*/
#include <stdlib.h>
#include <axwin3/axwin.h>
+#include <axwin3/widget.h>
// === GLOBALS ===
tHWND gSidebar;
// Create sidebar
// TODO: Use the widget library instead
- gSidebar = AxWin3_CreateWindow(NULL, "Widget", 0, 0, NULL, sidebar_callback);
-
// TODO: Get screen dimensions somehow
+ gSidebar = AxWin3_Widget_CreateWindow(NULL, 32, 600, 0);
- // Size the window
- AxWin3_SetWindowPos(gSidebar, 0, 0, 32, 600);
+ AxWin3_MoveWindow(gSidebar, 0, 0);
// Show!
AxWin3_ShowWindow(gSidebar, 1);
-include ../../Makefile.cfg
-# Some evil lazy evaulation, hopefully it works
-CPPFLAGS += -I include/
+CPPFLAGS += -I include/ -I ../include/
DIR := Apps/AxWin/3.0
BIN := AxWinWM
+++ /dev/null
-/*
- * Acess2 Window Manager v3
- * - By John Hodge (thePowersGang)
- *
- * ipcmessages.h
- * - IPC Message format definition
- * - Shared between library and server
- */
-#ifndef _IPCMESSAGES_H_
-#define _IPCMESSAGES_H_
-
-#include <stdint.h>
-
-typedef struct sAxWin_IPCMessage tAxWin_IPCMessage;
-typedef struct sIPCMsg_Return tIPCMsg_Return;
-typedef struct sIPCMsg_CreateWin tIPCMsg_CreateWin;
-typedef struct sIPCMsg_ShowWindow tIPCMsg_ShowWindow;
-typedef struct sIPCMsg_SetWindowPos tIPCMsg_SetWindowPos;
-
-/**
- * \name Flags for IPC Messages
- * \{
- */
-//! Request a return value
-#define IPCMSG_FLAG_RETURN 0x01
-/**
- * \}
- */
-
-struct sAxWin_IPCMessage
-{
- uint8_t ID;
- uint8_t Flags;
- uint16_t Size;
- uint32_t Window;
- char Data[];
-};
-
-struct sIPCMsg_Return
-{
- uint32_t Value;
-};
-
-struct sIPCMsg_CreateWin
-{
- uint32_t NewWinID;
- uint32_t Flags;
- char Renderer[];
-};
-
-struct sIPCMsg_ShowWindow
-{
- uint32_t bShow;
-};
-
-struct sIPCMsg_SetWindowPos
-{
- int16_t X;
- int16_t Y;
- uint16_t W;
- uint16_t H;
- uint8_t Fields;
-};
-
-enum eAxWin_IPCMessageTypes
-{
- IPCMSG_PING, //!< Get the server version
- IPCMSG_SENDMSG, //!< Send a message to another window (or to self)
- IPCMSG_CREATEWIN, //!< Create a window
- IPCMSG_DESTROYWIN, //!< Destroy a window
- IPCMSG_SHOWWINDOW, //!< Show/Hide a window
- IPCMSG_SETWINPOS, //!< Set a window position
-};
-
-#endif
* \note \a Flags is provided for convinience, the caller will
* set the copy in the window structure.
*/
- tWindow *(*CreateWindow)(int Flags);
+ tWindow *(*CreateWindow)(int Arg);
/**
* \brief Redraw a window on the screen
return 1;
// - Create the new window, and save its pointer
- newwin = WM_CreateWindow(parent, info->Flags, info->Renderer);
+ newwin = WM_CreateWindow(parent, info->RendererArg, info->Renderer);
IPC_int_SetWindow(Client, info->NewWinID, newwin);
return 0;
gpWM_Renderers = Renderer;
}
-tWindow *WM_CreateWindow(tWindow *Parent, int Flags, const char *RendererName)
+tWindow *WM_CreateWindow(tWindow *Parent, int RendererArg, const char *RendererName)
{
tWMRenderer *renderer;
tWindow *ret;
return NULL;
// - Call create window function
- ret = renderer->CreateWindow(Flags);
-
- // - Fill common fields on that
- ret->Flags = Flags;
+ ret = renderer->CreateWindow(RendererArg);
// - Return!
return ret;
--- /dev/null
+/*
+ * Acess2 Window Manager v3
+ * - By John Hodge (thePowersGang)
+ *
+ * ipcmessages.h
+ * - IPC Message format definition
+ * - Shared between library and server
+ */
+#ifndef _IPCMESSAGES_H_
+#define _IPCMESSAGES_H_
+
+#include <stdint.h>
+
+typedef struct sAxWin_IPCMessage tAxWin_IPCMessage;
+typedef struct sIPCMsg_Return tIPCMsg_Return;
+typedef struct sIPCMsg_CreateWin tIPCMsg_CreateWin;
+typedef struct sIPCMsg_ShowWindow tIPCMsg_ShowWindow;
+typedef struct sIPCMsg_SetWindowPos tIPCMsg_SetWindowPos;
+
+/**
+ * \name Flags for IPC Messages
+ * \{
+ */
+//! Request a return value
+#define IPCMSG_FLAG_RETURN 0x01
+/**
+ * \}
+ */
+
+struct sAxWin_IPCMessage
+{
+ uint8_t ID;
+ uint8_t Flags;
+ uint16_t Size;
+ uint32_t Window;
+ char Data[];
+};
+
+struct sIPCMsg_Return
+{
+ uint32_t Value;
+};
+
+struct sIPCMsg_CreateWin
+{
+ uint32_t NewWinID;
+ uint32_t RendererArg;
+ char Renderer[];
+};
+
+struct sIPCMsg_ShowWindow
+{
+ uint32_t bShow;
+};
+
+struct sIPCMsg_SetWindowPos
+{
+ int16_t X;
+ int16_t Y;
+ uint16_t W;
+ uint16_t H;
+ uint8_t Fields;
+};
+
+enum eAxWin_IPCMessageTypes
+{
+ IPCMSG_PING, //!< Get the server version
+ IPCMSG_SENDMSG, //!< Send a message to another window (or to self)
+ IPCMSG_CREATEWIN, //!< Create a window
+ IPCMSG_DESTROYWIN, //!< Destroy a window
+ IPCMSG_SHOWWINDOW, //!< Show/Hide a window
+ IPCMSG_SETWINPOS, //!< Set a window position
+};
+
+#endif
include ../../../Libraries/Makefile.cfg
-CPPFLAGS +=
+CPPFLAGS += -I ../include/
CFLAGS += -Wall
LDFLAGS += -lc -soname libaxwin3.so
#ifndef _INTERNAL_H_
#define _INTERNAL_H_
+#include <stdint.h>
+
struct sAxWin3_Window
{
uint32_t ServerID;
char Data[];
};
-extern const char *gsAxWin3_int_ServerDesc;
-
-extern tAxWin_IPCMessage *AxWin3_int_AllocateIPCMessage(tHWND Window, int Message, int Flags, int ExtraBytes);
-extern void AxWin3_int_SendIPCMessage(tAxWin_IPCMessage *Msg);
-extern tAxWin_IPCMessage *AxWin3_int_GetIPCMessage(void);
+extern void *AxWin3_int_GetDataPtr(tHWND Window);
#endif
* Acess2 Window Manager v3
* - By John Hodge (thePowersGang)
*
- * ipcmessages.h
- * - IPC Message format definition
+ * internal.h
+ * - Internal definitions
*/
-#ifndef _IPCMESSAGES_LIB_H_
-#define _IPCMESSAGES_LIB_H_
+#ifndef _IPC_H_
+#define _IPC_H_
+
+#include <ipcmessages.h>
+
+extern const char *gsAxWin3_int_ServerDesc;
+
+extern tAxWin_IPCMessage *AxWin3_int_AllocateIPCMessage(tHWND Window, int Message, int Flags, int ExtraBytes);
+extern void AxWin3_int_SendIPCMessage(tAxWin_IPCMessage *Msg);
+extern tAxWin_IPCMessage *AxWin3_int_GetIPCMessage(void);
-#include "../../WM/include/ipcmessages.h"
#endif
* - Entrypoint and setup
*/
#include <axwin3/axwin.h>
-#include "include/ipc.h"
#include "include/internal.h"
+#include "include/ipc.h"
// === CODE ===
int SoMain(void *Base, int argc, const char *argv[], const char **envp)
#include <acess/sys.h>
#include <string.h>
#include <stdlib.h>
-#include "include/ipc.h"
+#include <ipcmessages.h> // AxWin3 common
#include "include/internal.h"
// === CONSTANTS ===
+/*
+ * AxWin3 Interface Library
+ * - By John Hodge (thePowersGang)
+ *
+ * main.c
+ * - Entrypoint and setup
+ */
+#include <axwin3/axwin.h>
+#include <axwin3/widget.h>
+#include "include/internal.h"
+
+// === STRUCTURES ===
+typedef struct
+{
+ // Callbacks for each element
+} tWidgetWindowInfo;
+
+// === CODE ===
+int AxWin3_Widget_MessageHandler(tHWND Window, int Size, void *Data)
+{
+ return 0;
+}
+
+tHWND AxWin3_Widget_CreateWindow(tHWND Parent, int W, int H, int RootEleFlags)
+{
+ tHWND ret;
+ tWidgetWindowInfo *info;
+
+ ret = AxWin3_CreateWindow(
+ Parent, "Widget", RootEleFlags,
+ sizeof(*info), AxWin3_Widget_MessageHandler
+ );
+ info = AxWin3_int_GetDataPtr(ret);
+
+ return ret;
+}
+
#include <axwin3/axwin.h>
#include <stdlib.h>
#include <string.h>
-#include "include/ipc.h"
#include "include/internal.h"
+#include "include/ipc.h"
#define WINDOWS_PER_ALLOC (63)
}
tHWND AxWin3_CreateWindow(
- tHWND Parent, const char *Renderer, int Flags,
- int DataBytes, void **DataPtr,
- tAxWin3_WindowMessageHandler MessageHandler
+ tHWND Parent, const char *Renderer, int RendererArg,
+ int DataBytes, tAxWin3_WindowMessageHandler MessageHandler
)
{
tWindow *ret;
msg = AxWin3_int_AllocateIPCMessage(Parent, IPCMSG_CREATEWIN, 0, dataSize);
create_win = (void*)msg->Data;
create_win->NewWinID = newWinID;
- create_win->Flags = Flags;
+ create_win->RendererArg = RendererArg;
strcpy(create_win->Renderer, Renderer);
// Send and clean up
// TODO: Detect and handle possible errors
// Return success
- if(DataPtr) *DataPtr = ret->Data;
return ret;
}
free(msg);
}
+void *AxWin3_int_GetDataPtr(tHWND Window)
+{
+ return &Window->Data;
+}
+
void AxWin3_ShowWindow(tHWND Window, int bShow)
{
tAxWin_IPCMessage *msg;
$(_OBJPREFIX)%.o: %.c
@echo [CC] -o $@
@mkdir -p $(dir $@)
- @$(CC) $(CFLAGS) -o $@ -c $<
+ @$(CC) $(CFLAGS) $(CPPFLAGS) -o $@ -c $<
$(_OBJPREFIX)%.ao: %.$(ASSUFFIX)
+++ /dev/null
-../Applications/axwin3_src/libaxwin3.so/
\ No newline at end of file
--- /dev/null
+all clean install all-install: ;
+ @$(MAKE) --no-print-directory -C ../../Applications/axwin3_src/libaxwin3.so_src/ $*
typedef int (*tAxWin3_WindowMessageHandler)(tHWND Window, int Length, void *Data);
+// --- Connection management
extern void AxWin3_Connect(const char *ServerDesc);
extern tAxWin3_MessageCallback AxWin3_SetMessageCallback(tAxWin3_MessageCallback Callback);
extern void AxWin3_MainLoop(void);
-extern tHWND AxWin3_CreateWindow(tHWND Parent, const char *Renderer, int Flags, int DataBytes, void **DataPtr,
- tAxWin3_WindowMessageHandler MessageHandler);
+// --- Window creation/deletion
+/**
+ * \brief Create a new window (with the required client structures)
+ * \param Parent Parent window handle
+ * \param Renderer Symbolic name of the renderer to use
+ * \param RendererArg Argument to pass to the renderer's initialisation
+ * \param DataBytes Number of bytes to allocate for the caller's use
+ * \param MessageHandler Function to call when a message arrives for the window
+ * \return New window handle
+ * \note Usually wrapped by renderer-specific functions
+ */
+extern tHWND AxWin3_CreateWindow(
+ tHWND Parent,
+ const char *Renderer, int RendererArg,
+ int DataBytes,
+ tAxWin3_WindowMessageHandler MessageHandler
+ );
+/**
+ * \brief Destroy a window
+ * \param Window Handle to a window to destroy
+ */
extern void AxWin3_DestroyWindow(tHWND Window);
+// --- Core window management functions
extern void AxWin3_SendMessage(tHWND Window, int Length, void *Data);
extern void AxWin3_ShowWindow(tHWND Window, int bShow);
extern void AxWin3_SetWindowPos(tHWND Window, short X, short Y, short W, short H);
--- /dev/null
+/*
+ * Acess2 GUI Version 3 (AxWin3)
+ * - By John Hodge (thePowersGang)
+ *
+ * widget.h
+ * - Server-side widget library
+ */
+#ifndef _AXWIN3_WIDGET_H_
+#define _AXWIN3_WIDGET_H_
+
+#include "axwin.h"
+
+extern tHWND AxWin3_Widget_CreateWindow(tHWND Parent, int W, int H, int RootEleFlags);
+
+#endif
+