summaryrefslogtreecommitdiff
path: root/libmate-desktop
diff options
context:
space:
mode:
Diffstat (limited to 'libmate-desktop')
-rw-r--r--libmate-desktop/mate-bg-crossfade.c10
-rw-r--r--libmate-desktop/mate-bg.c365
-rw-r--r--libmate-desktop/mate-bg.h48
-rw-r--r--libmate-desktop/mate-dconf.h2
-rw-r--r--libmate-desktop/mate-desktop-item.c4
-rw-r--r--libmate-desktop/mate-desktop-utils.c5
-rw-r--r--libmate-desktop/mate-rr-labeler.c70
-rw-r--r--libmate-desktop/mate-rr-labeler.h15
8 files changed, 20 insertions, 499 deletions
diff --git a/libmate-desktop/mate-bg-crossfade.c b/libmate-desktop/mate-bg-crossfade.c
index 716c782..3242004 100644
--- a/libmate-desktop/mate-bg-crossfade.c
+++ b/libmate-desktop/mate-bg-crossfade.c
@@ -277,19 +277,9 @@ tile_surface (cairo_surface_t *surface,
}
else
{
-#if GTK_CHECK_VERSION(3, 0, 0)
- GtkStyleContext *style_context;
- style_context = gtk_style_context_new();
- GdkRGBA color;
- gtk_style_context_get(style_context, GTK_STATE_FLAG_NORMAL,
- GTK_STYLE_PROPERTY_BACKGROUND_COLOR, &color,
- NULL);
- gdk_cairo_set_source_rgba(cr, &color);
-#else
GtkStyle *style;
style = gtk_widget_get_default_style ();
gdk_cairo_set_source_color(cr, &style->bg[GTK_STATE_NORMAL]);
-#endif
}
cairo_paint (cr);
diff --git a/libmate-desktop/mate-bg.c b/libmate-desktop/mate-bg.c
index 798b3b3..83efcd3 100644
--- a/libmate-desktop/mate-bg.c
+++ b/libmate-desktop/mate-bg.c
@@ -101,13 +101,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;
@@ -155,31 +150,17 @@ static GdkPixbuf *pixbuf_scale_to_fit (GdkPixbuf *src,
static GdkPixbuf *pixbuf_scale_to_min (GdkPixbuf *src,
int min_width,
int min_height);
-#if !GTK_CHECK_VERSION(3, 0, 0)
+
static void pixbuf_draw_gradient (GdkPixbuf *pixbuf,
gboolean horizontal,
GdkColor *c1,
GdkColor *c2,
GdkRectangle *rect);
-#endif
static void pixbuf_tile (GdkPixbuf *src,
-#if GTK_CHECK_VERSION (3, 0, 0)
- cairo_t *cr,
- int width,
- int height
-#else
- GdkPixbuf *dest
-#endif
- );
+ GdkPixbuf *dest);
static void pixbuf_blend (GdkPixbuf *src,
-#if GTK_CHECK_VERSION (3, 0, 0)
- cairo_t *cr,
- int dest_width,
- int dest_height,
-#else
GdkPixbuf *dest,
-#endif
int src_x,
int src_y,
int width,
@@ -225,20 +206,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)
-{
- /* If all else fails use black */
- if (!gdk_rgba_parse (colorp, string)) {
- colorp->red = 0.0;
- colorp->blue = 0.0;
- colorp->green = 0.0;
- colorp->alpha = 1.0;
- }
-}
-#else
static void
color_from_string (const char *string,
GdkColor *colorp)
@@ -251,15 +218,7 @@ color_from_string (const char *string,
gdk_color_parse (string, colorp);
}
-#endif
-#if GTK_CHECK_VERSION(3, 0, 0)
-static char *
-color_to_string (const GdkRGBA *color)
-{
- return gdk_rgba_to_string(color);
-}
-#else
static char *
color_to_string (const GdkColor *color)
{
@@ -268,7 +227,6 @@ color_to_string (const GdkColor *color)
color->green >> 8,
color->blue >> 8);
}
-#endif
static gboolean
do_changed (MateBG *bg)
@@ -402,11 +360,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));
@@ -466,11 +420,7 @@ mate_bg_load_from_gsettings (MateBG *bg,
/* Placement */
placement = g_settings_get_enum (settings, MATE_BG_KEY_PICTURE_PLACEMENT);
-#if GTK_CHECK_VERSION (3, 0, 0)
- mate_bg_set_rgba (bg, ctype, &c1, &c2);
-#else
mate_bg_set_color (bg, ctype, &c1, &c2);
-#endif
mate_bg_set_placement (bg, placement);
mate_bg_set_filename (bg, filename);
@@ -595,43 +545,6 @@ mate_bg_new (void)
return g_object_new (MATE_TYPE_BG, NULL);
}
-#if GTK_CHECK_VERSION (3, 0, 0)
-void
-mate_bg_set_rgba (MateBG *bg,
- MateBGColorType type,
- GdkRGBA *primary,
- GdkRGBA *secondary
- )
-{
- g_return_if_fail (bg != NULL);
- g_return_if_fail (primary != NULL);
-
- if (bg->color_type != type ||
- !gdk_rgba_equal (&bg->primary, primary) ||
- (secondary && !gdk_rgba_equal (&bg->secondary, secondary)))
- {
- bg->color_type = type;
- bg->primary = *primary;
- if (secondary) {
- bg->secondary = *secondary;
- }
-
- queue_changed (bg);
- }
-}
-
-static void
-color_to_rgba(const GdkColor* color, GdkRGBA* rgba)
-{
- g_assert (color != NULL);
- g_assert (rgba != NULL);
- rgba->red = color->red/65535.0;
- rgba->blue = color->blue/65535.0;
- rgba->green = color->green/65535.0;
- rgba->alpha = 1.0;
-}
-#endif
-
void
mate_bg_set_color (MateBG *bg,
MateBGColorType type,
@@ -641,39 +554,15 @@ mate_bg_set_color (MateBG *bg,
g_return_if_fail (bg != NULL);
g_return_if_fail (primary != NULL);
-#if GTK_CHECK_VERSION (3, 0, 0)
- GdkRGBA primary_rgba;
- GdkRGBA secondary_rgba;
-
- color_to_rgba(primary, &primary_rgba);
-
- if(secondary) {
- color_to_rgba(secondary, &secondary_rgba);
- }
-#endif
-
if (bg->color_type != type ||
-#if GTK_CHECK_VERSION (3, 0, 0)
- !gdk_rgba_equal (&bg->primary, &primary_rgba) ||
- (secondary && !gdk_rgba_equal (&bg->secondary, &secondary_rgba)))
-#else
!gdk_color_equal (&bg->primary, primary) ||
- (secondary && !gdk_color_equal (&bg->secondary, secondary)))
-#endif
- {
+ (secondary && !gdk_color_equal (&bg->secondary, secondary))) {
bg->color_type = type;
-#if GTK_CHECK_VERSION (3, 0, 0)
- bg->primary = primary_rgba;
- if (secondary) {
- bg->secondary = secondary_rgba;
- }
-#else
bg->primary = *primary;
if (secondary) {
bg->secondary = *secondary;
}
-#endif
queue_changed (bg);
}
@@ -700,12 +589,11 @@ mate_bg_get_placement (MateBG *bg)
return bg->placement;
}
-#if GTK_CHECK_VERSION (3, 0, 0)
void
-mate_bg_get_rgba (MateBG *bg,
+mate_bg_get_color (MateBG *bg,
MateBGColorType *type,
- GdkRGBA *primary,
- GdkRGBA *secondary)
+ GdkColor *primary,
+ GdkColor *secondary)
{
g_return_if_fail (bg != NULL);
@@ -718,31 +606,6 @@ mate_bg_get_rgba (MateBG *bg,
if (secondary)
*secondary = bg->secondary;
}
-#endif
-
-void
-mate_bg_get_color (MateBG *bg,
- MateBGColorType *type,
- GdkColor *primary,
- GdkColor *secondary)
-{
- g_return_if_fail (bg != NULL);
-
- if (type)
- *type = bg->color_type;
-
- if (primary) {
- primary->red = bg->primary.red * 0xffff;
- primary->green = bg->primary.green * 0xffff;
- primary->blue = bg->primary.blue * 0xffff;
- }
-
- if (secondary) {
- secondary->red = bg->secondary.red * 0xffff;
- secondary->green = bg->secondary.green * 0xffff;
- secondary->blue = bg->secondary.blue * 0xffff;
- }
-}
void
mate_bg_set_draw_background (MateBG *bg,
@@ -954,12 +817,12 @@ mate_bg_set_filename (MateBG *bg,
}
}
-#if !GTK_CHECK_VERSION(3, 0, 0)
static void
draw_color_area (MateBG *bg,
GdkPixbuf *dest,
GdkRectangle *rect)
{
+ guint32 pixel;
GdkRectangle extent;
extent.x = 0;
@@ -970,8 +833,7 @@ draw_color_area (MateBG *bg,
gdk_rectangle_intersect (rect, &extent, rect);
switch (bg->color_type) {
- case MATE_BG_COLOR_SOLID: {
- guint32 pixel;
+ case MATE_BG_COLOR_SOLID:
/* not really a big deal to ignore the area of interest */
pixel = ((bg->primary.red >> 8) << 24) |
((bg->primary.green >> 8) << 16) |
@@ -979,7 +841,6 @@ draw_color_area (MateBG *bg,
(0xff);
gdk_pixbuf_fill (dest, pixel);
- }
break;
case MATE_BG_COLOR_H_GRADIENT:
@@ -994,24 +855,12 @@ draw_color_area (MateBG *bg,
break;
}
}
-#endif
static void
draw_color (MateBG *bg,
-#if GTK_CHECK_VERSION(3, 0, 0)
- cairo_t *cr,
- gint width,
- gint height
-#else
- GdkPixbuf *dest
-#endif
- )
+ GdkPixbuf *dest,
+ GdkScreen *screen)
{
-#if GTK_CHECK_VERSION(3, 0, 0)
- gdk_cairo_set_source_rgba(cr, &(bg->primary));
- cairo_rectangle(cr, 0, 0, width, height);
- cairo_fill(cr);
-#else
GdkRectangle rect;
rect.x = 0;
@@ -1019,11 +868,8 @@ draw_color (MateBG *bg,
rect.width = gdk_pixbuf_get_width (dest);
rect.height = gdk_pixbuf_get_height (dest);
draw_color_area (bg, dest, &rect);
-#endif
}
-
-#if !GTK_CHECK_VERSION(3, 0, 0)
static void
draw_color_each_monitor (MateBG *bg,
GdkPixbuf *dest,
@@ -1039,7 +885,6 @@ draw_color_each_monitor (MateBG *bg,
draw_color_area (bg, dest, &rect);
}
}
-#endif
static GdkPixbuf *
pixbuf_clip_to_fit (GdkPixbuf *src,
@@ -1126,11 +971,7 @@ static void
draw_image_area (MateBG *bg,
gint num_monitor,
GdkPixbuf *pixbuf,
-#if GTK_CHECK_VERSION (3, 0, 0)
- cairo_t *cr,
-#else
GdkPixbuf *dest,
-#endif
GdkRectangle *area)
{
int dest_width = area->width;
@@ -1145,28 +986,16 @@ draw_image_area (MateBG *bg,
switch (bg->placement) {
case MATE_BG_PLACEMENT_TILED:
-#if GTK_CHECK_VERSION (3, 0, 0)
- pixbuf_tile (scaled, cr, dest_width, dest_height);
-#else
pixbuf_tile (scaled, dest);
-#endif
break;
case MATE_BG_PLACEMENT_ZOOMED:
case MATE_BG_PLACEMENT_CENTERED:
case MATE_BG_PLACEMENT_FILL_SCREEN:
case MATE_BG_PLACEMENT_SCALED:
-#if GTK_CHECK_VERSION (3, 0, 0)
- pixbuf_blend (scaled, cr, dest_width, dest_height, 0, 0, w, h, x + area->x, y + area->y, 1.0);
-#else
pixbuf_blend (scaled, dest, 0, 0, w, h, x + area->x, y + area->y, 1.0);
-#endif
break;
case MATE_BG_PLACEMENT_SPANNED:
-#if GTK_CHECK_VERSION (3, 0, 0)
- pixbuf_blend (scaled, cr, dest_width, dest_height, 0, 0, w, h, x, y, 1.0);
-#else
pixbuf_blend (scaled, dest, 0, 0, w, h, x, y, 1.0);
-#endif
break;
default:
g_assert_not_reached ();
@@ -1181,44 +1010,22 @@ draw_image_area (MateBG *bg,
static void
draw_image_for_thumb (MateBG *bg,
GdkPixbuf *pixbuf,
-#if GTK_CHECK_VERSION (3, 0, 0)
- cairo_t *cr,
- gint width,
- gint height
-#else
- GdkPixbuf *dest
-#endif
- )
+ GdkPixbuf *dest)
{
GdkRectangle rect;
rect.x = 0;
rect.y = 0;
-#if GTK_CHECK_VERSION (3, 0, 0)
- rect.width = width;
- rect.height = height;
-
-#else
rect.width = gdk_pixbuf_get_width (dest);
rect.height = gdk_pixbuf_get_height (dest);
-#endif
-#if GTK_CHECK_VERSION(3, 0, 0)
- draw_image_area (bg, -1, pixbuf, cr, &rect);
-#else
draw_image_area (bg, -1, pixbuf, dest, &rect);
-#endif
}
static void
draw_once (MateBG *bg,
-#if GTK_CHECK_VERSION (3, 0, 0)
- cairo_t *cr,
- gint width,
- gint height,
-#else
GdkPixbuf *dest,
-#endif
+ GdkScreen *screen,
gboolean is_root)
{
GdkRectangle rect;
@@ -1230,27 +1037,17 @@ draw_once (MateBG *bg,
rect.x = 0;
rect.y = 0;
-#if GTK_CHECK_VERSION (3, 0, 0)
- rect.width = width;
- rect.height = height;
-#else
rect.width = gdk_pixbuf_get_width (dest);
rect.height = gdk_pixbuf_get_height (dest);
-#endif
pixbuf = get_pixbuf_for_size (bg, monitor, rect.width, rect.height);
if (pixbuf) {
-#if GTK_CHECK_VERSION (3, 0, 0)
- draw_image_area (bg, monitor, pixbuf, cr, &rect);
-#else
draw_image_area (bg, monitor, pixbuf, dest, &rect);
-#endif
g_object_unref (pixbuf);
}
}
-#if !GTK_CHECK_VERSION (3, 0, 0)
static void
draw_each_monitor (MateBG *bg,
GdkPixbuf *dest,
@@ -1273,48 +1070,25 @@ draw_each_monitor (MateBG *bg,
}
}
}
-#endif
void
mate_bg_draw (MateBG *bg,
-#if GTK_CHECK_VERSION(3, 0, 0)
- cairo_t *cr,
- gint width,
- gint height,
-#else
GdkPixbuf *dest,
GdkScreen *screen,
-#endif
gboolean is_root)
{
if (!bg)
return;
if (is_root && (bg->placement != MATE_BG_PLACEMENT_SPANNED)) {
-#if GTK_CHECK_VERSION(3, 0, 0)
- draw_color (bg, cr, width, height);
-#else
draw_color_each_monitor (bg, dest, screen);
-#endif
if (bg->filename) {
-#if GTK_CHECK_VERSION (3, 0, 0)
- draw_once (bg, cr, width, height, is_root);
-#else
draw_each_monitor (bg, dest, screen);
-#endif
}
} else {
-#if GTK_CHECK_VERSION(3, 0, 0)
- draw_color (bg, cr, width, height);
-#else
- draw_color (bg, dest);
-#endif
+ draw_color (bg, dest, screen);
if (bg->filename) {
-#if GTK_CHECK_VERSION (3, 0, 0)
- draw_once (bg, cr, width, height, is_root);
-#else
- draw_once (bg, dest, is_root);
-#endif
+ draw_once (bg, dest, screen, is_root);
}
}
}
@@ -1431,17 +1205,10 @@ mate_bg_create_pixmap (MateBG *bg,
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
{
-#if GTK_CHECK_VERSION(3, 0, 0)
- gdk_cairo_set_source_window(cr, window, 0, 0);
-#else
GdkPixbuf *pixbuf;
pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, FALSE, 8,
@@ -1449,7 +1216,6 @@ mate_bg_create_pixmap (MateBG *bg,
mate_bg_draw (bg, pixbuf, gdk_window_get_screen (window), is_root);
gdk_cairo_set_source_pixbuf (cr, pixbuf, 0, 0);
g_object_unref (pixbuf);
-#endif
}
cairo_paint (cr);
@@ -1468,11 +1234,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;
@@ -1499,14 +1261,9 @@ mate_bg_is_dark (MateBG *bg,
g_object_unref (pixbuf);
}
-#if GTK_CHECK_VERSION(3, 0, 0)
- // todo
- intensity = 20;
-#else
intensity = (color.red * 77 +
color.green * 150 +
color.blue * 28) >> 16;
-#endif
return intensity < 160; /* biased slightly to be dark */
}
@@ -1637,54 +1394,31 @@ fit_factor (int from_width, int from_height,
return MIN (to_width / (double) from_width, to_height / (double) from_height);
}
-#if GTK_CHECK_VERSION (3, 0, 0)
-cairo_surface_t *
-#else
GdkPixbuf *
-#endif
mate_bg_create_thumbnail (MateBG *bg,
MateDesktopThumbnailFactory *factory,
GdkScreen *screen,
int dest_width,
int dest_height)
{
-#if GTK_CHECK_VERSION (3, 0, 0)
- cairo_surface_t *result;
-#else
GdkPixbuf *result;
-#endif
GdkPixbuf *thumb;
g_return_val_if_fail (bg != NULL, NULL);
-
-#if GTK_CHECK_VERSION (3, 0, 0)
- result = cairo_image_surface_create(CAIRO_FORMAT_RGB24, dest_width, dest_height);
- cairo_t *cr = cairo_create(result);
- draw_color (bg, cr, dest_width, dest_height);
-#else
result = gdk_pixbuf_new (GDK_COLORSPACE_RGB, FALSE, 8, dest_width, dest_height);
- draw_color (bg, result);
-#endif
+ draw_color (bg, result, screen);
if (bg->filename) {
thumb = create_img_thumbnail (bg, factory, screen, dest_width, dest_height, -1);
if (thumb) {
-#if GTK_CHECK_VERSION (3, 0, 0)
- draw_image_for_thumb (bg, thumb, cr, dest_width, dest_height);
-#else
draw_image_for_thumb (bg, thumb, result);
-#endif
g_object_unref (thumb);
}
}
-#if GTK_CHECK_VERSION (3, 0, 0)
- cairo_destroy(cr);
-#endif
-
return result;
}
@@ -2056,11 +1790,7 @@ blend (GdkPixbuf *p1,
GdkPixbuf *p2,
double alpha)
{
-#if GTK_CHECK_VERSION (3, 0, 0)
- cairo_surface_t *surface = gdk_cairo_surface_create_from_pixbuf(p1, 0, NULL);
-#else
GdkPixbuf *result = gdk_pixbuf_copy (p1);
-#endif
GdkPixbuf *tmp;
if (gdk_pixbuf_get_width (p2) != gdk_pixbuf_get_width (p1) ||
@@ -2074,18 +1804,7 @@ blend (GdkPixbuf *p1,
tmp = g_object_ref (p2);
}
-#if GTK_CHECK_VERSION (3, 0, 0)
- cairo_t *cr = cairo_create(surface);
- int width = gdk_pixbuf_get_width(p1);
- int height = gdk_pixbuf_get_height(p1);
- pixbuf_blend (tmp, cr, width, height, 0, 0, -1, -1, 0, 0, alpha);
- cairo_destroy (cr);
-
- GdkPixbuf *result = gdk_pixbuf_get_from_surface (surface, 0, 0, width, height);
- cairo_surface_destroy (surface);
-#else
pixbuf_blend (tmp, result, 0, 0, -1, -1, 0, 0, alpha);
-#endif
g_object_unref (tmp);
@@ -2890,7 +2609,6 @@ pixbuf_scale_to_min (GdkPixbuf *src, int min_width, int min_height)
return dest;
}
-#if !GTK_CHECK_VERSION(3, 0, 0)
static guchar *
create_gradient (const GdkColor *primary,
const GdkColor *secondary,
@@ -2921,12 +2639,14 @@ pixbuf_draw_gradient (GdkPixbuf *pixbuf,
int height;
int rowstride;
guchar *dst;
+ guchar *dst_limit;
int n_channels = 3;
rowstride = gdk_pixbuf_get_rowstride (pixbuf);
width = rect->width;
height = rect->height;
dst = gdk_pixbuf_get_pixels (pixbuf) + rect->x * n_channels + rowstride * rect->y;
+ dst_limit = dst + height * rowstride;
if (horizontal) {
guchar *gradient = create_gradient (primary, secondary, width);
@@ -2962,17 +2682,10 @@ pixbuf_draw_gradient (GdkPixbuf *pixbuf,
g_free (gradient);
}
}
-#endif
static void
pixbuf_blend (GdkPixbuf *src,
-#if GTK_CHECK_VERSION (3, 0, 0)
- cairo_t *cr,
- int dest_width,
- int dest_height,
-#else
GdkPixbuf *dest,
-#endif
int src_x,
int src_y,
int src_width,
@@ -2981,10 +2694,8 @@ pixbuf_blend (GdkPixbuf *src,
int dest_y,
double alpha)
{
-#if !GTK_CHECK_VERSION (3, 0, 0)
int dest_width = gdk_pixbuf_get_width (dest);
int dest_height = gdk_pixbuf_get_height (dest);
-#endif
int offset_x = dest_x - src_x;
int offset_y = dest_y - src_y;
@@ -3008,47 +2719,29 @@ pixbuf_blend (GdkPixbuf *src,
src_height = dest_height - dest_y;
}
-#if GTK_CHECK_VERSION (3, 0, 0)
- gdk_cairo_set_source_pixbuf(cr, src, offset_x, offset_y);
- cairo_rectangle (cr, offset_x, offset_y, src_width, src_height);
- cairo_paint_with_alpha (cr, alpha);
- cairo_fill (cr);
-#else
gdk_pixbuf_composite (src, dest,
dest_x, dest_y,
src_width, src_height,
offset_x, offset_y,
1, 1, GDK_INTERP_NEAREST,
alpha * 0xFF + 0.5);
-#endif
}
static void
-#if GTK_CHECK_VERSION (3, 0, 0)
-pixbuf_tile (GdkPixbuf *src, cairo_t *cr, int dest_width, int dest_height)
-#else
pixbuf_tile (GdkPixbuf *src, GdkPixbuf *dest)
-#endif
{
int x, y;
int tile_width, tile_height;
-#if !GTK_CHECK_VERSION (3, 0, 0)
int dest_width = gdk_pixbuf_get_width (dest);
int dest_height = gdk_pixbuf_get_height (dest);
-#endif
tile_width = gdk_pixbuf_get_width (src);
tile_height = gdk_pixbuf_get_height (src);
for (y = 0; y < dest_height; y += tile_height) {
for (x = 0; x < dest_width; x += tile_width) {
-#if GTK_CHECK_VERSION (3, 0, 0)
- pixbuf_blend (src, cr, dest_width, dest_height, 0, 0,
- tile_width, tile_height, x, y, 1.0);
-#else
pixbuf_blend (src, dest, 0, 0,
tile_width, tile_height, x, y, 1.0);
-#endif
}
}
}
@@ -3510,11 +3203,7 @@ mate_bg_changes_with_time (MateBG *bg)
* vaguely defined as 'suitable point to show while single-stepping
* through the slideshow'. Returns NULL if frame_num is out of bounds.
*/
-#if GTK_CHECK_VERSION (3, 0, 0)
-cairo_surface_t *
-#else
GdkPixbuf *
-#endif
mate_bg_create_frame_thumbnail (MateBG *bg,
MateDesktopThumbnailFactory *factory,
GdkScreen *screen,
@@ -3523,11 +3212,7 @@ mate_bg_create_frame_thumbnail (MateBG *bg,
int frame_num)
{
SlideShow *show;
-#if GTK_CHECK_VERSION (3, 0, 0)
- cairo_surface_t *result;
-#else
GdkPixbuf *result;
-#endif
GdkPixbuf *thumb;
GList *l;
int i, skipped;
@@ -3562,16 +3247,10 @@ mate_bg_create_frame_thumbnail (MateBG *bg,
if (!found)
return NULL;
-#if GTK_CHECK_VERSION (3, 0, 0)
- result = cairo_image_surface_create(CAIRO_FORMAT_RGB24, dest_width, dest_height);
- cairo_t *cr = cairo_create(result);
- draw_color(bg, cr, dest_width, dest_height);
-#else
result = gdk_pixbuf_new (GDK_COLORSPACE_RGB, FALSE, 8, dest_width, dest_height);
- draw_color (bg, result);
-#endif
+ draw_color (bg, result, screen);
if (bg->filename) {
thumb = create_img_thumbnail (bg, factory, screen,
@@ -3579,19 +3258,11 @@ mate_bg_create_frame_thumbnail (MateBG *bg,
frame_num + skipped);
if (thumb) {
-#if GTK_CHECK_VERSION (3, 0, 0)
- draw_image_for_thumb (bg, thumb, cr, dest_width, dest_height);
-#else
draw_image_for_thumb (bg, thumb, result);
-#endif
g_object_unref (thumb);
}
}
-#if GTK_CHECK_VERSION (3, 0, 0)
- cairo_destroy (cr);
-#endif
-
return result;
}
diff --git a/libmate-desktop/mate-bg.h b/libmate-desktop/mate-bg.h
index d8f8944..f69454d 100644
--- a/libmate-desktop/mate-bg.h
+++ b/libmate-desktop/mate-bg.h
@@ -40,15 +40,6 @@
extern "C" {
#endif
-
-#ifndef MATE_DEPRECATED_FOR
-#if GTK_CHECK_VERSION (3, 0, 0)
-#define MATE_DEPRECATED_FOR(func) G_DEPRECATED_FOR(func)
-#else
-#define MATE_DEPRECATED_FOR(func)
-#endif
-#endif
-
#define MATE_TYPE_BG (mate_bg_get_type ())
#define MATE_BG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MATE_TYPE_BG, MateBG))
#define MATE_BG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MATE_TYPE_BG, MateBGClass))
@@ -110,13 +101,6 @@ void mate_bg_set_filename (MateBG *bg,
const char *filename);
void mate_bg_set_placement (MateBG *bg,
MateBGPlacement placement);
-#if GTK_CHECK_VERSION (3, 0, 0)
-void mate_bg_set_rgba (MateBG *bg,
- MateBGColorType type,
- GdkRGBA *primary,
- GdkRGBA *secondary);
-#endif
-MATE_DEPRECATED_FOR(mate_bg_set_rgba)
void mate_bg_set_color (MateBG *bg,
MateBGColorType type,
GdkColor *primary,
@@ -126,15 +110,6 @@ void mate_bg_set_draw_background (MateBG *bg,
/* Getters */
gboolean mate_bg_get_draw_background (MateBG *bg);
MateBGPlacement mate_bg_get_placement (MateBG *bg);
-
-#if GTK_CHECK_VERSION (3, 0, 0)
-void mate_bg_get_rgba (MateBG *bg,
- MateBGColorType *type,
- GdkRGBA *primary,
- GdkRGBA *secondary);
-#endif
-
-MATE_DEPRECATED_FOR(mate_bg_get_rgba)
void mate_bg_get_color (MateBG *bg,
MateBGColorType *type,
GdkColor *primary,
@@ -143,14 +118,8 @@ const gchar * mate_bg_get_filename (MateBG *bg);
/* Drawing and thumbnailing */
void mate_bg_draw (MateBG *bg,
-#if GTK_CHECK_VERSION(3, 0, 0)
- cairo_t *cr,
- gint width,
- gint height,
-#else
GdkPixbuf *dest,
GdkScreen *screen,
-#endif
gboolean is_root);
#if GTK_CHECK_VERSION(3, 0, 0)
@@ -169,39 +138,22 @@ gboolean mate_bg_get_image_size (MateBG *bg,
int best_height,
int *width,
int *height);
-#if GTK_CHECK_VERSION (3, 0, 0)
-cairo_surface_t *mate_bg_create_thumbnail (MateBG *bg,
- MateDesktopThumbnailFactory *factory,
- GdkScreen *screen,
- int dest_width,
- int dest_height);
-#else
GdkPixbuf * mate_bg_create_thumbnail (MateBG *bg,
MateDesktopThumbnailFactory *factory,
GdkScreen *screen,
int dest_width,
int dest_height);
-#endif
gboolean mate_bg_is_dark (MateBG *bg,
int dest_width,
int dest_height);
gboolean mate_bg_has_multiple_sizes (MateBG *bg);
gboolean mate_bg_changes_with_time (MateBG *bg);
-#if GTK_CHECK_VERSION (3, 0, 0)
-cairo_surface_t *mate_bg_create_frame_thumbnail (MateBG *bg,
- MateDesktopThumbnailFactory *factory,
- GdkScreen *screen,
- int dest_width,
- int dest_height,
- int frame_num);
-#else
GdkPixbuf * mate_bg_create_frame_thumbnail (MateBG *bg,
MateDesktopThumbnailFactory *factory,
GdkScreen *screen,
int dest_width,
int dest_height,
int frame_num);
-#endif
/* Set a surface as root - not a MateBG method. At some point
* if we decide to stabilize the API then we may want to make
diff --git a/libmate-desktop/mate-dconf.h b/libmate-desktop/mate-dconf.h
index 5b31562..6bb7304 100644
--- a/libmate-desktop/mate-dconf.h
+++ b/libmate-desktop/mate-dconf.h
@@ -41,7 +41,7 @@ gboolean mate_dconf_recursive_reset (const gchar *dir,
gchar **mate_dconf_list_subdirs (const gchar *dir,
gboolean remove_trailing_slash);
-void mate_dconf_sync (void);
+void mate_dconf_sync ();
G_END_DECLS
diff --git a/libmate-desktop/mate-desktop-item.c b/libmate-desktop/mate-desktop-item.c
index 06f585a..eb004d9 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 **
diff --git a/libmate-desktop/mate-desktop-utils.c b/libmate-desktop/mate-desktop-utils.c
index cac00ee..985278f 100644
--- a/libmate-desktop/mate-desktop-utils.c
+++ b/libmate-desktop/mate-desktop-utils.c
@@ -195,12 +195,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)
- GdkDisplay *display = gdk_screen_get_display(screen);
- context = gdk_display_get_app_launch_context(display);
-#else
context = gdk_app_launch_context_new ();
-#endif
gdk_app_launch_context_set_screen (context, screen);
res = g_app_info_launch (appinfo, NULL, G_APP_LAUNCH_CONTEXT (context), error);
g_object_unref (context);
diff --git a/libmate-desktop/mate-rr-labeler.c b/libmate-desktop/mate-rr-labeler.c
index c490ed2..2b33526 100644
--- a/libmate-desktop/mate-rr-labeler.c
+++ b/libmate-desktop/mate-rr-labeler.c
@@ -45,11 +45,7 @@ struct _MateRRLabeler {
int num_outputs;
-#if GTK_CHECK_VERSION(3, 0, 0)
- GdkRGBA *palette;
-#else
GdkColor *palette;
-#endif
GtkWidget **windows;
GdkScreen *screen;
@@ -229,11 +225,7 @@ make_palette (MateRRLabeler *labeler)
g_assert (labeler->num_outputs > 0);
-#if GTK_CHECK_VERSION(3, 0, 0)
- labeler->palette = g_new (GdkRGBA, labeler->num_outputs);
-#else
labeler->palette = g_new (GdkColor, labeler->num_outputs);
-#endif
start_hue = 0.0; /* red */
end_hue = 2.0/3; /* blue */
@@ -248,16 +240,9 @@ make_palette (MateRRLabeler *labeler)
gtk_hsv_to_rgb (h, s, v, &r, &g, &b);
-#if GTK_CHECK_VERSION(3, 0, 0)
- labeler->palette[i].red = r;
- labeler->palette[i].green = g;
- labeler->palette[i].blue = b;
- labeler->palette[i].alpha = 1.0;
-#else
labeler->palette[i].red = (int) (65535 * r + 0.5);
labeler->palette[i].green = (int) (65535 * g + 0.5);
labeler->palette[i].blue = (int) (65535 * b + 0.5);
-#endif
}
}
@@ -271,11 +256,7 @@ label_window_draw_event_cb (GtkWidget *widget, cairo_t *cr, gpointer data)
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");
@@ -298,11 +279,7 @@ label_window_expose_event_cb (GtkWidget *widget, GdkEventExpose *event, gpointer
/* 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,
@@ -338,21 +315,13 @@ position_window (MateRRLabeler *labeler,
}
static GtkWidget *
-#if GTK_CHECK_VERSION(3, 0, 0)
-create_label_window (MateRRLabeler *labeler, MateOutputInfo *output, GdkRGBA *color)
-#else
create_label_window (MateRRLabeler *labeler, MateOutputInfo *output, GdkColor *color)
-#endif
{
GtkWidget *window;
GtkWidget *widget;
char *str;
const char *display_name;
-#if GTK_CHECK_VERSION (3, 0, 0)
- GdkRGBA black = { 0.0, 0.0, 0.0, 1.0 };
-#else
GdkColor black = { 0, 0, 0, 0 };
-#endif
window = gtk_window_new (GTK_WINDOW_POPUP);
gtk_widget_set_app_paintable (window, TRUE);
@@ -394,11 +363,7 @@ create_label_window (MateRRLabeler *labeler, MateOutputInfo *output, GdkColor *c
* 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_override_color( 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);
@@ -476,31 +441,6 @@ mate_rr_labeler_hide (MateRRLabeler *labeler)
}
-#if GTK_CHECK_VERSION (3, 0, 0)
-void
-mate_rr_labeler_get_rgba_for_output (MateRRLabeler *labeler, MateOutputInfo *output, GdkRGBA *color_out)
-{
- int i;
-
- g_return_if_fail (MATE_IS_RR_LABELER (labeler));
- g_return_if_fail (output != NULL);
- g_return_if_fail (color_out != NULL);
-
- for (i = 0; i < labeler->num_outputs; i++)
- if (labeler->config->outputs[i] == output) {
- *color_out = labeler->palette[i];
- return;
- }
-
- g_warning ("trying to get the color for unknown MateOutputInfo %p; returning magenta!", output);
-
- color_out->red = 1.0;
- color_out->green = 0;
- color_out->blue = 1.0;
- color_out->alpha = 1.0;
-}
-#endif
-
void
mate_rr_labeler_get_color_for_output (MateRRLabeler *labeler, MateOutputInfo *output, GdkColor *color_out)
{
@@ -512,15 +452,7 @@ mate_rr_labeler_get_color_for_output (MateRRLabeler *labeler, MateOutputInfo *ou
for (i = 0; i < labeler->num_outputs; i++)
if (labeler->config->outputs[i] == output) {
-#if GTK_CHECK_VERSION (3, 0, 0)
- color_out->red = labeler->palette[i].red * 0xffff;
- color_out->green = labeler->palette[i].green * 0xffff;
- color_out->blue = labeler->palette[i].blue * 0xffff;
-#else
- color_out->red = labeler->palette[i].red;
- color_out->green = labeler->palette[i].green;
- color_out->blue = labeler->palette[i].blue;
-#endif
+ *color_out = labeler->palette[i];
return;
}
diff --git a/libmate-desktop/mate-rr-labeler.h b/libmate-desktop/mate-rr-labeler.h
index d3688be..33ecb5f 100644
--- a/libmate-desktop/mate-rr-labeler.h
+++ b/libmate-desktop/mate-rr-labeler.h
@@ -32,8 +32,6 @@
#include "mate-rr-config.h"
-#include <gtk/gtk.h>
-
#define MATE_TYPE_RR_LABELER (mate_rr_labeler_get_type ())
#define MATE_RR_LABELER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MATE_TYPE_RR_LABELER, MateRRLabeler))
#define MATE_RR_LABELER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MATE_TYPE_RR_LABELER, MateRRLabelerClass))
@@ -41,14 +39,6 @@
#define MATE_IS_RR_LABELER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MATE_TYPE_RR_LABELER))
#define MATE_RR_LABELER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MATE_TYPE_RR_LABELER, MateRRLabelerClass))
-#ifndef MATE_DEPRECATED_FOR
-#if GTK_CHECK_VERSION (3, 0, 0)
-#define MATE_DEPRECATED_FOR(func) G_DEPRECATED_FOR(func)
-#else
-#define MATE_DEPRECATED_FOR(func)
-#endif
-#endif
-
typedef struct _MateRRLabeler MateRRLabeler;
typedef struct _MateRRLabelerClass MateRRLabelerClass;
@@ -58,11 +48,6 @@ MateRRLabeler *mate_rr_labeler_new (MateRRConfig *config);
void mate_rr_labeler_hide (MateRRLabeler *labeler);
-#if GTK_CHECK_VERSION (3, 0, 0)
-void mate_rr_labeler_get_rgba_for_output (MateRRLabeler *labeler, MateOutputInfo *output, GdkRGBA *color_out);
-#endif
-
-MATE_DEPRECATED_FOR(mate_rr_labeler_get_rgba_for_output)
void mate_rr_labeler_get_color_for_output (MateRRLabeler *labeler, MateOutputInfo *output, GdkColor *color_out);
#endif