Skip to content

Commit

Permalink
Avoid moving and resizing override-redirect windows
Browse files Browse the repository at this point in the history
Override-redirect windows should not be moved or resized by the
window manager.

- Mark override-redirect windows as already placed to avoid
  placing them when first shown.
- Don't move-resize newly created override-redirect MetaWindow
- Don't queue a resize on override-redirect windows when reading
  their WM_TRANSIENT_FOR hint.
- Add g_return_if_fail (!window->override_redirect) to catch
  unexpected code paths that might result in override-redirect
  windows being moved or resized.

http://bugzilla.gnome.org/show_bug.cgi?id=582639
  • Loading branch information
owtaylor committed Jun 30, 2009
1 parent dc2d8ac commit 729fb2e
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 14 deletions.
2 changes: 1 addition & 1 deletion src/core/window-props.c
Original file line number Diff line number Diff line change
Expand Up @@ -1446,7 +1446,7 @@ reload_transient_for (MetaWindow *window,
window->xtransient_for != window->xgroup_leader)
meta_window_group_leader_changed (window);

if (!window->constructing)
if (!window->constructing && !window->override_redirect)
meta_window_queue (window, META_QUEUE_MOVE_RESIZE);
}

Expand Down
44 changes: 31 additions & 13 deletions src/core/window.c
Original file line number Diff line number Diff line change
Expand Up @@ -678,8 +678,9 @@ meta_window_new_with_attrs (MetaDisplay *display,
window->hidden = 0;
/* if already mapped, no need to worry about focus-on-first-time-showing */
window->showing_for_first_time = !window->mapped;
/* if already mapped we don't want to do the placement thing */
window->placed = (window->mapped && !window->hidden);
/* if already mapped we don't want to do the placement thing;
* override-redirect windows are placed by the app */
window->placed = ((window->mapped && !window->hidden) || window->override_redirect);
if (window->placed)
meta_topic (META_DEBUG_PLACEMENT,
"Not placing window 0x%lx since it's already mapped\n",
Expand Down Expand Up @@ -963,13 +964,14 @@ meta_window_new_with_attrs (MetaDisplay *display,
*/
flags =
META_IS_CONFIGURE_REQUEST | META_IS_MOVE_ACTION | META_IS_RESIZE_ACTION;
meta_window_move_resize_internal (window,
flags,
window->size_hints.win_gravity,
window->size_hints.x,
window->size_hints.y,
window->size_hints.width,
window->size_hints.height);
if (!window->override_redirect)
meta_window_move_resize_internal (window,
flags,
window->size_hints.win_gravity,
window->size_hints.x,
window->size_hints.y,
window->size_hints.width,
window->size_hints.height);

/* Now try applying saved stuff from the session */
{
Expand Down Expand Up @@ -1958,6 +1960,9 @@ meta_window_queue (MetaWindow *window, guint queuebits)
{
guint queuenum;

/* Easier to debug by checking here rather than in the idle */
g_return_if_fail (!window->override_redirect || (queuebits & META_QUEUE_MOVE_RESIZE) == 0);

for (queuenum=0; queuenum<NUMBER_OF_QUEUES; queuenum++)
{
if (queuebits & 1<<queuenum)
Expand Down Expand Up @@ -3628,6 +3633,8 @@ meta_window_move_resize_internal (MetaWindow *window,
MetaRectangle new_rect;
MetaRectangle old_rect;

g_return_if_fail (!window->override_redirect);

is_configure_request = (flags & META_IS_CONFIGURE_REQUEST) != 0;
do_gravity_adjust = (flags & META_DO_GRAVITY_ADJUST) != 0;
is_user_action = (flags & META_IS_USER_ACTION) != 0;
Expand Down Expand Up @@ -4028,6 +4035,8 @@ meta_window_resize (MetaWindow *window,
int x, y;
MetaMoveResizeFlags flags;

g_return_if_fail (!window->override_redirect);

meta_window_get_position (window, &x, &y);

flags = (user_op ? META_IS_USER_ACTION : 0) | META_IS_RESIZE_ACTION;
Expand All @@ -4043,8 +4052,12 @@ meta_window_move (MetaWindow *window,
int root_x_nw,
int root_y_nw)
{
MetaMoveResizeFlags flags =
(user_op ? META_IS_USER_ACTION : 0) | META_IS_MOVE_ACTION;
MetaMoveResizeFlags flags;

g_return_if_fail (!window->override_redirect);

flags = (user_op ? META_IS_USER_ACTION : 0) | META_IS_MOVE_ACTION;

meta_window_move_resize_internal (window,
flags,
NorthWestGravity,
Expand All @@ -4061,8 +4074,11 @@ meta_window_move_resize (MetaWindow *window,
int w,
int h)
{
MetaMoveResizeFlags flags =
(user_op ? META_IS_USER_ACTION : 0) |
MetaMoveResizeFlags flags;

g_return_if_fail (!window->override_redirect);

flags = (user_op ? META_IS_USER_ACTION : 0) |
META_IS_MOVE_ACTION | META_IS_RESIZE_ACTION;
meta_window_move_resize_internal (window,
flags,
Expand Down Expand Up @@ -7176,6 +7192,8 @@ meta_window_shove_titlebar_onscreen (MetaWindow *window)
int horiz_amount, vert_amount;
int newx, newy;

g_return_if_fail (!window->override_redirect);

/* If there's no titlebar, don't bother */
if (!window->frame)
return;
Expand Down

0 comments on commit 729fb2e

Please sign in to comment.