@@ -158,6 +158,10 @@ typedef struct _RemminaConnectionObject {
158158 gboolean connected ;
159159 gboolean dynres_unlocked ;
160160
161+ /* The time of the GTK event which called remmina_connection_window_open_from_file_full().
162+ * Needed to make gtk_window_present_with_time() work under wayland */
163+ guint32 open_from_file_event_time ;
164+
161165} RemminaConnectionObject ;
162166
163167struct _RemminaConnectionHolder {
@@ -3574,6 +3578,14 @@ static RemminaConnectionWindow* remmina_connection_window_find(RemminaFile* remm
35743578 return REMMINA_CONNECTION_WINDOW (remmina_widget_pool_find (REMMINA_TYPE_CONNECTION_WINDOW , tag ));
35753579}
35763580
3581+ static gboolean remmina_connection_object_delayed_window_present (gpointer user_data )
3582+ {
3583+ RemminaConnectionObject * cnnobj = (RemminaConnectionObject * )user_data ;
3584+ if (cnnobj && cnnobj -> cnnhld && cnnobj -> cnnhld -> cnnwin )
3585+ gtk_window_present_with_time (GTK_WINDOW (cnnobj -> cnnhld -> cnnwin ), cnnobj -> open_from_file_event_time );
3586+ return FALSE;
3587+ }
3588+
35773589static void remmina_connection_object_on_connect (RemminaProtocolWidget * gp , RemminaConnectionObject * cnnobj )
35783590{
35793591 TRACE_CALL (__func__ );
@@ -3641,8 +3653,12 @@ static void remmina_connection_object_on_connect(RemminaProtocolWidget* gp, Remm
36413653 gtk_widget_reparent (cnnobj -> viewport , cnnobj -> scrolled_container );
36423654 G_GNUC_END_IGNORE_DEPRECATIONS
36433655
3644- gtk_window_present (GTK_WINDOW (cnnhld -> cnnwin ));
36453656 gtk_notebook_set_current_page (GTK_NOTEBOOK (cnnhld -> cnnwin -> priv -> notebook ), i );
3657+
3658+ /* Present the windows after a delay so GTK can realize and show its objects
3659+ * before calling gtk_window_present_with_time() */
3660+ g_timeout_add (200 , remmina_connection_object_delayed_window_present , (gpointer )cnnobj );
3661+
36463662 }
36473663
36483664#if FLOATING_TOOLBAR_WIDGET
@@ -3766,6 +3782,10 @@ GtkWidget* remmina_connection_window_open_from_file_full(RemminaFile* remminafil
37663782 cnnobj = g_new0 (RemminaConnectionObject , 1 );
37673783 cnnobj -> remmina_file = remminafile ;
37683784
3785+ /* Save the time of the event which caused the file open, so we can
3786+ * use gtk_window_present_with_time() later */
3787+ cnnobj -> open_from_file_event_time = gtk_get_current_event_time ();
3788+
37693789 /* Create the RemminaProtocolWidget */
37703790 protocolwidget = cnnobj -> proto = remmina_protocol_widget_new ();
37713791
0 commit comments