diff --git a/gdk/quartz/gdkwindow-quartz.c b/gdk/quartz/gdkwindow-quartz.c index 9cb6bc6f0..04d7b19bf 100644 --- a/gdk/quartz/gdkwindow-quartz.c +++ b/gdk/quartz/gdkwindow-quartz.c @@ -2884,9 +2884,45 @@ void gdk_window_set_functions (GdkWindow *window, GdkWMFunction functions) { + GdkWindowImplQuartz *impl; + gboolean close, minimize, maximize; + g_return_if_fail (GDK_IS_WINDOW (window)); - /* FIXME: Implement */ + if (GDK_WINDOW_DESTROYED (window) || + !WINDOW_IS_TOPLEVEL (window)) + return; + + impl = GDK_WINDOW_IMPL_QUARTZ (GDK_WINDOW_OBJECT (window)->impl); + if (!impl->toplevel) + return; + + /* GDK_FUNC_ALL turns the meaning of the other bits around, as on X11 */ + if (functions & GDK_FUNC_ALL) + { + close = !(functions & GDK_FUNC_CLOSE); + minimize = !(functions & GDK_FUNC_MINIMIZE); + maximize = !(functions & GDK_FUNC_MAXIMIZE); + } + else + { + close = (functions & GDK_FUNC_CLOSE) != 0; + minimize = (functions & GDK_FUNC_MINIMIZE) != 0; + maximize = (functions & GDK_FUNC_MAXIMIZE) != 0; + } + + /* The buttons of the title bar, so that gtk_window_set_deletable() + * works. Enabling and disabling them works from Mac OS X 10.2 on and + * leaves the style of the window (and whether it can be resized, which + * the geometry hints decide) alone; a window without a title bar has + * no buttons, so nothing happens there. */ + GDK_QUARTZ_ALLOC_POOL; + + [[impl->toplevel standardWindowButton:NSWindowCloseButton] setEnabled:close]; + [[impl->toplevel standardWindowButton:NSWindowMiniaturizeButton] setEnabled:minimize]; + [[impl->toplevel standardWindowButton:NSWindowZoomButton] setEnabled:maximize]; + + GDK_QUARTZ_RELEASE_POOL; } gboolean