summaryrefslogtreecommitdiff
path: root/ui/recent.c
diff options
context:
space:
mode:
authorGerald Combs <gerald@wireshark.org>2016-06-07 15:26:03 -0700
committerAnders Broman <a.broman58@gmail.com>2016-06-08 03:41:32 +0000
commit502335612c4c35a4bf7f19ffa7500ea1aac7d43f (patch)
tree8979d9cea502a7d18c4caccaf5d690e275522918 /ui/recent.c
parent73286c417eebe975edb24a024eb0230bbca29acc (diff)
downloadwireshark-502335612c4c35a4bf7f19ffa7500ea1aac7d43f.tar.gz
Use separate main geometry settings for Qt and GTK+.
Qt and GTK+ can have wildly different notions about the top-left position of the main window, particularly in multiple-screen configurations. For example, on OS X with the following monitor arrangment: g .---------. | | | | q--------.| | | |`---------' | | `--------' GTK+ positions windows relative to 'g' and Qt positions windows relative to 'q'. As a result it's easy for one UI to clobber the settings of the other. Split the geometry_main_x and geometry_main_y recent settings into Qt and GTK+ versions. In the Qt UI, try moving the main window onscreen before falling back to the default geometry. This keeps us from losing our size settings. Add a link to a Qt geometry bug. Change-Id: If7ae0dcc1719e646299ee3bbf1c88743f655c9a0 Ping-Bug: 12389 Reviewed-on: https://code.wireshark.org/review/15775 Reviewed-by: Gerald Combs <gerald@wireshark.org> Petri-Dish: Gerald Combs <gerald@wireshark.org> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'ui/recent.c')
-rw-r--r--ui/recent.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/ui/recent.c b/ui/recent.c
index 566acabbc8..4ea4bb1600 100644
--- a/ui/recent.c
+++ b/ui/recent.c
@@ -57,6 +57,8 @@
#define RECENT_GUI_BYTES_VIEW "gui.bytes_view"
#define RECENT_GUI_GEOMETRY_MAIN_X "gui.geometry_main_x"
#define RECENT_GUI_GEOMETRY_MAIN_Y "gui.geometry_main_y"
+#define RECENT_GUI_GTK_GEOMETRY_MAIN_X "gui.gtk.geometry_main_x"
+#define RECENT_GUI_GTK_GEOMETRY_MAIN_Y "gui.gtk.geometry_main_y"
#define RECENT_GUI_GEOMETRY_MAIN_WIDTH "gui.geometry_main_width"
#define RECENT_GUI_GEOMETRY_MAIN_HEIGHT "gui.geometry_main_height"
#define RECENT_GUI_GEOMETRY_MAIN_MAXIMIZED "gui.geometry_main_maximized"
@@ -650,6 +652,8 @@ write_recent(void)
fprintf(rf, "# Decimal numbers.\n");
fprintf(rf, RECENT_GUI_GEOMETRY_MAIN_X ": %d\n", recent.gui_geometry_main_x);
fprintf(rf, RECENT_GUI_GEOMETRY_MAIN_Y ": %d\n", recent.gui_geometry_main_y);
+ fprintf(rf, RECENT_GUI_GTK_GEOMETRY_MAIN_X ": %d\n", recent.gui_gtk_geometry_main_x);
+ fprintf(rf, RECENT_GUI_GTK_GEOMETRY_MAIN_Y ": %d\n", recent.gui_gtk_geometry_main_y);
fprintf(rf, RECENT_GUI_GEOMETRY_MAIN_WIDTH ": %d\n",
recent.gui_geometry_main_width);
fprintf(rf, RECENT_GUI_GEOMETRY_MAIN_HEIGHT ": %d\n",
@@ -878,6 +882,16 @@ read_set_recent_common_pair_static(gchar *key, const gchar *value,
if (p == value || *p != '\0')
return PREFS_SET_SYNTAX_ERR; /* number was bad */
recent.gui_geometry_main_y = (gint)num;
+ } else if (strcmp(key, RECENT_GUI_GTK_GEOMETRY_MAIN_X) == 0) {
+ num = strtol(value, &p, 0);
+ if (p == value || *p != '\0')
+ return PREFS_SET_SYNTAX_ERR; /* number was bad */
+ recent.gui_gtk_geometry_main_x = (gint)num;
+ } else if (strcmp(key, RECENT_GUI_GTK_GEOMETRY_MAIN_Y) == 0) {
+ num = strtol(value, &p, 0);
+ if (p == value || *p != '\0')
+ return PREFS_SET_SYNTAX_ERR; /* number was bad */
+ recent.gui_gtk_geometry_main_y = (gint)num;
} else if (strcmp(key, RECENT_GUI_GEOMETRY_MAIN_WIDTH) == 0) {
num = strtol(value, &p, 0);
if (p == value || *p != '\0')
@@ -1177,6 +1191,8 @@ recent_read_static(char **rf_path_return, int *rf_errno_return)
/* set defaults */
recent.gui_geometry_main_x = 20;
recent.gui_geometry_main_y = 20;
+ recent.gui_gtk_geometry_main_x = 20;
+ recent.gui_gtk_geometry_main_y = 20;
recent.gui_geometry_main_width = DEF_WIDTH;
recent.gui_geometry_main_height = DEF_HEIGHT;
recent.gui_geometry_main_maximized= FALSE;