[gtk/readonly-events-1: 4/9] gtk: Stop using GdkEventKey
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/readonly-events-1: 4/9] gtk: Stop using GdkEventKey
- Date: Fri, 21 Feb 2020 04:27:13 +0000 (UTC)
commit 84494b28f09743eb43c517b4258da4f04be6f755
Author: Matthias Clasen <mclasen redhat com>
Date: Thu Feb 20 21:21:08 2020 -0500
gtk: Stop using GdkEventKey
We should just use GdkEvent, instead of taking
a GdkEventKey, and then cast it everywhere.
gtk/gtkbindings.c | 14 +++++++-------
gtk/gtkbindings.h | 2 +-
gtk/gtkcombobox.c | 2 +-
gtk/gtkeventcontrollerkey.c | 4 ++--
gtk/gtkimcontext.c | 8 ++++----
gtk/gtkimcontext.h | 4 ++--
gtk/gtkimcontextime.c | 4 ++--
gtk/gtkimcontextquartz.c | 2 +-
gtk/gtkimcontextsimple.c | 10 +++++-----
gtk/gtkimcontextwayland.c | 2 +-
gtk/gtkimmulticontext.c | 12 ++++++------
gtk/gtkkeyhash.c | 8 ++++----
gtk/gtktextview.c | 8 ++++----
gtk/gtktextview.h | 6 +++---
gtk/gtktreeview.c | 4 ++--
gtk/gtkwidget.c | 2 +-
16 files changed, 46 insertions(+), 46 deletions(-)
---
diff --git a/gtk/gtkbindings.c b/gtk/gtkbindings.c
index 949c8cf65a..9f3d879d04 100644
--- a/gtk/gtkbindings.c
+++ b/gtk/gtkbindings.c
@@ -1756,7 +1756,7 @@ gtk_bindings_activate (GObject *object,
/**
* gtk_bindings_activate_event:
* @object: a #GObject (generally must be a widget)
- * @event: a #GdkEventKey
+ * @event: a key event
*
* Looks up key bindings for @object to find one matching
* @event, and if one was found, activate it.
@@ -1764,8 +1764,8 @@ gtk_bindings_activate (GObject *object,
* Returns: %TRUE if a matching key binding was found
*/
gboolean
-gtk_bindings_activate_event (GObject *object,
- GdkEventKey *event)
+gtk_bindings_activate_event (GObject *object,
+ GdkEvent *event)
{
GSList *entries = NULL;
GdkDisplay *display;
@@ -1779,13 +1779,13 @@ gtk_bindings_activate_event (GObject *object,
key_hash = binding_key_hash_for_keymap (gdk_display_get_keymap (display));
entries = _gtk_key_hash_lookup (key_hash,
- gdk_key_event_get_keycode ((GdkEvent *)event),
- gdk_event_get_modifier_state ((GdkEvent *)event),
+ gdk_key_event_get_keycode (event),
+ gdk_event_get_modifier_state (event),
BINDING_MOD_MASK () & ~GDK_RELEASE_MASK,
- gdk_key_event_get_group((GdkEvent *)event));
+ gdk_key_event_get_group(event));
handled = gtk_bindings_activate_list (object, entries,
- gdk_event_get_event_type ((GdkEvent *) event) == GDK_KEY_RELEASE);
+ gdk_event_get_event_type (event) == GDK_KEY_RELEASE);
g_slist_free (entries);
diff --git a/gtk/gtkbindings.h b/gtk/gtkbindings.h
index 20df806ae3..ef8756f6bd 100644
--- a/gtk/gtkbindings.h
+++ b/gtk/gtkbindings.h
@@ -67,7 +67,7 @@ gboolean gtk_bindings_activate (GObject *object,
GdkModifierType modifiers);
GDK_AVAILABLE_IN_ALL
gboolean gtk_bindings_activate_event (GObject *object,
- GdkEventKey *event);
+ GdkEvent *event);
GDK_AVAILABLE_IN_ALL
gboolean gtk_binding_set_activate (GtkBindingSet *binding_set,
guint keyval,
diff --git a/gtk/gtkcombobox.c b/gtk/gtkcombobox.c
index ac529c718e..9a013d554f 100644
--- a/gtk/gtkcombobox.c
+++ b/gtk/gtkcombobox.c
@@ -1795,7 +1795,7 @@ gtk_combo_box_menu_key (GtkEventControllerKey *key,
widget = gtk_event_controller_get_widget (GTK_EVENT_CONTROLLER (key));
event = gtk_get_current_event ();
- if (!gtk_bindings_activate_event (G_OBJECT (widget), (GdkEventKey *)event))
+ if (!gtk_bindings_activate_event (G_OBJECT (widget), event))
{
gtk_event_controller_key_forward (key, GTK_WIDGET (combo_box));
}
diff --git a/gtk/gtkeventcontrollerkey.c b/gtk/gtkeventcontrollerkey.c
index ea2b4c994d..efb1befb58 100644
--- a/gtk/gtkeventcontrollerkey.c
+++ b/gtk/gtkeventcontrollerkey.c
@@ -101,7 +101,7 @@ gtk_event_controller_key_handle_event (GtkEventController *controller,
return FALSE;
if (key->im_context &&
- gtk_im_context_filter_keypress (key->im_context, (GdkEventKey *) event))
+ gtk_im_context_filter_keypress (key->im_context, event))
{
g_signal_emit (controller, signals[IM_UPDATE], 0);
return TRUE;
@@ -368,7 +368,7 @@ gtk_event_controller_key_forward (GtkEventControllerKey *controller,
GTK_PHASE_BUBBLE))
return TRUE;
- if (gtk_bindings_activate_event (G_OBJECT (widget), (GdkEventKey *)controller->current_event))
+ if (gtk_bindings_activate_event (G_OBJECT (widget), controller->current_event))
return TRUE;
return FALSE;
diff --git a/gtk/gtkimcontext.c b/gtk/gtkimcontext.c
index c01b5b98de..4604a7651f 100644
--- a/gtk/gtkimcontext.c
+++ b/gtk/gtkimcontext.c
@@ -127,7 +127,7 @@ static void gtk_im_context_real_get_preedit_string (GtkIMContext *context,
PangoAttrList **attrs,
gint *cursor_pos);
static gboolean gtk_im_context_real_filter_keypress (GtkIMContext *context,
- GdkEventKey *event);
+ GdkEvent *event);
static gboolean gtk_im_context_real_get_surrounding (GtkIMContext *context,
gchar **text,
gint *cursor_index);
@@ -371,8 +371,8 @@ gtk_im_context_real_get_preedit_string (GtkIMContext *context,
}
static gboolean
-gtk_im_context_real_filter_keypress (GtkIMContext *context,
- GdkEventKey *event)
+gtk_im_context_real_filter_keypress (GtkIMContext *context,
+ GdkEvent *event)
{
return FALSE;
}
@@ -511,7 +511,7 @@ gtk_im_context_get_preedit_string (GtkIMContext *context,
**/
gboolean
gtk_im_context_filter_keypress (GtkIMContext *context,
- GdkEventKey *key)
+ GdkEvent *key)
{
GtkIMContextClass *klass;
diff --git a/gtk/gtkimcontext.h b/gtk/gtkimcontext.h
index 3d77266975..33b41d5895 100644
--- a/gtk/gtkimcontext.h
+++ b/gtk/gtkimcontext.h
@@ -68,7 +68,7 @@ struct _GtkIMContextClass
PangoAttrList **attrs,
gint *cursor_pos);
gboolean (*filter_keypress) (GtkIMContext *context,
- GdkEventKey *event);
+ GdkEvent *event);
void (*focus_in) (GtkIMContext *context);
void (*focus_out) (GtkIMContext *context);
void (*reset) (GtkIMContext *context);
@@ -106,7 +106,7 @@ void gtk_im_context_get_preedit_string (GtkIMContext *context,
gint *cursor_pos);
GDK_AVAILABLE_IN_ALL
gboolean gtk_im_context_filter_keypress (GtkIMContext *context,
- GdkEventKey *event);
+ GdkEvent *event);
GDK_AVAILABLE_IN_ALL
void gtk_im_context_focus_in (GtkIMContext *context);
GDK_AVAILABLE_IN_ALL
diff --git a/gtk/gtkimcontextime.c b/gtk/gtkimcontextime.c
index ced066a66b..1c814ebe1b 100644
--- a/gtk/gtkimcontextime.c
+++ b/gtk/gtkimcontextime.c
@@ -98,7 +98,7 @@ static void gtk_im_context_ime_get_property (GObject *object,
static void gtk_im_context_ime_set_client_widget (GtkIMContext *context,
GtkWidget *widget);
static gboolean gtk_im_context_ime_filter_keypress (GtkIMContext *context,
- GdkEventKey *event);
+ GdkEvent *event);
static void gtk_im_context_ime_reset (GtkIMContext *context);
static void gtk_im_context_ime_get_preedit_string (GtkIMContext *context,
gchar **str,
@@ -345,7 +345,7 @@ _gtk_im_context_ime_commit_unichar (GtkIMContextIME *context_ime,
static gboolean
gtk_im_context_ime_filter_keypress (GtkIMContext *context,
- GdkEventKey *event)
+ GdkEvent *event)
{
GtkIMContextIME *context_ime;
gboolean retval = FALSE;
diff --git a/gtk/gtkimcontextquartz.c b/gtk/gtkimcontextquartz.c
index 7b046c3def..d98ce88ead 100644
--- a/gtk/gtkimcontextquartz.c
+++ b/gtk/gtkimcontextquartz.c
@@ -163,7 +163,7 @@ output_result (GtkIMContext *context,
static gboolean
quartz_filter_keypress (GtkIMContext *context,
- GdkEventKey *event)
+ GdkEvent *event)
{
GtkIMContextQuartz *qc = GTK_IM_CONTEXT_QUARTZ (context);
gboolean retval;
diff --git a/gtk/gtkimcontextsimple.c b/gtk/gtkimcontextsimple.c
index 5fdcc8533d..645f7cd4ca 100644
--- a/gtk/gtkimcontextsimple.c
+++ b/gtk/gtkimcontextsimple.c
@@ -114,7 +114,7 @@ static const guint16 gtk_compose_ignore[] = {
static void gtk_im_context_simple_finalize (GObject *obj);
static gboolean gtk_im_context_simple_filter_keypress (GtkIMContext *context,
- GdkEventKey *key);
+ GdkEvent *key);
static void gtk_im_context_simple_reset (GtkIMContext *context);
static void gtk_im_context_simple_get_preedit_string (GtkIMContext *context,
gchar **str,
@@ -928,11 +928,11 @@ no_sequence_matches (GtkIMContextSimple *context_simple,
0,
0);
- gtk_im_context_filter_keypress (context, (GdkEventKey *)tmp_event);
+ gtk_im_context_filter_keypress (context, tmp_event);
g_object_unref (tmp_event);
}
- return gtk_im_context_filter_keypress (context, (GdkEventKey *)event);
+ return gtk_im_context_filter_keypress (context, event);
}
else
{
@@ -966,7 +966,7 @@ is_hex_keyval (guint keyval)
}
static guint
-canonical_hex_keyval (GdkEventKey *event)
+canonical_hex_keyval (GdkEvent *event)
{
GdkSurface *surface = gdk_event_get_surface ((GdkEvent *) event);
GdkKeymap *keymap = gdk_display_get_keymap (gdk_surface_get_display (surface));
@@ -1014,7 +1014,7 @@ canonical_hex_keyval (GdkEventKey *event)
static gboolean
gtk_im_context_simple_filter_keypress (GtkIMContext *context,
- GdkEventKey *event)
+ GdkEvent *event)
{
GtkIMContextSimple *context_simple = GTK_IM_CONTEXT_SIMPLE (context);
GtkIMContextSimplePrivate *priv = context_simple->priv;
diff --git a/gtk/gtkimcontextwayland.c b/gtk/gtkimcontextwayland.c
index 4fcc2f9a01..9511ae6978 100644
--- a/gtk/gtkimcontextwayland.c
+++ b/gtk/gtkimcontextwayland.c
@@ -615,7 +615,7 @@ gtk_im_context_wayland_get_preedit_string (GtkIMContext *context,
static gboolean
gtk_im_context_wayland_filter_keypress (GtkIMContext *context,
- GdkEventKey *key)
+ GdkEvent *key)
{
/* This is done by the compositor */
return GTK_IM_CONTEXT_CLASS (gtk_im_context_wayland_parent_class)->filter_keypress (context, key);
diff --git a/gtk/gtkimmulticontext.c b/gtk/gtkimmulticontext.c
index 2818241e11..863f862428 100644
--- a/gtk/gtkimmulticontext.c
+++ b/gtk/gtkimmulticontext.c
@@ -66,7 +66,7 @@ static void gtk_im_multicontext_get_preedit_string (GtkIMContext
PangoAttrList **attrs,
gint *cursor_pos);
static gboolean gtk_im_multicontext_filter_keypress (GtkIMContext *context,
- GdkEventKey *event);
+ GdkEvent *event);
static void gtk_im_multicontext_focus_in (GtkIMContext *context);
static void gtk_im_multicontext_focus_out (GtkIMContext *context);
static void gtk_im_multicontext_reset (GtkIMContext *context);
@@ -343,7 +343,7 @@ gtk_im_multicontext_get_preedit_string (GtkIMContext *context,
static gboolean
gtk_im_multicontext_filter_keypress (GtkIMContext *context,
- GdkEventKey *event)
+ GdkEvent *event)
{
GtkIMMulticontext *multicontext = GTK_IM_MULTICONTEXT (context);
GtkIMContext *slave = gtk_im_multicontext_get_slave (multicontext);
@@ -358,15 +358,15 @@ gtk_im_multicontext_filter_keypress (GtkIMContext *context,
GdkDisplay *display;
GdkModifierType no_text_input_mask;
- keyval = gdk_key_event_get_keyval ((GdkEvent *) event);
- state = gdk_event_get_modifier_state ((GdkEvent *) event);
- display = gdk_event_get_display ((GdkEvent *) event);
+ keyval = gdk_key_event_get_keyval (event);
+ state = gdk_event_get_modifier_state (event);
+ display = gdk_event_get_display (event);
no_text_input_mask =
gdk_keymap_get_modifier_mask (gdk_display_get_keymap (display),
GDK_MODIFIER_INTENT_NO_TEXT_INPUT);
- if (gdk_event_get_event_type ((GdkEvent *) event) == GDK_KEY_PRESS &&
+ if (gdk_event_get_event_type (event) == GDK_KEY_PRESS &&
(state & no_text_input_mask) == 0)
{
gunichar ch;
diff --git a/gtk/gtkkeyhash.c b/gtk/gtkkeyhash.c
index 9d516183be..45e9937f6f 100644
--- a/gtk/gtkkeyhash.c
+++ b/gtk/gtkkeyhash.c
@@ -355,11 +355,11 @@ keyval_in_group (GdkKeymap *keymap,
/**
* _gtk_key_hash_lookup:
* @key_hash: a #GtkKeyHash
- * @hardware_keycode: hardware keycode field from a #GdkEventKey
- * @state: state field from a #GdkEventKey
+ * @hardware_keycode: hardware keycode field from a #GdkEvent
+ * @state: state field from a #GdkEvent
* @mask: mask of modifiers to consider when matching against the
* modifiers in entries.
- * @group: group field from a #GdkEventKey
+ * @group: group field from a #GdkEvent
*
* Looks up the best matching entry or entries in the hash table for
* a given event. The results are sorted so that entries with less
@@ -530,7 +530,7 @@ _gtk_key_hash_lookup (GtkKeyHash *key_hash,
*
* Looks up the best matching entry or entries in the hash table for a
* given keyval/modifiers pair. It’s better to use
- * _gtk_key_hash_lookup() if you have the original #GdkEventKey
+ * _gtk_key_hash_lookup() if you have the original #GdkEvent
* available. The results are sorted so that entries with less
* modifiers come before entries with more modifiers.
*
diff --git a/gtk/gtktextview.c b/gtk/gtktextview.c
index 1051264b00..c357b3c98c 100644
--- a/gtk/gtktextview.c
+++ b/gtk/gtktextview.c
@@ -7650,8 +7650,8 @@ gtk_text_view_reset_im_context (GtkTextView *text_view)
*
* |[<!-- language="C" -->
* static gboolean
- * gtk_foo_bar_key_press_event (GtkWidget *widget,
- * GdkEventKey *event)
+ * gtk_foo_bar_key_press_event (GtkWidget *widget,
+ * GdkEvent *event)
* {
* guint keyval;
*
@@ -7672,8 +7672,8 @@ gtk_text_view_reset_im_context (GtkTextView *text_view)
* Returns: %TRUE if the input method handled the key event.
*/
gboolean
-gtk_text_view_im_context_filter_keypress (GtkTextView *text_view,
- GdkEventKey *event)
+gtk_text_view_im_context_filter_keypress (GtkTextView *text_view,
+ GdkEvent *event)
{
g_return_val_if_fail (GTK_IS_TEXT_VIEW (text_view), FALSE);
diff --git a/gtk/gtktextview.h b/gtk/gtktextview.h
index d386aebf70..3d824b2517 100644
--- a/gtk/gtktextview.h
+++ b/gtk/gtktextview.h
@@ -299,10 +299,10 @@ gboolean gtk_text_view_move_visually (GtkTextView *text_v
gint count);
GDK_AVAILABLE_IN_ALL
-gboolean gtk_text_view_im_context_filter_keypress (GtkTextView *text_view,
- GdkEventKey *event);
+gboolean gtk_text_view_im_context_filter_keypress (GtkTextView *text_view,
+ GdkEvent *event);
GDK_AVAILABLE_IN_ALL
-void gtk_text_view_reset_im_context (GtkTextView *text_view);
+void gtk_text_view_reset_im_context (GtkTextView *text_view);
/* Adding child widgets */
GDK_AVAILABLE_IN_ALL
diff --git a/gtk/gtktreeview.c b/gtk/gtktreeview.c
index ca2ad2bb53..1742fbd0e6 100644
--- a/gtk/gtktreeview.c
+++ b/gtk/gtktreeview.c
@@ -5436,7 +5436,7 @@ gtk_tree_view_key_controller_key_pressed (GtkEventControllerKey *key,
/* Handle the keybindings. */
event = gtk_get_current_event ();
- if (gtk_bindings_activate_event (G_OBJECT (widget), (GdkEventKey *)event))
+ if (gtk_bindings_activate_event (G_OBJECT (widget), event))
{
gdk_event_unref (event);
return TRUE;
@@ -5496,7 +5496,7 @@ gtk_tree_view_key_controller_key_released (GtkEventControllerKey *key,
/* Handle the keybindings. */
event = gtk_get_current_event ();
- gtk_bindings_activate_event (G_OBJECT (tree_view), (GdkEventKey *)event);
+ gtk_bindings_activate_event (G_OBJECT (tree_view), event);
gdk_event_unref (event);
}
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index 6f64a3ae2a..d2efd29ec5 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -4990,7 +4990,7 @@ gtk_widget_event (GtkWidget *widget,
if (return_val == FALSE &&
(gdk_event_get_event_type (event) == GDK_KEY_PRESS ||
gdk_event_get_event_type (event) == GDK_KEY_RELEASE))
- return_val |= gtk_bindings_activate_event (G_OBJECT (widget), (GdkEventKey *) event);
+ return_val |= gtk_bindings_activate_event (G_OBJECT (widget), event);
return return_val;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]