mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-09 18:30:08 +00:00
Add private accessor for GdkKeyEvent.translated
Avoid accessing the event structure directly, even from within GTK.
This commit is contained in:
parent
be8fc8f26b
commit
0cf5b66e7b
@ -1466,6 +1466,32 @@ gdk_key_event_new (GdkEventType type,
|
||||
return event;
|
||||
}
|
||||
|
||||
/*< private >
|
||||
* gdk_key_event_get_translated_key:
|
||||
* @event: (type GdkKeyEvent): a key event
|
||||
* @no_lock: whether the translated key should take the event
|
||||
* state into account
|
||||
*
|
||||
* Extracts the translated key from a key event.
|
||||
*
|
||||
* Returns: (transfer none): the translated key
|
||||
*/
|
||||
GdkTranslatedKey *
|
||||
gdk_key_event_get_translated_key (GdkEvent *event,
|
||||
gboolean no_lock)
|
||||
{
|
||||
GdkKeyEvent *self = (GdkKeyEvent *) event;
|
||||
|
||||
g_return_val_if_fail (GDK_IS_EVENT (event), NULL);
|
||||
g_return_val_if_fail (GDK_IS_EVENT_TYPE (event, GDK_KEY_PRESS) ||
|
||||
GDK_IS_EVENT_TYPE (event, GDK_KEY_RELEASE), NULL);
|
||||
|
||||
if (no_lock)
|
||||
return &(self->translated[1]);
|
||||
|
||||
return &(self->translated[0]);
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_key_event_get_keyval:
|
||||
* @event: (type GdkKeyEvent): a key event
|
||||
|
@ -612,6 +612,9 @@ GdkEvent * gdk_grab_broken_event_new (GdkSurface *surface,
|
||||
GdkSurface *grab_surface,
|
||||
gboolean implicit);
|
||||
|
||||
GdkTranslatedKey * gdk_key_event_get_translated_key (GdkEvent *event,
|
||||
gboolean no_lock);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GDK_EVENTS_PRIVATE_H__ */
|
||||
|
Loading…
Reference in New Issue
Block a user