diff --git a/src/Makefile.am b/src/Makefile.am
index 59dc248e8..86d7a47fd 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -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 \
diff --git a/src/core/window.c b/src/core/window.c
index c6f8432a3..5f13bf159 100644
--- a/src/core/window.c
+++ b/src/core/window.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
diff --git a/src/wayland/meta-window-xwayland.c b/src/wayland/meta-window-xwayland.c
new file mode 100644
index 000000000..9f32500d4
--- /dev/null
+++ b/src/wayland/meta-window-xwayland.c
@@ -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 .
+ *
+ */
+
+#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;
+}
diff --git a/src/wayland/meta-window-xwayland.h b/src/wayland/meta-window-xwayland.h
new file mode 100644
index 000000000..5ea6041d4
--- /dev/null
+++ b/src/wayland/meta-window-xwayland.h
@@ -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 .
+ *
+ */
+
+#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
diff --git a/src/x11/window-x11-private.h b/src/x11/window-x11-private.h
index 62341739e..e7c8af495 100644
--- a/src/x11/window-x11-private.h
+++ b/src/x11/window-x11-private.h
@@ -30,6 +30,11 @@ G_BEGIN_DECLS
typedef struct _MetaWindowX11Private MetaWindowX11Private;
+struct _MetaWindowX11Class
+{
+ MetaWindowClass parent_class;
+};
+
struct _MetaWindowX11
{
MetaWindow parent;
diff --git a/src/x11/window-x11.c b/src/x11/window-x11.c
index 5a6f113b0..a55355755 100644
--- a/src/x11/window-x11.c
+++ b/src/x11/window-x11.c
@@ -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
diff --git a/src/x11/window-x11.h b/src/x11/window-x11.h
index a2637a0df..dc1e97dcf 100644
--- a/src/x11/window-x11.h
+++ b/src/x11/window-x11.h
@@ -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,