From 06a58f43c0b58ab15a3e40e93b16f2c0e128af23 Mon Sep 17 00:00:00 2001 From: Havoc Pennington Date: Thu, 19 Aug 2004 02:05:24 +0000 Subject: [PATCH] track the last_xor_rect separately from the current window size, and then 2004-08-18 Havoc Pennington * src/display.h (struct _MetaDisplay): track the last_xor_rect separately from the current window size, and then use that to paint the wireframe including the frame, and taking into account shaded windows. * src/window.c (meta_window_get_xor_rect): new function to compute the xor rect; it is not really 100% right, because it uses the frame dimensions from the window at the start of the move/resize. But probably won't break in practice. --- ChangeLog | 12 ++++++++++++ src/display.c | 15 +++++++++------ src/display.h | 1 + src/keybindings.c | 28 ++++++++++++++++----------- src/window.c | 49 ++++++++++++++++++++++++++++++++++++----------- src/window.h | 3 +++ 6 files changed, 80 insertions(+), 28 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5730accc5..fe5765b63 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2004-08-18 Havoc Pennington + + * src/display.h (struct _MetaDisplay): track the last_xor_rect + separately from the current window size, and then use that to + paint the wireframe including the frame, and taking into + account shaded windows. + + * src/window.c (meta_window_get_xor_rect): new function to compute + the xor rect; it is not really 100% right, because it uses the + frame dimensions from the window at the start of the move/resize. + But probably won't break in practice. + 2004-08-17 Christian Rose * configure.in: Added "bs" to ALL_LINGUAS. diff --git a/src/display.c b/src/display.c index 86f62bf97..5827df6ee 100644 --- a/src/display.c +++ b/src/display.c @@ -3136,10 +3136,8 @@ meta_display_begin_grab_op (MetaDisplay *display, if (display->grab_wireframe_active) { - /* FIXME we should really display the outer frame rect, - * but that complicates all the move/resize code since - * it works in terms of window rect. - */ + MetaRectangle xor_rect; + display->grab_wireframe_rect = window->rect; if (window->frame) { @@ -3148,8 +3146,13 @@ meta_display_begin_grab_op (MetaDisplay *display, } meta_window_calc_showing (display->grab_window); + + meta_window_get_xor_rect (window, &display->grab_wireframe_rect, + &xor_rect); + meta_effects_begin_wireframe (display->grab_window->screen, - &display->grab_wireframe_rect); + &xor_rect); + display->grab_wireframe_last_xor_rect = xor_rect; } #ifdef HAVE_XSYNC @@ -3312,7 +3315,7 @@ meta_display_end_grab_op (MetaDisplay *display, { display->grab_wireframe_active = FALSE; meta_effects_end_wireframe (display->grab_window->screen, - &display->grab_wireframe_rect); + &display->grab_wireframe_last_xor_rect); if (!display->grab_was_cancelled) meta_window_move_resize (display->grab_window, TRUE, diff --git a/src/display.h b/src/display.h index 174f0538c..a81445c8a 100644 --- a/src/display.h +++ b/src/display.h @@ -250,6 +250,7 @@ struct _MetaDisplay guint grab_wireframe_active : 1; guint grab_was_cancelled : 1; MetaRectangle grab_wireframe_rect; + MetaRectangle grab_wireframe_last_xor_rect; MetaRectangle grab_initial_window_pos; MetaResizePopup *grab_resize_popup; GTimeVal grab_last_moveresize_time; diff --git a/src/keybindings.c b/src/keybindings.c index 89c6d57f6..9039e96a6 100644 --- a/src/keybindings.c +++ b/src/keybindings.c @@ -1822,14 +1822,16 @@ process_keyboard_move_grab (MetaDisplay *display, { MetaRectangle new_xor; - new_xor = display->grab_wireframe_rect; - new_xor.x = x; - new_xor.y = y; + display->grab_wireframe_rect.x = x; + display->grab_wireframe_rect.y = y; + + meta_window_get_xor_rect (window, &display->grab_wireframe_rect, + &new_xor); meta_effects_update_wireframe (window->screen, - &display->grab_wireframe_rect, + &display->grab_wireframe_last_xor_rect, &new_xor); - display->grab_wireframe_rect = new_xor; + display->grab_wireframe_last_xor_rect = new_xor; } else { @@ -2281,15 +2283,19 @@ process_keyboard_resize_grab (MetaDisplay *display, { MetaRectangle new_xor; - new_xor.x = x; - new_xor.y = y; - new_xor.width = width; - new_xor.height = height; + window->display->grab_wireframe_rect.x = x; + window->display->grab_wireframe_rect.y = y; + window->display->grab_wireframe_rect.width = width; + window->display->grab_wireframe_rect.height = height; + meta_window_get_xor_rect (window, + &window->display->grab_wireframe_rect, + &new_xor); + meta_effects_update_wireframe (window->screen, - &window->display->grab_wireframe_rect, + &window->display->grab_wireframe_last_xor_rect, &new_xor); - window->display->grab_wireframe_rect = new_xor; + window->display->grab_wireframe_last_xor_rect = new_xor; /* do this after drawing the wires, so we don't draw over it */ meta_window_refresh_resize_popup (window); diff --git a/src/window.c b/src/window.c index 36efa5fe5..e8ab0bb12 100644 --- a/src/window.c +++ b/src/window.c @@ -3241,6 +3241,26 @@ meta_window_get_outer_rect (MetaWindow *window, *rect = window->rect; } +void +meta_window_get_xor_rect (MetaWindow *window, + const MetaRectangle *grab_wireframe_rect, + MetaRectangle *xor_rect) +{ + if (window->frame) + { + xor_rect->x = grab_wireframe_rect->x - window->frame->child_x; + xor_rect->y = grab_wireframe_rect->y - window->frame->child_y; + xor_rect->width = grab_wireframe_rect->width + window->frame->child_x + window->frame->right_width; + + if (window->shaded) + xor_rect->height = window->frame->child_y; + else + xor_rect->height = grab_wireframe_rect->height + window->frame->child_y + window->frame->bottom_height; + } + else + *xor_rect = *grab_wireframe_rect; +} + const char* meta_window_get_startup_id (MetaWindow *window) { @@ -6224,14 +6244,18 @@ update_move (MetaWindow *window, * constraints */ MetaRectangle new_xor; - new_xor = window->display->grab_wireframe_rect; - new_xor.x = new_x; - new_xor.y = new_y; + + window->display->grab_wireframe_rect.x = new_x; + window->display->grab_wireframe_rect.y = new_y; + + meta_window_get_xor_rect (window, + &window->display->grab_wireframe_rect, + &new_xor); meta_effects_update_wireframe (window->screen, - &window->display->grab_wireframe_rect, + &window->display->grab_wireframe_last_xor_rect, &new_xor); - window->display->grab_wireframe_rect = new_xor; + window->display->grab_wireframe_last_xor_rect = new_xor; } else { @@ -6381,15 +6405,18 @@ update_resize (MetaWindow *window, if ((new_x + new_w <= new_x) || (new_y + new_h <= new_y)) return; - new_xor.x = new_x; - new_xor.y = new_y; - new_xor.width = new_w; - new_xor.height = new_h; + window->display->grab_wireframe_rect.x = new_x; + window->display->grab_wireframe_rect.y = new_y; + window->display->grab_wireframe_rect.width = new_w; + window->display->grab_wireframe_rect.height = new_h; + meta_window_get_xor_rect (window, &window->display->grab_wireframe_rect, + &new_xor); + meta_effects_update_wireframe (window->screen, - &window->display->grab_wireframe_rect, + &window->display->grab_wireframe_last_xor_rect, &new_xor); - window->display->grab_wireframe_rect = new_xor; + window->display->grab_wireframe_last_xor_rect = new_xor; /* do this after drawing the wires, so we don't draw over it */ meta_window_refresh_resize_popup (window); diff --git a/src/window.h b/src/window.h index 183c58f16..5a2681aa4 100644 --- a/src/window.h +++ b/src/window.h @@ -417,6 +417,9 @@ void meta_window_get_geometry (MetaWindow *window, int *height); void meta_window_get_outer_rect (MetaWindow *window, MetaRectangle *rect); +void meta_window_get_xor_rect (MetaWindow *window, + const MetaRectangle *grab_wireframe_rect, + MetaRectangle *xor_rect); void meta_window_delete (MetaWindow *window, Time timestamp); void meta_window_kill (MetaWindow *window);