DIR := Apps/AxWin/3.0
BIN := AxWinWM
-OBJ := main.o wm.o input.o ipc.o
+OBJ := main.o wm.o input.o video.o ipc.o
OBJ += messageio.o
OBJ += renderer_classes.o renderer_passthru.o renderer_widget.o
#define TODO(str)
+#define UNIMPLEMENTED() do{_SysDebug("TODO: Implement %s", __func__); for(;;);}while(0)
+
+#define AXWIN_VERSION 0x300
+
+// === GLOBALS ===
+extern int giTerminalFD;
+extern const char *gsTerminalDevice;
+
+extern int giScreenWidth, giScreenHeight;
+
// === FUNCTIONS ===
// --- Input ---
- int Input_Init(void);
-void Input_FillSelect(int *nfds, fd_set *set);
-void Input_HandleSelect(fd_set *set);
+extern int Input_Init(void);
+extern void Input_FillSelect(int *nfds, fd_set *set);
+extern void Input_HandleSelect(fd_set *set);
// --- IPC ---
-void IPC_Init(void);
-void IPC_FillSelect(int *nfds, fd_set *set);
-void IPC_HandleSelect(fd_set *set);
+extern void IPC_Init(void);
+extern void IPC_FillSelect(int *nfds, fd_set *set);
+extern void IPC_HandleSelect(fd_set *set);
#endif
#ifndef _IPCMESSAGES_H_
#define _IPCMESSAGES_H_
-typedef struct sAxWin_IPCMessage tAxWin_IPCMessage;
+typedef struct sAxWin_IPCMessage tAxWin_IPCMessage;
+typedef struct sIPCMsg_Return tIPCMsg_Return;
/**
* \name Flags for IPC Messages
* \{
*/
//! Request a return value
-#define IPCMSG_FLAG_RETURN 1
+#define IPCMSG_FLAG_RETURN 0x01
struct sAxWin_IPCMessage
{
- uint16_t ID;
- uint16_t Flags;
+ uint8_t ID;
+ uint8_t Flags;
+ uint16_t Size;
+ uint32_t Window;
char Data[];
};
+struct sIPCMsg_Return
+{
+ uint32_t Value;
+};
+
enum eAxWin_IPCMessageTypes
{
IPCMSG_PING, //!<
extern int WM_SetFlags(tWindow *Window, int Flags);
extern int WM_SendMessage(tWindow *Window, int MessageID, int Length, void *Data);
// --- Rendering
-extern void Render_DrawFilledRect(tWindow *Window, tColour Colour, int X, int Y, int W, int H);
+extern void WM_Render_FilledRect(tWindow *Window, tColour Colour, int X, int Y, int W, int H);
#endif
#include <net.h>
#include <string.h>
#include <ipcmessages.h>
+#include <stdio.h>
#define AXWIN_PORT 4101
void IPC_Init(void);
void IPC_FillSelect(int *nfds, fd_set *set);
void IPC_HandleSelect(fd_set *set);
-void IPC_Handle(tIPC_Type *IPCType, void *Ident, size_t MsgLen, tAxWin_Message *Msg);
+void IPC_Handle(tIPC_Type *IPCType, void *Ident, size_t MsgLen, tAxWin_IPCMessage *Msg);
void IPC_ReturnValue(tIPC_Type *IPCType, void *Ident, int MessageID, uint32_t Value);
int IPC_Type_Datagram_GetSize(void *Ident);
int IPC_Type_Datagram_Compare(void *Ident1, void *Ident2);
void IPC_Handle(tIPC_Type *IPCType, void *Ident, size_t MsgLen, tAxWin_IPCMessage *Msg)
{
- tApplication *app;
- tElement *ele;
-
_SysDebug("IPC_Handle: (IPCType=%p, Ident=%p, MsgLen=%i, Msg=%p)",
IPCType, Ident, MsgLen, Msg);
- if( MsgLen < sizeof(tAxWin_Message) )
+ if( MsgLen < sizeof(tAxWin_IPCMessage) )
return ;
- if( MsgLen < sizeof(tAxWin_Message) + Msg->Size )
+ if( MsgLen < sizeof(tAxWin_IPCMessage) + Msg->Size )
return ;
- app = AxWin_GetClient(IPCType, Ident);
+// win = AxWin_GetClient(IPCType, Ident, Msg->Window);
switch((enum eAxWin_IPCMessageTypes) Msg->ID)
{
// --- Ping message (reset timeout and get server version)
case IPCMSG_PING:
_SysDebug(" IPC_Handle: IPCMSG_PING");
- if( MsgLen < sizeof(tAxWin_Message) + 4 ) return;
+ if( MsgLen < sizeof(tAxWin_IPCMessage) + 4 ) return;
if( Msg->Flags & IPCMSG_FLAG_RETURN )
{
Msg->ID = IPCMSG_PING;
}
}
-void IPC_ReturnValue(tIPC_Type *IPCType, void *Ident, int MessageID, uint32_t Value)
-{
- char data[sizeof(tAxWin_Message) + sizeof(tAxWin_RetMsg)];
- tAxWin_Message *msg = (void *)data;
- tAxWin_RetMsg *ret_msg = (void *)msg->Data;
-
- msg->Source = 0; // 0 = Server
- msg->ID = MSG_SRSP_RETURN;
- msg->Size = sizeof(tAxWin_RetMsg);
- ret_msg->ReqID = MessageID;
- ret_msg->Rsvd = 0;
- ret_msg->Value = Value;
-
- IPCType->SendMessage(Ident, sizeof(data), data);
-}
-
int IPC_Type_Datagram_GetSize(void *Ident)
{
return 4 + Net_GetAddressSize( ((uint16_t*)Ident)[1] );
// === IMPORTS ===
extern void WM_Update(void);
+extern void Video_Setup(void);
// === PROTOTYPES ===
void ParseCommandline(int argc, char **argv);
gsMouseDevice = "/Devices/PS2Mouse";
}
-// Video_Setup();
+ Video_Setup();
// Interface_Init();
IPC_Init();
Input_Init();
void Renderer_Class_Redraw(tWindow *Window)
{
tClassfulInfo *info = Window->RendererInfo;
- Render_DrawFilledRect(Window, info->BGColour, 0, 0, Window->W, Window->H);
+ WM_Render_FilledRect(Window, info->BGColour, 0, 0, Window->W, Window->H);
}
int Renderer_Class_HandleMessage(tWindow *Target, int Msg, int Len, void *Data)
--- /dev/null
+/*
+ */
+#ifndef _RESORUCE_CURSOR_H
+#define _RESORUCE_CURSOR_H
+
+#include <stdint.h>
+
+static struct {
+ uint16_t W, H, OfsX, OfsY;
+ uint32_t Data[];
+} cCursorBitmap = {
+ 8, 16, 0, 0,
+ {
+ 0xFF000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0xFF000000, 0xFF000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0xFF000000, 0xFFFFFFFF, 0xFF000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0xFF000000, 0xFFFFFFFF, 0xFFFFFFFF, 0xFF000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0xFF000000, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFF000000, 0x00000000, 0x00000000, 0x00000000,
+ 0xFF000000, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFF000000, 0x00000000, 0x00000000,
+ 0xFF000000, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFF000000, 0x00000000,
+ 0xFF000000, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFF000000, 0xFF000000, 0xFF000000,
+ 0xFF000000, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFF000000, 0x00000000, 0x00000000,
+ 0xFF000000, 0xFF000000, 0xFF000000, 0xFFFFFFFF, 0xFFFFFFFF, 0xFF000000, 0x00000000, 0x00000000,
+ 0xFF000000, 0x00000000, 0x00000000, 0xFF000000, 0xFFFFFFFF, 0xFFFFFFFF, 0xFF000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0xFF000000, 0xFFFFFFFF, 0xFFFFFFFF, 0xFF000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xFF000000, 0xFFFFFFFF, 0xFFFFFFFF, 0xFF000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xFF000000, 0xFFFFFFFF, 0xFFFFFFFF, 0xFF000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xFF000000, 0xFF000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000
+ }
+};
+
+#endif
+
* video.c
* - Video methods
*/
-#include "common.h"
+#include <common.h>
#include <acess/sys.h>
#include <acess/devices/terminal.h>
#include <image.h>
#include "resources/cursor.h"
+#include <stdio.h>
// === PROTOTYPES ===
void Video_Setup(void);
// === GLOBALS ===
int giVideo_CursorX;
int giVideo_CursorY;
+uint32_t *gpScreenBuffer;
// === CODE ===
void Video_Setup(void)
// Create local framebuffer (back buffer)
gpScreenBuffer = malloc( giScreenWidth*giScreenHeight*4 );
- memset32( gpScreenBuffer, 0x8888FF, giScreenWidth*giScreenHeight );
+ Video_FillRect(0, 0, giScreenWidth, giScreenHeight, 0x8080FF);
// Set cursor position and bitmap
ioctl(giTerminalFD, TERM_IOCTL_SETCURSORBITMAP, &cCursorBitmap);
void Video_FillRect(short X, short Y, short W, short H, uint32_t Color)
{
+ int i;
uint32_t *buf = gpScreenBuffer + Y*giScreenWidth + X;
_SysDebug("Video_FillRect: (X=%i, Y=%i, W=%i, H=%i, Color=%08x)",
while( H -- )
{
- memset32( buf, Color, W );
- buf += giScreenWidth;
+ for( i = W; i --; )
+ *buf++ = Color;
+ buf += giScreenWidth - W;
}
}
// === CODE ===
void WM_RegisterRenderer(tWMRenderer *Renderer)
{
- TODO("Implement WM_RegisterRenderer");
+ UNIMPLEMENTED();
}
tWindow *WM_CreateWindowStruct(size_t ExtraSize)
return NULL;
}
+void WM_Render_FilledRect(tWindow *Window, tColour Colour, int X, int Y, int W, int H)
+{
+ UNIMPLEMENTED();
+}
+