Usermode/AxWin3 - Fiddling
authorJohn Hodge <[email protected]>
Thu, 27 Oct 2011 12:20:17 +0000 (20:20 +0800)
committerJohn Hodge <[email protected]>
Thu, 27 Oct 2011 12:20:17 +0000 (20:20 +0800)
Usermode/Applications/axwin3_src/WM/include/renderer_classful.h [new file with mode: 0644]
Usermode/Applications/axwin3_src/WM/include/wm_internals.h [new file with mode: 0644]
Usermode/Applications/axwin3_src/WM/include/wm_messages.h [new file with mode: 0644]
Usermode/Applications/axwin3_src/WM/include/wm_renderer.h
Usermode/Applications/axwin3_src/WM/renderer_classes.c
Usermode/Applications/axwin3_src/WM/renderer_passthru.c
Usermode/Applications/axwin3_src/WM/renderer_widget.c

diff --git a/Usermode/Applications/axwin3_src/WM/include/renderer_classful.h b/Usermode/Applications/axwin3_src/WM/include/renderer_classful.h
new file mode 100644 (file)
index 0000000..5e93de8
--- /dev/null
@@ -0,0 +1,20 @@
+/*
+ * Acess2 Window Manager v3 (axwin3)
+ * - By John Hodge (thePowersGang)
+ *
+ * include/renderer_classful.h
+ * - Classful renderer messages
+ */
+#ifndef _RENDERER_CLASSFUL_H_
+#define _RENDERER_CLASSFUL_H_
+
+#include "wm_messages.h"
+
+enum eWM_Classful_Messages
+{
+       MSG_CLASSFUL_SETBGCOLOUR = WNDMSG_CLASS_MIN,
+       MSG_CLASSFUL_SETTEXT
+};
+
+#endif
+
diff --git a/Usermode/Applications/axwin3_src/WM/include/wm_internals.h b/Usermode/Applications/axwin3_src/WM/include/wm_internals.h
new file mode 100644 (file)
index 0000000..b5aa978
--- /dev/null
@@ -0,0 +1,28 @@
+/*
+ * Acess2 Window Manager v3 (axwin3)
+ * - By John Hodge (thePowersGang)
+ *
+ * include/wm_internals.h
+ * - Window management internal definitions
+ */
+#ifndef _WM_INTERNALS_H_
+#define _WM_INTERNALS_H_
+
+#include <wm.h>
+
+struct sWindow
+{
+       uint32_t        ID;
+       tWMRenderer     *Renderer;
+       
+        int    X;
+        int    Y;
+        int    W;
+        int    H;
+
+       void    *RendererInfo;  
+
+};
+
+#endif
+
diff --git a/Usermode/Applications/axwin3_src/WM/include/wm_messages.h b/Usermode/Applications/axwin3_src/WM/include/wm_messages.h
new file mode 100644 (file)
index 0000000..0bebfda
--- /dev/null
@@ -0,0 +1,30 @@
+/*
+ * Acess2 Window Manager v3 (axwin3)
+ * - By John Hodge (thePowersGang)
+ *
+ * include/wm_messages.h
+ * - Core window messages
+ */
+#ifndef _WM_MESSAGES_H_
+#define _WM_MESSAGES_H_
+
+enum eWM_WindowMessages
+{
+       WNDMSG_NULL,
+       
+       WNDMSG_CREATE,
+       WNDMSG_DESTROY,
+       WNDMSG_FOCUS,   // Called on change
+       WNDMSG_SHOW,    // Called on change
+       
+       WNDMSG_MOUSEMOVE,
+       WNDMSG_MOUSEBTN,
+       WNDMSG_KEYDOWN,
+       WNDMSG_KEYFIRE,
+       WNDMSG_KEYUP,
+       
+       WNDMSG_CLASS_MIN = 0x1000,
+       WNDMSG_CLASS_MAX = 0x2000,
+};
+
+#endif
index 165d38a..8e828eb 100644 (file)
@@ -1,14 +1,15 @@
 /*
-* Acess2 Window Manager v3 (axwin3)
-* - By John Hodge (thePowersGang)
-*
-* include/wm_renderer.h
-* - Window renderer API
-*/
+ * Acess2 Window Manager v3 (axwin3)
+ * - By John Hodge (thePowersGang)
+ *
+ * include/wm_renderer.h
+ * - Window renderer API
+ */
 #ifndef _WM_RENDERER_H_
 #define _WM_RENDERER_H_
 
 #include <wm.h>
+#include <wm_internals.h>
 
 struct sWMRenderer
 {
@@ -50,6 +51,7 @@ struct sWMRenderer
         * \param MessageID     Implementation defined message ID (usually the command)
         * \param Length        Length of the buffer \a Data
         * \param Data          Implementation defined data buffer
+        * \return Boolean failure (0: Handled, 1: Unhandled)
         */
         int    (*HandleMessage)(tWindow *Window, int MessageID, int Length, void *Data);
 };
index 7eea9ac..dfa447e 100644 (file)
@@ -7,6 +7,13 @@
  */
 #include <common.h>
 #include <wm_renderer.h>
+#include <renderer_classful.h>
+
+// === TYPES ===
+typedef struct sClassfulInfo
+{
+       tColour BGColour;
+} tClassfulInfo;
 
 // === PROTOTYPES ===
 tWindow        *Renderer_Class_Create(int Width, int Height, int Flags);
@@ -31,12 +38,12 @@ int Renderer_Class_Init(void)
 
 tWindow        *Renderer_Class_Create(int Width, int Height, int Flags)
 {
-       // TODO: Add info
-       return WM_CreateWindowStruct(0);
+       return WM_CreateWindowStruct(sizeof(tClassfulInfo));
 }
 
 void Renderer_Class_Redraw(tWindow *Window)
 {
+       tClassfulInfo   *info = Window->RendererInfo;
        Render_DrawFilledRect(Window, info->BGColour, 0, 0, Window->W, Window->H);
 }
 
@@ -48,11 +55,15 @@ int Renderer_Class_HandleMessage(tWindow *Target, int Msg, int Len, void *Data)
        case MSG_CLASSFUL_SETBGCOLOUR:
                if( Len != sizeof(uint32_t) ) return -1;
                info->BGColour = *(uint32_t*)Data;
-               break;
+               return 0;
 
        case MSG_CLASSFUL_SETTEXT:
                
-               break;
+               return -1;
+       
+       // Anything else is unhandled
+       default:
+               return 1;
        }
 }
 
index a75484c..d18dc40 100644 (file)
@@ -8,12 +8,17 @@
 #include <common.h>
 #include <wm_renderer.h>
 
+// === PROTOTYPES ===
+tWindow        *Renderer_Passthru_Create(int Width, int Height, int Flags);
+void   Renderer_Passthru_Redraw(tWindow *Window);
+ int   Renderer_Passthru_HandleMessage(tWindow *Target, int Msg, int Len, void *Data);
+
 // === GLOBALS ===
 tWMRenderer    gRenderer_Passthru = {
        .Name = "Passthru",
        .CreateWindow = Renderer_Passthru_Create,
        .Redraw = Renderer_Passthru_Redraw,
-       .SendMessage = Renderer_Passthru_SendMessage
+       .HandleMessage = Renderer_Passthru_HandleMessage
 };
 
 // === CODE ===
@@ -22,4 +27,19 @@ int Renderer_Passthru_Init(void)
        return 0;
 }
 
+tWindow        *Renderer_Passthru_Create(int Width, int Height, int Flags)
+{
+       return NULL;
+}
+
+void Renderer_Passthru_Redraw(tWindow *Window)
+{
+       
+}
+
+int Renderer_Passthru_HandleMessage(tWindow *Target, int Msg, int Len, void *Data)
+{
+       return 1;
+}
+
 
index 7407e5f..94f983d 100644 (file)
@@ -41,7 +41,7 @@ int Renderer_Widget_Init(void)
 tWindow        *Renderer_Widget_Create(int Width, int Height, int Flags)
 {
        // TODO: Add info
-       return WM_CreateWindowStruct(tWidgetWin_Info);
+       return WM_CreateWindowStruct( sizeof(tWidgetWin) );
 }
 
 void Renderer_Widget_Redraw(tWindow *Window)
@@ -50,10 +50,11 @@ void Renderer_Widget_Redraw(tWindow *Window)
 
 int Renderer_Widget_HandleMessage(tWindow *Target, int Msg, int Len, void *Data)
 {
-       tClassfulInfo   *info = Target->RendererInfo;
+       tWidgetWin      *info = Target->RendererInfo;
        switch(Msg)
        {
-
+       default:
+               return 1;       // Unhandled
        }
 }
 

UCC git Repository :: git.ucc.asn.au