mirror of
https://github.com/brl/mutter.git
synced 2025-02-16 13:24:09 +00:00
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:
parent
6f3ae06362
commit
3876a1a192
@ -1193,18 +1193,26 @@ meta_window_actor_should_unredirect (MetaWindowActor *self)
|
||||
int num_monitors = meta_screen_get_n_monitors (screen);
|
||||
int i;
|
||||
|
||||
if (!meta_window_is_override_redirect (metaWindow))
|
||||
if (meta_window_requested_dont_bypass_compositor (metaWindow))
|
||||
return FALSE;
|
||||
|
||||
if (!meta_window_is_override_redirect (metaWindow) &&
|
||||
!meta_window_requested_bypass_compositor (metaWindow))
|
||||
return FALSE;
|
||||
|
||||
if (priv->opacity != 0xff)
|
||||
return FALSE;
|
||||
|
||||
if (priv->argb32)
|
||||
if (priv->argb32 && !meta_window_requested_bypass_compositor (metaWindow))
|
||||
return FALSE;
|
||||
|
||||
if (metaWindow->has_shape)
|
||||
return FALSE;
|
||||
|
||||
if (meta_window_requested_bypass_compositor (metaWindow) &&
|
||||
meta_window_is_fullscreen (metaWindow))
|
||||
return TRUE;
|
||||
|
||||
meta_screen_get_size (screen, &screen_width, &screen_height);
|
||||
meta_window_get_outer_rect (metaWindow, &window_rect);
|
||||
|
||||
|
@ -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)
|
||||
{
|
||||
|
@ -172,6 +172,8 @@ item(_NET_WM_ACTION_BELOW)
|
||||
item(_NET_WM_STATE_STICKY)
|
||||
item(_NET_WM_FULLSCREEN_MONITORS)
|
||||
item(_NET_WM_STATE_FOCUSED)
|
||||
item(_NET_WM_BYPASS_COMPOSITOR)
|
||||
item(_NET_WM_DONT_BYPASS_COMPOSITOR)
|
||||
|
||||
#if 0
|
||||
/* We apparently never use: */
|
||||
|
@ -140,6 +140,8 @@ void meta_window_foreach_ancestor (MetaWindow *window,
|
||||
MetaMaximizeFlags meta_window_get_maximized (MetaWindow *window);
|
||||
gboolean meta_window_is_fullscreen (MetaWindow *window);
|
||||
gboolean meta_window_is_on_primary_monitor (MetaWindow *window);
|
||||
gboolean meta_window_requested_bypass_compositor (MetaWindow *window);
|
||||
gboolean meta_window_requested_dont_bypass_compositor (MetaWindow *window);
|
||||
|
||||
gboolean meta_window_is_mapped (MetaWindow *window);
|
||||
gboolean meta_window_toplevel_is_mapped (MetaWindow *window);
|
||||
|
Loading…
x
Reference in New Issue
Block a user