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>
* 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)
{
/* 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,

View File

@ -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;

View File

@ -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_effects_update_wireframe (window->screen,
meta_window_get_xor_rect (window,
&window->display->grab_wireframe_rect,
&new_xor);
window->display->grab_wireframe_rect = new_xor;
meta_effects_update_wireframe (window->screen,
&window->display->grab_wireframe_last_xor_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);

View File

@ -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;
meta_effects_update_wireframe (window->screen,
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);
window->display->grab_wireframe_rect = new_xor;
meta_effects_update_wireframe (window->screen,
&window->display->grab_wireframe_last_xor_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);

View File

@ -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);