mirror of
https://github.com/brl/mutter.git
synced 2024-11-24 17:10:40 -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>
|
||||
|
||||
* src/window.c (meta_window_get_gravity_position): hrm, I fixed
|
||||
|
40
src/window.c
40
src/window.c
@ -1351,30 +1351,46 @@ meta_window_move_resize_internal (MetaWindow *window,
|
||||
* basically breaking gravity). Not sure how to fix this.
|
||||
*/
|
||||
|
||||
switch (resize_gravity)
|
||||
{
|
||||
/* If client is staying fixed on the east during resize, then we
|
||||
* have to move the west edge.
|
||||
*/
|
||||
switch (resize_gravity)
|
||||
{
|
||||
case NorthEastGravity:
|
||||
case EastGravity:
|
||||
case SouthEastGravity:
|
||||
root_x_nw -= size_dx;
|
||||
break;
|
||||
|
||||
/* centered horizontally */
|
||||
case NorthGravity:
|
||||
case SouthGravity:
|
||||
case CenterGravity:
|
||||
root_x_nw -= size_dx / 2;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
switch (resize_gravity)
|
||||
{
|
||||
/* If client is staying fixed on the south during resize,
|
||||
* we have to move the north edge
|
||||
*/
|
||||
switch (resize_gravity)
|
||||
{
|
||||
case SouthGravity:
|
||||
case SouthEastGravity:
|
||||
case SouthWestGravity:
|
||||
root_y_nw -= size_dy;
|
||||
break;
|
||||
|
||||
/* centered vertically */
|
||||
case EastGravity:
|
||||
case WestGravity:
|
||||
case CenterGravity:
|
||||
root_y_nw -= size_dy / 2;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@ -1944,6 +1960,7 @@ meta_window_configure_request (MetaWindow *window,
|
||||
XEvent *event)
|
||||
{
|
||||
int x, y, width, height;
|
||||
gboolean only_resize;
|
||||
|
||||
/* it's essential to use only the explicitly-set fields,
|
||||
* 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);
|
||||
|
||||
only_resize = TRUE;
|
||||
|
||||
if (((window->type == META_WINDOW_DESKTOP ||
|
||||
window->type == META_WINDOW_DOCK ||
|
||||
window->type == META_WINDOW_TOOLBAR ||
|
||||
@ -1972,6 +1991,9 @@ meta_window_configure_request (MetaWindow *window,
|
||||
|
||||
if (event->xconfigurerequest.value_mask & CWY)
|
||||
y = event->xconfigurerequest.y;
|
||||
|
||||
if (event->xconfigurerequest.value_mask & (CWX | CWY))
|
||||
only_resize = FALSE;
|
||||
}
|
||||
|
||||
width = window->rect.width;
|
||||
@ -2002,8 +2024,16 @@ meta_window_configure_request (MetaWindow *window,
|
||||
window->size_hints.width = width;
|
||||
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,
|
||||
NorthWestGravity,
|
||||
only_resize ?
|
||||
window->size_hints.win_gravity : NorthWestGravity,
|
||||
window->size_hints.x,
|
||||
window->size_hints.y,
|
||||
window->size_hints.width,
|
||||
|
Loading…
Reference in New Issue
Block a user