From 7bf0c7719316fd8f4da8f94d0937db158d70ad4b Mon Sep 17 00:00:00 2001 From: "Jasper St. Pierre" Date: Tue, 29 Apr 2014 15:18:40 -0400 Subject: [PATCH] window: Move _NET_WM_ALLOWED_ACTIONS setting to window-x11 as well --- src/core/window.c | 78 ++++---------------------------------------- src/x11/window-x11.c | 71 ++++++++++++++++++++++++++++++++++++++++ src/x11/window-x11.h | 1 + 3 files changed, 79 insertions(+), 71 deletions(-) diff --git a/src/core/window.c b/src/core/window.c index 7fb02de2e..7ad2b61b4 100644 --- a/src/core/window.c +++ b/src/core/window.c @@ -1688,6 +1688,13 @@ set_net_wm_state (MetaWindow *window) meta_window_x11_set_net_wm_state (window); } +static void +set_allowed_actions_hint (MetaWindow *window) +{ + if (window->client_type == META_WINDOW_CLIENT_TYPE_X11) + meta_window_x11_set_allowed_actions_hint (window); +} + /** * meta_window_located_on_workspace: * @window: a #MetaWindow @@ -5730,77 +5737,6 @@ meta_window_frame_size_changed (MetaWindow *window) meta_frame_clear_cached_borders (window->frame); } -static void -set_allowed_actions_hint (MetaWindow *window) -{ -#define MAX_N_ACTIONS 12 - unsigned long data[MAX_N_ACTIONS]; - int i; - - i = 0; - if (window->has_move_func) - { - data[i] = window->display->atom__NET_WM_ACTION_MOVE; - ++i; - } - if (window->has_resize_func) - { - data[i] = window->display->atom__NET_WM_ACTION_RESIZE; - ++i; - } - if (window->has_fullscreen_func) - { - data[i] = window->display->atom__NET_WM_ACTION_FULLSCREEN; - ++i; - } - if (window->has_minimize_func) - { - data[i] = window->display->atom__NET_WM_ACTION_MINIMIZE; - ++i; - } - if (window->has_shade_func) - { - data[i] = window->display->atom__NET_WM_ACTION_SHADE; - ++i; - } - /* sticky according to EWMH is different from mutter's sticky; - * mutter doesn't support EWMH sticky - */ - if (window->has_maximize_func) - { - data[i] = window->display->atom__NET_WM_ACTION_MAXIMIZE_HORZ; - ++i; - data[i] = window->display->atom__NET_WM_ACTION_MAXIMIZE_VERT; - ++i; - } - /* We always allow this */ - data[i] = window->display->atom__NET_WM_ACTION_CHANGE_DESKTOP; - ++i; - if (window->has_close_func) - { - data[i] = window->display->atom__NET_WM_ACTION_CLOSE; - ++i; - } - - /* I guess we always allow above/below operations */ - data[i] = window->display->atom__NET_WM_ACTION_ABOVE; - ++i; - data[i] = window->display->atom__NET_WM_ACTION_BELOW; - ++i; - - g_assert (i <= MAX_N_ACTIONS); - - meta_verbose ("Setting _NET_WM_ALLOWED_ACTIONS with %d atoms\n", i); - - meta_error_trap_push (window->display); - XChangeProperty (window->display->xdisplay, window->xwindow, - window->display->atom__NET_WM_ALLOWED_ACTIONS, - XA_ATOM, - 32, PropModeReplace, (guchar*) data, i); - meta_error_trap_pop (window->display); -#undef MAX_N_ACTIONS -} - static void meta_window_get_default_skip_hints (MetaWindow *window, gboolean *skip_taskbar_out, diff --git a/src/x11/window-x11.c b/src/x11/window-x11.c index 60fc25314..507822cee 100644 --- a/src/x11/window-x11.c +++ b/src/x11/window-x11.c @@ -2856,3 +2856,74 @@ meta_window_x11_configure_notify (MetaWindow *window, meta_compositor_sync_window_geometry (window->display->compositor, window, FALSE); } + +void +meta_window_x11_set_allowed_actions_hint (MetaWindow *window) +{ +#define MAX_N_ACTIONS 12 + unsigned long data[MAX_N_ACTIONS]; + int i; + + i = 0; + if (window->has_move_func) + { + data[i] = window->display->atom__NET_WM_ACTION_MOVE; + ++i; + } + if (window->has_resize_func) + { + data[i] = window->display->atom__NET_WM_ACTION_RESIZE; + ++i; + } + if (window->has_fullscreen_func) + { + data[i] = window->display->atom__NET_WM_ACTION_FULLSCREEN; + ++i; + } + if (window->has_minimize_func) + { + data[i] = window->display->atom__NET_WM_ACTION_MINIMIZE; + ++i; + } + if (window->has_shade_func) + { + data[i] = window->display->atom__NET_WM_ACTION_SHADE; + ++i; + } + /* sticky according to EWMH is different from mutter's sticky; + * mutter doesn't support EWMH sticky + */ + if (window->has_maximize_func) + { + data[i] = window->display->atom__NET_WM_ACTION_MAXIMIZE_HORZ; + ++i; + data[i] = window->display->atom__NET_WM_ACTION_MAXIMIZE_VERT; + ++i; + } + /* We always allow this */ + data[i] = window->display->atom__NET_WM_ACTION_CHANGE_DESKTOP; + ++i; + if (window->has_close_func) + { + data[i] = window->display->atom__NET_WM_ACTION_CLOSE; + ++i; + } + + /* I guess we always allow above/below operations */ + data[i] = window->display->atom__NET_WM_ACTION_ABOVE; + ++i; + data[i] = window->display->atom__NET_WM_ACTION_BELOW; + ++i; + + g_assert (i <= MAX_N_ACTIONS); + + meta_verbose ("Setting _NET_WM_ALLOWED_ACTIONS with %d atoms\n", i); + + meta_error_trap_push (window->display); + XChangeProperty (window->display->xdisplay, window->xwindow, + window->display->atom__NET_WM_ALLOWED_ACTIONS, + XA_ATOM, + 32, PropModeReplace, (guchar*) data, i); + meta_error_trap_pop (window->display); +#undef MAX_N_ACTIONS +} diff --git a/src/x11/window-x11.h b/src/x11/window-x11.h index 29d95b0f5..5c4002482 100644 --- a/src/x11/window-x11.h +++ b/src/x11/window-x11.h @@ -42,6 +42,7 @@ typedef struct _MetaWindowX11Class MetaWindowX11Class; void meta_window_x11_set_net_wm_state (MetaWindow *window); void meta_window_x11_set_wm_state (MetaWindow *window); +void meta_window_x11_set_allowed_actions_hint (MetaWindow *window); void meta_window_x11_update_role (MetaWindow *window); void meta_window_x11_update_net_wm_type (MetaWindow *window);