Usermode/AxWin4 - Fix broken map impl causing pixel->window mapping to fail
authorJohn Hodge (sonata) <[email protected]>
Fri, 7 Nov 2014 09:14:40 +0000 (17:14 +0800)
committerJohn Hodge (sonata) <[email protected]>
Fri, 7 Nov 2014 09:14:40 +0000 (17:14 +0800)
Usermode/Applications/axwin4_src/Server/CClient.cpp
Usermode/Applications/axwin4_src/Server/compositor.cpp
Usermode/Applications/axwin4_src/Server/ipc.cpp
Usermode/Libraries/libc++.so_src/include_exp/map

index 8640bf3..70c4cf8 100644 (file)
@@ -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);
index 42bb8b9..da924e8 100644 (file)
@@ -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);
 }
 
index c507285..1c5ba99 100644 (file)
@@ -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)
index 455af71..2f9031b 100644 (file)
@@ -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<iterator,bool>(it, true);
                }
                else {

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