Commit ecfa5393 authored by Richard Hult's avatar Richard Hult Committed by Richard Hult

Patch from Stefan Gehn to implement those, bug #459667.

2007-08-30  Richard Hult  <richard@imendio.com>

	* gdk/quartz/gdkwindow-quartz.c: (gdk_window_set_keep_above,
	gdk_window_set_keep_below): Patch from Stefan Gehn to implement
	those, bug #459667.

svn path=/trunk/; revision=18703
parent af1b34d4
2007-08-30 Richard Hult <richard@imendio.com>
* gdk/quartz/gdkwindow-quartz.c: (gdk_window_set_keep_above,
gdk_window_set_keep_below): Patch from Stefan Gehn to implement
those, bug #459667.
2007-08-30 Richard Hult <richard@imendio.com>
* gdk/quartz/gdkimage-quartz.c: (_gdk_quartz_image_copy_to_image):
......
......@@ -1944,87 +1944,94 @@ gdk_window_set_hints (GdkWindow *window,
/* FIXME: Implement */
}
void
gdk_window_set_type_hint (GdkWindow *window,
GdkWindowTypeHint hint)
static
gint window_type_hint_to_level (GdkWindowTypeHint hint)
{
GdkWindowImplQuartz *impl;
gint level;
gboolean shadow;
g_return_if_fail (GDK_IS_WINDOW (window));
if (GDK_WINDOW_DESTROYED (window))
return;
switch (hint)
{
case GDK_WINDOW_TYPE_HINT_DOCK:
case GDK_WINDOW_TYPE_HINT_UTILITY:
return NSFloatingWindowLevel;
impl = GDK_WINDOW_IMPL_QUARTZ (((GdkWindowObject *) window)->impl);
case GDK_WINDOW_TYPE_HINT_MENU: /* Torn-off menu */
case GDK_WINDOW_TYPE_HINT_DROPDOWN_MENU: /* Menu from menubar */
return NSTornOffMenuWindowLevel;
impl->type_hint = hint;
case GDK_WINDOW_TYPE_HINT_NOTIFICATION:
case GDK_WINDOW_TYPE_HINT_TOOLTIP:
return NSStatusWindowLevel;
/* Match the documentation, only do something if we're not mapped yet. */
if (GDK_WINDOW_IS_MAPPED (window))
return;
case GDK_WINDOW_TYPE_HINT_SPLASHSCREEN:
case GDK_WINDOW_TYPE_HINT_POPUP_MENU:
case GDK_WINDOW_TYPE_HINT_COMBO:
case GDK_WINDOW_TYPE_HINT_DND:
return NSPopUpMenuWindowLevel;
switch (hint)
{
case GDK_WINDOW_TYPE_HINT_NORMAL: /* Normal toplevel window */
case GDK_WINDOW_TYPE_HINT_DIALOG: /* Dialog window */
level = NSNormalWindowLevel;
shadow = TRUE;
break;
case GDK_WINDOW_TYPE_HINT_TOOLBAR: /* Window used to implement toolbars */
case GDK_WINDOW_TYPE_HINT_DESKTOP: /* N/A */
level = NSNormalWindowLevel;
shadow = FALSE;
break;
case GDK_WINDOW_TYPE_HINT_DOCK:
case GDK_WINDOW_TYPE_HINT_UTILITY:
level = NSFloatingWindowLevel;
shadow = TRUE;
default:
break;
}
return NSNormalWindowLevel;
}
static gboolean
window_type_hint_to_shadow (GdkWindowTypeHint hint)
{
switch (hint)
{
case GDK_WINDOW_TYPE_HINT_NORMAL: /* Normal toplevel window */
case GDK_WINDOW_TYPE_HINT_DIALOG: /* Dialog window */
case GDK_WINDOW_TYPE_HINT_DOCK:
case GDK_WINDOW_TYPE_HINT_UTILITY:
case GDK_WINDOW_TYPE_HINT_MENU: /* Torn-off menu */
level = NSTornOffMenuWindowLevel;
shadow = TRUE;
break;
case GDK_WINDOW_TYPE_HINT_DROPDOWN_MENU: /* Menu from menubar */
level = NSTornOffMenuWindowLevel;
shadow = TRUE;
break;
case GDK_WINDOW_TYPE_HINT_SPLASHSCREEN:
level = NSPopUpMenuWindowLevel;
shadow = TRUE;
break;
case GDK_WINDOW_TYPE_HINT_POPUP_MENU:
case GDK_WINDOW_TYPE_HINT_COMBO:
level = NSPopUpMenuWindowLevel;
shadow = TRUE;
break;
case GDK_WINDOW_TYPE_HINT_NOTIFICATION:
case GDK_WINDOW_TYPE_HINT_TOOLTIP:
level = NSStatusWindowLevel;
shadow = TRUE;
break;
return TRUE;
case GDK_WINDOW_TYPE_HINT_TOOLBAR: /* Window used to implement toolbars */
case GDK_WINDOW_TYPE_HINT_DESKTOP: /* N/A */
case GDK_WINDOW_TYPE_HINT_DND:
level = NSPopUpMenuWindowLevel;
shadow = FALSE;
break;
default:
level = NSNormalWindowLevel;
shadow = FALSE;
break;
}
[impl->toplevel setHasShadow:shadow];
[impl->toplevel setLevel:level];
return FALSE;
}
void
gdk_window_set_type_hint (GdkWindow *window,
GdkWindowTypeHint hint)
{
GdkWindowImplQuartz *impl;
g_return_if_fail (GDK_IS_WINDOW (window));
if (GDK_WINDOW_DESTROYED (window))
return;
impl = GDK_WINDOW_IMPL_QUARTZ (((GdkWindowObject *) window)->impl);
impl->type_hint = hint;
/* Match the documentation, only do something if we're not mapped yet. */
if (GDK_WINDOW_IS_MAPPED (window))
return;
[impl->toplevel setHasShadow: window_type_hint_to_shadow (hint)];
[impl->toplevel setLevel: window_type_hint_to_level (hint)];
}
GdkWindowTypeHint
......@@ -2316,17 +2323,39 @@ gdk_window_unfullscreen (GdkWindow *window)
void
gdk_window_set_keep_above (GdkWindow *window, gboolean setting)
{
GdkWindowObject *private = (GdkWindowObject *) window;
GdkWindowImplQuartz *impl = GDK_WINDOW_IMPL_QUARTZ (private->impl);
gint level;
g_return_if_fail (GDK_IS_WINDOW (window));
g_return_if_fail (WINDOW_IS_TOPLEVEL (window));
/* FIXME: Implement */
if (GDK_WINDOW_DESTROYED (window))
return;
level = window_type_hint_to_level (gdk_window_get_type_hint (window));
/* Adjust normal window level by one if necessary. */
[impl->toplevel setLevel: level + (setting ? 1 : 0)];
}
void
gdk_window_set_keep_below (GdkWindow *window, gboolean setting)
{
GdkWindowObject *private = (GdkWindowObject *) window;
GdkWindowImplQuartz *impl = GDK_WINDOW_IMPL_QUARTZ (private->impl);
gint level;
g_return_if_fail (GDK_IS_WINDOW (window));
g_return_if_fail (WINDOW_IS_TOPLEVEL (window));
/* FIXME: Implement */
if (GDK_WINDOW_DESTROYED (window))
return;
level = window_type_hint_to_level (gdk_window_get_type_hint (window));
/* Adjust normal window level by one if necessary. */
[impl->toplevel setLevel: level - (setting ? 1 : 0)];
}
GdkWindow *
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment