summaryrefslogtreecommitdiff
path: root/gdk
diff options
context:
space:
mode:
authorBenjamin Otte <otte@redhat.com>2018-07-28 20:07:43 +0200
committerBenjamin Otte <otte@redhat.com>2018-07-30 19:32:38 +0200
commit375fbd4e476044a5066cf59f2a29b0c3338b0ffa (patch)
tree64f6e34ca9e4c42265fcf52fbb296fea243f2434 /gdk
parent813957a92fe580ec0e2fa2076a233994a0d08ce8 (diff)
downloadgtk+-375fbd4e476044a5066cf59f2a29b0c3338b0ffa.tar.gz
gdk: Remove key_event->string and key_event->length
They're unused.
Diffstat (limited to 'gdk')
-rw-r--r--gdk/broadway/gdkeventsource.c1
-rw-r--r--gdk/gdkevents.c10
-rw-r--r--gdk/gdkeventsprivate.h14
-rw-r--r--gdk/wayland/gdkdevice-wayland.c73
-rw-r--r--gdk/x11/gdkdevicemanager-core-x11.c70
-rw-r--r--gdk/x11/gdkdevicemanager-xi2.c2
-rw-r--r--gdk/x11/gdkprivate-x11.h2
7 files changed, 2 insertions, 170 deletions
diff --git a/gdk/broadway/gdkeventsource.c b/gdk/broadway/gdkeventsource.c
index 0eb603a960..9356ad975b 100644
--- a/gdk/broadway/gdkeventsource.c
+++ b/gdk/broadway/gdkeventsource.c
@@ -285,7 +285,6 @@ _gdk_broadway_events_got_input (BroadwayInputMsg *message)
event->key.state = message->key.state;
event->key.hardware_keycode = message->key.key;
gdk_event_set_scancode (event, message->key.key);
- event->key.length = 0;
gdk_event_set_device (event, gdk_seat_get_keyboard (seat));
node = _gdk_event_queue_append (display, event);
diff --git a/gdk/gdkevents.c b/gdk/gdkevents.c
index 4a8dcb71f1..35558f68b0 100644
--- a/gdk/gdkevents.c
+++ b/gdk/gdkevents.c
@@ -631,11 +631,6 @@ gdk_event_copy (const GdkEvent *event)
switch ((guint) event->any.type)
{
- case GDK_KEY_PRESS:
- case GDK_KEY_RELEASE:
- new_event->key.string = g_strdup (event->key.string);
- break;
-
case GDK_ENTER_NOTIFY:
case GDK_LEAVE_NOTIFY:
if (event->crossing.child_surface != NULL)
@@ -698,11 +693,6 @@ gdk_event_finalize (GObject *object)
switch ((guint) event->any.type)
{
- case GDK_KEY_PRESS:
- case GDK_KEY_RELEASE:
- g_free (event->key.string);
- break;
-
case GDK_ENTER_NOTIFY:
case GDK_LEAVE_NOTIFY:
g_clear_object (&event->crossing.child_surface);
diff --git a/gdk/gdkeventsprivate.h b/gdk/gdkeventsprivate.h
index f4d15507e7..e7e9cac515 100644
--- a/gdk/gdkeventsprivate.h
+++ b/gdk/gdkeventsprivate.h
@@ -244,18 +244,6 @@ struct _GdkEventScroll
* @keyval: the key that was pressed or released. See the
* `gdk/gdkkeysyms.h` header file for a
* complete list of GDK key codes.
- * @length: the length of @string.
- * @string: a string containing an approximation of the text that
- * would result from this keypress. The only correct way to handle text
- * input of text is using input methods (see #GtkIMContext), so this
- * field is deprecated and should never be used.
- * (gdk_unicode_to_keyval() provides a non-deprecated way of getting
- * an approximate translation for a key.) The string is encoded in the
- * encoding of the current locale (Note: this for backwards compatibility:
- * strings in GTK+ and GDK are typically in UTF-8.) and NUL-terminated.
- * In some cases, the translation of the key code will be a single
- * NUL byte, in which case looking at @length is necessary to distinguish
- * it from the an empty translation.
* @hardware_keycode: the raw code of the key that was pressed or released.
* @group: the keyboard group.
* @is_modifier: a flag that indicates if @hardware_keycode is mapped to a
@@ -269,8 +257,6 @@ struct _GdkEventKey
guint32 time;
guint state;
guint keyval;
- gint length;
- gchar *string;
guint16 hardware_keycode;
guint16 key_scancode;
guint8 group;
diff --git a/gdk/wayland/gdkdevice-wayland.c b/gdk/wayland/gdkdevice-wayland.c
index 2b7557a63f..f991f55ff3 100644
--- a/gdk/wayland/gdkdevice-wayland.c
+++ b/gdk/wayland/gdkdevice-wayland.c
@@ -2009,73 +2009,6 @@ keyboard_handle_leave (void *data,
static gboolean keyboard_repeat (gpointer data);
-static void
-translate_keyboard_string (GdkEventKey *event)
-{
- gunichar c = 0;
- gchar buf[7];
-
- /* Fill in event->string crudely, since various programs
- * depend on it.
- */
- event->string = NULL;
-
- if (event->keyval != GDK_KEY_VoidSymbol)
- c = gdk_keyval_to_unicode (event->keyval);
-
- if (c)
- {
- gsize bytes_written;
- gint len;
-
- /* Apply the control key - Taken from Xlib */
- if (event->state & GDK_CONTROL_MASK)
- {
- if ((c >= '@' && c < '\177') || c == ' ')
- c &= 0x1F;
- else if (c == '2')
- {
- event->string = g_memdup ("\0\0", 2);
- event->length = 1;
- buf[0] = '\0';
- return;
- }
- else if (c >= '3' && c <= '7')
- c -= ('3' - '\033');
- else if (c == '8')
- c = '\177';
- else if (c == '/')
- c = '_' & 0x1F;
- }
-
- len = g_unichar_to_utf8 (c, buf);
- buf[len] = '\0';
-
- event->string = g_locale_from_utf8 (buf, len,
- NULL, &bytes_written,
- NULL);
- if (event->string)
- event->length = bytes_written;
- }
- else if (event->keyval == GDK_KEY_Escape)
- {
- event->length = 1;
- event->string = g_strdup ("\033");
- }
- else if (event->keyval == GDK_KEY_Return ||
- event->keyval == GDK_KEY_KP_Enter)
- {
- event->length = 1;
- event->string = g_strdup ("\r");
- }
-
- if (!event->string)
- {
- event->length = 0;
- event->string = g_strdup ("");
- }
-}
-
static GSettings *
get_keyboard_settings (GdkWaylandSeat *seat)
{
@@ -2191,17 +2124,15 @@ deliver_key_event (GdkWaylandSeat *seat,
event->key.keyval = sym;
event->key.is_modifier = _gdk_wayland_keymap_key_is_modifier (keymap, key);
- translate_keyboard_string (&event->key);
-
_gdk_wayland_display_deliver_event (seat->display, event);
GDK_DISPLAY_NOTE (seat->display, EVENTS,
g_message ("keyboard %s event%s, code %d, sym %d, "
- "string %s, mods 0x%x",
+ "mods 0x%x",
(state ? "press" : "release"),
(from_key_repeat ? " (repeat)" : ""),
event->key.hardware_keycode, event->key.keyval,
- event->key.string, event->key.state));
+ event->key.state));
if (!xkb_keymap_key_repeats (xkb_keymap, key))
return;
diff --git a/gdk/x11/gdkdevicemanager-core-x11.c b/gdk/x11/gdkdevicemanager-core-x11.c
index f64b5551e5..305bec3d6f 100644
--- a/gdk/x11/gdkdevicemanager-core-x11.c
+++ b/gdk/x11/gdkdevicemanager-core-x11.c
@@ -221,8 +221,6 @@ translate_key_event (GdkDisplay *display,
event->key.is_modifier = gdk_x11_keymap_key_is_modifier (keymap, event->key.hardware_keycode);
- _gdk_x11_event_translate_keyboard_string (&event->key);
-
#ifdef G_ENABLE_DEBUG
if (GDK_DISPLAY_DEBUG_CHECK (display, EVENTS))
{
@@ -231,10 +229,6 @@ translate_key_event (GdkDisplay *display,
xevent->xkey.window,
event->key.keyval ? gdk_keyval_name (event->key.keyval) : "(none)",
event->key.keyval);
-
- if (event->key.length > 0)
- g_message ("\t\tlength: %4d string: \"%s\"",
- event->key.length, event->key.string);
}
#endif /* G_ENABLE_DEBUG */
return;
@@ -724,70 +718,6 @@ gdk_x11_device_manager_core_translate_event (GdkEventTranslator *translator,
return return_val;
}
-void
-_gdk_x11_event_translate_keyboard_string (GdkEventKey *event)
-{
- gunichar c = 0;
- gchar buf[7];
-
- /* Fill in event->string crudely, since various programs
- * depend on it.
- */
- event->string = NULL;
-
- if (event->keyval != GDK_KEY_VoidSymbol)
- c = gdk_keyval_to_unicode (event->keyval);
-
- if (c)
- {
- gsize bytes_written;
- gint len;
-
- /* Apply the control key - Taken from Xlib
- */
- if (event->state & GDK_CONTROL_MASK)
- {
- if ((c >= '@' && c < '\177') || c == ' ') c &= 0x1F;
- else if (c == '2')
- {
- event->string = g_memdup ("\0\0", 2);
- event->length = 1;
- buf[0] = '\0';
- return;
- }
- else if (c >= '3' && c <= '7') c -= ('3' - '\033');
- else if (c == '8') c = '\177';
- else if (c == '/') c = '_' & 0x1F;
- }
-
- len = g_unichar_to_utf8 (c, buf);
- buf[len] = '\0';
-
- event->string = g_locale_from_utf8 (buf, len,
- NULL, &bytes_written,
- NULL);
- if (event->string)
- event->length = bytes_written;
- }
- else if (event->keyval == GDK_KEY_Escape)
- {
- event->length = 1;
- event->string = g_strdup ("\033");
- }
- else if (event->keyval == GDK_KEY_Return ||
- event->keyval == GDK_KEY_KP_Enter)
- {
- event->length = 1;
- event->string = g_strdup ("\r");
- }
-
- if (!event->string)
- {
- event->length = 0;
- event->string = g_strdup ("");
- }
-}
-
/* We only care about focus events that indicate that _this_
* surface (not a ancestor or child) got or lost the focus
*/
diff --git a/gdk/x11/gdkdevicemanager-xi2.c b/gdk/x11/gdkdevicemanager-xi2.c
index 40e2c0296f..86ea47faa5 100644
--- a/gdk/x11/gdkdevicemanager-xi2.c
+++ b/gdk/x11/gdkdevicemanager-xi2.c
@@ -1471,8 +1471,6 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator,
_gdk_x11_keymap_add_virt_mods (keymap, &state);
event->key.state |= state;
- _gdk_x11_event_translate_keyboard_string (&event->key);
-
if (ev->evtype == XI_KeyPress)
set_user_time (event);
diff --git a/gdk/x11/gdkprivate-x11.h b/gdk/x11/gdkprivate-x11.h
index a609c4b93e..813fa81e1c 100644
--- a/gdk/x11/gdkprivate-x11.h
+++ b/gdk/x11/gdkprivate-x11.h
@@ -166,8 +166,6 @@ void gdk_x11_device_xi2_store_axes (GdkX11DeviceXI2 *device,
gint n_axes);
#endif
-void _gdk_x11_event_translate_keyboard_string (GdkEventKey *event);
-
GdkAtom _gdk_x11_display_manager_atom_intern (GdkDisplayManager *manager,
const gchar *atom_name,
gboolean copy_name);