mirror of
https://github.com/brl/mutter.git
synced 2024-12-25 04:22:05 +00:00
wayland: Add and implement set/unset_modal for the gtk_surface interface
Add set_modal ond unset_modal to the gtk_surface interface. When a surface is modal, the compositor can treat it differently from non-modal dialogs, for example attach it to the parent window if any. There is currently no changes to input device focus; it is up to the client to ignore events to the parent surface that is wanted. This bumps the gtk_shell version to 2. https://bugzilla.gnome.org/show_bug.cgi?id=745720
This commit is contained in:
parent
df3b412a25
commit
eb6c70137b
@ -1554,14 +1554,14 @@ gtk_surface_destructor (struct wl_resource *resource)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
set_dbus_properties (struct wl_client *client,
|
gtk_surface_set_dbus_properties (struct wl_client *client,
|
||||||
struct wl_resource *resource,
|
struct wl_resource *resource,
|
||||||
const char *application_id,
|
const char *application_id,
|
||||||
const char *app_menu_path,
|
const char *app_menu_path,
|
||||||
const char *menubar_path,
|
const char *menubar_path,
|
||||||
const char *window_object_path,
|
const char *window_object_path,
|
||||||
const char *application_object_path,
|
const char *application_object_path,
|
||||||
const char *unique_bus_name)
|
const char *unique_bus_name)
|
||||||
{
|
{
|
||||||
MetaWaylandSurface *surface = wl_resource_get_user_data (resource);
|
MetaWaylandSurface *surface = wl_resource_get_user_data (resource);
|
||||||
|
|
||||||
@ -1581,8 +1581,36 @@ set_dbus_properties (struct wl_client *client,
|
|||||||
window_object_path);
|
window_object_path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gtk_surface_set_modal (struct wl_client *client,
|
||||||
|
struct wl_resource *resource)
|
||||||
|
{
|
||||||
|
MetaWaylandSurface *surface = wl_resource_get_user_data (resource);
|
||||||
|
|
||||||
|
if (surface->is_modal)
|
||||||
|
return;
|
||||||
|
|
||||||
|
surface->is_modal = TRUE;
|
||||||
|
meta_window_set_type (surface->window, META_WINDOW_MODAL_DIALOG);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gtk_surface_unset_modal (struct wl_client *client,
|
||||||
|
struct wl_resource *resource)
|
||||||
|
{
|
||||||
|
MetaWaylandSurface *surface = wl_resource_get_user_data (resource);
|
||||||
|
|
||||||
|
if (!surface->is_modal)
|
||||||
|
return;
|
||||||
|
|
||||||
|
surface->is_modal = FALSE;
|
||||||
|
meta_window_set_type (surface->window, META_WINDOW_NORMAL);
|
||||||
|
}
|
||||||
|
|
||||||
static const struct gtk_surface_interface meta_wayland_gtk_surface_interface = {
|
static const struct gtk_surface_interface meta_wayland_gtk_surface_interface = {
|
||||||
set_dbus_properties
|
gtk_surface_set_dbus_properties,
|
||||||
|
gtk_surface_set_modal,
|
||||||
|
gtk_surface_unset_modal,
|
||||||
};
|
};
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -101,6 +101,7 @@ struct _MetaWaylandSurface
|
|||||||
struct wl_resource *xdg_shell_resource;
|
struct wl_resource *xdg_shell_resource;
|
||||||
MetaWaylandSerial acked_configure_serial;
|
MetaWaylandSerial acked_configure_serial;
|
||||||
gboolean has_set_geometry;
|
gboolean has_set_geometry;
|
||||||
|
gboolean is_modal;
|
||||||
|
|
||||||
/* xdg_popup */
|
/* xdg_popup */
|
||||||
struct {
|
struct {
|
||||||
|
@ -42,7 +42,7 @@
|
|||||||
#define META_WL_SEAT_VERSION 4
|
#define META_WL_SEAT_VERSION 4
|
||||||
#define META_WL_OUTPUT_VERSION 2
|
#define META_WL_OUTPUT_VERSION 2
|
||||||
#define META_XSERVER_VERSION 1
|
#define META_XSERVER_VERSION 1
|
||||||
#define META_GTK_SHELL_VERSION 1
|
#define META_GTK_SHELL_VERSION 2
|
||||||
#define META_WL_SUBCOMPOSITOR_VERSION 1
|
#define META_WL_SUBCOMPOSITOR_VERSION 1
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<protocol name="gtk">
|
<protocol name="gtk">
|
||||||
|
|
||||||
<interface name="gtk_shell" version="1">
|
<interface name="gtk_shell" version="2">
|
||||||
<description summary="gtk specific extensions">
|
<description summary="gtk specific extensions">
|
||||||
gtk_shell is a protocol extension providing additional features for
|
gtk_shell is a protocol extension providing additional features for
|
||||||
clients implementing it. It is not backward compatible, and a client must
|
clients implementing it. It is not backward compatible, and a client must
|
||||||
@ -25,7 +25,7 @@
|
|||||||
</request>
|
</request>
|
||||||
</interface>
|
</interface>
|
||||||
|
|
||||||
<interface name="gtk_surface" version="1">
|
<interface name="gtk_surface" version="2">
|
||||||
<request name="set_dbus_properties">
|
<request name="set_dbus_properties">
|
||||||
<arg name="application_id" type="string" allow-null="true"/>
|
<arg name="application_id" type="string" allow-null="true"/>
|
||||||
<arg name="app_menu_path" type="string" allow-null="true"/>
|
<arg name="app_menu_path" type="string" allow-null="true"/>
|
||||||
@ -34,6 +34,9 @@
|
|||||||
<arg name="application_object_path" type="string" allow-null="true"/>
|
<arg name="application_object_path" type="string" allow-null="true"/>
|
||||||
<arg name="unique_bus_name" type="string" allow-null="true"/>
|
<arg name="unique_bus_name" type="string" allow-null="true"/>
|
||||||
</request>
|
</request>
|
||||||
|
|
||||||
|
<request name="set_modal"/>
|
||||||
|
<request name="unset_modal"/>
|
||||||
</interface>
|
</interface>
|
||||||
|
|
||||||
</protocol>
|
</protocol>
|
||||||
|
Loading…
Reference in New Issue
Block a user