summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authormonsta <[email protected]>2016-11-20 22:24:08 +0300
committermonsta <[email protected]>2016-11-20 22:24:08 +0300
commitde1227d4355f56017270f3a7541b8be21fd955af (patch)
tree37ad9b1c13c571ed51da2c5649e33cb9a2a9e7fe /plugins
parentc0e9048f916f4141292ca3b107735496e698cac5 (diff)
downloadmate-settings-daemon-de1227d4355f56017270f3a7541b8be21fd955af.tar.bz2
mate-settings-daemon-de1227d4355f56017270f3a7541b8be21fd955af.tar.xz
move to GTK+3 (>= 3.14), drop GTK+2 code and --with-gtk build option
and require libmatekbd and libmate-desktop >= 1.17
Diffstat (limited to 'plugins')
-rw-r--r--plugins/a11y-keyboard/msd-a11y-keyboard-manager.c12
-rw-r--r--plugins/a11y-settings/msd-a11y-settings-manager.c4
-rw-r--r--plugins/background/msd-background-manager.c9
-rw-r--r--plugins/clipboard/msd-clipboard-manager.c13
-rw-r--r--plugins/common/eggaccelerators.h1
-rw-r--r--plugins/common/msd-input-helper.c10
-rw-r--r--plugins/common/msd-osd-window.c292
-rw-r--r--plugins/common/msd-osd-window.h17
-rw-r--r--plugins/housekeeping/msd-ldsm-dialog.c13
-rw-r--r--plugins/housekeeping/msd-ldsm-trash-empty.c11
-rw-r--r--plugins/keybindings/msd-keybindings-manager.c5
-rw-r--r--plugins/keyboard/msd-keyboard-manager.c5
-rw-r--r--plugins/keyboard/msd-keyboard-xkb.c8
-rw-r--r--plugins/media-keys/msd-media-keys-manager.c20
-rw-r--r--plugins/media-keys/msd-media-keys-window.c52
-rw-r--r--plugins/mouse/msd-locate-pointer.c133
-rw-r--r--plugins/mouse/msd-mouse-manager.c4
-rw-r--r--plugins/xrandr/msd-xrandr-manager.c51
18 files changed, 16 insertions, 644 deletions
diff --git a/plugins/a11y-keyboard/msd-a11y-keyboard-manager.c b/plugins/a11y-keyboard/msd-a11y-keyboard-manager.c
index 88f11dc..a33cf40 100644
--- a/plugins/a11y-keyboard/msd-a11y-keyboard-manager.c
+++ b/plugins/a11y-keyboard/msd-a11y-keyboard-manager.c
@@ -180,11 +180,7 @@ get_xkb_desc_rec (MsdA11yKeyboardManager *manager)
desc->ctrls = NULL;
status = XkbGetControls (GDK_DISPLAY_XDISPLAY(gdk_display_get_default()), XkbAllControlsMask, desc);
}
-#if GTK_CHECK_VERSION (3, 0, 0)
gdk_error_trap_pop_ignored ();
-#else
- gdk_error_trap_pop ();
-#endif
g_return_val_if_fail (desc != NULL, NULL);
g_return_val_if_fail (desc->ctrls != NULL, NULL);
@@ -391,11 +387,7 @@ set_server_from_settings (MsdA11yKeyboardManager *manager)
XkbFreeKeyboard (desc, XkbAllComponentsMask, True);
XSync (GDK_DISPLAY_XDISPLAY(gdk_display_get_default()), FALSE);
-#if GTK_CHECK_VERSION (3, 0, 0)
gdk_error_trap_pop_ignored ();
-#else
- gdk_error_trap_pop ();
-#endif
mate_settings_profile_end (NULL);
}
@@ -1074,11 +1066,7 @@ restore_server_xkb_config (MsdA11yKeyboardManager *manager)
XkbAllComponentsMask, True);
XSync (GDK_DISPLAY_XDISPLAY(gdk_display_get_default()), FALSE);
-#if GTK_CHECK_VERSION (3, 0, 0)
gdk_error_trap_pop_ignored ();
-#else
- gdk_error_trap_pop ();
-#endif
manager->priv->original_xkb_desc = NULL;
}
diff --git a/plugins/a11y-settings/msd-a11y-settings-manager.c b/plugins/a11y-settings/msd-a11y-settings-manager.c
index 09d7ba7..d116efa 100644
--- a/plugins/a11y-settings/msd-a11y-settings-manager.c
+++ b/plugins/a11y-settings/msd-a11y-settings-manager.c
@@ -32,9 +32,7 @@
#include <glib.h>
#include <glib/gi18n.h>
-#include <gdk/gdk.h>
-#include <gdk/gdkx.h>
-#include <gtk/gtk.h>
+#include <gio/gio.h>
#include "mate-settings-profile.h"
#include "msd-a11y-settings-manager.h"
diff --git a/plugins/background/msd-background-manager.c b/plugins/background/msd-background-manager.c
index ca5bc79..bf1400d 100644
--- a/plugins/background/msd-background-manager.c
+++ b/plugins/background/msd-background-manager.c
@@ -46,14 +46,6 @@
#include "mate-settings-profile.h"
#include "msd-background-manager.h"
-#if !GTK_CHECK_VERSION(3, 0, 0)
-#define cairo_surface_t GdkPixmap
-#define cairo_surface_destroy g_object_unref
-#define mate_bg_create_surface mate_bg_create_pixmap
-#define mate_bg_set_surface_as_root mate_bg_set_pixmap_as_root
-#define mate_bg_set_surface_as_root_with_crossfade mate_bg_set_pixmap_as_root_with_crossfade
-#endif
-
#define MATE_SESSION_MANAGER_DBUS_NAME "org.gnome.SessionManager"
#define MATE_SESSION_MANAGER_DBUS_PATH "/org/gnome/SessionManager"
@@ -162,6 +154,7 @@ caja_is_drawing_bg (MsdBackgroundManager *manager)
return running;
}
#endif
+
static void
free_fade (MsdBackgroundManager *manager)
{
diff --git a/plugins/clipboard/msd-clipboard-manager.c b/plugins/clipboard/msd-clipboard-manager.c
index f2d7e62..fc07228 100644
--- a/plugins/clipboard/msd-clipboard-manager.c
+++ b/plugins/clipboard/msd-clipboard-manager.c
@@ -37,7 +37,6 @@
#include <glib/gi18n.h>
#include <gdk/gdk.h>
#include <gdk/gdkx.h>
-#include <gtk/gtk.h>
#include <X11/Xlib.h>
#include <X11/Xatom.h>
@@ -151,11 +150,7 @@ send_selection_notify (MsdClipboardManager *manager,
(XEvent *)&notify);
XSync (manager->priv->display, False);
-#if GTK_CHECK_VERSION (3, 0, 0)
gdk_error_trap_pop_ignored ();
-#else
- gdk_error_trap_pop ();
-#endif
}
static void
@@ -182,11 +177,7 @@ finish_selection_request (MsdClipboardManager *manager,
False, NoEventMask, (XEvent *) &notify);
XSync (manager->priv->display, False);
-#if GTK_CHECK_VERSION (3, 0, 0)
gdk_error_trap_pop_ignored ();
-#else
- gdk_error_trap_pop ();
-#endif
}
static int
@@ -562,11 +553,7 @@ convert_clipboard_target (IncrConversion *rdata,
XSync (manager->priv->display, False);
-#if GTK_CHECK_VERSION (3, 0, 0)
gdk_error_trap_pop_ignored ();
-#else
- gdk_error_trap_pop ();
-#endif
}
}
}
diff --git a/plugins/common/eggaccelerators.h b/plugins/common/eggaccelerators.h
index 74a19e4..8584373 100644
--- a/plugins/common/eggaccelerators.h
+++ b/plugins/common/eggaccelerators.h
@@ -21,7 +21,6 @@
#ifndef __EGG_ACCELERATORS_H__
#define __EGG_ACCELERATORS_H__
-#include <gtk/gtk.h>
#include <gdk/gdk.h>
#ifdef __cplusplus
diff --git a/plugins/common/msd-input-helper.c b/plugins/common/msd-input-helper.c
index 35cc060..7101e43 100644
--- a/plugins/common/msd-input-helper.c
+++ b/plugins/common/msd-input-helper.c
@@ -22,7 +22,6 @@
#include <gdk/gdk.h>
#include <gdk/gdkx.h>
-#include <gtk/gtk.h>
#include <sys/types.h>
#include <X11/Xatom.h>
@@ -66,19 +65,12 @@ device_is_touchpad (XDeviceInfo *deviceinfo)
if ((XGetDeviceProperty (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), device, prop, 0, 1, False,
XA_INTEGER, &realtype, &realformat, &nitems,
&bytes_after, &data) == Success) && (realtype != None)) {
-#if GTK_CHECK_VERSION (3, 0, 0)
gdk_error_trap_pop_ignored ();
-#else
- gdk_error_trap_pop ();
-#endif
XFree (data);
return device;
}
-#if GTK_CHECK_VERSION (3, 0, 0)
+
gdk_error_trap_pop_ignored ();
-#else
- gdk_error_trap_pop ();
-#endif
XCloseDevice (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), device);
return NULL;
diff --git a/plugins/common/msd-osd-window.c b/plugins/common/msd-osd-window.c
index 0ed2bf4..49b01cb 100644
--- a/plugins/common/msd-osd-window.c
+++ b/plugins/common/msd-osd-window.c
@@ -55,11 +55,7 @@ struct MsdOsdWindowPrivate
};
enum {
-#if GTK_CHECK_VERSION (3, 0, 0)
DRAW_WHEN_COMPOSITED,
-#else
- EXPOSE_WHEN_COMPOSITED,
-#endif
LAST_SIGNAL
};
@@ -143,137 +139,27 @@ add_hide_timeout (MsdOsdWindow *window)
window);
}
-#if !GTK_CHECK_VERSION (3, 0, 0)
-void
-msd_osd_window_draw_rounded_rectangle (cairo_t* cr,
- gdouble aspect,
- gdouble x,
- gdouble y,
- gdouble corner_radius,
- gdouble width,
- gdouble height)
-{
- gdouble radius = corner_radius / aspect;
-
- cairo_move_to (cr, x + radius, y);
-
- cairo_line_to (cr,
- x + width - radius,
- y);
- cairo_arc (cr,
- x + width - radius,
- y + radius,
- radius,
- -90.0f * G_PI / 180.0f,
- 0.0f * G_PI / 180.0f);
- cairo_line_to (cr,
- x + width,
- y + height - radius);
- cairo_arc (cr,
- x + width - radius,
- y + height - radius,
- radius,
- 0.0f * G_PI / 180.0f,
- 90.0f * G_PI / 180.0f);
- cairo_line_to (cr,
- x + radius,
- y + height);
- cairo_arc (cr,
- x + radius,
- y + height - radius,
- radius,
- 90.0f * G_PI / 180.0f,
- 180.0f * G_PI / 180.0f);
- cairo_line_to (cr,
- x,
- y + radius);
- cairo_arc (cr,
- x + radius,
- y + radius,
- radius,
- 180.0f * G_PI / 180.0f,
- 270.0f * G_PI / 180.0f);
- cairo_close_path (cr);
-}
-
-void
-msd_osd_window_color_reverse (const GdkColor *a,
- GdkColor *b)
-{
- gdouble red;
- gdouble green;
- gdouble blue;
- gdouble h;
- gdouble s;
- gdouble v;
-
- red = (gdouble) a->red / 65535.0;
- green = (gdouble) a->green / 65535.0;
- blue = (gdouble) a->blue / 65535.0;
-
- gtk_rgb_to_hsv (red, green, blue, &h, &s, &v);
-
- v = 0.5 + (0.5 - v);
- if (v > 1.0)
- v = 1.0;
- else if (v < 0.0)
- v = 0.0;
-
- gtk_hsv_to_rgb (h, s, v, &red, &green, &blue);
-
- b->red = red * 65535.0;
- b->green = green * 65535.0;
- b->blue = blue * 65535.0;
-}
-#endif
-
-/* This is our expose/draw-event handler when the window is in a compositing manager.
+/* This is our draw-event handler when the window is in a compositing manager.
* We draw everything by hand, using Cairo, so that we can have a nice
* transparent/rounded look.
*/
static void
-#if GTK_CHECK_VERSION (3, 0, 0)
draw_when_composited (GtkWidget *widget, cairo_t *orig_cr)
-#else
-expose_when_composited (GtkWidget *widget, GdkEventExpose *event)
-#endif
{
MsdOsdWindow *window;
-#if !GTK_CHECK_VERSION (3, 0, 0)
- cairo_t *context;
-#endif
cairo_t *cr;
cairo_surface_t *surface;
int width;
int height;
-#if GTK_CHECK_VERSION (3, 0, 0)
GtkStyleContext *context;
-#else
- GtkStyle *style;
- GdkColor color;
- double r, g, b;
-#endif
window = MSD_OSD_WINDOW (widget);
-#if !GTK_CHECK_VERSION (3, 0, 0)
- context = gdk_cairo_create (gtk_widget_get_window (widget));
-#endif
-
-#if GTK_CHECK_VERSION (3, 0, 0)
context = gtk_widget_get_style_context (widget);
cairo_set_operator (orig_cr, CAIRO_OPERATOR_SOURCE);
-#else
- style = gtk_widget_get_style (widget);
- cairo_set_operator (context, CAIRO_OPERATOR_SOURCE);
-#endif
gtk_window_get_size (GTK_WINDOW (widget), &width, &height);
-#if GTK_CHECK_VERSION (3, 0, 0)
surface = cairo_surface_create_similar (cairo_get_target (orig_cr),
-#else
- surface = cairo_surface_create_similar (cairo_get_target (context),
-#endif
CAIRO_CONTENT_COLOR_ALPHA,
width,
height);
@@ -286,75 +172,34 @@ expose_when_composited (GtkWidget *widget, GdkEventExpose *event)
if (cairo_status (cr) != CAIRO_STATUS_SUCCESS) {
goto done;
}
-#if !GTK_CHECK_VERSION (3, 0, 0)
- cairo_set_source_rgba (cr, 1.0, 1.0, 1.0, 0.0);
- cairo_set_operator (cr, CAIRO_OPERATOR_OVER);
- cairo_paint (cr);
-#endif
-#if GTK_CHECK_VERSION (3, 0, 0)
gtk_render_background (context, cr, 0, 0, width, height);
gtk_render_frame (context, cr, 0, 0, width, height);
-#else
- /* draw a box */
- msd_osd_window_draw_rounded_rectangle (cr, 1.0, 0.5, 0.5, height / 10, width-1, height-1);
- msd_osd_window_color_reverse (&style->bg[GTK_STATE_NORMAL], &color);
- r = (float)color.red / 65535.0;
- g = (float)color.green / 65535.0;
- b = (float)color.blue / 65535.0;
- cairo_set_source_rgba (cr, r, g, b, BG_ALPHA);
- cairo_fill_preserve (cr);
-
- msd_osd_window_color_reverse (&style->text_aa[GTK_STATE_NORMAL], &color);
- r = (float)color.red / 65535.0;
- g = (float)color.green / 65535.0;
- b = (float)color.blue / 65535.0;
- cairo_set_source_rgba (cr, r, g, b, BG_ALPHA / 2);
- cairo_set_line_width (cr, 1);
- cairo_stroke (cr);
-#endif
-#if GTK_CHECK_VERSION (3, 0, 0)
g_signal_emit (window, signals[DRAW_WHEN_COMPOSITED], 0, cr);
-#else
- g_signal_emit (window, signals[EXPOSE_WHEN_COMPOSITED], 0, cr);
-#endif
cairo_destroy (cr);
/* Make sure we have a transparent background */
-#if GTK_CHECK_VERSION (3, 0, 0)
cairo_rectangle (orig_cr, 0, 0, width, height);
cairo_set_source_rgba (orig_cr, 0.0, 0.0, 0.0, 0.0);
cairo_fill (orig_cr);
cairo_set_source_surface (orig_cr, surface, 0, 0);
cairo_paint_with_alpha (orig_cr, window->priv->fade_out_alpha);
-#else
- cairo_rectangle (context, 0, 0, width, height);
- cairo_set_source_rgba (context, 0.0, 0.0, 0.0, 0.0);
- cairo_fill (context);
-
- cairo_set_source_surface (context, surface, 0, 0);
- cairo_paint_with_alpha (context, window->priv->fade_out_alpha);
-#endif
done:
if (surface != NULL) {
cairo_surface_destroy (surface);
}
-#if !GTK_CHECK_VERSION (3, 0, 0)
- cairo_destroy (context);
-#endif
}
-/* This is our expose/draw-event handler when the window is *not* in a compositing manager.
+/* This is our draw-event handler when the window is *not* in a compositing manager.
* We just draw a rectangular frame by hand. We do this with hardcoded drawing code,
* instead of GtkFrame, to avoid changing the window's internal widget hierarchy: in
* either case (composited or non-composited), callers can assume that this works
* identically to a GtkWindow without any intermediate widgetry.
*/
-#if GTK_CHECK_VERSION (3, 0, 0)
static void
draw_when_not_composited (GtkWidget *widget, cairo_t *cr)
{
@@ -374,29 +219,7 @@ draw_when_not_composited (GtkWidget *widget, cairo_t *cr)
width,
height);
}
-#else
-static void
-expose_when_not_composited (GtkWidget *widget, GdkEventExpose *event)
-{
- GtkAllocation allocation;
-
- gtk_widget_get_allocation (widget, &allocation);
-
- gtk_paint_shadow (gtk_widget_get_style (widget),
- gtk_widget_get_window (widget),
- gtk_widget_get_state (widget),
- GTK_SHADOW_OUT,
- &event->area,
- widget,
- NULL, /* NULL detail -> themes should use the MsdOsdWindow widget name, probably */
- 0,
- 0,
- allocation.width,
- allocation.height);
-}
-#endif
-#if GTK_CHECK_VERSION (3, 0, 0)
static gboolean
msd_osd_window_draw (GtkWidget *widget,
cairo_t *cr)
@@ -417,28 +240,6 @@ msd_osd_window_draw (GtkWidget *widget,
return FALSE;
}
-#else
-static gboolean
-msd_osd_window_expose_event (GtkWidget *widget,
- GdkEventExpose *event)
-{
- MsdOsdWindow *window;
- GtkWidget *child;
-
- window = MSD_OSD_WINDOW (widget);
-
- if (window->priv->is_composited)
- expose_when_composited (widget, event);
- else
- expose_when_not_composited (widget, event);
-
- child = gtk_bin_get_child (GTK_BIN (window));
- if (child)
- gtk_container_propagate_expose (GTK_CONTAINER (window), child, event);
-
- return FALSE;
-}
-#endif
static void
msd_osd_window_real_show (GtkWidget *widget)
@@ -470,7 +271,6 @@ msd_osd_window_real_hide (GtkWidget *widget)
static void
msd_osd_window_real_realize (GtkWidget *widget)
{
-#if GTK_CHECK_VERSION (3, 0, 0)
GdkScreen *screen;
GdkVisual *visual;
cairo_region_t *region;
@@ -492,40 +292,8 @@ msd_osd_window_real_realize (GtkWidget *widget)
region = cairo_region_create ();
gtk_widget_input_shape_combine_region (widget, region);
cairo_region_destroy (region);
-#else
- GdkColormap *colormap;
- GtkAllocation allocation;
- GdkBitmap *mask;
- cairo_t *cr;
-
- colormap = gdk_screen_get_rgba_colormap (gtk_widget_get_screen (widget));
-
- if (colormap != NULL) {
- gtk_widget_set_colormap (widget, colormap);
- }
-
- if (GTK_WIDGET_CLASS (msd_osd_window_parent_class)->realize) {
- GTK_WIDGET_CLASS (msd_osd_window_parent_class)->realize (widget);
- }
-
- gtk_widget_get_allocation (widget, &allocation);
- mask = gdk_pixmap_new (gtk_widget_get_window (widget),
- allocation.width,
- allocation.height,
- 1);
- cr = gdk_cairo_create (mask);
-
- cairo_set_source_rgba (cr, 1., 1., 1., 0.);
- cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE);
- cairo_paint (cr);
-
- /* make the whole window ignore events */
- gdk_window_input_shape_combine_mask (gtk_widget_get_window (widget), mask, 0, 0);
- g_object_unref (mask);
- cairo_destroy (cr);
-#endif
}
-#if GTK_CHECK_VERSION (3, 0, 0)
+
static void
msd_osd_window_style_updated (GtkWidget *widget)
{
@@ -543,25 +311,7 @@ msd_osd_window_style_updated (GtkWidget *widget)
gtk_style_context_get_padding (context, GTK_STATE_FLAG_NORMAL, &padding);
gtk_container_set_border_width (GTK_CONTAINER (widget), 12 + MAX (padding.left, padding.top));
}
-#else
-static void
-msd_osd_window_style_set (GtkWidget *widget,
- GtkStyle *previous_style)
-{
- GtkStyle *style;
-
- GTK_WIDGET_CLASS (msd_osd_window_parent_class)->style_set (widget, previous_style);
- /* We set our border width to 12 (per the MATE standard), plus the
- * thickness of the frame that we draw in our expose/draw handler. This will
- * make our child be 12 pixels away from the frame.
- */
-
- style = gtk_widget_get_style (widget);
- gtk_container_set_border_width (GTK_CONTAINER (widget), 12 + MAX (style->xthickness, style->ythickness));
-}
-#endif
-#if GTK_CHECK_VERSION (3, 0, 0)
static void
msd_osd_window_get_preferred_width (GtkWidget *widget,
gint *minimum,
@@ -599,23 +349,6 @@ msd_osd_window_get_preferred_height (GtkWidget *widget,
*minimum += padding.top;
*natural += padding.top;
}
-#else
-static void
-msd_osd_window_size_request (GtkWidget *widget,
- GtkRequisition *requisition)
-{
- GtkStyle *style;
-
- GTK_WIDGET_CLASS (msd_osd_window_parent_class)->size_request (widget, requisition);
-
- /* See the comment in msd_osd_window_style_set() for why we add the thickness here */
-
- style = gtk_widget_get_style (widget);
-
- requisition->width += style->xthickness;
- requisition->height += style->ythickness;
-}
-#endif
static GObject *
msd_osd_window_constructor (GType type,
@@ -634,11 +367,9 @@ msd_osd_window_constructor (GType type,
"focus-on-map", FALSE,
NULL);
-#if GTK_CHECK_VERSION (3, 0, 0)
GtkWidget *widget = GTK_WIDGET (object);
GtkStyleContext *style_context = gtk_widget_get_style_context (widget);
gtk_style_context_add_class (style_context, "osd");
-#endif
return object;
}
@@ -654,29 +385,15 @@ msd_osd_window_class_init (MsdOsdWindowClass *klass)
widget_class->show = msd_osd_window_real_show;
widget_class->hide = msd_osd_window_real_hide;
widget_class->realize = msd_osd_window_real_realize;
-#if GTK_CHECK_VERSION (3, 0, 0)
widget_class->style_updated = msd_osd_window_style_updated;
widget_class->get_preferred_width = msd_osd_window_get_preferred_width;
widget_class->get_preferred_height = msd_osd_window_get_preferred_height;
widget_class->draw = msd_osd_window_draw;
-#else
- widget_class->style_set = msd_osd_window_style_set;
- widget_class->size_request = msd_osd_window_size_request;
- widget_class->expose_event = msd_osd_window_expose_event;
-#endif
-#if GTK_CHECK_VERSION (3, 0, 0)
signals[DRAW_WHEN_COMPOSITED] = g_signal_new ("draw-when-composited",
-#else
- signals[EXPOSE_WHEN_COMPOSITED] = g_signal_new ("expose-when-composited",
-#endif
G_TYPE_FROM_CLASS (gobject_class),
G_SIGNAL_RUN_FIRST,
-#if GTK_CHECK_VERSION (3, 0, 0)
G_STRUCT_OFFSET (MsdOsdWindowClass, draw_when_composited),
-#else
- G_STRUCT_OFFSET (MsdOsdWindowClass, expose_when_composited),
-#endif
NULL, NULL,
g_cclosure_marshal_VOID__POINTER,
G_TYPE_NONE, 1,
@@ -685,7 +402,6 @@ msd_osd_window_class_init (MsdOsdWindowClass *klass)
#if GTK_CHECK_VERSION (3, 20, 0)
gtk_widget_class_set_css_name (widget_class, "MsdOsdWindow");
#endif
-
g_type_class_add_private (klass, sizeof (MsdOsdWindowPrivate));
}
@@ -733,10 +449,8 @@ msd_osd_window_init (MsdOsdWindow *window)
gtk_window_set_decorated (GTK_WINDOW (window), FALSE);
gtk_widget_set_app_paintable (GTK_WIDGET (window), TRUE);
-#if GTK_CHECK_VERSION (3, 0, 0)
GtkStyleContext *style = gtk_widget_get_style_context (GTK_WIDGET (window));
gtk_style_context_add_class (style, "window-frame");
-#endif
/* assume 130x130 on a 640x480 display and scale from there */
scalew = gdk_screen_get_width (screen) / 640.0;
diff --git a/plugins/common/msd-osd-window.h b/plugins/common/msd-osd-window.h
index 42229f4..ac3325a 100644
--- a/plugins/common/msd-osd-window.h
+++ b/plugins/common/msd-osd-window.h
@@ -70,11 +70,7 @@ struct MsdOsdWindow {
struct MsdOsdWindowClass {
GtkWindowClass parent_class;
-#if GTK_CHECK_VERSION (3, 0, 0)
void (* draw_when_composited) (MsdOsdWindow *window, cairo_t *cr);
-#else
- void (* expose_when_composited) (MsdOsdWindow *window, cairo_t *cr);
-#endif
};
GType msd_osd_window_get_type (void);
@@ -84,19 +80,6 @@ gboolean msd_osd_window_is_composited (MsdOsdWindow *windo
gboolean msd_osd_window_is_valid (MsdOsdWindow *window);
void msd_osd_window_update_and_hide (MsdOsdWindow *window);
-#if !GTK_CHECK_VERSION (3, 0, 0)
-void msd_osd_window_draw_rounded_rectangle (cairo_t *cr,
- gdouble aspect,
- gdouble x,
- gdouble y,
- gdouble corner_radius,
- gdouble width,
- gdouble height);
-
-void msd_osd_window_color_reverse (const GdkColor *a,
- GdkColor *b);
-#endif
-
#ifdef __cplusplus
}
#endif
diff --git a/plugins/housekeeping/msd-ldsm-dialog.c b/plugins/housekeeping/msd-ldsm-dialog.c
index d95701f..190daf4 100644
--- a/plugins/housekeeping/msd-ldsm-dialog.c
+++ b/plugins/housekeeping/msd-ldsm-dialog.c
@@ -25,11 +25,6 @@
#define SETTINGS_SCHEMA "org.mate.SettingsDaemon.plugins.housekeeping"
#define SETTINGS_IGNORE_PATHS "ignore-paths"
-#if GTK_CHECK_VERSION (3, 0, 0)
-#define gtk_hbox_new(X,Y) gtk_box_new(GTK_ORIENTATION_HORIZONTAL,Y)
-#define gtk_vbox_new(X,Y) gtk_box_new(GTK_ORIENTATION_VERTICAL,Y)
-#endif
-
enum
{
PROP_0,
@@ -220,12 +215,8 @@ msd_ldsm_dialog_init (MsdLdsmDialog *dialog)
/* Create the image */
image = gtk_image_new_from_icon_name ("dialog-warning", GTK_ICON_SIZE_DIALOG);
-#if GTK_CHECK_VERSION (3, 0, 0)
gtk_widget_set_halign (image, GTK_ALIGN_START);
gtk_widget_set_valign (image, GTK_ALIGN_END);
-#else
- gtk_misc_set_alignment (GTK_MISC (image), 0.5, 0.0);
-#endif
/* Create the labels */
dialog->priv->primary_label = gtk_label_new (NULL);
@@ -261,10 +252,10 @@ msd_ldsm_dialog_init (MsdLdsmDialog *dialog)
/* Now set up the dialog's GtkBox's' */
gtk_box_set_spacing (GTK_BOX (main_vbox), 14);
- hbox = gtk_hbox_new (FALSE, 12);
+ hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
gtk_container_set_border_width (GTK_CONTAINER (hbox), 5);
- text_vbox = gtk_vbox_new (FALSE, 12);
+ text_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12);
gtk_box_pack_start (GTK_BOX (text_vbox), dialog->priv->primary_label, FALSE, FALSE, 0);
gtk_box_pack_start (GTK_BOX (text_vbox), dialog->priv->secondary_label, TRUE, TRUE, 0);
diff --git a/plugins/housekeeping/msd-ldsm-trash-empty.c b/plugins/housekeeping/msd-ldsm-trash-empty.c
index 33b1635..c552c3b 100644
--- a/plugins/housekeeping/msd-ldsm-trash-empty.c
+++ b/plugins/housekeeping/msd-ldsm-trash-empty.c
@@ -26,11 +26,6 @@
#define CAJA_PREFS_SCHEMA "org.mate.caja.preferences"
#define CAJA_CONFIRM_TRASH_KEY "confirm-trash"
-#if GTK_CHECK_VERSION (3, 0, 0)
-#define gtk_hbox_new(X,Y) gtk_box_new(GTK_ORIENTATION_HORIZONTAL,Y)
-#define gtk_vbox_new(X,Y) gtk_box_new(GTK_ORIENTATION_VERTICAL,Y)
-#endif
-
/* Some of this code has been borrowed from the trash-applet, courtesy of Ryan Lortie */
static GtkWidget *trash_empty_confirm_dialog = NULL;
@@ -251,9 +246,9 @@ trash_empty_start ()
gtk_window_set_title (GTK_WINDOW (trash_empty_dialog),
_("Emptying the trash"));
- vbox1 = gtk_vbox_new (FALSE, 12);
- vbox2 = gtk_vbox_new (FALSE, 0);
- hbox = gtk_hbox_new (FALSE, 0);
+ vbox1 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12);
+ vbox2 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
+ hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
label1 = gtk_label_new (NULL);
gtk_label_set_line_wrap (GTK_LABEL (label1), TRUE);
diff --git a/plugins/keybindings/msd-keybindings-manager.c b/plugins/keybindings/msd-keybindings-manager.c
index 738e75a..89ae0bc 100644
--- a/plugins/keybindings/msd-keybindings-manager.c
+++ b/plugins/keybindings/msd-keybindings-manager.c
@@ -330,11 +330,8 @@ binding_unregister_keys (MsdKeybindingsManager *manager)
if (need_flush)
gdk_flush ();
-#if GTK_CHECK_VERSION (3, 0, 0)
+
gdk_error_trap_pop_ignored ();
-#else
- gdk_error_trap_pop ();
-#endif
}
static void
diff --git a/plugins/keyboard/msd-keyboard-manager.c b/plugins/keyboard/msd-keyboard-manager.c
index 3eef1b2..048d648 100644
--- a/plugins/keyboard/msd-keyboard-manager.c
+++ b/plugins/keyboard/msd-keyboard-manager.c
@@ -35,7 +35,6 @@
#include <glib/gi18n.h>
#include <gdk/gdk.h>
#include <gdk/gdkx.h>
-#include <gtk/gtk.h>
#ifdef HAVE_X11_EXTENSIONS_XF86MISC_H
#include <X11/extensions/xf86misc.h>
@@ -304,11 +303,7 @@ apply_settings (GSettings *settings,
#endif /* HAVE_X11_EXTENSIONS_XKB_H */
XSync (GDK_DISPLAY_XDISPLAY(gdk_display_get_default()), FALSE);
-#if GTK_CHECK_VERSION (3, 0, 0)
gdk_error_trap_pop_ignored ();
-#else
- gdk_error_trap_pop ();
-#endif
}
void
diff --git a/plugins/keyboard/msd-keyboard-xkb.c b/plugins/keyboard/msd-keyboard-xkb.c
index bb62f2b..4f1cf28 100644
--- a/plugins/keyboard/msd-keyboard-xkb.c
+++ b/plugins/keyboard/msd-keyboard-xkb.c
@@ -172,11 +172,7 @@ popup_menu_launch_capplet ()
info = g_app_info_create_from_commandline ("mate-keyboard-properties", NULL, 0, &error);
if (info != NULL) {
-# if GTK_CHECK_VERSION (3, 0, 0)
context = gdk_display_get_app_launch_context (gdk_display_get_default ());
-# else
- context = gdk_app_launch_context_new ();
-# endif
g_app_info_launch (info, NULL,
G_APP_LAUNCH_CONTEXT (context), &error);
@@ -224,11 +220,7 @@ popup_menu_show_layout ()
matekbd_keyboard_drawing_new_dialog (xkl_state->group,
group_names
[xkl_state->group]);
-# if GTK_CHECK_VERSION(3,0,0)
g_signal_connect (dialog, "destroy",
-# else
- g_signal_connect (GTK_OBJECT (dialog), "destroy",
-#endif
G_CALLBACK (show_layout_destroy),
GINT_TO_POINTER (xkl_state->group));
g_hash_table_insert (preview_dialogs,
diff --git a/plugins/media-keys/msd-media-keys-manager.c b/plugins/media-keys/msd-media-keys-manager.c
index 7526a89..32d5d34 100644
--- a/plugins/media-keys/msd-media-keys-manager.c
+++ b/plugins/media-keys/msd-media-keys-manager.c
@@ -395,11 +395,9 @@ dialog_show (MsdMediaKeysManager *manager)
int screen_h;
int x;
int y;
-#if GTK_CHECK_VERSION (3, 0, 0)
GdkDisplay *display;
GdkDeviceManager *device_manager;
GdkDevice *pointer;
-#endif
int pointer_x;
int pointer_y;
GtkRequisition win_req;
@@ -420,11 +418,7 @@ dialog_show (MsdMediaKeysManager *manager)
* know its true size, yet, so we need to jump through hoops
*/
gtk_window_get_default_size (GTK_WINDOW (manager->priv->dialog), &orig_w, &orig_h);
-#if GTK_CHECK_VERSION (3, 0, 0)
gtk_widget_get_preferred_size (manager->priv->dialog, NULL, &win_req);
-#else
- gtk_widget_size_request (manager->priv->dialog, &win_req);
-#endif
if (win_req.width > orig_w) {
orig_w = win_req.width;
@@ -434,7 +428,6 @@ dialog_show (MsdMediaKeysManager *manager)
}
pointer_screen = NULL;
-#if GTK_CHECK_VERSION (3, 0, 0)
display = gdk_screen_get_display (manager->priv->current_screen);
device_manager = gdk_display_get_device_manager (display);
pointer = gdk_device_manager_get_client_pointer (device_manager);
@@ -443,13 +436,7 @@ dialog_show (MsdMediaKeysManager *manager)
&pointer_screen,
&pointer_x,
&pointer_y);
-#else
- gdk_display_get_pointer (gdk_screen_get_display (manager->priv->current_screen),
- &pointer_screen,
- &pointer_x,
- &pointer_y,
- NULL);
-#endif
+
if (pointer_screen != manager->priv->current_screen) {
/* The pointer isn't on the current screen, so just
* assume the default monitor
@@ -1224,11 +1211,8 @@ msd_media_keys_manager_stop (MsdMediaKeysManager *manager)
if (need_flush)
gdk_flush ();
-#if GTK_CHECK_VERSION (3, 0, 0)
+
gdk_error_trap_pop_ignored ();
-#else
- gdk_error_trap_pop ();
-#endif
g_slist_free (priv->screens);
priv->screens = NULL;
diff --git a/plugins/media-keys/msd-media-keys-window.c b/plugins/media-keys/msd-media-keys-window.c
index 3672281..61cdec3 100644
--- a/plugins/media-keys/msd-media-keys-window.c
+++ b/plugins/media-keys/msd-media-keys-window.c
@@ -402,29 +402,14 @@ draw_volume_boxes (MsdMediaKeysWindow *window,
double height)
{
gdouble x1;
-#if GTK_CHECK_VERSION (3, 0, 0)
GtkStyleContext *context;
-#else
- GdkColor color;
- double r, g, b;
- GtkStyle *style;
-#endif
-#if !GTK_CHECK_VERSION (3, 0, 0)
- _x0 += 0.5;
- _y0 += 0.5;
-#endif
height = round (height) - 1;
width = round (width) - 1;
x1 = round ((width - 1) * percentage);
-#if GTK_CHECK_VERSION (3, 0, 0)
context = gtk_widget_get_style_context (GTK_WIDGET (window));
-#else
- style = gtk_widget_get_style (GTK_WIDGET (window));
-#endif
/* bar background */
-#if GTK_CHECK_VERSION (3, 0, 0)
gtk_style_context_save (context);
gtk_style_context_add_class (context, GTK_STYLE_CLASS_TROUGH);
@@ -444,35 +429,6 @@ draw_volume_boxes (MsdMediaKeysWindow *window,
gtk_render_frame (context, cr, _x0 + 0.5, _y0 + 0.5, x1, height -1 );
gtk_style_context_restore (context);
-#else
- msd_osd_window_color_reverse (&style->dark[GTK_STATE_NORMAL], &color);
- r = (float)color.red / 65535.0;
- g = (float)color.green / 65535.0;
- b = (float)color.blue / 65535.0;
- msd_osd_window_draw_rounded_rectangle (cr, 1.0, _x0, _y0, height / 6, width, height);
- cairo_set_source_rgba (cr, r, g, b, MSD_OSD_WINDOW_FG_ALPHA / 2);
- cairo_fill_preserve (cr);
-
- /* bar border */
- msd_osd_window_color_reverse (&style->light[GTK_STATE_NORMAL], &color);
- r = (float)color.red / 65535.0;
- g = (float)color.green / 65535.0;
- b = (float)color.blue / 65535.0;
- cairo_set_source_rgba (cr, r, g, b, MSD_OSD_WINDOW_FG_ALPHA / 2);
- cairo_set_line_width (cr, 1);
- cairo_stroke (cr);
-
- /* bar progress */
- if (percentage < 0.01)
- return;
- color = style->bg[GTK_STATE_NORMAL];
- r = (float)color.red / 65535.0;
- g = (float)color.green / 65535.0;
- b = (float)color.blue / 65535.0;
- msd_osd_window_draw_rounded_rectangle (cr, 1.0, _x0 + 0.5, _y0 + 0.5, height / 6 - 0.5, x1, height - 1);
- cairo_set_source_rgba (cr, r, g, b, MSD_OSD_WINDOW_FG_ALPHA);
- cairo_fill (cr);
-#endif
}
static void
@@ -677,11 +633,7 @@ draw_action_custom (MsdMediaKeysWindow *window,
}
static void
-#if GTK_CHECK_VERSION (3, 0, 0)
msd_media_keys_window_draw_when_composited (MsdOsdWindow *osd_window,
-#else
-msd_media_keys_window_expose_when_composited (MsdOsdWindow *osd_window,
-#endif
cairo_t *cr)
{
MsdMediaKeysWindow *window = MSD_MEDIA_KEYS_WINDOW (osd_window);
@@ -703,11 +655,7 @@ msd_media_keys_window_class_init (MsdMediaKeysWindowClass *klass)
{
MsdOsdWindowClass *osd_window_class = MSD_OSD_WINDOW_CLASS (klass);
-#if GTK_CHECK_VERSION (3, 0, 0)
osd_window_class->draw_when_composited = msd_media_keys_window_draw_when_composited;
-#else
- osd_window_class->expose_when_composited = msd_media_keys_window_expose_when_composited;
-#endif
g_type_class_add_private (klass, sizeof (MsdMediaKeysWindowPrivate));
}
diff --git a/plugins/mouse/msd-locate-pointer.c b/plugins/mouse/msd-locate-pointer.c
index a480a6a..a519bf3 100644
--- a/plugins/mouse/msd-locate-pointer.c
+++ b/plugins/mouse/msd-locate-pointer.c
@@ -50,7 +50,6 @@ struct MsdLocatePointerData
static MsdLocatePointerData *data = NULL;
-#if GTK_CHECK_VERSION(3, 0, 0)
static void
msd_get_background_color (GtkStyleContext *context,
GtkStateFlags state,
@@ -68,37 +67,24 @@ msd_get_background_color (GtkStyleContext *context,
*color = *c;
gdk_rgba_free (c);
}
-#endif
static void
locate_pointer_paint (MsdLocatePointerData *data,
cairo_t *cr,
gboolean composite)
{
-#if GTK_CHECK_VERSION (3, 0, 0)
GdkRGBA color;
gdouble progress, circle_progress;
gint width, height, i;
GtkStyleContext *context;
-#else
- GdkColor color;
- gdouble progress, circle_progress;
- gint width, height, i;
- GtkStyle *style;
-#endif
progress = data->progress;
width = gdk_window_get_width (data->window);
height = gdk_window_get_height (data->window);
-#if GTK_CHECK_VERSION (3, 0, 0)
context = gtk_widget_get_style_context (data->widget);
msd_get_background_color (context, GTK_STATE_FLAG_SELECTED, &color);
-#else
- style = gtk_widget_get_style (data->widget);
- color = style->bg[GTK_STATE_SELECTED];
-#endif
cairo_set_source_rgba (cr, 1., 1., 1., 0.);
cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE);
@@ -118,15 +104,9 @@ locate_pointer_paint (MsdLocatePointerData *data,
if (composite)
{
cairo_set_source_rgba (cr,
-#if GTK_CHECK_VERSION (3, 0, 0)
color.red,
color.green,
color.blue,
-#else
- color.red / 65535.,
- color.green / 65535.,
- color.blue / 65535.,
-#endif
1 - circle_progress);
cairo_arc (cr,
width / 2,
@@ -160,7 +140,6 @@ locate_pointer_paint (MsdLocatePointerData *data,
}
}
-#if GTK_CHECK_VERSION (3, 0, 0)
static gboolean
locate_pointer_draw (GtkWidget *widget,
cairo_t *cr,
@@ -173,31 +152,11 @@ locate_pointer_draw (GtkWidget *widget,
return TRUE;
}
-#else
-static gboolean
-locate_pointer_expose (GtkWidget *widget,
- GdkEventExpose *event,
- gpointer user_data)
-{
- MsdLocatePointerData *data = (MsdLocatePointerData *) user_data;
- cairo_t *cr;
-
- if (event->window != data->window)
- return FALSE;
-
- cr = gdk_cairo_create (data->window);
- locate_pointer_paint (data, cr, gtk_widget_is_composited (data->widget));
- cairo_destroy (cr);
-
- return TRUE;
-}
-#endif
static void
update_shape (MsdLocatePointerData *data)
{
cairo_t *cr;
-#if GTK_CHECK_VERSION (3, 0, 0)
cairo_region_t *region;
cairo_surface_t *mask;
@@ -212,19 +171,6 @@ update_shape (MsdLocatePointerData *data)
cairo_destroy (cr);
cairo_surface_destroy (mask);
-#else
- GdkBitmap *mask;
-
- mask = gdk_pixmap_new (data->window, WINDOW_SIZE, WINDOW_SIZE, 1);
- cr = gdk_cairo_create (mask);
-
- locate_pointer_paint (data, cr, FALSE);
-
- gdk_window_shape_combine_mask (data->window, mask, 0, 0);
- g_object_unref (mask);
-
- cairo_destroy (cr);
-#endif
}
static void
@@ -234,10 +180,8 @@ timeline_frame_cb (MsdTimeline *timeline,
{
MsdLocatePointerData *data = (MsdLocatePointerData *) user_data;
GdkScreen *screen;
-#if GTK_CHECK_VERSION (3, 0, 0)
GdkDeviceManager *device_manager;
GdkDevice *pointer;
-#endif
gint cursor_x, cursor_y;
if (gtk_widget_is_composited (data->widget))
@@ -254,7 +198,6 @@ timeline_frame_cb (MsdTimeline *timeline,
}
screen = gdk_window_get_screen (data->window);
-#if GTK_CHECK_VERSION (3, 0, 0)
device_manager = gdk_display_get_device_manager (gdk_window_get_display (gdk_screen_get_root_window (screen)));
pointer = gdk_device_manager_get_client_pointer (device_manager);
gdk_window_get_device_position (gdk_screen_get_root_window (screen),
@@ -262,10 +205,7 @@ timeline_frame_cb (MsdTimeline *timeline,
&cursor_x,
&cursor_y,
NULL);
-#else
- gdk_window_get_pointer (gdk_screen_get_root_window (screen),
- &cursor_x, &cursor_y, NULL);
-#endif
+
gdk_window_move (data->window,
cursor_x - WINDOW_SIZE / 2,
cursor_y - WINDOW_SIZE / 2);
@@ -274,38 +214,18 @@ timeline_frame_cb (MsdTimeline *timeline,
static void
set_transparent_shape (GdkWindow *window)
{
-#if GTK_CHECK_VERSION (3, 0, 0)
cairo_region_t *region;
region = cairo_region_create ();
gdk_window_input_shape_combine_region (data->window, region, 0, 0);
cairo_region_destroy (region);
-#else
- GdkBitmap *mask;
- cairo_t *cr;
-
- mask = gdk_pixmap_new (data->window, WINDOW_SIZE, WINDOW_SIZE, 1);
- cr = gdk_cairo_create (mask);
-
- cairo_set_source_rgba (cr, 1., 1., 1., 0.);
- cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE);
- cairo_paint (cr);
-
- gdk_window_shape_combine_mask (data->window, mask, 0, 0);
- g_object_unref (mask);
- cairo_destroy (cr);
-#endif
}
static void
unset_transparent_shape (GdkWindow *window)
{
-#if GTK_CHECK_VERSION (3, 0, 0)
gdk_window_shape_combine_region (data->window, NULL, 0, 0);
-#else
- gdk_window_shape_combine_mask (data->window, NULL, 0, 0);
-#endif
}
static void
@@ -335,39 +255,23 @@ static void
create_window (MsdLocatePointerData *data,
GdkScreen *screen)
{
-#if !GTK_CHECK_VERSION (3, 0, 0)
- GdkColormap *colormap;
-#endif
GdkVisual *visual;
GdkWindowAttr attributes;
gint attributes_mask;
-#if !GTK_CHECK_VERSION (3, 0, 0)
- colormap = gdk_screen_get_rgba_colormap (screen);
-#endif
visual = gdk_screen_get_rgba_visual (screen);
-#if GTK_CHECK_VERSION (3, 0, 0)
if (visual == NULL)
visual = gdk_screen_get_system_visual (screen);
-#endif
attributes_mask = GDK_WA_X | GDK_WA_Y;
-#if GTK_CHECK_VERSION (3, 0, 0)
if (visual != NULL)
attributes_mask = attributes_mask | GDK_WA_VISUAL;
-#else
- if (colormap)
- attributes_mask = attributes_mask | GDK_WA_VISUAL | GDK_WA_COLORMAP;
-#endif
attributes.window_type = GDK_WINDOW_TEMP;
attributes.wclass = GDK_INPUT_OUTPUT;
attributes.visual = visual;
-#if !GTK_CHECK_VERSION (3, 0, 0)
- attributes.colormap = colormap;
-#endif
attributes.event_mask = GDK_VISIBILITY_NOTIFY_MASK | GDK_EXPOSURE_MASK;
attributes.width = 1;
attributes.height = 1;
@@ -392,13 +296,8 @@ msd_locate_pointer_data_new (GdkScreen *screen)
data->widget = gtk_window_new (GTK_WINDOW_POPUP);
gtk_widget_realize (data->widget);
-#if GTK_CHECK_VERSION (3, 0, 0)
g_signal_connect (G_OBJECT (data->widget), "draw",
G_CALLBACK (locate_pointer_draw),
-#else
- g_signal_connect (G_OBJECT (data->widget), "expose_event",
- G_CALLBACK (locate_pointer_expose),
-#endif
data);
data->timeline = msd_timeline_new (ANIMATION_LENGTH);
@@ -416,17 +315,10 @@ static void
move_locate_pointer_window (MsdLocatePointerData *data,
GdkScreen *screen)
{
-#if GTK_CHECK_VERSION (3, 0, 0)
GdkDeviceManager *device_manager;
GdkDevice *pointer;
-#endif
gint cursor_x, cursor_y;
-#if !GTK_CHECK_VERSION (3, 0, 0)
- GdkBitmap *mask;
- cairo_t *cr;
-#endif
-#if GTK_CHECK_VERSION (3, 0, 0)
device_manager = gdk_display_get_device_manager (gdk_window_get_display (gdk_screen_get_root_window (screen)));
pointer = gdk_device_manager_get_client_pointer (device_manager);
gdk_window_get_device_position (gdk_screen_get_root_window (screen),
@@ -434,32 +326,13 @@ move_locate_pointer_window (MsdLocatePointerData *data,
&cursor_x,
&cursor_y,
NULL);
-#else
- gdk_window_get_pointer (gdk_screen_get_root_window (screen), &cursor_x, &cursor_y, NULL);
-#endif
gdk_window_move_resize (data->window,
cursor_x - WINDOW_SIZE / 2,
cursor_y - WINDOW_SIZE / 2,
WINDOW_SIZE, WINDOW_SIZE);
-#if GTK_CHECK_VERSION (3, 0, 0)
gdk_window_input_shape_combine_region (data->window, NULL, 0, 0);
-#else
- mask = gdk_pixmap_new (data->window, WINDOW_SIZE, WINDOW_SIZE, 1);
-
- cr = gdk_cairo_create (mask);
- cairo_set_source_rgb (cr, 0., 0., 0.);
- cairo_rectangle (cr, 0., 0., WINDOW_SIZE, WINDOW_SIZE);
- cairo_fill (cr);
- cairo_destroy (cr);
-
-
- /* allow events to happen through the window */
- gdk_window_input_shape_combine_mask (data->window, mask, 0, 0);
-
- g_object_unref (mask);
-#endif
}
void
@@ -578,11 +451,7 @@ set_locate_pointer (void)
Window xroot;
screen = gdk_display_get_screen (display, j);
-#if GTK_CHECK_VERSION (3, 0, 0)
xroot = gdk_x11_window_get_xid (gdk_screen_get_root_window (screen));
-#else
- xroot = gdk_x11_drawable_get_xid (gdk_screen_get_root_window (screen));
-#endif
XGrabKey (GDK_DISPLAY_XDISPLAY (display),
keys[i].keycode,
diff --git a/plugins/mouse/msd-mouse-manager.c b/plugins/mouse/msd-mouse-manager.c
index d986b4f..3eebcf6 100644
--- a/plugins/mouse/msd-mouse-manager.c
+++ b/plugins/mouse/msd-mouse-manager.c
@@ -239,11 +239,7 @@ touchpad_has_single_button (XDevice *device)
if (rc == Success)
XFree (data);
-#if GTK_CHECK_VERSION (3, 0, 0)
gdk_error_trap_pop_ignored ();
-#else
- gdk_error_trap_pop ();
-#endif
return is_single_button;
}
diff --git a/plugins/xrandr/msd-xrandr-manager.c b/plugins/xrandr/msd-xrandr-manager.c
index 31d90e1..3fd9413 100644
--- a/plugins/xrandr/msd-xrandr-manager.c
+++ b/plugins/xrandr/msd-xrandr-manager.c
@@ -1679,21 +1679,12 @@ status_icon_popup_menu_selection_done_cb (GtkMenuShell *menu_shell, gpointer dat
* to see why that "after" handler is needed.
*/
static gboolean
-#if GTK_CHECK_VERSION (3, 0, 0)
output_title_label_draw_cb (GtkWidget *widget, cairo_t *cr, gpointer data)
-#else
-output_title_label_expose_event_cb (GtkWidget *widget, GdkEventExpose *event, gpointer data)
-#endif
{
MsdXrandrManager *manager = MSD_XRANDR_MANAGER (data);
struct MsdXrandrManagerPrivate *priv = manager->priv;
MateRROutputInfo *output;
-#if GTK_CHECK_VERSION (3, 0, 0)
GdkRGBA color;
-#else
- GdkColor color;
- cairo_t *cr;
-#endif
GtkAllocation allocation;
g_assert (GTK_IS_LABEL (widget));
@@ -1704,12 +1695,7 @@ output_title_label_expose_event_cb (GtkWidget *widget, GdkEventExpose *event, gp
g_assert (priv->labeler != NULL);
/* Draw a black rectangular border, filled with the color that corresponds to this output */
-#if GTK_CHECK_VERSION (3, 0, 0)
mate_rr_labeler_get_rgba_for_output (priv->labeler, output, &color);
-#else
- mate_rr_labeler_get_color_for_output (priv->labeler, output, &color);
- cr = gdk_cairo_create (gtk_widget_get_window (widget));
-#endif
cairo_set_source_rgb (cr, 0, 0, 0);
cairo_set_line_width (cr, OUTPUT_TITLE_ITEM_BORDER);
@@ -1721,11 +1707,7 @@ output_title_label_expose_event_cb (GtkWidget *widget, GdkEventExpose *event, gp
allocation.height - OUTPUT_TITLE_ITEM_BORDER);
cairo_stroke (cr);
-#if GTK_CHECK_VERSION (3, 0, 0)
gdk_cairo_set_source_rgba (cr, &color);
-#else
- gdk_cairo_set_source_color (cr, &color);
-#endif
cairo_rectangle (cr,
allocation.x + OUTPUT_TITLE_ITEM_BORDER,
allocation.y + OUTPUT_TITLE_ITEM_BORDER,
@@ -1747,19 +1729,12 @@ output_title_label_expose_event_cb (GtkWidget *widget, GdkEventExpose *event, gp
gtk_widget_set_state (widget, GTK_STATE_NORMAL);
-#if !GTK_CHECK_VERSION (3, 0, 0)
- cairo_destroy (cr);
-#endif
return FALSE;
}
/* See the comment in output_title_event_box_expose_event_cb() about this funny label widget */
static gboolean
-#if GTK_CHECK_VERSION (3, 0, 0)
output_title_label_after_draw_cb (GtkWidget *widget, cairo_t *cr, gpointer data)
-#else
-output_title_label_after_expose_event_cb (GtkWidget *widget, GdkEventExpose *event, gpointer data)
-#endif
{
g_assert (GTK_IS_LABEL (widget));
gtk_widget_set_state (widget, GTK_STATE_INSENSITIVE);
@@ -1847,17 +1822,10 @@ make_menu_item_for_output_title (MsdXrandrManager *manager, MateRROutputInfo *ou
* to its expose-event signal. See the comment in *** to see why need to connect
* to the label both 'before' and 'after'.
*/
-#if GTK_CHECK_VERSION (3, 0, 0)
g_signal_connect (label, "draw",
G_CALLBACK (output_title_label_draw_cb), manager);
g_signal_connect_after (label, "draw",
G_CALLBACK (output_title_label_after_draw_cb) , manager);
-#else
- g_signal_connect (label, "expose-event",
- G_CALLBACK (output_title_label_expose_event_cb), manager);
- g_signal_connect_after (label, "expose-event",
- G_CALLBACK (output_title_label_after_expose_event_cb), manager);
-#endif
g_object_set_data (G_OBJECT (label), "output", output);
@@ -2125,7 +2093,6 @@ status_icon_popup_menu (MsdXrandrManager *manager, guint button, guint32 timesta
g_signal_connect (priv->popup_menu, "selection-done",
G_CALLBACK (status_icon_popup_menu_selection_done_cb), manager);
-#if GTK_CHECK_VERSION (3, 0, 0)
/*Set up custom theming and forced transparency support*/
GtkWidget *toplevel = gtk_widget_get_toplevel (priv->popup_menu);
/*Fix any failures of compiz/other wm's to communicate with gtk for transparency */
@@ -2137,7 +2104,7 @@ status_icon_popup_menu (MsdXrandrManager *manager, guint button, guint32 timesta
context = gtk_widget_get_style_context (GTK_WIDGET(toplevel));
gtk_style_context_add_class(context,"gnome-panel-menu-bar");
gtk_style_context_add_class(context,"mate-panel-menu-bar");
-#endif
+
gtk_menu_popup (GTK_MENU (priv->popup_menu), NULL, NULL,
gtk_status_icon_position_menu,
priv->status_icon, button, timestamp);
@@ -2382,11 +2349,7 @@ msd_xrandr_manager_start (MsdXrandrManager *manager,
True, GrabModeAsync, GrabModeAsync);
gdk_flush ();
-#if GTK_CHECK_VERSION (3, 0, 0)
gdk_error_trap_pop_ignored ();
-#else
- gdk_error_trap_pop ();
-#endif
}
if (manager->priv->rotate_windows_keycode) {
@@ -2398,11 +2361,7 @@ msd_xrandr_manager_start (MsdXrandrManager *manager,
True, GrabModeAsync, GrabModeAsync);
gdk_flush ();
-#if GTK_CHECK_VERSION (3, 0, 0)
gdk_error_trap_pop_ignored ();
-#else
- gdk_error_trap_pop ();
-#endif
}
show_timestamps_dialog (manager, "Startup");
@@ -2441,11 +2400,7 @@ msd_xrandr_manager_stop (MsdXrandrManager *manager)
manager->priv->switch_video_mode_keycode, AnyModifier,
gdk_x11_get_default_root_xwindow());
-#if GTK_CHECK_VERSION (3, 0, 0)
gdk_error_trap_pop_ignored ();
-#else
- gdk_error_trap_pop ();
-#endif
}
if (manager->priv->rotate_windows_keycode) {
@@ -2455,11 +2410,7 @@ msd_xrandr_manager_stop (MsdXrandrManager *manager)
manager->priv->rotate_windows_keycode, AnyModifier,
gdk_x11_get_default_root_xwindow());
-#if GTK_CHECK_VERSION (3, 0, 0)
gdk_error_trap_pop_ignored ();
-#else
- gdk_error_trap_pop ();
-#endif
}
gdk_window_remove_filter (gdk_get_default_root_window (),