From 1a6891126636505152d134b91e3a3824b3e615b9 Mon Sep 17 00:00:00 2001 From: Gary Wong Date: Tue, 25 Aug 2009 14:19:01 -0600 Subject: [PATCH] Properly compute the update region when the old region was empty. --- ChangeLog | 5 +++++ window-table.c | 33 +++++++++++++++++++++------------ 2 files changed, 26 insertions(+), 12 deletions(-) diff --git a/ChangeLog b/ChangeLog index 038b015..54053bf 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2009-08-25 Gary Wong + + * window-table.c (queue_window_update): Properly compute the + update region when the old region was empty. + 2009-08-24 Gary Wong * gwm.c (shutdown_display) [DEBUG]: Call muntrace() only when diff --git a/window-table.c b/window-table.c index 047161e..88ce34f 100644 --- a/window-table.c +++ b/window-table.c @@ -243,23 +243,32 @@ extern void queue_window_update( struct gwm_window *window, int cleared ) { /* FIXME Consider computing the region instead of the bounding box. */ - - if( x < window->update.x ) { - window->update.width += window->update.x - x; - window->update.x = x; - } - if( y < window->update.y ) { - window->update.height += window->update.y - y; + if( !window->update.width || !window->update.height ) { + /* New update region. */ + window->update.x = x; window->update.y = y; - } + window->update.width = width; + window->update.height = height; + } else { + /* Compute the bounding box of the union of the old and new regions. */ + if( x < window->update.x ) { + window->update.width += window->update.x - x; + window->update.x = x; + } - if( x + width > window->update.x + window->update.width ) - window->update.width = x + width - window->update.x; + if( y < window->update.y ) { + window->update.height += window->update.y - y; + window->update.y = y; + } - if( y + height > window->update.y + window->update.height ) - window->update.height = y + height - window->update.y; + if( x + width > window->update.x + window->update.width ) + window->update.width = x + width - window->update.x; + if( y + height > window->update.y + window->update.height ) + window->update.height = y + height - window->update.y; + } + if( !cleared ) window->cleared = FALSE; -- 2.11.4.GIT