diff options
author | Olivier Fourdan <ofourdan@redhat.com> | 2013-01-21 11:49:45 +0100 |
---|---|---|
committer | Olivier Fourdan <ofourdan@redhat.com> | 2013-01-25 13:16:56 +0100 |
commit | 54dc823d67ce784511b5638ec62e4e9a73d21857 (patch) | |
tree | 05b908f0e4d002bc03f592b26297fe92de647a83 | |
parent | e57de5310834083a7ac28992e64b9394d76adb04 (diff) | |
download | gtk+-54dc823d67ce784511b5638ec62e4e9a73d21857.tar.gz |
gdk: add gdk_window_set_fullscreen_mode()
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
-rw-r--r-- | gdk/gdkinternals.h | 1 | ||||
-rw-r--r-- | gdk/gdkwindow.c | 62 | ||||
-rw-r--r-- | gdk/gdkwindow.h | 22 | ||||
-rw-r--r-- | gdk/gdkwindowimpl.h | 1 |
4 files changed, 86 insertions, 0 deletions
diff --git a/gdk/gdkinternals.h b/gdk/gdkinternals.h index 35bbb7fe24..0eb4074cb8 100644 --- a/gdk/gdkinternals.h +++ b/gdk/gdkinternals.h @@ -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 diff --git a/gdk/gdkwindow.c b/gdk/gdkwindow.c index e337d53ae1..7afcd96978 100644 --- a/gdk/gdkwindow.c +++ b/gdk/gdkwindow.c @@ -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; @@ -10692,6 +10693,67 @@ gdk_window_fullscreen (GdkWindow *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 * diff --git a/gdk/gdkwindow.h b/gdk/gdkwindow.h index 4a5daf8482..a4fbac022e 100644 --- a/gdk/gdkwindow.h +++ b/gdk/gdkwindow.h @@ -317,6 +317,22 @@ typedef enum } 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) * @event_mask: event mask (see gdk_window_set_events()) @@ -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); diff --git a/gdk/gdkwindowimpl.h b/gdk/gdkwindowimpl.h index e45de49f88..65149e8217 100644 --- a/gdk/gdkwindowimpl.h +++ b/gdk/gdkwindowimpl.h @@ -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); |