Make a half-hearted not-very-tested attempt to handle window resizes

2001-08-18  Havoc Pennington  <hp@pobox.com>

	* src/window.c (meta_window_configure_request):
	(meta_window_move_resize_internal): Make a half-hearted
	not-very-tested attempt to handle window resizes correctly with
	respect to window gravity.
This commit is contained in:
Havoc Pennington 2001-08-19 02:45:55 +00:00 committed by Havoc Pennington
parent 922749e5b3
commit 92a965b979
2 changed files with 48 additions and 11 deletions

View File

@ -1,3 +1,10 @@
2001-08-18 Havoc Pennington <hp@pobox.com>
* src/window.c (meta_window_configure_request):
(meta_window_move_resize_internal): Make a half-hearted
not-very-tested attempt to handle window resizes correctly with
respect to window gravity.
2001-08-18 Havoc Pennington <hp@pobox.com> 2001-08-18 Havoc Pennington <hp@pobox.com>
* src/window.c (meta_window_get_gravity_position): hrm, I fixed * src/window.c (meta_window_get_gravity_position): hrm, I fixed

View File

@ -1351,30 +1351,46 @@ meta_window_move_resize_internal (MetaWindow *window,
* basically breaking gravity). Not sure how to fix this. * basically breaking gravity). Not sure how to fix this.
*/ */
switch (resize_gravity)
{
/* If client is staying fixed on the east during resize, then we /* If client is staying fixed on the east during resize, then we
* have to move the west edge. * have to move the west edge.
*/ */
switch (resize_gravity)
{
case NorthEastGravity: case NorthEastGravity:
case EastGravity: case EastGravity:
case SouthEastGravity: case SouthEastGravity:
root_x_nw -= size_dx; root_x_nw -= size_dx;
break; break;
/* centered horizontally */
case NorthGravity:
case SouthGravity:
case CenterGravity:
root_x_nw -= size_dx / 2;
break;
default: default:
break; break;
} }
switch (resize_gravity)
{
/* If client is staying fixed on the south during resize, /* If client is staying fixed on the south during resize,
* we have to move the north edge * we have to move the north edge
*/ */
switch (resize_gravity)
{
case SouthGravity: case SouthGravity:
case SouthEastGravity: case SouthEastGravity:
case SouthWestGravity: case SouthWestGravity:
root_y_nw -= size_dy; root_y_nw -= size_dy;
break; break;
/* centered vertically */
case EastGravity:
case WestGravity:
case CenterGravity:
root_y_nw -= size_dy / 2;
break;
default: default:
break; break;
} }
@ -1944,6 +1960,7 @@ meta_window_configure_request (MetaWindow *window,
XEvent *event) XEvent *event)
{ {
int x, y, width, height; int x, y, width, height;
gboolean only_resize;
/* it's essential to use only the explicitly-set fields, /* it's essential to use only the explicitly-set fields,
* and otherwise use our current up-to-date position. * and otherwise use our current up-to-date position.
@ -1956,6 +1973,8 @@ meta_window_configure_request (MetaWindow *window,
meta_window_get_gravity_position (window, &x, &y); meta_window_get_gravity_position (window, &x, &y);
only_resize = TRUE;
if (((window->type == META_WINDOW_DESKTOP || if (((window->type == META_WINDOW_DESKTOP ||
window->type == META_WINDOW_DOCK || window->type == META_WINDOW_DOCK ||
window->type == META_WINDOW_TOOLBAR || window->type == META_WINDOW_TOOLBAR ||
@ -1972,6 +1991,9 @@ meta_window_configure_request (MetaWindow *window,
if (event->xconfigurerequest.value_mask & CWY) if (event->xconfigurerequest.value_mask & CWY)
y = event->xconfigurerequest.y; y = event->xconfigurerequest.y;
if (event->xconfigurerequest.value_mask & (CWX | CWY))
only_resize = FALSE;
} }
width = window->rect.width; width = window->rect.width;
@ -2002,8 +2024,16 @@ meta_window_configure_request (MetaWindow *window,
window->size_hints.width = width; window->size_hints.width = width;
window->size_hints.height = height; window->size_hints.height = height;
/* FIXME passing the gravity on only_resize thing is kind of crack-rock.
* Basically I now have several ways of handling gravity, and things
* don't make too much sense. I think I am doing the math in a couple
* places and could do it in only one function, and remove some of the
* move_resize_internal arguments.
*/
meta_window_move_resize_internal (window, TRUE, FALSE, meta_window_move_resize_internal (window, TRUE, FALSE,
NorthWestGravity, only_resize ?
window->size_hints.win_gravity : NorthWestGravity,
window->size_hints.x, window->size_hints.x,
window->size_hints.y, window->size_hints.y,
window->size_hints.width, window->size_hints.width,