mirror of
https://github.com/brl/mutter.git
synced 2024-11-25 01:20:42 -05:00
xwayland: Add MetaWindowXwayland
MetaWindowXwayland derives from MetaWindowX11 to allow for some Xwayland specific vfunc that wouldn't apply to plain X11 windows, such as shortcut inhibit routines. https://bugzilla.gnome.org/show_bug.cgi?id=783342
This commit is contained in:
parent
1923db97c1
commit
1546989845
@ -437,6 +437,8 @@ libmutter_@LIBMUTTER_API_VERSION@_la_SOURCES += \
|
||||
wayland/meta-wayland-xdg-foreign.h \
|
||||
wayland/meta-window-wayland.c \
|
||||
wayland/meta-window-wayland.h \
|
||||
wayland/meta-window-xwayland.c \
|
||||
wayland/meta-window-xwayland.h \
|
||||
wayland/meta-wayland-xdg-shell.c \
|
||||
wayland/meta-wayland-xdg-shell.h \
|
||||
wayland/meta-wayland-wl-shell.c \
|
||||
|
@ -58,6 +58,7 @@
|
||||
|
||||
#ifdef HAVE_WAYLAND
|
||||
#include "wayland/meta-window-wayland.h"
|
||||
#include "wayland/meta-window-xwayland.h"
|
||||
#include "wayland/meta-wayland-surface.h"
|
||||
#include "wayland/meta-wayland-private.h"
|
||||
#endif
|
||||
@ -942,9 +943,11 @@ _meta_window_shared_new (MetaDisplay *display,
|
||||
"IsUnviewable" :
|
||||
"(unknown)");
|
||||
|
||||
if (client_type == META_WINDOW_CLIENT_TYPE_X11)
|
||||
if (client_type == META_WINDOW_CLIENT_TYPE_X11 && !meta_is_wayland_compositor ())
|
||||
window = g_object_new (META_TYPE_WINDOW_X11, NULL);
|
||||
#ifdef HAVE_WAYLAND
|
||||
else if (client_type == META_WINDOW_CLIENT_TYPE_X11)
|
||||
window = g_object_new (META_TYPE_WINDOW_XWAYLAND, NULL);
|
||||
else if (client_type == META_WINDOW_CLIENT_TYPE_WAYLAND)
|
||||
window = g_object_new (META_TYPE_WINDOW_WAYLAND, NULL);
|
||||
#endif
|
||||
|
68
src/wayland/meta-window-xwayland.c
Normal file
68
src/wayland/meta-window-xwayland.c
Normal file
@ -0,0 +1,68 @@
|
||||
/*
|
||||
* Copyright (C) 2017 Red Hat
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "x11/window-x11.h"
|
||||
#include "x11/window-x11-private.h"
|
||||
#include "wayland/meta-window-xwayland.h"
|
||||
#include "wayland/meta-wayland.h"
|
||||
|
||||
struct _MetaWindowXwayland
|
||||
{
|
||||
MetaWindowX11 parent;
|
||||
};
|
||||
|
||||
struct _MetaWindowXwaylandClass
|
||||
{
|
||||
MetaWindowX11Class parent_class;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE (MetaWindowXwayland, meta_window_xwayland, META_TYPE_WINDOW_X11)
|
||||
|
||||
static void
|
||||
meta_window_xwayland_init (MetaWindowXwayland *window_xwayland)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
meta_window_xwayland_force_restore_shortcuts (MetaWindow *window,
|
||||
ClutterInputDevice *source)
|
||||
{
|
||||
MetaWaylandCompositor *compositor = meta_wayland_compositor_get_default ();
|
||||
|
||||
meta_wayland_compositor_restore_shortcuts (compositor, source);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
meta_window_xwayland_shortcuts_inhibited (MetaWindow *window,
|
||||
ClutterInputDevice *source)
|
||||
{
|
||||
MetaWaylandCompositor *compositor = meta_wayland_compositor_get_default ();
|
||||
|
||||
return meta_wayland_compositor_is_shortcuts_inhibited (compositor, source);
|
||||
}
|
||||
|
||||
static void
|
||||
meta_window_xwayland_class_init (MetaWindowXwaylandClass *klass)
|
||||
{
|
||||
MetaWindowClass *window_class = META_WINDOW_CLASS (klass);
|
||||
|
||||
window_class->force_restore_shortcuts = meta_window_xwayland_force_restore_shortcuts;
|
||||
window_class->shortcuts_inhibited = meta_window_xwayland_shortcuts_inhibited;
|
||||
}
|
34
src/wayland/meta-window-xwayland.h
Normal file
34
src/wayland/meta-window-xwayland.h
Normal file
@ -0,0 +1,34 @@
|
||||
/*
|
||||
* Copyright (C) 2017 Red Hat
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef META_WINDOW_XWAYLAND_H
|
||||
#define META_WINDOW_XWAYLAND_H
|
||||
|
||||
#include "meta/window.h"
|
||||
#include "x11/window-x11.h"
|
||||
#include "x11/window-x11-private.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define META_TYPE_WINDOW_XWAYLAND (meta_window_xwayland_get_type())
|
||||
G_DECLARE_FINAL_TYPE (MetaWindowXwayland, meta_window_xwayland,
|
||||
META, WINDOW_XWAYLAND, MetaWindowX11)
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif
|
@ -30,6 +30,11 @@ G_BEGIN_DECLS
|
||||
|
||||
typedef struct _MetaWindowX11Private MetaWindowX11Private;
|
||||
|
||||
struct _MetaWindowX11Class
|
||||
{
|
||||
MetaWindowClass parent_class;
|
||||
};
|
||||
|
||||
struct _MetaWindowX11
|
||||
{
|
||||
MetaWindow parent;
|
||||
|
@ -53,11 +53,6 @@
|
||||
#include "backends/meta-logical-monitor.h"
|
||||
#include "backends/x11/meta-backend-x11.h"
|
||||
|
||||
struct _MetaWindowX11Class
|
||||
{
|
||||
MetaWindowClass parent_class;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE_WITH_PRIVATE (MetaWindowX11, meta_window_x11, META_TYPE_WINDOW)
|
||||
|
||||
static void
|
||||
|
@ -41,6 +41,8 @@ GType meta_window_x11_get_type (void);
|
||||
typedef struct _MetaWindowX11 MetaWindowX11;
|
||||
typedef struct _MetaWindowX11Class MetaWindowX11Class;
|
||||
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (MetaWindowX11, g_object_unref)
|
||||
|
||||
MetaWindow * meta_window_x11_new (MetaDisplay *display,
|
||||
Window xwindow,
|
||||
gboolean must_be_viewable,
|
||||
|
Loading…
Reference in New Issue
Block a user