From: John Hodge (sonata) Date: Fri, 7 Nov 2014 09:14:40 +0000 (+0800) Subject: Usermode/AxWin4 - Fix broken map impl causing pixel->window mapping to fail X-Git-Url: https://git.ucc.asn.au/?p=tpg%2Facess2.git;a=commitdiff_plain;h=b5f8fa2dea9d6a67ac5c8a3a442ee4570deaa56c Usermode/AxWin4 - Fix broken map impl causing pixel->window mapping to fail --- diff --git a/Usermode/Applications/axwin4_src/Server/CClient.cpp b/Usermode/Applications/axwin4_src/Server/CClient.cpp index 8640bf3b..70c4cf86 100644 --- a/Usermode/Applications/axwin4_src/Server/CClient.cpp +++ b/Usermode/Applications/axwin4_src/Server/CClient.cpp @@ -35,7 +35,7 @@ CWindow* CClient::GetWindow(int ID) void CClient::SetWindow(int ID, CWindow* window) { - _SysDebug("SetWindow(ID=%i,window=%p)", ID, window); + //_SysDebug("SetWindow(ID=%i,window=%p)", ID, window); auto it = m_windows.find(ID); if( it != m_windows.end() ) { _SysDebug("CLIENT BUG: Window ID %i is already used by %p", ID, it->second); diff --git a/Usermode/Applications/axwin4_src/Server/compositor.cpp b/Usermode/Applications/axwin4_src/Server/compositor.cpp index 42bb8b9b..da924e8d 100644 --- a/Usermode/Applications/axwin4_src/Server/compositor.cpp +++ b/Usermode/Applications/axwin4_src/Server/compositor.cpp @@ -107,7 +107,7 @@ void CCompositor::BlitFromSurface(const CSurface& dest, const CRect& src_rect) void CCompositor::MouseMove(unsigned int Cursor, unsigned int X, unsigned int Y, int dX, int dY) { - _SysDebug("MouseButton(%i, %i,%i, %+i,%+i)", Cursor, X, Y, dX, dY); + //_SysDebug("MouseButton(%i, %i,%i, %+i,%+i)", Cursor, X, Y, dX, dY); m_video.SetCursorPos(X+dX, Y+dY); CWindow *dstwin = getWindowForCoord(X, Y); if( dstwin ) @@ -120,6 +120,7 @@ void CCompositor::MouseButton(unsigned int Cursor, unsigned int X, unsigned int { _SysDebug("MouseButton(%i, %i,%i, %i=%i)", Cursor, X, Y, Button, Press); CWindow *dstwin = getWindowForCoord(X, Y); + _SysDebug("- dstwin = %p", dstwin); if( dstwin ) { // 1. Give focus and bring to front @@ -150,7 +151,12 @@ void CWindowIDBuffer::set(unsigned int X, unsigned int Y, unsigned int W, unsign .Client = win->client().id(), .Window = win->id(), }; - + for( unsigned int row = 0; row < H; row ++ ) + { + TWindowID* dst = &m_buf[ (Y+row) * m_w ]; + for( unsigned int col = 0; col < W; col ++ ) + dst[col] = ent; + } } CWindow* CWindowIDBuffer::get(unsigned int X, unsigned int Y) { @@ -160,9 +166,12 @@ CWindow* CWindowIDBuffer::get(unsigned int X, unsigned int Y) if( pos >= m_buf.size() ) return nullptr; auto id = m_buf[pos]; + //_SysDebug("CWindowIDBuffer::get id = {%i,%i}", id.Client, id.Window); auto client = ::AxWin::IPC::GetClientByID(id.Client); - if( client == nullptr ) + if( client == nullptr ) { + //_SysDebug("CWindowIDBuffer::get client=%p", client); return nullptr; + } return client->GetWindow(id.Window); } diff --git a/Usermode/Applications/axwin4_src/Server/ipc.cpp b/Usermode/Applications/axwin4_src/Server/ipc.cpp index c5072853..1c5ba994 100644 --- a/Usermode/Applications/axwin4_src/Server/ipc.cpp +++ b/Usermode/Applications/axwin4_src/Server/ipc.cpp @@ -65,6 +65,7 @@ void HandleSelect(const fd_set& rfds) void RegisterClient(CClient& client) { + _SysDebug("RegisterClient(&client=%p)", &client); // allocate a client ID, and save for( int i = 0; i < 100; i ++ ) { @@ -84,7 +85,14 @@ void RegisterClient(CClient& client) CClient* GetClientByID(uint16_t id) { auto it = glClients.find(id); - return (it == glClients.end() ? nullptr : it->second); + if(it == glClients.end()) { + //_SysDebug("Client %i not registered", id); + return nullptr; + } + else { + //_SysDebug("Client %i %i = %p", id, it->first, it->second); + return it->second; + } } void DeregisterClient(CClient& client) diff --git a/Usermode/Libraries/libc++.so_src/include_exp/map b/Usermode/Libraries/libc++.so_src/include_exp/map index 455af71f..2f9031b9 100644 --- a/Usermode/Libraries/libc++.so_src/include_exp/map +++ b/Usermode/Libraries/libc++.so_src/include_exp/map @@ -198,7 +198,7 @@ public: const key_type& k = val.first; iterator it = upper_bound(k); if( it == end() || m_comp(k, it->first) ) { // if k < it->first, no match - insert_at(it.m_index, value_type(k,mapped_type()) ); + insert_at(it.m_index, val); return pair(it, true); } else {