X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=Usermode%2FLibraries%2Flibaxwin4.so_src%2Fwm.cpp;h=ee1895ea1f6967705a5837c95c85b555cb251055;hb=92c5980925e773c6e1d6775c50c9d86c77b84d23;hp=f023ea8176e39b3035db37c8126c3d0831dd39c9;hpb=145dd00e5c5a36f844be327e16a00b2983245423;p=tpg%2Facess2.git diff --git a/Usermode/Libraries/libaxwin4.so_src/wm.cpp b/Usermode/Libraries/libaxwin4.so_src/wm.cpp index f023ea81..ee1895ea 100644 --- a/Usermode/Libraries/libaxwin4.so_src/wm.cpp +++ b/Usermode/Libraries/libaxwin4.so_src/wm.cpp @@ -35,6 +35,8 @@ extern "C" tAxWin4_Window *AxWin4_CreateWindow(const char *Name) tAxWin4_Window *ret = new tAxWin4_Window(); gWindowList[id] = ret; ret->m_id = id; + ret->m_fd = -1; + ret->m_buffer = nullptr; // Request creation of window CSerialiser message; message.WriteU8(IPCMSG_CREATEWIN); @@ -95,13 +97,45 @@ extern "C" void AxWin4_SetTitle(tAxWin4_Window *Window, const char *Title) ::AxWin::SendMessage(message); } +extern "C" void AxWin4_DamageRect(tAxWin4_Window *Window, unsigned int X, unsigned int Y, unsigned int W, unsigned int H) +{ + CSerialiser message; + message.WriteU8(IPCMSG_DAMAGERECT); + message.WriteU16(Window->m_id); + message.WriteU16(X); + message.WriteU16(Y); + message.WriteU16(W); + message.WriteU16(H); + ::AxWin::SendMessage(message); +} + extern "C" void *AxWin4_GetWindowBuffer(tAxWin4_Window *Window) { - //if( !Window->m_buffer ) - //{ - // // TODO: Support non-blocking operations - //} - return NULL; + if( Window->m_fd == -1 ) + { + CSerialiser req; + req.WriteU8(IPCMSG_GETWINBUF); + req.WriteU16(Window->m_id); + + CDeserialiser response = GetSyncReply(req, IPCMSG_GETWINBUF); + if( response.ReadU16() != Window->m_id ) + { + + } + + uint64_t handle = response.ReadU64(); + Window->m_fd = _SysUnMarshalFD(handle); + + _SysDebug("AxWin4_GetWindowBuffer: %llx = %i", handle, Window->m_fd); + } + + if( !Window->m_buffer ) + { + size_t size = 640*480*4; + Window->m_buffer = _SysMMap(NULL, size, MMAP_PROT_WRITE, MMAP_MAP_SHARED, Window->m_fd, 0); + } + + return Window->m_buffer; } }; // namespace AxWin