summaryrefslogtreecommitdiff
path: root/libmate-desktop
diff options
context:
space:
mode:
Diffstat (limited to 'libmate-desktop')
-rw-r--r--libmate-desktop/Makefile.am4
-rw-r--r--libmate-desktop/mate-aboutdialog.c29
-rw-r--r--libmate-desktop/mate-bg-crossfade.c37
-rw-r--r--libmate-desktop/mate-bg-crossfade.h8
-rw-r--r--libmate-desktop/mate-bg.c203
-rw-r--r--libmate-desktop/mate-bg.h24
-rw-r--r--libmate-desktop/mate-colorbutton.c36
-rw-r--r--libmate-desktop/mate-colorbutton.h4
-rw-r--r--libmate-desktop/mate-colorsel.c212
-rw-r--r--libmate-desktop/mate-colorseldialog.c8
-rw-r--r--libmate-desktop/mate-desktop-2.0-uninstalled.pc.in2
-rw-r--r--libmate-desktop/mate-desktop-2.0.pc.in2
-rw-r--r--libmate-desktop/mate-desktop-item.c8
-rw-r--r--libmate-desktop/mate-desktop-utils.c12
-rw-r--r--libmate-desktop/mate-desktop-utils.h2
-rw-r--r--libmate-desktop/mate-rr-labeler.c89
-rw-r--r--libmate-desktop/mate-rr-labeler.h3
-rw-r--r--libmate-desktop/mate-rr.c10
18 files changed, 4 insertions, 689 deletions
diff --git a/libmate-desktop/Makefile.am b/libmate-desktop/Makefile.am
index 5544b1c..32fa956 100644
--- a/libmate-desktop/Makefile.am
+++ b/libmate-desktop/Makefile.am
@@ -104,8 +104,8 @@ INTROSPECTION_COMPILER_ARGS = --includedir=$(srcdir)
if HAVE_INTROSPECTION
MateDesktop-2.0.gir: libmate-desktop-2.la
-MateDesktop_2_0_gir_INCLUDES = GObject-2.0 Gtk-$(GTK_API_VERSION)
-MateDesktop_2_0_gir_PACKAGES = gdk-pixbuf-2.0 glib-2.0 gobject-2.0 gio-2.0 gtk+-$(GTK_API_VERSION)
+MateDesktop_2_0_gir_INCLUDES = GObject-2.0 Gtk-3.0
+MateDesktop_2_0_gir_PACKAGES = gdk-pixbuf-2.0 glib-2.0 gobject-2.0 gio-2.0 gtk+-3.0
MateDesktop_2_0_gir_CFLAGS = -DMATE_DESKTOP_USE_UNSTABLE_API -I$(top_srcdir)
MateDesktop_2_0_gir_LIBS = libmate-desktop-2.la
MateDesktop_2_0_gir_FILES = $(introspection_sources) $(libmate_desktop_HEADERS)
diff --git a/libmate-desktop/mate-aboutdialog.c b/libmate-desktop/mate-aboutdialog.c
index 29d5737..0e9a39b 100644
--- a/libmate-desktop/mate-aboutdialog.c
+++ b/libmate-desktop/mate-aboutdialog.c
@@ -492,15 +492,7 @@ mate_about_dialog_init (MateAboutDialog *about)
gtk_container_set_border_width (GTK_CONTAINER (gtk_dialog_get_action_area (dialog)), 5);
/* Widgets */
-#if !GTK_CHECK_VERSION(3,0,0)
- gtk_widget_push_composite_child ();
-#endif
-
-#if GTK_CHECK_VERSION (3, 0, 0)
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 8);
-#else
- vbox = gtk_vbox_new (FALSE, 8);
-#endif
gtk_container_set_focus_chain (GTK_CONTAINER (vbox), NULL);
gtk_container_set_border_width (GTK_CONTAINER (vbox), 5);
gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (dialog)), vbox, TRUE, TRUE, 0);
@@ -517,9 +509,7 @@ mate_about_dialog_init (MateAboutDialog *about)
gtk_label_set_selectable (GTK_LABEL (priv->comments_label), TRUE);
gtk_label_set_justify (GTK_LABEL (priv->comments_label), GTK_JUSTIFY_CENTER);
gtk_label_set_line_wrap (GTK_LABEL (priv->comments_label), TRUE);
-#if GTK_CHECK_VERSION (3, 0, 0)
gtk_label_set_max_width_chars (GTK_LABEL (priv->comments_label), 60);
-#endif
gtk_box_pack_start (GTK_BOX (vbox), priv->comments_label, FALSE, FALSE, 0);
priv->copyright_label = gtk_label_new (NULL);
@@ -527,11 +517,7 @@ mate_about_dialog_init (MateAboutDialog *about)
gtk_label_set_justify (GTK_LABEL (priv->copyright_label), GTK_JUSTIFY_CENTER);
gtk_box_pack_start (GTK_BOX (vbox), priv->copyright_label, FALSE, FALSE, 0);
-#if GTK_CHECK_VERSION (3, 0, 0)
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
-#else
- hbox = gtk_hbox_new (TRUE, 0);
-#endif
gtk_box_pack_start (GTK_BOX (vbox), hbox, TRUE, FALSE, 0);
priv->website_label = button = gtk_label_new ("");
@@ -579,10 +565,6 @@ mate_about_dialog_init (MateAboutDialog *about)
gtk_window_set_resizable (GTK_WINDOW (about), FALSE);
-#if !GTK_CHECK_VERSION(3,0,0)
- gtk_widget_pop_composite_child ();
-#endif
-
gtk_widget_grab_default (close_button);
gtk_widget_grab_focus (close_button);
@@ -613,13 +595,8 @@ mate_about_dialog_finalize (GObject *object)
g_slist_foreach (priv->visited_links, (GFunc)g_free, NULL);
g_slist_free (priv->visited_links);
-#if GTK_CHECK_VERSION (3, 0, 0)
g_object_unref (priv->hand_cursor);
g_object_unref (priv->regular_cursor);
-#else
- gdk_cursor_unref (priv->hand_cursor);
- gdk_cursor_unref (priv->regular_cursor);
-#endif
G_OBJECT_CLASS (mate_about_dialog_parent_class)->finalize (object);
}
@@ -1891,20 +1868,14 @@ text_view_visibility_notify_event (GtkWidget *text_view,
GdkEventVisibility *event,
MateAboutDialog *about)
{
-#if GTK_CHECK_VERSION (3, 0, 0)
GdkDeviceManager *device_manager;
GdkDevice *device;
-#endif
gint wx, wy, bx, by;
-#if GTK_CHECK_VERSION (3, 0, 0)
device_manager = gdk_display_get_device_manager (gtk_widget_get_display(text_view));
device = gdk_device_manager_get_client_pointer (device_manager);
gdk_window_get_device_position (gtk_widget_get_window (text_view), device, &wx, &wy, NULL);
-#else
- gdk_window_get_pointer (gtk_widget_get_window (text_view), &wx, &wy, NULL);
-#endif
gtk_text_view_window_to_buffer_coords (GTK_TEXT_VIEW (text_view),
GTK_TEXT_WINDOW_WIDGET,
diff --git a/libmate-desktop/mate-bg-crossfade.c b/libmate-desktop/mate-bg-crossfade.c
index 484f252..a399c1c 100644
--- a/libmate-desktop/mate-bg-crossfade.c
+++ b/libmate-desktop/mate-bg-crossfade.c
@@ -38,13 +38,6 @@
#include <mate-bg.h>
#include "mate-bg-crossfade.h"
-#if !GTK_CHECK_VERSION(3, 0, 0)
-#define cairo_surface_t GdkPixmap
-#define cairo_create gdk_cairo_create
-#define cairo_set_source_surface gdk_cairo_set_source_pixmap
-#define cairo_surface_destroy g_object_unref
-#endif
-
struct _MateBGCrossfadePrivate
{
GdkWindow *window;
@@ -245,7 +238,6 @@ tile_surface (cairo_surface_t *surface,
cairo_surface_t *copy;
cairo_t *cr;
-#if GTK_CHECK_VERSION (3, 0, 0)
if (surface == NULL)
{
copy = gdk_window_create_similar_surface (gdk_get_default_root_window (),
@@ -258,9 +250,6 @@ tile_surface (cairo_surface_t *surface,
cairo_surface_get_content (surface),
width, height);
}
-#else
- copy = gdk_pixmap_new(surface, width, height, surface == NULL? 24 : -1);
-#endif
cr = cairo_create (copy);
@@ -273,7 +262,6 @@ tile_surface (cairo_surface_t *surface,
}
else
{
-#if GTK_CHECK_VERSION (3, 0, 0)
GtkStyleContext *context;
GdkRGBA bg;
context = gtk_style_context_new ();
@@ -283,11 +271,6 @@ tile_surface (cairo_surface_t *surface,
gtk_style_context_get_background_color (context, GTK_STATE_FLAG_NORMAL, &bg);
gdk_cairo_set_source_rgba(cr, &bg);
g_object_unref (G_OBJECT (context));
-#else
- GtkStyle *style;
- style = gtk_widget_get_default_style ();
- gdk_cairo_set_source_color(cr, &style->bg[GTK_STATE_NORMAL]);
-#endif
}
cairo_paint (cr);
@@ -316,11 +299,7 @@ tile_surface (cairo_surface_t *surface,
* could not be copied.
**/
gboolean
-#if GTK_CHECK_VERSION(3, 0, 0)
mate_bg_crossfade_set_start_surface (MateBGCrossfade* fade, cairo_surface_t *surface)
-#else
-mate_bg_crossfade_set_start_pixmap (MateBGCrossfade* fade, GdkPixmap *surface)
-#endif
{
g_return_val_if_fail (MATE_IS_BG_CROSSFADE (fade), FALSE);
@@ -365,11 +344,7 @@ get_current_time (void)
* could not be copied.
**/
gboolean
-#if GTK_CHECK_VERSION(3, 0, 0)
mate_bg_crossfade_set_end_surface (MateBGCrossfade* fade, cairo_surface_t *surface)
-#else
-mate_bg_crossfade_set_end_pixmap (MateBGCrossfade* fade, GdkPixmap *surface)
-#endif
{
g_return_val_if_fail (MATE_IS_BG_CROSSFADE (fade), FALSE);
@@ -486,16 +461,10 @@ on_finished (MateBGCrossfade *fade)
g_assert (fade->priv->end_surface != NULL);
-#if GTK_CHECK_VERSION (3, 0, 0)
cairo_pattern_t *pattern;
pattern = cairo_pattern_create_for_surface (fade->priv->end_surface);
gdk_window_set_background_pattern (fade->priv->window, pattern);
cairo_pattern_destroy (pattern);
-#else
- gdk_window_set_back_pixmap (fade->priv->window,
- fade->priv->end_surface,
- FALSE);
-#endif
draw_background (fade);
cairo_surface_destroy (fade->priv->end_surface);
@@ -545,16 +514,10 @@ mate_bg_crossfade_start (MateBGCrossfade *fade,
g_source_unref (source);
fade->priv->window = window;
-#if GTK_CHECK_VERSION (3, 0, 0)
cairo_pattern_t *pattern;
pattern = cairo_pattern_create_for_surface (fade->priv->fading_surface);
gdk_window_set_background_pattern (fade->priv->window, pattern);
cairo_pattern_destroy (pattern);
-#else
- gdk_window_set_back_pixmap (fade->priv->window,
- fade->priv->fading_surface,
- FALSE);
-#endif
draw_background (fade);
fade->priv->is_first_frame = TRUE;
diff --git a/libmate-desktop/mate-bg-crossfade.h b/libmate-desktop/mate-bg-crossfade.h
index f4674fd..912da20 100644
--- a/libmate-desktop/mate-bg-crossfade.h
+++ b/libmate-desktop/mate-bg-crossfade.h
@@ -63,18 +63,10 @@ struct _MateBGCrossfadeClass
GType mate_bg_crossfade_get_type (void);
MateBGCrossfade *mate_bg_crossfade_new (int width, int height);
-
-#if GTK_CHECK_VERSION(3, 0, 0)
gboolean mate_bg_crossfade_set_start_surface (MateBGCrossfade *fade,
cairo_surface_t *surface);
gboolean mate_bg_crossfade_set_end_surface (MateBGCrossfade *fade,
cairo_surface_t *surface);
-#else
-gboolean mate_bg_crossfade_set_start_pixmap (MateBGCrossfade *fade,
- GdkPixmap *pixmap);
-gboolean mate_bg_crossfade_set_end_pixmap (MateBGCrossfade *fade,
- GdkPixmap *pixmap);
-#endif
void mate_bg_crossfade_start (MateBGCrossfade *fade,
GdkWindow *window);
diff --git a/libmate-desktop/mate-bg.c b/libmate-desktop/mate-bg.c
index e8c198a..8bd8a54 100644
--- a/libmate-desktop/mate-bg.c
+++ b/libmate-desktop/mate-bg.c
@@ -47,18 +47,7 @@ Authors: Soren Sandmann <[email protected]>
#include <mate-bg.h>
#include <mate-bg-crossfade.h>
-#if GTK_CHECK_VERSION (3, 0, 0)
# include <cairo-xlib.h>
-#else
-#define cairo_surface_t GdkPixmap
-#define cairo_create gdk_cairo_create
-#define cairo_surface_destroy g_object_unref
-#define cairo_xlib_surface_get_drawable GDK_DRAWABLE_XID
-#define gdk_error_trap_pop_ignored gdk_error_trap_pop
-#define mate_bg_get_surface_from_root mate_bg_get_pixmap_from_root
-#define mate_bg_crossfade_set_start_surface mate_bg_crossfade_set_start_pixmap
-#define mate_bg_crossfade_set_end_surface mate_bg_crossfade_set_end_pixmap
-#endif
#define MATE_BG_CACHE_DIR "mate/background"
@@ -101,13 +90,8 @@ struct _MateBG {
char *filename;
MateBGPlacement placement;
MateBGColorType color_type;
-#if GTK_CHECK_VERSION (3, 0, 0)
GdkRGBA primary;
GdkRGBA secondary;
-#else
- GdkColor primary;
- GdkColor secondary;
-#endif
gboolean is_enabled;
GFileMonitor* file_monitor;
@@ -139,21 +123,13 @@ static guint signals[N_SIGNALS] = {0};
G_DEFINE_TYPE(MateBG, mate_bg, G_TYPE_OBJECT)
-#if GTK_CHECK_VERSION (3, 0, 0)
static cairo_surface_t *make_root_pixmap (GdkWindow *window,
-#else
-static GdkPixmap *make_root_pixmap (GdkWindow *window,
-#endif
gint width,
gint height);
/* Pixbuf utils */
-#if GTK_CHECK_VERSION (3, 0, 0)
static void pixbuf_average_value (GdkPixbuf *pixbuf,
GdkRGBA *result);
-#else
-static guint32 pixbuf_average_value (GdkPixbuf *pixbuf);
-#endif
static GdkPixbuf *pixbuf_scale_to_fit (GdkPixbuf *src,
int max_width,
int max_height);
@@ -163,13 +139,8 @@ static GdkPixbuf *pixbuf_scale_to_min (GdkPixbuf *src,
static void pixbuf_draw_gradient (GdkPixbuf *pixbuf,
gboolean horizontal,
-#if GTK_CHECK_VERSION (3, 0, 0)
GdkRGBA *c1,
GdkRGBA *c2,
-#else
- GdkColor *c1,
- GdkColor *c2,
-#endif
GdkRectangle *rect);
static void pixbuf_tile (GdkPixbuf *src,
@@ -221,7 +192,6 @@ static FileSize *find_best_size (GSList *sizes,
gint width,
gint height);
-#if GTK_CHECK_VERSION (3, 0, 0)
static void
color_from_string (const char *string,
GdkRGBA *colorp)
@@ -243,29 +213,6 @@ color_to_string (const GdkRGBA *color)
((guint) (color->green * 65535)) >> 8,
((guint) (color->blue * 65535)) >> 8);
}
-#else
-static void
-color_from_string (const char *string,
- GdkColor *colorp)
-{
- /* If all else fails use black */
- gdk_color_parse ("#000000", colorp);
-
- if (!string)
- return;
-
- gdk_color_parse (string, colorp);
-}
-
-static char *
-color_to_string (const GdkColor *color)
-{
- return g_strdup_printf ("#%02x%02x%02x",
- color->red >> 8,
- color->green >> 8,
- color->blue >> 8);
-}
-#endif
static gboolean
do_changed (MateBG *bg)
@@ -384,11 +331,7 @@ mate_bg_load_from_gsettings (MateBG *bg,
char *tmp;
char *filename;
MateBGColorType ctype;
-#if GTK_CHECK_VERSION (3, 0, 0)
GdkRGBA c1, c2;
-#else
- GdkColor c1, c2;
-#endif
MateBGPlacement placement;
g_return_if_fail (MATE_IS_BG (bg));
@@ -576,26 +519,15 @@ mate_bg_new (void)
void
mate_bg_set_color (MateBG *bg,
MateBGColorType type,
-#if GTK_CHECK_VERSION (3, 0, 0)
GdkRGBA *primary,
GdkRGBA *secondary)
-#else
- GdkColor *primary,
- GdkColor *secondary)
-#endif
{
g_return_if_fail (bg != NULL);
g_return_if_fail (primary != NULL);
if (bg->color_type != type ||
-#if GTK_CHECK_VERSION (3, 0, 0)
!gdk_rgba_equal (&bg->primary, primary) ||
(secondary && !gdk_rgba_equal (&bg->secondary, secondary))) {
-#else
- !gdk_color_equal (&bg->primary, primary) ||
- (secondary && !gdk_color_equal (&bg->secondary, secondary))) {
-#endif
-
bg->color_type = type;
bg->primary = *primary;
if (secondary) {
@@ -630,13 +562,8 @@ mate_bg_get_placement (MateBG *bg)
void
mate_bg_get_color (MateBG *bg,
MateBGColorType *type,
-#if GTK_CHECK_VERSION (3, 0, 0)
GdkRGBA *primary,
GdkRGBA *secondary)
-#else
- GdkColor *primary,
- GdkColor *secondary)
-#endif
{
g_return_if_fail (bg != NULL);
@@ -878,15 +805,9 @@ draw_color_area (MateBG *bg,
switch (bg->color_type) {
case MATE_BG_COLOR_SOLID:
/* not really a big deal to ignore the area of interest */
-#if GTK_CHECK_VERSION (3, 0, 0)
pixel = (((guint) bg->primary.red * 65535) >> 8) << 24 |
(((guint) bg->primary.green * 65535) >> 8) << 24 |
(((guint) bg->primary.blue * 65535) >> 8) << 24 |
-#else
- pixel = ((bg->primary.red >> 8) << 24) |
- ((bg->primary.green >> 8) << 16) |
- ((bg->primary.blue >> 8) << 8) |
-#endif
(0xff);
gdk_pixbuf_fill (dest, pixel);
@@ -1205,13 +1126,8 @@ mate_bg_get_pixmap_size (MateBG *bg,
* so that if someone calls XKillClient on it, it won't affect the application
* who created it.
**/
-#if GTK_CHECK_VERSION (3, 0, 0)
cairo_surface_t *
mate_bg_create_surface (MateBG *bg,
-#else
-GdkPixmap *
-mate_bg_create_pixmap (MateBG *bg,
-#endif
GdkWindow *window,
int width,
int height,
@@ -1242,21 +1158,13 @@ mate_bg_create_pixmap (MateBG *bg,
}
else
{
-# if GTK_CHECK_VERSION (3, 0, 0)
surface = gdk_window_create_similar_surface (window, CAIRO_CONTENT_COLOR,
pm_width, pm_height);
-# else
- surface = gdk_pixmap_new (window, pm_width, pm_height, -1);
-# endif
}
cr = cairo_create (surface);
if (!bg->filename && bg->color_type == MATE_BG_COLOR_SOLID) {
-#if GTK_CHECK_VERSION (3, 0, 0)
gdk_cairo_set_source_rgba (cr, &(bg->primary));
-#else
- gdk_cairo_set_source_color (cr, &(bg->primary));
-#endif
}
else
{
@@ -1285,11 +1193,7 @@ mate_bg_is_dark (MateBG *bg,
int width,
int height)
{
-#if GTK_CHECK_VERSION (3, 0, 0)
GdkRGBA color;
-#else
- GdkColor color;
-#endif
int intensity;
GdkPixbuf *pixbuf;
@@ -1304,7 +1208,6 @@ mate_bg_is_dark (MateBG *bg,
}
pixbuf = get_pixbuf_for_size (bg, -1, width, height);
if (pixbuf) {
-#if GTK_CHECK_VERSION (3, 0, 0)
GdkRGBA argb;
guchar a, r, g, b;
@@ -1313,13 +1216,6 @@ mate_bg_is_dark (MateBG *bg,
r = argb.red * 0xff;
g = argb.green * 0xff;
b = argb.blue * 0xff;
-#else
- guint32 argb = pixbuf_average_value (pixbuf);
- guchar a = (argb >> 24) & 0xff;
- guchar r = (argb >> 16) & 0xff;
- guchar g = (argb >> 8) & 0xff;
- guchar b = (argb >> 0) & 0xff;
-#endif
color.red = (color.red * (0xFF - a) + r * 0x101 * a) / 0xFF;
color.green = (color.green * (0xFF - a) + g * 0x101 * a) / 0xFF;
@@ -1327,15 +1223,9 @@ mate_bg_is_dark (MateBG *bg,
g_object_unref (pixbuf);
}
-#if GTK_CHECK_VERSION (3, 0, 0)
intensity = ((guint) (color.red * 65535) * 77 +
(guint) (color.green * 65535) * 150 +
(guint) (color.blue * 65535) * 28) >> 16;
-#else
- intensity = (color.red * 77 +
- color.green * 150 +
- color.blue * 28) >> 16;
-#endif
return intensity < 160; /* biased slightly to be dark */
}
@@ -1344,11 +1234,7 @@ mate_bg_is_dark (MateBG *bg,
* Create a persistent pixmap. We create a separate display
* and set the closedown mode on it to RetainPermanent.
*/
-#if GTK_CHECK_VERSION (3, 0, 0)
static cairo_surface_t *
-#else
-static GdkPixmap *
-#endif
make_root_pixmap (GdkWindow *window, gint width, gint height)
{
GdkScreen *screen = gdk_window_get_screen(window);
@@ -1376,14 +1262,9 @@ make_root_pixmap (GdkWindow *window, gint width, gint height)
XSetCloseDownMode (display, RetainPermanent);
XCloseDisplay (display);
-# if GTK_CHECK_VERSION (3, 0, 0)
surface = cairo_xlib_surface_create (GDK_SCREEN_XDISPLAY (screen), xpixmap,
GDK_VISUAL_XVISUAL (gdk_screen_get_system_visual (screen)),
width, height);
-# else
- surface = gdk_pixmap_foreign_new_for_screen (screen, xpixmap, width, height, depth);
- gdk_drawable_set_colormap (surface, gdk_drawable_get_colormap (window));
-# endif
return surface;
}
@@ -1511,13 +1392,8 @@ mate_bg_create_thumbnail (MateBG *bg,
*
* Return value: a #cairo_surface_t if successful or %NULL
**/
-#if GTK_CHECK_VERSION (3, 0, 0)
cairo_surface_t *
mate_bg_get_surface_from_root (GdkScreen *screen)
-#else
-GdkPixmap *
-mate_bg_get_pixmap_from_root (GdkScreen *screen)
-#endif
{
int result;
gint format;
@@ -1553,7 +1429,6 @@ mate_bg_get_pixmap_from_root (GdkScreen *screen)
if (data != NULL) {
gdk_error_trap_push ();
-# if GTK_CHECK_VERSION (3, 0, 0)
Pixmap xpixmap = *(Pixmap *) data;
Window root_return;
int x_ret, y_ret;
@@ -1571,21 +1446,11 @@ mate_bg_get_pixmap_from_root (GdkScreen *screen)
}
gdk_error_trap_pop_ignored ();
-# else
- source_pixmap = gdk_pixmap_foreign_new (*(Pixmap *) data);
- gdk_error_trap_pop ();
-
- if (source_pixmap != NULL) {
- gdk_drawable_set_colormap (source_pixmap,
- gdk_screen_get_default_colormap (screen));
- }
-# endif
}
width = gdk_screen_get_width (screen);
height = gdk_screen_get_height (screen);
-# if GTK_CHECK_VERSION (3, 0, 0)
if (source_pixmap) {
surface = cairo_surface_create_similar (source_pixmap,
CAIRO_CONTENT_COLOR,
@@ -1608,27 +1473,6 @@ mate_bg_get_pixmap_from_root (GdkScreen *screen)
CAIRO_CONTENT_COLOR,
width, height);
}
-# else
- surface = gdk_pixmap_new (source_pixmap != NULL? source_pixmap :
- gdk_screen_get_root_window (screen),
- width, height, -1);
-
- cr = gdk_cairo_create (surface);
- if (source_pixmap != NULL) {
- gdk_cairo_set_source_pixmap (cr, source_pixmap, 0, 0);
- cairo_pattern_t *pattern = cairo_get_source (cr);
- cairo_pattern_set_extend (pattern, CAIRO_EXTEND_REPEAT);
- } else {
- cairo_set_source_rgb (cr, 0.0, 0.0, 0.0);
- }
- cairo_paint (cr);
-
- if (cairo_status (cr) != CAIRO_STATUS_SUCCESS) {
- g_object_unref (surface);
- surface = NULL;
- }
- cairo_destroy (cr);
-# endif
if (source_pixmap != NULL)
cairo_surface_destroy (source_pixmap);
@@ -1681,9 +1525,6 @@ mate_bg_set_root_pixmap_id (GdkScreen *screen,
if (esetrootpmap && esetrootpmap != xrootpmap) {
XKillClient (display, esetrootpmap);
}
-# if !GTK_CHECK_VERSION (3, 0, 0)
- XSync (display, False);
-# endif
gdk_error_trap_pop_ignored ();
}
}
@@ -1720,18 +1561,10 @@ mate_bg_set_root_pixmap_id (GdkScreen *screen,
* to mate_bg_create_surface().
**/
void
-#if GTK_CHECK_VERSION (3, 0, 0)
mate_bg_set_surface_as_root (GdkScreen *screen, cairo_surface_t *surface)
-#else
-mate_bg_set_pixmap_as_root (GdkScreen *screen, GdkPixmap *surface)
-#endif
{
g_return_if_fail (screen != NULL);
-# if GTK_CHECK_VERSION (3, 0, 0)
g_return_if_fail (cairo_surface_get_type (surface) == CAIRO_SURFACE_TYPE_XLIB);
-# else
- g_return_if_fail (surface != NULL);
-# endif
/* Desktop background pixmap should be created from dummy X client since most
* applications will try to kill it with XKillClient later when changing pixmap
@@ -1763,13 +1596,8 @@ mate_bg_set_pixmap_as_root (GdkScreen *screen, GdkPixmap *surface)
* Return value: (transfer full): a #MateBGCrossfade object
**/
MateBGCrossfade *
-#if GTK_CHECK_VERSION (3, 0, 0)
mate_bg_set_surface_as_root_with_crossfade (GdkScreen *screen,
cairo_surface_t *surface)
-#else
-mate_bg_set_pixmap_as_root_with_crossfade (GdkScreen *screen,
- GdkPixmap *surface)
-#endif
{
g_return_val_if_fail (screen != NULL, NULL);
g_return_val_if_fail (surface != NULL, NULL);
@@ -2576,14 +2404,9 @@ clear_cache (MateBG *bg)
}
/* Pixbuf utilities */
-#if GTK_CHECK_VERSION (3, 0, 0)
static void
pixbuf_average_value (GdkPixbuf *pixbuf,
GdkRGBA *result)
-#else
-static guint32
-pixbuf_average_value (GdkPixbuf *pixbuf)
-#endif
{
guint64 a_total, r_total, g_total, b_total;
guint row, column;
@@ -2592,9 +2415,7 @@ pixbuf_average_value (GdkPixbuf *pixbuf)
int r, g, b, a;
guint64 dividend;
guint width, height;
-#if GTK_CHECK_VERSION (3, 0, 0)
gdouble dd;
-#endif
width = gdk_pixbuf_get_width (pixbuf);
height = gdk_pixbuf_get_height (pixbuf);
@@ -2640,20 +2461,12 @@ pixbuf_average_value (GdkPixbuf *pixbuf)
dividend = height * width;
a_total = dividend * 0xFF;
}
-#if GTK_CHECK_VERSION (3, 0, 0)
dd = dividend * 0xFF;
result->alpha = a_total / dd;
result->red = r_total / dd;
result->green = g_total / dd;
result->blue = b_total / dd;
-#else
-
- return ((a_total + dividend / 2) / dividend) << 24
- | ((r_total + dividend / 2) / dividend) << 16
- | ((g_total + dividend / 2) / dividend) << 8
- | ((b_total + dividend / 2) / dividend);
-#endif
}
static GdkPixbuf *
@@ -2709,13 +2522,8 @@ pixbuf_scale_to_min (GdkPixbuf *src, int min_width, int min_height)
}
static guchar *
-#if GTK_CHECK_VERSION (3, 0, 0)
create_gradient (const GdkRGBA *primary,
const GdkRGBA *secondary,
-#else
-create_gradient (const GdkColor *primary,
- const GdkColor *secondary,
-#endif
int n_pixels)
{
guchar *result = g_malloc (n_pixels * 3);
@@ -2724,15 +2532,9 @@ create_gradient (const GdkColor *primary,
for (i = 0; i < n_pixels; ++i) {
double ratio = (i + 0.5) / n_pixels;
-#if GTK_CHECK_VERSION (3, 0, 0)
result[3 * i + 0] = (guchar) ((primary->red * (1 - ratio) + secondary->red * ratio) * 0x100);
result[3 * i + 1] = (guchar) ((primary->green * (1 - ratio) + secondary->green * ratio) * 0x100);
result[3 * i + 2] = (guchar) ((primary->blue * (1 - ratio) + secondary->blue * ratio) * 0x100);
-#else
- result[3 * i + 0] = ((guint16) (primary->red * (1 - ratio) + secondary->red * ratio)) >> 8;
- result[3 * i + 1] = ((guint16) (primary->green * (1 - ratio) + secondary->green * ratio)) >> 8;
- result[3 * i + 2] = ((guint16) (primary->blue * (1 - ratio) + secondary->blue * ratio)) >> 8;
-#endif
}
return result;
@@ -2741,13 +2543,8 @@ create_gradient (const GdkColor *primary,
static void
pixbuf_draw_gradient (GdkPixbuf *pixbuf,
gboolean horizontal,
-#if GTK_CHECK_VERSION (3, 0, 0)
GdkRGBA *primary,
GdkRGBA *secondary,
-#else
- GdkColor *primary,
- GdkColor *secondary,
-#endif
GdkRectangle *rect)
{
int width;
diff --git a/libmate-desktop/mate-bg.h b/libmate-desktop/mate-bg.h
index 1b612a6..a1adf36 100644
--- a/libmate-desktop/mate-bg.h
+++ b/libmate-desktop/mate-bg.h
@@ -102,13 +102,8 @@ void mate_bg_set_placement (MateBG *bg,
MateBGPlacement placement);
void mate_bg_set_color (MateBG *bg,
MateBGColorType type,
-#if GTK_CHECK_VERSION(3, 0, 0)
GdkRGBA *primary,
GdkRGBA *secondary);
-#else
- GdkColor *primary,
- GdkColor *secondary);
-#endif
void mate_bg_set_draw_background (MateBG *bg,
gboolean draw_background);
/* Getters */
@@ -116,13 +111,8 @@ gboolean mate_bg_get_draw_background (MateBG *bg);
MateBGPlacement mate_bg_get_placement (MateBG *bg);
void mate_bg_get_color (MateBG *bg,
MateBGColorType *type,
-#if GTK_CHECK_VERSION(3, 0, 0)
GdkRGBA *primary,
GdkRGBA *secondary);
-#else
- GdkColor *primary,
- GdkColor *secondary);
-#endif
const gchar * mate_bg_get_filename (MateBG *bg);
/* Drawing and thumbnailing */
@@ -131,11 +121,7 @@ void mate_bg_draw (MateBG *bg,
GdkScreen *screen,
gboolean is_root);
-#if GTK_CHECK_VERSION(3, 0, 0)
cairo_surface_t *mate_bg_create_surface (MateBG *bg,
-#else
-GdkPixmap *mate_bg_create_pixmap (MateBG *bg,
-#endif
GdkWindow *window,
int width,
int height,
@@ -168,22 +154,12 @@ GdkPixbuf * mate_bg_create_frame_thumbnail (MateBG *bg,
* if we decide to stabilize the API then we may want to make
* these object methods, drop mate_bg_create_surface, etc.
*/
-#if GTK_CHECK_VERSION(3, 0, 0)
void mate_bg_set_surface_as_root (GdkScreen *screen,
cairo_surface_t *surface);
MateBGCrossfade *mate_bg_set_surface_as_root_with_crossfade (GdkScreen *screen,
cairo_surface_t *surface);
cairo_surface_t *mate_bg_get_surface_from_root (GdkScreen *screen);
-#else /* GTK_CHECK_VERSION(3, 0, 0) */
-
-void mate_bg_set_pixmap_as_root (GdkScreen *screen,
- GdkPixmap *pixmap);
-MateBGCrossfade *mate_bg_set_pixmap_as_root_with_crossfade (GdkScreen *screen,
- GdkPixmap *pixmap);
-GdkPixmap *mate_bg_get_pixmap_from_root (GdkScreen *screen);
-#endif /* GTK_CHECK_VERSION(3, 0, 0) */
-
G_END_DECLS
#endif
diff --git a/libmate-desktop/mate-colorbutton.c b/libmate-desktop/mate-colorbutton.c
index b559294..8d3da3e 100644
--- a/libmate-desktop/mate-colorbutton.c
+++ b/libmate-desktop/mate-colorbutton.c
@@ -258,28 +258,13 @@ mate_color_button_get_checkered (void)
/* Handle exposure events for the color picker's drawing area */
static gboolean
-#if GTK_CHECK_VERSION (3, 0, 0)
draw (GtkWidget *widget,
cairo_t *cr,
gpointer data)
-#else
-expose_event (GtkWidget *widget,
- GdkEventExpose *event,
- gpointer data)
-#endif
{
MateColorButton *color_button = MATE_COLOR_BUTTON (data);
cairo_pattern_t *checkered;
-#if !GTK_CHECK_VERSION (3, 0, 0)
- cairo_t *cr = gdk_cairo_create (event->window);
-
- GtkAllocation allocation;
- gtk_widget_get_allocation (widget, &allocation);
- gdk_cairo_rectangle (cr, &allocation);
- cairo_clip (cr);
-#endif
-
if (mate_color_button_has_alpha (color_button))
{
cairo_save (cr);
@@ -317,10 +302,6 @@ expose_event (GtkWidget *widget,
cairo_pattern_destroy (checkered);
}
-#if !GTK_CHECK_VERSION (3, 0, 0)
- cairo_destroy (cr);
-#endif
-
return FALSE;
}
@@ -435,10 +416,6 @@ mate_color_button_init (MateColorButton *color_button)
/* Create the widgets */
color_button->priv = MATE_COLOR_BUTTON_GET_PRIVATE (color_button);
-#if !GTK_CHECK_VERSION(3,0,0)
- gtk_widget_push_composite_child ();
-#endif
-
alignment = gtk_alignment_new (0.5, 0.5, 0.5, 1.0);
gtk_container_set_border_width (GTK_CONTAINER (alignment), 1);
gtk_container_add (GTK_CONTAINER (color_button), alignment);
@@ -457,13 +434,8 @@ mate_color_button_init (MateColorButton *color_button)
g_object_unref (layout);
gtk_widget_set_size_request (color_button->priv->draw_area, rect.width - 2, rect.height - 2);
-#if GTK_CHECK_VERSION (3, 0, 0)
g_signal_connect (color_button->priv->draw_area, "draw",
G_CALLBACK (draw), color_button);
-#else
- g_signal_connect (color_button->priv->draw_area, "expose-event",
- G_CALLBACK (expose_event), color_button);
-#endif
gtk_container_add (GTK_CONTAINER (frame), color_button->priv->draw_area);
gtk_widget_show (color_button->priv->draw_area);
@@ -492,10 +464,6 @@ mate_color_button_init (MateColorButton *color_button)
G_CALLBACK (mate_color_button_drag_data_received), color_button);
g_signal_connect (color_button, "drag-data-get",
G_CALLBACK (mate_color_button_drag_data_get), color_button);
-
-#if !GTK_CHECK_VERSION(3,0,0)
- gtk_widget_pop_composite_child ();
-#endif
}
static void
@@ -673,7 +641,6 @@ mate_color_button_set_color (MateColorButton *color_button,
g_object_notify (G_OBJECT (color_button), "color");
}
-#if GTK_CHECK_VERSION(3, 0, 0)
/**
* mate_color_button_set_rgba:
* @color_button: a #MateColorButton.
@@ -699,7 +666,6 @@ mate_color_button_set_rgba (MateColorButton *color_button,
g_object_notify (G_OBJECT (color_button), "color");
}
-#endif
/**
* mate_color_button_set_alpha:
@@ -743,7 +709,6 @@ mate_color_button_get_color (MateColorButton *color_button,
color->blue = color_button->priv->color.blue;
}
-#if GTK_CHECK_VERSION(3, 0, 0)
/**
* mate_color_button_get_rgba:
* @color_button: a #MateColorButton.
@@ -764,7 +729,6 @@ mate_color_button_get_rgba (MateColorButton *color_button,
color->blue = color_button->priv->color.blue / 65535.;
color->alpha = color_button->priv->alpha / 65535.;
}
-#endif
/**
* mate_color_button_get_alpha:
diff --git a/libmate-desktop/mate-colorbutton.h b/libmate-desktop/mate-colorbutton.h
index 7d6528f..2670e03 100644
--- a/libmate-desktop/mate-colorbutton.h
+++ b/libmate-desktop/mate-colorbutton.h
@@ -81,18 +81,14 @@ GtkWidget *mate_color_button_new (void);
GtkWidget *mate_color_button_new_with_color (const GdkColor *color);
void mate_color_button_set_color (MateColorButton *color_button,
const GdkColor *color);
-#if GTK_CHECK_VERSION(3, 0, 0)
void mate_color_button_set_rgba (MateColorButton *color_button,
const GdkRGBA *color);
-#endif
void mate_color_button_set_alpha (MateColorButton *color_button,
guint16 alpha);
void mate_color_button_get_color (MateColorButton *color_button,
GdkColor *color);
-#if GTK_CHECK_VERSION(3, 0, 0)
void mate_color_button_get_rgba (MateColorButton *color_button,
GdkRGBA *color);
-#endif
guint16 mate_color_button_get_alpha (MateColorButton *color_button);
void mate_color_button_set_use_alpha (MateColorButton *color_button,
gboolean use_alpha);
diff --git a/libmate-desktop/mate-colorsel.c b/libmate-desktop/mate-colorsel.c
index 4d14d54..7ae2455 100644
--- a/libmate-desktop/mate-colorsel.c
+++ b/libmate-desktop/mate-colorsel.c
@@ -35,13 +35,6 @@
#include <glib/gi18n-lib.h>
#include "mate-colorsel.h"
-#if !GTK_CHECK_VERSION(3,0,0)
-#define gtk_widget_get_preferred_size(x,y,z) gtk_widget_size_request(x,y)
-# define gtk_separator_new(orientation) \
- (((orientation) == GTK_ORIENTATION_HORIZONTAL) ? \
- gtk_hseparator_new () : gtk_vseparator_new ())
-#endif
-
#define DEFAULT_COLOR_PALETTE "#ef2929:#fcaf3e:#fce94f:#8ae234:#729fcf:#ad7fa8:#e9b96e:#888a85:#eeeeec:#cc0000:#f57900:#edd400:#73d216:#3465a4:#75507b:#c17d11:#555753:#d3d7cf:#a40000:#ce5c00:#c4a000:#4e9a06:#204a87:#5c3566:#8f5902:#2e3436:#babdb6:#000000:#2e3436:#555753:#888a85:#babdb6:#d3d7cf:#eeeeec:#f3f3f3:#ffffff"
/* Number of elements in the custom palatte */
@@ -217,7 +210,6 @@ static guint color_selection_signals[LAST_SIGNAL] = { 0 };
static MateColorSelectionChangePaletteFunc noscreen_change_palette_hook = default_noscreen_change_palette_func;
static MateColorSelectionChangePaletteWithScreenFunc change_palette_hook = default_change_palette_func;
-#if GTK_CHECK_VERSION (3, 0, 0)
static const guchar dropper_bits[] = {
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\377\377\377\377\377\377\377\377\377\377"
@@ -260,29 +252,6 @@ static const guchar dropper_bits[] = {
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\377\0\0\0\0\0"
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"};
-#else
-static const guchar dropper_bits[] = {
- 0xff, 0x8f, 0x01, 0x00, 0xff, 0x77, 0x01, 0x00,
- 0xff, 0xfb, 0x00, 0x00, 0xff, 0xf8, 0x00, 0x00,
- 0x7f, 0xff, 0x00, 0x00, 0xff, 0x7e, 0x01, 0x00,
- 0xff, 0x9d, 0x01, 0x00, 0xff, 0xd8, 0x01, 0x00,
- 0x7f, 0xd4, 0x01, 0x00, 0x3f, 0xee, 0x01, 0x00,
- 0x1f, 0xff, 0x01, 0x00, 0x8f, 0xff, 0x01, 0x00,
- 0xc7, 0xff, 0x01, 0x00, 0xe3, 0xff, 0x01, 0x00,
- 0xf3, 0xff, 0x01, 0x00, 0xfd, 0xff, 0x01, 0x00,
- 0xff, 0xff, 0x01, 0x00 };
-
-static const guchar dropper_mask[] = {
- 0x00, 0x70, 0x00, 0x00, 0x00, 0xf8, 0x00, 0x00,
- 0x00, 0xfc, 0x01, 0x00, 0x00, 0xff, 0x01, 0x00,
- 0x80, 0xff, 0x01, 0x00, 0x00, 0xff, 0x00, 0x00,
- 0x00, 0x7f, 0x00, 0x00, 0x80, 0x3f, 0x00, 0x00,
- 0xc0, 0x3f, 0x00, 0x00, 0xe0, 0x13, 0x00, 0x00,
- 0xf0, 0x01, 0x00, 0x00, 0xf8, 0x00, 0x00, 0x00,
- 0x7c, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x00,
- 0x1e, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00 };
-#endif
G_DEFINE_TYPE (MateColorSelection, mate_color_selection, GTK_TYPE_BOX)
@@ -369,27 +338,15 @@ mate_color_selection_init (MateColorSelection *colorsel)
_mate_desktop_init_i18n ();
-#if !GTK_CHECK_VERSION(3,0,0)
- gtk_widget_push_composite_child ();
-#endif
-
priv = colorsel->private_data = G_TYPE_INSTANCE_GET_PRIVATE (colorsel, MATE_TYPE_COLOR_SELECTION, ColorSelectionPrivate);
priv->changing = FALSE;
priv->default_set = FALSE;
priv->default_alpha_set = FALSE;
-#if GTK_CHECK_VERSION (3, 0, 0)
top_hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
-#else
- top_hbox = gtk_hbox_new (FALSE, 12);
-#endif
gtk_box_pack_start (GTK_BOX (colorsel), top_hbox, FALSE, FALSE, 0);
-#if GTK_CHECK_VERSION (3, 0, 0)
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
-#else
- vbox = gtk_vbox_new (FALSE, 6);
-#endif
priv->triangle_colorsel = gtk_hsv_new ();
g_signal_connect (priv->triangle_colorsel, "changed",
G_CALLBACK (hsv_changed), colorsel);
@@ -399,11 +356,7 @@ mate_color_selection_init (MateColorSelection *colorsel)
gtk_widget_set_tooltip_text (priv->triangle_colorsel,
_("Select the color you want from the outer ring. Select the darkness or lightness of that color using the inner triangle."));
-#if GTK_CHECK_VERSION (3, 0, 0)
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
-#else
- hbox = gtk_hbox_new (FALSE, 6);
-#endif
gtk_box_pack_end (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
frame = gtk_frame_new (NULL);
@@ -427,11 +380,7 @@ mate_color_selection_init (MateColorSelection *colorsel)
gtk_widget_set_tooltip_text (button,
_("Click the eyedropper, then click a color anywhere on your screen to select that color."));
-#if GTK_CHECK_VERSION (3, 0, 0)
top_right_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
-#else
- top_right_vbox = gtk_vbox_new (FALSE, 6);
-#endif
gtk_box_pack_start (GTK_BOX (top_hbox), top_right_vbox, FALSE, FALSE, 0);
table = gtk_table_new (8, 6, FALSE);
gtk_box_pack_start (GTK_BOX (top_right_vbox), table, FALSE, FALSE, 0);
@@ -528,11 +477,7 @@ mate_color_selection_init (MateColorSelection *colorsel)
}
}
set_selected_palette (colorsel, 0, 0);
-#if GTK_CHECK_VERSION (3, 0, 0)
priv->palette_frame = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
-#else
- priv->palette_frame = gtk_vbox_new (FALSE, 6);
-#endif
label = gtk_label_new_with_mnemonic (_("_Palette:"));
#if GTK_CHECK_VERSION (3, 16, 0)
gtk_label_set_xalign (GTK_LABEL (label), 0.0);
@@ -570,10 +515,6 @@ mate_color_selection_init (MateColorSelection *colorsel)
atk_object_set_role (gtk_widget_get_accessible (GTK_WIDGET (colorsel)), ATK_ROLE_COLOR_CHOOSER);
make_all_relations (atk_obj, priv);
}
-
-#if !GTK_CHECK_VERSION(3,0,0)
- gtk_widget_pop_composite_child ();
-#endif
}
/* GObject methods */
@@ -718,11 +659,7 @@ mate_color_selection_grab_broken (GtkWidget *widget,
*
*/
-#if GTK_CHECK_VERSION (3, 0, 0)
static void color_sample_draw_sample (MateColorSelection *colorsel, cairo_t *cr, int which);
-#else
-static void color_sample_draw_sample (MateColorSelection *colorsel, int which);
-#endif
static void color_sample_update_samples (MateColorSelection *colorsel);
static void
@@ -881,18 +818,11 @@ color_sample_drag_handle (GtkWidget *widget,
/* which = 0 means draw old sample, which = 1 means draw new */
static void
-#if GTK_CHECK_VERSION (3, 0, 0)
color_sample_draw_sample (MateColorSelection *colorsel, cairo_t *cr, int which)
-#else
-color_sample_draw_sample (MateColorSelection *colorsel, int which)
-#endif
{
GtkWidget *da;
gint x, y, wid, heig, goff;
ColorSelectionPrivate *priv;
-#if !GTK_CHECK_VERSION (3, 0, 0)
- cairo_t *cr;
-#endif
GtkAllocation allocation;
g_return_if_fail (colorsel != NULL);
@@ -914,10 +844,6 @@ color_sample_draw_sample (MateColorSelection *colorsel, int which)
goff = allocation.width % 32;
}
-#if !GTK_CHECK_VERSION (3, 0, 0)
- cr = gdk_cairo_create (gtk_widget_get_window (da));
-#endif
-
gtk_widget_get_allocation (da, &allocation);
wid = allocation.width;
heig = allocation.height;
@@ -961,10 +887,6 @@ color_sample_draw_sample (MateColorSelection *colorsel, int which)
cairo_rectangle (cr, 0, 0, wid, heig);
cairo_fill (cr);
-
-#if !GTK_CHECK_VERSION (3, 0, 0)
- cairo_destroy (cr);
-#endif
}
@@ -976,7 +898,6 @@ color_sample_update_samples (MateColorSelection *colorsel)
gtk_widget_queue_draw (priv->cur_sample);
}
-#if GTK_CHECK_VERSION (3, 0, 0)
static gboolean
color_old_sample_draw (GtkWidget *da,
cairo_t *cr,
@@ -995,26 +916,6 @@ color_cur_sample_draw (GtkWidget *da,
color_sample_draw_sample (colorsel, cr, 1);
return FALSE;
}
-#else
-static gboolean
-color_old_sample_expose (GtkWidget *da,
- GdkEventExpose *event,
- MateColorSelection *colorsel)
-{
- color_sample_draw_sample (colorsel, 0);
- return FALSE;
-}
-
-
-static gboolean
-color_cur_sample_expose (GtkWidget *da,
- GdkEventExpose *event,
- MateColorSelection *colorsel)
-{
- color_sample_draw_sample (colorsel, 1);
- return FALSE;
-}
-#endif
static void
color_sample_setup_dnd (MateColorSelection *colorsel, GtkWidget *sample)
@@ -1089,11 +990,7 @@ color_sample_new (MateColorSelection *colorsel)
priv = colorsel->private_data;
-#if GTK_CHECK_VERSION (3, 0, 0)
priv->sample_area = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
-#else
- priv->sample_area = gtk_hbox_new (FALSE, 0);
-#endif
priv->old_sample = gtk_drawing_area_new ();
priv->cur_sample = gtk_drawing_area_new ();
@@ -1102,21 +999,12 @@ color_sample_new (MateColorSelection *colorsel)
gtk_box_pack_start (GTK_BOX (priv->sample_area), priv->cur_sample,
TRUE, TRUE, 0);
-#if GTK_CHECK_VERSION (3, 0, 0)
g_signal_connect (priv->old_sample, "draw",
G_CALLBACK (color_old_sample_draw),
colorsel);
g_signal_connect (priv->cur_sample, "draw",
G_CALLBACK (color_cur_sample_draw),
colorsel);
-#else
- g_signal_connect (priv->old_sample, "expose-event",
- G_CALLBACK (color_old_sample_expose),
- colorsel);
- g_signal_connect (priv->cur_sample, "expose-event",
- G_CALLBACK (color_cur_sample_expose),
- colorsel);
-#endif
color_sample_setup_dnd (colorsel, priv->old_sample);
color_sample_setup_dnd (colorsel, priv->cur_sample);
@@ -1159,16 +1047,9 @@ palette_get_color (GtkWidget *drawing_area, gdouble *color)
static void
palette_paint (GtkWidget *drawing_area,
-#if GTK_CHECK_VERSION (3, 0, 0)
cairo_t *cr,
-#else
- GdkRectangle *area,
-#endif
gpointer data)
{
-#if !GTK_CHECK_VERSION (3, 0, 0)
- cairo_t *cr;
-#endif
gint focus_width;
GtkAllocation allocation;
@@ -1177,16 +1058,8 @@ palette_paint (GtkWidget *drawing_area,
gtk_widget_get_allocation (drawing_area, &allocation);
-#if !GTK_CHECK_VERSION (3, 0, 0)
- cr = gdk_cairo_create (gtk_widget_get_window (drawing_area));
-#endif
-
gdk_cairo_set_source_color (cr, &gtk_widget_get_style (drawing_area)->bg[GTK_STATE_NORMAL]);
-#if GTK_CHECK_VERSION (3, 0, 0)
cairo_rectangle (cr, 0, 0, allocation.width, allocation.height);
-#else
- gdk_cairo_rectangle (cr, area);
-#endif
cairo_fill (cr);
if (gtk_widget_has_focus (drawing_area))
@@ -1199,10 +1072,6 @@ palette_paint (GtkWidget *drawing_area,
allocation.height - focus_width);
cairo_stroke (cr);
}
-
-#if !GTK_CHECK_VERSION (3, 0, 0)
- cairo_destroy (cr);
-#endif
}
static void
@@ -1423,24 +1292,14 @@ palette_set_color (GtkWidget *drawing_area,
}
static gboolean
-#if GTK_CHECK_VERSION (3, 0, 0)
palette_draw (GtkWidget *drawing_area,
cairo_t *cr,
gpointer data)
-#else
-palette_expose (GtkWidget *drawing_area,
- GdkEventExpose *event,
- gpointer data)
-#endif
{
if (gtk_widget_get_window (drawing_area) == NULL)
return FALSE;
-#if GTK_CHECK_VERSION (3, 0, 0)
palette_paint (drawing_area, cr, data);
-#else
- palette_paint (drawing_area, &(event->area), data);
-#endif
return FALSE;
}
@@ -1701,13 +1560,8 @@ palette_new (MateColorSelection *colorsel)
| GDK_ENTER_NOTIFY_MASK
| GDK_LEAVE_NOTIFY_MASK);
-#if GTK_CHECK_VERSION (3, 0, 0)
g_signal_connect (retval, "draw",
G_CALLBACK (palette_draw), colorsel);
-#else
- g_signal_connect (retval, "expose-event",
- G_CALLBACK (palette_expose), colorsel);
-#endif
g_signal_connect (retval, "button-press-event",
G_CALLBACK (palette_press), colorsel);
g_signal_connect (retval, "button-release-event",
@@ -1755,7 +1609,6 @@ make_picker_cursor (GdkScreen *screen)
if (!cursor)
{
-#if GTK_CHECK_VERSION (3, 0, 0)
GdkPixbuf *pixbuf;
pixbuf = gdk_pixbuf_new_from_data (dropper_bits,
@@ -1767,54 +1620,7 @@ make_picker_cursor (GdkScreen *screen)
cursor = gdk_cursor_new_from_pixbuf (gdk_screen_get_display (screen),
pixbuf,
DROPPER_X_HOT, DROPPER_Y_HOT);
-
g_object_unref (pixbuf);
-#else
- GdkColor bg = { 0, 0xffff, 0xffff, 0xffff };
- GdkColor fg = { 0, 0x0000, 0x0000, 0x0000 };
- GdkWindow *window;
- GdkPixmap *pixmap, *mask;
- cairo_surface_t *image;
- cairo_t *cr;
-
- window = gdk_screen_get_root_window (screen);
-
-
- pixmap = gdk_pixmap_new (window, DROPPER_WIDTH, DROPPER_HEIGHT, 1);
-
- cr = gdk_cairo_create (pixmap);
- cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE);
- image = cairo_image_surface_create_for_data ((guchar *) dropper_bits,
- CAIRO_FORMAT_A1,
- DROPPER_WIDTH,
- DROPPER_HEIGHT,
- DROPPER_STRIDE);
- cairo_set_source_surface (cr, image, 0, 0);
- cairo_surface_destroy (image);
- cairo_paint (cr);
- cairo_destroy (cr);
-
-
- mask = gdk_pixmap_new (window, DROPPER_WIDTH, DROPPER_HEIGHT, 1);
-
- cr = gdk_cairo_create (mask);
- cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE);
- image = cairo_image_surface_create_for_data ((guchar *) dropper_mask,
- CAIRO_FORMAT_A1,
- DROPPER_WIDTH,
- DROPPER_HEIGHT,
- DROPPER_STRIDE);
- cairo_set_source_surface (cr, image, 0, 0);
- cairo_surface_destroy (image);
- cairo_paint (cr);
- cairo_destroy (cr);
-
- cursor = gdk_cursor_new_from_pixmap (pixmap, mask, &fg, &bg,
- DROPPER_X_HOT, DROPPER_Y_HOT);
-
- g_object_unref (pixmap);
- g_object_unref (mask);
-#endif
}
return cursor;
@@ -1835,16 +1641,9 @@ grab_color_at_mouse (GdkScreen *screen,
priv = colorsel->private_data;
-#if GTK_CHECK_VERSION (3, 0, 0)
pixbuf = gdk_pixbuf_get_from_window (root_window,
x_root, y_root,
1, 1);
-#else
- pixbuf = gdk_pixbuf_get_from_drawable (NULL, root_window, NULL,
- x_root, y_root,
- 0, 0,
- 1, 1);
-#endif
if (!pixbuf)
{
gint x, y;
@@ -1852,16 +1651,9 @@ grab_color_at_mouse (GdkScreen *screen,
GdkWindow *window = gdk_display_get_window_at_pointer (display, &x, &y);
if (!window)
return;
-#if GTK_CHECK_VERSION (3, 0, 0)
pixbuf = gdk_pixbuf_get_from_window (window,
x, y,
1, 1);
-#else
- pixbuf = gdk_pixbuf_get_from_drawable (NULL, window, NULL,
- x, y,
- 0, 0,
- 1, 1);
-#endif
if (!pixbuf)
return;
}
@@ -2086,11 +1878,7 @@ get_screen_color (GtkWidget *button)
NULL,
picker_cursor,
time);
-#if GTK_CHECK_VERSION (3, 0, 0)
g_object_unref (picker_cursor);
-#else
- gdk_cursor_unref (picker_cursor);
-#endif
if (grab_status != GDK_GRAB_SUCCESS)
{
diff --git a/libmate-desktop/mate-colorseldialog.c b/libmate-desktop/mate-colorseldialog.c
index 5b87c0f..bfde10d 100644
--- a/libmate-desktop/mate-colorseldialog.c
+++ b/libmate-desktop/mate-colorseldialog.c
@@ -158,14 +158,6 @@ mate_color_selection_dialog_init (MateColorSelectionDialog *colorseldiag)
gtk_widget_hide (colorseldiag->help_button);
-#if !GTK_CHECK_VERSION(3,0,0)
- gtk_dialog_set_alternative_button_order (GTK_DIALOG (colorseldiag),
- GTK_RESPONSE_OK,
- GTK_RESPONSE_CANCEL,
- GTK_RESPONSE_HELP,
- -1);
-#endif
-
gtk_window_set_title (GTK_WINDOW (colorseldiag),
_("Color Selection"));
diff --git a/libmate-desktop/mate-desktop-2.0-uninstalled.pc.in b/libmate-desktop/mate-desktop-2.0-uninstalled.pc.in
index 2e696ed..a915ed8 100644
--- a/libmate-desktop/mate-desktop-2.0-uninstalled.pc.in
+++ b/libmate-desktop/mate-desktop-2.0-uninstalled.pc.in
@@ -5,7 +5,7 @@ includedir=@includedir@
Name: mate-desktop-2.0
Description: Utility library for loading .desktop files
-Requires: gtk+-@GTK_API_VERSION@ @STARTUP_NOTIFICATION_PACKAGE@
+Requires: gtk+-3.0 @STARTUP_NOTIFICATION_PACKAGE@
Version: @VERSION@
Libs: ${pc_top_builddir}/${pcfiledir}/libmate-desktop-2.la
Cflags: -I${pc_top_builddir}/${pcfiledir}
diff --git a/libmate-desktop/mate-desktop-2.0.pc.in b/libmate-desktop/mate-desktop-2.0.pc.in
index 366df09..b44182d 100644
--- a/libmate-desktop/mate-desktop-2.0.pc.in
+++ b/libmate-desktop/mate-desktop-2.0.pc.in
@@ -5,7 +5,7 @@ includedir=@includedir@
Name: mate-desktop-2.0
Description: Utility library for loading .desktop files
-Requires: gtk+-@GTK_API_VERSION@ @STARTUP_NOTIFICATION_PACKAGE@
+Requires: gtk+-3.0 @STARTUP_NOTIFICATION_PACKAGE@
Requires.private: dconf
Version: @VERSION@
Libs: -L${libdir} -lmate-desktop-2
diff --git a/libmate-desktop/mate-desktop-item.c b/libmate-desktop/mate-desktop-item.c
index 9ad34ee..00fe5a9 100644
--- a/libmate-desktop/mate-desktop-item.c
+++ b/libmate-desktop/mate-desktop-item.c
@@ -1480,11 +1480,7 @@ static void
sn_error_trap_pop (SnDisplay *display,
Display *xdisplay)
{
-#if GTK_CHECK_VERSION(3,0,0)
gdk_error_trap_pop_ignored ();
-#else
- gdk_error_trap_pop ();
-#endif
}
static char **
@@ -2524,11 +2520,7 @@ mate_desktop_item_find_icon (GtkIconTheme *icon_theme,
full = NULL;
if (info) {
full = g_strdup (gtk_icon_info_get_filename (info));
-#if GTK_CHECK_VERSION (3, 8, 0)
g_object_unref (info);
-#else
- gtk_icon_info_free (info);
-#endif
}
g_free (icon_no_extension);
}
diff --git a/libmate-desktop/mate-desktop-utils.c b/libmate-desktop/mate-desktop-utils.c
index 99eef35..b86253e 100644
--- a/libmate-desktop/mate-desktop-utils.c
+++ b/libmate-desktop/mate-desktop-utils.c
@@ -36,7 +36,6 @@
#include "private.h"
-#if GTK_CHECK_VERSION (3, 0, 0)
static void
gtk_style_shade (GdkRGBA *a,
GdkRGBA *b,
@@ -51,7 +50,6 @@ static void
hls_to_rgb (gdouble *h,
gdouble *l,
gdouble *s);
-#endif
/**
* mate_desktop_prepend_terminal_to_vector:
@@ -208,13 +206,7 @@ mate_gdk_spawn_command_line_on_screen (GdkScreen *screen, const gchar *command,
appinfo = g_app_info_create_from_commandline (command, NULL, G_APP_INFO_CREATE_NONE, error);
if (appinfo) {
-#if GTK_CHECK_VERSION (3, 0, 0)
context = gdk_display_get_app_launch_context (gdk_screen_get_display (screen));
-#else
- /* Deprecated in GDK 3.0 */
- context = gdk_app_launch_context_new ();
- gdk_app_launch_context_set_screen (context, screen);
-#endif
res = g_app_info_launch (appinfo, NULL, G_APP_LAUNCH_CONTEXT (context), error);
g_object_unref (context);
g_object_unref (appinfo);
@@ -236,9 +228,6 @@ _mate_desktop_init_i18n (void) {
}
}
-
-#if GTK_CHECK_VERSION (3, 0, 0)
-
/**
* gtk_style_shade:
* @a: the starting colour
@@ -469,4 +458,3 @@ mate_desktop_gtk_style_get_dark_color (GtkStyleContext *style,
gtk_style_context_get_background_color (style, state, color);
gtk_style_shade (color, color, DARKNESS_MULT);
}
-#endif
diff --git a/libmate-desktop/mate-desktop-utils.h b/libmate-desktop/mate-desktop-utils.h
index 4d87aa5..4c8082d 100644
--- a/libmate-desktop/mate-desktop-utils.h
+++ b/libmate-desktop/mate-desktop-utils.h
@@ -43,7 +43,6 @@ void mate_desktop_prepend_terminal_to_vector (int *argc, char ***argv);
/* replace gdk_spawn_command_line_on_screen, not available in GTK3 */
gboolean mate_gdk_spawn_command_line_on_screen (GdkScreen *screen, const gchar *command, GError **error);
-#if GTK_CHECK_VERSION (3, 0, 0)
void
mate_desktop_gtk_style_get_light_color (GtkStyleContext *style,
GtkStateFlags state,
@@ -53,7 +52,6 @@ void
mate_desktop_gtk_style_get_dark_color (GtkStyleContext *style,
GtkStateFlags state,
GdkRGBA *color);
-#endif
G_END_DECLS
diff --git a/libmate-desktop/mate-rr-labeler.c b/libmate-desktop/mate-rr-labeler.c
index 161be2f..de65423 100644
--- a/libmate-desktop/mate-rr-labeler.c
+++ b/libmate-desktop/mate-rr-labeler.c
@@ -44,11 +44,7 @@ struct _MateRRLabelerPrivate {
int num_outputs;
-#if GTK_CHECK_VERSION (3, 0, 0)
GdkRGBA *palette;
-#else
- GdkColor *palette;
-#endif
GtkWidget **windows;
GdkScreen *screen;
@@ -302,11 +298,7 @@ make_palette (MateRRLabeler *labeler)
g_assert (labeler->priv->num_outputs > 0);
-#if GTK_CHECK_VERSION (3, 0, 0)
labeler->priv->palette = g_new (GdkRGBA, labeler->priv->num_outputs);
-#else
- labeler->priv->palette = g_new (GdkColor, labeler->priv->num_outputs);
-#endif
start_hue = 0.0; /* red */
end_hue = 2.0/3; /* blue */
@@ -321,16 +313,10 @@ make_palette (MateRRLabeler *labeler)
gtk_hsv_to_rgb (h, s, v, &r, &g, &b);
-#if GTK_CHECK_VERSION (3, 0, 0)
labeler->priv->palette[i].red = r;
labeler->priv->palette[i].green = g;
labeler->priv->palette[i].blue = b;
labeler->priv->palette[i].alpha = 1.0;
-#else
- labeler->priv->palette[i].red = (int) (65535 * r + 0.5);
- labeler->priv->palette[i].green = (int) (65535 * g + 0.5);
- labeler->priv->palette[i].blue = (int) (65535 * b + 0.5);
-#endif
}
}
@@ -338,26 +324,14 @@ make_palette (MateRRLabeler *labeler)
#define LABEL_WINDOW_PADDING 12
static gboolean
-#if GTK_CHECK_VERSION (3, 0, 0)
label_window_draw_event_cb (GtkWidget *widget, cairo_t *cr, gpointer data)
-#else
-label_window_expose_event_cb (GtkWidget *widget, GdkEventExpose *event, gpointer data)
-#endif
{
-#if GTK_CHECK_VERSION (3, 0, 0)
GdkRGBA *color;
-#else
- GdkColor *color;
-#endif
GtkAllocation allocation;
color = g_object_get_data (G_OBJECT (widget), "color");
gtk_widget_get_allocation (widget, &allocation);
-#if !GTK_CHECK_VERSION (3, 0, 0)
- cairo_t *cr = gdk_cairo_create (gtk_widget_get_window (widget));
-#endif
-
/* edge outline */
cairo_set_source_rgb (cr, 0, 0, 0);
@@ -370,11 +344,7 @@ label_window_expose_event_cb (GtkWidget *widget, GdkEventExpose *event, gpointer
cairo_stroke (cr);
/* fill */
-#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,
LABEL_WINDOW_EDGE_THICKNESS,
LABEL_WINDOW_EDGE_THICKNESS,
@@ -382,10 +352,6 @@ label_window_expose_event_cb (GtkWidget *widget, GdkEventExpose *event, gpointer
allocation.height - LABEL_WINDOW_EDGE_THICKNESS * 2);
cairo_fill (cr);
-#if !GTK_CHECK_VERSION (3, 0, 0)
- cairo_destroy (cr);
-#endif
-
return FALSE;
}
@@ -409,13 +375,8 @@ position_window (MateRRLabeler *labeler,
gtk_window_move (GTK_WINDOW (window), workarea.x, workarea.y);
}
-#if GTK_CHECK_VERSION (3, 0, 0)
static GtkWidget *
create_label_window (MateRRLabeler *labeler, MateRROutputInfo *output, GdkRGBA *color)
-#else
-static GtkWidget *
-create_label_window (MateRRLabeler *labeler, MateRROutputInfo *output, GdkColor *color)
-#endif
{
GtkWidget *window;
GtkWidget *widget;
@@ -435,13 +396,8 @@ create_label_window (MateRRLabeler *labeler, MateRROutputInfo *output, GdkColor
*/
g_object_set_data (G_OBJECT (window), "color", color);
-#if GTK_CHECK_VERSION (3, 0, 0)
g_signal_connect (window, "draw",
G_CALLBACK (label_window_draw_event_cb), labeler);
-#else
- g_signal_connect (window, "expose-event",
- G_CALLBACK (label_window_expose_event_cb), labeler);
-#endif
if (mate_rr_config_get_clone (labeler->priv->config)) {
/* Keep this string in sync with mate-control-center/capplets/display/xrandr-capplet.c:get_display_name() */
@@ -467,11 +423,7 @@ create_label_window (MateRRLabeler *labeler, MateRROutputInfo *output, GdkColor
* theme's colors, since the label is always shown against a light
* pastel background. See bgo#556050
*/
-#if GTK_CHECK_VERSION(3,0,0)
gtk_widget_modify_fg (widget, gtk_widget_get_state_flags (widget), &black);
-#else
- gtk_widget_modify_fg (widget, gtk_widget_get_state (widget), &black);
-#endif
gtk_container_add (GTK_CONTAINER (window), widget);
@@ -565,7 +517,6 @@ mate_rr_labeler_hide (MateRRLabeler *labeler)
priv->windows = NULL;
}
-#if GTK_CHECK_VERSION (3, 0, 0)
/**
* mate_rr_labeler_get_rgba_for_output:
* @labeler: A #MateRRLabeler
@@ -599,43 +550,3 @@ mate_rr_labeler_get_rgba_for_output (MateRRLabeler *labeler, MateRROutputInfo *o
color_out->blue = 1.0;
color_out->alpha = 1.0;
}
-#endif
-
-/**
- * mate_rr_labeler_get_color_for_output:
- * @labeler: A #MateRRLabeler
- * @output: Output device (i.e. monitor) to query
- * @color_out: (out): Color of selected monitor.
- *
- * Get the color used for the label on a given output (monitor).
- */
-void
-mate_rr_labeler_get_color_for_output (MateRRLabeler *labeler, MateRROutputInfo *output, GdkColor *color_out)
-{
- int i;
- MateRROutputInfo **outputs;
-
- g_return_if_fail (MATE_IS_RR_LABELER (labeler));
- g_return_if_fail (MATE_IS_RR_OUTPUT_INFO (output));
- g_return_if_fail (color_out != NULL);
-
- outputs = mate_rr_config_get_outputs (labeler->priv->config);
-
- for (i = 0; i < labeler->priv->num_outputs; i++)
- if (outputs[i] == output) {
-#if GTK_CHECK_VERSION (3, 0, 0)
- color_out->red = labeler->priv->palette[i].red * 0xffff;
- color_out->green = labeler->priv->palette[i].green * 0xffff;
- color_out->blue = labeler->priv->palette[i].blue * 0xffff;
-#else
- *color_out = labeler->priv->palette[i];
-#endif
- return;
- }
-
- g_warning ("trying to get the color for unknown MateOutputInfo %p; returning magenta!", output);
-
- color_out->red = 0xffff;
- color_out->green = 0;
- color_out->blue = 0xffff;
-}
diff --git a/libmate-desktop/mate-rr-labeler.h b/libmate-desktop/mate-rr-labeler.h
index f5e98f7..bdeba2e 100644
--- a/libmate-desktop/mate-rr-labeler.h
+++ b/libmate-desktop/mate-rr-labeler.h
@@ -60,9 +60,6 @@ MateRRLabeler *mate_rr_labeler_new (MateRRConfig *config);
void mate_rr_labeler_hide (MateRRLabeler *labeler);
-#ifdef GDK_VERSION_3_0
void mate_rr_labeler_get_rgba_for_output (MateRRLabeler *labeler, MateRROutputInfo *output, GdkRGBA *color_out);
-#endif
-void mate_rr_labeler_get_color_for_output (MateRRLabeler *labeler, MateRROutputInfo *output, GdkColor *color_out);
#endif
diff --git a/libmate-desktop/mate-rr.c b/libmate-desktop/mate-rr.c
index e7147bc..079ce2c 100644
--- a/libmate-desktop/mate-rr.c
+++ b/libmate-desktop/mate-rr.c
@@ -499,12 +499,7 @@ fill_out_screen_info (Display *xdisplay,
info->primary = None;
gdk_error_trap_push ();
info->primary = XRRGetOutputPrimary (xdisplay, xroot);
-#if GTK_CHECK_VERSION (3, 0, 0)
gdk_error_trap_pop_ignored ();
-#else
- gdk_flush ();
- gdk_error_trap_pop (); /* ignore error */
-#endif
return TRUE;
#else
@@ -851,12 +846,7 @@ mate_rr_screen_set_size (MateRRScreen *screen,
gdk_error_trap_push ();
XRRSetScreenSize (screen->priv->xdisplay, screen->priv->xroot,
width, height, mm_width, mm_height);
- #if GTK_CHECK_VERSION (3, 0, 0)
gdk_error_trap_pop_ignored ();
- #else
- gdk_flush ();
- gdk_error_trap_pop (); /* ignore error */
- #endif
#endif
}