Move fullscreen-mode to GdkToplevel

This commit is contained in:
Matthias Clasen 2020-03-09 11:49:59 -07:00
parent 81be6ff46b
commit f020d77a23
8 changed files with 31 additions and 33 deletions

View File

@ -282,11 +282,6 @@ GdkSurface * gdk_surface_new_temp (GdkDisplay *display,
const GdkRectangle *position);
void gdk_surface_set_fullscreen_mode (GdkSurface *surface,
GdkFullscreenMode mode);
GdkFullscreenMode gdk_surface_get_fullscreen_mode (GdkSurface *surface);
G_END_DECLS
#endif /* __GDK_INTERNALS_H__ */

View File

@ -2337,29 +2337,6 @@ gdk_surface_create_similar_surface (GdkSurface * surface,
return similar_surface;
}
void
gdk_surface_set_fullscreen_mode (GdkSurface *surface,
GdkFullscreenMode mode)
{
g_return_if_fail (GDK_IS_SURFACE (surface));
if (surface->fullscreen_mode != mode)
{
surface->fullscreen_mode = mode;
if (GDK_SURFACE_GET_CLASS (surface)->apply_fullscreen_mode != NULL)
GDK_SURFACE_GET_CLASS (surface)->apply_fullscreen_mode (surface);
}
}
GdkFullscreenMode
gdk_surface_get_fullscreen_mode (GdkSurface *surface)
{
g_return_val_if_fail (GDK_IS_SURFACE (surface), GDK_FULLSCREEN_ON_CURRENT_MONITOR);
return surface->fullscreen_mode;
}
/**
* gdk_surface_begin_resize_drag:
* @surface: a toplevel #GdkSurface

View File

@ -148,7 +148,6 @@ struct _GdkSurfaceClass
/* optional */
gboolean (* beep) (GdkSurface *surface);
void (* apply_fullscreen_mode) (GdkSurface *surface);
void (* begin_resize_drag) (GdkSurface *surface,
GdkSurfaceEdge edge,
GdkDevice *device,

View File

@ -164,6 +164,13 @@ gdk_toplevel_default_init (GdkToplevelInterface *iface)
"Deletable",
FALSE,
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY));
g_object_interface_install_property (iface,
g_param_spec_enum ("fullscreen-mode",
"Fullscreen mode",
"Fullscreen mode",
GDK_TYPE_FULLSCREEN_MODE,
GDK_FULLSCREEN_ON_CURRENT_MONITOR,
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY));
}
guint
@ -183,6 +190,7 @@ gdk_toplevel_install_properties (GObjectClass *object_class,
g_object_class_override_property (object_class, first_prop + GDK_TOPLEVEL_PROP_FOCUS_ON_MAP, "focus-on-map");
g_object_class_override_property (object_class, first_prop + GDK_TOPLEVEL_PROP_DECORATED, "decorated");
g_object_class_override_property (object_class, first_prop + GDK_TOPLEVEL_PROP_DELETABLE, "deletable");
g_object_class_override_property (object_class, first_prop + GDK_TOPLEVEL_PROP_FULLSCREEN_MODE, "fullscreen-mode");
return GDK_TOPLEVEL_NUM_PROPERTIES;
}

View File

@ -38,6 +38,7 @@ typedef enum
GDK_TOPLEVEL_PROP_FOCUS_ON_MAP,
GDK_TOPLEVEL_PROP_DECORATED,
GDK_TOPLEVEL_PROP_DELETABLE,
GDK_TOPLEVEL_PROP_FULLSCREEN_MODE,
GDK_TOPLEVEL_NUM_PROPERTIES
} GdkToplevelProperties;

View File

@ -4371,6 +4371,11 @@ gdk_wayland_toplevel_set_property (GObject *object,
case LAST_PROP + GDK_TOPLEVEL_PROP_DELETABLE:
break;
case LAST_PROP + GDK_TOPLEVEL_PROP_FULLSCREEN_MODE:
surface->fullscreen_mode = g_value_get_enum (value);
g_object_notify_by_pspec (G_OBJECT (surface), pspec);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@ -4433,6 +4438,10 @@ gdk_wayland_toplevel_get_property (GObject *object,
case LAST_PROP + GDK_TOPLEVEL_PROP_DELETABLE:
break;
case LAST_PROP + GDK_TOPLEVEL_PROP_FULLSCREEN_MODE:
g_value_set_enum (value, surface->fullscreen_mode);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;

View File

@ -50,7 +50,7 @@ gdk_monitor_has_fullscreen_window (GdkMonitor *monitor)
if ((gdk_toplevel_get_state (GDK_TOPLEVEL (surface)) & GDK_SURFACE_STATE_FULLSCREEN) == 0)
continue;
if (gdk_surface_get_fullscreen_mode (surface) == GDK_FULLSCREEN_ON_ALL_MONITORS ||
if (surface->fullscreen_mode == GDK_FULLSCREEN_ON_ALL_MONITORS ||
gdk_display_get_monitor_at_surface (monitor->display, surface) == monitor)
{
has_fullscreen = TRUE;

View File

@ -1287,7 +1287,6 @@ gdk_x11_surface_withdraw (GdkSurface *surface)
GDK_SURFACE_STATE_WITHDRAWN);
g_assert (!GDK_SURFACE_IS_MAPPED (surface));
XWithdrawWindow (GDK_SURFACE_XDISPLAY (surface),
GDK_SURFACE_XID (surface), 0);
}
@ -3288,7 +3287,8 @@ gdk_x11_surface_fullscreen_on_monitor (GdkSurface *surface,
gdk_monitor_get_geometry (monitor, &geom);
gdk_x11_surface_move (surface, geom.x, geom.y);
gdk_surface_set_fullscreen_mode (surface, GDK_FULLSCREEN_ON_CURRENT_MONITOR);
surface->fullscreen_mode = GDK_FULLSCREEN_ON_CURRENT_MONITOR;
g_object_notify (G_OBJECT (surface), "fullscreen-mode");
gdk_x11_surface_fullscreen (surface);
}
@ -4660,7 +4660,6 @@ gdk_x11_surface_class_init (GdkX11SurfaceClass *klass)
impl_class->destroy = gdk_x11_surface_destroy;
impl_class->beep = gdk_x11_surface_beep;
impl_class->apply_fullscreen_mode = gdk_x11_surface_apply_fullscreen_mode;
impl_class->begin_resize_drag = gdk_x11_surface_begin_resize_drag;
impl_class->begin_move_drag = gdk_x11_surface_begin_move_drag;
impl_class->destroy_notify = gdk_x11_surface_destroy_notify;
@ -4889,6 +4888,12 @@ gdk_wayland_toplevel_set_property (GObject *object,
g_object_notify_by_pspec (G_OBJECT (surface), pspec);
break;
case LAST_PROP + GDK_TOPLEVEL_PROP_FULLSCREEN_MODE:
surface->fullscreen_mode = g_value_get_enum (value);
gdk_x11_surface_apply_fullscreen_mode (surface);
g_object_notify_by_pspec (G_OBJECT (surface), pspec);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@ -4964,6 +4969,10 @@ gdk_wayland_toplevel_get_property (GObject *object,
}
break;
case LAST_PROP + GDK_TOPLEVEL_PROP_FULLSCREEN_MODE:
g_value_set_enum (value, surface->fullscreen_mode);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;