[gedit/wip/3.14-osx: 30/69] [osx] Enable native fullscreen window button



commit 0dcef4fd03059afa0b1bee17b76a5c9438fa5566
Author: Jesse van den Kieboom <jessevdk gmail com>
Date:   Sat Aug 23 15:50:50 2014 +0200

    [osx] Enable native fullscreen window button

 gedit/gedit-app-osx.c |   30 ++++++++++++++++++++++++++++++
 1 files changed, 30 insertions(+), 0 deletions(-)
---
diff --git a/gedit/gedit-app-osx.c b/gedit/gedit-app-osx.c
index f7671a5..60069dd 100644
--- a/gedit/gedit-app-osx.c
+++ b/gedit/gedit-app-osx.c
@@ -344,6 +344,27 @@ gedit_app_osx_startup (GApplication *application)
        recent_files_menu_populate (app_osx);
 }
 
+static void
+set_window_allow_fullscreen (GeditWindow *window)
+{
+       GdkWindow *wnd;
+       NSWindow *native;
+
+       wnd = gtk_widget_get_window (GTK_WIDGET (window));
+
+       if (wnd != NULL)
+       {
+               native = gdk_quartz_window_get_nswindow (wnd);
+               [native setCollectionBehavior: [native collectionBehavior] | 
NSWindowCollectionBehaviorFullScreenPrimary];
+       }
+}
+
+static void
+on_window_realized (GtkWidget *widget)
+{
+       set_window_allow_fullscreen (GEDIT_WINDOW (widget));
+}
+
 static GeditWindow *
 gedit_app_osx_create_window_impl (GeditApp *app)
 {
@@ -353,6 +374,15 @@ gedit_app_osx_create_window_impl (GeditApp *app)
 
        gtk_window_set_titlebar (GTK_WINDOW (window), NULL);
 
+       if (gtk_widget_get_realized (GTK_WIDGET (window)))
+       {
+               set_window_allow_fullscreen (window);
+       }
+       else
+       {
+               g_signal_connect (window, "realize", G_CALLBACK (on_window_realized), NULL);
+       }
+
        return window;
 }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]