Usermode/CLIShell - Fixed not catching execve returning
[tpg/acess2.git] / Usermode / Applications / axwin3_src / WM / wm.c
index a056a52..35a5308 100644 (file)
@@ -14,7 +14,7 @@
 #include <decorator.h>
 
 // === IMPORTS ===
-extern void    IPC_SendWMMessage(tIPC_Client *Client, uint32_t Src, uint32_t Dst, int Msg, int Len, void *Data);
+extern void    IPC_SendWMMessage(tIPC_Client *Client, uint32_t Src, uint32_t Dst, int Msg, int Len, const void *Data);
 
 // === GLOBALS ===
 tWMRenderer    *gpWM_Renderers;
@@ -170,8 +170,10 @@ void WM_ShowWindow(tWindow *Window, int bShow)
                        WM_FocusWindow(Window->Parent);
        }
        // Just a little memory saving for large hidden windows
-       if(Window->RenderBuffer)
+       if(Window->RenderBuffer) {
                free(Window->RenderBuffer);
+               Window->RenderBuffer = NULL;
+       }
        
        WM_Invalidate(Window);
 }
@@ -187,8 +189,10 @@ void WM_DecorateWindow(tWindow *Window, int bDecorate)
                Window->Flags |= WINFLAG_NODECORATE;
        
        // Needed because the window size changes
-       if(Window->RenderBuffer)
+       if(Window->RenderBuffer) {
                free(Window->RenderBuffer);
+               Window->RenderBuffer = NULL;
+       }
        
        WM_Invalidate(Window);
 }
@@ -216,8 +220,10 @@ int WM_ResizeWindow(tWindow *Window, int W, int H)
 
        Window->W = W;  Window->H = H;
 
-       if(Window->RenderBuffer)
+       if(Window->RenderBuffer) {
                free(Window->RenderBuffer);
+               Window->RenderBuffer = NULL;
+       }
        WM_Invalidate(Window);
 
        {
@@ -230,10 +236,16 @@ int WM_ResizeWindow(tWindow *Window, int W, int H)
        return 0;
 }
 
-int WM_SendMessage(tWindow *Source, tWindow *Dest, int Message, int Length, void *Data)
+int WM_SendMessage(tWindow *Source, tWindow *Dest, int Message, int Length, const void *Data)
 {
        if(Dest == NULL)        return -2;
        if(Length > 0 && Data == NULL)  return -1;
+
+       if( Decorator_HandleMessage(Dest, Message, Length, Data) != 1 )
+       {
+               // TODO: Catch errors from ->HandleMessage
+               return 0;
+       }
        
        // ->HandleMessage returns 1 when the message was not handled
        if( Dest->Renderer->HandleMessage(Dest, Message, Length, Data) != 1 )

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