Skip to content

Commit

Permalink
Merge branch 'next' into kbcapture
Browse files Browse the repository at this point in the history
  • Loading branch information
giox069 committed Feb 11, 2017
2 parents 9efeb0b + 3bf2827 commit 99f452f
Show file tree
Hide file tree
Showing 13 changed files with 96 additions and 82 deletions.
24 changes: 11 additions & 13 deletions remmina/src/remmina_connection_window.c
Original file line number Diff line number Diff line change
Expand Up @@ -2929,11 +2929,17 @@ static gboolean remmina_connection_window_go_fullscreen(GtkWidget *widget, GdkEv
priv = cnnhld->cnnwin->priv;

#if GTK_CHECK_VERSION(3, 18, 0)
gtk_window_fullscreen_on_monitor(GTK_WINDOW(cnnhld->cnnwin),
gdk_screen_get_default (),
gdk_screen_get_monitor_at_window
(gdk_screen_get_default (), gtk_widget_get_window(GTK_WIDGET(cnnhld->cnnwin))
));
if (remmina_pref.fullscreen_on_auto)
{
gtk_window_fullscreen_on_monitor(GTK_WINDOW(cnnhld->cnnwin),
gdk_screen_get_default (),
gdk_screen_get_monitor_at_window
(gdk_screen_get_default (), gtk_widget_get_window(GTK_WIDGET(cnnhld->cnnwin))
));
} else {
remmina_log_print("Fullscreen managed by WM or by the user, as per settings");
gtk_window_fullscreen(GTK_WINDOW(cnnhld->cnnwin));
}
#else
remmina_log_print("Cannot fullscreen on a specific monitor, feature available from GTK 3.18");
gtk_window_fullscreen(GTK_WINDOW(cnnhld->cnnwin));
Expand Down Expand Up @@ -3275,19 +3281,11 @@ static gboolean remmina_connection_window_hostkey_func(RemminaProtocolWidget* gp

if (keyval == GDK_KEY_Up || keyval == GDK_KEY_Down) {
sz = gdk_window_get_height(gsvwin) + 2; // Add 2px of black scroll border
#if GTK_VERSION == 3
adj = gtk_scrollable_get_vadjustment(GTK_SCROLLABLE(child));
#elif GTK_VERSION == 2
adj = gtk_viewport_get_vadjustment(GTK_VIEWPORT(child));
#endif
}
else {
sz = gdk_window_get_width(gsvwin) + 2; // Add 2px of black scroll border
#if GTK_VERSION == 3
adj = gtk_scrollable_get_hadjustment(GTK_SCROLLABLE(child));
#elif GTK_VERSION == 2
adj = gtk_viewport_get_hadjustment(GTK_VIEWPORT(child));
#endif
}

if (keyval == GDK_KEY_Up || keyval == GDK_KEY_Left) {
Expand Down
27 changes: 21 additions & 6 deletions remmina/src/remmina_file.c
Original file line number Diff line number Diff line change
Expand Up @@ -486,31 +486,46 @@ remmina_file_dup(RemminaFile *remminafile)
void remmina_file_update_screen_resolution(RemminaFile *remminafile)
{
TRACE_CALL("remmina_file_update_screen_resolution");
#if GTK_VERSION == 3
GdkDisplay *display;
#if GTK_CHECK_VERSION(3, 20, 0)
/* TODO: rename to "seat" */
GdkSeat *seat;
GdkDevice *device;
#else
GdkDeviceManager *device_manager;
GdkDevice *device;
#endif
GdkScreen *screen;
#if GTK_CHECK_VERSION(3, 22, 0)
GdkMonitor *monitor;
#else
gint monitor;
#endif
gchar *pos;
gchar *resolution;
gint x, y;
gint monitor;
GdkRectangle rect;

resolution = g_strdup(remmina_file_get_string(remminafile, "resolution"));
if (resolution == NULL || strchr(resolution, 'x') == NULL)
{
#if GTK_VERSION == 3
display = gdk_display_get_default();
/* gdk_display_get_device_manager deprecated since 3.20, Use gdk_display_get_default_seat */
#if GTK_CHECK_VERSION(3, 20, 0)
seat = gdk_display_get_default_seat(display);
device = gdk_seat_get_pointer(seat);
#else
device_manager = gdk_display_get_device_manager(display);
device = gdk_device_manager_get_client_pointer(device_manager);
gdk_device_get_position(device, &screen, &x, &y);
#elif GTK_VERSION == 2
gdk_display_get_pointer(gdk_display_get_default(), &screen, &x, &y, NULL);
#endif
gdk_device_get_position(device, &screen, &x, &y);
#if GTK_CHECK_VERSION(3, 22, 0)
monitor = gdk_display_get_monitor_at_point(display, x, y);
gdk_monitor_get_geometry(monitor, &rect);
#else
monitor = gdk_screen_get_monitor_at_point(screen, x, y);
gdk_screen_get_monitor_geometry(screen, monitor, &rect);
#endif
remmina_file_set_int(remminafile, "resolution_width", rect.width);
remmina_file_set_int(remminafile, "resolution_height", rect.height);
}
Expand Down
17 changes: 5 additions & 12 deletions remmina/src/remmina_file_editor.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
* Remmina - The GTK+ Remote Desktop Client
* Copyright (C) 2009-2011 Vic Lee
* Copyright (C) 2014-2015 Antenore Gatta, Fabio Castelli, Giovanni Panozzo
* Copyright (C) 2016-2017 Antenore Gatta, Giovanni Panozzo
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -1419,12 +1420,9 @@ GtkWidget* remmina_file_editor_new_from_file(RemminaFile* remminafile)
priv->precommand_entry = widget;
cs = remmina_file_get_string(remminafile, "precommand");
gtk_entry_set_text(GTK_ENTRY(widget), cs ? cs : "");
if (!cs)
{
s = g_strdup_printf(_("A command or a script name/path."));
gtk_widget_set_tooltip_text (widget, s);
g_free(s);
}
s = g_strdup_printf(_("Script/command full path w/o arguments"));
gtk_widget_set_tooltip_text (widget, s);
g_free(s);

/* POST Connection Command */
widget = gtk_label_new(_("Post Command"));
Expand All @@ -1441,12 +1439,7 @@ GtkWidget* remmina_file_editor_new_from_file(RemminaFile* remminafile)
priv->postcommand_entry = widget;
cs = remmina_file_get_string(remminafile, "postcommand");
gtk_entry_set_text(GTK_ENTRY(widget), cs ? cs : "");
if (!cs)
{
s = g_strdup_printf(_("A command or a script name/path."));
gtk_widget_set_tooltip_text (widget, s);
g_free(s);
}
s = g_strdup_printf(_("Script/command full path w/o arguments"));

/* Create the Preference frame */
widget = gtk_event_box_new();
Expand Down
6 changes: 0 additions & 6 deletions remmina/src/remmina_ftp_client.c
Original file line number Diff line number Diff line change
Expand Up @@ -80,15 +80,9 @@ G_DEFINE_TYPE(RemminaCellRendererPixbuf, remmina_cell_renderer_pixbuf, GTK_TYPE_
static guint remmina_cell_renderer_pixbuf_signals[1] =
{ 0 };

#if GTK_VERSION == 2
static gboolean remmina_cell_renderer_pixbuf_activate(GtkCellRenderer *renderer, GdkEvent *event, GtkWidget *widget,
const gchar *path, GdkRectangle *background_area, GdkRectangle *cell_area,
GtkCellRendererState flags)
#elif GTK_VERSION == 3
static gboolean remmina_cell_renderer_pixbuf_activate(GtkCellRenderer *renderer, GdkEvent *event, GtkWidget *widget,
const gchar *path, const GdkRectangle *background_area, const GdkRectangle *cell_area,
GtkCellRendererState flags)
#endif
{
TRACE_CALL("remmina_cell_renderer_pixbuf_activate");
g_signal_emit(G_OBJECT(renderer), remmina_cell_renderer_pixbuf_signals[0], 0, path);
Expand Down
12 changes: 0 additions & 12 deletions remmina/src/remmina_init_dialog.c
Original file line number Diff line number Diff line change
Expand Up @@ -93,11 +93,7 @@ static void remmina_init_dialog_init(RemminaInitDialog *dialog)
/**** Create the dialog content from here ****/

/* Create top-level hbox */
#if GTK_VERSION == 3
hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 4);
#elif GTK_VERSION == 2
hbox = gtk_hbox_new(FALSE, 4);
#endif
gtk_widget_show(hbox);
gtk_container_set_border_width(GTK_CONTAINER(hbox), 15);
gtk_box_pack_start(GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dialog))), hbox, TRUE, TRUE, 0);
Expand All @@ -109,11 +105,7 @@ static void remmina_init_dialog_init(RemminaInitDialog *dialog)
dialog->image = widget;

/* Create vbox for other dialog content */
#if GTK_VERSION == 3
widget = gtk_box_new(GTK_ORIENTATION_VERTICAL, 4);
#elif GTK_VERSION == 2
widget = gtk_vbox_new(FALSE, 4);
#endif
gtk_widget_show(widget);
gtk_box_pack_start(GTK_BOX(hbox), widget, TRUE, TRUE, 4);
dialog->content_vbox = widget;
Expand Down Expand Up @@ -806,11 +798,7 @@ gint remmina_init_dialog_serverkey_confirm(RemminaInitDialog *dialog, const gcha
gtk_label_set_text(GTK_LABEL(dialog->status_label), (dialog->status ? dialog->status : dialog->title));

/* Create vbox */
#if GTK_VERSION == 3
vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 4);
#elif GTK_VERSION == 2
vbox = gtk_vbox_new(FALSE, 4);
#endif
gtk_widget_show(vbox);

/* Icon */
Expand Down
5 changes: 5 additions & 0 deletions remmina/src/remmina_pref.c
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,11 @@ void remmina_pref_init(void)
else
remmina_pref.invisible_toolbar = FALSE;

if (g_key_file_has_key(gkeyfile, "remmina_pref", "fullscreen_on_auto", NULL))
remmina_pref.fullscreen_on_auto = g_key_file_get_boolean(gkeyfile, "remmina_pref", "fullscreen_on_auto", NULL);
else
remmina_pref.fullscreen_on_auto = TRUE;

if (g_key_file_has_key(gkeyfile, "remmina_pref", "floating_toolbar_placement", NULL))
remmina_pref.floating_toolbar_placement = g_key_file_get_integer(gkeyfile, "remmina_pref", "floating_toolbar_placement", NULL);
else
Expand Down
1 change: 1 addition & 0 deletions remmina/src/remmina_pref.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ typedef struct _RemminaPref
gchar *keystrokes;
/* In RemminaPrefDialog appearance tab */
gboolean invisible_toolbar;
gboolean fullscreen_on_auto;
gboolean always_show_tab;
gboolean hide_connection_toolbar;
gint default_mode;
Expand Down
2 changes: 2 additions & 0 deletions remmina/src/remmina_pref_dialog.c
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ void remmina_pref_on_dialog_destroy(GtkWidget *widget, gpointer user_data)
remmina_pref.save_view_mode = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(remmina_pref_dialog->checkbutton_options_remember_last_view_mode));
remmina_pref.save_when_connect = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(remmina_pref_dialog->checkbutton_options_save_settings));
remmina_pref.invisible_toolbar = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(remmina_pref_dialog->checkbutton_appearance_invisible_toolbar));
remmina_pref.fullscreen_on_auto = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(remmina_pref_dialog->checkbutton_appearance_fullscreen_on_auto));
remmina_pref.always_show_tab = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(remmina_pref_dialog->checkbutton_appearance_show_tabs));
remmina_pref.hide_connection_toolbar = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(remmina_pref_dialog->checkbutton_appearance_hide_toolbar));

Expand Down Expand Up @@ -394,6 +395,7 @@ GtkDialog* remmina_pref_dialog_new(gint default_tab, GtkWindow *parent)
remmina_pref_dialog->checkbutton_options_remember_last_view_mode = GTK_CHECK_BUTTON(GET_OBJECT("checkbutton_options_remember_last_view_mode"));
remmina_pref_dialog->checkbutton_options_save_settings = GTK_CHECK_BUTTON(GET_OBJECT("checkbutton_options_save_settings"));
remmina_pref_dialog->checkbutton_appearance_invisible_toolbar = GTK_CHECK_BUTTON(GET_OBJECT("checkbutton_appearance_invisible_toolbar"));
remmina_pref_dialog->checkbutton_appearance_fullscreen_on_auto = GTK_CHECK_BUTTON(GET_OBJECT("checkbutton_appearance_fullscreen_on_auto"));
remmina_pref_dialog->checkbutton_appearance_show_tabs = GTK_CHECK_BUTTON(GET_OBJECT("checkbutton_appearance_show_tabs"));
remmina_pref_dialog->checkbutton_appearance_hide_toolbar = GTK_CHECK_BUTTON(GET_OBJECT("checkbutton_appearance_hide_toolbar"));
remmina_pref_dialog->comboboxtext_options_double_click = GTK_COMBO_BOX(GET_OBJECT("comboboxtext_options_double_click"));
Expand Down
1 change: 1 addition & 0 deletions remmina/src/remmina_pref_dialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ typedef struct _RemminaPrefDialog
GtkCheckButton *checkbutton_options_remember_last_view_mode;
GtkCheckButton *checkbutton_options_save_settings;
GtkCheckButton *checkbutton_appearance_invisible_toolbar;
GtkCheckButton *checkbutton_appearance_fullscreen_on_auto;
GtkCheckButton *checkbutton_appearance_show_tabs;
GtkCheckButton *checkbutton_appearance_hide_toolbar;
GtkComboBox *comboboxtext_options_double_click;
Expand Down
8 changes: 0 additions & 8 deletions remmina/src/remmina_scrolled_viewport.c
Original file line number Diff line number Diff line change
Expand Up @@ -109,23 +109,15 @@ static gboolean remmina_scrolled_viewport_motion_timeout(gpointer data)
if (mx != 0)
{
gint step = MAX(10, MIN(remmina_pref.auto_scroll_step, w / 5));
#if GTK_VERSION == 3
adj = gtk_scrollable_get_hadjustment(GTK_SCROLLABLE(child));
#elif GTK_VERSION == 2
adj = gtk_viewport_get_hadjustment(GTK_VIEWPORT(child));
#endif
value = gtk_adjustment_get_value(GTK_ADJUSTMENT(adj)) + (gdouble)(mx * step);
value = MAX(0, MIN(value, gtk_adjustment_get_upper(GTK_ADJUSTMENT(adj)) - (gdouble) w + 2.0));
gtk_adjustment_set_value(GTK_ADJUSTMENT(adj), value);
}
if (my != 0)
{
gint step = MAX(10, MIN(remmina_pref.auto_scroll_step, h / 5));
#if GTK_VERSION == 3
adj = gtk_scrollable_get_vadjustment(GTK_SCROLLABLE(child));
#elif GTK_VERSION == 2
adj = gtk_viewport_get_vadjustment(GTK_VIEWPORT(child));
#endif
value = gtk_adjustment_get_value(GTK_ADJUSTMENT(adj)) + (gdouble)(my * step);
value = MAX(0, MIN(value, gtk_adjustment_get_upper(GTK_ADJUSTMENT(adj)) - (gdouble) h + 2.0));
gtk_adjustment_set_value(GTK_ADJUSTMENT(adj), value);
Expand Down
8 changes: 0 additions & 8 deletions remmina/src/remmina_sftp_client.c
Original file line number Diff line number Diff line change
Expand Up @@ -1007,11 +1007,7 @@ remmina_sftp_client_confirm_resume (RemminaSFTPClient *client, const gchar *path
NULL);
gtk_container_set_border_width (GTK_CONTAINER (dialog), 4);

#if GTK_VERSION == 3
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 4);
#elif GTK_VERSION == 2
hbox = gtk_hbox_new (FALSE, 4);
#endif
gtk_widget_show(hbox);
gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG(dialog))),
hbox, TRUE, TRUE, 4);
Expand All @@ -1020,11 +1016,7 @@ remmina_sftp_client_confirm_resume (RemminaSFTPClient *client, const gchar *path
gtk_widget_show(widget);
gtk_box_pack_start (GTK_BOX (hbox), widget, TRUE, TRUE, 4);

#if GTK_VERSION == 3
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 4);
#elif GTK_VERSION == 2
vbox = gtk_vbox_new (FALSE, 4);
#endif
gtk_widget_show(vbox);
gtk_box_pack_start (GTK_BOX (hbox), vbox, TRUE, TRUE, 4);

Expand Down
11 changes: 8 additions & 3 deletions remmina/ui/remmina_main.glade
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.19.0
<!-- Generated with glade 3.20.0
Remmina - The GTK+ Remmina Remote Desktop Client
Copyright (C) Antenore Gatta & Giovanni Panozzo 2014-2016
Copyright (C) Antenore Gatta & Giovanni Panozzo 2014-2017
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
Expand All @@ -24,7 +24,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
<!-- interface-license-type gplv2 -->
<!-- interface-name Remmina -->
<!-- interface-description The GTK+ Remmina Remote Desktop Client -->
<!-- interface-copyright Antenore Gatta & Giovanni Panozzo 2014-2016 -->
<!-- interface-copyright Antenore Gatta & Giovanni Panozzo 2014-2017 -->
<object class="GtkAccelGroup" id="accelgroup_shortcuts"/>
<object class="GtkActionGroup" id="actiongroup_application">
<property name="accel_group">accelgroup_shortcuts</property>
Expand Down Expand Up @@ -286,6 +286,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
<property name="width_chars">25</property>
<property name="primary_icon_stock">gtk-connect</property>
<property name="secondary_icon_stock">gtk-clear</property>
<property name="primary_icon_tooltip_text" translatable="yes">Server name or IP address</property>
<property name="secondary_icon_tooltip_text" translatable="yes">Clear</property>
<property name="completion">entrycompletion</property>
<property name="input_hints">GTK_INPUT_HINT_WORD_COMPLETION | GTK_INPUT_HINT_NONE</property>
<signal name="activate" handler="remmina_main_quickconnect_on_click" swapped="no"/>
Expand Down Expand Up @@ -706,5 +708,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
</child>
</object>
</child>
<child type="titlebar">
<placeholder/>
</child>
</object>
</interface>
Loading

0 comments on commit 99f452f

Please sign in to comment.