Usermode/libaxwin4 - Fix bad message ID for resize, bad return in window create
authorJohn Hodge <[email protected]>
Sun, 8 Jun 2014 06:15:18 +0000 (14:15 +0800)
committerJohn Hodge <[email protected]>
Sun, 8 Jun 2014 06:15:18 +0000 (14:15 +0800)
Usermode/Libraries/libaxwin4.so_src/ipc_acessipcpipe.cpp
Usermode/Libraries/libaxwin4.so_src/window_drawing.cpp
Usermode/Libraries/libaxwin4.so_src/wm.cpp

index 2f879ff..09cebca 100644 (file)
@@ -43,8 +43,11 @@ void CIPCChannel_AcessIPCPipe::Send(CSerialiser& message)
        if(serialised.size() > 0x1000 ) {
                throw ::std::length_error("CIPCChannel_AcessIPCPipe::Send");
        }
-       _SysDebug("Send %i bytes", serialised.size());
-       _SysWrite(m_fd, serialised.data(), serialised.size());
+       _SysDebug("CIPCChannel_AcessIPCPipe::Send(%i bytes)", serialised.size());
+       size_t rv = _SysWrite(m_fd, serialised.data(), serialised.size());
+       if( rv != serialised.size() ) {
+               throw ::std::system_error(errno, ::std::system_category());
+       }
 }
 
 
index df320ef..6f2f898 100644 (file)
@@ -8,6 +8,7 @@
 #include <axwin4/axwin.h>
 #include "include/common.hpp"
 #include <ipc_proto.hpp>
+#include <algorithm>   // min
 
 namespace AxWin {
 
@@ -17,7 +18,8 @@ extern "C" void AxWin4_DrawBitmap(tAxWin4_Window *Window, int X, int Y, unsigned
        if( W > 128 )
        {
                const uint32_t* data32 = static_cast<uint32_t*>(Data);
-               for( unsigned int row = 0; row < H; row ++ )
+               const unsigned int rows_per_message = 2048 / W;
+               for( unsigned int row = 0; row < H; row += rows_per_message )
                {
                        CSerialiser     message;
                        message.WriteU8(IPCMSG_PUSHDATA);
@@ -25,10 +27,10 @@ extern "C" void AxWin4_DrawBitmap(tAxWin4_Window *Window, int X, int Y, unsigned
                        message.WriteU16(X);
                        message.WriteU16(Y+row);
                        message.WriteU16(W);
-                       message.WriteU16(1);
+                       message.WriteU16( ::std::min(rows_per_message,H-row) );
                        message.WriteBuffer(W*4, data32);
                        ::AxWin::SendMessage(message);
-                       data32 += W;
+                       data32 += W*rows_per_message;
                }
        }
        else
index 50712d4..2144eb7 100644 (file)
@@ -14,13 +14,17 @@ namespace AxWin {
 extern "C" tAxWin4_Window *AxWin4_CreateWindow(const char *Name)
 {
        // Allocate a window ID
+       
        // Create window structure locally
+       tAxWin4_Window *ret = new tAxWin4_Window();
+       ret->m_id = 0;
        // Request creation of window
        CSerialiser     message;
        message.WriteU8(IPCMSG_CREATEWIN);
-       message.WriteU16(0);
+       message.WriteU16(ret->m_id);
        message.WriteString(Name);
        ::AxWin::SendMessage(message);
+       return ret;
 }
 
 extern "C" void AxWin4_ShowWindow(tAxWin4_Window *Window)
@@ -48,7 +52,7 @@ extern "C" void AxWin4_ResizeWindow(tAxWin4_Window *Window, unsigned int W, unsi
        CSerialiser     message;
        message.WriteU8(IPCMSG_SETWINATTR);
        message.WriteU16(Window->m_id);
-       message.WriteU16(IPC_WINATTR_POSITION);
+       message.WriteU16(IPC_WINATTR_DIMENSIONS);
        message.WriteU16(W);
        message.WriteU16(H);
        ::AxWin::SendMessage(message);

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