mirror of
https://github.com/brl/mutter.git
synced 2024-11-21 23:50:41 -05:00
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:
parent
922749e5b3
commit
92a965b979
@ -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
|
||||||
|
52
src/window.c
52
src/window.c
@ -1349,35 +1349,51 @@ meta_window_move_resize_internal (MetaWindow *window,
|
|||||||
/* There can be somewhat bogus interactions between gravity
|
/* There can be somewhat bogus interactions between gravity
|
||||||
* and the position constraints (with position contraints
|
* and the position constraints (with position contraints
|
||||||
* basically breaking gravity). Not sure how to fix this.
|
* basically breaking gravity). Not sure how to fix this.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* If client is staying fixed on the east during resize, then we
|
|
||||||
* have to move the west edge.
|
|
||||||
*/
|
|
||||||
switch (resize_gravity)
|
switch (resize_gravity)
|
||||||
{
|
{
|
||||||
|
/* If client is staying fixed on the east during resize, then we
|
||||||
|
* have to move the west edge.
|
||||||
|
*/
|
||||||
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If client is staying fixed on the south during resize,
|
|
||||||
* we have to move the north edge
|
|
||||||
*/
|
|
||||||
switch (resize_gravity)
|
switch (resize_gravity)
|
||||||
{
|
{
|
||||||
|
/* If client is staying fixed on the south during resize,
|
||||||
|
* we have to move the north edge
|
||||||
|
*/
|
||||||
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
constrain_position (window,
|
constrain_position (window,
|
||||||
window->frame ? &fgeom : NULL,
|
window->frame ? &fgeom : NULL,
|
||||||
@ -1944,7 +1960,8 @@ 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,
|
||||||
|
Loading…
Reference in New Issue
Block a user