diff options
author | myheroyuki <myheroyuki@outlook.com> | 2023-04-21 15:02:37 +0300 |
---|---|---|
committer | myheroyuki <myheroyuki@outlook.com> | 2023-04-21 15:02:37 +0300 |
commit | df4eed2e91ead65eaad52dd7210780223d200dc2 (patch) | |
tree | 5cde3be77db4550dd47ca74045c863e8c2496f81 | |
parent | e23491609add3b7206a36d640e277a10b44807e7 (diff) |
More work on rcw
-rw-r--r-- | plugins/vnc/vnc_plugin.c | 2 | ||||
-rw-r--r-- | src/rcw.c | 95 | ||||
-rw-r--r-- | src/remmina_ssh.c | 4 | ||||
-rw-r--r-- | src/remmina_ssh_plugin.c | 10 |
4 files changed, 57 insertions, 54 deletions
diff --git a/plugins/vnc/vnc_plugin.c b/plugins/vnc/vnc_plugin.c index 3b980aaea..7a183159c 100644 --- a/plugins/vnc/vnc_plugin.c +++ b/plugins/vnc/vnc_plugin.c @@ -1984,7 +1984,7 @@ static void remmina_plugin_vnc_init(RemminaProtocolWidget *gp) gpdata->drawing_area = gtk_drawing_area_new(); gtk_widget_show(gpdata->drawing_area); - gtk_container_add(GTK_CONTAINER(gp), gpdata->drawing_area); + gtk_box_append((gp), gpdata->drawing_area); // gtk_widget_add_events( // gpdata->drawing_area, @@ -552,7 +552,7 @@ static void rcw_keyboard_grab(RemminaConnectionWindow *cnnwin) // #else // GdkDeviceManager *manager; // #endif -// //GdkGrabStatus ggs; +// GdkGrabStatus ggs; // GdkDevice *keyboard = NULL; // if (cnnwin->priv->kbcaptured) { @@ -579,24 +579,24 @@ static void rcw_keyboard_grab(RemminaConnectionWindow *cnnwin) // #if DEBUG_KB_GRABBING // printf("DEBUG_KB_GRABBING: profile asks for grabbing, let’s try.\n"); // #endif - /* Up to GTK version 3.20 we can grab the keyboard with gdk_device_grab(). - * in GTK 3.20 gdk_seat_grab() should be used instead of gdk_device_grab(). - * There is a bug in GTK up to 3.22: When gdk_device_grab() fails - * the widget is hidden: - * https://gitlab.gnome.org/GNOME/gtk/commit/726ad5a5ae7c4f167e8dd454cd7c250821c400ab - * The bugfix will be released with GTK 3.24. - * Also please note that the newer gdk_seat_grab() is still calling gdk_device_grab(). - * - * Warning: gdk_seat_grab() will call XGrabKeyboard() or XIGrabDevice() - * which in turn will generate a core X input event FocusOut and FocusIn - * but not Xinput2 events. - * In some cases, GTK is unable to neutralize FocusIn and FocusOut core - * events (ie: i3wm+Plasma with GDK_CORE_DEVICE_EVENTS=1 because detail=NotifyNonlinear - * instead of detail=NotifyAncestor/detail=NotifyInferior) - * Receiving a FocusOut event for Remmina at this time will cause an infinite loop. - * Therefore is important for GTK to use Xinput2 instead of core X events - * by unsetting GDK_CORE_DEVICE_EVENTS - */ +// /* Up to GTK version 3.20 we can grab the keyboard with gdk_device_grab(). +// * in GTK 3.20 gdk_seat_grab() should be used instead of gdk_device_grab(). +// * There is a bug in GTK up to 3.22: When gdk_device_grab() fails +// * the widget is hidden: +// * https://gitlab.gnome.org/GNOME/gtk/commit/726ad5a5ae7c4f167e8dd454cd7c250821c400ab +// * The bugfix will be released with GTK 3.24. +// * Also please note that the newer gdk_seat_grab() is still calling gdk_device_grab(). +// * +// * Warning: gdk_seat_grab() will call XGrabKeyboard() or XIGrabDevice() +// * which in turn will generate a core X input event FocusOut and FocusIn +// * but not Xinput2 events. +// * In some cases, GTK is unable to neutralize FocusIn and FocusOut core +// * events (ie: i3wm+Plasma with GDK_CORE_DEVICE_EVENTS=1 because detail=NotifyNonlinear +// * instead of detail=NotifyAncestor/detail=NotifyInferior) +// * Receiving a FocusOut event for Remmina at this time will cause an infinite loop. +// * Therefore is important for GTK to use Xinput2 instead of core X events +// * by unsetting GDK_CORE_DEVICE_EVENTS +// */ // #if GTK_CHECK_VERSION(3, 20, 0) // ggs = gdk_seat_grab(seat, gtk_widget_get_window(GTK_WIDGET(cnnwin)), // GDK_SEAT_CAPABILITY_KEYBOARD, TRUE, NULL, NULL, NULL, NULL); @@ -623,7 +623,8 @@ static void rcw_keyboard_grab(RemminaConnectionWindow *cnnwin) // } // } else { // rcw_kp_ungrab(cnnwin); -// } //TODO GTK4 +// } +//TODO GTK4 } static void rcw_close_all_connections(RemminaConnectionWindow *cnnwin) @@ -938,7 +939,7 @@ static GtkWidget *rco_create_scrolled_container(RemminaScaleMode scalemode, int scrolled_container = gtk_scrolled_window_new(); rco_set_scrolled_policy(scalemode, GTK_SCROLLED_WINDOW(scrolled_container)); //gtk_container_set_border_width(GTK_CONTAINER(scrolled_container), 0); - gtk_widget_set_can_focus(scrolled_container, FALSE); + gtk_widget_set_focusable(scrolled_container, FALSE); } gtk_widget_set_name(scrolled_container, "remmina-scrolled-container"); @@ -958,9 +959,9 @@ gboolean rcw_toolbar_autofit_restore(RemminaConnectionWindow *cnnwin) cnnwin->priv->tar_eventsource = 0; - if (priv->toolbar_is_reconfiguring) + if (priv->toolbar_is_reconfiguring){ return G_SOURCE_REMOVE; - + } if (!(cnnobj = rcw_get_visible_cnnobj(cnnwin))) return FALSE; if (cnnobj->connected && GTK_IS_SCROLLED_WINDOW(cnnobj->scrolled_container)) { @@ -969,13 +970,15 @@ gboolean rcw_toolbar_autofit_restore(RemminaConnectionWindow *cnnwin) gtk_widget_get_allocation(cnnobj->scrolled_container, &ca); gtk_widget_get_allocation(priv->toolbar, &ta); if (remmina_pref.toolbar_placement == TOOLBAR_PLACEMENT_LEFT || - remmina_pref.toolbar_placement == TOOLBAR_PLACEMENT_RIGHT) + remmina_pref.toolbar_placement == TOOLBAR_PLACEMENT_RIGHT){ gtk_window_set_default_size(GTK_WINDOW(cnnobj->cnnwin), MAX(1, dwidth + ta.width + nba.width - ca.width), MAX(1, dheight + nba.height - ca.height)); - else + } + else{ + gtk_window_unmaximize(GTK_WINDOW(cnnobj->cnnwin)); gtk_window_set_default_size(GTK_WINDOW(cnnobj->cnnwin), MAX(1, dwidth + nba.width - ca.width), MAX(1, dheight + ta.height + nba.height - ca.height)); - //(GTK_CONTAINER(cnnobj->cnnwin)); + } } if (GTK_IS_SCROLLED_WINDOW(cnnobj->scrolled_container)) { RemminaScaleMode scalemode = get_current_allowed_scale_mode(cnnobj, NULL, NULL); @@ -989,14 +992,18 @@ static void rcw_toolbar_autofit(GtkWidget *toggle, RemminaConnectionWindow *cnnw { TRACE_CALL(__func__); RemminaConnectionObject *cnnobj; - - if (cnnwin->priv->toolbar_is_reconfiguring) + if (cnnwin->priv->toolbar_is_reconfiguring){ return; - if (!(cnnobj = rcw_get_visible_cnnobj(cnnwin))) return; + } + + if (!(cnnobj = rcw_get_visible_cnnobj(cnnwin))) { + return; + } if (GTK_IS_SCROLLED_WINDOW(cnnobj->scrolled_container)) { - // if ((gdk_window_get_state(gtk_widget_get_window(GTK_WIDGET(cnnwin))) & GDK_TOPLEVEL_STATE_MAXIMIZED) != 0) - // gtk_window_unmaximize(GTK_WINDOW(cnnwin)); TODO GTK4 + if (gtk_window_is_fullscreen(cnnwin)){ + gtk_window_unfullscreen(GTK_WINDOW(cnnwin)); //TODO GTK4 + } /* It’s tricky to make the toolbars disappear automatically, while keeping scrollable. * Please tell me if you know a better way to do this */ @@ -3721,7 +3728,7 @@ static void rcw_on_switch_page(GtkNotebook *notebook, GtkWidget *newpage, guint cnnobj_newpage = g_object_get_data(G_OBJECT(newpage), "cnnobj"); if (priv->spf_eventsourceid) g_source_remove(priv->spf_eventsourceid); - //priv->spf_eventsourceid = g_idle_add(rcw_on_switch_page_finalsel, cnnobj_newpage); + priv->spf_eventsourceid = g_idle_add(rcw_on_switch_page_finalsel, cnnobj_newpage); } static void rcw_on_page_added(GtkNotebook *notebook, GtkWidget *child, guint page_num, @@ -3818,8 +3825,7 @@ rcw_create_notebook(RemminaConnectionWindow *cnnwin) g_signal_connect(G_OBJECT(notebook), "switch-page", G_CALLBACK(rcw_on_switch_page), cnnwin); g_signal_connect(G_OBJECT(notebook), "page-added", G_CALLBACK(rcw_on_page_added), cnnwin); g_signal_connect(G_OBJECT(notebook), "page-removed", G_CALLBACK(rcw_on_page_removed), cnnwin); - gtk_widget_set_can_focus(GTK_WIDGET(notebook), FALSE); - + gtk_widget_set_focusable(GTK_WIDGET(notebook), FALSE); return notebook; } @@ -4071,16 +4077,17 @@ RemminaConnectionWindow *rcw_create_fullscreen(GtkWindow *old, gint view_mode) #if GTK_CHECK_VERSION(3, 22, 0) GtkNative* native = gtk_widget_get_native((GTK_WIDGET(cnnwin))); GdkSurface *window = gtk_native_get_surface(native); - old_window = window; - //old_display = gdk_window_get_display(old_window); - //old_monitor = gdk_display_get_monitor_at_window(old_display, old_window); - //n_monitors = gdk_display_get_n_monitors(old_display); - for (i = 0; i < n_monitors; ++i) { - // if (gdk_display_get_monitor(old_display, i) == old_monitor) { - // full_screen_target_monitor = i; - // break; - // } - } + // old_window = gtk_native_get_surface(gtk_widget_get_native(old)); + // old_display = gdk_surface_get_display(old_window); + // old_monitor = gdk_display_get_monitor_at_surface(old_display, old_window); + // GListModel* list = gdk_display_get_monitors(old_display); + // n_monitors = g_list_model_get_n_items(list);// ); gdk_display_get_n_monitors(old_display); + // for (i = 0; i < n_monitors; ++i) { + // if (g_list_model_get_item(list, i) == old_monitor) { + // full_screen_target_monitor = i; + // break; + // } + // } #else GtkNative* native = gtk_widget_get_native((GTK_WIDGET(cnnwin))); GdkSurface *window = gtk_native_get_surface(native); diff --git a/src/remmina_ssh.c b/src/remmina_ssh.c index 9dfac3483..2cd641e57 100644 --- a/src/remmina_ssh.c +++ b/src/remmina_ssh.c @@ -3038,8 +3038,8 @@ remmina_ssh_shell_thread(gpointer data) shell->thread = 0; - // if (shell->exit_callback) - // IDLE_ADD((GSourceFunc)remmina_ssh_call_exit_callback_on_main_thread, (gpointer)shell); + if (shell->exit_callback) + IDLE_ADD((GSourceFunc)remmina_ssh_call_exit_callback_on_main_thread, (gpointer)shell); return NULL; } diff --git a/src/remmina_ssh_plugin.c b/src/remmina_ssh_plugin.c index 1dd5654c4..e0ff7f7d2 100644 --- a/src/remmina_ssh_plugin.c +++ b/src/remmina_ssh_plugin.c @@ -975,21 +975,17 @@ remmina_plugin_ssh_init(RemminaProtocolWidget *gp) hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0); gtk_widget_show(hbox); - + GtkEventControllerFocus* focus_event_controller = gtk_event_controller_focus_new(); gtk_event_controller_set_propagation_phase(focus_event_controller, GTK_PHASE_BUBBLE); gtk_widget_add_controller(G_OBJECT(hbox), focus_event_controller); g_signal_connect(focus_event_controller, "enter", G_CALLBACK(remmina_plugin_ssh_on_focus_in), gp); - if (gtk_widget_get_can_focus(hbox)){ - REMMINA_DEBUG("can focus fine..."); - }else{ - REMMINA_DEBUG("here's our issue!"); - } vte = vte_terminal_new(); - //gtk_widget_show(vte); + + gtk_widget_set_hexpand(vte, TRUE); vte_terminal_set_size(VTE_TERMINAL(vte), 80, 25); vte_terminal_set_scroll_on_keystroke(VTE_TERMINAL(vte), TRUE); #if !VTE_CHECK_VERSION(0, 38, 0) |