From: John Hodge Date: Sun, 8 Jun 2014 06:15:18 +0000 (+0800) Subject: Usermode/libaxwin4 - Fix bad message ID for resize, bad return in window create X-Git-Url: https://git.ucc.asn.au/?a=commitdiff_plain;h=d87b9f934993d643b193880603523dead2a63547;p=tpg%2Facess2.git Usermode/libaxwin4 - Fix bad message ID for resize, bad return in window create --- diff --git a/Usermode/Libraries/libaxwin4.so_src/ipc_acessipcpipe.cpp b/Usermode/Libraries/libaxwin4.so_src/ipc_acessipcpipe.cpp index 2f879ff4..09cebcae 100644 --- a/Usermode/Libraries/libaxwin4.so_src/ipc_acessipcpipe.cpp +++ b/Usermode/Libraries/libaxwin4.so_src/ipc_acessipcpipe.cpp @@ -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()); + } } diff --git a/Usermode/Libraries/libaxwin4.so_src/window_drawing.cpp b/Usermode/Libraries/libaxwin4.so_src/window_drawing.cpp index df320ef7..6f2f898b 100644 --- a/Usermode/Libraries/libaxwin4.so_src/window_drawing.cpp +++ b/Usermode/Libraries/libaxwin4.so_src/window_drawing.cpp @@ -8,6 +8,7 @@ #include #include "include/common.hpp" #include +#include // 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(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 diff --git a/Usermode/Libraries/libaxwin4.so_src/wm.cpp b/Usermode/Libraries/libaxwin4.so_src/wm.cpp index 50712d48..2144eb74 100644 --- a/Usermode/Libraries/libaxwin4.so_src/wm.cpp +++ b/Usermode/Libraries/libaxwin4.so_src/wm.cpp @@ -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);