summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorStefano Karapetsas <[email protected]>2014-01-24 11:29:35 +0100
committerStefano Karapetsas <[email protected]>2014-01-24 11:29:35 +0100
commite7548428cd64022b6b1c39265e0a6fa63a7f78d8 (patch)
tree2498643b6a28423227df1880ff7f16887583b5d5 /src/core
parente7f50837683fc30d29768ce6b00e0b1c6b476b48 (diff)
downloadmarco-e7548428cd64022b6b1c39265e0a6fa63a7f78d8.tar.bz2
marco-e7548428cd64022b6b1c39265e0a6fa63a7f78d8.tar.xz
core: Improve GTK3 support
Diffstat (limited to 'src/core')
-rw-r--r--src/core/display.c4
-rw-r--r--src/core/errors.c37
-rw-r--r--src/core/screen.c13
3 files changed, 52 insertions, 2 deletions
diff --git a/src/core/display.c b/src/core/display.c
index 584ca098..d950e7ea 100644
--- a/src/core/display.c
+++ b/src/core/display.c
@@ -1454,7 +1454,11 @@ static gboolean maybe_send_event_to_gtk(MetaDisplay* display, XEvent* xevent)
return FALSE;
}
+#if GTK_CHECK_VERSION (3, 0, 0)
+ gdk_window = gdk_x11_window_lookup_for_display(gdk_display, window);
+#else
gdk_window = gdk_window_lookup_for_display(gdk_display, window);
+#endif
if (gdk_window == NULL)
{
diff --git a/src/core/errors.c b/src/core/errors.c
index c603ccfd..fc89e096 100644
--- a/src/core/errors.c
+++ b/src/core/errors.c
@@ -28,6 +28,7 @@
#include <errno.h>
#include <stdlib.h>
#include <gdk/gdk.h>
+#include <gtk/gtk.h>
#ifdef __GNUC__
#define UNUSED_VARIABLE __attribute__ ((unused))
@@ -35,17 +36,51 @@
#define UNUSED_VARIABLE
#endif
+#if !GTK_CHECK_VERSION (3, 0, 0)
static int x_error_handler (Display *display,
XErrorEvent *error);
static int x_io_error_handler (Display *display);
+#endif
void
meta_errors_init (void)
{
+#if !GTK_CHECK_VERSION (3, 0, 0)
XSetErrorHandler (x_error_handler);
XSetIOErrorHandler (x_io_error_handler);
+#endif
+}
+
+#if GTK_CHECK_VERSION (3, 0, 0)
+
+void
+meta_error_trap_push (MetaDisplay *display)
+{
+ gdk_error_trap_push ();
+}
+
+void
+meta_error_trap_pop (MetaDisplay *display,
+ gboolean last_request_was_roundtrip)
+{
+ gdk_error_trap_pop_ignored ();
}
+void
+meta_error_trap_push_with_return (MetaDisplay *display)
+{
+ gdk_error_trap_push ();
+}
+
+int
+meta_error_trap_pop_with_return (MetaDisplay *display,
+ gboolean last_request_was_roundtrip)
+{
+ return gdk_error_trap_pop ();
+}
+
+#else
+
typedef struct ForeignDisplay ForeignDisplay;
struct ForeignDisplay
@@ -292,3 +327,5 @@ x_io_error_handler (Display *xdisplay)
return 0;
}
+
+#endif
diff --git a/src/core/screen.c b/src/core/screen.c
index e8fce40a..a35447ad 100644
--- a/src/core/screen.c
+++ b/src/core/screen.c
@@ -1197,6 +1197,7 @@ 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 *
@@ -1239,7 +1240,8 @@ get_window_pixbuf (MetaWindow *window,
g_object_unref (pixbuf);
return scaled;
}
-
+#endif
+
void
meta_screen_ensure_tab_popup (MetaScreen *screen,
MetaTabList list_type,
@@ -1272,14 +1274,17 @@ 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
@@ -1312,7 +1317,11 @@ 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);
entries[i].demands_attention = window->wm_state_demands_attention;