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-08-02 14:58:45 +0300
committermyheroyuki <myheroyuki@outlook.com>2023-08-02 14:58:45 +0300
commit00aa57e32ca66e65df0434f73eabfc7ee971cf6d (patch)
tree258685823da46099a90803ce698300cc34d696c8
parent245acc4172f6121f8fc855f0a332c6029d86cbaa (diff)
Updates to fix scale mode in RDP
-rw-r--r--plugins/rdp/rdp_event.c64
-rw-r--r--src/rcw.c6
-rw-r--r--src/remmina_protocol_widget.c4
3 files changed, 39 insertions, 35 deletions
diff --git a/plugins/rdp/rdp_event.c b/plugins/rdp/rdp_event.c
index 153c6dd7e..9919831bd 100644
--- a/plugins/rdp/rdp_event.c
+++ b/plugins/rdp/rdp_event.c
@@ -101,7 +101,7 @@ gboolean remmina_rdp_event_on_unmap(RemminaProtocolWidget *gp)
return FALSE;
}
-static gboolean remmina_rdp_event_on_focus_in(GtkWidget *widget, RemminaProtocolWidget *gp)
+static gboolean remmina_rdp_event_on_focus_in(GtkEventControllerFocus *widget, RemminaProtocolWidget *gp)
{
TRACE_CALL(__func__);
@@ -132,7 +132,7 @@ static gboolean remmina_rdp_event_on_focus_in(GtkWidget *widget, RemminaProtocol
manager = gdk_display_get_device_manager(gdk_display_get_default());
keyboard = gdk_device_manager_get_client_pointer(manager);
#endif
- GtkNative* native = gtk_widget_get_native((GTK_WIDGET(widget)));
+ GtkNative* native = gtk_widget_get_native((GTK_WIDGET(rfi->drawing_area)));
GdkSurface *surface = gtk_native_get_surface(native);
gdk_surface_get_device_position(surface, keyboard, NULL, NULL, &state);
@@ -234,6 +234,36 @@ static void keypress_list_add(RemminaProtocolWidget *gp, RemminaPluginRdpEvent r
g_array_append_val(rfi->pressed_keys, rdp_event);
}
+static void remmina_rdp_event_update_scale_factor(RemminaProtocolWidget *gp)
+{
+ TRACE_CALL(__func__);
+ GtkAllocation a;
+ gint rdwidth, rdheight;
+ gint gpwidth, gpheight;
+ rfContext *rfi = GET_PLUGIN_DATA(gp);
+
+ gtk_widget_get_allocation((gp), &a);
+ gpwidth = a.width;
+ gpheight = a.height;
+
+ if (rfi->scale == REMMINA_PROTOCOL_WIDGET_SCALE_MODE_SCALED) {
+ if ((gpwidth > 1) && (gpheight > 1)) {
+ rdwidth = remmina_plugin_service->protocol_plugin_get_width(gp);
+ rdheight = remmina_plugin_service->protocol_plugin_get_height(gp);
+
+ rfi->scale_width = gpwidth;
+ rfi->scale_height = gpheight;
+
+ rfi->scale_x = (gdouble)rfi->scale_width / (gdouble)rdwidth;
+ rfi->scale_y = (gdouble)rfi->scale_height / (gdouble)rdheight;
+ }
+ } else {
+ rfi->scale_width = 0;
+ rfi->scale_height = 0;
+ rfi->scale_x = 0;
+ rfi->scale_y = 0;
+ }
+}
static void remmina_rdp_event_scale_area(RemminaProtocolWidget *gp, gint *x, gint *y, gint *w, gint *h)
{
@@ -250,6 +280,7 @@ static void remmina_rdp_event_scale_area(RemminaProtocolWidget *gp, gint *x, gin
if ((width == 0) || (height == 0))
return;
+ remmina_rdp_event_update_scale_factor(gp);
if ((rfi->scale_width == width) && (rfi->scale_height == height)) {
/* Same size, just copy the pixels */
@@ -311,36 +342,7 @@ void remmina_rdp_event_update_rect(RemminaProtocolWidget *gp, gint x, gint y, gi
gtk_widget_queue_draw(rfi->drawing_area);
}
-static void remmina_rdp_event_update_scale_factor(RemminaProtocolWidget *gp)
-{
- TRACE_CALL(__func__);
- GtkAllocation a;
- gint rdwidth, rdheight;
- gint gpwidth, gpheight;
- rfContext *rfi = GET_PLUGIN_DATA(gp);
- gtk_widget_get_allocation(GTK_WIDGET(gp), &a);
- gpwidth = a.width;
- gpheight = a.height;
-
- if (rfi->scale == REMMINA_PROTOCOL_WIDGET_SCALE_MODE_SCALED) {
- if ((gpwidth > 1) && (gpheight > 1)) {
- rdwidth = remmina_plugin_service->protocol_plugin_get_width(gp);
- rdheight = remmina_plugin_service->protocol_plugin_get_height(gp);
-
- rfi->scale_width = gpwidth;
- rfi->scale_height = gpheight;
-
- rfi->scale_x = (gdouble)rfi->scale_width / (gdouble)rdwidth;
- rfi->scale_y = (gdouble)rfi->scale_height / (gdouble)rdheight;
- }
- } else {
- rfi->scale_width = 0;
- rfi->scale_height = 0;
- rfi->scale_x = 0;
- rfi->scale_y = 0;
- }
-}
static gboolean remmina_rdp_event_on_draw(GtkWidget *widget, cairo_t *context, int width, int height, RemminaProtocolWidget *gp)
{
diff --git a/src/rcw.c b/src/rcw.c
index 32167dc29..4bd990050 100644
--- a/src/rcw.c
+++ b/src/rcw.c
@@ -3373,7 +3373,7 @@ static void rcw_init(RemminaConnectionWindow *cnnwin)
remmina_widget_pool_register(GTK_WIDGET(cnnwin));
}
-static gboolean rcw_focus_in_event(GtkWidget *widget, gpointer user_data)
+static gboolean rcw_focus_in_event(GtkEventControllerFocus *widget, gpointer user_data)
{
TRACE_CALL(__func__);
#if DEBUG_KB_GRABBING
@@ -3383,7 +3383,7 @@ static gboolean rcw_focus_in_event(GtkWidget *widget, gpointer user_data)
return FALSE;
}
-static gboolean rcw_focus_out_event(GtkWidget *widget, gpointer user_data)
+static gboolean rcw_focus_out_event(GtkEventControllerFocus *widget, gpointer user_data)
{
TRACE_CALL(__func__);
#if DEBUG_KB_GRABBING
@@ -4717,6 +4717,8 @@ GtkWidget *rcw_open_from_file_full(RemminaFile *remminafile, GCallback disconnec
/* Create the RemminaProtocolWidget */
cnnobj->proto = remmina_protocol_widget_new();
+ gtk_widget_set_hexpand(cnnobj->proto, TRUE);
+ gtk_widget_set_vexpand(cnnobj->proto, TRUE);
remmina_protocol_widget_setup((RemminaProtocolWidget *)cnnobj->proto, remminafile, cnnobj);
if (remmina_protocol_widget_has_error((RemminaProtocolWidget *)cnnobj->proto)) {
GtkWindow *wparent;
diff --git a/src/remmina_protocol_widget.c b/src/remmina_protocol_widget.c
index 59c4af119..652bf4906 100644
--- a/src/remmina_protocol_widget.c
+++ b/src/remmina_protocol_widget.c
@@ -2130,7 +2130,7 @@ void remmina_protocol_widget_send_keys_signals(GtkWidget *widget, const guint *k
// event.hardware_keycode = remmina_public_get_keycode_for_keyval(display, event.keyval);
// event.is_modifier = (int)remmina_public_get_modifier_for_keycode(display, event.hardware_keycode);
// REMMINA_DEBUG("Sending keyval: %u, hardware_keycode: %u", event.keyval, event.hardware_keycode);
- g_signal_emit_by_name(G_OBJECT(widget), "key-press-event", &event, &result);
+ //g_signal_emit_by_name(G_OBJECT(widget), "key-press-event", &event, &result);
}
}
@@ -2141,7 +2141,7 @@ void remmina_protocol_widget_send_keys_signals(GtkWidget *widget, const guint *k
// event.keyval = keyvals[i];
// event.hardware_keycode = remmina_public_get_keycode_for_keyval(keymap, event.keyval);
// event.is_modifier = (int)remmina_public_get_modifier_for_keycode(keymap, event.hardware_keycode);
- g_signal_emit_by_name(G_OBJECT(widget), "key-release-event", &event, &result);
+ //g_signal_emit_by_name(G_OBJECT(widget), "key-release-event", &event, &result);
}
} //TODO GTK4 figure out immutable events
}