Support bypass compositor hints
Add support for _NET_WM_BYPASS_COMPOSITOR and _NET_WM_DONT_BYPASS_COMPOSITOR as proposed here: https://mail.gnome.org/archives/wm-spec-list/2012-February/msg00010.html https://bugzilla.gnome.org/show_bug.cgi?id=683020
This commit is contained in:
@@ -413,6 +413,10 @@ struct _MetaWindow
|
||||
|
||||
/* The currently complementary tiled window, if any */
|
||||
MetaWindow *tile_match;
|
||||
|
||||
/* Bypass compositor hints */
|
||||
guint bypass_compositor : 1;
|
||||
guint dont_bypass_compositor : 1;
|
||||
};
|
||||
|
||||
struct _MetaWindowClass
|
||||
|
@@ -1584,6 +1584,58 @@ reload_gtk_hide_titlebar_when_maximized (MetaWindow *window,
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
reload_bypass_compositor (MetaWindow *window,
|
||||
MetaPropValue *value,
|
||||
gboolean initial)
|
||||
{
|
||||
gboolean requested_value = FALSE;
|
||||
gboolean current_value = window->bypass_compositor;
|
||||
|
||||
if (value->type != META_PROP_VALUE_INVALID)
|
||||
{
|
||||
requested_value = ((int) value->v.cardinal == 1);
|
||||
meta_verbose ("Request to bypass compositor for window %s.\n", window->desc);
|
||||
}
|
||||
|
||||
if (requested_value == current_value)
|
||||
return;
|
||||
|
||||
if (requested_value && window->dont_bypass_compositor)
|
||||
{
|
||||
meta_verbose ("Setting bypass and dont compositor for same window (%s) makes no sense, ignoring.\n", window->desc);
|
||||
return;
|
||||
}
|
||||
|
||||
window->bypass_compositor = requested_value;
|
||||
}
|
||||
|
||||
static void
|
||||
reload_dont_bypass_compositor (MetaWindow *window,
|
||||
MetaPropValue *value,
|
||||
gboolean initial)
|
||||
{
|
||||
gboolean requested_value = FALSE;
|
||||
gboolean current_value = window->dont_bypass_compositor;
|
||||
|
||||
if (value->type != META_PROP_VALUE_INVALID)
|
||||
{
|
||||
requested_value = ((int) value->v.cardinal == 1);
|
||||
meta_verbose ("Request to don't bypass compositor for window %s.\n", window->desc);
|
||||
}
|
||||
|
||||
if (requested_value == current_value)
|
||||
return;
|
||||
|
||||
if (requested_value && window->bypass_compositor)
|
||||
{
|
||||
meta_verbose ("Setting bypass and dont compositor for same window (%s) makes no sense, ignoring.\n", window->desc);
|
||||
return;
|
||||
}
|
||||
|
||||
window->dont_bypass_compositor = requested_value;
|
||||
}
|
||||
|
||||
#define RELOAD_STRING(var_name, propname) \
|
||||
static void \
|
||||
reload_ ## var_name (MetaWindow *window, \
|
||||
@@ -1683,6 +1735,8 @@ meta_display_init_window_prop_hooks (MetaDisplay *display)
|
||||
{ display->atom__NET_WM_WINDOW_TYPE, META_PROP_VALUE_INVALID, reload_net_wm_window_type, FALSE, TRUE },
|
||||
{ display->atom__NET_WM_STRUT, META_PROP_VALUE_INVALID, reload_struts, FALSE, FALSE },
|
||||
{ display->atom__NET_WM_STRUT_PARTIAL, META_PROP_VALUE_INVALID, reload_struts, FALSE, FALSE },
|
||||
{ display->atom__NET_WM_BYPASS_COMPOSITOR, META_PROP_VALUE_CARDINAL, reload_bypass_compositor, FALSE, FALSE },
|
||||
{ display->atom__NET_WM_DONT_BYPASS_COMPOSITOR, META_PROP_VALUE_CARDINAL, reload_dont_bypass_compositor, FALSE, FALSE },
|
||||
{ 0 },
|
||||
};
|
||||
|
||||
|
@@ -3640,6 +3640,28 @@ meta_window_is_on_primary_monitor (MetaWindow *window)
|
||||
return window->monitor->is_primary;
|
||||
}
|
||||
|
||||
/**
|
||||
* meta_window_requested_bypass_compositor:
|
||||
*
|
||||
* Return value: %TRUE if the window requested to bypass the compositor
|
||||
*/
|
||||
gboolean
|
||||
meta_window_requested_bypass_compositor (MetaWindow *window)
|
||||
{
|
||||
return window->bypass_compositor;
|
||||
}
|
||||
|
||||
/**
|
||||
* meta_window_requested_dont_bypass_compositor:
|
||||
*
|
||||
* Return value: %TRUE if the window requested to opt out of unredirecting
|
||||
*/
|
||||
gboolean
|
||||
meta_window_requested_dont_bypass_compositor (MetaWindow *window)
|
||||
{
|
||||
return window->dont_bypass_compositor;
|
||||
}
|
||||
|
||||
void
|
||||
meta_window_tile (MetaWindow *window)
|
||||
{
|
||||
|
Reference in New Issue
Block a user