[gtk/readonly-events-1] gtk: Stop using GdkEventKey
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/readonly-events-1] gtk: Stop using GdkEventKey
- Date: Fri, 21 Feb 2020 02:31:05 +0000 (UTC)
commit c52f3b2f8b84fb9f4ce5280c0fd2587a8e09a457
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/gtkimcontext.c | 8 ++++----
gtk/gtkimcontext.h | 4 ++--
gtk/gtkimcontextsimple.c | 10 +++++-----
gtk/gtkimcontextwayland.c | 2 +-
gtk/gtkimmulticontext.c | 12 ++++++------
gtk/gtktextview.c | 8 ++++----
gtk/gtktextview.h | 6 +++---
gtk/gtktreeview.c | 4 ++--
10 files changed, 35 insertions(+), 35 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/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/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/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);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]