From bb46f5e56a0b9f08f097175d1a3715fa24972f41 Mon Sep 17 00:00:00 2001 From: "John Hodge (sonata)" Date: Thu, 29 Nov 2012 11:37:47 +0800 Subject: [PATCH] Usermode/AxWin3 - Fixed requesting redraw on window move --- Usermode/Applications/axwin3_src/WM/wm.c | 39 ++++++++++++++++-------- 1 file changed, 26 insertions(+), 13 deletions(-) diff --git a/Usermode/Applications/axwin3_src/WM/wm.c b/Usermode/Applications/axwin3_src/WM/wm.c index f039460e..f9592db5 100644 --- a/Usermode/Applications/axwin3_src/WM/wm.c +++ b/Usermode/Applications/axwin3_src/WM/wm.c @@ -292,8 +292,9 @@ int WM_MoveWindow(tWindow *Window, int X, int Y) _SysDebug("WM_MoveWindow: (%i,%i)", X, Y); Window->X = X; Window->Y = Y; - // TODO: Why invalidate buffer? - WM_Invalidate(Window); + // Mark up the tree that a child window has changed + while( (Window = Window->Parent) ) + Window->Flags &= ~WINFLAG_CHILDCLEAN; return 0; } @@ -407,6 +408,17 @@ void WM_int_UpdateWindow(tWindow *Window) if( !(Window->Flags & WINFLAG_SHOW) ) return ; + if( (Window->Flags & WINFLAG_RELATIVE) && Window->Parent ) + { + Window->RealX = Window->Parent->RealX + Window->Parent->BorderL + Window->X; + Window->RealY = Window->Parent->RealY + Window->Parent->BorderT + Window->Y; + } + else + { + Window->RealX = Window->X; + Window->RealY = Window->Y; + } + // Render if( !(Window->Flags & WINFLAG_CLEAN) ) { @@ -428,17 +440,6 @@ void WM_int_UpdateWindow(tWindow *Window) Window->RealW = Window->W; Window->RealH = Window->H; } - - if( (Window->Flags & WINFLAG_RELATIVE) && Window->Parent ) - { - Window->RealX = Window->Parent->RealX + Window->Parent->BorderL + Window->X; - Window->RealY = Window->Parent->RealY + Window->Parent->BorderT + Window->Y; - } - else - { - Window->RealX = Window->X; - Window->RealY = Window->Y; - } Window->Renderer->Redraw(Window); Window->Flags |= WINFLAG_CLEAN; @@ -466,6 +467,18 @@ void WM_int_BlitWindow(tWindow *Window) // Ignore hidden windows if( !(Window->Flags & WINFLAG_SHOW) ) return ; + + // Duplicated position update to handle window moving + if( (Window->Flags & WINFLAG_RELATIVE) && Window->Parent ) + { + Window->RealX = Window->Parent->RealX + Window->Parent->BorderL + Window->X; + Window->RealY = Window->Parent->RealY + Window->Parent->BorderT + Window->Y; + } + else + { + Window->RealX = Window->X; + Window->RealY = Window->Y; + } // _SysDebug("Blit %p (%p) to (%i,%i) %ix%i", Window, Window->RenderBuffer, // Window->RealX, Window->RealY, Window->RealW, Window->RealH); -- 2.20.1