track the last_xor_rect separately from the current window size, and then

2004-08-18  Havoc Pennington  <hp@redhat.com>

	* 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.
This commit is contained in:
Havoc Pennington 2004-08-19 02:05:24 +00:00 committed by Havoc Pennington
parent e81b5978b0
commit 06a58f43c0
6 changed files with 80 additions and 28 deletions

View File

@ -1,3 +1,15 @@
2004-08-18 Havoc Pennington <hp@redhat.com>
* 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 <menthos@menthos.com> 2004-08-17 Christian Rose <menthos@menthos.com>
* configure.in: Added "bs" to ALL_LINGUAS. * configure.in: Added "bs" to ALL_LINGUAS.

View File

@ -3136,10 +3136,8 @@ meta_display_begin_grab_op (MetaDisplay *display,
if (display->grab_wireframe_active) if (display->grab_wireframe_active)
{ {
/* FIXME we should really display the outer frame rect, MetaRectangle xor_rect;
* but that complicates all the move/resize code since
* it works in terms of window rect.
*/
display->grab_wireframe_rect = window->rect; display->grab_wireframe_rect = window->rect;
if (window->frame) if (window->frame)
{ {
@ -3148,8 +3146,13 @@ meta_display_begin_grab_op (MetaDisplay *display,
} }
meta_window_calc_showing (display->grab_window); 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, 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 #ifdef HAVE_XSYNC
@ -3312,7 +3315,7 @@ meta_display_end_grab_op (MetaDisplay *display,
{ {
display->grab_wireframe_active = FALSE; display->grab_wireframe_active = FALSE;
meta_effects_end_wireframe (display->grab_window->screen, meta_effects_end_wireframe (display->grab_window->screen,
&display->grab_wireframe_rect); &display->grab_wireframe_last_xor_rect);
if (!display->grab_was_cancelled) if (!display->grab_was_cancelled)
meta_window_move_resize (display->grab_window, meta_window_move_resize (display->grab_window,
TRUE, TRUE,

View File

@ -250,6 +250,7 @@ struct _MetaDisplay
guint grab_wireframe_active : 1; guint grab_wireframe_active : 1;
guint grab_was_cancelled : 1; guint grab_was_cancelled : 1;
MetaRectangle grab_wireframe_rect; MetaRectangle grab_wireframe_rect;
MetaRectangle grab_wireframe_last_xor_rect;
MetaRectangle grab_initial_window_pos; MetaRectangle grab_initial_window_pos;
MetaResizePopup *grab_resize_popup; MetaResizePopup *grab_resize_popup;
GTimeVal grab_last_moveresize_time; GTimeVal grab_last_moveresize_time;

View File

@ -1822,14 +1822,16 @@ process_keyboard_move_grab (MetaDisplay *display,
{ {
MetaRectangle new_xor; MetaRectangle new_xor;
new_xor = display->grab_wireframe_rect; display->grab_wireframe_rect.x = x;
new_xor.x = x; display->grab_wireframe_rect.y = y;
new_xor.y = y;
meta_window_get_xor_rect (window, &display->grab_wireframe_rect,
&new_xor);
meta_effects_update_wireframe (window->screen, meta_effects_update_wireframe (window->screen,
&display->grab_wireframe_rect, &display->grab_wireframe_last_xor_rect,
&new_xor); &new_xor);
display->grab_wireframe_rect = new_xor; display->grab_wireframe_last_xor_rect = new_xor;
} }
else else
{ {
@ -2281,15 +2283,19 @@ process_keyboard_resize_grab (MetaDisplay *display,
{ {
MetaRectangle new_xor; MetaRectangle new_xor;
new_xor.x = x; window->display->grab_wireframe_rect.x = x;
new_xor.y = y; window->display->grab_wireframe_rect.y = y;
new_xor.width = width; window->display->grab_wireframe_rect.width = width;
new_xor.height = height; 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, meta_effects_update_wireframe (window->screen,
&window->display->grab_wireframe_rect, &window->display->grab_wireframe_last_xor_rect,
&new_xor); &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 */ /* do this after drawing the wires, so we don't draw over it */
meta_window_refresh_resize_popup (window); meta_window_refresh_resize_popup (window);

View File

@ -3241,6 +3241,26 @@ meta_window_get_outer_rect (MetaWindow *window,
*rect = window->rect; *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* const char*
meta_window_get_startup_id (MetaWindow *window) meta_window_get_startup_id (MetaWindow *window)
{ {
@ -6224,14 +6244,18 @@ update_move (MetaWindow *window,
* constraints * constraints
*/ */
MetaRectangle new_xor; MetaRectangle new_xor;
new_xor = window->display->grab_wireframe_rect;
new_xor.x = new_x; window->display->grab_wireframe_rect.x = new_x;
new_xor.y = new_y; 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, meta_effects_update_wireframe (window->screen,
&window->display->grab_wireframe_rect, &window->display->grab_wireframe_last_xor_rect,
&new_xor); &new_xor);
window->display->grab_wireframe_rect = new_xor; window->display->grab_wireframe_last_xor_rect = new_xor;
} }
else else
{ {
@ -6381,15 +6405,18 @@ update_resize (MetaWindow *window,
if ((new_x + new_w <= new_x) || (new_y + new_h <= new_y)) if ((new_x + new_w <= new_x) || (new_y + new_h <= new_y))
return; return;
new_xor.x = new_x; window->display->grab_wireframe_rect.x = new_x;
new_xor.y = new_y; window->display->grab_wireframe_rect.y = new_y;
new_xor.width = new_w; window->display->grab_wireframe_rect.width = new_w;
new_xor.height = new_h; 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, meta_effects_update_wireframe (window->screen,
&window->display->grab_wireframe_rect, &window->display->grab_wireframe_last_xor_rect,
&new_xor); &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 */ /* do this after drawing the wires, so we don't draw over it */
meta_window_refresh_resize_popup (window); meta_window_refresh_resize_popup (window);

View File

@ -417,6 +417,9 @@ void meta_window_get_geometry (MetaWindow *window,
int *height); int *height);
void meta_window_get_outer_rect (MetaWindow *window, void meta_window_get_outer_rect (MetaWindow *window,
MetaRectangle *rect); MetaRectangle *rect);
void meta_window_get_xor_rect (MetaWindow *window,
const MetaRectangle *grab_wireframe_rect,
MetaRectangle *xor_rect);
void meta_window_delete (MetaWindow *window, void meta_window_delete (MetaWindow *window,
Time timestamp); Time timestamp);
void meta_window_kill (MetaWindow *window); void meta_window_kill (MetaWindow *window);