[gtk+] entry: Update to using GdkEvent API
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] entry: Update to using GdkEvent API
- Date: Tue, 19 Sep 2017 17:12:38 +0000 (UTC)
commit e46a1d32f04281bd35c4e260537b97be159725bf
Author: Carlos Garnacho <carlosg gnome org>
Date: Fri Aug 25 16:45:12 2017 +0200
entry: Update to using GdkEvent API
gtk/gtkentry.c | 29 ++++++++++++++++++++---------
1 files changed, 20 insertions(+), 9 deletions(-)
---
diff --git a/gtk/gtkentry.c b/gtk/gtkentry.c
index 7c5673c..b3f9b08 100644
--- a/gtk/gtkentry.c
+++ b/gtk/gtkentry.c
@@ -3502,7 +3502,7 @@ gtk_entry_event (GtkWidget *widget,
gdk_event_get_coords (event, &x, &y);
- if (event->type == GDK_MOTION_NOTIFY &&
+ if (gdk_event_get_event_type (event) == GDK_MOTION_NOTIFY &&
priv->mouse_cursor_obscured)
{
set_text_cursor (widget);
@@ -3536,7 +3536,7 @@ gtk_entry_event (GtkWidget *widget,
sequence = gdk_event_get_event_sequence (event);
device = gdk_event_get_device (event);
- switch (event->type)
+ switch (gdk_event_get_event_type (event))
{
case GDK_TOUCH_BEGIN:
if (icon_info->current_sequence)
@@ -3680,6 +3680,7 @@ gtk_entry_multipress_gesture_pressed (GtkGestureMultiPress *gesture,
GtkTextHandleMode mode;
gboolean is_touchscreen, extend_selection;
GdkDevice *source;
+ guint state;
source = gdk_event_get_source_device (event);
is_touchscreen = gtk_simulate_touchscreen () ||
@@ -3699,8 +3700,10 @@ gtk_entry_multipress_gesture_pressed (GtkGestureMultiPress *gesture,
priv->select_words = FALSE;
priv->select_lines = FALSE;
+ gdk_event_get_state (event, &state);
+
extend_selection =
- (event->button.state &
+ (state &
gtk_widget_get_modifier_mask (widget,
GDK_MODIFIER_INTENT_EXTEND_SELECTION));
@@ -4055,6 +4058,10 @@ gtk_entry_key_press (GtkWidget *widget,
GtkEntry *entry = GTK_ENTRY (widget);
GtkEntryPrivate *priv = entry->priv;
gboolean retval = FALSE;
+ guint keyval;
+
+ if (!gdk_event_get_keyval ((GdkEvent *) event, &keyval))
+ return GDK_EVENT_PROPAGATE;
priv->handling_key_event = TRUE;
@@ -4077,10 +4084,10 @@ gtk_entry_key_press (GtkWidget *widget,
}
}
- if (event->keyval == GDK_KEY_Return ||
- event->keyval == GDK_KEY_KP_Enter ||
- event->keyval == GDK_KEY_ISO_Enter ||
- event->keyval == GDK_KEY_Escape)
+ if (keyval == GDK_KEY_Return ||
+ keyval == GDK_KEY_KP_Enter ||
+ keyval == GDK_KEY_ISO_Enter ||
+ keyval == GDK_KEY_Escape)
gtk_entry_reset_im_context (entry);
if (GTK_WIDGET_CLASS (gtk_entry_parent_class)->key_press_event (widget, event))
@@ -4476,8 +4483,12 @@ gtk_cell_editable_key_press_event (GtkEntry *entry,
gpointer data)
{
GtkEntryPrivate *priv = entry->priv;
+ guint keyval;
+
+ if (!gdk_event_get_keyval ((GdkEvent *) key_event, &keyval))
+ return GDK_EVENT_PROPAGATE;
- if (key_event->keyval == GDK_KEY_Escape)
+ if (keyval == GDK_KEY_Escape)
{
priv->editing_canceled = TRUE;
gtk_cell_editable_editing_done (GTK_CELL_EDITABLE (entry));
@@ -4487,7 +4498,7 @@ gtk_cell_editable_key_press_event (GtkEntry *entry,
}
/* override focus */
- if (key_event->keyval == GDK_KEY_Up || key_event->keyval == GDK_KEY_Down)
+ if (keyval == GDK_KEY_Up || keyval == GDK_KEY_Down)
{
gtk_cell_editable_editing_done (GTK_CELL_EDITABLE (entry));
gtk_cell_editable_remove_widget (GTK_CELL_EDITABLE (entry));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]