summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mate-panel/Makefile.am2
-rw-r--r--mate-panel/panel-background-monitor.c410
-rw-r--r--mate-panel/panel-background-monitor.h68
-rw-r--r--mate-panel/panel-background.c238
-rw-r--r--mate-panel/panel-background.h10
5 files changed, 6 insertions, 722 deletions
diff --git a/mate-panel/Makefile.am b/mate-panel/Makefile.am
index 1a2a8ee3..6cd56ff1 100644
--- a/mate-panel/Makefile.am
+++ b/mate-panel/Makefile.am
@@ -72,7 +72,6 @@ panel_sources += \
panel-xutils.c \
panel-force-quit.c \
panel-action-protocol.c \
- panel-background-monitor.c \
panel-struts.c
endif
@@ -133,7 +132,6 @@ panel_sources += \
panel-xutils.h \
panel-force-quit.h \
panel-action-protocol.h \
- panel-background-monitor.h \
panel-struts.h
endif
diff --git a/mate-panel/panel-background-monitor.c b/mate-panel/panel-background-monitor.c
deleted file mode 100644
index 4c33aedf..00000000
--- a/mate-panel/panel-background-monitor.c
+++ /dev/null
@@ -1,410 +0,0 @@
-/*
- * panel-background-monitor.c:
- *
- * Copyright (C) 2001, 2002 Ian McKellar <[email protected]>
- * 2002 Sun Microsystems, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- *
- * Authors:
- * Ian McKellar <[email protected]>
- * Mark McLoughlin <[email protected]>
- */
-
-#include <config.h>
-
-#ifndef HAVE_X11
-#error file should only be compiled when HAVE_X11 is enabled
-#endif
-
-#include <glib.h>
-#include <glib-object.h>
-#include <gdk/gdk.h>
-#include <gdk/gdkx.h>
-#include <cairo-xlib.h>
-#include <X11/Xlib.h>
-#include <X11/Xatom.h>
-
-#define MATE_DESKTOP_USE_UNSTABLE_API
-#include <libmate-desktop/mate-bg.h>
-
-#include "panel-background-monitor.h"
-#include "panel-util.h"
-
-enum {
- CHANGED,
- LAST_SIGNAL
-};
-
-static void panel_background_monitor_changed (PanelBackgroundMonitor *monitor);
-
-static GdkFilterReturn panel_background_monitor_xevent_filter (GdkXEvent *xevent,
- GdkEvent *event,
- gpointer data);
-
-struct _PanelBackgroundMonitorClass {
- GObjectClass parent_class;
- void (*changed) (PanelBackgroundMonitor *monitor);
-};
-
-struct _PanelBackgroundMonitor {
- GObject parent_instance;
-
- GdkScreen *screen;
-
- Window xwindow;
- GdkWindow *gdkwindow;
-
- Atom xatom;
- GdkAtom gdkatom;
-
- cairo_surface_t *surface;
- GdkPixbuf *gdkpixbuf;
-
- int width;
- int height;
-
- gboolean display_grabbed;
-};
-
-G_DEFINE_TYPE (PanelBackgroundMonitor, panel_background_monitor, G_TYPE_OBJECT)
-
-static PanelBackgroundMonitor *global_background_monitor = NULL;
-
-static guint signals [LAST_SIGNAL] = { 0 };
-
-gboolean gdk_window_check_composited_wm(GdkWindow* window)
-{
- g_return_val_if_fail (GDK_IS_X11_WINDOW (window), TRUE);
- return gdk_screen_is_composited(gdk_window_get_screen(window));
-}
-
-static void
-panel_background_monitor_finalize (GObject *object)
-{
- PanelBackgroundMonitor *monitor;
-
- monitor = PANEL_BACKGROUND_MONITOR (object);
-
- gdk_window_remove_filter (
- monitor->gdkwindow, panel_background_monitor_xevent_filter, monitor);
- g_signal_handlers_disconnect_by_func (monitor->screen,
- panel_background_monitor_changed, monitor);
-
- if (monitor->surface)
- cairo_surface_destroy (monitor->surface);
- monitor->surface= NULL;
-
- if (monitor->gdkpixbuf)
- g_object_unref (monitor->gdkpixbuf);
- monitor->gdkpixbuf = NULL;
-
- G_OBJECT_CLASS (panel_background_monitor_parent_class)->finalize (object);
-}
-
-static void
-panel_background_monitor_class_init (PanelBackgroundMonitorClass *klass)
-{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
-
- signals [CHANGED] =
- g_signal_new ("changed",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (PanelBackgroundMonitorClass, changed),
- NULL, NULL,
- g_cclosure_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
-
- object_class->finalize = panel_background_monitor_finalize;
-}
-
-static void
-panel_background_monitor_init (PanelBackgroundMonitor *monitor)
-{
- monitor->screen = NULL;
-
- monitor->gdkwindow = NULL;
- monitor->xwindow = None;
-
- monitor->gdkatom = gdk_atom_intern_static_string ("_XROOTPMAP_ID");
- monitor->xatom = gdk_x11_atom_to_xatom (monitor->gdkatom);
-
- monitor->surface = NULL;
- monitor->gdkpixbuf = NULL;
-
- monitor->display_grabbed = FALSE;
-}
-
-static void
-panel_background_monitor_connect_to_screen (PanelBackgroundMonitor *monitor,
- GdkScreen *screen)
-{
- if (monitor->screen != NULL && monitor->gdkwindow != NULL) {
- gdk_window_remove_filter (monitor->gdkwindow,
- panel_background_monitor_xevent_filter,
- monitor);
- }
-
- monitor->screen = screen;
- g_signal_connect_swapped (screen, "size-changed",
- G_CALLBACK (panel_background_monitor_changed), monitor);
-
- monitor->gdkwindow = gdk_screen_get_root_window (screen);
- monitor->xwindow = GDK_WINDOW_XID (monitor->gdkwindow);
-
- gdk_window_add_filter (
- monitor->gdkwindow, panel_background_monitor_xevent_filter, monitor);
-
- gdk_window_set_events (
- monitor->gdkwindow,
- gdk_window_get_events (monitor->gdkwindow) | GDK_PROPERTY_CHANGE_MASK);
-}
-
-static PanelBackgroundMonitor *
-panel_background_monitor_new (GdkScreen *screen)
-{
- PanelBackgroundMonitor *monitor;
-
- monitor = g_object_new (PANEL_TYPE_BACKGROUND_MONITOR, NULL);
-
- panel_background_monitor_connect_to_screen (monitor, screen);
-
- return monitor;
-}
-
-PanelBackgroundMonitor *
-panel_background_monitor_get_for_screen (GdkScreen *screen)
-{
- g_return_val_if_fail (GDK_IS_X11_SCREEN (screen), NULL);
-
- if (!global_background_monitor) {
- global_background_monitor = panel_background_monitor_new (screen);
-
- g_object_add_weak_pointer (G_OBJECT (global_background_monitor),
- (void **) &global_background_monitor);
-
- return global_background_monitor;
- }
-
- return g_object_ref (global_background_monitor);
-}
-
-static void
-panel_background_monitor_changed (PanelBackgroundMonitor *monitor)
-{
- if (monitor->surface)
- cairo_surface_destroy (monitor->surface);
- monitor->surface = NULL;
-
- if (monitor->gdkpixbuf)
- g_object_unref (monitor->gdkpixbuf);
- monitor->gdkpixbuf = NULL;
-
- g_signal_emit (monitor, signals [CHANGED], 0);
-}
-
-static GdkFilterReturn
-panel_background_monitor_xevent_filter (GdkXEvent *xevent,
- GdkEvent *event,
- gpointer data)
-{
- PanelBackgroundMonitor *monitor;
- XEvent *xev;
-
- g_return_val_if_fail (PANEL_IS_BACKGROUND_MONITOR (data), GDK_FILTER_CONTINUE);
-
- monitor = PANEL_BACKGROUND_MONITOR (data);
- xev = (XEvent *) xevent;
-
- if (xev->type == PropertyNotify &&
- xev->xproperty.atom == monitor->xatom &&
- xev->xproperty.window == monitor->xwindow)
- panel_background_monitor_changed (monitor);
-
- return GDK_FILTER_CONTINUE;
-}
-
-static GdkPixbuf *
-panel_background_monitor_tile_background (PanelBackgroundMonitor *monitor,
- int width,
- int height)
-{
- GdkPixbuf *retval;
- int tilewidth, tileheight;
-
- retval = gdk_pixbuf_new (GDK_COLORSPACE_RGB, FALSE, 8, width, height);
-
- tilewidth = gdk_pixbuf_get_width (monitor->gdkpixbuf);
- tileheight = gdk_pixbuf_get_height (monitor->gdkpixbuf);
-
- if (tilewidth == 1 && tileheight == 1) {
- guchar *pixels;
- int n_channels;
- guint32 pixel = 0;
-
- n_channels = gdk_pixbuf_get_n_channels (monitor->gdkpixbuf);
- pixels = gdk_pixbuf_get_pixels (monitor->gdkpixbuf);
-
- if (pixels) {
- if (n_channels == 4)
- pixel = ((guint32 *) pixels) [0];
- else if (n_channels == 3)
- pixel = pixels [0] << 24 | pixels [1] << 16 | pixels [2] << 8;
- }
-
- gdk_pixbuf_fill (retval, pixel);
- } else {
- unsigned char *data;
- cairo_t *cr;
- cairo_surface_t *surface;
- cairo_pattern_t *pattern;
-
- data = g_malloc (width * height * 4);
- if (!data)
- return NULL;
-
- surface = cairo_image_surface_create_for_data (data,
- CAIRO_FORMAT_RGB24,
- width, height,
- width * 4);
- cr = cairo_create (surface);
- cairo_set_source_rgb (cr, 1, 1, 1);
- cairo_paint (cr);
-
- gdk_cairo_set_source_pixbuf (cr, monitor->gdkpixbuf, 0, 0);
- pattern = cairo_get_source (cr);
- cairo_pattern_set_extend (pattern, CAIRO_EXTEND_REPEAT);
- cairo_rectangle (cr, 0, 0, width, height);
- cairo_fill (cr);
-
- cairo_destroy (cr);
- cairo_surface_destroy (surface);
-
- retval = panel_util_cairo_rgbdata_to_pixbuf (data,
- width, height);
-
- g_free (data);
- }
-
- return retval;
-}
-
-static void
-panel_background_monitor_setup_pixbuf (PanelBackgroundMonitor *monitor)
-{
- GdkDisplay *display;
- int rwidth, rheight;
- int pwidth, pheight;
-
- display = gdk_screen_get_display (monitor->screen);
-
- gdk_x11_display_grab (display);
- monitor->display_grabbed = TRUE;
-
- if (!monitor->surface)
- monitor->surface = mate_bg_get_surface_from_root (monitor->screen);
-
- if (!monitor->surface)
- {
- g_warning ("couldn't get background pixmap\n");
- gdk_x11_display_ungrab (display);
- monitor->display_grabbed = FALSE;
- return;
- }
-
- pwidth = cairo_xlib_surface_get_width (monitor->surface);
- pheight = cairo_xlib_surface_get_height (monitor->surface);
-
- gdk_window_get_geometry (monitor->gdkwindow,
- NULL, NULL, &rwidth, &rheight);
-
- monitor->width = MIN (pwidth, rwidth);
- monitor->height = MIN (pheight, rheight);
-
- g_assert (monitor->gdkpixbuf == NULL);
- monitor->gdkpixbuf = gdk_pixbuf_get_from_surface (monitor->surface,
- 0, 0,
- monitor->width, monitor->height);
-
- gdk_x11_display_ungrab (display);
- monitor->display_grabbed = FALSE;
-
- if (monitor->gdkpixbuf == NULL)
- return;
-
- if ((monitor->width < rwidth || monitor->height < rheight)) {
- GdkPixbuf *tiled;
-
- tiled = panel_background_monitor_tile_background (
- monitor, rwidth, rheight);
- g_object_unref (monitor->gdkpixbuf);
- monitor->gdkpixbuf = tiled;
-
- monitor->width = rwidth;
- monitor->height = rheight;
- }
-}
-
-GdkPixbuf *
-panel_background_monitor_get_region (PanelBackgroundMonitor *monitor,
- int x,
- int y,
- int width,
- int height)
-{
- GdkPixbuf *pixbuf, *tmpbuf;
- int subwidth, subheight;
- int subx, suby;
-
- g_return_val_if_fail (monitor, NULL);
- g_return_val_if_fail (GDK_IS_X11_WINDOW (monitor->gdkwindow), NULL);
-
- if (!monitor->gdkpixbuf)
- panel_background_monitor_setup_pixbuf (monitor);
-
- if (!monitor->gdkpixbuf)
- return NULL;
-
- subwidth = MIN (width, monitor->width - x);
- subheight = MIN (height, monitor->height - y);
- /* if x or y are negative numbers */
- subwidth = MIN (subwidth, width + x);
- subheight = MIN (subheight, height + y);
-
- subx = MAX (x, 0);
- suby = MAX (y, 0);
-
- if ((subwidth <= 0) || (subheight <= 0) ||
- (monitor->width-x < 0) || (monitor->height-y < 0) )
- /* region is completely offscreen */
- return gdk_pixbuf_new (GDK_COLORSPACE_RGB, FALSE, 8,
- width, height);
-
- pixbuf = gdk_pixbuf_new_subpixbuf (
- monitor->gdkpixbuf, subx, suby, subwidth, subheight);
-
- if ((subwidth < width) || (subheight < height)) {
- tmpbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, FALSE, 8,
- width, height);
- gdk_pixbuf_copy_area (pixbuf, 0, 0, subwidth, subheight,
- tmpbuf, (x < 0) ? -x : 0, (y < 0) ? -y : 0);
- g_object_unref (pixbuf);
- pixbuf = tmpbuf;
- }
-
- return pixbuf;
-}
diff --git a/mate-panel/panel-background-monitor.h b/mate-panel/panel-background-monitor.h
deleted file mode 100644
index 09b7b91e..00000000
--- a/mate-panel/panel-background-monitor.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * panel-background-monitor.h:
- *
- * Copyright (C) 2001, 2002 Ian McKellar <[email protected]>
- * 2002 Sun Microsystems, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- *
- * Authors:
- * Ian McKellar <[email protected]>
- * Mark McLoughlin <[email protected]>
- */
-
-#ifndef __PANEL_BACKGROUND_MONITOR_H__
-#define __PANEL_BACKGROUND_MONITOR_H__
-
-#ifdef PACKAGE_NAME /* only check HAVE_X11 if config.h has been included */
-#ifndef HAVE_X11
-#error file should only be included when HAVE_X11 is enabled
-#endif
-#endif
-
-#include <glib.h>
-#include <glib-object.h>
-#include <gdk/gdk.h>
-
-#define PANEL_TYPE_BACKGROUND_MONITOR (panel_background_monitor_get_type ())
-#define PANEL_BACKGROUND_MONITOR(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), \
- PANEL_TYPE_BACKGROUND_MONITOR, \
- PanelBackgroundMonitor))
-#define PANEL_BACKGROUND_MONITOR_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), \
- PANEL_TYPE_BACKGROUND_MONITOR, \
- PanelBackgroundMonitorClass))
-#define PANEL_IS_BACKGROUND_MONITOR(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), \
- PANEL_TYPE_BACKGROUND_MONITOR))
-#define PANEL_IS_BACKGROUND_MONITOR_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), \
- PANEL_TYPE_BACKGROUND_MONITOR))
-#define PANEL_BACKGROUND_MONITOR_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), \
- PANEL_TYPE_BACKGROUND_MONITOR, \
- PanelBackgroundMonitorClass))
-
-typedef struct _PanelBackgroundMonitorClass PanelBackgroundMonitorClass;
-typedef struct _PanelBackgroundMonitor PanelBackgroundMonitor;
-
-gboolean gdk_window_check_composited_wm (GdkWindow* window);
-
-GType panel_background_monitor_get_type (void);
-PanelBackgroundMonitor *panel_background_monitor_get_for_screen (GdkScreen *screen);
-GdkPixbuf *panel_background_monitor_get_region (PanelBackgroundMonitor *monitor,
- int x,
- int y,
- int width,
- int height);
-
-#endif /* __PANEL_BACKGROUND_MONITOR_H__ */
diff --git a/mate-panel/panel-background.c b/mate-panel/panel-background.c
index 3ce08a5b..132d8921 100644
--- a/mate-panel/panel-background.c
+++ b/mate-panel/panel-background.c
@@ -42,15 +42,6 @@
static gboolean panel_background_composite (PanelBackground *background);
static void load_background_file (PanelBackground *background);
-
-static void
-set_pixbuf_background (PanelBackground *background)
-{
- g_assert (background->composited_pattern != NULL);
-
- gdk_window_set_background_pattern (background->window, background->composited_pattern);
-}
-
void panel_background_apply_css (PanelBackground *background, GtkWidget *widget)
{
GtkStyleContext *context;
@@ -143,21 +134,12 @@ panel_background_prepare (PanelBackground *background)
break;
case PANEL_BACK_COLOR:
-#ifdef HAVE_X11
- if (GDK_IS_X11_DISPLAY (gdk_display_get_default ()) &&
- background->has_alpha &&
- !gdk_window_check_composited_wm(background->window))
- set_pixbuf_background (background);
- else
-#endif /* HAVE_X11 */
- { /* Not using X11, or pixbuf background not needed */
- gdk_window_set_background_rgba (background->window,
- &background->color);
- }
+ gdk_window_set_background_rgba (background->window, &background->color);
break;
case PANEL_BACK_IMAGE:
- set_pixbuf_background (background);
+ g_assert (background->composited_pattern);
+ gdk_window_set_background_pattern (background->window, background->composited_pattern);
break;
default:
@@ -195,69 +177,6 @@ free_composited_resources (PanelBackground *background)
background->composited_pattern = NULL;
}
-#ifdef HAVE_X11
-
-static void _panel_background_transparency(GdkScreen* screen,PanelBackground* background)
-{
- panel_background_composite(background);
-}
-
-static void
-background_changed (PanelBackgroundMonitor *monitor,
- PanelBackground *background)
-{
- GdkPixbuf *tmp;
-
- g_return_if_fail (GDK_IS_X11_DISPLAY (gdk_display_get_default ()));
-
- tmp = background->desktop;
-
- background->desktop = panel_background_monitor_get_region (
- background->monitor,
- background->region.x,
- background->region.y,
- background->region.width,
- background->region.height);
-
- if (tmp)
- g_object_unref (tmp);
-
- panel_background_composite (background);
-}
-
-static GdkPixbuf *
-get_desktop_pixbuf (PanelBackground *background)
-{
- GdkPixbuf *desktop;
-
- g_return_val_if_fail (GDK_IS_X11_DISPLAY (gdk_display_get_default ()), NULL);
-
- if (!background->monitor) {
- background->monitor =
- panel_background_monitor_get_for_screen (
- gdk_window_get_screen (background->window));
-
- background->monitor_signal =
- g_signal_connect (
- background->monitor, "changed",
- G_CALLBACK (background_changed), background);
- }
- g_signal_connect(gdk_window_get_screen(background->window), "composited-changed",
- G_CALLBACK(_panel_background_transparency),
- background);
-
- desktop = panel_background_monitor_get_region (
- background->monitor,
- background->region.x,
- background->region.y,
- background->region.width,
- background->region.height);
-
- return desktop;
-}
-
-#endif /* HAVE_X11 */
-
static cairo_pattern_t *
composite_image_onto_desktop (PanelBackground *background)
{
@@ -279,24 +198,6 @@ composite_image_onto_desktop (PanelBackground *background)
cr = cairo_create (surface);
-#ifdef HAVE_X11
- if (GDK_IS_X11_DISPLAY (gdk_display_get_default ())) {
- if (!background->desktop)
- background->desktop = get_desktop_pixbuf (background);
-
- if(!gdk_window_check_composited_wm (background->window)){
- cairo_set_source_rgb (cr, 1, 1, 1);
- cairo_paint (cr);
-
- if (background->desktop) {
- gdk_cairo_set_source_pixbuf (cr, background->desktop, 0, 0);
- cairo_rectangle (cr, 0, 0, width, height);
- cairo_fill (cr);
- }
- }
- }
-#endif /* HAVE_X11 */
-
gdk_cairo_set_source_pixbuf (cr, background->transformed_image, 0, 0);
pattern = cairo_get_source (cr);
cairo_pattern_set_extend (pattern, CAIRO_EXTEND_REPEAT);
@@ -311,71 +212,6 @@ composite_image_onto_desktop (PanelBackground *background)
return pattern;
}
-static cairo_pattern_t *
-composite_color_onto_desktop (PanelBackground *background)
-{
- cairo_surface_t *surface;
- cairo_pattern_t *pattern;
- cairo_t *cr;
-
- surface = gdk_window_create_similar_surface (background->window,
- CAIRO_CONTENT_COLOR_ALPHA,
- background->region.width,
- background->region.height);
- if (cairo_surface_status (surface) != CAIRO_STATUS_SUCCESS) {
- cairo_surface_destroy (surface);
- return NULL;
- }
-
- cr = cairo_create (surface);
-
-#ifdef HAVE_X11
- if (GDK_IS_X11_DISPLAY (gdk_display_get_default ())) {
- if (!background->desktop)
- background->desktop = get_desktop_pixbuf (background);
-
- if(!gdk_window_check_composited_wm (background->window)){
- if (background->desktop) {
- gdk_cairo_set_source_pixbuf (cr, background->desktop, 0, 0);
- cairo_paint (cr);
- }
- }
- }
-#endif /* HAVE_X11 */
-
- gdk_cairo_set_source_rgba (cr, &background->color);
- cairo_paint (cr);
-
- cairo_destroy (cr);
-
- pattern = cairo_pattern_create_for_surface (surface);
- cairo_surface_destroy (surface);
-
- return pattern;
-}
-
-static cairo_pattern_t *
-get_composited_pattern (PanelBackground *background)
-{
- cairo_pattern_t *retval = NULL;
-
- switch (background->type) {
- case PANEL_BACK_NONE:
- break;
- case PANEL_BACK_COLOR:
- retval = composite_color_onto_desktop (background);
- break;
- case PANEL_BACK_IMAGE:
- retval = composite_image_onto_desktop (background);
- break;
- default:
- g_assert_not_reached ();
- break;
- }
-
- return retval;
-}
-
static gboolean
panel_background_composite (PanelBackground *background)
{
@@ -386,16 +222,12 @@ panel_background_composite (PanelBackground *background)
switch (background->type) {
case PANEL_BACK_NONE:
- break;
case PANEL_BACK_COLOR:
- if (background->has_alpha)
- background->composited_pattern =
- get_composited_pattern (background);
break;
case PANEL_BACK_IMAGE:
if (background->transformed_image) {
background->composited_pattern =
- get_composited_pattern (background);
+ composite_image_onto_desktop (background);
}
break;
default:
@@ -568,25 +400,6 @@ panel_background_transform (PanelBackground *background)
return TRUE;
}
-#ifdef HAVE_X11
-static void
-disconnect_background_monitor (PanelBackground *background)
-{
- g_return_if_fail (GDK_IS_X11_DISPLAY (gdk_display_get_default ()));
- if (background->monitor) {
- g_signal_handler_disconnect (
- background->monitor, background->monitor_signal);
- background->monitor_signal = -1;
- g_object_unref (background->monitor);
- }
- background->monitor = NULL;
-
- if (background->desktop)
- g_object_unref (background->desktop);
- background->desktop = NULL;
-}
-#endif /* HAVE_X11 */
-
static void
panel_background_update_has_alpha (PanelBackground *background)
{
@@ -600,13 +413,6 @@ panel_background_update_has_alpha (PanelBackground *background)
has_alpha = gdk_pixbuf_get_has_alpha (background->loaded_image);
background->has_alpha = has_alpha;
-
-#ifdef HAVE_X11
- if (GDK_IS_X11_DISPLAY (gdk_display_get_default ())) {
- if (!has_alpha)
- disconnect_background_monitor (background);
- }
-#endif /* HAVE_X11 */
}
static void
@@ -903,12 +709,6 @@ panel_background_change_region (PanelBackground *background,
background->orientation = orientation;
-#ifdef HAVE_X11
- if (background->desktop)
- g_object_unref (background->desktop);
- background->desktop = NULL;
-#endif /* HAVE_X11 */
-
if (need_to_retransform || ! background->transformed)
/* only retransform the background if we have in
fact changed size/orientation */
@@ -948,12 +748,6 @@ panel_background_init (PanelBackground *background,
background->transformed_image = NULL;
background->composited_pattern = NULL;
-#ifdef HAVE_X11
- background->monitor = NULL;
- background->desktop = NULL;
- background->monitor_signal = -1;
-#endif /* HAVE_X11 */
-
background->window = NULL;
background->default_pattern = NULL;
@@ -976,12 +770,6 @@ panel_background_init (PanelBackground *background,
void
panel_background_free (PanelBackground *background)
{
-#ifdef HAVE_X11
- if (GDK_IS_X11_DISPLAY (gdk_display_get_default ())) {
- disconnect_background_monitor (background);
- }
-#endif /* HAVE_X11 */
-
free_transformed_resources (background);
if (background->image)
@@ -992,12 +780,6 @@ panel_background_free (PanelBackground *background)
g_object_unref (background->loaded_image);
background->loaded_image = NULL;
-#ifdef HAVE_X11
- if (background->monitor)
- g_object_unref (background->monitor);
- background->monitor = NULL;
-#endif /* HAVE_X11 */
-
if (background->window)
g_object_unref (background->window);
background->window = NULL;
@@ -1019,13 +801,7 @@ panel_background_make_string (PanelBackground *background,
effective_type = panel_background_effective_type (background);
-#ifdef HAVE_X11
- if (is_using_x11 () &&
- (effective_type == PANEL_BACK_IMAGE ||
- (effective_type == PANEL_BACK_COLOR &&
- background->has_alpha &&
- !gdk_window_check_composited_wm(background->window)))) {
-
+ if (effective_type == PANEL_BACK_IMAGE) {
cairo_surface_t *surface;
if (!background->composited_pattern)
@@ -1038,9 +814,7 @@ panel_background_make_string (PanelBackground *background,
return NULL;
retval = g_strdup_printf ("pixmap:%d,%d,%d", (guint32)cairo_xlib_surface_get_drawable (surface), x, y);
- } else
-#endif
- if (effective_type == PANEL_BACK_COLOR) {
+ } else if (effective_type == PANEL_BACK_COLOR) {
gchar *rgba = gdk_rgba_to_string (&background->color);
retval = g_strdup_printf (
"color:%s",
diff --git a/mate-panel/panel-background.h b/mate-panel/panel-background.h
index fbfbd5d9..b39cc569 100644
--- a/mate-panel/panel-background.h
+++ b/mate-panel/panel-background.h
@@ -33,10 +33,6 @@
#include "panel-enums.h"
#include "panel-types.h"
-#ifdef HAVE_X11
-#include "panel-background-monitor.h"
-#endif
-
typedef struct _PanelBackground PanelBackground;
typedef void (*PanelBackgroundChangedNotify)
@@ -59,12 +55,6 @@ struct _PanelBackground {
GdkPixbuf *transformed_image;
cairo_pattern_t *composited_pattern;
-#ifdef HAVE_X11
- PanelBackgroundMonitor *monitor;
- GdkPixbuf *desktop;
- gulong monitor_signal;
-#endif /* HAVE_X11 */
-
GdkWindow *window;
cairo_pattern_t *default_pattern;
GdkRGBA default_color;