diff options
Diffstat (limited to 'src/caja-desktop-window.c')
-rw-r--r-- | src/caja-desktop-window.c | 141 |
1 files changed, 0 insertions, 141 deletions
diff --git a/src/caja-desktop-window.c b/src/caja-desktop-window.c index 1cc14348..f843d718 100644 --- a/src/caja-desktop-window.c +++ b/src/caja-desktop-window.c @@ -35,128 +35,17 @@ #include <libcaja-private/caja-icon-names.h> #include <gio/gio.h> #include <glib/gi18n.h> -#if GTK_CHECK_VERSION(3, 21, 0) -#define MATE_DESKTOP_USE_UNSTABLE_API -#include <libmate-desktop/mate-bg.h> -#endif struct CajaDesktopWindowDetails { gulong size_changed_id; gboolean loaded; -#if GTK_CHECK_VERSION(3, 21, 0) - gboolean composited; - cairo_surface_t *surface; -#endif }; G_DEFINE_TYPE (CajaDesktopWindow, caja_desktop_window, CAJA_TYPE_SPATIAL_WINDOW); -#if GTK_CHECK_VERSION(3, 21, 0) - -static void -background_changed (CajaDesktopWindow *window) -{ - GdkScreen *screen = gdk_screen_get_default (); - - if (window->details->surface) { - cairo_surface_destroy (window->details->surface); - } - - window->details->surface = mate_bg_get_surface_from_root (screen); - gtk_widget_queue_draw (GTK_WIDGET (window)); -} - -static GdkFilterReturn -filter_func (GdkXEvent *xevent, - GdkEvent *event, - CajaDesktopWindow *window) -{ - XEvent *xev = (XEvent *) xevent; - GdkAtom gdkatom; - - if (xev->type != PropertyNotify) { - return GDK_FILTER_CONTINUE; - } - - gdkatom = gdk_atom_intern_static_string ("_XROOTPMAP_ID"); - if (xev->xproperty.atom != gdk_x11_atom_to_xatom (gdkatom)) { - return GDK_FILTER_CONTINUE; - } - - background_changed (window); - - return GDK_FILTER_CONTINUE; -} - -static void -caja_desktop_window_composited_changed (GtkWidget *widget) -{ - CajaDesktopWindow *window = CAJA_DESKTOP_WINDOW (widget); - GdkScreen *screen = gdk_screen_get_default (); - gboolean composited = gdk_screen_is_composited (screen); - GdkWindow *root; - - if (window->details->composited == composited) { - return; - } - - window->details->composited = composited; - root = gdk_screen_get_root_window (screen); - - if (composited) { - gdk_window_remove_filter (root, (GdkFilterFunc) filter_func, window); - - if (window->details->surface) { - cairo_surface_destroy (window->details->surface); - window->details->surface = NULL; - } - } else { - gint events = gdk_window_get_events (root); - - gdk_window_set_events (root, events | GDK_PROPERTY_CHANGE_MASK); - gdk_window_add_filter (root, (GdkFilterFunc) filter_func, window); - background_changed (window); - } -} - -static gboolean -caja_desktop_window_draw (GtkWidget *widget, - cairo_t *cr) -{ - CajaDesktopWindow *window = CAJA_DESKTOP_WINDOW (widget); - - if (window->details->surface) { - cairo_set_source_surface (cr, window->details->surface, 0, 0); - cairo_paint (cr); - } - - return GTK_WIDGET_CLASS (caja_desktop_window_parent_class)->draw (widget, cr); -} - -static void -caja_desktop_window_finalize (GObject *obj) -{ - CajaDesktopWindow *window = CAJA_DESKTOP_WINDOW (obj); - - if (window->details->composited == FALSE) { - GdkScreen *screen = gdk_screen_get_default (); - GdkWindow *root = gdk_screen_get_root_window (screen); - - gdk_window_remove_filter (root, (GdkFilterFunc) filter_func, window); - } - - if (window->details->surface) { - cairo_surface_destroy (window->details->surface); - window->details->surface = NULL; - } - - G_OBJECT_CLASS (caja_desktop_window_parent_class)->finalize (obj); -} -#endif - static void caja_desktop_window_init (CajaDesktopWindow *window) { @@ -173,11 +62,6 @@ caja_desktop_window_init (CajaDesktopWindow *window) gtk_style_context_add_class (context, "caja-desktop-window"); #endif -#if GTK_CHECK_VERSION(3, 21, 0) - window->details->composited = TRUE; - caja_desktop_window_composited_changed (GTK_WIDGET (window)); -#endif - gtk_window_move (GTK_WINDOW (window), 0, 0); /* shouldn't really be needed given our semantic type @@ -283,13 +167,6 @@ map (GtkWidget *widget) /* Chain up to realize our children */ GTK_WIDGET_CLASS (caja_desktop_window_parent_class)->map (widget); gdk_window_lower (gtk_widget_get_window (widget)); -#if GTK_CHECK_VERSION(3, 21, 0) - GdkWindow *window; - GdkRGBA transparent = { 0, 0, 0, 0 }; - - window = gtk_widget_get_window (widget); - gdk_window_set_background_rgba (window, &transparent); -#endif } static void @@ -359,21 +236,12 @@ realize (GtkWidget *widget) { CajaDesktopWindow *window; CajaDesktopWindowDetails *details; -#if GTK_CHECK_VERSION(3, 21, 0) - GdkVisual *visual; -#endif window = CAJA_DESKTOP_WINDOW (widget); details = window->details; /* Make sure we get keyboard events */ gtk_widget_set_events (widget, gtk_widget_get_events (widget) | GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK); -#if GTK_CHECK_VERSION(3, 21, 0) - visual = gdk_screen_get_rgba_visual (gtk_widget_get_screen (widget)); - if (visual) { - gtk_widget_set_visual (widget, visual); - } -#endif /* Do the work of realizing. */ GTK_WIDGET_CLASS (caja_desktop_window_parent_class)->realize (widget); @@ -405,19 +273,10 @@ caja_desktop_window_class_init (CajaDesktopWindowClass *klass) { GtkWidgetClass *wclass = GTK_WIDGET_CLASS (klass); CajaWindowClass *nclass = CAJA_WINDOW_CLASS (klass); -#if GTK_CHECK_VERSION(3, 21, 0) - GObjectClass *object_class = G_OBJECT_CLASS (klass); - - object_class->finalize = caja_desktop_window_finalize; -#endif wclass->realize = realize; wclass->unrealize = unrealize; wclass->map = map; -#if GTK_CHECK_VERSION(3, 21, 0) - wclass->composited_changed = caja_desktop_window_composited_changed; - wclass->draw = caja_desktop_window_draw; -#endif nclass->window_type = CAJA_WINDOW_DESKTOP; nclass->get_title = real_get_title; nclass->get_icon = real_get_icon; |