-BUILD_NUM = 2045
+BUILD_NUM = 2056
/*
- * Acess2 GUI Shell
+ * Acess2 GUI Test App
* - By John Hodge (thePowersGang)
*/
#include <axwin/axwin.h>
// === CODE ===
int main(int argc, char *argv[])
-{
+{
+ AxWin_Register("Terminal");
+
// Create Window
- ghMenubarWindow = AxWin_CreateWindow(0, 0, -1, -1, WINFLAG_NOBORDER, Menubar_HandleMessage);
+ //ghMenubarWindow = AxWin_CreateWindow(0, 0, -1, -1, WINFLAG_NOBORDER, Menubar_HandleMessage);
AxWin_MessageLoop();
CPPFLAGS += -I../include
-DIR = Apps/AxWin/1.0
-BIN = ../AxWinWM
-OBJ = main.o helpers.o commandline.o video.o messages.o
+DIR := Apps/AxWin/1.0
+BIN := ../AxWinWM
+OBJ := main.o helpers.o commandline.o video.o
+OBJ += messages.o interface.o
-include ../../Makefile.tpl
// === Functions ===
extern void memset32(void *ptr, uint32_t val, size_t count);
+extern void Video_FillRect(short X, short Y, short W, short H, uint32_t Color);
+extern void Video_Update(void);
#endif
--- /dev/null
+/*
+ * Acess GUI (AxWin) Version 2
+ * By John Hodge (thePowersGang)
+ */
+#include "common.h"
+
+// === CODE ===
+void Interface_Render(void)
+{
+ Video_FillRect(
+ 0, 0,
+ giScreenWidth/16, giScreenHeight,
+ 0xDDDDDD);
+
+ Video_Update();
+}
// === IMPORTS ===
extern void ParseCommandline(int argc, char *argv[]);
-extern void Video_Setup();
+extern void Video_Setup(void);
+extern void Messages_PollIPC(void);
// === GLOBALS ===
char *gsTerminalDevice = NULL;
}
Video_Setup();
+ Interface_Render();
// Main Loop
for(;;)
{
case MSG_SREQ_PING:
Msg->ID = MSG_SRSP_PONG;
- Respond(ID, sizeof(Msg->ID), Msg);
+ Msg->Size = 2;
+ Msg->SRsp_Pong.Major = 0;
+ Msg->SRsp_Pong.Minor = 1;
+ Msg->SRsp_Pong.Build = -1;
+ Messages_RespondIPC(ID, sizeof(Msg->ID), Msg);
break;
default:
fprintf(stderr, "WARNING: Unknown message %i from %i (%p)\n", Msg->ID, ID, Respond);
#include <acess/devices/terminal.h>
// === PROTOTYPES ===
-void Video_Setup();
-void Video_Update();
+void Video_Setup(void);
+void Video_Update(void);
+void Video_FillRect(short X, short Y, short W, short H, uint32_t Color);
// === GLOBALS ===
// === CODE ===
-void Video_Setup()
+void Video_Setup(void)
{
int tmpInt;
Video_Update();
}
-void Video_Update()
+void Video_Update(void)
{
- seek(giTerminalFD, 0, SEEK_SET);
+ //seek(giTerminalFD, 0, SEEK_SET);
+ seek(giTerminalFD, 0, 1);
write(giTerminalFD, giScreenWidth*giScreenHeight*4, gpScreenBuffer);
}
+
+void Video_FillRect(short X, short Y, short W, short H, uint32_t Color)
+{
+ uint32_t *buf = gpScreenBuffer + Y*giScreenWidth + X;
+
+ while( H -- )
+ {
+ memset32( buf, Color, W );
+ buf += giScreenWidth;
+ }
+}
CFLAGS += -Wall
LDFLAGS += -lc -soname libaxwin2.so
-OBJ = main.o messages.o windows.o
+OBJ = main.o messages.o
BIN = ../libaxwin2.so
include ../Makefile.tpl
// === Variables ===
extern int giAxWin_Mode;
+extern int giAxWin_PID;
#endif
* main.c - Library Initialisation
*/
#include "common.h"
+#include <string.h>
// === GLOBALS ===
int giAxWin_Mode = 0;
+ int giAxWin_PID = 0;
// === CODE ===
int SoMain()
{
return 0;
}
+
+int AxWin_Register(const char *Name)
+{
+ tAxWin_Message req;
+ tAxWin_Message *msg;
+ tAxWin_RetMsg *ret;
+ int len = strlen(Name);
+
+ req.ID = MSG_SREQ_REGISTER;
+ req.Size = 1 + (len+1)/4;
+ strcpy(req.Data, Name);
+
+ AxWin_SendMessage(&req);
+
+ for(;;)
+ {
+ msg = AxWin_WaitForMessage();
+
+ if(msg->ID == MSG_SREQ_ADDTAB)
+ {
+ ret = (void*) &msg->Data[0];
+ if( ret->ReqID == MSG_SREQ_REGISTER )
+ break;
+ }
+
+ AxWin_HandleMessage(msg);
+ free(msg);
+ }
+
+ return !!ret->Bool;
+}
+
+tAxWin_Handle AxWin_AddTab(const char *Title)
+{
+ tAxWin_Message req;
+ tAxWin_Message *msg;
+ tAxWin_RetMsg *ret;
+ int len = strlen(Title);
+
+ req.ID = MSG_SREQ_ADDTAB;
+ req.Size = 1 + (len+1)/4;
+ strcpy(req.Data, Title);
+
+ for(;;)
+ {
+ msg = AxWin_WaitForMessage();
+
+ if(msg->ID == MSG_SRSP_RETURN)
+ {
+ ret = (void*) &msg->Data[0];
+ if( ret->ReqID == MSG_SREQ_ADDTAB )
+ break;
+ }
+
+ AxWin_HandleMessage(msg);
+ free(msg);
+ }
+
+ return (tAxWin_Handle) ret->Handle;
+}
tAxWin_Message *AxWin_WaitForMessage();
int AxWin_HandleMessage(tAxWin_Message *Message);
+// === ===
+
// === CODE ===
+int AxWin_SendMessage(tAxWin_Message *Message)
+{
+ switch(giAxWin_Mode)
+ {
+ case AXWIN_MODE_IPC:
+ SysSendMessage(giAxWin_PID, Message->Size*4, Message);
+ break;
+ default:
+ break;
+ }
+ return 0;
+}
+
/**
* \brief Loop forever, checking and waiting for messages
*/
{
struct sAxWin_Window *Next;
uint32_t WmHandle;
- tAxWin_MessageCallback Callback;
+ tAxWin_MessageCallback *Callback;
};
// === PROTOTYPES ===
-tAxWin_Handle AxWin_CreateWindow(
+tAxWin_Window *AxWin_CreateWindow(
int16_t X, int16_t Y, int16_t W, int16_t H,
uint32_t Flags, tAxWin_MessageCallback *Callback
);
tAxWin_Window *gProcessWindows;
// === CODE ===
-tAxWin_Handle AxWin_CreateWindow(
+tAxWin_Window *AxWin_CreateWindow(
int16_t X, int16_t Y,
int16_t W, int16_t H,
uint32_t Flags, tAxWin_MessageCallback *Callback)
/*
* Acess2 System Interface Header
*/
-#ifndef _SYS_SYS_H_
-#define _SYS_SYS_H_
+#ifndef _ACESS_SYS_H_
+#define _ACESS_SYS_H_
#include <stdint.h>
+#include <sys/types.h>
// === CONSTANTS ===
#ifndef NULL
#define FILEFLAG_SYMLINK 0x20
// === TYPES ===
-typedef uint pid_t;
-
struct s_sysACL {
union {
struct {
extern int execve(char *path, char **argv, char **envp);
extern int gettid();
extern int getpid();
+extern int _SysSetFaultHandler(int (*Handler)(int));
// --- Permissions ---
extern int getuid();
extern void close(int fd);
extern uint read(int fd, uint length, void *buffer);
extern uint write(int fd, uint length, void *buffer);
-extern int seek(int fd, uint64_t offset, int whence);
+extern int seek(int fd, int64_t offset, int whence);
extern uint64_t tell(int fd);
extern int ioctl(int fd, int id, void *data);
extern int finfo(int fd, t_sysFInfo *info, int maxacls);
#define _AXWIN_AXWIN_H
// === Core Types ===
-typedef unsigned int tAxWin_Handle;
+typedef void *tAxWin_Handle;
// === Messaging ===
#include "messages.h"
extern int AxWin_MessageLoop();
+extern int AxWin_SendMessage(tAxWin_Message *Message);
+extern tAxWin_Message *AxWin_WaitForMessage(void);
+extern int AxWin_HandleMessage(tAxWin_Message *Message);
// === Window Control ===
/**
/**
* \}
*/
-extern tAxWin_Window AxWin_CreateWindow(
+extern tAxWin_Window *AxWin_CreateWindow(
int16_t X, int16_t Y, int16_t W, int16_t H,
uint32_t Flags, tAxWin_MessageCallback *Callback);
#include <stdint.h>
typedef struct sAxWin_Message tAxWin_Message;
+typedef struct sAxWin_RetMsg tAxWin_RetMsg;
+
+// Higherarchy:
+// - HANDLE
+// + ELEMENT
+// > DIALOG
+// > TAB
/**
* \brief Message IDs
// - Windows
MSG_SREQ_REGISTER, // bool (char[] Name) - Registers this PID with the Window Manager
- MSG_SREQ_ADDTAB, // ELEMENT (char[] Name) - Adds a tab to the window
+ MSG_SREQ_ADDTAB, // TAB (char[] Name) - Adds a tab to the window
MSG_SREQ_DELTAB, // void (TAB Tab) - Closes a tab
- MSG_SREQ_NEWDIALOG, // ELEMENT (ELEMENT Parent, char[] Name) - Creates a dialog
- MSG_SREQ_DELDIALOG, // void (ELEMENT Dialog) - Closes a dialog
+ MSG_SREQ_NEWDIALOG, // DIALOG (TAB Parent, char[] Name) - Creates a dialog
+ MSG_SREQ_DELDIALOG, // void (DIALOG Dialog) - Closes a dialog
MSG_SREQ_SETNAME, // void (ELEMENT Element, char[] Name)
MSG_SREQ_GETNAME, // char[] (ELEMENT Element)
{
uint16_t ID;
uint16_t Size; //!< Size in DWORDS
+ char Data[];
+};
+
+struct sAxWin_RetMsg
+{
+ uint16_t ReqID;
+ uint16_t Rsvd;
union
{
- struct sAxWin_SReq_Ping SReq_Pong;
- struct sAxWin_SReq_NewWindow SReq_NewWindow;
-
- // Server Responses
- struct sAxWin_SRsp_Pong SRsp_Pong;
- struct sAxWin_SRsp_NewWindow SRsp_Window;
+ uint8_t Bool;
+ uint32_t Handle;
+ int Integer;
};
};
/*\r
Syscall Definitions\r
*/\r
+#ifndef _SYS_SYS_H_\r
+#define _SYS_SYS_H_\r
\r
#include <sys/types.h>\r
\r
extern int read(int fp, int len, void *buf);\r
extern int write(int fp, int len, void *buf);\r
extern int tell(int fp);\r
-extern void seek(int fp, int dist, int flag);\r
+extern void seek(int fp, int64_t dist, int flag);\r
extern int fstat(int fp, t_fstat *st);\r
extern int ioctl(int fp, int call, void *arg);\r
extern int readdir(int fp, char *file);\r
extern int pollmsg(int *src, unsigned int *Data);\r
extern int getmsg(int *src, unsigned int *Data);\r
\r
-extern int _SysSetFaultHandler(int (*Handler)(int));\r
+#endif\r
+\r
+#endif\r
-
+/*
+ */
#ifndef _SYS_TYPES_H
#define _SYS_TYPES_H
+#include <stdint.h>
typedef struct {
int st_dev; //dev_t
#define S_IFSOCK 0140000 /* socket */
#define S_IFIFO 0010000 /* fifo */
+
+typedef uint32_t pid_t;
+typedef uint32_t tid_t;
+typedef int64_t time_t;
+
#endif