summaryrefslogtreecommitdiff
path: root/eel
diff options
context:
space:
mode:
authormonsta <[email protected]>2018-01-29 17:28:30 +0300
committerraveit65 <[email protected]>2018-01-31 11:47:27 +0100
commit26a21fa2cb70a13b7e96ae43d4de825ad7663dc9 (patch)
treed61f2df112ee55e68de510d5c95b2531ba1fa922 /eel
parent0045e373ee71efb8ae9979adc4ef88d5dc90b2ea (diff)
downloadcaja-26a21fa2cb70a13b7e96ae43d4de825ad7663dc9.tar.bz2
caja-26a21fa2cb70a13b7e96ae43d4de825ad7663dc9.tar.xz
require GTK+ 3.22 and GLib 2.50
Diffstat (limited to 'eel')
-rw-r--r--eel/eel-background.c47
-rw-r--r--eel/eel-canvas.c100
-rw-r--r--eel/eel-canvas.h19
-rw-r--r--eel/eel-editable-label.c9
-rw-r--r--eel/eel-gtk-extensions.c4
-rw-r--r--eel/eel-labeled-image.c11
-rw-r--r--eel/eel-wrap-table.c2
7 files changed, 3 insertions, 189 deletions
diff --git a/eel/eel-background.c b/eel/eel-background.c
index 8de791ec..e9b4b2cf 100644
--- a/eel/eel-background.c
+++ b/eel/eel-background.c
@@ -80,9 +80,7 @@ struct EelBackgroundDetails
gboolean is_active;
};
-#if GTK_CHECK_VERSION (3, 22, 0)
static GList *desktop_bg_objects = NULL;
-#endif
static void
free_fade (EelBackground *self)
@@ -131,14 +129,12 @@ eel_background_finalize (GObject *object)
free_background_surface (self);
free_fade (self);
-#if GTK_CHECK_VERSION (3, 22, 0)
if (self->details->is_desktop)
{
desktop_bg_objects = g_list_remove (desktop_bg_objects,
G_OBJECT (self));
}
-#endif
G_OBJECT_CLASS (eel_background_parent_class)->finalize (object);
}
@@ -496,22 +492,8 @@ fade_to_surface (EelBackground *self,
if (!mate_bg_crossfade_is_started (self->details->fade))
{
-#if GTK_CHECK_VERSION (3, 22, 0)
mate_bg_crossfade_start_widget (self->details->fade, widget);
-#else
- GdkWindow *window;
-
- if (EEL_IS_CANVAS (widget))
- {
- window = gtk_layout_get_bin_window (GTK_LAYOUT (widget));
- }
- else
- {
- window = gtk_widget_get_window (widget);
- }
- mate_bg_crossfade_start (self->details->fade, window);
-#endif
if (self->details->is_desktop)
{
g_signal_connect (self->details->fade,
@@ -558,22 +540,6 @@ eel_background_set_up_widget (EelBackground *self)
if (self->details->is_desktop)
{
-#if !GTK_CHECK_VERSION (3, 22, 0)
- if (self->details->bg_surface != NULL)
- {
- cairo_pattern_t *pattern =
- cairo_pattern_create_for_surface (self->details->bg_surface);
- gdk_window_set_background_pattern (window, pattern);
- cairo_pattern_destroy (pattern);
- }
- else
- {
- GdkRGBA color = self->details->default_color;
- make_color_inactive (self, &color);
- gdk_window_set_background_rgba (window, &color);
- }
- gdk_window_invalidate_rect (window, NULL, TRUE);
-#endif
set_root_surface (self, window, gtk_widget_get_screen (widget));
}
}
@@ -748,9 +714,7 @@ eel_get_widget_background (GtkWidget *widget)
{
EelBackground *self;
gpointer data;
-#if GTK_CHECK_VERSION (3, 22, 0)
GList *l;
-#endif
g_return_val_if_fail (GTK_IS_WIDGET (widget), NULL);
@@ -761,7 +725,7 @@ eel_get_widget_background (GtkWidget *widget)
g_assert (EEL_IS_BACKGROUND (data));
return data;
}
-#if GTK_CHECK_VERSION (3, 22, 0)
+
/* Check for an existing desktop window background. */
for (l = desktop_bg_objects; l != NULL; l = l->next)
{
@@ -772,7 +736,6 @@ eel_get_widget_background (GtkWidget *widget)
return self;
}
}
-#endif
self = eel_background_new ();
self->details->widget = widget;
@@ -887,14 +850,12 @@ eel_background_set_desktop (EelBackground *self,
if (is_desktop)
{
-#if GTK_CHECK_VERSION (3, 22, 0)
self->details->widget =
gtk_widget_get_toplevel (self->details->front_widget);
desktop_bg_objects = g_list_prepend (desktop_bg_objects,
G_OBJECT (self));
-#endif
if (gtk_widget_get_realized (self->details->widget))
{
widget_realized_setup (self->details->widget, self);
@@ -902,11 +863,9 @@ eel_background_set_desktop (EelBackground *self,
}
else
{
-#if GTK_CHECK_VERSION (3, 22, 0)
desktop_bg_objects = g_list_remove (desktop_bg_objects,
G_OBJECT (self));
self->details->widget = self->details->front_widget;
-#endif
}
}
@@ -937,12 +896,8 @@ eel_background_is_dark (EelBackground *self)
/* only check for the background on the 0th monitor */
GdkScreen *screen = gdk_screen_get_default ();
-#if GTK_CHECK_VERSION (3, 22, 0)
GdkDisplay *display = gdk_screen_get_display (screen);
gdk_monitor_get_geometry (gdk_display_get_monitor (display, 0), &rect);
-#else
- gdk_screen_get_monitor_geometry (screen, 0, &rect);
-#endif
return mate_bg_is_dark (self->details->bg, rect.width, rect.height);
}
diff --git a/eel/eel-canvas.c b/eel/eel-canvas.c
index 6e01bf2e..340f25e3 100644
--- a/eel/eel-canvas.c
+++ b/eel/eel-canvas.c
@@ -332,11 +332,7 @@ eel_canvas_item_dispose (GObject *object)
item->canvas->need_repick = TRUE;
}
-#if GTK_CHECK_VERSION (3, 20, 0)
eel_canvas_item_ungrab (item);
-#else
- eel_canvas_item_ungrab (item, GDK_CURRENT_TIME);
-#endif
if (item == item->canvas->focused_item)
item->canvas->focused_item = NULL;
@@ -869,7 +865,6 @@ eel_canvas_item_hide (EelCanvasItem *item)
}
}
-#if GTK_CHECK_VERSION (3, 20, 0)
/*
* Prepare the window for grabbing, i.e. show it.
*/
@@ -897,44 +892,15 @@ seat_grab_prepare_window (GdkSeat *seat,
* returns %GDK_GRAB_NOT_VIEWABLE. Else, it returns the result of calling
* gdk_seat_grab().
**/
-#else
-/**
- * eel_canvas_item_grab:
- * @item: A canvas item.
- * @event_mask: Mask of events that will be sent to this item.
- * @cursor: If non-NULL, the cursor that will be used while the grab is active.
- * @etime: The timestamp required for grabbing the mouse, or GDK_CURRENT_TIME.
- *
- * Specifies that all events that match the specified event mask should be sent
- * to the specified item, and also grabs the mouse by calling
- * gdk_pointer_grab(). The event mask is also used when grabbing the pointer.
- * If @cursor is not NULL, then that cursor is used while the grab is active.
- * The @etime parameter is the timestamp required for grabbing the mouse.
- *
- * Return value: If an item was already grabbed, it returns %GDK_GRAB_ALREADY_GRABBED. If
- * the specified item was hidden by calling eel_canvas_item_hide(), then it
- * returns %GDK_GRAB_NOT_VIEWABLE. Else, it returns the result of calling
- * gdk_pointer_grab().
- **/
-#endif
GdkGrabStatus
eel_canvas_item_grab (EelCanvasItem *item,
GdkEventMask event_mask,
GdkCursor *cursor,
-#if GTK_CHECK_VERSION (3, 20, 0)
const GdkEvent *event)
{
GdkGrabStatus retval;
GdkDisplay *display;
GdkSeat *seat;
-#else
- guint32 timestamp)
-{
- GdkGrabStatus retval;
- GdkDisplay *display;
- GdkDeviceManager *manager;
- GdkDevice *device;
-#endif
g_return_val_if_fail (EEL_IS_CANVAS_ITEM (item), GDK_GRAB_NOT_VIEWABLE);
g_return_val_if_fail (gtk_widget_get_mapped (GTK_WIDGET (item->canvas)),
@@ -947,7 +913,6 @@ eel_canvas_item_grab (EelCanvasItem *item,
return GDK_GRAB_NOT_VIEWABLE;
display = gtk_widget_get_display (GTK_WIDGET (item->canvas));
-#if GTK_CHECK_VERSION (3, 20, 0)
seat = gdk_display_get_default_seat (display);
retval = gdk_seat_grab (seat,
@@ -958,18 +923,6 @@ eel_canvas_item_grab (EelCanvasItem *item,
event,
seat_grab_prepare_window,
NULL);
-#else
- manager = gdk_display_get_device_manager (display);
- device = gdk_device_manager_get_client_pointer (manager);
-
- retval = gdk_device_grab (device,
- gtk_layout_get_bin_window (GTK_LAYOUT (item->canvas)),
- GDK_OWNERSHIP_NONE,
- FALSE,
- event_mask,
- cursor,
- timestamp);
-#endif
if (retval != GDK_GRAB_SUCCESS)
return retval;
@@ -981,7 +934,6 @@ eel_canvas_item_grab (EelCanvasItem *item,
return retval;
}
-#if GTK_CHECK_VERSION (3, 20, 0)
/**
* eel_canvas_item_ungrab:
* @item: A canvas item that holds a grab.
@@ -989,18 +941,7 @@ eel_canvas_item_grab (EelCanvasItem *item,
* Ungrabs the item, which must have been grabbed in the canvas, and ungrabs the
* seat.
**/
-#else
-/**
- * eel_canvas_item_ungrab:
- * @item: A canvas item that holds a grab.
- * @etime: The timestamp for ungrabbing the mouse.
- *
- * Ungrabs the item, which must have been grabbed in the canvas, and ungrabs the
- * mouse.
- **/
-#endif
void
-#if GTK_CHECK_VERSION (3, 20, 0)
eel_canvas_item_ungrab (EelCanvasItem *item)
{
GdkDisplay *display;
@@ -1017,26 +958,6 @@ eel_canvas_item_ungrab (EelCanvasItem *item)
item->canvas->grabbed_item = NULL;
gdk_seat_ungrab (seat);
}
-#else
-eel_canvas_item_ungrab (EelCanvasItem *item, guint32 etime)
-{
- GdkDisplay *display;
- GdkDeviceManager *manager;
- GdkDevice *device;
-
- g_return_if_fail (EEL_IS_CANVAS_ITEM (item));
-
- if (item->canvas->grabbed_item != item)
- return;
-
- display = gtk_widget_get_display (GTK_WIDGET (item->canvas));
- manager = gdk_display_get_device_manager (display);
- device = gdk_device_manager_get_client_pointer (manager);
-
- item->canvas->grabbed_item = NULL;
- gdk_device_ungrab (device, etime);
-}
-#endif
/**
* eel_canvas_item_w2i:
@@ -2226,11 +2147,7 @@ shutdown_transients (EelCanvas *canvas)
if (canvas->grabbed_item)
{
-#if GTK_CHECK_VERSION (3, 20, 0)
eel_canvas_item_ungrab (canvas->grabbed_item);
-#else
- eel_canvas_item_ungrab (canvas->grabbed_item, GDK_CURRENT_TIME);
-#endif
}
remove_idle (canvas);
@@ -2623,32 +2540,15 @@ emit_event (EelCanvas *canvas, GdkEvent *event)
break;
case GDK_MOTION_NOTIFY:
-#if !GTK_CHECK_VERSION (3, 20, 0)
- eel_canvas_window_to_world (canvas,
- ev.motion.x, ev.motion.y,
- &ev.motion.x, &ev.motion.y);
- break;
-#endif
-
case GDK_BUTTON_PRESS:
case GDK_2BUTTON_PRESS:
case GDK_3BUTTON_PRESS:
-#if GTK_CHECK_VERSION (3, 20, 0)
case GDK_BUTTON_RELEASE:
-#endif
eel_canvas_window_to_world (canvas,
ev.motion.x, ev.motion.y,
&ev.motion.x, &ev.motion.y);
break;
-#if !GTK_CHECK_VERSION (3, 20, 0)
- case GDK_BUTTON_RELEASE:
- eel_canvas_window_to_world (canvas,
- ev.motion.x, ev.motion.y,
- &ev.motion.x, &ev.motion.y);
- break;
-#endif
-
default:
break;
}
diff --git a/eel/eel-canvas.h b/eel/eel-canvas.h
index c0cbd301..8830e741 100644
--- a/eel/eel-canvas.h
+++ b/eel/eel-canvas.h
@@ -247,38 +247,19 @@ extern "C" {
*/
void eel_canvas_item_hide (EelCanvasItem *item);
-#if GTK_CHECK_VERSION (3, 20, 0)
/* Grab the seat for the specified item. Only the events in event_mask will be
* reported. If cursor is non-NULL, it will be used during the duration of the
* grab. event is the event, triggering the grab. Returns the same values as gdk_seat_grab().
*/
-#else
- /* Grab the mouse for the specified item. Only the events in event_mask will be
- * reported. If cursor is non-NULL, it will be used during the duration of the
- * grab. Time is a proper X event time parameter. Returns the same values as
- * XGrabPointer().
- */
-#endif
GdkGrabStatus eel_canvas_item_grab (EelCanvasItem *item,
GdkEventMask event_mask,
GdkCursor *cursor,
-#if GTK_CHECK_VERSION (3, 20, 0)
const GdkEvent* event);
-#else
- guint32 etime);
-#endif
-#if GTK_CHECK_VERSION (3, 20, 0)
/* Ungrabs the seat -- the specified item must be the same that was passed to
* eel_canvas_item_grab().
*/
void eel_canvas_item_ungrab (EelCanvasItem *item);
-#else
- /* Ungrabs the mouse -- the specified item must be the same that was passed to
- * eel_canvas_item_grab(). Time is a proper X event time parameter.
- */
- void eel_canvas_item_ungrab (EelCanvasItem *item, guint32 etime);
-#endif
/* These functions convert from a coordinate system to another. "w" is world
* coordinates and "i" is item coordinates.
diff --git a/eel/eel-editable-label.c b/eel/eel-editable-label.c
index 8b98a273..7cdbc491 100644
--- a/eel/eel-editable-label.c
+++ b/eel/eel-editable-label.c
@@ -40,11 +40,6 @@
#include <gdk/gdkkeysyms.h>
-/* g_memmove is removed in glib 2.40 */
-#if GLIB_CHECK_VERSION (2, 39, 0)
-#define g_memmove memmove
-#endif
-
enum
{
MOVE_CURSOR,
@@ -2282,7 +2277,7 @@ eel_editable_label_delete_text (EelEditableLabel *label,
if (start_pos < end_pos)
{
- g_memmove (label->text + start_pos, label->text + end_pos, label->n_bytes + 1 - end_pos);
+ memmove (label->text + start_pos, label->text + end_pos, label->n_bytes + 1 - end_pos);
label->n_bytes -= (end_pos - start_pos);
anchor = label->selection_anchor;
@@ -2325,7 +2320,7 @@ eel_editable_label_insert_text (EelEditableLabel *label,
g_object_freeze_notify (G_OBJECT (label));
- g_memmove (label->text + *index + new_text_length, label->text + *index, label->n_bytes - *index);
+ memmove (label->text + *index + new_text_length, label->text + *index, label->n_bytes - *index);
memcpy (label->text + *index, new_text, new_text_length);
label->n_bytes += new_text_length;
diff --git a/eel/eel-gtk-extensions.c b/eel/eel-gtk-extensions.c
index 1fd156c0..c3cff2f5 100644
--- a/eel/eel-gtk-extensions.c
+++ b/eel/eel-gtk-extensions.c
@@ -448,11 +448,7 @@ eel_gtk_message_dialog_set_details_label (GtkMessageDialog *dialog,
label = gtk_label_new (details_text);
gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
gtk_label_set_selectable (GTK_LABEL (label), TRUE);
-#if GTK_CHECK_VERSION (3, 16, 0)
gtk_label_set_xalign (GTK_LABEL (label), 0);
-#else
- gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
-#endif
gtk_container_add (GTK_CONTAINER (expander), label);
gtk_box_pack_start (GTK_BOX (content_area), expander, FALSE, FALSE, 0);
diff --git a/eel/eel-labeled-image.c b/eel/eel-labeled-image.c
index d58d808e..1928d064 100644
--- a/eel/eel-labeled-image.c
+++ b/eel/eel-labeled-image.c
@@ -1058,13 +1058,8 @@ labeled_image_update_alignments (EelLabeledImage *labeled_image)
if (labeled_image->details->fill)
{
-#if GTK_CHECK_VERSION (3, 16, 0)
x_alignment = gtk_label_get_xalign (GTK_LABEL (labeled_image->details->label));
y_alignment = gtk_label_get_yalign (GTK_LABEL (labeled_image->details->label));
-#else
- gtk_misc_get_alignment (GTK_MISC (labeled_image->details->label),
- &x_alignment, &y_alignment);
-#endif
/* Only the label is shown */
if (!labeled_image_show_image (labeled_image))
@@ -1100,14 +1095,8 @@ labeled_image_update_alignments (EelLabeledImage *labeled_image)
}
-#if GTK_CHECK_VERSION (3, 16, 0)
gtk_label_set_xalign (GTK_LABEL (labeled_image->details->label), x_alignment);
gtk_label_set_yalign (GTK_LABEL (labeled_image->details->label), y_alignment);
-#else
- gtk_misc_set_alignment (GTK_MISC (labeled_image->details->label),
- x_alignment,
- y_alignment);
-#endif
}
}
diff --git a/eel/eel-wrap-table.c b/eel/eel-wrap-table.c
index ac626a42..793d2290 100644
--- a/eel/eel-wrap-table.c
+++ b/eel/eel-wrap-table.c
@@ -1101,9 +1101,7 @@ eel_scrolled_wrap_table_new (gboolean homogeneous,
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window),
GTK_POLICY_NEVER,
GTK_POLICY_AUTOMATIC);
-#if GTK_CHECK_VERSION (3, 16, 0)
gtk_scrolled_window_set_overlay_scrolling (GTK_SCROLLED_WINDOW (scrolled_window), FALSE);
-#endif
viewport = gtk_viewport_new (gtk_scrolled_window_get_hadjustment (GTK_SCROLLED_WINDOW (scrolled_window)),
gtk_scrolled_window_get_vadjustment (GTK_SCROLLED_WINDOW (scrolled_window)));