From 9212dacb2bfd5985d8426bf0bdb88f2aca03444e Mon Sep 17 00:00:00 2001 From: monsta Date: Thu, 3 Mar 2016 15:19:33 +0300 Subject: [GTK+3] re-add ability to show alt-tab thumbnails when compositor is on adapted from: https://git.gnome.org/browse/metacity/commit/?id=e6828a3ee2cab1ec1acbdd5a444dc1cb98215a75 https://git.gnome.org/browse/metacity/commit/?id=758902aef22629943738241cea1f597b6db4b18e https://git.gnome.org/browse/metacity/commit/?id=c6ba6dc7f458720d9f8666881f45a830580468cb https://git.gnome.org/browse/metacity/commit/?id=68bdf1ab9de815e07f5cd75b2e1fa24ba92ae319 https://git.gnome.org/browse/metacity/commit/?id=78bbf4423f72797a05bfaddd4121d70db30de9a3 --- src/compositor/compositor-private.h | 5 ++++ src/compositor/compositor-xrender.c | 50 +++++++++++++++++++++++++++++++++++++ src/compositor/compositor.c | 16 ++++++++++++ 3 files changed, 71 insertions(+) (limited to 'src/compositor') diff --git a/src/compositor/compositor-private.h b/src/compositor/compositor-private.h index 61e7ffb0..1eef9633 100644 --- a/src/compositor/compositor-private.h +++ b/src/compositor/compositor-private.h @@ -44,8 +44,13 @@ struct _MetaCompositor void (*process_event) (MetaCompositor *compositor, XEvent *event, MetaWindow *window); +#if GTK_CHECK_VERSION (3, 0, 0) + cairo_surface_t *(* get_window_surface) (MetaCompositor *compositor, + MetaWindow *window); +#else Pixmap (*get_window_pixmap) (MetaCompositor *compositor, MetaWindow *window); +#endif void (*set_active_window) (MetaCompositor *compositor, MetaScreen *screen, MetaWindow *window); diff --git a/src/compositor/compositor-xrender.c b/src/compositor/compositor-xrender.c index 5080f80d..1da598c5 100644 --- a/src/compositor/compositor-xrender.c +++ b/src/compositor/compositor-xrender.c @@ -34,6 +34,11 @@ #include #include +#include + +#if GTK_CHECK_VERSION (3, 0, 0) +#include +#endif #include "display.h" #include "screen.h" @@ -2797,6 +2802,46 @@ xrender_process_event (MetaCompositor *compositor, #endif } +#if GTK_CHECK_VERSION (3, 0, 0) +static cairo_surface_t * +xrender_get_window_surface (MetaCompositor *compositor, + MetaWindow *window) +{ +#ifdef HAVE_COMPOSITE_EXTENSIONS + MetaFrame *frame; + Window xwindow; + MetaScreen *screen; + MetaCompWindow *cw; + MetaCompositorXRender *xrc; + Display *display; + Pixmap pixmap; + + frame = meta_window_get_frame (window); + + if (frame) + xwindow = meta_frame_get_xwindow (frame); + else + xwindow = meta_window_get_xwindow (window); + + screen = meta_window_get_screen (window); + cw = find_window_for_screen (screen, xwindow); + + if (cw == NULL) + return NULL; + + xrc = (MetaCompositorXRender *) compositor; + display = meta_display_get_xdisplay (xrc->display); + + if (meta_window_is_shaded (window)) + pixmap = cw->shaded_back_pixmap; + else + pixmap = cw->back_pixmap; + + return cairo_xlib_surface_create (display, pixmap, cw->attrs.visual, + cw->attrs.width, cw->attrs.height); +#endif +} +#else static Pixmap xrender_get_window_pixmap (MetaCompositor *compositor, MetaWindow *window) @@ -2817,6 +2862,7 @@ xrender_get_window_pixmap (MetaCompositor *compositor, return cw->back_pixmap; #endif } +#endif /* GTK_CHECK_VERSION */ static void xrender_set_active_window (MetaCompositor *compositor, @@ -3000,7 +3046,11 @@ static MetaCompositor comp_info = { xrender_remove_window, xrender_set_updates, xrender_process_event, +#if GTK_CHECK_VERSION (3, 0, 0) + xrender_get_window_surface, +#else xrender_get_window_pixmap, +#endif xrender_set_active_window, xrender_free_window, xrender_maximize_window, diff --git a/src/compositor/compositor.c b/src/compositor/compositor.c index f7a28261..4d3f370b 100644 --- a/src/compositor/compositor.c +++ b/src/compositor/compositor.c @@ -107,6 +107,21 @@ meta_compositor_process_event (MetaCompositor *compositor, #endif } +#if GTK_CHECK_VERSION (3, 0, 0) +cairo_surface_t * +meta_compositor_get_window_surface (MetaCompositor *compositor, + MetaWindow *window) +{ +#ifdef HAVE_COMPOSITE_EXTENSIONS + if (compositor && compositor->get_window_surface) + return compositor->get_window_surface (compositor, window); + else + return NULL; +#else + return NULL; +#endif +} +#else Pixmap meta_compositor_get_window_pixmap (MetaCompositor *compositor, MetaWindow *window) @@ -120,6 +135,7 @@ meta_compositor_get_window_pixmap (MetaCompositor *compositor, return None; #endif } +#endif /* GTK_CHECK_VERSION */ void meta_compositor_set_active_window (MetaCompositor *compositor, -- cgit v1.2.1