Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/Remmina/Remmina.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormyheroyuki <myheroyuki@outlook.com>2023-04-19 14:35:06 +0300
committermyheroyuki <myheroyuki@outlook.com>2023-04-19 14:35:06 +0300
commite23491609add3b7206a36d640e277a10b44807e7 (patch)
treea46e935bc6a40f4539f9e2cf0ee36a7fcf89efe0
parentae347f813581062c800df328eb58986a35795e04 (diff)
More work to rcw, focus on ssh connections. Still very much a work in progress
-rw-r--r--src/rcw.c140
-rw-r--r--src/remmina_masterthread_exec.c2
-rw-r--r--src/remmina_message_panel.c15
-rw-r--r--src/remmina_protocol_widget.c24
-rw-r--r--src/remmina_ssh_plugin.c37
-rw-r--r--src/remmina_ssh_plugin.h2
6 files changed, 142 insertions, 78 deletions
diff --git a/src/rcw.c b/src/rcw.c
index 2850a5d05..1988fb8c3 100644
--- a/src/rcw.c
+++ b/src/rcw.c
@@ -352,9 +352,9 @@ static void rcw_class_init(RemminaConnectionWindowClass *klass)
, -1);
#endif
- // gtk_style_context_add_provider_for_screen(gdk_screen_get_default(),
- // GTK_STYLE_PROVIDER(provider),
- // GTK_STYLE_PROVIDER_PRIORITY_APPLICATION); TODO GTK4
+ gtk_style_context_add_provider_for_display(gdk_display_get_default(),
+ GTK_STYLE_PROVIDER(provider),
+ GTK_STYLE_PROVIDER_PRIORITY_APPLICATION); // TODO GTK4
g_object_unref(provider);
@@ -2809,7 +2809,7 @@ static gboolean rcw_floating_toolbar_on_leave(GtkEventController *event_controll
GdkEvent* event = gtk_event_controller_get_current_event(event_controller);
if (event == NULL){
return FALSE;
- }
+ } //TODO determine why nulls occur
if (gdk_crossing_event_get_detail(event) != GDK_NOTIFY_INFERIOR)
rcw_floating_toolbar_show(cnnwin, FALSE);
return TRUE;
@@ -3299,11 +3299,14 @@ static gboolean rcw_state_event(GtkWidget *widget, gpointer user_data)
return FALSE;
}
-static gboolean rcw_map_event(GtkWidget *widget, GdkEvent *event, gpointer data)
+static gboolean rcw_map_event(GdkSurface *surface, gpointer data)
{
TRACE_CALL(__func__);
-
+ GtkWidget* widget = gtk_native_get_for_surface(surface);
+ if (widget == NULL){
+ return FALSE;
+ }
RemminaConnectionWindow *cnnwin = (RemminaConnectionWindow *)widget;
RemminaConnectionObject *cnnobj;
@@ -3319,10 +3322,15 @@ static gboolean rcw_map_event(GtkWidget *widget, GdkEvent *event, gpointer data)
return FALSE;
}
-static gboolean rcw_unmap_event(GtkWidget *widget, GdkEvent *event, gpointer data)
+static gboolean rcw_unmap_event(GdkSurface *surface, gpointer data)
{
TRACE_CALL(__func__);
+ GtkWidget* widget = gtk_native_get_for_surface(surface);
+ if (widget == NULL){
+ return FALSE;
+ }
+
RemminaConnectionWindow *cnnwin = (RemminaConnectionWindow *)widget;
RemminaConnectionObject *cnnobj;
RemminaProtocolWidget *gp;
@@ -3337,7 +3345,7 @@ static gboolean rcw_unmap_event(GtkWidget *widget, GdkEvent *event, gpointer dat
return FALSE;
}
-static gboolean rcw_map_event_fullscreen(GtkWidget *widget, GdkEvent *event, gpointer data)
+static gboolean rcw_map_event_fullscreen(GtkWidget *widget, gpointer data)
{
TRACE_CALL(__func__);
RemminaConnectionObject *cnnobj;
@@ -3400,14 +3408,26 @@ static gboolean rcw_map_event_fullscreen(GtkWidget *widget, GdkEvent *event, gpo
void rcw_property_notification_check(GObject* self, GParamSpec* pspec, gpointer user_data)
{
REMMINA_DEBUG("rcw_property_notification_check %s", g_param_spec_get_name(pspec));
- //map-event
+ if (strcmp(g_param_spec_get_name(pspec), "mapped") == 0) {
+ GdkSurface* surface = GDK_SURFACE(self);
+ if (gdk_surface_get_mapped(surface)){
+ rcw_map_event(self, user_data);
+ }
+ else{
+ rcw_unmap_event(self, user_data);
+ }
+ }
+ if (strcmp(g_param_spec_get_name(pspec), "default-width") == 0 ||
+ strcmp(g_param_spec_get_name(pspec), "default-height") == 0 ||
+ strcmp(g_param_spec_get_name(pspec), "maximized") == 0 ||
+ strcmp(g_param_spec_get_name(pspec), "fullscreened")== 0) {
+ rcw_state_event(self, user_data);
+ rcw_on_configure(self, user_data);
+
+ }
+
//map-event (fullscreen)
- //unmap-event
- //delete-event
- //window-state-event
//configure-event
- //focus-in-event
- //focus-out-event
}
@@ -3422,19 +3442,17 @@ rcw_new(gboolean fullscreen, int full_screen_target_monitor)
if (fullscreen){
/* Put the window in fullscreen after it is mapped to have it appear on the same monitor */
- g_signal_connect(G_OBJECT(cnnwin), "notify", G_CALLBACK(rcw_map_event_fullscreen), GINT_TO_POINTER(full_screen_target_monitor));
+ g_signal_connect(G_OBJECT(cnnwin), "notify", G_CALLBACK(rcw_property_notification_check), GINT_TO_POINTER(full_screen_target_monitor));
}
else{
- //g_signal_connect(G_OBJECT(cnnwin), "notify", G_CALLBACK(rcw_map_event), NULL);
- g_signal_connect(G_OBJECT(cnnwin), "notify", G_CALLBACK(rcw_property_notification_check), NULL);
+ g_signal_connect(G_OBJECT(cnnwin), "notify", G_CALLBACK(rcw_property_notification_check), NULL);
}
- // g_signal_connect(G_OBJECT(cnnwin), "notify", G_CALLBACK(rcw_unmap_event), NULL);
//gtk_container_set_border_width(GTK_CONTAINER(cnnwin), 0);
- // g_signal_connect(G_OBJECT(cnnwin), "toolbar-place", G_CALLBACK(rcw_toolbar_place_signal), NULL);
+ g_signal_connect(G_OBJECT(cnnwin), "toolbar-place", G_CALLBACK(rcw_toolbar_place_signal), NULL);
- // g_signal_connect(G_OBJECT(cnnwin), "notify", G_CALLBACK(rcw_delete_event), NULL);
- // g_signal_connect(G_OBJECT(cnnwin), "destroy", G_CALLBACK(rcw_destroy), NULL);
+ g_signal_connect(G_OBJECT(cnnwin), "close-request", G_CALLBACK(rcw_delete_event), NULL);
+ g_signal_connect(G_OBJECT(cnnwin), "destroy", G_CALLBACK(rcw_destroy), NULL);
/* Under Xorg focus-in-event and focus-out-event don’t work when keyboard is grabbed
* via gdk_device_grab. So we listen for window-state-event to detect focus in and focus out.
@@ -3444,23 +3462,17 @@ rcw_new(gboolean fullscreen, int full_screen_target_monitor)
// g_signal_connect(G_OBJECT(cnnwin), "notify", G_CALLBACK(rcw_state_event), NULL);
GtkEventControllerFocus* focus_event_controller = gtk_event_controller_focus_new();
+ // gtk_event_controller_set_propagation_phase(focus_event_controller, GTK_PHASE_CAPTURE);
gtk_widget_add_controller(G_OBJECT(cnnwin), focus_event_controller);
g_signal_connect(focus_event_controller, "enter", G_CALLBACK(rcw_focus_in_event), cnnwin);
g_signal_connect(focus_event_controller, "leave", G_CALLBACK(rcw_focus_out_event), cnnwin);
- // g_signal_connect(G_OBJECT(cnnwin), "focus-in-event", G_CALLBACK(rcw_focus_in_event), NULL);
- // g_signal_connect(G_OBJECT(cnnwin), "focus-out-event", G_CALLBACK(rcw_focus_out_event), NULL);
GtkEventControllerMotion* motion_event_controller = gtk_event_controller_motion_new();
+ // gtk_event_controller_set_propagation_phase(motion_event_controller, GTK_PHASE_CAPTURE);
gtk_widget_add_controller(G_OBJECT(cnnwin), motion_event_controller);
g_signal_connect(motion_event_controller, "enter", G_CALLBACK(rcw_on_enter_notify_event), cnnwin);
g_signal_connect(motion_event_controller, "leave", G_CALLBACK(rcw_on_leave_notify_event), cnnwin);
-
- // g_signal_connect(G_OBJECT(cnnwin), "enter-notify-event", G_CALLBACK(rcw_on_enter_notify_event), NULL);
- // g_signal_connect(G_OBJECT(cnnwin), "leave-notify-event", G_CALLBACK(rcw_on_leave_notify_event), NULL);
-
-
- // g_signal_connect(G_OBJECT(cnnwin), "notify", G_CALLBACK(rcw_on_configure), NULL);
return cnnwin;
}
@@ -3823,6 +3835,7 @@ static RemminaConnectionWindow *rcw_create_scrolled(gint width, gint height, gbo
cnnwin = rcw_new(FALSE, 0);
gtk_widget_realize(GTK_WIDGET(cnnwin));
+ g_signal_connect(gtk_native_get_surface(cnnwin), "notify", G_CALLBACK(rcw_property_notification_check), NULL);
gtk_window_set_default_size(GTK_WINDOW(cnnwin), width, height);
g_object_set(settings, "gtk-application-prefer-dark-theme", remmina_pref.dark_theme, NULL);
@@ -3957,9 +3970,11 @@ static void rcw_create_overlay_ftb_overlay(RemminaConnectionWindow *cnnwin)
rcw_floating_toolbar_show(cnnwin, TRUE);
GtkEventControllerMotion* motion_event_controller = gtk_event_controller_motion_new();
+ // gtk_event_controller_set_propagation_phase(motion_event_controller, GTK_PHASE_CAPTURE);
gtk_widget_add_controller(G_OBJECT(priv->overlay_ftb_overlay), motion_event_controller);
GtkEventControllerScroll* scroll_event_controller = gtk_event_controller_scroll_new(GTK_EVENT_CONTROLLER_SCROLL_NONE);
+ // gtk_event_controller_set_propagation_phase(scroll_event_controller, GTK_PHASE_CAPTURE);
gtk_widget_add_controller(G_OBJECT(priv->overlay_ftb_overlay), scroll_event_controller);
g_signal_connect(motion_event_controller, "enter", G_CALLBACK(rcw_floating_toolbar_on_enter), cnnwin);
@@ -4078,6 +4093,7 @@ RemminaConnectionWindow *rcw_create_fullscreen(GtkWindow *old, gint view_mode)
cnnwin = rcw_new(TRUE, full_screen_target_monitor);
gtk_widget_set_name(GTK_WIDGET(cnnwin), "remmina-connection-window-fullscreen");
gtk_widget_realize(GTK_WIDGET(cnnwin));
+ g_signal_connect(gtk_native_get_surface(cnnwin), "notify", G_CALLBACK(rcw_property_notification_check), NULL);
if (!view_mode)
view_mode = VIEWPORT_FULLSCREEN_MODE;
@@ -4491,12 +4507,12 @@ static gboolean open_connection_last_stage(gpointer user_data)
return FALSE;
}
-static void rpw_size_allocated_on_connection(GtkWidget *w, GdkRectangle *allocation, gpointer user_data)
+static void rpw_size_allocated_on_connection(GtkWidget *w, gpointer user_data)
{
RemminaProtocolWidget *gp = (RemminaProtocolWidget *)w;
/* Disconnect signal handler to avoid to be called again after a normal resize */
- g_signal_handler_disconnect(w, gp->cnnobj->deferred_open_size_allocate_handler);
+ // g_signal_handler_disconnect(w, gp->cnnobj->deferred_open_size_allocate_handler);
/* Allow extra 100 ms for size allocation (do we really need it?) */
g_timeout_add(100, open_connection_last_stage, gp);
@@ -4677,6 +4693,7 @@ GtkWidget *rcw_open_from_file_full(RemminaFile *remminafile, GCallback disconnec
gtk_widget_show(cnnobj->proto);
GtkEventControllerMotion* motion_event_controller = gtk_event_controller_motion_new();
+ // gtk_event_controller_set_propagation_phase(motion_event_controller, GTK_PHASE_CAPTURE);
gtk_widget_add_controller(G_OBJECT(cnnobj->proto), motion_event_controller);
@@ -4759,8 +4776,10 @@ GtkWidget *rcw_open_from_file_full(RemminaFile *remminafile, GCallback disconnec
* we should wait for a size allocation from GTK for cnnobj->proto
* before connecting */
- // cnnobj->deferred_open_size_allocate_handler = g_signal_connect(G_OBJECT(cnnobj->proto), "size-allocate", G_CALLBACK(rpw_size_allocated_on_connection), NULL); TODO gtk4
+ //Seems to have changed in GTK4. Is it still necessary?
+ // cnnobj->deferred_open_size_allocate_handler = g_signal_connect(G_OBJECT(cnnobj->proto), "size-allocate", G_CALLBACK(rpw_size_allocated_on_connection), NULL);
+ rpw_size_allocated_on_connection(cnnobj->proto, NULL);
return cnnobj->proto;
}
@@ -4790,35 +4809,38 @@ void rco_destroy_message_panel(RemminaConnectionObject *cnnobj, RemminaMessagePa
RemminaMessagePanel *lastPanel;
gboolean was_visible;
GtkWidget *page;
-
+ GtkWidget* child;
page = nb_find_page_by_cnnobj(cnnobj->cnnwin->priv->notebook, cnnobj);
- // childs = gtk_container_get_children(GTK_CONTAINER(page));
- // cc = g_list_first(childs);
- // while (cc != NULL) {
- // if ((RemminaMessagePanel *)cc->data == mp)
- // break;
- // cc = g_list_next(cc);
- // }
- // g_list_free(childs);
- if (cc == NULL) {
+
+ child = gtk_widget_get_first_child(page);
+ while(child != NULL){
+ if ((RemminaMessagePanel *)child == mp){
+ break;
+ }
+ child = gtk_widget_get_next_sibling(child);
+ }
+
+ if (child == NULL) {
printf("Remmina: Warning. There was a request to destroy a RemminaMessagePanel that is not on the page\n");
return;
}
was_visible = gtk_widget_is_visible(GTK_WIDGET(mp));
- gtk_window_destroy(GTK_WIDGET(mp));
+ gtk_box_remove(page, (mp));
/* And now, show the last remaining message panel, if needed */
if (was_visible) {
- // childs = gtk_container_get_children(GTK_CONTAINER(page));
- // cc = g_list_first(childs);
- // lastPanel = NULL;
- // while (cc != NULL) {
- // if (G_TYPE_CHECK_INSTANCE_TYPE(cc->data, REMMINA_TYPE_MESSAGE_PANEL))
- // lastPanel = (RemminaMessagePanel *)cc->data;
- // cc = g_list_next(cc);
- // }
- // g_list_free(childs);
+
+
+ lastPanel = NULL;
+ child = gtk_widget_get_first_child(page);
+ while(child != NULL){
+ if (G_TYPE_CHECK_INSTANCE_TYPE(child, REMMINA_TYPE_MESSAGE_PANEL)){
+ lastPanel = child;
+ }
+ child = gtk_widget_get_next_sibling(child);
+ }
+
if (lastPanel)
gtk_widget_show(GTK_WIDGET(lastPanel));
}
@@ -4834,7 +4856,7 @@ void rco_show_message_panel(RemminaConnectionObject *cnnobj, RemminaMessagePanel
{
TRACE_CALL(__func__);
GList *childs, *cc;
- GtkWidget *page;
+ GtkWidget *page, *child;
/* Hides all RemminaMessagePanels childs of cnnobj->page */
page = nb_find_page_by_cnnobj(cnnobj->cnnwin->priv->notebook, cnnobj);
@@ -4847,12 +4869,20 @@ void rco_show_message_panel(RemminaConnectionObject *cnnobj, RemminaMessagePanel
// }
// g_list_free(childs);
+ child = gtk_widget_get_first_child(page);
+ while(child != NULL){
+ if (G_TYPE_CHECK_INSTANCE_TYPE(child, REMMINA_TYPE_MESSAGE_PANEL)){
+ gtk_widget_hide(child);
+ }
+ child = gtk_widget_get_next_sibling(child);
+ }
+
/* Add the new message panel at the top of cnnobj->page */
gtk_box_append(GTK_BOX(page), GTK_WIDGET(mp));
- //gtk_box_reorder_child(GTK_BOX(page), GTK_WIDGET(mp), 0);
+ gtk_box_reorder_child_after(GTK_BOX(page), GTK_WIDGET(mp), NULL);
/* Show the message panel */
- //gtk_widget_show_all(GTK_WIDGET(mp));
+ gtk_widget_show(GTK_WIDGET(mp));
/* Focus the correct field of the RemminaMessagePanel */
remmina_message_panel_focus_auth_entry(mp);
diff --git a/src/remmina_masterthread_exec.c b/src/remmina_masterthread_exec.c
index 6c1817eb5..b34326489 100644
--- a/src/remmina_masterthread_exec.c
+++ b/src/remmina_masterthread_exec.c
@@ -129,7 +129,7 @@ void remmina_masterthread_exec_and_wait(RemminaMTExecData *d)
pthread_cleanup_push(remmina_masterthread_exec_cleanup_handler, (void*)d);
pthread_mutex_init(&d->pt_mutex, NULL);
pthread_cond_init(&d->pt_cond, NULL);
- //gdk_threads_add_idle((GSourceFunc)remmina_masterthread_exec_callback, (gpointer)d);
+ g_idle_add((GSourceFunc)remmina_masterthread_exec_callback, (gpointer)d);
pthread_mutex_lock(&d->pt_mutex);
while (!d->complete)
pthread_cond_wait(&d->pt_cond, &d->pt_mutex);
diff --git a/src/remmina_message_panel.c b/src/remmina_message_panel.c
index 9305fbf7b..5dc0eb73f 100644
--- a/src/remmina_message_panel.c
+++ b/src/remmina_message_panel.c
@@ -93,6 +93,7 @@ RemminaMessagePanel *remmina_message_panel_new()
"orientation", GTK_ORIENTATION_VERTICAL,
"spacing", 0,
NULL);
+ // gtk_widget_set_size_request(mp, 0, 60);
priv = remmina_message_panel_get_instance_private(mp);
@@ -100,7 +101,7 @@ RemminaMessagePanel *remmina_message_panel_new()
priv->response_callback_data = NULL;
/* Set widget class, for CSS styling */
- // gtk_widget_set_name(GTK_WIDGET(mp), "remmina-cw-message-panel");
+ gtk_widget_set_name(GTK_WIDGET(mp), "remmina-cw-message-panel");
gtk_style_context_add_class(gtk_widget_get_style_context(GTK_WIDGET(mp)), "message_panel");
gtk_style_context_add_class(gtk_widget_get_style_context(GTK_WIDGET(mp)), "background");
@@ -133,7 +134,7 @@ void remmina_message_panel_setup_progress(RemminaMessagePanel *mp, const gchar *
*/
TRACE_CALL(__func__);
- GtkBox *hbox;
+ GtkCenterBox *hbox;
GtkWidget *w;
RemminaMessagePanelPrivate *priv = remmina_message_panel_get_instance_private(mp);
@@ -142,16 +143,16 @@ void remmina_message_panel_setup_progress(RemminaMessagePanel *mp, const gchar *
raise(SIGINT);
}
- hbox = GTK_BOX(gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0));
-
+ hbox = (gtk_center_box_new());
+ gtk_widget_set_hexpand(hbox, TRUE);
/* A spinner */
w = gtk_spinner_new();
- gtk_box_append(hbox, w);
+ gtk_center_box_set_start_widget(hbox, w);
gtk_spinner_start(GTK_SPINNER(w));
/* A message */
w = gtk_label_new(message);
- gtk_box_append(hbox, w);
+ gtk_center_box_set_center_widget(hbox, w);
priv->response_callback = response_callback;
priv->response_callback_data = response_callback_data;
@@ -160,7 +161,7 @@ void remmina_message_panel_setup_progress(RemminaMessagePanel *mp, const gchar *
* only when a response_callback function is defined. */
if (response_callback) {
w = gtk_button_new_with_label(_("Cancel"));
- gtk_box_append(hbox, w);
+ gtk_center_box_set_end_widget(hbox, w);
g_object_set_data(G_OBJECT(w), btn_response_key, (void *)GTK_RESPONSE_CANCEL);
g_signal_connect(G_OBJECT(w), "clicked", G_CALLBACK(remmina_message_panel_button_clicked_callback), mp);
}
diff --git a/src/remmina_protocol_widget.c b/src/remmina_protocol_widget.c
index 3adaaad4c..87e34a3d4 100644
--- a/src/remmina_protocol_widget.c
+++ b/src/remmina_protocol_widget.c
@@ -332,6 +332,7 @@ void remmina_protocol_widget_open_connection(RemminaProtocolWidget *gp)
s = g_strdup_printf(_("Connecting to “%s”…"), (name ? name : "*"));
mp = remmina_message_panel_new();
+ gtk_widget_set_hexpand(mp, TRUE);
remmina_message_panel_setup_progress(mp, s, cancel_open_connection_cb, gp);
g_free(s);
gp->priv->connect_message_panel = mp;
@@ -832,19 +833,26 @@ void remmina_protocol_widget_call_feature_by_ref(RemminaProtocolWidget *gp, cons
gp->priv->plugin->call_feature(gp, feature);
}
-static gboolean remmina_protocol_widget_on_key_press(GtkWidget *widget, GdkKeyEvent *event, RemminaProtocolWidget *gp)
+static gboolean remmina_protocol_widget_on_key_press(GtkEventControllerKey *self, guint keyval,
+ guint keycode,
+ GdkModifierType state,
+ RemminaProtocolWidget *gp)
{
TRACE_CALL(__func__);
if (gp->priv->hostkey_func)
- return gp->priv->hostkey_func(gp, gdk_key_event_get_keyval(event), FALSE);
+ return gp->priv->hostkey_func(gp, keyval, FALSE);
return FALSE;
}
-static gboolean remmina_protocol_widget_on_key_release(GtkWidget *widget, GdkKeyEvent *event, RemminaProtocolWidget *gp)
+static gboolean remmina_protocol_widget_on_key_release(GtkEventControllerKey* self,
+ guint keyval,
+ guint keycode,
+ GdkModifierType state,
+ RemminaProtocolWidget *gp)
{
TRACE_CALL(__func__);
if (gp->priv->hostkey_func)
- return gp->priv->hostkey_func(gp, gdk_key_event_get_keyval(event), TRUE);
+ return gp->priv->hostkey_func(gp, keyval, TRUE);
return FALSE;
}
@@ -852,8 +860,12 @@ static gboolean remmina_protocol_widget_on_key_release(GtkWidget *widget, GdkKey
void remmina_protocol_widget_register_hostkey(RemminaProtocolWidget *gp, GtkWidget *widget)
{
TRACE_CALL(__func__);
- g_signal_connect(G_OBJECT(widget), "key-press-event", G_CALLBACK(remmina_protocol_widget_on_key_press), gp);
- g_signal_connect(G_OBJECT(widget), "key-release-event", G_CALLBACK(remmina_protocol_widget_on_key_release), gp);
+
+ GtkEventControllerKey* key_event_controller = gtk_event_controller_key_new();
+ gtk_widget_add_controller(widget, key_event_controller);
+
+ g_signal_connect(key_event_controller, "key-pressed", G_CALLBACK(remmina_protocol_widget_on_key_press), gp);
+ g_signal_connect(key_event_controller, "key-released", G_CALLBACK(remmina_protocol_widget_on_key_release), gp);
}
void remmina_protocol_widget_set_hostkey_func(RemminaProtocolWidget *gp, RemminaHostkeyFunc func)
diff --git a/src/remmina_ssh_plugin.c b/src/remmina_ssh_plugin.c
index 16b33bfeb..1dd5654c4 100644
--- a/src/remmina_ssh_plugin.c
+++ b/src/remmina_ssh_plugin.c
@@ -436,7 +436,7 @@ void remmina_plugin_ssh_vte_terminal_set_encoding_and_pty(VteTerminal *terminal,
}
static gboolean
-remmina_plugin_ssh_on_focus_in(GtkWidget *widget, GdkFocusEvent *event, RemminaProtocolWidget *gp)
+remmina_plugin_ssh_on_focus_in(GtkWidget *widget, RemminaProtocolWidget *gp)
{
TRACE_CALL(__func__);
RemminaPluginSshData *gpdata = GET_PLUGIN_DATA(gp);
@@ -796,9 +796,13 @@ void remmina_plugin_ssh_call_sftp(RemminaProtocolWidget *gp)
}
gboolean
-remmina_ssh_plugin_popup_menu(GtkWidget *widget, GdkEvent *event, GtkWidget *menu)
+remmina_ssh_plugin_popup_menu(GtkGestureClick* self,
+ gint n_press,
+ gdouble x,
+ gdouble y,
+ gpointer menu)
{
-// if ((get_event_type(event) == GDK_BUTTON_PRESS) && (gdk_button_event_get_button((GdkButtonEvent *)event) == 3)) {
+ //if ((get_event_type(event) == GDK_BUTTON_PRESS) && (gdk_button_event_get_button((GdkButtonEvent *)event) == 3)) {
// #if GTK_CHECK_VERSION(3, 22, 0)
// gtk_menu_popup_at_pointer(GTK_MENU(menu), NULL);
// #else
@@ -806,7 +810,7 @@ remmina_ssh_plugin_popup_menu(GtkWidget *widget, GdkEvent *event, GtkWidget *men
// ((GdkEventButton *)event)->button, gtk_get_current_event_time());
// #endif
// return TRUE;
-// }
+ //} TODO GTK4
return FALSE;
}
@@ -849,7 +853,12 @@ void remmina_plugin_ssh_popup_ui(RemminaProtocolWidget *gp)
// gtk_menu_shell_append(GTK_MENU_SHELL(menu), find_text);
// gtk_menu_shell_append(GTK_MENU_SHELL(menu), sftp);
- g_signal_connect(G_OBJECT(gpdata->vte), "button_press_event",
+ GtkGesture* click_gesture = gtk_gesture_click_new();
+ // gtk_event_controller_set_propagation_phase (GTK_EVENT_CONTROLLER(click_gesture),
+ // GTK_PHASE_CAPTURE );
+ gtk_widget_add_controller(G_OBJECT(gpdata->vte), GTK_EVENT_CONTROLLER(click_gesture));
+
+ g_signal_connect(click_gesture, "pressed",
G_CALLBACK(remmina_ssh_plugin_popup_menu), menu);
g_signal_connect(G_OBJECT(select_all), "activate",
@@ -965,8 +974,19 @@ remmina_plugin_ssh_init(RemminaProtocolWidget *gp)
hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0);
gtk_widget_show(hbox);
- gtk_box_append(GTK_BOX(gp), hbox);
- g_signal_connect(G_OBJECT(hbox), "focus-in-event", G_CALLBACK(remmina_plugin_ssh_on_focus_in), gp);
+
+
+
+ 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);
@@ -1274,7 +1294,8 @@ remmina_plugin_ssh_init(RemminaProtocolWidget *gp)
g_signal_connect(G_OBJECT(vte), "eof", G_CALLBACK(remmina_plugin_ssh_eof), gp);
g_signal_connect(G_OBJECT(vte), "child-exited", G_CALLBACK(remmina_plugin_ssh_eof), gp);
remmina_plugin_ssh_popup_ui(gp);
- //gtk_widget_show_all(hbox);
+ gtk_box_append(GTK_BOX(gp), hbox);
+ gtk_widget_show(hbox);
}
/**
diff --git a/src/remmina_ssh_plugin.h b/src/remmina_ssh_plugin.h
index 1fab82094..002a8926a 100644
--- a/src/remmina_ssh_plugin.h
+++ b/src/remmina_ssh_plugin.h
@@ -61,7 +61,7 @@ void remmina_plugin_ssh_vte_copy_clipboard(gpointer vte);
void remmina_plugin_ssh_vte_paste_clipboard(gpointer vte);
void remmina_plugin_ssh_vte_decrease_font(gpointer vte);
void remmina_plugin_ssh_vte_increase_font(gpointer vte);
-gboolean remmina_ssh_plugin_popup_menu(GtkWidget *widget, GdkEvent *event, GtkWidget *menu);
+gboolean remmina_ssh_plugin_popup_menu(GtkGestureClick* self, gint n_press, gdouble x, gdouble y, gpointer menu);
#endif
G_END_DECLS