after resizing the display, check if the window manager placed it

2000-04-15  Michael Natterer  <mitch@gimp.org>

	* app/gdisplay_ops.c (gdisplay_shrink_wrap): after resizing the
	display, check if the window manager placed it offscreen and
	center it in that case.
This commit is contained in:
Michael Natterer 2000-04-15 20:08:04 +00:00 committed by Michael Natterer
parent 554b9a344e
commit 89d3e0d8ef
3 changed files with 40 additions and 0 deletions

View File

@ -1,3 +1,9 @@
2000-04-15 Michael Natterer <mitch@gimp.org>
* app/gdisplay_ops.c (gdisplay_shrink_wrap): after resizing the
display, check if the window manager placed it offscreen and
center it in that case.
2000-04-15 Michael Natterer <mitch@gimp.org>
* app/disp_callbacks.c: s/0/FALSE/

View File

@ -151,6 +151,7 @@ gdisplay_shrink_wrap (GDisplay *gdisp)
GtkAllocation allocation;
gint disp_width, disp_height;
gint width, height;
gint shell_x, shell_y;
gint shell_width, shell_height;
gint max_auto_width, max_auto_height;
gint border_x, border_y;
@ -251,6 +252,22 @@ gdisplay_shrink_wrap (GDisplay *gdisp)
else
gdisplay_expose_full (gdisp);
/* let Gtk/X/WM position the window */
while (gtk_events_pending ())
gtk_main_iteration ();
gdk_window_get_origin (gdisp->shell->window, &shell_x, &shell_y);
/* if the window is offscreen, center it... */
if (shell_x > s_width || shell_y > s_height ||
(shell_x + width + border_x) < 0 || (shell_y + height + border_y) < 0)
{
shell_x = (s_width - width - border_x) >> 1;
shell_y = (s_height - height - border_y) >> 1;
gdk_window_move (gdisp->shell->window, shell_x, shell_y);
}
/* If the width or height of the display has changed, recalculate
* the display offsets...
*/

View File

@ -151,6 +151,7 @@ gdisplay_shrink_wrap (GDisplay *gdisp)
GtkAllocation allocation;
gint disp_width, disp_height;
gint width, height;
gint shell_x, shell_y;
gint shell_width, shell_height;
gint max_auto_width, max_auto_height;
gint border_x, border_y;
@ -251,6 +252,22 @@ gdisplay_shrink_wrap (GDisplay *gdisp)
else
gdisplay_expose_full (gdisp);
/* let Gtk/X/WM position the window */
while (gtk_events_pending ())
gtk_main_iteration ();
gdk_window_get_origin (gdisp->shell->window, &shell_x, &shell_y);
/* if the window is offscreen, center it... */
if (shell_x > s_width || shell_y > s_height ||
(shell_x + width + border_x) < 0 || (shell_y + height + border_y) < 0)
{
shell_x = (s_width - width - border_x) >> 1;
shell_y = (s_height - height - border_y) >> 1;
gdk_window_move (gdisp->shell->window, shell_x, shell_y);
}
/* If the width or height of the display has changed, recalculate
* the display offsets...
*/