]> Pileus Git - ~andy/gtk/commitdiff
gdk: add gdk_window_set_fullscreen_mode()
authorOlivier Fourdan <ofourdan@redhat.com>
Mon, 21 Jan 2013 10:49:45 +0000 (11:49 +0100)
committerOlivier Fourdan <ofourdan@redhat.com>
Fri, 25 Jan 2013 12:16:56 +0000 (13:16 +0100)
and gdk_window_get_fullscreen_mode() API to allow
applications to specify if a fullscreen window should
span across all monitors in a multi-monitor setup or
remain on the current monitor where the window is
placed.

Fullscreen mode can be either GDK_FULLSCREEN_ON_ALL_MONITORS
or GDK_FULLSCREEN_ON_CURRENT_MONITOR.

https://bugzilla.gnome.org/show_bug.cgi?id=691856

gdk/gdkinternals.h
gdk/gdkwindow.c
gdk/gdkwindow.h
gdk/gdkwindowimpl.h

index 35bbb7fe241cf7ef16b01fcf86637eb06e494af2..0eb4074cb8ce9459324567ff93df53d6e5f07b9a 100644 (file)
@@ -221,6 +221,7 @@ struct _GdkWindow
   guint native_visibility : 2; /* the native visibility of a impl windows */
   guint viewable : 1; /* mapped and all parents mapped */
   guint applied_shape : 1;
+  GdkFullscreenMode fullscreen_mode;
 
   /* The GdkWindow that has the impl, ref:ed if another window.
    * This ref is required to keep the wrapper of the impl window alive
index e337d53ae1943b3381734f22660cc7da7f41ff34..7afcd9697846a5b221843801b81363af859ff25b 100644 (file)
@@ -313,6 +313,7 @@ gdk_window_init (GdkWindow *window)
   window->window_type = GDK_WINDOW_CHILD;
 
   window->state = GDK_WINDOW_STATE_WITHDRAWN;
+  window->fullscreen_mode = GDK_FULLSCREEN_ON_CURRENT_MONITOR;
   window->width = 1;
   window->height = 1;
   window->toplevel_window_type = -1;
@@ -10691,6 +10692,67 @@ gdk_window_fullscreen (GdkWindow *window)
   GDK_WINDOW_IMPL_GET_CLASS (window->impl)->fullscreen (window);
 }
 
+/**
+ * gdk_window_set_fullscreen_mode:
+ * @window: a toplevel #GdkWindow
+ * @mode: fullscreen mode
+ *
+ * Specifies whether the @window should span over all monitors (in a multi-head
+ * setup) or only the current monitor when in fullscreen mode.
+ *
+ * The @mode argument is from the #GdkFullscreenMode enumeration.
+ * If #GDK_FULLSCREEN_ON_ALL_MONITORS is specified, the fullscreen @window will
+ * span over all monitors from the #GdkScreen.
+ *
+ * On X11, searches through the list of monitors from the #GdkScreen the ones
+ * which delimit the 4 edges of the entire #GdkScreen and will ask the window
+ * manager to span the @window over these monitors.
+ *
+ * If the XINERAMA extension is not available or not usable, this function
+ * has no effect.
+ *
+ * Not all window managers support this, so you can't rely on the fullscreen
+ * window to span over the multiple monitors when #GDK_FULLSCREEN_ON_ALL_MONITORS
+ * is specified.
+ *
+ * Since: 3.8
+ **/
+void
+gdk_window_set_fullscreen_mode (GdkWindow        *window,
+                                GdkFullscreenMode mode)
+{
+  GdkWindowImplClass *impl_class;
+
+  g_return_if_fail (GDK_IS_WINDOW (window));
+
+  if (window->fullscreen_mode != mode)
+    {
+      window->fullscreen_mode = mode;
+
+      impl_class = GDK_WINDOW_IMPL_GET_CLASS (window->impl);
+      if (impl_class->apply_fullscreen_mode != NULL)
+        impl_class->apply_fullscreen_mode (window);
+    }
+}
+
+/**
+ * gdk_window_get_fullscreen_mode:
+ * @window: a toplevel #GdkWindow
+ *
+ * Obtains the #GdkFullscreenMode of the @window.
+ *
+ * Returns: The #GdkFullscreenMode applied to the window when fullscreen.
+ *
+ * Since: 3.8
+ **/
+GdkFullscreenMode
+gdk_window_get_fullscreen_mode (GdkWindow *window)
+{
+  g_return_val_if_fail (GDK_IS_WINDOW (window), GDK_FULLSCREEN_ON_CURRENT_MONITOR);
+
+  return window->fullscreen_mode;
+}
+
 /**
  * gdk_window_unfullscreen:
  * @window: a toplevel #GdkWindow
index 4a5daf8482de35cfcb4402daaf2c40f7a3e5f1be..a4fbac022ef220b69a667be0c879f95acff313d9 100644 (file)
@@ -316,6 +316,22 @@ typedef enum
   GDK_WINDOW_EDGE_SOUTH_EAST  
 } GdkWindowEdge;
 
+/**
+ * GdkFullscreenMode:
+ * @GDK_FULLSCREEN_ON_CURRENT_MONITOR: Fullscreen on current monitor only.
+ * @GDK_FULLSCREEN_ON_ALL_MONITORS: Span across all monitors when fullscreen.
+ *
+ * Indicates which monitor (in a multi-head setup) a window should span over
+ * when in fullscreen mode.
+ *
+ * Since: 3.8
+ **/
+typedef enum
+{
+  GDK_FULLSCREEN_ON_CURRENT_MONITOR,
+  GDK_FULLSCREEN_ON_ALL_MONITORS
+} GdkFullscreenMode;
+
 /**
  * GdkWindowAttr:
  * @title: title of the window (for toplevel windows)
@@ -773,6 +789,12 @@ void          gdk_window_unstick         (GdkWindow       *window);
 void          gdk_window_maximize        (GdkWindow       *window);
 void          gdk_window_unmaximize      (GdkWindow       *window);
 void          gdk_window_fullscreen      (GdkWindow       *window);
+GDK_AVAILABLE_IN_3_8
+void          gdk_window_set_fullscreen_mode (GdkWindow   *window,
+                                          GdkFullscreenMode mode);
+GDK_AVAILABLE_IN_3_8
+GdkFullscreenMode
+              gdk_window_get_fullscreen_mode (GdkWindow   *window);
 void          gdk_window_unfullscreen    (GdkWindow       *window);
 void          gdk_window_set_keep_above  (GdkWindow       *window,
                                           gboolean         setting);
index e45de49f88a4cc339d7b55b71fe29fab2be1c564..65149e8217e0df3f3e90ce20b019b7e825348687 100644 (file)
@@ -214,6 +214,7 @@ struct _GdkWindowImplClass
   void         (* maximize)             (GdkWindow *window);
   void         (* unmaximize)           (GdkWindow *window);
   void         (* fullscreen)           (GdkWindow *window);
+  void         (* apply_fullscreen_mode) (GdkWindow *window);
   void         (* unfullscreen)         (GdkWindow *window);
   void         (* set_keep_above)       (GdkWindow *window,
                                         gboolean   setting);