summaryrefslogtreecommitdiff
path: root/eel/eel-canvas-rect-ellipse.c
diff options
context:
space:
mode:
authorlukefromdc <[email protected]>2016-11-22 15:02:51 -0500
committerlukefromdc <[email protected]>2016-11-22 15:02:51 -0500
commit276eb145ce96d5f75f8d3901daf6310f60ddbb81 (patch)
tree544f41e76c9a91973867065696fc2e414ca60170 /eel/eel-canvas-rect-ellipse.c
parent969e4d021fe49654fe6e5ee7e88c920fec126505 (diff)
downloadcaja-276eb145ce96d5f75f8d3901daf6310f60ddbb81.tar.bz2
caja-276eb145ce96d5f75f8d3901daf6310f60ddbb81.tar.xz
move to GTK+3 (>= 3.14), drop libunique, GTK+2 code, and --with-gtk build option
*Remove GTK_VERSION_CHECK (3, 0, 0) and libunique selectors *Remove GTK2 and libunique specific code. *Leaves selector for specific GTK3 versions. *Remove #DEFINES for vbox/hbox previously required for GTK2 compatability *Keep vbox in caja-spatial-window.c, it is necessary for the desktop to work *spatial-window vbox issue at https://github.com/mate-desktop/caja/issues/591
Diffstat (limited to 'eel/eel-canvas-rect-ellipse.c')
-rw-r--r--eel/eel-canvas-rect-ellipse.c216
1 files changed, 4 insertions, 212 deletions
diff --git a/eel/eel-canvas-rect-ellipse.c b/eel/eel-canvas-rect-ellipse.c
index b1300679..40237cf5 100644
--- a/eel/eel-canvas-rect-ellipse.c
+++ b/eel/eel-canvas-rect-ellipse.c
@@ -53,15 +53,7 @@ enum
PROP_Y1,
PROP_X2,
PROP_Y2,
-#if !GTK_CHECK_VERSION(3,0,0)
- PROP_FILL_COLOR,
- PROP_FILL_COLOR_GDK,
-#endif
PROP_FILL_COLOR_RGBA,
-#if !GTK_CHECK_VERSION(3,0,0)
- PROP_OUTLINE_COLOR,
- PROP_OUTLINE_COLOR_GDK,
-#endif
PROP_OUTLINE_COLOR_RGBA,
PROP_OUTLINE_STIPPLING,
PROP_WIDTH_PIXELS,
@@ -170,52 +162,18 @@ eel_canvas_re_class_init (EelCanvasREClass *klass)
G_PARAM_READWRITE));
g_object_class_install_property
(gobject_class,
-#if GTK_CHECK_VERSION(3,0,0)
PROP_FILL_COLOR_RGBA,
g_param_spec_boxed ("fill-color-rgba", NULL, NULL,
GDK_TYPE_RGBA,
-#else
- PROP_FILL_COLOR,
- g_param_spec_string ("fill-color", NULL, NULL,
- NULL,
- G_PARAM_READWRITE));
- g_object_class_install_property
- (gobject_class,
- PROP_FILL_COLOR_GDK,
- g_param_spec_boxed ("fill-color-gdk", NULL, NULL,
- GDK_TYPE_COLOR,
- G_PARAM_READWRITE));
- g_object_class_install_property
- (gobject_class,
- PROP_FILL_COLOR_RGBA,
- g_param_spec_uint ("fill-color-rgba", NULL, NULL,
- 0, G_MAXUINT, 0,
- G_PARAM_READWRITE));
- g_object_class_install_property
- (gobject_class,
- PROP_OUTLINE_COLOR,
- g_param_spec_string ("outline-color", NULL, NULL,
- NULL,
- G_PARAM_READWRITE));
- g_object_class_install_property
- (gobject_class,
- PROP_OUTLINE_COLOR_GDK,
- g_param_spec_boxed ("outline-color-gdk", NULL, NULL,
- GDK_TYPE_COLOR,
-#endif
+
G_PARAM_READWRITE));
g_object_class_install_property
(gobject_class,
PROP_OUTLINE_COLOR_RGBA,
-#if GTK_CHECK_VERSION(3,0,0)
g_param_spec_boxed ("outline-color-rgba", NULL, NULL,
GDK_TYPE_RGBA,
G_PARAM_READWRITE));
-#else
- g_param_spec_uint ("outline-color-rgba", NULL, NULL,
- 0, G_MAXUINT, 0,
- G_PARAM_READWRITE));
-#endif
+
g_object_class_install_property
(gobject_class,
PROP_OUTLINE_STIPPLING,
@@ -317,10 +275,6 @@ eel_canvas_re_set_property (GObject *object,
{
EelCanvasItem *item;
EelCanvasRE *re;
-#if !GTK_CHECK_VERSION(3,0,0)
- GdkColor color = { 0, 0, 0, 0, };
- GdkColor *pcolor;
-#endif
g_return_if_fail (object != NULL);
g_return_if_fail (EEL_IS_CANVAS_RE (object));
@@ -354,7 +308,6 @@ eel_canvas_re_set_property (GObject *object,
eel_canvas_item_request_update (item);
break;
-#if GTK_CHECK_VERSION(3,0,0)
case PROP_FILL_COLOR_RGBA: {
GdkRGBA *color;
@@ -384,95 +337,6 @@ eel_canvas_re_set_property (GObject *object,
eel_canvas_item_request_redraw (item);
break;
}
-#else
- case PROP_FILL_COLOR:
- case PROP_FILL_COLOR_GDK:
- case PROP_FILL_COLOR_RGBA:
- switch (param_id)
- {
- case PROP_FILL_COLOR:
- if (g_value_get_string (value) &&
- gdk_color_parse (g_value_get_string (value), &color))
- eel_canvas_re_set_fill (re, TRUE);
- else
- eel_canvas_re_set_fill (re, FALSE);
-
- re->fill_color = ((color.red & 0xff00) << 16 |
- (color.green & 0xff00) << 8 |
- (color.blue & 0xff00) |
- 0xff);
- break;
-
- case PROP_FILL_COLOR_GDK:
- pcolor = g_value_get_boxed (value);
- eel_canvas_re_set_fill (re, pcolor != NULL);
-
- if (pcolor)
- {
- color = *pcolor;
- }
-
- re->fill_color = ((color.red & 0xff00) << 16 |
- (color.green & 0xff00) << 8 |
- (color.blue & 0xff00) |
- 0xff);
- break;
-
- case PROP_FILL_COLOR_RGBA:
- eel_canvas_re_set_fill (re, TRUE);
- re->fill_color = g_value_get_uint (value);
- break;
- }
-#ifdef VERBOSE
- g_print ("re fill color = %08x\n", re->fill_color);
-#endif
- eel_canvas_item_request_redraw (item);
- break;
-
- case PROP_OUTLINE_COLOR:
- case PROP_OUTLINE_COLOR_GDK:
- case PROP_OUTLINE_COLOR_RGBA:
- switch (param_id)
- {
- case PROP_OUTLINE_COLOR:
- if (g_value_get_string (value) &&
- gdk_color_parse (g_value_get_string (value), &color))
- eel_canvas_re_set_outline (re, TRUE);
- else
- eel_canvas_re_set_outline (re, FALSE);
-
- re->outline_color = ((color.red & 0xff00) << 16 |
- (color.green & 0xff00) << 8 |
- (color.blue & 0xff00) |
- 0xff);
- break;
-
- case PROP_OUTLINE_COLOR_GDK:
- pcolor = g_value_get_boxed (value);
- eel_canvas_re_set_outline (re, pcolor != NULL);
-
- if (pcolor)
- {
- color = *pcolor;
- }
-
- re->outline_color = ((color.red & 0xff00) << 16 |
- (color.green & 0xff00) << 8 |
- (color.blue & 0xff00) |
- 0xff);
- break;
-
- case PROP_OUTLINE_COLOR_RGBA:
- eel_canvas_re_set_outline (re, TRUE);
- re->outline_color = g_value_get_uint (value);
- break;
- }
-#ifdef VERBOSE
- g_print ("re outline color %x %x %x\n", color.red, color.green, color.blue);
-#endif
- eel_canvas_item_request_redraw (item);
- break;
-#endif
case PROP_OUTLINE_STIPPLING:
re->outline_stippling = g_value_get_boolean (value);
@@ -500,26 +364,6 @@ eel_canvas_re_set_property (GObject *object,
}
}
-#if !GTK_CHECK_VERSION(3,0,0)
-/* Allocates a GdkColor structure filled with the specified pixel, and puts it into the specified
- * value for returning it in the get_property method.
- */
-static void
-get_color_value (EelCanvasRE *re, gulong pixel, GValue *value)
-{
- GdkColor color;
-
- color.red = (pixel >> 16) & 0xFF;
- color.green = (pixel >> 8) & 0xFF;
- color.blue = pixel & 0xFF;
- color.red |= color.red << 8;
- color.green |= color.green << 8;
- color.blue |= color.blue << 8;
-
- g_value_set_boxed (value, &color);
-}
-#endif
-
static void
eel_canvas_re_get_property (GObject *object,
guint param_id,
@@ -551,29 +395,12 @@ eel_canvas_re_get_property (GObject *object,
g_value_set_double (value, re->y2);
break;
-#if GTK_CHECK_VERSION(3,0,0)
case PROP_FILL_COLOR_RGBA:
g_value_set_boxed (value, &re->fill_color);
break;
case PROP_OUTLINE_COLOR_RGBA:
g_value_set_boxed (value, &re->outline_color);
-#else
- case PROP_FILL_COLOR_GDK:
- get_color_value (re, re->fill_color, value);
- break;
-
- case PROP_OUTLINE_COLOR_GDK:
- get_color_value (re, re->outline_color, value);
- break;
-
- case PROP_FILL_COLOR_RGBA:
- g_value_set_uint (value, re->fill_color);
- break;
-
- case PROP_OUTLINE_COLOR_RGBA:
- g_value_set_uint (value, re->outline_color);
-#endif
break;
case PROP_OUTLINE_STIPPLING:
@@ -660,11 +487,8 @@ static void eel_canvas_rect_init (EelCanvasRect *rect);
static void eel_canvas_rect_finalize (GObject *object);
static void eel_canvas_rect_realize (EelCanvasItem *item);
-#if GTK_CHECK_VERSION(3,0,0)
static void eel_canvas_rect_draw (EelCanvasItem *item, cairo_t *cr, cairo_region_t *region);
-#else
-static void eel_canvas_rect_draw (EelCanvasItem *item, GdkDrawable *drawable, GdkEventExpose *expose);
-#endif
+
static double eel_canvas_rect_point (EelCanvasItem *item, double x, double y, int cx, int cy,
EelCanvasItem **actual_item);
@@ -780,29 +604,15 @@ eel_canvas_rect_realize (EelCanvasItem *item)
static void
eel_canvas_set_source_color (cairo_t *cr,
-#if GTK_CHECK_VERSION(3,0,0)
GdkRGBA *rgba)
{
gdk_cairo_set_source_rgba (cr, rgba);
-#else
- guint rgba)
-{
- cairo_set_source_rgba (cr,
- ((rgba >> 24) & 0xff) / 255.,
- ((rgba >> 16) & 0xff) / 255.,
- ((rgba >> 8) & 0xff) / 255.,
- ((rgba >> 0) & 0xff) / 255.);
-#endif
}
#define DASH_ON 0.8
#define DASH_OFF 1.7
static void
-#if GTK_CHECK_VERSION(3,0,0)
eel_canvas_rect_draw (EelCanvasItem *item, cairo_t *cr, cairo_region_t *region)
-#else
-eel_canvas_rect_draw (EelCanvasItem *item, GdkDrawable *drawable, GdkEventExpose *expose)
-#endif
{
EelCanvasRE *re;
double x1, y1, x2, y2;
@@ -828,21 +638,11 @@ eel_canvas_rect_draw (EelCanvasItem *item, GdkDrawable *drawable, GdkEventExpose
return;
}
-#if GTK_CHECK_VERSION(3,0,0)
cairo_save (cr);
-#else
- cairo_t *cr = gdk_cairo_create (drawable);
- gdk_cairo_region (cr, expose->region);
- cairo_clip (cr);
-#endif
if (re->fill_set)
{
-#if GTK_CHECK_VERSION(3,0,0)
eel_canvas_set_source_color (cr, &re->fill_color);
-#else
- eel_canvas_set_source_color (cr, re->fill_color);
-#endif
cairo_rectangle (cr,
cx1, cy1,
cx2 - cx1 + 1,
@@ -852,11 +652,8 @@ eel_canvas_rect_draw (EelCanvasItem *item, GdkDrawable *drawable, GdkEventExpose
if (re->outline_set)
{
-#if GTK_CHECK_VERSION(3,0,0)
eel_canvas_set_source_color (cr, &re->outline_color);
-#else
- eel_canvas_set_source_color (cr, re->outline_color);
-#endif
+
if (re->width_pixels) {
cairo_set_line_width (cr, (int) re->width);
} else {
@@ -875,12 +672,7 @@ eel_canvas_rect_draw (EelCanvasItem *item, GdkDrawable *drawable, GdkEventExpose
cy2 - cy1);
cairo_stroke (cr);
}
-
-#if GTK_CHECK_VERSION(3,0,0)
cairo_restore (cr);
-#else
- cairo_destroy (cr);
-#endif
}
static double