mirror of
https://github.com/brl/mutter.git
synced 2024-11-21 15:40:41 -05:00
clutter: Remove support for transparent windows
We're only ever a compositor, so we're never asking to be transparent. Thus remove support for requesting to paint to GLX or EGL displays with an alpha channel. https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1364
This commit is contained in:
parent
787bc3d993
commit
d857edf09c
@ -98,7 +98,6 @@ static const gchar *atom_names[] = {
|
||||
|
||||
/* various flags corresponding to pre init setup calls */
|
||||
static gboolean clutter_enable_xinput = TRUE;
|
||||
static gboolean clutter_enable_argb = FALSE;
|
||||
static gboolean clutter_enable_stereo = FALSE;
|
||||
static Display *_foreign_dpy = NULL;
|
||||
|
||||
@ -240,13 +239,6 @@ clutter_backend_x11_pre_parse (ClutterBackend *backend,
|
||||
env_string = NULL;
|
||||
}
|
||||
|
||||
env_string = g_getenv ("CLUTTER_DISABLE_ARGB_VISUAL");
|
||||
if (env_string)
|
||||
{
|
||||
clutter_enable_argb = FALSE;
|
||||
env_string = NULL;
|
||||
}
|
||||
|
||||
env_string = g_getenv ("CLUTTER_DISABLE_XINPUT");
|
||||
if (env_string)
|
||||
{
|
||||
@ -550,15 +542,12 @@ clutter_backend_x11_get_renderer (ClutterBackend *backend,
|
||||
|
||||
static gboolean
|
||||
check_onscreen_template (CoglRenderer *renderer,
|
||||
CoglSwapChain *swap_chain,
|
||||
CoglOnscreenTemplate *onscreen_template,
|
||||
gboolean enable_argb,
|
||||
gboolean enable_stereo,
|
||||
GError **error)
|
||||
{
|
||||
GError *internal_error = NULL;
|
||||
|
||||
cogl_swap_chain_set_has_alpha (swap_chain, enable_argb);
|
||||
cogl_onscreen_template_set_stereo_enabled (onscreen_template,
|
||||
clutter_enable_stereo);
|
||||
|
||||
@ -573,17 +562,15 @@ check_onscreen_template (CoglRenderer *renderer,
|
||||
*/
|
||||
if (cogl_renderer_check_onscreen_template (renderer, onscreen_template, &internal_error))
|
||||
{
|
||||
clutter_enable_argb = enable_argb;
|
||||
clutter_enable_stereo = enable_stereo;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (enable_argb || enable_stereo) /* More possibilities to try */
|
||||
if (enable_stereo) /* More possibilities to try */
|
||||
CLUTTER_NOTE (BACKEND,
|
||||
"Creation of a CoglDisplay with alpha=%s, stereo=%s failed: %s",
|
||||
enable_argb ? "enabled" : "disabled",
|
||||
"Creation of a CoglDisplay with, stereo=%s failed: %s",
|
||||
enable_stereo ? "enabled" : "disabled",
|
||||
internal_error != NULL
|
||||
? internal_error->message
|
||||
@ -611,8 +598,7 @@ clutter_backend_x11_get_display (ClutterBackend *backend,
|
||||
CoglDisplay *display = NULL;
|
||||
gboolean res = FALSE;
|
||||
|
||||
CLUTTER_NOTE (BACKEND, "Creating CoglDisplay, alpha=%s, stereo=%s",
|
||||
clutter_enable_argb ? "enabled" : "disabled",
|
||||
CLUTTER_NOTE (BACKEND, "Creating CoglDisplay, stereo=%s",
|
||||
clutter_enable_stereo ? "enabled" : "disabled");
|
||||
|
||||
onscreen_template = cogl_onscreen_template_new (swap_chain);
|
||||
@ -620,22 +606,13 @@ clutter_backend_x11_get_display (ClutterBackend *backend,
|
||||
/* It's possible that the current renderer doesn't support transparency
|
||||
* or doesn't support stereo, so we try the different combinations.
|
||||
*/
|
||||
if (clutter_enable_argb && clutter_enable_stereo)
|
||||
res = check_onscreen_template (renderer, swap_chain, onscreen_template,
|
||||
TRUE, TRUE, error);
|
||||
|
||||
/* Prioritize stereo over alpha */
|
||||
if (!res && clutter_enable_stereo)
|
||||
res = check_onscreen_template (renderer, swap_chain, onscreen_template,
|
||||
FALSE, TRUE, error);
|
||||
|
||||
if (!res && clutter_enable_argb)
|
||||
res = check_onscreen_template (renderer, swap_chain, onscreen_template,
|
||||
TRUE, FALSE, error);
|
||||
if (clutter_enable_stereo)
|
||||
res = check_onscreen_template (renderer, onscreen_template,
|
||||
TRUE, error);
|
||||
|
||||
if (!res)
|
||||
res = check_onscreen_template (renderer, swap_chain, onscreen_template,
|
||||
FALSE, FALSE, error);
|
||||
res = check_onscreen_template (renderer, onscreen_template,
|
||||
FALSE, error);
|
||||
|
||||
if (res)
|
||||
display = cogl_display_new (renderer, onscreen_template);
|
||||
@ -972,56 +949,6 @@ clutter_x11_has_composite_extension (void)
|
||||
return have_composite;
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_x11_set_use_argb_visual:
|
||||
* @use_argb: %TRUE if ARGB visuals should be requested by default
|
||||
*
|
||||
* Sets whether the Clutter X11 backend should request ARGB visuals by default
|
||||
* or not.
|
||||
*
|
||||
* By default, Clutter requests RGB visuals.
|
||||
*
|
||||
* If no ARGB visuals are found, the X11 backend will fall back to
|
||||
* requesting a RGB visual instead.
|
||||
*
|
||||
* ARGB visuals are required for the #ClutterStage:use-alpha property to work.
|
||||
*
|
||||
* This function can only be called once, and before clutter_init() is
|
||||
* called.
|
||||
*
|
||||
* Since: 1.2
|
||||
*/
|
||||
void
|
||||
clutter_x11_set_use_argb_visual (gboolean use_argb)
|
||||
{
|
||||
if (_clutter_context_is_initialized ())
|
||||
{
|
||||
g_warning ("%s() can only be used before calling clutter_init()",
|
||||
G_STRFUNC);
|
||||
return;
|
||||
}
|
||||
|
||||
CLUTTER_NOTE (BACKEND, "ARGB visuals are %s",
|
||||
use_argb ? "enabled" : "disabled");
|
||||
|
||||
clutter_enable_argb = use_argb;
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_x11_get_use_argb_visual:
|
||||
*
|
||||
* Retrieves whether the Clutter X11 backend is using ARGB visuals by default
|
||||
*
|
||||
* Return value: %TRUE if ARGB visuals are queried by default
|
||||
*
|
||||
* Since: 1.2
|
||||
*/
|
||||
gboolean
|
||||
clutter_x11_get_use_argb_visual (void)
|
||||
{
|
||||
return clutter_enable_argb;
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_x11_set_use_stereo_stage:
|
||||
* @use_stereo: %TRUE if the stereo stages should be used if possible.
|
||||
|
@ -112,11 +112,6 @@ void clutter_x11_remove_filter (ClutterX11FilterFunc func,
|
||||
CLUTTER_EXPORT
|
||||
gboolean clutter_x11_has_composite_extension (void);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
void clutter_x11_set_use_argb_visual (gboolean use_argb);
|
||||
CLUTTER_EXPORT
|
||||
gboolean clutter_x11_get_use_argb_visual (void);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
void clutter_x11_set_use_stereo_stage (gboolean use_stereo);
|
||||
CLUTTER_EXPORT
|
||||
|
@ -37,8 +37,6 @@ struct _CoglSwapChain
|
||||
{
|
||||
CoglObject _parent;
|
||||
|
||||
gboolean has_alpha;
|
||||
|
||||
int length;
|
||||
};
|
||||
|
||||
|
@ -59,13 +59,6 @@ cogl_swap_chain_new (void)
|
||||
return _cogl_swap_chain_object_new (swap_chain);
|
||||
}
|
||||
|
||||
void
|
||||
cogl_swap_chain_set_has_alpha (CoglSwapChain *swap_chain,
|
||||
gboolean has_alpha)
|
||||
{
|
||||
swap_chain->has_alpha = has_alpha;
|
||||
}
|
||||
|
||||
void
|
||||
cogl_swap_chain_set_length (CoglSwapChain *swap_chain,
|
||||
int length)
|
||||
|
@ -50,7 +50,6 @@ typedef struct _CoglGLXDisplay
|
||||
CoglGLXCachedConfig glx_cached_configs[COGL_GLX_N_CACHED_CONFIGS];
|
||||
|
||||
gboolean found_fbconfig;
|
||||
gboolean fbconfig_has_rgba_visual;
|
||||
gboolean is_direct;
|
||||
gboolean have_vblank_counter;
|
||||
gboolean can_vblank_wait;
|
||||
|
@ -223,7 +223,7 @@ egl_attributes_from_framebuffer_config (CoglDisplay *display,
|
||||
attributes[i++] = 1;
|
||||
|
||||
attributes[i++] = EGL_ALPHA_SIZE;
|
||||
attributes[i++] = config->swap_chain->has_alpha ? 1 : EGL_DONT_CARE;
|
||||
attributes[i++] = EGL_DONT_CARE;
|
||||
|
||||
attributes[i++] = EGL_DEPTH_SIZE;
|
||||
attributes[i++] = 1;
|
||||
|
@ -885,7 +885,7 @@ glx_attributes_from_framebuffer_config (CoglDisplay *display,
|
||||
attributes[i++] = GLX_BLUE_SIZE;
|
||||
attributes[i++] = 1;
|
||||
attributes[i++] = GLX_ALPHA_SIZE;
|
||||
attributes[i++] = config->swap_chain->has_alpha ? 1 : GLX_DONT_CARE;
|
||||
attributes[i++] = GLX_DONT_CARE;
|
||||
attributes[i++] = GLX_DEPTH_SIZE;
|
||||
attributes[i++] = 1;
|
||||
attributes[i++] = GLX_STENCIL_SIZE;
|
||||
@ -944,40 +944,8 @@ find_fbconfig (CoglDisplay *display,
|
||||
goto done;
|
||||
}
|
||||
|
||||
if (config->swap_chain->has_alpha)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < n_configs; i++)
|
||||
{
|
||||
XVisualInfo *vinfo;
|
||||
|
||||
vinfo = glx_renderer->glXGetVisualFromFBConfig (xlib_renderer->xdpy,
|
||||
configs[i]);
|
||||
if (vinfo == NULL)
|
||||
continue;
|
||||
|
||||
if (vinfo->depth == 32 &&
|
||||
(vinfo->red_mask | vinfo->green_mask | vinfo->blue_mask)
|
||||
!= 0xffffffff)
|
||||
{
|
||||
COGL_NOTE (WINSYS, "Found an ARGB FBConfig [index:%d]", i);
|
||||
*config_ret = configs[i];
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
|
||||
g_set_error_literal (error, COGL_WINSYS_ERROR,
|
||||
COGL_WINSYS_ERROR_CREATE_CONTEXT,
|
||||
"Unable to find fbconfig with rgba visual");
|
||||
ret = FALSE;
|
||||
goto done;
|
||||
}
|
||||
else
|
||||
{
|
||||
COGL_NOTE (WINSYS, "Using the first available FBConfig");
|
||||
*config_ret = configs[0];
|
||||
}
|
||||
COGL_NOTE (WINSYS, "Using the first available FBConfig");
|
||||
*config_ret = configs[0];
|
||||
|
||||
done:
|
||||
XFree (configs);
|
||||
@ -1059,8 +1027,6 @@ create_context (CoglDisplay *display, GError **error)
|
||||
CoglXlibRenderer *xlib_renderer =
|
||||
_cogl_xlib_renderer_get_data (display->renderer);
|
||||
CoglGLXRenderer *glx_renderer = display->renderer->winsys;
|
||||
gboolean support_transparent_windows =
|
||||
display->onscreen_template->config.swap_chain->has_alpha;
|
||||
GLXFBConfig config;
|
||||
GError *fbconfig_error = NULL;
|
||||
XSetWindowAttributes attrs;
|
||||
@ -1084,7 +1050,6 @@ create_context (CoglDisplay *display, GError **error)
|
||||
}
|
||||
|
||||
glx_display->fbconfig = config;
|
||||
glx_display->fbconfig_has_rgba_visual = support_transparent_windows;
|
||||
|
||||
COGL_NOTE (WINSYS, "Creating GLX Context (display: %p)",
|
||||
xlib_renderer->xdpy);
|
||||
|
@ -212,10 +212,6 @@ test_paint_wrapper_main (int argc, char *argv[])
|
||||
|
||||
error = NULL;
|
||||
|
||||
#ifdef CLUTTER_WINDOWING_X11
|
||||
clutter_x11_set_use_argb_visual (TRUE);
|
||||
#endif
|
||||
|
||||
if (clutter_init_with_args (&argc, &argv,
|
||||
NULL,
|
||||
super_oh_entries,
|
||||
|
Loading…
Reference in New Issue
Block a user