mirror of
https://github.com/brl/mutter.git
synced 2024-11-11 08:46:26 -05:00
window: Atomically unmaximize both directions from a _NET_WM_STATE ClientMessage
When GDK sends an unmaximize _NET_WM_STATE ClientMessage, it tells us to remove the _NET_WM_STATE_MAXIMIZED_HORZ and _NET_WM_STATE_MAXIMIZED_VERT states. Before this time, it would independently call: meta_window_unmaximize (window, META_MAXIMIZE_HORIZONTAL); meta_window_unmaximize (window, META_MAXIMIZE_VERTICAL); Which, besides being foolishly inefficient, would also mess up our saved_rect tracking, causing the window to only look like it was unmaximized vertically. Make this code more intelligent, so it causes us to unmaximize in one call. https://bugzilla.gnome.org/show_bug.cgi?id=722108
This commit is contained in:
parent
ebcd60d0b3
commit
0b003bb895
@ -6860,46 +6860,36 @@ meta_window_client_message (MetaWindow *window,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (first == display->atom__NET_WM_STATE_MAXIMIZED_HORZ ||
|
if (first == display->atom__NET_WM_STATE_MAXIMIZED_HORZ ||
|
||||||
second == display->atom__NET_WM_STATE_MAXIMIZED_HORZ)
|
second == display->atom__NET_WM_STATE_MAXIMIZED_HORZ ||
|
||||||
|
first == display->atom__NET_WM_STATE_MAXIMIZED_VERT ||
|
||||||
|
second == display->atom__NET_WM_STATE_MAXIMIZED_VERT)
|
||||||
{
|
{
|
||||||
gboolean max;
|
gboolean max;
|
||||||
|
MetaMaximizeFlags directions = 0;
|
||||||
|
|
||||||
max = (action == _NET_WM_STATE_ADD ||
|
max = (action == _NET_WM_STATE_ADD ||
|
||||||
(action == _NET_WM_STATE_TOGGLE &&
|
(action == _NET_WM_STATE_TOGGLE &&
|
||||||
!window->maximized_horizontally));
|
!window->maximized_horizontally));
|
||||||
if (max && window->has_maximize_func)
|
|
||||||
{
|
if (first == display->atom__NET_WM_STATE_MAXIMIZED_HORZ ||
|
||||||
if (meta_prefs_get_raise_on_click ())
|
second == display->atom__NET_WM_STATE_MAXIMIZED_HORZ)
|
||||||
meta_window_raise (window);
|
directions |= META_MAXIMIZE_HORIZONTAL;
|
||||||
meta_window_maximize (window, META_MAXIMIZE_HORIZONTAL);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (meta_prefs_get_raise_on_click ())
|
|
||||||
meta_window_raise (window);
|
|
||||||
meta_window_unmaximize (window, META_MAXIMIZE_HORIZONTAL);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (first == display->atom__NET_WM_STATE_MAXIMIZED_VERT ||
|
if (first == display->atom__NET_WM_STATE_MAXIMIZED_VERT ||
|
||||||
second == display->atom__NET_WM_STATE_MAXIMIZED_VERT)
|
second == display->atom__NET_WM_STATE_MAXIMIZED_VERT)
|
||||||
{
|
directions |= META_MAXIMIZE_VERTICAL;
|
||||||
gboolean max;
|
|
||||||
|
|
||||||
max = (action == _NET_WM_STATE_ADD ||
|
|
||||||
(action == _NET_WM_STATE_TOGGLE &&
|
|
||||||
!window->maximized_vertically));
|
|
||||||
if (max && window->has_maximize_func)
|
if (max && window->has_maximize_func)
|
||||||
{
|
{
|
||||||
if (meta_prefs_get_raise_on_click ())
|
if (meta_prefs_get_raise_on_click ())
|
||||||
meta_window_raise (window);
|
meta_window_raise (window);
|
||||||
meta_window_maximize (window, META_MAXIMIZE_VERTICAL);
|
meta_window_maximize (window, directions);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (meta_prefs_get_raise_on_click ())
|
if (meta_prefs_get_raise_on_click ())
|
||||||
meta_window_raise (window);
|
meta_window_raise (window);
|
||||||
meta_window_unmaximize (window, META_MAXIMIZE_VERTICAL);
|
meta_window_unmaximize (window, directions);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user