summaryrefslogtreecommitdiff
path: root/src/core/screen.c
diff options
context:
space:
mode:
authormonsta <[email protected]>2016-03-03 15:19:33 +0300
committermonsta <[email protected]>2016-03-03 17:36:48 +0300
commit9212dacb2bfd5985d8426bf0bdb88f2aca03444e (patch)
tree9e3d84215d52bb348439aa2ea71ed9ad17004712 /src/core/screen.c
parentee01366b6659c9f4238a9a89706aa2b78903ead8 (diff)
downloadmarco-9212dacb2bfd5985d8426bf0bdb88f2aca03444e.tar.bz2
marco-9212dacb2bfd5985d8426bf0bdb88f2aca03444e.tar.xz
[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
Diffstat (limited to 'src/core/screen.c')
-rw-r--r--src/core/screen.c31
1 files changed, 22 insertions, 9 deletions
diff --git a/src/core/screen.c b/src/core/screen.c
index 14fa9953..b4cb5ef7 100644
--- a/src/core/screen.c
+++ b/src/core/screen.c
@@ -1213,7 +1213,6 @@ meta_screen_update_cursor (MetaScreen *screen)
XFreeCursor (screen->display->xdisplay, xcursor);
}
-#if !GTK_CHECK_VERSION (3, 0, 0)
#define MAX_PREVIEW_SIZE 150.0
static GdkPixbuf *
@@ -1221,16 +1220,38 @@ get_window_pixbuf (MetaWindow *window,
int *width,
int *height)
{
+#if GTK_CHECK_VERSION (3, 0, 0)
+ cairo_surface_t *surface;
+#else
Pixmap pmap;
+#endif
GdkPixbuf *pixbuf, *scaled;
double ratio;
+#if GTK_CHECK_VERSION (3, 0, 0)
+ surface = meta_compositor_get_window_surface (window->display->compositor,
+ window);
+ if (surface == None)
+ return NULL;
+#else
pmap = meta_compositor_get_window_pixmap (window->display->compositor,
window);
if (pmap == None)
return NULL;
+#endif
+
+ meta_error_trap_push (NULL);
+#if GTK_CHECK_VERSION (3, 0, 0)
+ pixbuf = meta_ui_get_pixbuf_from_surface (surface);
+ cairo_surface_destroy (surface);
+#else
pixbuf = meta_ui_get_pixbuf_from_pixmap (pmap);
+#endif
+
+ if (meta_error_trap_pop_with_return (NULL, FALSE) != Success)
+ g_clear_object (&pixbuf);
+
if (pixbuf == NULL)
return NULL;
@@ -1256,7 +1277,6 @@ get_window_pixbuf (MetaWindow *window,
g_object_unref (pixbuf);
return scaled;
}
-#endif
void
meta_screen_ensure_tab_popup (MetaScreen *screen,
@@ -1290,17 +1310,14 @@ meta_screen_ensure_tab_popup (MetaScreen *screen,
{
MetaWindow *window;
MetaRectangle r;
-#if !GTK_CHECK_VERSION (3, 0, 0)
GdkPixbuf *win_pixbuf = NULL;
int width = 0, height = 0;
-#endif
window = tmp->data;
entries[i].key = (MetaTabEntryKey) window->xwindow;
entries[i].title = window->title;
-#if !GTK_CHECK_VERSION (3, 0, 0)
/* Only get the pixbuf if the user does NOT have
compositing-fast-alt-tab-set to true
in GSettings. There is an obvious lag when the pixbuf is
@@ -1333,10 +1350,6 @@ meta_screen_ensure_tab_popup (MetaScreen *screen,
t_width - icon_width, t_height - icon_height,
1.0, 1.0, GDK_INTERP_BILINEAR, 255);
}
-#else
- /* at the moment, thumbnails are disabled for GTK3 */
- entries[i].icon = g_object_ref (window->icon);
-#endif
entries[i].blank = FALSE;
entries[i].hidden = !meta_window_showing_on_its_workspace (window);