Commit 62b2b5ec authored by Felipe Borges's avatar Felipe Borges 👣

frdp-display: Make sure we forward only valid key press events

parent e610e34b
...@@ -55,25 +55,22 @@ frdp_display_key_press_event (GtkWidget *widget, ...@@ -55,25 +55,22 @@ frdp_display_key_press_event (GtkWidget *widget,
{ {
FrdpDisplay *self = FRDP_DISPLAY (widget); FrdpDisplay *self = FRDP_DISPLAY (widget);
guint16 keycode = key->hardware_keycode; guint16 keycode = key->hardware_keycode;
FrdpKeyEvent event;
if (!frdp_display_is_initialized (self)) if (!frdp_display_is_initialized (self))
return TRUE; return TRUE;
switch (key->type) { switch (key->type) {
case GDK_KEY_PRESS: case GDK_KEY_PRESS:
event = FRDP_KEY_EVENT_PRESS; frdp_session_send_key (self->priv->session, FRDP_KEY_EVENT_PRESS, keycode);
break; break;
case GDK_KEY_RELEASE: case GDK_KEY_RELEASE:
event = FRDP_KEY_EVENT_RELEASE; frdp_session_send_key (self->priv->session, FRDP_KEY_EVENT_RELEASE, keycode);
break; break;
default: default:
g_warn_if_reached (); g_warn_if_reached ();
break; break;
} }
frdp_session_send_key (self->priv->session, event, keycode);
return TRUE; return TRUE;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment