Make sure we leave fullscreen mode if the window is hidden.

2008-02-14  Richard Hult  <richard@imendio.com>

	* gdk/quartz/gdkwindow-quartz.c: (get_fullscreen_geometry),
	(gdk_window_hide), (gdk_window_fullscreen),
	(gdk_window_unfullscreen): Make sure we leave fullscreen mode if
	the window is hidden.

svn path=/trunk/; revision=19567
This commit is contained in:
Richard Hult 2008-02-14 21:41:59 +00:00 committed by Richard Hult
parent 59687608aa
commit b9d88ac6e5
2 changed files with 51 additions and 28 deletions

View File

@ -1,3 +1,10 @@
2008-02-14 Richard Hult <richard@imendio.com>
* gdk/quartz/gdkwindow-quartz.c: (get_fullscreen_geometry),
(gdk_window_hide), (gdk_window_fullscreen),
(gdk_window_unfullscreen): Make sure we leave fullscreen mode if
the window is hidden.
2008-02-14 Richard Hult <richard@imendio.com> 2008-02-14 Richard Hult <richard@imendio.com>
* gdk/quartz/GdkQuartzWindow.c: Set frame, not bounds when * gdk/quartz/GdkQuartzWindow.c: Set frame, not bounds when

View File

@ -32,8 +32,20 @@ static guint update_idle;
static GSList *main_window_stack; static GSList *main_window_stack;
#define FULLSCREEN_DATA "fullscreen-data"
typedef struct
{
gint x, y;
gint width, height;
GdkWMDecoration decor;
} FullscreenSavedGeometry;
static void update_toplevel_order (void); static void update_toplevel_order (void);
static void clear_toplevel_order (void); static void clear_toplevel_order (void);
static FullscreenSavedGeometry *get_fullscreen_geometry (GdkWindow *window);
#define WINDOW_IS_TOPLEVEL(window) \ #define WINDOW_IS_TOPLEVEL(window) \
(GDK_WINDOW_TYPE (window) != GDK_WINDOW_CHILD && \ (GDK_WINDOW_TYPE (window) != GDK_WINDOW_CHILD && \
@ -1079,6 +1091,10 @@ gdk_window_hide (GdkWindow *window)
g_return_if_fail (GDK_IS_WINDOW (window)); g_return_if_fail (GDK_IS_WINDOW (window));
/* Make sure we're not stuck in fullscreen mode. */
if (get_fullscreen_geometry (window))
ShowMenuBar ();
if (GDK_WINDOW_DESTROYED (window)) if (GDK_WINDOW_DESTROYED (window))
return; return;
@ -2711,14 +2727,11 @@ gdk_window_deiconify (GdkWindow *window)
} }
} }
#define FULLSCREEN_DATA "fullscreen-data" static FullscreenSavedGeometry *
get_fullscreen_geometry (GdkWindow *window)
typedef struct
{ {
gint x, y; return g_object_get_data (G_OBJECT (window), FULLSCREEN_DATA);
gint width, height; }
GdkWMDecoration decor;
} FullscreenSavedGeometry;
void void
gdk_window_fullscreen (GdkWindow *window) gdk_window_fullscreen (GdkWindow *window)
@ -2731,29 +2744,33 @@ gdk_window_fullscreen (GdkWindow *window)
g_return_if_fail (GDK_IS_WINDOW (window)); g_return_if_fail (GDK_IS_WINDOW (window));
g_return_if_fail (WINDOW_IS_TOPLEVEL (window)); g_return_if_fail (WINDOW_IS_TOPLEVEL (window));
geometry = g_new (FullscreenSavedGeometry, 1); geometry = get_fullscreen_geometry (window);
if (!geometry)
{
geometry = g_new (FullscreenSavedGeometry, 1);
geometry->x = private->x; geometry->x = private->x;
geometry->y = private->y; geometry->y = private->y;
geometry->width = impl->width; geometry->width = impl->width;
geometry->height = impl->height; geometry->height = impl->height;
if (!gdk_window_get_decorations (window, &geometry->decor))
geometry->decor = GDK_DECOR_ALL;
g_object_set_data_full (G_OBJECT (window), if (!gdk_window_get_decorations (window, &geometry->decor))
FULLSCREEN_DATA, geometry, geometry->decor = GDK_DECOR_ALL;
g_free);
g_object_set_data_full (G_OBJECT (window),
FULLSCREEN_DATA, geometry,
g_free);
gdk_window_set_decorations (window, 0);
frame = [[NSScreen mainScreen] frame];
move_resize_window_internal (window,
0, 0,
frame.size.width, frame.size.height);
}
HideMenuBar (); HideMenuBar ();
gdk_window_set_decorations (window, 0);
frame = [[NSScreen mainScreen] frame];
move_resize_window_internal (window,
0, 0,
frame.size.width, frame.size.height);
gdk_synthesize_window_state (window, 0, GDK_WINDOW_STATE_FULLSCREEN); gdk_synthesize_window_state (window, 0, GDK_WINDOW_STATE_FULLSCREEN);
} }
@ -2765,8 +2782,7 @@ gdk_window_unfullscreen (GdkWindow *window)
g_return_if_fail (GDK_IS_WINDOW (window)); g_return_if_fail (GDK_IS_WINDOW (window));
g_return_if_fail (WINDOW_IS_TOPLEVEL (window)); g_return_if_fail (WINDOW_IS_TOPLEVEL (window));
geometry = g_object_get_data (G_OBJECT (window), FULLSCREEN_DATA); geometry = get_fullscreen_geometry (window);
if (geometry) if (geometry)
{ {
ShowMenuBar (); ShowMenuBar ();