[gimp/gimp-2-8] Bug 756178 - Crash on new layer creation in fullscreen mode



commit 08c22c0dc0fb8ee0f2f03ece91c9e59a2c226ac7
Author: Kristian Rietveld <kris loopnest org>
Date:   Sun Apr 17 00:32:27 2016 +0100

    Bug 756178 - Crash on new layer creation in fullscreen mode
    
    Disable "new-style" fullscreen mode on OS X, we need support in
    GTK+ in order for this to work properly. The currently available
    fullscreen option in View > Fullscreen works fine and we plan to
    migrate to the "new-style" fullscreen support in the future.
    
    (cherry picked from commit cdc7542d46a6d3c6b2c223d14f63e7d29d9571ec)

 app/display/Makefile.am       |    7 ++++++-
 app/display/gimpimagewindow.c |   35 +++++++++++++++++++++++++++++++++++
 2 files changed, 41 insertions(+), 1 deletions(-)
---
diff --git a/app/display/Makefile.am b/app/display/Makefile.am
index d0b5413..d368d7c 100644
--- a/app/display/Makefile.am
+++ b/app/display/Makefile.am
@@ -1,5 +1,9 @@
 ## Process this file with automake to produce Makefile.in
 
+if PLATFORM_OSX
+xobjective_c = "-xobjective-c"
+endif
+
 AM_CPPFLAGS = \
        -DG_LOG_DOMAIN=\"Gimp-Display\"
 
@@ -10,7 +14,8 @@ INCLUDES = \
        -I$(top_srcdir)/app     \
        $(GEGL_CFLAGS)          \
        $(GTK_CFLAGS)           \
-       -I$(includedir)
+       -I$(includedir)         \
+       $(xobjective_c)
 
 noinst_LIBRARIES = libappdisplay.a
 
diff --git a/app/display/gimpimagewindow.c b/app/display/gimpimagewindow.c
index f1300b1..a467b9a 100644
--- a/app/display/gimpimagewindow.c
+++ b/app/display/gimpimagewindow.c
@@ -20,6 +20,11 @@
 #include <gegl.h>
 #include <gtk/gtk.h>
 
+#ifdef GDK_WINDOWING_QUARTZ
+#import <AppKit/AppKit.h>
+#include <gdk/gdkquartz.h>
+#endif /* !GDK_WINDOWING_QUARTZ */
+
 #include "libgimpmath/gimpmath.h"
 #include "libgimpwidgets/gimpwidgets.h"
 
@@ -144,6 +149,7 @@ static void      gimp_image_window_get_property        (GObject             *obj
                                                         GValue              *value,
                                                         GParamSpec          *pspec);
 
+static void      gimp_image_window_map                 (GtkWidget           *widget);
 static gboolean  gimp_image_window_delete_event        (GtkWidget           *widget,
                                                         GdkEventAny         *event);
 static gboolean  gimp_image_window_configure_event     (GtkWidget           *widget,
@@ -247,6 +253,7 @@ gimp_image_window_class_init (GimpImageWindowClass *klass)
   object_class->set_property       = gimp_image_window_set_property;
   object_class->get_property       = gimp_image_window_get_property;
 
+  widget_class->map                = gimp_image_window_map;
   widget_class->delete_event       = gimp_image_window_delete_event;
   widget_class->configure_event    = gimp_image_window_configure_event;
   widget_class->window_state_event = gimp_image_window_window_state_event;
@@ -521,6 +528,34 @@ gimp_image_window_get_property (GObject    *object,
     }
 }
 
+static void
+gimp_image_window_map (GtkWidget *widget)
+{
+#ifdef GDK_WINDOWING_QUARTZ
+  GdkWindow *gdk_window;
+  NSWindow  *ns_window;
+#endif /* !GDK_WINDOWING_QUARTZ */
+
+  GTK_WIDGET_CLASS (parent_class)->map (widget);
+
+#ifdef GDK_WINDOWING_QUARTZ
+  gdk_window = gtk_widget_get_window (GTK_WIDGET (widget));
+  ns_window = gdk_quartz_window_get_nswindow (gdk_window);
+
+  /* Disable the new-style full screen mode. For now only the "old-style"
+   * full screen mode, via the "View" menu, is supported. In the future, and
+   * as soon as GTK+ has proper support for this, we will migrate to the
+   * new-style full screen mode.
+   */
+#if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_7
+  ns_window.collectionBehavior |= NSWindowCollectionBehaviorFullScreenAuxiliary;
+#else
+  /* Hard code the define ... */
+  ns_window.collectionBehavior |= 1 << 8;
+#endif
+#endif /* !GDK_WINDOWING_QUARTZ */
+}
+
 static gboolean
 gimp_image_window_delete_event (GtkWidget   *widget,
                                 GdkEventAny *event)


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