Commit d2b94a20 authored by Felipe Borges's avatar Felipe Borges 👣

frdp-display: Don't initialize frdp_session w/ display

Only when the client explicitly tries to connect.
parent f640ab38
......@@ -35,6 +35,12 @@ enum
PROP_SCALING
};
static gboolean
frdp_display_is_initialized (FrdpDisplay *self)
{
return self->priv->session != NULL;
}
static gboolean
frdp_display_key_press_event (GtkWidget *widget,
GdkEventKey *key)
......@@ -43,6 +49,9 @@ frdp_display_key_press_event (GtkWidget *widget,
guint16 keycode = key->hardware_keycode;
FrdpKeyEvent event;
if (!frdp_display_is_initialized (self))
return TRUE;
switch (key->type) {
case GDK_KEY_PRESS:
event = FRDP_KEY_EVENT_PRESS;
......@@ -66,6 +75,9 @@ frdp_display_motion_notify_event (GtkWidget *widget,
{
FrdpDisplay *self = FRDP_DISPLAY (widget);
if (!frdp_display_is_initialized (self))
return TRUE;
frdp_session_mouse_event (self->priv->session,
FRDP_MOUSE_EVENT_MOVE,
event->x,
......@@ -81,6 +93,9 @@ frdp_display_button_press_event (GtkWidget *widget,
FrdpDisplay *self = FRDP_DISPLAY (widget);
guint16 flags = 0;
if (!frdp_display_is_initialized (self))
return TRUE;
if ((event->button < 1) || (event->button > 3))
return FALSE;
......@@ -112,6 +127,9 @@ frdp_display_scroll_event (GtkWidget *widget,
FrdpDisplay *self = FRDP_DISPLAY (widget);
guint16 flags = FRDP_MOUSE_EVENT_WHEEL;
if (!frdp_display_is_initialized (self))
return TRUE;
switch (event->direction) {
case GDK_SCROLL_UP:
break;
......@@ -251,9 +269,6 @@ frdp_display_init (FrdpDisplay *self)
FrdpDisplayPrivate *priv;
self->priv = frdp_display_get_instance_private (self);
priv = self->priv;
priv->session = frdp_session_new (FRDP_DISPLAY (self));
gtk_widget_add_events (GTK_WIDGET (self),
GDK_POINTER_MOTION_MASK |
......@@ -264,6 +279,8 @@ frdp_display_init (FrdpDisplay *self)
GDK_KEY_PRESS_MASK);
gtk_widget_set_can_focus (GTK_WIDGET (self), TRUE);
self->priv->session = NULL;
}
void
......@@ -273,6 +290,8 @@ frdp_display_open_host (FrdpDisplay *self,
{
g_return_if_fail (host != NULL);
self->priv->session = frdp_session_new (self);
frdp_session_connect (self->priv->session,
host,
port,
......
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