diff options
author | Stephen Fisher <steve@stephen-fisher.com> | 2010-09-27 20:02:54 +0000 |
---|---|---|
committer | Stephen Fisher <steve@stephen-fisher.com> | 2010-09-27 20:02:54 +0000 |
commit | eb27557794d6318724df064f6e71c3f2de5382de (patch) | |
tree | d5c6547a2a030c8fef5e35e32a3e05f5a91ca802 /gtk/gui_utils.c | |
parent | 22475e4bce932b1815c0f9879939d41ef3336880 (diff) | |
download | wireshark-eb27557794d6318724df064f6e71c3f2de5382de.tar.gz |
Fix bug #553 by ensuring that the upper-left corner of Wireshark is within the viewable area of the monitor.
svn path=/trunk/; revision=34265
Diffstat (limited to 'gtk/gui_utils.c')
-rw-r--r-- | gtk/gui_utils.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/gtk/gui_utils.c b/gtk/gui_utils.c index 0b27737b73..836b656a02 100644 --- a/gtk/gui_utils.c +++ b/gtk/gui_utils.c @@ -331,9 +331,31 @@ window_get_geometry(GtkWidget *widget, window_geometry_t *geom) void window_set_geometry(GtkWidget *widget, window_geometry_t *geom) { + GdkScreen *default_screen; + GdkRectangle viewable_area; + gint monitor_num; + /* as we now have the geometry from the recent file, set it */ /* if the window was minimized, x and y are -32000 (at least on Win32) */ if (geom->set_pos && geom->x != -32000 && geom->y != -32000) { + /* Per Wireshark bug #553, GTK has a problem on MS Windows where + * the upper-left corner of the window may appear off screen when + * when a single desktop spans multiple monitors of different + * resolutions and positions relative to each other. + * + * If the requested (x,y) position isn't within the monitor's + * viewable area, change it to the viewable area's (0,0). */ + + default_screen = gdk_screen_get_default(); + monitor_num = gdk_screen_get_monitor_at_point(default_screen, geom->x, geom->y); + gdk_screen_get_monitor_geometry(default_screen, monitor_num, &viewable_area); + + if(geom->x < viewable_area.x || geom->x > viewable_area.width) + geom->x = viewable_area.x; + + if(geom->y < viewable_area.y || geom->y > viewable_area.height) + geom->y = viewable_area.y; + gtk_window_move(GTK_WINDOW(widget), geom->x, geom->y); |