git.ucc.asn.au
/
tpg
/
acess2.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
| inline |
side by side
Usermode/AxWin3 - Decorator resize and close, misc fixes
[tpg/acess2.git]
/
Usermode
/
Applications
/
axwin3_src
/
WM
/
ipc.c
diff --git
a/Usermode/Applications/axwin3_src/WM/ipc.c
b/Usermode/Applications/axwin3_src/WM/ipc.c
index
38cd133
..
51692a6
100644
(file)
--- a/
Usermode/Applications/axwin3_src/WM/ipc.c
+++ b/
Usermode/Applications/axwin3_src/WM/ipc.c
@@
-76,11
+76,11
@@
void IPC_Init(void)
{
int tmp;
// TODO: Check this
- giNetworkFileHandle =
o
pen("/Devices/ip/loop/udp", OPENFLAG_READ);
+ giNetworkFileHandle =
_SysO
pen("/Devices/ip/loop/udp", OPENFLAG_READ);
if( giNetworkFileHandle != -1 )
{
tmp = AXWIN_PORT;
-
ioctl(giNetworkFileHandle, 4, &tmp);
// TODO: Don't hard-code IOCtl number
+
_SysIOCtl(giNetworkFileHandle, 4, &tmp);
// TODO: Don't hard-code IOCtl number
}
}
@@
-103,7
+103,7
@@
void IPC_HandleSelect(fd_set *set)
int readlen, identlen;
char *msg;
- readlen =
r
ead(giNetworkFileHandle, staticBuf, sizeof(staticBuf));
+ readlen =
_SysR
ead(giNetworkFileHandle, staticBuf, sizeof(staticBuf));
identlen = 4 + Net_GetAddressSize( ((uint16_t*)staticBuf)[1] );
msg = staticBuf + identlen;
@@
-114,11
+114,11
@@
void IPC_HandleSelect(fd_set *set)
}
size_t len;
-
pid_t
tid;
- while( (len = SysGetMessage(&tid, 0, NULL)) )
+
int
tid;
+ while( (len =
_
SysGetMessage(&tid, 0, NULL)) )
{
char data[len];
- SysGetMessage(NULL, len, data);
+
_
SysGetMessage(NULL, len, data);
IPC_Handle(&gIPC_Type_SysMessage, &tid, len, (void*)data);
// _SysDebug("IPC_HandleSelect: Message handled");
@@
-145,7
+145,7
@@
void IPC_Type_Datagram_Send(const void *Ident, size_t Length, const void *Data)
memcpy(tmpbuf, Ident, identlen); // Header
memcpy(tmpbuf + identlen, Data, Length); // Data
// TODO: Handle fragmented packets
-
w
rite(giNetworkFileHandle, tmpbuf, sizeof(tmpbuf));
+
_SysW
rite(giNetworkFileHandle, tmpbuf, sizeof(tmpbuf));
}
int IPC_Type_Sys_GetSize(const void *Ident)
@@
-160,7
+160,7
@@
int IPC_Type_Sys_Compare(const void *Ident1, const void *Ident2)
void IPC_Type_Sys_Send(const void *Ident, size_t Length, const void *Data)
{
- SysSendMessage( *(const tid_t*)Ident, Length, Data );
+
_
SysSendMessage( *(const tid_t*)Ident, Length, Data );
}
// --- Client -> Window Mappings
@@
-168,7
+168,10
@@
int _CompareClientPtrs(const void *_a, const void *_b)
{
tIPC_Client *a = *(tIPC_Client**)_a;
tIPC_Client *b = *(tIPC_Client**)_b;
-
+
+ ASSERT(a);
+ ASSERT(b);
+
if(a->IPCType < b->IPCType) return -1;
if(a->IPCType > b->IPCType) return 1;
@@
-406,6
+409,20
@@
int IPC_Msg_CreateWin(tIPC_Client *Client, tAxWin_IPCMessage *Msg)
return 0;
}
+int IPC_Msg_DestroyWin(tIPC_Client *Client, tAxWin_IPCMessage *Msg)
+{
+ tWindow *win;
+
+ ASSERT(Msg->ID == IPCMSG_DESTROYWIN);
+
+ win = IPC_int_GetWindow(Client, Msg->Window);
+ if( !win )
+ return 0;
+
+ WM_DestroyWindow(win);
+ return 0;
+}
+
int IPC_Msg_SetWindowTitle(tIPC_Client *Client, tAxWin_IPCMessage *Msg)
{
tWindow *win;
@@
-461,8
+478,8
@@
int IPC_Msg_FocusWindow(tIPC_Client *Client, tAxWin_IPCMessage *Msg)
ASSERT(Msg->ID == IPCMSG_FOCUSWINDOW);
// Don't allow the focus to be changed unless the client has the focus
-
if(!gpWM_FocusedWindow) return 1;
-
if(gpWM_FocusedWindow->Client != Client) return 1;
+
//
if(!gpWM_FocusedWindow) return 1;
+
//
if(gpWM_FocusedWindow->Client != Client) return 1;
win = IPC_int_GetWindow(Client, Msg->Window);
if(!win) return 1;
@@
-525,7
+542,7
@@
int (*gIPC_MessageHandlers[])(tIPC_Client *Client, tAxWin_IPCMessage *Msg) = {
IPC_Msg_GetDisplayDims,
IPC_Msg_SendMsg,
IPC_Msg_CreateWin,
-
NULL,
// Destroy window
+
IPC_Msg_DestroyWin,
// Destroy window
IPC_Msg_SetWindowTitle,
IPC_Msg_ShowWindow,
IPC_Msg_DecorateWindow,
@@
-571,7
+588,8
@@
void IPC_Handle(const tIPC_Type *IPCType, const void *Ident, size_t MsgLen, tAxW
}
_SysDebug("IPC_Handle: Call %s-%i", renderer->Name, Msg->ID);
rv = renderer->IPCHandlers[Msg->ID](win, Msg->Size, Msg->Data);
- _SysDebug("IPC_Handle: rv = %i", rv);
+ if( rv )
+ _SysDebug("IPC_Handle: rv != 0 (%i)", rv);
}
else
{
@@
-589,11
+607,12
@@
void IPC_Handle(const tIPC_Type *IPCType, const void *Ident, size_t MsgLen, tAxW
_SysDebug("IPC_Handle: Call WM-%i", Msg->ID);
rv = gIPC_MessageHandlers[Msg->ID](client, Msg);
- _SysDebug("IPC_Handle: rv = %i", rv);
+ if( rv )
+ _SysDebug("IPC_Handle: rv != 0 (%i)", rv);
}
}
-//
--- Server->Client replies
+//
Dispatch a message to the client
void IPC_SendWMMessage(tIPC_Client *Client, uint32_t Src, uint32_t Dst, int MsgID, int Len, void *Data)
{
tAxWin_IPCMessage *hdr;
@@
-616,6
+635,7
@@
void IPC_SendWMMessage(tIPC_Client *Client, uint32_t Src, uint32_t Dst, int MsgI
Client->IPCType->SendMessage(Client->Ident, sizeof(buf), buf);
}
+// --- Server->Client replies
void IPC_SendReply(tIPC_Client *Client, uint32_t WinID, int MsgID, size_t Len, const void *Data)
{
tAxWin_IPCMessage *hdr;
UCC
git Repository :: git.ucc.asn.au