xserver: Branch 'master' - 15 commits
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Fri Dec 20 15:33:11 UTC 2019
hw/xwayland/Makefile.am | 17
hw/xwayland/meson.build | 16
hw/xwayland/xwayland-cursor.c | 16
hw/xwayland/xwayland-cursor.h | 38
hw/xwayland/xwayland-cvt.c | 7
hw/xwayland/xwayland-cvt.h | 34
hw/xwayland/xwayland-glamor-eglstream.c | 12
hw/xwayland/xwayland-glamor-gbm.c | 9
hw/xwayland/xwayland-glamor-xv.c | 5
hw/xwayland/xwayland-glamor.c | 7
hw/xwayland/xwayland-glamor.h | 136 +++
hw/xwayland/xwayland-glx.c | 4
hw/xwayland/xwayland-glx.h | 37
hw/xwayland/xwayland-input.c | 16
hw/xwayland/xwayland-input.h | 195 ++++
hw/xwayland/xwayland-output.c | 12
hw/xwayland/xwayland-output.h | 82 +
hw/xwayland/xwayland-pixmap.c | 123 ++
hw/xwayland/xwayland-pixmap.h | 47 +
hw/xwayland/xwayland-present.c | 10
hw/xwayland/xwayland-present.h | 74 +
hw/xwayland/xwayland-screen.c | 640 ++++++++++++++
hw/xwayland/xwayland-screen.h | 130 ++
hw/xwayland/xwayland-shm.c | 14
hw/xwayland/xwayland-shm.h | 41
hw/xwayland/xwayland-types.h | 34
hw/xwayland/xwayland-vidmode.c | 5
hw/xwayland/xwayland-vidmode.h | 37
hw/xwayland/xwayland-window-buffers.c | 7
hw/xwayland/xwayland-window-buffers.h | 7
hw/xwayland/xwayland-window.c | 827 ++++++++++++++++++
hw/xwayland/xwayland-window.h | 81 +
hw/xwayland/xwayland.c | 1438 --------------------------------
hw/xwayland/xwayland.h | 549 ------------
34 files changed, 2693 insertions(+), 2014 deletions(-)
New commits:
commit 58155baeac494c95a45d99d44dd9307e8aedd2af
Author: Olivier Fourdan <ofourdan at redhat.com>
Date: Wed Dec 18 15:00:11 2019 +0100
xwayland: Cleanup and remove `xwayland.h`
Now that each source and header should be in order, we can safely cleaup
the last remaining bits from the main `xwayland.h` which is not needed
anymore and can be removed.
Signed-off-by: Olivier Fourdan <ofourdan at redhat.com>
Reviewed-by: Michel Dänzer <mdaenzer at redhat.com>
diff --git a/hw/xwayland/Makefile.am b/hw/xwayland/Makefile.am
index 99e8a275b..5bb088f80 100644
--- a/hw/xwayland/Makefile.am
+++ b/hw/xwayland/Makefile.am
@@ -35,7 +35,6 @@ Xwayland_SOURCES = \
xwayland-window.h \
xwayland-window-buffers.c \
xwayland-window-buffers.h \
- xwayland.h \
$(top_srcdir)/Xi/stubs.c \
$(top_srcdir)/mi/miinitext.c
diff --git a/hw/xwayland/xwayland-cursor.c b/hw/xwayland/xwayland-cursor.c
index 44ed1fa41..91728f1c1 100644
--- a/hw/xwayland/xwayland-cursor.c
+++ b/hw/xwayland/xwayland-cursor.c
@@ -32,7 +32,6 @@
#include "inputstr.h"
#include "mipointer.h"
-#include "xwayland.h"
#include "xwayland-cursor.h"
#include "xwayland-input.h"
#include "xwayland-screen.h"
diff --git a/hw/xwayland/xwayland-cvt.c b/hw/xwayland/xwayland-cvt.c
index 9eafacf75..1bc3cec92 100644
--- a/hw/xwayland/xwayland-cvt.c
+++ b/hw/xwayland/xwayland-cvt.c
@@ -33,7 +33,6 @@
#include <string.h>
#include <randrstr.h>
-#include "xwayland.h"
#include "xwayland-cvt.h"
diff --git a/hw/xwayland/xwayland-glamor-eglstream.c b/hw/xwayland/xwayland-glamor-eglstream.c
index 27190e4a4..81947a6ba 100644
--- a/hw/xwayland/xwayland-glamor-eglstream.c
+++ b/hw/xwayland/xwayland-glamor-eglstream.c
@@ -40,7 +40,6 @@
#include <epoxy/egl.h>
-#include "xwayland.h"
#include "xwayland-glamor.h"
#include "xwayland-pixmap.h"
#include "xwayland-screen.h"
diff --git a/hw/xwayland/xwayland-glamor-gbm.c b/hw/xwayland/xwayland-glamor-gbm.c
index 6f624f773..80655fd16 100644
--- a/hw/xwayland/xwayland-glamor-gbm.c
+++ b/hw/xwayland/xwayland-glamor-gbm.c
@@ -46,7 +46,6 @@
#include <dri3.h>
#include "drm-client-protocol.h"
-#include "xwayland.h"
#include "xwayland-glamor.h"
#include "xwayland-pixmap.h"
#include "xwayland-screen.h"
diff --git a/hw/xwayland/xwayland-glamor-xv.c b/hw/xwayland/xwayland-glamor-xv.c
index fe6849cc3..23e7100e4 100644
--- a/hw/xwayland/xwayland-glamor-xv.c
+++ b/hw/xwayland/xwayland-glamor-xv.c
@@ -36,7 +36,6 @@
#include <X11/extensions/Xv.h>
-#include "xwayland.h"
#include "xwayland-glamor.h"
#define NUM_FORMATS 3
diff --git a/hw/xwayland/xwayland-glamor.c b/hw/xwayland/xwayland-glamor.c
index f18196cec..d9523b0a7 100644
--- a/hw/xwayland/xwayland-glamor.c
+++ b/hw/xwayland/xwayland-glamor.c
@@ -23,9 +23,7 @@
* SOFTWARE.
*/
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
+#include <xwayland-config.h>
#define MESA_EGL_NO_X11_HEADERS
#define EGL_NO_X11
@@ -37,7 +35,6 @@
#include "glx_extinit.h"
#endif
-#include "xwayland.h"
#include "xwayland-glamor.h"
#include "xwayland-glx.h"
#include "xwayland-screen.h"
diff --git a/hw/xwayland/xwayland-glamor.h b/hw/xwayland/xwayland-glamor.h
index 78e0d6ddd..e9896bfef 100644
--- a/hw/xwayland/xwayland-glamor.h
+++ b/hw/xwayland/xwayland-glamor.h
@@ -28,6 +28,8 @@
#include <xwayland-config.h>
+#include <wayland-client.h>
+
#include "xwayland-types.h"
struct xwl_egl_backend {
diff --git a/hw/xwayland/xwayland-glx.c b/hw/xwayland/xwayland-glx.c
index c5c634c08..4fd3e6905 100644
--- a/hw/xwayland/xwayland-glx.c
+++ b/hw/xwayland/xwayland-glx.c
@@ -31,7 +31,7 @@
*/
#include <xwayland-config.h>
-#include "xwayland.h"
+
#define MESA_EGL_NO_X11_HEADERS
#define EGL_NO_X11
// #include <EGL/egl.h>
diff --git a/hw/xwayland/xwayland-input.c b/hw/xwayland/xwayland-input.c
index a7be75d41..beaac192f 100644
--- a/hw/xwayland/xwayland-input.c
+++ b/hw/xwayland/xwayland-input.c
@@ -39,7 +39,6 @@
#include <mipointrst.h>
#include <misc.h>
-#include "xwayland.h"
#include "xwayland-cursor.h"
#include "xwayland-input.h"
#include "xwayland-window.h"
diff --git a/hw/xwayland/xwayland-output.c b/hw/xwayland/xwayland-output.c
index 6ed8ef3d6..fab47fe35 100644
--- a/hw/xwayland/xwayland-output.c
+++ b/hw/xwayland/xwayland-output.c
@@ -28,7 +28,6 @@
#include <randrstr.h>
#include <X11/Xatom.h>
-#include "xwayland.h"
#include "xwayland-cvt.h"
#include "xwayland-output.h"
#include "xwayland-screen.h"
diff --git a/hw/xwayland/xwayland-present.c b/hw/xwayland/xwayland-present.c
index 5b9ee201f..09fa66a6a 100644
--- a/hw/xwayland/xwayland-present.c
+++ b/hw/xwayland/xwayland-present.c
@@ -23,14 +23,11 @@
* SOFTWARE.
*/
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
+#include <xwayland-config.h>
#include <windowstr.h>
#include <present.h>
-#include "xwayland.h"
#include "xwayland-present.h"
#include "xwayland-screen.h"
#include "xwayland-window.h"
diff --git a/hw/xwayland/xwayland-screen.c b/hw/xwayland/xwayland-screen.c
index 4932d2cdd..b84252306 100644
--- a/hw/xwayland/xwayland-screen.c
+++ b/hw/xwayland/xwayland-screen.c
@@ -47,7 +47,6 @@
#include "xwayland-pixmap.h"
#include "xwayland-present.h"
#include "xwayland-shm.h"
-#include "xwayland.h"
#include "xdg-output-unstable-v1-client-protocol.h"
#include "viewporter-client-protocol.h"
diff --git a/hw/xwayland/xwayland-shm.c b/hw/xwayland/xwayland-shm.c
index 388e0f0f2..84d58874a 100644
--- a/hw/xwayland/xwayland-shm.c
+++ b/hw/xwayland/xwayland-shm.c
@@ -40,7 +40,6 @@
#include "os.h"
#include "pixmapstr.h"
-#include "xwayland.h"
#include "xwayland-pixmap.h"
#include "xwayland-screen.h"
#include "xwayland-shm.h"
diff --git a/hw/xwayland/xwayland-vidmode.c b/hw/xwayland/xwayland-vidmode.c
index 137200250..100ccb411 100644
--- a/hw/xwayland/xwayland-vidmode.c
+++ b/hw/xwayland/xwayland-vidmode.c
@@ -35,7 +35,7 @@
#include "extinit.h"
#ifdef XF86VIDMODE
-#include "xwayland.h"
+
#include "randrstr.h"
#include "vidmodestr.h"
diff --git a/hw/xwayland/xwayland-window-buffers.h b/hw/xwayland/xwayland-window-buffers.h
index c6b2092e3..8031f24d5 100644
--- a/hw/xwayland/xwayland-window-buffers.h
+++ b/hw/xwayland/xwayland-window-buffers.h
@@ -24,11 +24,14 @@
* Olivier Fourdan <ofourdan at redhat.com>
*/
-#include "xwayland.h"
-
#ifndef XWAYLAND_WINDOW_BUFFERS_H
#define XWAYLAND_WINDOW_BUFFERS_H
+#include <xwayland-config.h>
+
+#include "xwayland-types.h"
+#include "regionstr.h"
+
void xwl_window_buffers_init(struct xwl_window *xwl_window);
void xwl_window_buffers_recycle(struct xwl_window *xwl_window);
void xwl_window_buffers_dispose(struct xwl_window *xwl_window);
diff --git a/hw/xwayland/xwayland-window.c b/hw/xwayland/xwayland-window.c
index fee49c11e..a9128fb3d 100644
--- a/hw/xwayland/xwayland-window.c
+++ b/hw/xwayland/xwayland-window.c
@@ -42,7 +42,6 @@
#include "xwayland-window.h"
#include "xwayland-window-buffers.h"
#include "xwayland-shm.h"
-#include "xwayland.h"
#include "viewporter-client-protocol.h"
diff --git a/hw/xwayland/xwayland.c b/hw/xwayland/xwayland.c
index ff85ebbd8..608163101 100644
--- a/hw/xwayland/xwayland.c
+++ b/hw/xwayland/xwayland.c
@@ -23,6 +23,8 @@
* SOFTWARE.
*/
+#include <xwayland-config.h>
+
#include <stdio.h>
#include <X11/Xatom.h>
@@ -36,7 +38,6 @@
#include <xserver_poll.h>
#include <propertyst.h>
-#include "xwayland.h"
#include "xwayland-screen.h"
#include "xwayland-vidmode.h"
diff --git a/hw/xwayland/xwayland.h b/hw/xwayland/xwayland.h
deleted file mode 100644
index f6552978a..000000000
--- a/hw/xwayland/xwayland.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright © 2014 Intel Corporation
- *
- * Permission to use, copy, modify, distribute, and sell this software
- * and its documentation for any purpose is hereby granted without
- * fee, provided that the above copyright notice appear in all copies
- * and that both that copyright notice and this permission notice
- * appear in supporting documentation, and that the name of the
- * copyright holders not be used in advertising or publicity
- * pertaining to distribution of the software without specific,
- * written prior permission. The copyright holders make no
- * representations about the suitability of this software for any
- * purpose. It is provided "as is" without express or implied
- * warranty.
- *
- * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
- * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
- * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
- * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
- * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
- * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
- */
-
-#ifndef XWAYLAND_H
-#define XWAYLAND_H
-
-#include <xwayland-config.h>
-
-#include <stdio.h>
-#include <unistd.h>
-#include <errno.h>
-
-#include <wayland-client.h>
-
-#include <X11/X.h>
-
-#include <fb.h>
-#include <dix.h>
-#include <exevents.h>
-
-#include "relative-pointer-unstable-v1-client-protocol.h"
-#include "pointer-constraints-unstable-v1-client-protocol.h"
-#include "tablet-unstable-v2-client-protocol.h"
-#include "xwayland-keyboard-grab-unstable-v1-client-protocol.h"
-#include "linux-dmabuf-unstable-v1-client-protocol.h"
-
-#include "xwayland-types.h"
-
-#endif
commit c830bd847fa5b60db95dcbb54dde3868f2a31a9a
Author: Olivier Fourdan <ofourdan at redhat.com>
Date: Wed Dec 18 10:33:16 2019 +0100
xwayland: Remove `MODIFIER_META` definition
It's nowhere to be used.
Signed-off-by: Olivier Fourdan <ofourdan at redhat.com>
Reviewed-by: Michel Dänzer <mdaenzer at redhat.com>
diff --git a/hw/xwayland/xwayland.h b/hw/xwayland/xwayland.h
index 81cd120cd..f6552978a 100644
--- a/hw/xwayland/xwayland.h
+++ b/hw/xwayland/xwayland.h
@@ -48,6 +48,4 @@
#include "xwayland-types.h"
-#define MODIFIER_META 0x01
-
#endif
commit 4c644fd792e642fc566f7b0b08bc000ecf641a50
Author: Olivier Fourdan <ofourdan at redhat.com>
Date: Wed Dec 18 14:13:34 2019 +0100
xwayland: Move Xwayland GLX declaration
Move the Xwayland GLX declaration to its own header file.
Signed-off-by: Olivier Fourdan <ofourdan at redhat.com>
Reviewed-by: Michel Dänzer <mdaenzer at redhat.com>
diff --git a/hw/xwayland/Makefile.am b/hw/xwayland/Makefile.am
index 5d6a2ab91..99e8a275b 100644
--- a/hw/xwayland/Makefile.am
+++ b/hw/xwayland/Makefile.am
@@ -16,6 +16,7 @@ Xwayland_SOURCES = \
xwayland-cursor.c \
xwayland-cursor.h \
xwayland-glamor.h \
+ xwayland-glx.h \
xwayland-pixmap.c \
xwayland-pixmap.h \
xwayland-present.h \
diff --git a/hw/xwayland/meson.build b/hw/xwayland/meson.build
index 640af0634..b6d060363 100644
--- a/hw/xwayland/meson.build
+++ b/hw/xwayland/meson.build
@@ -5,6 +5,7 @@ srcs = [
'xwayland-cursor.c',
'xwayland-cursor.h',
'xwayland-glamor.h',
+ 'xwayland-glx.h',
'xwayland-pixmap.c',
'xwayland-pixmap.h',
'xwayland-present.h',
diff --git a/hw/xwayland/xwayland-glamor.c b/hw/xwayland/xwayland-glamor.c
index e7c984c83..f18196cec 100644
--- a/hw/xwayland/xwayland-glamor.c
+++ b/hw/xwayland/xwayland-glamor.c
@@ -39,6 +39,7 @@
#include "xwayland.h"
#include "xwayland-glamor.h"
+#include "xwayland-glx.h"
#include "xwayland-screen.h"
#include "xwayland-window.h"
diff --git a/hw/xwayland/xwayland-glx.h b/hw/xwayland/xwayland-glx.h
new file mode 100644
index 000000000..62c9fb7ce
--- /dev/null
+++ b/hw/xwayland/xwayland-glx.h
@@ -0,0 +1,37 @@
+/*
+ * Copyright © 2019 Red Hat, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ * Authors:
+ * Adam Jackson <ajax at redhat.com>
+ */
+
+#ifndef XWAYLAND_GLX_H
+#define XWAYLAND_GLX_H
+
+#include <xwayland-config.h>
+
+#ifdef GLXEXT
+#include "glx_extinit.h"
+extern __GLXprovider glamor_provider;
+#endif
+
+#endif /* XWAYLAND_GLX_H */
diff --git a/hw/xwayland/xwayland.h b/hw/xwayland/xwayland.h
index 187af6697..81cd120cd 100644
--- a/hw/xwayland/xwayland.h
+++ b/hw/xwayland/xwayland.h
@@ -50,9 +50,4 @@
#define MODIFIER_META 0x01
-#ifdef GLXEXT
-#include "glx_extinit.h"
-extern __GLXprovider glamor_provider;
-#endif
-
#endif
commit 808a0a038b945171e0c6e18093fe1b9daeafe26a
Author: Olivier Fourdan <ofourdan at redhat.com>
Date: Wed Dec 18 11:18:22 2019 +0100
xwayland: Move Xwayland vidmode declaration
Move the Xwayland vidmode declaration to its own header file.
Signed-off-by: Olivier Fourdan <ofourdan at redhat.com>
Reviewed-by: Michel Dänzer <mdaenzer at redhat.com>
diff --git a/hw/xwayland/Makefile.am b/hw/xwayland/Makefile.am
index a7dc78389..5d6a2ab91 100644
--- a/hw/xwayland/Makefile.am
+++ b/hw/xwayland/Makefile.am
@@ -29,6 +29,7 @@ Xwayland_SOURCES = \
xwayland-cvt.c \
xwayland-cvt.h \
xwayland-vidmode.c \
+ xwayland-vidmode.h \
xwayland-window.c \
xwayland-window.h \
xwayland-window-buffers.c \
diff --git a/hw/xwayland/meson.build b/hw/xwayland/meson.build
index e6da62a88..640af0634 100644
--- a/hw/xwayland/meson.build
+++ b/hw/xwayland/meson.build
@@ -18,6 +18,7 @@ srcs = [
'xwayland-cvt.c',
'xwayland-cvt.h',
'xwayland-vidmode.c',
+ 'xwayland-vidmode.h',
'xwayland-window.c',
'xwayland-window.h',
'xwayland-window-buffers.c',
diff --git a/hw/xwayland/xwayland-vidmode.c b/hw/xwayland/xwayland-vidmode.c
index 8ff68ba53..137200250 100644
--- a/hw/xwayland/xwayland-vidmode.c
+++ b/hw/xwayland/xwayland-vidmode.c
@@ -40,6 +40,7 @@
#include "vidmodestr.h"
#include "xwayland-screen.h"
+#include "xwayland-vidmode.h"
static DevPrivateKeyRec xwlVidModePrivateKeyRec;
#define xwlVidModePrivateKey (&xwlVidModePrivateKeyRec)
diff --git a/hw/xwayland/xwayland-vidmode.h b/hw/xwayland/xwayland-vidmode.h
new file mode 100644
index 000000000..4e3236eb1
--- /dev/null
+++ b/hw/xwayland/xwayland-vidmode.h
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 1999-2003 by The XFree86 Project, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the copyright holder(s)
+ * and author(s) shall not be used in advertising or otherwise to promote
+ * the sale, use or other dealings in this Software without prior written
+ * authorization from the copyright holder(s) and author(s).
+ */
+
+#ifndef XWAYLAND_VIDMODE_H
+#define XWAYLAND_VIDMODE_H
+
+#include <xwayland-config.h>
+
+#ifdef XF86VIDMODE
+void xwlVidModeExtensionInit(void);
+#endif
+
+#endif /* XWAYLAND_VIDMODE_H */
diff --git a/hw/xwayland/xwayland.c b/hw/xwayland/xwayland.c
index d45caffbe..ff85ebbd8 100644
--- a/hw/xwayland/xwayland.c
+++ b/hw/xwayland/xwayland.c
@@ -38,6 +38,7 @@
#include "xwayland.h"
#include "xwayland-screen.h"
+#include "xwayland-vidmode.h"
#ifdef XF86VIDMODE
#include <X11/extensions/xf86vmproto.h>
diff --git a/hw/xwayland/xwayland.h b/hw/xwayland/xwayland.h
index bee09330a..187af6697 100644
--- a/hw/xwayland/xwayland.h
+++ b/hw/xwayland/xwayland.h
@@ -50,10 +50,6 @@
#define MODIFIER_META 0x01
-#ifdef XF86VIDMODE
-void xwlVidModeExtensionInit(void);
-#endif
-
#ifdef GLXEXT
#include "glx_extinit.h"
extern __GLXprovider glamor_provider;
commit e8ba8a94e120abf78886ca809f0bf01e7258367c
Author: Olivier Fourdan <ofourdan at redhat.com>
Date: Wed Dec 18 10:56:34 2019 +0100
xwayland: Move Xwayland CVT declaration
Move the Xwayland CVT declaration to its own header file.
Signed-off-by: Olivier Fourdan <ofourdan at redhat.com>
Reviewed-by: Michel Dänzer <mdaenzer at redhat.com>
diff --git a/hw/xwayland/Makefile.am b/hw/xwayland/Makefile.am
index 7969edcbc..a7dc78389 100644
--- a/hw/xwayland/Makefile.am
+++ b/hw/xwayland/Makefile.am
@@ -27,6 +27,7 @@ Xwayland_SOURCES = \
xwayland-output.c \
xwayland-output.h \
xwayland-cvt.c \
+ xwayland-cvt.h \
xwayland-vidmode.c \
xwayland-window.c \
xwayland-window.h \
diff --git a/hw/xwayland/meson.build b/hw/xwayland/meson.build
index 1718e8883..e6da62a88 100644
--- a/hw/xwayland/meson.build
+++ b/hw/xwayland/meson.build
@@ -16,6 +16,7 @@ srcs = [
'xwayland-output.c',
'xwayland-output.h',
'xwayland-cvt.c',
+ 'xwayland-cvt.h',
'xwayland-vidmode.c',
'xwayland-window.c',
'xwayland-window.h',
diff --git a/hw/xwayland/xwayland-cvt.c b/hw/xwayland/xwayland-cvt.c
index 8564fdbae..9eafacf75 100644
--- a/hw/xwayland/xwayland-cvt.c
+++ b/hw/xwayland/xwayland-cvt.c
@@ -29,14 +29,14 @@
* code is shared directly.
*/
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
+#include <xwayland-config.h>
#include <string.h>
#include <randrstr.h>
#include "xwayland.h"
+#include "xwayland-cvt.h"
+
/*
* Generate a CVT standard mode from HDisplay, VDisplay and VRefresh.
*
diff --git a/hw/xwayland/xwayland-cvt.h b/hw/xwayland/xwayland-cvt.h
new file mode 100644
index 000000000..64ff41e35
--- /dev/null
+++ b/hw/xwayland/xwayland-cvt.h
@@ -0,0 +1,34 @@
+/*
+ * Copyright 2005-2006 Luc Verhaegen.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#ifndef XWAYLAND_CVT_H
+#define XWAYLAND_CVT_H
+
+#include <xwayland-config.h>
+
+#include <dix.h>
+#include <randrstr.h>
+
+RRModePtr xwayland_cvt(int HDisplay, int VDisplay,
+ float VRefresh, Bool Reduced, Bool Interlaced);
+
+#endif /* XWAYLAND_CVT_H */
diff --git a/hw/xwayland/xwayland-output.c b/hw/xwayland/xwayland-output.c
index 9778f881a..6ed8ef3d6 100644
--- a/hw/xwayland/xwayland-output.c
+++ b/hw/xwayland/xwayland-output.c
@@ -29,6 +29,7 @@
#include <X11/Xatom.h>
#include "xwayland.h"
+#include "xwayland-cvt.h"
#include "xwayland-output.h"
#include "xwayland-screen.h"
#include "xwayland-window.h"
diff --git a/hw/xwayland/xwayland.h b/hw/xwayland/xwayland.h
index b084845fc..bee09330a 100644
--- a/hw/xwayland/xwayland.h
+++ b/hw/xwayland/xwayland.h
@@ -38,7 +38,6 @@
#include <fb.h>
#include <dix.h>
-#include <randrstr.h>
#include <exevents.h>
#include "relative-pointer-unstable-v1-client-protocol.h"
@@ -51,9 +50,6 @@
#define MODIFIER_META 0x01
-RRModePtr xwayland_cvt(int HDisplay, int VDisplay,
- float VRefresh, Bool Reduced, Bool Interlaced);
-
#ifdef XF86VIDMODE
void xwlVidModeExtensionInit(void);
#endif
commit 0617c635fa3577965c5fa198ed4e57da8fee919d
Author: Olivier Fourdan <ofourdan at redhat.com>
Date: Wed Dec 18 10:03:43 2019 +0100
xwayland: Separate Xwayland screen code
Move Xwayland screen related code to a separate source file and header.
Signed-off-by: Olivier Fourdan <ofourdan at redhat.com>
Reviewed-by: Michel Dänzer <mdaenzer at redhat.com>
diff --git a/hw/xwayland/Makefile.am b/hw/xwayland/Makefile.am
index 681c61d13..7969edcbc 100644
--- a/hw/xwayland/Makefile.am
+++ b/hw/xwayland/Makefile.am
@@ -19,6 +19,8 @@ Xwayland_SOURCES = \
xwayland-pixmap.c \
xwayland-pixmap.h \
xwayland-present.h \
+ xwayland-screen.c \
+ xwayland-screen.h \
xwayland-shm.c \
xwayland-shm.h \
xwayland-types.h \
diff --git a/hw/xwayland/meson.build b/hw/xwayland/meson.build
index d4a4336fe..1718e8883 100644
--- a/hw/xwayland/meson.build
+++ b/hw/xwayland/meson.build
@@ -8,6 +8,8 @@ srcs = [
'xwayland-pixmap.c',
'xwayland-pixmap.h',
'xwayland-present.h',
+ 'xwayland-screen.c',
+ 'xwayland-screen.h',
'xwayland-shm.c',
'xwayland-shm.h',
'xwayland-types.h',
diff --git a/hw/xwayland/xwayland-cursor.c b/hw/xwayland/xwayland-cursor.c
index 9c4c86aa2..44ed1fa41 100644
--- a/hw/xwayland/xwayland-cursor.c
+++ b/hw/xwayland/xwayland-cursor.c
@@ -35,6 +35,7 @@
#include "xwayland.h"
#include "xwayland-cursor.h"
#include "xwayland-input.h"
+#include "xwayland-screen.h"
#include "xwayland-shm.h"
#include "xwayland-types.h"
diff --git a/hw/xwayland/xwayland-glamor-eglstream.c b/hw/xwayland/xwayland-glamor-eglstream.c
index e052df29c..27190e4a4 100644
--- a/hw/xwayland/xwayland-glamor-eglstream.c
+++ b/hw/xwayland/xwayland-glamor-eglstream.c
@@ -43,6 +43,7 @@
#include "xwayland.h"
#include "xwayland-glamor.h"
#include "xwayland-pixmap.h"
+#include "xwayland-screen.h"
#include "wayland-eglstream-client-protocol.h"
#include "wayland-eglstream-controller-client-protocol.h"
diff --git a/hw/xwayland/xwayland-glamor-gbm.c b/hw/xwayland/xwayland-glamor-gbm.c
index 6ed097fc2..6f624f773 100644
--- a/hw/xwayland/xwayland-glamor-gbm.c
+++ b/hw/xwayland/xwayland-glamor-gbm.c
@@ -49,6 +49,7 @@
#include "xwayland.h"
#include "xwayland-glamor.h"
#include "xwayland-pixmap.h"
+#include "xwayland-screen.h"
#include "linux-dmabuf-unstable-v1-client-protocol.h"
diff --git a/hw/xwayland/xwayland-glamor.c b/hw/xwayland/xwayland-glamor.c
index 6330b1f4c..e7c984c83 100644
--- a/hw/xwayland/xwayland-glamor.c
+++ b/hw/xwayland/xwayland-glamor.c
@@ -39,6 +39,7 @@
#include "xwayland.h"
#include "xwayland-glamor.h"
+#include "xwayland-screen.h"
#include "xwayland-window.h"
static void
diff --git a/hw/xwayland/xwayland-glx.c b/hw/xwayland/xwayland-glx.c
index 0fc2a7d01..c5c634c08 100644
--- a/hw/xwayland/xwayland-glx.c
+++ b/hw/xwayland/xwayland-glx.c
@@ -43,6 +43,8 @@
#include "glamor_context.h"
#include "glamor.h"
+#include "xwayland-screen.h"
+
/* Can't get these from <GL/glx.h> since it pulls in client headers */
#define GLX_RGBA_BIT 0x00000001
#define GLX_WINDOW_BIT 0x00000001
diff --git a/hw/xwayland/xwayland-input.c b/hw/xwayland/xwayland-input.c
index 7f2d4d6a1..a7be75d41 100644
--- a/hw/xwayland/xwayland-input.c
+++ b/hw/xwayland/xwayland-input.c
@@ -43,6 +43,7 @@
#include "xwayland-cursor.h"
#include "xwayland-input.h"
#include "xwayland-window.h"
+#include "xwayland-screen.h"
#include "pointer-constraints-unstable-v1-client-protocol.h"
#include "relative-pointer-unstable-v1-client-protocol.h"
diff --git a/hw/xwayland/xwayland-output.c b/hw/xwayland/xwayland-output.c
index 6f62e5ae7..9778f881a 100644
--- a/hw/xwayland/xwayland-output.c
+++ b/hw/xwayland/xwayland-output.c
@@ -30,6 +30,7 @@
#include "xwayland.h"
#include "xwayland-output.h"
+#include "xwayland-screen.h"
#include "xwayland-window.h"
#include "xdg-output-unstable-v1-client-protocol.h"
diff --git a/hw/xwayland/xwayland-present.c b/hw/xwayland/xwayland-present.c
index 0cf18e7c1..5b9ee201f 100644
--- a/hw/xwayland/xwayland-present.c
+++ b/hw/xwayland/xwayland-present.c
@@ -32,6 +32,7 @@
#include "xwayland.h"
#include "xwayland-present.h"
+#include "xwayland-screen.h"
#include "xwayland-window.h"
#include "xwayland-pixmap.h"
#include "glamor.h"
diff --git a/hw/xwayland/xwayland-screen.c b/hw/xwayland/xwayland-screen.c
new file mode 100644
index 000000000..4932d2cdd
--- /dev/null
+++ b/hw/xwayland/xwayland-screen.c
@@ -0,0 +1,641 @@
+/*
+ * Copyright © 2011-2014 Intel Corporation
+ *
+ * Permission to use, copy, modify, distribute, and sell this software
+ * and its documentation for any purpose is hereby granted without
+ * fee, provided that the above copyright notice appear in all copies
+ * and that both that copyright notice and this permission notice
+ * appear in supporting documentation, and that the name of the
+ * copyright holders not be used in advertising or publicity
+ * pertaining to distribution of the software without specific,
+ * written prior permission. The copyright holders make no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied
+ * warranty.
+ *
+ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
+ * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
+ * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
+ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
+ */
+
+#include <xwayland-config.h>
+
+#include <stdio.h>
+#include <unistd.h>
+#include <errno.h>
+
+#include <X11/Xatom.h>
+#include <micmap.h>
+#include <misyncshm.h>
+#include <os.h>
+#include <fb.h>
+#include <dixstruct.h>
+#include <propertyst.h>
+#include <inputstr.h>
+#include <xserver_poll.h>
+
+#include "xwayland-cursor.h"
+#include "xwayland-screen.h"
+#include "xwayland-window.h"
+#include "xwayland-input.h"
+#include "xwayland-output.h"
+#include "xwayland-pixmap.h"
+#include "xwayland-present.h"
+#include "xwayland-shm.h"
+#include "xwayland.h"
+
+#include "xdg-output-unstable-v1-client-protocol.h"
+#include "viewporter-client-protocol.h"
+
+static DevPrivateKeyRec xwl_screen_private_key;
+static DevPrivateKeyRec xwl_client_private_key;
+
+_X_NORETURN
+static void _X_ATTRIBUTE_PRINTF(1, 2)
+xwl_give_up(const char *f, ...)
+{
+ va_list args;
+
+ va_start(args, f);
+ VErrorFSigSafe(f, args);
+ va_end(args);
+
+ CloseWellKnownConnections();
+ OsCleanup(TRUE);
+ fflush(stderr);
+ exit(1);
+}
+
+struct xwl_client *
+xwl_client_get(ClientPtr client)
+{
+ return dixLookupPrivate(&client->devPrivates, &xwl_client_private_key);
+}
+
+struct xwl_screen *
+xwl_screen_get(ScreenPtr screen)
+{
+ return dixLookupPrivate(&screen->devPrivates, &xwl_screen_private_key);
+}
+
+Bool
+xwl_screen_has_viewport_support(struct xwl_screen *xwl_screen)
+{
+ return wl_compositor_get_version(xwl_screen->compositor) >=
+ WL_SURFACE_DAMAGE_BUFFER_SINCE_VERSION &&
+ xwl_screen->viewporter != NULL;
+}
+
+Bool
+xwl_screen_has_resolution_change_emulation(struct xwl_screen *xwl_screen)
+{
+ /* Resolution change emulation is only supported in rootless mode and
+ * it requires viewport support.
+ */
+ return xwl_screen->rootless && xwl_screen_has_viewport_support(xwl_screen);
+}
+
+/* Return the output @ 0x0, falling back to the first output in the list */
+struct xwl_output *
+xwl_screen_get_first_output(struct xwl_screen *xwl_screen)
+{
+ struct xwl_output *xwl_output;
+
+ xorg_list_for_each_entry(xwl_output, &xwl_screen->output_list, link) {
+ if (xwl_output->x == 0 && xwl_output->y == 0)
+ return xwl_output;
+ }
+
+ if (xorg_list_is_empty(&xwl_screen->output_list))
+ return NULL;
+
+ return xorg_list_first_entry(&xwl_screen->output_list, struct xwl_output, link);
+}
+
+static void
+xwl_property_callback(CallbackListPtr *pcbl, void *closure,
+ void *calldata)
+{
+ ScreenPtr screen = closure;
+ PropertyStateRec *rec = calldata;
+ struct xwl_screen *xwl_screen;
+ struct xwl_window *xwl_window;
+
+ if (rec->win->drawable.pScreen != screen)
+ return;
+
+ xwl_window = xwl_window_get(rec->win);
+ if (!xwl_window)
+ return;
+
+ xwl_screen = xwl_screen_get(screen);
+
+ if (rec->prop->propertyName == xwl_screen->allow_commits_prop)
+ xwl_window_update_property(xwl_window, rec);
+}
+
+Bool
+xwl_close_screen(ScreenPtr screen)
+{
+ struct xwl_screen *xwl_screen = xwl_screen_get(screen);
+ struct xwl_output *xwl_output, *next_xwl_output;
+ struct xwl_seat *xwl_seat, *next_xwl_seat;
+
+ DeleteCallback(&PropertyStateCallback, xwl_property_callback, screen);
+
+ xorg_list_for_each_entry_safe(xwl_output, next_xwl_output,
+ &xwl_screen->output_list, link)
+ xwl_output_destroy(xwl_output);
+
+ xorg_list_for_each_entry_safe(xwl_seat, next_xwl_seat,
+ &xwl_screen->seat_list, link)
+ xwl_seat_destroy(xwl_seat);
+
+ xwl_screen_release_tablet_manager(xwl_screen);
+
+ RemoveNotifyFd(xwl_screen->wayland_fd);
+
+ wl_display_disconnect(xwl_screen->display);
+
+ screen->CloseScreen = xwl_screen->CloseScreen;
+ free(xwl_screen);
+
+ return screen->CloseScreen(screen);
+}
+
+static struct xwl_seat *
+xwl_screen_get_default_seat(struct xwl_screen *xwl_screen)
+{
+ if (xorg_list_is_empty(&xwl_screen->seat_list))
+ return NULL;
+
+ return container_of(xwl_screen->seat_list.prev,
+ struct xwl_seat,
+ link);
+}
+
+static void
+xwl_cursor_warped_to(DeviceIntPtr device,
+ ScreenPtr screen,
+ ClientPtr client,
+ WindowPtr window,
+ SpritePtr sprite,
+ int x, int y)
+{
+ struct xwl_screen *xwl_screen = xwl_screen_get(screen);
+ struct xwl_seat *xwl_seat = device->public.devicePrivate;
+ struct xwl_window *xwl_window;
+ WindowPtr focus;
+
+ if (!xwl_seat)
+ xwl_seat = xwl_screen_get_default_seat(xwl_screen);
+
+ if (!window)
+ window = XYToWindow(sprite, x, y);
+
+ xwl_window = xwl_window_from_window(window);
+ if (!xwl_window && xwl_seat->focus_window) {
+ focus = xwl_seat->focus_window->window;
+
+ /* Warps on non wl_surface backed Windows are only allowed
+ * as long as the pointer stays within the focus window.
+ */
+ if (x >= focus->drawable.x &&
+ y >= focus->drawable.y &&
+ x < focus->drawable.x + focus->drawable.width &&
+ y < focus->drawable.y + focus->drawable.height) {
+ if (!window) {
+ DebugF("Warp relative to pointer, assuming pointer focus\n");
+ xwl_window = xwl_seat->focus_window;
+ } else if (window == screen->root) {
+ DebugF("Warp on root window, assuming pointer focus\n");
+ xwl_window = xwl_seat->focus_window;
+ }
+ }
+ }
+ if (!xwl_window)
+ return;
+
+ xwl_seat_emulate_pointer_warp(xwl_seat, xwl_window, sprite, x, y);
+}
+
+static void
+xwl_cursor_confined_to(DeviceIntPtr device,
+ ScreenPtr screen,
+ WindowPtr window)
+{
+ struct xwl_screen *xwl_screen = xwl_screen_get(screen);
+ struct xwl_seat *xwl_seat = device->public.devicePrivate;
+ struct xwl_window *xwl_window;
+
+ if (!xwl_seat)
+ xwl_seat = xwl_screen_get_default_seat(xwl_screen);
+
+ /* xwl_seat hasn't been setup yet, don't do anything just yet */
+ if (!xwl_seat)
+ return;
+
+ if (window == screen->root) {
+ xwl_seat_unconfine_pointer(xwl_seat);
+ return;
+ }
+
+ xwl_window = xwl_window_from_window(window);
+ if (!xwl_window && xwl_seat->focus_window) {
+ /* Allow confining on InputOnly windows, but only if the geometry
+ * is the same than the focus window.
+ */
+ if (window->drawable.class == InputOnly) {
+ DebugF("Confine on InputOnly window, assuming pointer focus\n");
+ xwl_window = xwl_seat->focus_window;
+ }
+ }
+ if (!xwl_window)
+ return;
+
+ xwl_seat_confine_pointer(xwl_seat, xwl_window);
+}
+
+void
+xwl_screen_check_resolution_change_emulation(struct xwl_screen *xwl_screen)
+{
+ struct xwl_window *xwl_window;
+
+ xorg_list_for_each_entry(xwl_window, &xwl_screen->window_list, link_window)
+ xwl_window_check_resolution_change_emulation(xwl_window);
+}
+
+static void
+xwl_screen_post_damage(struct xwl_screen *xwl_screen)
+{
+ struct xwl_window *xwl_window, *next_xwl_window;
+
+ xorg_list_for_each_entry_safe(xwl_window, next_xwl_window,
+ &xwl_screen->damage_window_list, link_damage) {
+ /* If we're waiting on a frame callback from the server,
+ * don't attach a new buffer. */
+ if (xwl_window->frame_callback)
+ continue;
+
+ if (!xwl_window->allow_commits)
+ continue;
+
+#ifdef XWL_HAS_GLAMOR
+ if (xwl_screen->glamor && !xwl_glamor_allow_commits(xwl_window))
+ continue;
+#endif
+
+ xwl_window_post_damage(xwl_window);
+ }
+}
+
+static void
+registry_global(void *data, struct wl_registry *registry, uint32_t id,
+ const char *interface, uint32_t version)
+{
+ struct xwl_screen *xwl_screen = data;
+
+ if (strcmp(interface, "wl_compositor") == 0) {
+ uint32_t request_version = 1;
+
+ if (version >= WL_SURFACE_DAMAGE_BUFFER_SINCE_VERSION)
+ request_version = WL_SURFACE_DAMAGE_BUFFER_SINCE_VERSION;
+
+ xwl_screen->compositor =
+ wl_registry_bind(registry, id, &wl_compositor_interface, request_version);
+ }
+ else if (strcmp(interface, "wl_shm") == 0) {
+ xwl_screen->shm = wl_registry_bind(registry, id, &wl_shm_interface, 1);
+ }
+ else if (strcmp(interface, "wl_shell") == 0) {
+ xwl_screen->shell =
+ wl_registry_bind(registry, id, &wl_shell_interface, 1);
+ }
+ else if (strcmp(interface, "wl_output") == 0 && version >= 2) {
+ if (xwl_output_create(xwl_screen, id))
+ xwl_screen->expecting_event++;
+ }
+ else if (strcmp(interface, "zxdg_output_manager_v1") == 0) {
+ /* We support xdg-output from version 1 to version 3 */
+ version = min(version, 3);
+ xwl_screen->xdg_output_manager =
+ wl_registry_bind(registry, id, &zxdg_output_manager_v1_interface, version);
+ xwl_screen_init_xdg_output(xwl_screen);
+ }
+ else if (strcmp(interface, "wp_viewporter") == 0) {
+ xwl_screen->viewporter = wl_registry_bind(registry, id, &wp_viewporter_interface, 1);
+ }
+#ifdef XWL_HAS_GLAMOR
+ else if (xwl_screen->glamor) {
+ xwl_glamor_init_wl_registry(xwl_screen, registry, id, interface,
+ version);
+ }
+#endif
+}
+
+static void
+global_remove(void *data, struct wl_registry *registry, uint32_t name)
+{
+ struct xwl_screen *xwl_screen = data;
+ struct xwl_output *xwl_output, *tmp_xwl_output;
+
+ xorg_list_for_each_entry_safe(xwl_output, tmp_xwl_output,
+ &xwl_screen->output_list, link) {
+ if (xwl_output->server_output_id == name) {
+ xwl_output_remove(xwl_output);
+ break;
+ }
+ }
+}
+
+static const struct wl_registry_listener registry_listener = {
+ registry_global,
+ global_remove
+};
+
+static void
+xwl_read_events (struct xwl_screen *xwl_screen)
+{
+ int ret;
+
+ if (xwl_screen->wait_flush)
+ return;
+
+ ret = wl_display_read_events(xwl_screen->display);
+ if (ret == -1)
+ xwl_give_up("failed to read Wayland events: %s\n", strerror(errno));
+
+ xwl_screen->prepare_read = 0;
+
+ ret = wl_display_dispatch_pending(xwl_screen->display);
+ if (ret == -1)
+ xwl_give_up("failed to dispatch Wayland events: %s\n", strerror(errno));
+}
+
+static int
+xwl_display_pollout (struct xwl_screen *xwl_screen, int timeout)
+{
+ struct pollfd poll_fd;
+
+ poll_fd.fd = wl_display_get_fd(xwl_screen->display);
+ poll_fd.events = POLLOUT;
+
+ return xserver_poll(&poll_fd, 1, timeout);
+}
+
+static void
+xwl_dispatch_events (struct xwl_screen *xwl_screen)
+{
+ int ret = 0;
+ int ready;
+
+ if (xwl_screen->wait_flush)
+ goto pollout;
+
+ while (xwl_screen->prepare_read == 0 &&
+ wl_display_prepare_read(xwl_screen->display) == -1) {
+ ret = wl_display_dispatch_pending(xwl_screen->display);
+ if (ret == -1)
+ xwl_give_up("failed to dispatch Wayland events: %s\n",
+ strerror(errno));
+ }
+
+ xwl_screen->prepare_read = 1;
+
+pollout:
+ ready = xwl_display_pollout(xwl_screen, 5);
+ if (ready == -1 && errno != EINTR)
+ xwl_give_up("error polling on XWayland fd: %s\n", strerror(errno));
+
+ if (ready > 0)
+ ret = wl_display_flush(xwl_screen->display);
+
+ if (ret == -1 && errno != EAGAIN)
+ xwl_give_up("failed to write to XWayland fd: %s\n", strerror(errno));
+
+ xwl_screen->wait_flush = (ready == 0 || ready == -1 || ret == -1);
+}
+
+static void
+socket_handler(int fd, int ready, void *data)
+{
+ struct xwl_screen *xwl_screen = data;
+
+ xwl_read_events (xwl_screen);
+}
+
+static void
+wakeup_handler(void *data, int err)
+{
+}
+
+static void
+block_handler(void *data, void *timeout)
+{
+ struct xwl_screen *xwl_screen = data;
+
+ xwl_screen_post_damage(xwl_screen);
+ xwl_dispatch_events (xwl_screen);
+}
+
+void
+xwl_sync_events (struct xwl_screen *xwl_screen)
+{
+ xwl_dispatch_events (xwl_screen);
+ xwl_read_events (xwl_screen);
+}
+
+Bool
+xwl_screen_init(ScreenPtr pScreen, int argc, char **argv)
+{
+ static const char allow_commits[] = "_XWAYLAND_ALLOW_COMMITS";
+ struct xwl_screen *xwl_screen;
+ Pixel red_mask, blue_mask, green_mask;
+ int ret, bpc, green_bpc, i;
+#ifdef XWL_HAS_GLAMOR
+ Bool use_eglstreams = FALSE;
+#endif
+
+ xwl_screen = calloc(1, sizeof *xwl_screen);
+ if (xwl_screen == NULL)
+ return FALSE;
+
+ if (!dixRegisterPrivateKey(&xwl_screen_private_key, PRIVATE_SCREEN, 0))
+ return FALSE;
+ if (!xwl_pixmap_init())
+ return FALSE;
+ if (!xwl_window_init())
+ return FALSE;
+ /* There are no easy to use new / delete client hooks, we could use a
+ * ClientStateCallback, but it is easier to let the dix code manage the
+ * memory for us. This will zero fill the initial xwl_client data.
+ */
+ if (!dixRegisterPrivateKey(&xwl_client_private_key, PRIVATE_CLIENT,
+ sizeof(struct xwl_client)))
+ return FALSE;
+
+ dixSetPrivate(&pScreen->devPrivates, &xwl_screen_private_key, xwl_screen);
+ xwl_screen->screen = pScreen;
+
+#ifdef XWL_HAS_GLAMOR
+ xwl_screen->glamor = 1;
+#endif
+
+ for (i = 1; i < argc; i++) {
+ if (strcmp(argv[i], "-rootless") == 0) {
+ xwl_screen->rootless = 1;
+ }
+ else if (strcmp(argv[i], "-shm") == 0) {
+ xwl_screen->glamor = 0;
+ }
+ else if (strcmp(argv[i], "-eglstream") == 0) {
+#ifdef XWL_HAS_EGLSTREAM
+ use_eglstreams = TRUE;
+#else
+ ErrorF("xwayland glamor: this build does not have EGLStream support\n");
+#endif
+ }
+ }
+
+#ifdef XWL_HAS_GLAMOR
+ if (xwl_screen->glamor)
+ xwl_glamor_init_backends(xwl_screen, use_eglstreams);
+#endif
+
+ /* In rootless mode, we don't have any screen storage, and the only
+ * rendering should be to redirected mode. */
+ if (xwl_screen->rootless)
+ xwl_screen->root_clip_mode = ROOT_CLIP_INPUT_ONLY;
+ else
+ xwl_screen->root_clip_mode = ROOT_CLIP_FULL;
+
+ xorg_list_init(&xwl_screen->output_list);
+ xorg_list_init(&xwl_screen->seat_list);
+ xorg_list_init(&xwl_screen->damage_window_list);
+ xorg_list_init(&xwl_screen->window_list);
+ xwl_screen->depth = 24;
+
+ xwl_screen->display = wl_display_connect(NULL);
+ if (xwl_screen->display == NULL) {
+ ErrorF("could not connect to wayland server\n");
+ return FALSE;
+ }
+
+ if (!xwl_screen_init_output(xwl_screen))
+ return FALSE;
+
+ xwl_screen->expecting_event = 0;
+ xwl_screen->registry = wl_display_get_registry(xwl_screen->display);
+ wl_registry_add_listener(xwl_screen->registry,
+ ®istry_listener, xwl_screen);
+ ret = wl_display_roundtrip(xwl_screen->display);
+ if (ret == -1) {
+ ErrorF("could not connect to wayland server\n");
+ return FALSE;
+ }
+
+ while (xwl_screen->expecting_event > 0)
+ wl_display_roundtrip(xwl_screen->display);
+
+ bpc = xwl_screen->depth / 3;
+ green_bpc = xwl_screen->depth - 2 * bpc;
+ blue_mask = (1 << bpc) - 1;
+ green_mask = ((1 << green_bpc) - 1) << bpc;
+ red_mask = blue_mask << (green_bpc + bpc);
+
+ miSetVisualTypesAndMasks(xwl_screen->depth,
+ ((1 << TrueColor) | (1 << DirectColor)),
+ green_bpc, TrueColor,
+ red_mask, green_mask, blue_mask);
+
+ miSetPixmapDepths();
+
+ ret = fbScreenInit(pScreen, NULL,
+ xwl_screen->width, xwl_screen->height,
+ 96, 96, 0,
+ BitsPerPixel(xwl_screen->depth));
+ if (!ret)
+ return FALSE;
+
+ fbPictureInit(pScreen, 0, 0);
+
+#ifdef HAVE_XSHMFENCE
+ if (!miSyncShmScreenInit(pScreen))
+ return FALSE;
+#endif
+
+ xwl_screen->wayland_fd = wl_display_get_fd(xwl_screen->display);
+ SetNotifyFd(xwl_screen->wayland_fd, socket_handler, X_NOTIFY_READ, xwl_screen);
+ RegisterBlockAndWakeupHandlers(block_handler, wakeup_handler, xwl_screen);
+
+ pScreen->blackPixel = 0;
+ pScreen->whitePixel = 1;
+
+ ret = fbCreateDefColormap(pScreen);
+
+ if (!xwl_screen_init_cursor(xwl_screen))
+ return FALSE;
+
+#ifdef XWL_HAS_GLAMOR
+ if (xwl_screen->glamor) {
+ xwl_glamor_select_backend(xwl_screen, use_eglstreams);
+
+ if (xwl_screen->egl_backend == NULL || !xwl_glamor_init(xwl_screen)) {
+ ErrorF("Failed to initialize glamor, falling back to sw\n");
+ xwl_screen->glamor = 0;
+ }
+ }
+
+ if (xwl_screen->glamor && xwl_screen->rootless)
+ xwl_screen->present = xwl_present_init(pScreen);
+#endif
+
+ if (!xwl_screen->glamor) {
+ xwl_screen->CreateScreenResources = pScreen->CreateScreenResources;
+ pScreen->CreateScreenResources = xwl_shm_create_screen_resources;
+ pScreen->CreatePixmap = xwl_shm_create_pixmap;
+ pScreen->DestroyPixmap = xwl_shm_destroy_pixmap;
+ }
+
+ xwl_screen->RealizeWindow = pScreen->RealizeWindow;
+ pScreen->RealizeWindow = xwl_realize_window;
+
+ xwl_screen->UnrealizeWindow = pScreen->UnrealizeWindow;
+ pScreen->UnrealizeWindow = xwl_unrealize_window;
+
+ xwl_screen->DestroyWindow = pScreen->DestroyWindow;
+ pScreen->DestroyWindow = xwl_destroy_window;
+
+ xwl_screen->CloseScreen = pScreen->CloseScreen;
+ pScreen->CloseScreen = xwl_close_screen;
+
+ xwl_screen->ResizeWindow = pScreen->ResizeWindow;
+ pScreen->ResizeWindow = xwl_resize_window;
+
+ if (xwl_screen->rootless) {
+ xwl_screen->SetWindowPixmap = pScreen->SetWindowPixmap;
+ pScreen->SetWindowPixmap = xwl_window_set_window_pixmap;
+ }
+
+ pScreen->CursorWarpedTo = xwl_cursor_warped_to;
+ pScreen->CursorConfinedTo = xwl_cursor_confined_to;
+
+ xwl_screen->allow_commits_prop = MakeAtom(allow_commits,
+ strlen(allow_commits),
+ TRUE);
+ if (xwl_screen->allow_commits_prop == BAD_RESOURCE)
+ return FALSE;
+
+ AddCallback(&PropertyStateCallback, xwl_property_callback, pScreen);
+
+ wl_display_roundtrip(xwl_screen->display);
+ while (xwl_screen->expecting_event)
+ wl_display_roundtrip(xwl_screen->display);
+
+ return ret;
+}
diff --git a/hw/xwayland/xwayland-screen.h b/hw/xwayland/xwayland-screen.h
new file mode 100644
index 000000000..264c6b515
--- /dev/null
+++ b/hw/xwayland/xwayland-screen.h
@@ -0,0 +1,130 @@
+/*
+ * Copyright © 2011-2014 Intel Corporation
+ *
+ * Permission to use, copy, modify, distribute, and sell this software
+ * and its documentation for any purpose is hereby granted without
+ * fee, provided that the above copyright notice appear in all copies
+ * and that both that copyright notice and this permission notice
+ * appear in supporting documentation, and that the name of the
+ * copyright holders not be used in advertising or publicity
+ * pertaining to distribution of the software without specific,
+ * written prior permission. The copyright holders make no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied
+ * warranty.
+ *
+ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
+ * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
+ * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
+ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
+ */
+
+#ifndef XWAYLAND_SCREEN_H
+#define XWAYLAND_SCREEN_H
+
+#include <xwayland-config.h>
+
+#include <stdio.h>
+#include <unistd.h>
+#include <X11/X.h>
+#include <dix.h>
+
+#include "xwayland-types.h"
+#include "xwayland-output.h"
+#include "xwayland-glamor.h"
+
+struct xwl_format {
+ uint32_t format;
+ int num_modifiers;
+ uint64_t *modifiers;
+};
+
+struct xwl_screen {
+ int width;
+ int height;
+ int depth;
+ ScreenPtr screen;
+ int expecting_event;
+ enum RootClipMode root_clip_mode;
+
+ int rootless;
+ int glamor;
+ int present;
+
+ CreateScreenResourcesProcPtr CreateScreenResources;
+ CloseScreenProcPtr CloseScreen;
+ RealizeWindowProcPtr RealizeWindow;
+ UnrealizeWindowProcPtr UnrealizeWindow;
+ DestroyWindowProcPtr DestroyWindow;
+ XYToWindowProcPtr XYToWindow;
+ SetWindowPixmapProcPtr SetWindowPixmap;
+ ResizeWindowProcPtr ResizeWindow;
+
+ struct xorg_list output_list;
+ struct xorg_list seat_list;
+ struct xorg_list damage_window_list;
+ struct xorg_list window_list;
+
+ int wayland_fd;
+ struct wl_display *display;
+ struct wl_registry *registry;
+ struct wl_registry *input_registry;
+ struct wl_compositor *compositor;
+ struct zwp_tablet_manager_v2 *tablet_manager;
+ struct wl_shm *shm;
+ struct wl_shell *shell;
+ struct zwp_relative_pointer_manager_v1 *relative_pointer_manager;
+ struct zwp_pointer_constraints_v1 *pointer_constraints;
+ struct zwp_xwayland_keyboard_grab_manager_v1 *wp_grab;
+ struct zxdg_output_manager_v1 *xdg_output_manager;
+ struct wp_viewporter *viewporter;
+ uint32_t serial;
+
+#define XWL_FORMAT_ARGB8888 (1 << 0)
+#define XWL_FORMAT_XRGB8888 (1 << 1)
+#define XWL_FORMAT_RGB565 (1 << 2)
+
+ int prepare_read;
+ int wait_flush;
+
+ uint32_t num_formats;
+ struct xwl_format *formats;
+ void *egl_display, *egl_context;
+
+ struct xwl_egl_backend gbm_backend;
+ struct xwl_egl_backend eglstream_backend;
+ /* pointer to the current backend for creating pixmaps on wayland */
+ struct xwl_egl_backend *egl_backend;
+
+ struct glamor_context *glamor_ctx;
+
+ Atom allow_commits_prop;
+};
+
+/* Apps which use randr/vidmode to change the mode when going fullscreen,
+ * usually change the mode of only a single monitor, so this should be plenty.
+ */
+#define XWL_CLIENT_MAX_EMULATED_MODES 16
+
+struct xwl_client {
+ struct xwl_emulated_mode emulated_modes[XWL_CLIENT_MAX_EMULATED_MODES];
+};
+
+struct xwl_client *xwl_client_get(ClientPtr client);
+struct xwl_screen *xwl_screen_get(ScreenPtr screen);
+Bool xwl_screen_has_viewport_support(struct xwl_screen *xwl_screen);
+Bool xwl_screen_has_resolution_change_emulation(struct xwl_screen *xwl_screen);
+void xwl_screen_check_resolution_change_emulation(struct xwl_screen *xwl_screen);
+struct xwl_output *xwl_screen_get_first_output(struct xwl_screen *xwl_screen);
+Bool xwl_close_screen(ScreenPtr screen);
+Bool xwl_screen_init(ScreenPtr pScreen, int argc, char **argv);
+void xwl_sync_events (struct xwl_screen *xwl_screen);
+void xwl_surface_damage(struct xwl_screen *xwl_screen,
+ struct wl_surface *surface,
+ int32_t x, int32_t y, int32_t width, int32_t height);
+
+#endif /* XWAYLAND_SCREEN_H */
diff --git a/hw/xwayland/xwayland-shm.c b/hw/xwayland/xwayland-shm.c
index 995bf64f8..388e0f0f2 100644
--- a/hw/xwayland/xwayland-shm.c
+++ b/hw/xwayland/xwayland-shm.c
@@ -42,6 +42,7 @@
#include "xwayland.h"
#include "xwayland-pixmap.h"
+#include "xwayland-screen.h"
#include "xwayland-shm.h"
struct xwl_pixmap {
diff --git a/hw/xwayland/xwayland-vidmode.c b/hw/xwayland/xwayland-vidmode.c
index 56aac693a..8ff68ba53 100644
--- a/hw/xwayland/xwayland-vidmode.c
+++ b/hw/xwayland/xwayland-vidmode.c
@@ -39,6 +39,8 @@
#include "randrstr.h"
#include "vidmodestr.h"
+#include "xwayland-screen.h"
+
static DevPrivateKeyRec xwlVidModePrivateKeyRec;
#define xwlVidModePrivateKey (&xwlVidModePrivateKeyRec)
diff --git a/hw/xwayland/xwayland-window-buffers.c b/hw/xwayland/xwayland-window-buffers.c
index 6d0eac96e..ff9ed57db 100644
--- a/hw/xwayland/xwayland-window-buffers.c
+++ b/hw/xwayland/xwayland-window-buffers.c
@@ -30,6 +30,7 @@
#include "xwayland-window.h"
#include "xwayland-pixmap.h"
+#include "xwayland-screen.h"
#include "xwayland-window-buffers.h"
#define BUFFER_TIMEOUT 1 * 1000 /* ms */
diff --git a/hw/xwayland/xwayland-window.c b/hw/xwayland/xwayland-window.c
index 09ee782e5..fee49c11e 100644
--- a/hw/xwayland/xwayland-window.c
+++ b/hw/xwayland/xwayland-window.c
@@ -38,6 +38,7 @@
#include "xwayland-types.h"
#include "xwayland-input.h"
#include "xwayland-present.h"
+#include "xwayland-screen.h"
#include "xwayland-window.h"
#include "xwayland-window-buffers.h"
#include "xwayland-shm.h"
diff --git a/hw/xwayland/xwayland.c b/hw/xwayland/xwayland.c
index a9d04ddee..d45caffbe 100644
--- a/hw/xwayland/xwayland.c
+++ b/hw/xwayland/xwayland.c
@@ -37,15 +37,7 @@
#include <propertyst.h>
#include "xwayland.h"
-#include "xwayland-cursor.h"
-#include "xwayland-glamor.h"
-#include "xwayland-input.h"
-#include "xwayland-output.h"
-#include "xwayland-pixmap.h"
-#include "xwayland-present.h"
-#include "xwayland-shm.h"
-#include "xwayland-window-buffers.h"
-#include "xwayland-window.h"
+#include "xwayland-screen.h"
#ifdef XF86VIDMODE
#include <X11/extensions/xf86vmproto.h>
@@ -86,22 +78,6 @@ ddxInputThreadInit(void)
}
#endif
- _X_NORETURN
-static void _X_ATTRIBUTE_PRINTF(1, 2)
-xwl_give_up(const char *f, ...)
-{
- va_list args;
-
- va_start(args, f);
- VErrorFSigSafe(f, args);
- va_end(args);
-
- CloseWellKnownConnections();
- OsCleanup(TRUE);
- fflush(stderr);
- exit(1);
-}
-
void
ddxUseMsg(void)
{
@@ -174,388 +150,6 @@ ddxProcessArgument(int argc, char *argv[], int i)
return 0;
}
-static DevPrivateKeyRec xwl_client_private_key;
-static DevPrivateKeyRec xwl_screen_private_key;
-
-struct xwl_client *
-xwl_client_get(ClientPtr client)
-{
- return dixLookupPrivate(&client->devPrivates, &xwl_client_private_key);
-}
-
-struct xwl_screen *
-xwl_screen_get(ScreenPtr screen)
-{
- return dixLookupPrivate(&screen->devPrivates, &xwl_screen_private_key);
-}
-
-static Bool
-xwl_screen_has_viewport_support(struct xwl_screen *xwl_screen)
-{
- return wl_compositor_get_version(xwl_screen->compositor) >=
- WL_SURFACE_DAMAGE_BUFFER_SINCE_VERSION &&
- xwl_screen->viewporter != NULL;
-}
-
-Bool
-xwl_screen_has_resolution_change_emulation(struct xwl_screen *xwl_screen)
-{
- /* Resolution change emulation is only supported in rootless mode and
- * it requires viewport support.
- */
- return xwl_screen->rootless && xwl_screen_has_viewport_support(xwl_screen);
-}
-
-/* Return the output @ 0x0, falling back to the first output in the list */
-struct xwl_output *
-xwl_screen_get_first_output(struct xwl_screen *xwl_screen)
-{
- struct xwl_output *xwl_output;
-
- xorg_list_for_each_entry(xwl_output, &xwl_screen->output_list, link) {
- if (xwl_output->x == 0 && xwl_output->y == 0)
- return xwl_output;
- }
-
- if (xorg_list_is_empty(&xwl_screen->output_list))
- return NULL;
-
- return xorg_list_first_entry(&xwl_screen->output_list, struct xwl_output, link);
-}
-
-static void
-xwl_property_callback(CallbackListPtr *pcbl, void *closure,
- void *calldata)
-{
- ScreenPtr screen = closure;
- PropertyStateRec *rec = calldata;
- struct xwl_screen *xwl_screen;
- struct xwl_window *xwl_window;
-
- if (rec->win->drawable.pScreen != screen)
- return;
-
- xwl_window = xwl_window_get(rec->win);
- if (!xwl_window)
- return;
-
- xwl_screen = xwl_screen_get(screen);
-
- if (rec->prop->propertyName == xwl_screen->allow_commits_prop)
- xwl_window_update_property(xwl_window, rec);
-}
-
-static Bool
-xwl_close_screen(ScreenPtr screen)
-{
- struct xwl_screen *xwl_screen = xwl_screen_get(screen);
- struct xwl_output *xwl_output, *next_xwl_output;
- struct xwl_seat *xwl_seat, *next_xwl_seat;
-
- DeleteCallback(&PropertyStateCallback, xwl_property_callback, screen);
-
- xorg_list_for_each_entry_safe(xwl_output, next_xwl_output,
- &xwl_screen->output_list, link)
- xwl_output_destroy(xwl_output);
-
- xorg_list_for_each_entry_safe(xwl_seat, next_xwl_seat,
- &xwl_screen->seat_list, link)
- xwl_seat_destroy(xwl_seat);
-
- xwl_screen_release_tablet_manager(xwl_screen);
-
- RemoveNotifyFd(xwl_screen->wayland_fd);
-
- wl_display_disconnect(xwl_screen->display);
-
- screen->CloseScreen = xwl_screen->CloseScreen;
- free(xwl_screen);
-
- return screen->CloseScreen(screen);
-}
-
-static struct xwl_seat *
-xwl_screen_get_default_seat(struct xwl_screen *xwl_screen)
-{
- if (xorg_list_is_empty(&xwl_screen->seat_list))
- return NULL;
-
- return container_of(xwl_screen->seat_list.prev,
- struct xwl_seat,
- link);
-}
-
-static void
-xwl_cursor_warped_to(DeviceIntPtr device,
- ScreenPtr screen,
- ClientPtr client,
- WindowPtr window,
- SpritePtr sprite,
- int x, int y)
-{
- struct xwl_screen *xwl_screen = xwl_screen_get(screen);
- struct xwl_seat *xwl_seat = device->public.devicePrivate;
- struct xwl_window *xwl_window;
- WindowPtr focus;
-
- if (!xwl_seat)
- xwl_seat = xwl_screen_get_default_seat(xwl_screen);
-
- if (!window)
- window = XYToWindow(sprite, x, y);
-
- xwl_window = xwl_window_from_window(window);
- if (!xwl_window && xwl_seat->focus_window) {
- focus = xwl_seat->focus_window->window;
-
- /* Warps on non wl_surface backed Windows are only allowed
- * as long as the pointer stays within the focus window.
- */
- if (x >= focus->drawable.x &&
- y >= focus->drawable.y &&
- x < focus->drawable.x + focus->drawable.width &&
- y < focus->drawable.y + focus->drawable.height) {
- if (!window) {
- DebugF("Warp relative to pointer, assuming pointer focus\n");
- xwl_window = xwl_seat->focus_window;
- } else if (window == screen->root) {
- DebugF("Warp on root window, assuming pointer focus\n");
- xwl_window = xwl_seat->focus_window;
- }
- }
- }
- if (!xwl_window)
- return;
-
- xwl_seat_emulate_pointer_warp(xwl_seat, xwl_window, sprite, x, y);
-}
-
-static void
-xwl_cursor_confined_to(DeviceIntPtr device,
- ScreenPtr screen,
- WindowPtr window)
-{
- struct xwl_screen *xwl_screen = xwl_screen_get(screen);
- struct xwl_seat *xwl_seat = device->public.devicePrivate;
- struct xwl_window *xwl_window;
-
- if (!xwl_seat)
- xwl_seat = xwl_screen_get_default_seat(xwl_screen);
-
- /* xwl_seat hasn't been setup yet, don't do anything just yet */
- if (!xwl_seat)
- return;
-
- if (window == screen->root) {
- xwl_seat_unconfine_pointer(xwl_seat);
- return;
- }
-
- xwl_window = xwl_window_from_window(window);
- if (!xwl_window && xwl_seat->focus_window) {
- /* Allow confining on InputOnly windows, but only if the geometry
- * is the same than the focus window.
- */
- if (window->drawable.class == InputOnly) {
- DebugF("Confine on InputOnly window, assuming pointer focus\n");
- xwl_window = xwl_seat->focus_window;
- }
- }
- if (!xwl_window)
- return;
-
- xwl_seat_confine_pointer(xwl_seat, xwl_window);
-}
-
-void
-xwl_screen_check_resolution_change_emulation(struct xwl_screen *xwl_screen)
-{
- struct xwl_window *xwl_window;
-
- xorg_list_for_each_entry(xwl_window, &xwl_screen->window_list, link_window)
- xwl_window_check_resolution_change_emulation(xwl_window);
-}
-
-static void
-xwl_screen_post_damage(struct xwl_screen *xwl_screen)
-{
- struct xwl_window *xwl_window, *next_xwl_window;
-
- xorg_list_for_each_entry_safe(xwl_window, next_xwl_window,
- &xwl_screen->damage_window_list, link_damage) {
- /* If we're waiting on a frame callback from the server,
- * don't attach a new buffer. */
- if (xwl_window->frame_callback)
- continue;
-
- if (!xwl_window->allow_commits)
- continue;
-
-#ifdef XWL_HAS_GLAMOR
- if (xwl_screen->glamor && !xwl_glamor_allow_commits(xwl_window))
- continue;
-#endif
-
- xwl_window_post_damage(xwl_window);
- }
-}
-
-static void
-registry_global(void *data, struct wl_registry *registry, uint32_t id,
- const char *interface, uint32_t version)
-{
- struct xwl_screen *xwl_screen = data;
-
- if (strcmp(interface, "wl_compositor") == 0) {
- uint32_t request_version = 1;
-
- if (version >= WL_SURFACE_DAMAGE_BUFFER_SINCE_VERSION)
- request_version = WL_SURFACE_DAMAGE_BUFFER_SINCE_VERSION;
-
- xwl_screen->compositor =
- wl_registry_bind(registry, id, &wl_compositor_interface, request_version);
- }
- else if (strcmp(interface, "wl_shm") == 0) {
- xwl_screen->shm = wl_registry_bind(registry, id, &wl_shm_interface, 1);
- }
- else if (strcmp(interface, "wl_shell") == 0) {
- xwl_screen->shell =
- wl_registry_bind(registry, id, &wl_shell_interface, 1);
- }
- else if (strcmp(interface, "wl_output") == 0 && version >= 2) {
- if (xwl_output_create(xwl_screen, id))
- xwl_screen->expecting_event++;
- }
- else if (strcmp(interface, "zxdg_output_manager_v1") == 0) {
- /* We support xdg-output from version 1 to version 3 */
- version = min(version, 3);
- xwl_screen->xdg_output_manager =
- wl_registry_bind(registry, id, &zxdg_output_manager_v1_interface, version);
- xwl_screen_init_xdg_output(xwl_screen);
- }
- else if (strcmp(interface, "wp_viewporter") == 0) {
- xwl_screen->viewporter = wl_registry_bind(registry, id, &wp_viewporter_interface, 1);
- }
-#ifdef XWL_HAS_GLAMOR
- else if (xwl_screen->glamor) {
- xwl_glamor_init_wl_registry(xwl_screen, registry, id, interface,
- version);
- }
-#endif
-}
-
-static void
-global_remove(void *data, struct wl_registry *registry, uint32_t name)
-{
- struct xwl_screen *xwl_screen = data;
- struct xwl_output *xwl_output, *tmp_xwl_output;
-
- xorg_list_for_each_entry_safe(xwl_output, tmp_xwl_output,
- &xwl_screen->output_list, link) {
- if (xwl_output->server_output_id == name) {
- xwl_output_remove(xwl_output);
- break;
- }
- }
-}
-
-static const struct wl_registry_listener registry_listener = {
- registry_global,
- global_remove
-};
-
-static void
-xwl_read_events (struct xwl_screen *xwl_screen)
-{
- int ret;
-
- if (xwl_screen->wait_flush)
- return;
-
- ret = wl_display_read_events(xwl_screen->display);
- if (ret == -1)
- xwl_give_up("failed to read Wayland events: %s\n", strerror(errno));
-
- xwl_screen->prepare_read = 0;
-
- ret = wl_display_dispatch_pending(xwl_screen->display);
- if (ret == -1)
- xwl_give_up("failed to dispatch Wayland events: %s\n", strerror(errno));
-}
-
-static int
-xwl_display_pollout (struct xwl_screen *xwl_screen, int timeout)
-{
- struct pollfd poll_fd;
-
- poll_fd.fd = wl_display_get_fd(xwl_screen->display);
- poll_fd.events = POLLOUT;
-
- return xserver_poll(&poll_fd, 1, timeout);
-}
-
-static void
-xwl_dispatch_events (struct xwl_screen *xwl_screen)
-{
- int ret = 0;
- int ready;
-
- if (xwl_screen->wait_flush)
- goto pollout;
-
- while (xwl_screen->prepare_read == 0 &&
- wl_display_prepare_read(xwl_screen->display) == -1) {
- ret = wl_display_dispatch_pending(xwl_screen->display);
- if (ret == -1)
- xwl_give_up("failed to dispatch Wayland events: %s\n",
- strerror(errno));
- }
-
- xwl_screen->prepare_read = 1;
-
-pollout:
- ready = xwl_display_pollout(xwl_screen, 5);
- if (ready == -1 && errno != EINTR)
- xwl_give_up("error polling on XWayland fd: %s\n", strerror(errno));
-
- if (ready > 0)
- ret = wl_display_flush(xwl_screen->display);
-
- if (ret == -1 && errno != EAGAIN)
- xwl_give_up("failed to write to XWayland fd: %s\n", strerror(errno));
-
- xwl_screen->wait_flush = (ready == 0 || ready == -1 || ret == -1);
-}
-
-static void
-socket_handler(int fd, int ready, void *data)
-{
- struct xwl_screen *xwl_screen = data;
-
- xwl_read_events (xwl_screen);
-}
-
-static void
-wakeup_handler(void *data, int err)
-{
-}
-
-static void
-block_handler(void *data, void *timeout)
-{
- struct xwl_screen *xwl_screen = data;
-
- xwl_screen_post_damage(xwl_screen);
- xwl_dispatch_events (xwl_screen);
-}
-
-void
-xwl_sync_events (struct xwl_screen *xwl_screen)
-{
- xwl_dispatch_events (xwl_screen);
- xwl_read_events (xwl_screen);
-}
-
static CARD32
add_client_fd(OsTimerPtr timer, CARD32 time, void *arg)
{
@@ -595,196 +189,6 @@ wm_selection_callback(CallbackListPtr *p, void *data, void *arg)
DeleteCallback(&SelectionCallback, wm_selection_callback, xwl_screen);
}
-static Bool
-xwl_screen_init(ScreenPtr pScreen, int argc, char **argv)
-{
- static const char allow_commits[] = "_XWAYLAND_ALLOW_COMMITS";
- struct xwl_screen *xwl_screen;
- Pixel red_mask, blue_mask, green_mask;
- int ret, bpc, green_bpc, i;
-#ifdef XWL_HAS_GLAMOR
- Bool use_eglstreams = FALSE;
-#endif
-
- xwl_screen = calloc(1, sizeof *xwl_screen);
- if (xwl_screen == NULL)
- return FALSE;
-
- if (!dixRegisterPrivateKey(&xwl_screen_private_key, PRIVATE_SCREEN, 0))
- return FALSE;
- if (!xwl_pixmap_init())
- return FALSE;
- if (!xwl_window_init())
- return FALSE;
- /* There are no easy to use new / delete client hooks, we could use a
- * ClientStateCallback, but it is easier to let the dix code manage the
- * memory for us. This will zero fill the initial xwl_client data.
- */
- if (!dixRegisterPrivateKey(&xwl_client_private_key, PRIVATE_CLIENT,
- sizeof(struct xwl_client)))
- return FALSE;
-
- dixSetPrivate(&pScreen->devPrivates, &xwl_screen_private_key, xwl_screen);
- xwl_screen->screen = pScreen;
-
-#ifdef XWL_HAS_GLAMOR
- xwl_screen->glamor = 1;
-#endif
-
- for (i = 1; i < argc; i++) {
- if (strcmp(argv[i], "-rootless") == 0) {
- xwl_screen->rootless = 1;
- }
- else if (strcmp(argv[i], "-shm") == 0) {
- xwl_screen->glamor = 0;
- }
- else if (strcmp(argv[i], "-eglstream") == 0) {
-#ifdef XWL_HAS_EGLSTREAM
- use_eglstreams = TRUE;
-#else
- ErrorF("xwayland glamor: this build does not have EGLStream support\n");
-#endif
- }
- }
-
-#ifdef XWL_HAS_GLAMOR
- if (xwl_screen->glamor)
- xwl_glamor_init_backends(xwl_screen, use_eglstreams);
-#endif
-
- /* In rootless mode, we don't have any screen storage, and the only
- * rendering should be to redirected mode. */
- if (xwl_screen->rootless)
- xwl_screen->root_clip_mode = ROOT_CLIP_INPUT_ONLY;
- else
- xwl_screen->root_clip_mode = ROOT_CLIP_FULL;
-
- xorg_list_init(&xwl_screen->output_list);
- xorg_list_init(&xwl_screen->seat_list);
- xorg_list_init(&xwl_screen->damage_window_list);
- xorg_list_init(&xwl_screen->window_list);
- xwl_screen->depth = 24;
-
- xwl_screen->display = wl_display_connect(NULL);
- if (xwl_screen->display == NULL) {
- ErrorF("could not connect to wayland server\n");
- return FALSE;
- }
-
- if (!xwl_screen_init_output(xwl_screen))
- return FALSE;
-
- xwl_screen->expecting_event = 0;
- xwl_screen->registry = wl_display_get_registry(xwl_screen->display);
- wl_registry_add_listener(xwl_screen->registry,
- ®istry_listener, xwl_screen);
- ret = wl_display_roundtrip(xwl_screen->display);
- if (ret == -1) {
- ErrorF("could not connect to wayland server\n");
- return FALSE;
- }
-
- while (xwl_screen->expecting_event > 0)
- wl_display_roundtrip(xwl_screen->display);
-
- bpc = xwl_screen->depth / 3;
- green_bpc = xwl_screen->depth - 2 * bpc;
- blue_mask = (1 << bpc) - 1;
- green_mask = ((1 << green_bpc) - 1) << bpc;
- red_mask = blue_mask << (green_bpc + bpc);
-
- miSetVisualTypesAndMasks(xwl_screen->depth,
- ((1 << TrueColor) | (1 << DirectColor)),
- green_bpc, TrueColor,
- red_mask, green_mask, blue_mask);
-
- miSetPixmapDepths();
-
- ret = fbScreenInit(pScreen, NULL,
- xwl_screen->width, xwl_screen->height,
- 96, 96, 0,
- BitsPerPixel(xwl_screen->depth));
- if (!ret)
- return FALSE;
-
- fbPictureInit(pScreen, 0, 0);
-
-#ifdef HAVE_XSHMFENCE
- if (!miSyncShmScreenInit(pScreen))
- return FALSE;
-#endif
-
- xwl_screen->wayland_fd = wl_display_get_fd(xwl_screen->display);
- SetNotifyFd(xwl_screen->wayland_fd, socket_handler, X_NOTIFY_READ, xwl_screen);
- RegisterBlockAndWakeupHandlers(block_handler, wakeup_handler, xwl_screen);
-
- pScreen->blackPixel = 0;
- pScreen->whitePixel = 1;
-
- ret = fbCreateDefColormap(pScreen);
-
- if (!xwl_screen_init_cursor(xwl_screen))
- return FALSE;
-
-#ifdef XWL_HAS_GLAMOR
- if (xwl_screen->glamor) {
- xwl_glamor_select_backend(xwl_screen, use_eglstreams);
-
- if (xwl_screen->egl_backend == NULL || !xwl_glamor_init(xwl_screen)) {
- ErrorF("Failed to initialize glamor, falling back to sw\n");
- xwl_screen->glamor = 0;
- }
- }
-
- if (xwl_screen->glamor && xwl_screen->rootless)
- xwl_screen->present = xwl_present_init(pScreen);
-#endif
-
- if (!xwl_screen->glamor) {
- xwl_screen->CreateScreenResources = pScreen->CreateScreenResources;
- pScreen->CreateScreenResources = xwl_shm_create_screen_resources;
- pScreen->CreatePixmap = xwl_shm_create_pixmap;
- pScreen->DestroyPixmap = xwl_shm_destroy_pixmap;
- }
-
- xwl_screen->RealizeWindow = pScreen->RealizeWindow;
- pScreen->RealizeWindow = xwl_realize_window;
-
- xwl_screen->UnrealizeWindow = pScreen->UnrealizeWindow;
- pScreen->UnrealizeWindow = xwl_unrealize_window;
-
- xwl_screen->DestroyWindow = pScreen->DestroyWindow;
- pScreen->DestroyWindow = xwl_destroy_window;
-
- xwl_screen->CloseScreen = pScreen->CloseScreen;
- pScreen->CloseScreen = xwl_close_screen;
-
- xwl_screen->ResizeWindow = pScreen->ResizeWindow;
- pScreen->ResizeWindow = xwl_resize_window;
-
- if (xwl_screen->rootless) {
- xwl_screen->SetWindowPixmap = pScreen->SetWindowPixmap;
- pScreen->SetWindowPixmap = xwl_window_set_window_pixmap;
- }
-
- pScreen->CursorWarpedTo = xwl_cursor_warped_to;
- pScreen->CursorConfinedTo = xwl_cursor_confined_to;
-
- xwl_screen->allow_commits_prop = MakeAtom(allow_commits,
- strlen(allow_commits),
- TRUE);
- if (xwl_screen->allow_commits_prop == BAD_RESOURCE)
- return FALSE;
-
- AddCallback(&PropertyStateCallback, xwl_property_callback, pScreen);
-
- wl_display_roundtrip(xwl_screen->display);
- while (xwl_screen->expecting_event)
- wl_display_roundtrip(xwl_screen->display);
-
- return ret;
-}
-
_X_NORETURN
static void _X_ATTRIBUTE_PRINTF(1, 0)
xwl_log_handler(const char *format, va_list args)
diff --git a/hw/xwayland/xwayland.h b/hw/xwayland/xwayland.h
index b22b21a19..b084845fc 100644
--- a/hw/xwayland/xwayland.h
+++ b/hw/xwayland/xwayland.h
@@ -45,105 +45,12 @@
#include "pointer-constraints-unstable-v1-client-protocol.h"
#include "tablet-unstable-v2-client-protocol.h"
#include "xwayland-keyboard-grab-unstable-v1-client-protocol.h"
-#include "xdg-output-unstable-v1-client-protocol.h"
#include "linux-dmabuf-unstable-v1-client-protocol.h"
-#include "viewporter-client-protocol.h"
#include "xwayland-types.h"
-#include "xwayland-output.h"
-#include "xwayland-glamor.h"
-
-struct xwl_format {
- uint32_t format;
- int num_modifiers;
- uint64_t *modifiers;
-};
-
-struct xwl_screen {
- int width;
- int height;
- int depth;
- ScreenPtr screen;
- int expecting_event;
- enum RootClipMode root_clip_mode;
-
- int rootless;
- int glamor;
- int present;
-
- CreateScreenResourcesProcPtr CreateScreenResources;
- CloseScreenProcPtr CloseScreen;
- RealizeWindowProcPtr RealizeWindow;
- UnrealizeWindowProcPtr UnrealizeWindow;
- DestroyWindowProcPtr DestroyWindow;
- XYToWindowProcPtr XYToWindow;
- SetWindowPixmapProcPtr SetWindowPixmap;
- ResizeWindowProcPtr ResizeWindow;
-
- struct xorg_list output_list;
- struct xorg_list seat_list;
- struct xorg_list damage_window_list;
- struct xorg_list window_list;
-
- int wayland_fd;
- struct wl_display *display;
- struct wl_registry *registry;
- struct wl_registry *input_registry;
- struct wl_compositor *compositor;
- struct zwp_tablet_manager_v2 *tablet_manager;
- struct wl_shm *shm;
- struct wl_shell *shell;
- struct zwp_relative_pointer_manager_v1 *relative_pointer_manager;
- struct zwp_pointer_constraints_v1 *pointer_constraints;
- struct zwp_xwayland_keyboard_grab_manager_v1 *wp_grab;
- struct zxdg_output_manager_v1 *xdg_output_manager;
- struct wp_viewporter *viewporter;
- uint32_t serial;
-
-#define XWL_FORMAT_ARGB8888 (1 << 0)
-#define XWL_FORMAT_XRGB8888 (1 << 1)
-#define XWL_FORMAT_RGB565 (1 << 2)
-
- int prepare_read;
- int wait_flush;
-
- uint32_t num_formats;
- struct xwl_format *formats;
- void *egl_display, *egl_context;
-
- struct xwl_egl_backend gbm_backend;
- struct xwl_egl_backend eglstream_backend;
- /* pointer to the current backend for creating pixmaps on wayland */
- struct xwl_egl_backend *egl_backend;
-
- struct glamor_context *glamor_ctx;
-
- Atom allow_commits_prop;
-};
#define MODIFIER_META 0x01
-/* Apps which use randr/vidmode to change the mode when going fullscreen,
- * usually change the mode of only a single monitor, so this should be plenty.
- */
-#define XWL_CLIENT_MAX_EMULATED_MODES 16
-
-struct xwl_client {
- struct xwl_emulated_mode emulated_modes[XWL_CLIENT_MAX_EMULATED_MODES];
-};
-
-struct xwl_client *xwl_client_get(ClientPtr client);
-
-void xwl_sync_events (struct xwl_screen *xwl_screen);
-void xwl_surface_damage(struct xwl_screen *xwl_screen,
- struct wl_surface *surface,
- int32_t x, int32_t y, int32_t width, int32_t height);
-
-struct xwl_screen *xwl_screen_get(ScreenPtr screen);
-Bool xwl_screen_has_resolution_change_emulation(struct xwl_screen *xwl_screen);
-struct xwl_output *xwl_screen_get_first_output(struct xwl_screen *xwl_screen);
-void xwl_screen_check_resolution_change_emulation(struct xwl_screen *xwl_screen);
-
RRModePtr xwayland_cvt(int HDisplay, int VDisplay,
float VRefresh, Bool Reduced, Bool Interlaced);
commit 211609a9387a5fb0df83ef6ddea59ef817ea2f59
Author: Olivier Fourdan <ofourdan at redhat.com>
Date: Wed Dec 18 10:45:17 2019 +0100
xwayland: Move Xwayland cursor declarations
Move the Xwayland cursor declarations to their own header file.
Signed-off-by: Olivier Fourdan <ofourdan at redhat.com>
Reviewed-by: Michel Dänzer <mdaenzer at redhat.com>
diff --git a/hw/xwayland/Makefile.am b/hw/xwayland/Makefile.am
index 9e77e6f81..681c61d13 100644
--- a/hw/xwayland/Makefile.am
+++ b/hw/xwayland/Makefile.am
@@ -14,6 +14,7 @@ Xwayland_SOURCES = \
xwayland-input.c \
xwayland-input.h \
xwayland-cursor.c \
+ xwayland-cursor.h \
xwayland-glamor.h \
xwayland-pixmap.c \
xwayland-pixmap.h \
diff --git a/hw/xwayland/meson.build b/hw/xwayland/meson.build
index 93672024e..d4a4336fe 100644
--- a/hw/xwayland/meson.build
+++ b/hw/xwayland/meson.build
@@ -3,6 +3,7 @@ srcs = [
'xwayland-input.c',
'xwayland-input.h',
'xwayland-cursor.c',
+ 'xwayland-cursor.h',
'xwayland-glamor.h',
'xwayland-pixmap.c',
'xwayland-pixmap.h',
diff --git a/hw/xwayland/xwayland-cursor.c b/hw/xwayland/xwayland-cursor.c
index 91b863e22..9c4c86aa2 100644
--- a/hw/xwayland/xwayland-cursor.c
+++ b/hw/xwayland/xwayland-cursor.c
@@ -33,6 +33,7 @@
#include "mipointer.h"
#include "xwayland.h"
+#include "xwayland-cursor.h"
#include "xwayland-input.h"
#include "xwayland-shm.h"
#include "xwayland-types.h"
diff --git a/hw/xwayland/xwayland-cursor.h b/hw/xwayland/xwayland-cursor.h
new file mode 100644
index 000000000..401e814a7
--- /dev/null
+++ b/hw/xwayland/xwayland-cursor.h
@@ -0,0 +1,38 @@
+/*
+ * Copyright © 2014 Intel Corporation
+ * Copyright © 2011 Kristian Høgsberg
+ *
+ * Permission to use, copy, modify, distribute, and sell this software
+ * and its documentation for any purpose is hereby granted without
+ * fee, provided that the above copyright notice appear in all copies
+ * and that both that copyright notice and this permission notice
+ * appear in supporting documentation, and that the name of the
+ * copyright holders not be used in advertising or publicity
+ * pertaining to distribution of the software without specific,
+ * written prior permission. The copyright holders make no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied
+ * warranty.
+ *
+ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
+ * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
+ * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
+ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
+ */
+
+#ifndef XWAYLAND_CURSOR_H
+#define XWAYLAND_CURSOR_H
+
+#include <xwayland-config.h>
+#include <xwayland-types.h>
+#include <xwayland-input.h>
+
+void xwl_tablet_tool_set_cursor(struct xwl_tablet_tool *tool);
+void xwl_seat_set_cursor(struct xwl_seat *xwl_seat);
+Bool xwl_screen_init_cursor(struct xwl_screen *xwl_screen);
+
+#endif /* XWAYLAND_CURSOR_H */
diff --git a/hw/xwayland/xwayland-input.c b/hw/xwayland/xwayland-input.c
index 2561e7d9b..7f2d4d6a1 100644
--- a/hw/xwayland/xwayland-input.c
+++ b/hw/xwayland/xwayland-input.c
@@ -40,6 +40,7 @@
#include <misc.h>
#include "xwayland.h"
+#include "xwayland-cursor.h"
#include "xwayland-input.h"
#include "xwayland-window.h"
diff --git a/hw/xwayland/xwayland-input.h b/hw/xwayland/xwayland-input.h
index cf2794430..e7e21fcfd 100644
--- a/hw/xwayland/xwayland-input.h
+++ b/hw/xwayland/xwayland-input.h
@@ -173,9 +173,6 @@ struct xwl_tablet_pad {
struct xorg_list pad_group_list;
};
-void xwl_tablet_tool_set_cursor(struct xwl_tablet_tool *tool);
-void xwl_seat_set_cursor(struct xwl_seat *xwl_seat);
-
void xwl_seat_destroy(struct xwl_seat *xwl_seat);
void xwl_seat_clear_touch(struct xwl_seat *xwl_seat, WindowPtr window);
diff --git a/hw/xwayland/xwayland.c b/hw/xwayland/xwayland.c
index a613ced6e..a9d04ddee 100644
--- a/hw/xwayland/xwayland.c
+++ b/hw/xwayland/xwayland.c
@@ -37,6 +37,7 @@
#include <propertyst.h>
#include "xwayland.h"
+#include "xwayland-cursor.h"
#include "xwayland-glamor.h"
#include "xwayland-input.h"
#include "xwayland-output.h"
diff --git a/hw/xwayland/xwayland.h b/hw/xwayland/xwayland.h
index 46f67e61e..b22b21a19 100644
--- a/hw/xwayland/xwayland.h
+++ b/hw/xwayland/xwayland.h
@@ -139,8 +139,6 @@ void xwl_surface_damage(struct xwl_screen *xwl_screen,
struct wl_surface *surface,
int32_t x, int32_t y, int32_t width, int32_t height);
-Bool xwl_screen_init_cursor(struct xwl_screen *xwl_screen);
-
struct xwl_screen *xwl_screen_get(ScreenPtr screen);
Bool xwl_screen_has_resolution_change_emulation(struct xwl_screen *xwl_screen);
struct xwl_output *xwl_screen_get_first_output(struct xwl_screen *xwl_screen);
commit aaeeb10b74920110c36efe069a47722bda5063dd
Author: Olivier Fourdan <ofourdan at redhat.com>
Date: Tue Dec 17 18:02:17 2019 +0100
xwayland: Move Xwayland output declarations
Move the Xwayland output declarations to their own header file.
Signed-off-by: Olivier Fourdan <ofourdan at redhat.com>
Reviewed-by: Michel Dänzer <mdaenzer at redhat.com>
diff --git a/hw/xwayland/Makefile.am b/hw/xwayland/Makefile.am
index 6c281259c..9e77e6f81 100644
--- a/hw/xwayland/Makefile.am
+++ b/hw/xwayland/Makefile.am
@@ -22,6 +22,7 @@ Xwayland_SOURCES = \
xwayland-shm.h \
xwayland-types.h \
xwayland-output.c \
+ xwayland-output.h \
xwayland-cvt.c \
xwayland-vidmode.c \
xwayland-window.c \
diff --git a/hw/xwayland/meson.build b/hw/xwayland/meson.build
index 273200e8c..93672024e 100644
--- a/hw/xwayland/meson.build
+++ b/hw/xwayland/meson.build
@@ -11,6 +11,7 @@ srcs = [
'xwayland-shm.h',
'xwayland-types.h',
'xwayland-output.c',
+ 'xwayland-output.h',
'xwayland-cvt.c',
'xwayland-vidmode.c',
'xwayland-window.c',
diff --git a/hw/xwayland/xwayland-output.c b/hw/xwayland/xwayland-output.c
index 238bebcdf..6f62e5ae7 100644
--- a/hw/xwayland/xwayland-output.c
+++ b/hw/xwayland/xwayland-output.c
@@ -29,6 +29,7 @@
#include <X11/Xatom.h>
#include "xwayland.h"
+#include "xwayland-output.h"
#include "xwayland-window.h"
#include "xdg-output-unstable-v1-client-protocol.h"
diff --git a/hw/xwayland/xwayland-output.h b/hw/xwayland/xwayland-output.h
new file mode 100644
index 000000000..02b983108
--- /dev/null
+++ b/hw/xwayland/xwayland-output.h
@@ -0,0 +1,82 @@
+/*
+ * Copyright © 2011-2014 Intel Corporation
+ *
+ * Permission to use, copy, modify, distribute, and sell this software
+ * and its documentation for any purpose is hereby granted without
+ * fee, provided that the above copyright notice appear in all copies
+ * and that both that copyright notice and this permission notice
+ * appear in supporting documentation, and that the name of the
+ * copyright holders not be used in advertising or publicity
+ * pertaining to distribution of the software without specific,
+ * written prior permission. The copyright holders make no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied
+ * warranty.
+ *
+ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
+ * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
+ * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
+ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
+ */
+
+#ifndef XWAYLAND_OUTPUT_H
+#define XWAYLAND_OUTPUT_H
+
+#include <xwayland-config.h>
+#include <wayland-client.h>
+
+#include <dix.h>
+#include <input.h>
+#include <randrstr.h>
+
+#include "xwayland-types.h"
+
+struct xwl_output {
+ struct xorg_list link;
+ struct wl_output *output;
+ struct zxdg_output_v1 *xdg_output;
+ uint32_t server_output_id;
+ struct xwl_screen *xwl_screen;
+ RROutputPtr randr_output;
+ RRCrtcPtr randr_crtc;
+ int32_t x, y, width, height, refresh;
+ Rotation rotation;
+ Bool wl_output_done;
+ Bool xdg_output_done;
+};
+
+/* Per client per output emulated randr/vidmode resolution info. */
+struct xwl_emulated_mode {
+ uint32_t server_output_id;
+ int32_t width;
+ int32_t height;
+ Bool from_vidmode;
+};
+
+Bool xwl_screen_init_output(struct xwl_screen *xwl_screen);
+
+struct xwl_output *xwl_output_create(struct xwl_screen *xwl_screen,
+ uint32_t id);
+
+void xwl_output_destroy(struct xwl_output *xwl_output);
+
+void xwl_output_remove(struct xwl_output *xwl_output);
+
+struct xwl_emulated_mode *xwl_output_get_emulated_mode_for_client(
+ struct xwl_output *xwl_output, ClientPtr client);
+
+RRModePtr xwl_output_find_mode(struct xwl_output *xwl_output,
+ int32_t width, int32_t height);
+void xwl_output_set_emulated_mode(struct xwl_output *xwl_output,
+ ClientPtr client, RRModePtr mode,
+ Bool from_vidmode);
+void xwl_output_set_window_randr_emu_props(struct xwl_screen *xwl_screen,
+ WindowPtr window);
+
+void xwl_screen_init_xdg_output(struct xwl_screen *xwl_screen);
+
+#endif /* XWAYLAND_OUTPUT_H */
diff --git a/hw/xwayland/xwayland.c b/hw/xwayland/xwayland.c
index 811545a0d..a613ced6e 100644
--- a/hw/xwayland/xwayland.c
+++ b/hw/xwayland/xwayland.c
@@ -39,6 +39,7 @@
#include "xwayland.h"
#include "xwayland-glamor.h"
#include "xwayland-input.h"
+#include "xwayland-output.h"
#include "xwayland-pixmap.h"
#include "xwayland-present.h"
#include "xwayland-shm.h"
diff --git a/hw/xwayland/xwayland.h b/hw/xwayland/xwayland.h
index 5f8947344..46f67e61e 100644
--- a/hw/xwayland/xwayland.h
+++ b/hw/xwayland/xwayland.h
@@ -50,6 +50,7 @@
#include "viewporter-client-protocol.h"
#include "xwayland-types.h"
+#include "xwayland-output.h"
#include "xwayland-glamor.h"
struct xwl_format {
@@ -122,28 +123,6 @@ struct xwl_screen {
#define MODIFIER_META 0x01
-struct xwl_output {
- struct xorg_list link;
- struct wl_output *output;
- struct zxdg_output_v1 *xdg_output;
- uint32_t server_output_id;
- struct xwl_screen *xwl_screen;
- RROutputPtr randr_output;
- RRCrtcPtr randr_crtc;
- int32_t x, y, width, height, refresh;
- Rotation rotation;
- Bool wl_output_done;
- Bool xdg_output_done;
-};
-
-/* Per client per output emulated randr/vidmode resolution info. */
-struct xwl_emulated_mode {
- uint32_t server_output_id;
- int32_t width;
- int32_t height;
- Bool from_vidmode;
-};
-
/* Apps which use randr/vidmode to change the mode when going fullscreen,
* usually change the mode of only a single monitor, so this should be plenty.
*/
@@ -167,31 +146,9 @@ Bool xwl_screen_has_resolution_change_emulation(struct xwl_screen *xwl_screen);
struct xwl_output *xwl_screen_get_first_output(struct xwl_screen *xwl_screen);
void xwl_screen_check_resolution_change_emulation(struct xwl_screen *xwl_screen);
-Bool xwl_screen_init_output(struct xwl_screen *xwl_screen);
-
-struct xwl_output *xwl_output_create(struct xwl_screen *xwl_screen,
- uint32_t id);
-
-void xwl_output_destroy(struct xwl_output *xwl_output);
-
-void xwl_output_remove(struct xwl_output *xwl_output);
-
-struct xwl_emulated_mode *xwl_output_get_emulated_mode_for_client(
- struct xwl_output *xwl_output, ClientPtr client);
-
-RRModePtr xwl_output_find_mode(struct xwl_output *xwl_output,
- int32_t width, int32_t height);
-void xwl_output_set_emulated_mode(struct xwl_output *xwl_output,
- ClientPtr client, RRModePtr mode,
- Bool from_vidmode);
-void xwl_output_set_window_randr_emu_props(struct xwl_screen *xwl_screen,
- WindowPtr window);
-
RRModePtr xwayland_cvt(int HDisplay, int VDisplay,
float VRefresh, Bool Reduced, Bool Interlaced);
-void xwl_screen_init_xdg_output(struct xwl_screen *xwl_screen);
-
#ifdef XF86VIDMODE
void xwlVidModeExtensionInit(void);
#endif
commit 091b24f13e3a9cf46f1c55ba0ba3f35e0bb41a59
Author: Olivier Fourdan <ofourdan at redhat.com>
Date: Tue Dec 17 17:40:21 2019 +0100
xwayland: Move Xwayland input declarations
Move the Xwayland input declarations to their own header file.
Signed-off-by: Olivier Fourdan <ofourdan at redhat.com>
Reviewed-by: Michel Dänzer <mdaenzer at redhat.com>
diff --git a/hw/xwayland/Makefile.am b/hw/xwayland/Makefile.am
index 681b45150..6c281259c 100644
--- a/hw/xwayland/Makefile.am
+++ b/hw/xwayland/Makefile.am
@@ -12,6 +12,7 @@ Xwayland_CFLAGS = \
Xwayland_SOURCES = \
xwayland.c \
xwayland-input.c \
+ xwayland-input.h \
xwayland-cursor.c \
xwayland-glamor.h \
xwayland-pixmap.c \
diff --git a/hw/xwayland/meson.build b/hw/xwayland/meson.build
index 9a81ae762..273200e8c 100644
--- a/hw/xwayland/meson.build
+++ b/hw/xwayland/meson.build
@@ -1,6 +1,7 @@
srcs = [
'xwayland.c',
'xwayland-input.c',
+ 'xwayland-input.h',
'xwayland-cursor.c',
'xwayland-glamor.h',
'xwayland-pixmap.c',
diff --git a/hw/xwayland/xwayland-cursor.c b/hw/xwayland/xwayland-cursor.c
index cba8e20cd..91b863e22 100644
--- a/hw/xwayland/xwayland-cursor.c
+++ b/hw/xwayland/xwayland-cursor.c
@@ -33,6 +33,7 @@
#include "mipointer.h"
#include "xwayland.h"
+#include "xwayland-input.h"
#include "xwayland-shm.h"
#include "xwayland-types.h"
diff --git a/hw/xwayland/xwayland-input.c b/hw/xwayland/xwayland-input.c
index 6bec7f762..2561e7d9b 100644
--- a/hw/xwayland/xwayland-input.c
+++ b/hw/xwayland/xwayland-input.c
@@ -40,6 +40,7 @@
#include <misc.h>
#include "xwayland.h"
+#include "xwayland-input.h"
#include "xwayland-window.h"
#include "pointer-constraints-unstable-v1-client-protocol.h"
diff --git a/hw/xwayland/xwayland-input.h b/hw/xwayland/xwayland-input.h
new file mode 100644
index 000000000..cf2794430
--- /dev/null
+++ b/hw/xwayland/xwayland-input.h
@@ -0,0 +1,198 @@
+/*
+ * Copyright © 2014 Intel Corporation
+ * Copyright © 2008 Kristian Høgsberg
+ *
+ * Permission to use, copy, modify, distribute, and sell this software
+ * and its documentation for any purpose is hereby granted without
+ * fee, provided that the above copyright notice appear in all copies
+ * and that both that copyright notice and this permission notice
+ * appear in supporting documentation, and that the name of the
+ * copyright holders not be used in advertising or publicity
+ * pertaining to distribution of the software without specific,
+ * written prior permission. The copyright holders make no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied
+ * warranty.
+ *
+ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
+ * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
+ * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
+ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
+ */
+
+#ifndef XWAYLAND_INPUT_H
+#define XWAYLAND_INPUT_H
+
+#include <xwayland-config.h>
+#include <wayland-client.h>
+
+#include <dix.h>
+#include <input.h>
+
+struct xwl_touch {
+ struct xwl_window *window;
+ int32_t id;
+ int x, y;
+ struct xorg_list link_touch;
+};
+
+struct xwl_pointer_warp_emulator {
+ struct xwl_seat *xwl_seat;
+ struct xwl_window *locked_window;
+ struct zwp_locked_pointer_v1 *locked_pointer;
+};
+
+struct xwl_cursor {
+ void (* update_proc) (struct xwl_cursor *);
+ struct wl_surface *surface;
+ struct wl_callback *frame_cb;
+ Bool needs_update;
+};
+
+struct xwl_seat {
+ DeviceIntPtr pointer;
+ DeviceIntPtr relative_pointer;
+ DeviceIntPtr keyboard;
+ DeviceIntPtr touch;
+ DeviceIntPtr stylus;
+ DeviceIntPtr eraser;
+ DeviceIntPtr puck;
+ struct xwl_screen *xwl_screen;
+ struct wl_seat *seat;
+ struct wl_pointer *wl_pointer;
+ struct zwp_relative_pointer_v1 *wp_relative_pointer;
+ struct wl_keyboard *wl_keyboard;
+ struct wl_touch *wl_touch;
+ struct zwp_tablet_seat_v2 *tablet_seat;
+ struct wl_array keys;
+ struct xwl_window *focus_window;
+ struct xwl_window *tablet_focus_window;
+ uint32_t id;
+ uint32_t pointer_enter_serial;
+ struct xorg_list link;
+ CursorPtr x_cursor;
+ struct xwl_cursor cursor;
+ WindowPtr last_xwindow;
+
+ struct xorg_list touches;
+
+ size_t keymap_size;
+ char *keymap;
+ struct wl_surface *keyboard_focus;
+
+ struct xorg_list axis_discrete_pending;
+ struct xorg_list sync_pending;
+
+ struct xwl_pointer_warp_emulator *pointer_warp_emulator;
+
+ struct xwl_window *cursor_confinement_window;
+ struct zwp_confined_pointer_v1 *confined_pointer;
+
+ struct {
+ Bool has_absolute;
+ wl_fixed_t x;
+ wl_fixed_t y;
+
+ Bool has_relative;
+ double dx;
+ double dy;
+ double dx_unaccel;
+ double dy_unaccel;
+ } pending_pointer_event;
+
+ struct xorg_list tablets;
+ struct xorg_list tablet_tools;
+ struct xorg_list tablet_pads;
+ struct zwp_xwayland_keyboard_grab_v1 *keyboard_grab;
+};
+
+struct xwl_tablet {
+ struct xorg_list link;
+ struct zwp_tablet_v2 *tablet;
+ struct xwl_seat *seat;
+};
+
+struct xwl_tablet_tool {
+ struct xorg_list link;
+ struct zwp_tablet_tool_v2 *tool;
+ struct xwl_seat *seat;
+
+ DeviceIntPtr xdevice;
+ uint32_t proximity_in_serial;
+ double x;
+ double y;
+ uint32_t pressure;
+ double tilt_x;
+ double tilt_y;
+ double rotation;
+ double slider;
+
+ uint32_t buttons_now,
+ buttons_prev;
+
+ int32_t wheel_clicks;
+
+ struct xwl_cursor cursor;
+};
+
+struct xwl_tablet_pad_ring {
+ unsigned int index;
+ struct xorg_list link;
+ struct xwl_tablet_pad_group *group;
+ struct zwp_tablet_pad_ring_v2 *ring;
+};
+
+struct xwl_tablet_pad_strip {
+ unsigned int index;
+ struct xorg_list link;
+ struct xwl_tablet_pad_group *group;
+ struct zwp_tablet_pad_strip_v2 *strip;
+};
+
+struct xwl_tablet_pad_group {
+ struct xorg_list link;
+ struct xwl_tablet_pad *pad;
+ struct zwp_tablet_pad_group_v2 *group;
+
+ struct xorg_list pad_group_ring_list;
+ struct xorg_list pad_group_strip_list;
+};
+
+struct xwl_tablet_pad {
+ struct xorg_list link;
+ struct zwp_tablet_pad_v2 *pad;
+ struct xwl_seat *seat;
+
+ DeviceIntPtr xdevice;
+
+ unsigned int nbuttons;
+ struct xorg_list pad_group_list;
+};
+
+void xwl_tablet_tool_set_cursor(struct xwl_tablet_tool *tool);
+void xwl_seat_set_cursor(struct xwl_seat *xwl_seat);
+
+void xwl_seat_destroy(struct xwl_seat *xwl_seat);
+
+void xwl_seat_clear_touch(struct xwl_seat *xwl_seat, WindowPtr window);
+
+void xwl_seat_emulate_pointer_warp(struct xwl_seat *xwl_seat,
+ struct xwl_window *xwl_window,
+ SpritePtr sprite,
+ int x, int y);
+
+void xwl_seat_destroy_pointer_warp_emulator(struct xwl_seat *xwl_seat);
+
+void xwl_seat_cursor_visibility_changed(struct xwl_seat *xwl_seat);
+
+void xwl_seat_confine_pointer(struct xwl_seat *xwl_seat,
+ struct xwl_window *xwl_window);
+void xwl_seat_unconfine_pointer(struct xwl_seat *xwl_seat);
+
+void xwl_screen_release_tablet_manager(struct xwl_screen *xwl_screen);
+
+#endif /* XWAYLAND_INPUT_H */
diff --git a/hw/xwayland/xwayland-window.c b/hw/xwayland/xwayland-window.c
index 4a1a64b49..09ee782e5 100644
--- a/hw/xwayland/xwayland-window.c
+++ b/hw/xwayland/xwayland-window.c
@@ -36,6 +36,7 @@
#include "propertyst.h"
#include "xwayland-types.h"
+#include "xwayland-input.h"
#include "xwayland-present.h"
#include "xwayland-window.h"
#include "xwayland-window-buffers.h"
diff --git a/hw/xwayland/xwayland.c b/hw/xwayland/xwayland.c
index 1e58f473c..811545a0d 100644
--- a/hw/xwayland/xwayland.c
+++ b/hw/xwayland/xwayland.c
@@ -38,6 +38,7 @@
#include "xwayland.h"
#include "xwayland-glamor.h"
+#include "xwayland-input.h"
#include "xwayland-pixmap.h"
#include "xwayland-present.h"
#include "xwayland-shm.h"
diff --git a/hw/xwayland/xwayland.h b/hw/xwayland/xwayland.h
index 18c49b23f..5f8947344 100644
--- a/hw/xwayland/xwayland.h
+++ b/hw/xwayland/xwayland.h
@@ -37,7 +37,6 @@
#include <X11/X.h>
#include <fb.h>
-#include <input.h>
#include <dix.h>
#include <randrstr.h>
#include <exevents.h>
@@ -123,146 +122,6 @@ struct xwl_screen {
#define MODIFIER_META 0x01
-struct xwl_touch {
- struct xwl_window *window;
- int32_t id;
- int x, y;
- struct xorg_list link_touch;
-};
-
-struct xwl_pointer_warp_emulator {
- struct xwl_seat *xwl_seat;
- struct xwl_window *locked_window;
- struct zwp_locked_pointer_v1 *locked_pointer;
-};
-
-struct xwl_cursor {
- void (* update_proc) (struct xwl_cursor *);
- struct wl_surface *surface;
- struct wl_callback *frame_cb;
- Bool needs_update;
-};
-
-struct xwl_seat {
- DeviceIntPtr pointer;
- DeviceIntPtr relative_pointer;
- DeviceIntPtr keyboard;
- DeviceIntPtr touch;
- DeviceIntPtr stylus;
- DeviceIntPtr eraser;
- DeviceIntPtr puck;
- struct xwl_screen *xwl_screen;
- struct wl_seat *seat;
- struct wl_pointer *wl_pointer;
- struct zwp_relative_pointer_v1 *wp_relative_pointer;
- struct wl_keyboard *wl_keyboard;
- struct wl_touch *wl_touch;
- struct zwp_tablet_seat_v2 *tablet_seat;
- struct wl_array keys;
- struct xwl_window *focus_window;
- struct xwl_window *tablet_focus_window;
- uint32_t id;
- uint32_t pointer_enter_serial;
- struct xorg_list link;
- CursorPtr x_cursor;
- struct xwl_cursor cursor;
- WindowPtr last_xwindow;
-
- struct xorg_list touches;
-
- size_t keymap_size;
- char *keymap;
- struct wl_surface *keyboard_focus;
-
- struct xorg_list axis_discrete_pending;
- struct xorg_list sync_pending;
-
- struct xwl_pointer_warp_emulator *pointer_warp_emulator;
-
- struct xwl_window *cursor_confinement_window;
- struct zwp_confined_pointer_v1 *confined_pointer;
-
- struct {
- Bool has_absolute;
- wl_fixed_t x;
- wl_fixed_t y;
-
- Bool has_relative;
- double dx;
- double dy;
- double dx_unaccel;
- double dy_unaccel;
- } pending_pointer_event;
-
- struct xorg_list tablets;
- struct xorg_list tablet_tools;
- struct xorg_list tablet_pads;
- struct zwp_xwayland_keyboard_grab_v1 *keyboard_grab;
-};
-
-struct xwl_tablet {
- struct xorg_list link;
- struct zwp_tablet_v2 *tablet;
- struct xwl_seat *seat;
-};
-
-struct xwl_tablet_tool {
- struct xorg_list link;
- struct zwp_tablet_tool_v2 *tool;
- struct xwl_seat *seat;
-
- DeviceIntPtr xdevice;
- uint32_t proximity_in_serial;
- double x;
- double y;
- uint32_t pressure;
- double tilt_x;
- double tilt_y;
- double rotation;
- double slider;
-
- uint32_t buttons_now,
- buttons_prev;
-
- int32_t wheel_clicks;
-
- struct xwl_cursor cursor;
-};
-
-struct xwl_tablet_pad_ring {
- unsigned int index;
- struct xorg_list link;
- struct xwl_tablet_pad_group *group;
- struct zwp_tablet_pad_ring_v2 *ring;
-};
-
-struct xwl_tablet_pad_strip {
- unsigned int index;
- struct xorg_list link;
- struct xwl_tablet_pad_group *group;
- struct zwp_tablet_pad_strip_v2 *strip;
-};
-
-struct xwl_tablet_pad_group {
- struct xorg_list link;
- struct xwl_tablet_pad *pad;
- struct zwp_tablet_pad_group_v2 *group;
-
- struct xorg_list pad_group_ring_list;
- struct xorg_list pad_group_strip_list;
-};
-
-struct xwl_tablet_pad {
- struct xorg_list link;
- struct zwp_tablet_pad_v2 *pad;
- struct xwl_seat *seat;
-
- DeviceIntPtr xdevice;
-
- unsigned int nbuttons;
- struct xorg_list pad_group_list;
-};
-
struct xwl_output {
struct xorg_list link;
struct wl_output *output;
@@ -308,26 +167,6 @@ Bool xwl_screen_has_resolution_change_emulation(struct xwl_screen *xwl_screen);
struct xwl_output *xwl_screen_get_first_output(struct xwl_screen *xwl_screen);
void xwl_screen_check_resolution_change_emulation(struct xwl_screen *xwl_screen);
-void xwl_tablet_tool_set_cursor(struct xwl_tablet_tool *tool);
-void xwl_seat_set_cursor(struct xwl_seat *xwl_seat);
-
-void xwl_seat_destroy(struct xwl_seat *xwl_seat);
-
-void xwl_seat_clear_touch(struct xwl_seat *xwl_seat, WindowPtr window);
-
-void xwl_seat_emulate_pointer_warp(struct xwl_seat *xwl_seat,
- struct xwl_window *xwl_window,
- SpritePtr sprite,
- int x, int y);
-
-void xwl_seat_destroy_pointer_warp_emulator(struct xwl_seat *xwl_seat);
-
-void xwl_seat_cursor_visibility_changed(struct xwl_seat *xwl_seat);
-
-void xwl_seat_confine_pointer(struct xwl_seat *xwl_seat,
- struct xwl_window *xwl_window);
-void xwl_seat_unconfine_pointer(struct xwl_seat *xwl_seat);
-
Bool xwl_screen_init_output(struct xwl_screen *xwl_screen);
struct xwl_output *xwl_output_create(struct xwl_screen *xwl_screen,
@@ -351,8 +190,6 @@ void xwl_output_set_window_randr_emu_props(struct xwl_screen *xwl_screen,
RRModePtr xwayland_cvt(int HDisplay, int VDisplay,
float VRefresh, Bool Reduced, Bool Interlaced);
-void xwl_screen_release_tablet_manager(struct xwl_screen *xwl_screen);
-
void xwl_screen_init_xdg_output(struct xwl_screen *xwl_screen);
#ifdef XF86VIDMODE
commit e23d2223d89ee9ae7977b028f2a6522707e921d6
Author: Olivier Fourdan <ofourdan at redhat.com>
Date: Tue Dec 17 17:18:11 2019 +0100
xwayland: Move Xwayland present declarations
Move the Xwayland Present declarations to their own header file.
Signed-off-by: Olivier Fourdan <ofourdan at redhat.com>
Reviewed-by: Michel Dänzer <mdaenzer at redhat.com>
diff --git a/hw/xwayland/Makefile.am b/hw/xwayland/Makefile.am
index f20973797..681b45150 100644
--- a/hw/xwayland/Makefile.am
+++ b/hw/xwayland/Makefile.am
@@ -16,6 +16,7 @@ Xwayland_SOURCES = \
xwayland-glamor.h \
xwayland-pixmap.c \
xwayland-pixmap.h \
+ xwayland-present.h \
xwayland-shm.c \
xwayland-shm.h \
xwayland-types.h \
diff --git a/hw/xwayland/meson.build b/hw/xwayland/meson.build
index 6cf502289..9a81ae762 100644
--- a/hw/xwayland/meson.build
+++ b/hw/xwayland/meson.build
@@ -5,6 +5,7 @@ srcs = [
'xwayland-glamor.h',
'xwayland-pixmap.c',
'xwayland-pixmap.h',
+ 'xwayland-present.h',
'xwayland-shm.c',
'xwayland-shm.h',
'xwayland-types.h',
diff --git a/hw/xwayland/xwayland-present.c b/hw/xwayland/xwayland-present.c
index c766ce19b..0cf18e7c1 100644
--- a/hw/xwayland/xwayland-present.c
+++ b/hw/xwayland/xwayland-present.c
@@ -31,6 +31,7 @@
#include <present.h>
#include "xwayland.h"
+#include "xwayland-present.h"
#include "xwayland-window.h"
#include "xwayland-pixmap.h"
#include "glamor.h"
diff --git a/hw/xwayland/xwayland-present.h b/hw/xwayland/xwayland-present.h
new file mode 100644
index 000000000..e16357824
--- /dev/null
+++ b/hw/xwayland/xwayland-present.h
@@ -0,0 +1,74 @@
+/*
+ * Copyright © 2018 Roman Gilg
+ *
+ * Permission to use, copy, modify, distribute, and sell this software
+ * and its documentation for any purpose is hereby granted without
+ * fee, provided that the above copyright notice appear in all copies
+ * and that both that copyright notice and this permission notice
+ * appear in supporting documentation, and that the name of the
+ * copyright holders not be used in advertising or publicity
+ * pertaining to distribution of the software without specific,
+ * written prior permission. The copyright holders make no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied
+ * warranty.
+ *
+ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
+ * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
+ * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
+ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
+ */
+
+#ifndef XWAYLAND_PRESENT_H
+#define XWAYLAND_PRESENT_H
+
+#include <xwayland-config.h>
+
+#include <dix.h>
+
+#include "xwayland-types.h"
+
+#ifdef GLAMOR_HAS_GBM
+struct xwl_present_window {
+ struct xwl_screen *xwl_screen;
+ struct xwl_present_event *sync_flip;
+ WindowPtr window;
+ struct xorg_list frame_callback_list;
+
+ uint64_t msc;
+ uint64_t ust;
+
+ OsTimerPtr frame_timer;
+
+ struct wl_callback *sync_callback;
+
+ struct xorg_list event_list;
+ struct xorg_list release_queue;
+};
+
+struct xwl_present_event {
+ uint64_t event_id;
+ uint64_t target_msc;
+
+ Bool abort;
+ Bool pending;
+ Bool buffer_released;
+
+ struct xwl_present_window *xwl_present_window;
+ struct wl_buffer *buffer;
+
+ struct xorg_list list;
+};
+
+void xwl_present_frame_callback(struct xwl_present_window *xwl_present_window);
+Bool xwl_present_init(ScreenPtr screen);
+void xwl_present_cleanup(WindowPtr window);
+void xwl_present_unrealize_window(WindowPtr window);
+
+#endif /* GLAMOR_HAS_GBM */
+
+#endif /* XWAYLAND_PRESENT_H */
diff --git a/hw/xwayland/xwayland-window.c b/hw/xwayland/xwayland-window.c
index 9246edd02..4a1a64b49 100644
--- a/hw/xwayland/xwayland-window.c
+++ b/hw/xwayland/xwayland-window.c
@@ -36,6 +36,7 @@
#include "propertyst.h"
#include "xwayland-types.h"
+#include "xwayland-present.h"
#include "xwayland-window.h"
#include "xwayland-window-buffers.h"
#include "xwayland-shm.h"
diff --git a/hw/xwayland/xwayland.c b/hw/xwayland/xwayland.c
index 5476e3c7d..1e58f473c 100644
--- a/hw/xwayland/xwayland.c
+++ b/hw/xwayland/xwayland.c
@@ -39,6 +39,7 @@
#include "xwayland.h"
#include "xwayland-glamor.h"
#include "xwayland-pixmap.h"
+#include "xwayland-present.h"
#include "xwayland-shm.h"
#include "xwayland-window-buffers.h"
#include "xwayland-window.h"
diff --git a/hw/xwayland/xwayland.h b/hw/xwayland/xwayland.h
index 60cb1b622..18c49b23f 100644
--- a/hw/xwayland/xwayland.h
+++ b/hw/xwayland/xwayland.h
@@ -121,39 +121,6 @@ struct xwl_screen {
Atom allow_commits_prop;
};
-#ifdef GLAMOR_HAS_GBM
-struct xwl_present_window {
- struct xwl_screen *xwl_screen;
- struct xwl_present_event *sync_flip;
- WindowPtr window;
- struct xorg_list frame_callback_list;
-
- uint64_t msc;
- uint64_t ust;
-
- OsTimerPtr frame_timer;
-
- struct wl_callback *sync_callback;
-
- struct xorg_list event_list;
- struct xorg_list release_queue;
-};
-
-struct xwl_present_event {
- uint64_t event_id;
- uint64_t target_msc;
-
- Bool abort;
- Bool pending;
- Bool buffer_released;
-
- struct xwl_present_window *xwl_present_window;
- struct wl_buffer *buffer;
-
- struct xorg_list list;
-};
-#endif
-
#define MODIFIER_META 0x01
struct xwl_touch {
@@ -384,17 +351,6 @@ void xwl_output_set_window_randr_emu_props(struct xwl_screen *xwl_screen,
RRModePtr xwayland_cvt(int HDisplay, int VDisplay,
float VRefresh, Bool Reduced, Bool Interlaced);
-#ifdef XWL_HAS_GLAMOR
-
-#ifdef GLAMOR_HAS_GBM
-void xwl_present_frame_callback(struct xwl_present_window *xwl_present_window);
-Bool xwl_present_init(ScreenPtr screen);
-void xwl_present_cleanup(WindowPtr window);
-void xwl_present_unrealize_window(WindowPtr window);
-#endif /* GLAMOR_HAS_GBM */
-
-#endif /* XWL_HAS_GLAMOR */
-
void xwl_screen_release_tablet_manager(struct xwl_screen *xwl_screen);
void xwl_screen_init_xdg_output(struct xwl_screen *xwl_screen);
commit d780bdc2fdaeb94b873a9b6dd05a3ab636840ce7
Author: Olivier Fourdan <ofourdan at redhat.com>
Date: Tue Dec 17 17:07:58 2019 +0100
xwayland: Separate Xwayland pixmap code
Move Xwayland generic pixmap code to a separate source file and header.
Signed-off-by: Olivier Fourdan <ofourdan at redhat.com>
Reviewed-by: Michel Dänzer <mdaenzer at redhat.com>
diff --git a/hw/xwayland/Makefile.am b/hw/xwayland/Makefile.am
index 4abc4692a..f20973797 100644
--- a/hw/xwayland/Makefile.am
+++ b/hw/xwayland/Makefile.am
@@ -14,6 +14,8 @@ Xwayland_SOURCES = \
xwayland-input.c \
xwayland-cursor.c \
xwayland-glamor.h \
+ xwayland-pixmap.c \
+ xwayland-pixmap.h \
xwayland-shm.c \
xwayland-shm.h \
xwayland-types.h \
diff --git a/hw/xwayland/meson.build b/hw/xwayland/meson.build
index 178f9166e..6cf502289 100644
--- a/hw/xwayland/meson.build
+++ b/hw/xwayland/meson.build
@@ -3,6 +3,8 @@ srcs = [
'xwayland-input.c',
'xwayland-cursor.c',
'xwayland-glamor.h',
+ 'xwayland-pixmap.c',
+ 'xwayland-pixmap.h',
'xwayland-shm.c',
'xwayland-shm.h',
'xwayland-types.h',
diff --git a/hw/xwayland/xwayland-glamor-eglstream.c b/hw/xwayland/xwayland-glamor-eglstream.c
index b9d3bc45d..e052df29c 100644
--- a/hw/xwayland/xwayland-glamor-eglstream.c
+++ b/hw/xwayland/xwayland-glamor-eglstream.c
@@ -42,6 +42,7 @@
#include "xwayland.h"
#include "xwayland-glamor.h"
+#include "xwayland-pixmap.h"
#include "wayland-eglstream-client-protocol.h"
#include "wayland-eglstream-controller-client-protocol.h"
diff --git a/hw/xwayland/xwayland-glamor-gbm.c b/hw/xwayland/xwayland-glamor-gbm.c
index e4718da52..6ed097fc2 100644
--- a/hw/xwayland/xwayland-glamor-gbm.c
+++ b/hw/xwayland/xwayland-glamor-gbm.c
@@ -48,6 +48,7 @@
#include "xwayland.h"
#include "xwayland-glamor.h"
+#include "xwayland-pixmap.h"
#include "linux-dmabuf-unstable-v1-client-protocol.h"
diff --git a/hw/xwayland/xwayland-pixmap.c b/hw/xwayland/xwayland-pixmap.c
new file mode 100644
index 000000000..fef6fa4cf
--- /dev/null
+++ b/hw/xwayland/xwayland-pixmap.c
@@ -0,0 +1,123 @@
+/*
+ * Copyright © 2014 Intel Corporation
+ *
+ * Permission to use, copy, modify, distribute, and sell this software
+ * and its documentation for any purpose is hereby granted without
+ * fee, provided that the above copyright notice appear in all copies
+ * and that both that copyright notice and this permission notice
+ * appear in supporting documentation, and that the name of the
+ * copyright holders not be used in advertising or publicity
+ * pertaining to distribution of the software without specific,
+ * written prior permission. The copyright holders make no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied
+ * warranty.
+ *
+ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
+ * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
+ * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
+ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
+ */
+
+#include <xwayland-config.h>
+
+#include <X11/X.h>
+
+#include "os.h"
+#include "privates.h"
+#include "dix.h"
+#include "fb.h"
+#include "pixmapstr.h"
+
+#include "xwayland-types.h"
+#include "xwayland-pixmap.h"
+#include "xwayland-window-buffers.h"
+
+static DevPrivateKeyRec xwl_pixmap_private_key;
+static DevPrivateKeyRec xwl_pixmap_cb_private_key;
+
+struct xwl_pixmap_buffer_release_callback {
+ xwl_pixmap_cb callback;
+ void *data;
+};
+
+void
+xwl_pixmap_set_private(PixmapPtr pixmap, struct xwl_pixmap *xwl_pixmap)
+{
+ dixSetPrivate(&pixmap->devPrivates, &xwl_pixmap_private_key, xwl_pixmap);
+}
+
+struct xwl_pixmap *
+xwl_pixmap_get(PixmapPtr pixmap)
+{
+ return dixLookupPrivate(&pixmap->devPrivates, &xwl_pixmap_private_key);
+}
+
+Bool
+xwl_pixmap_set_buffer_release_cb(PixmapPtr pixmap,
+ xwl_pixmap_cb func, void *data)
+{
+ struct xwl_pixmap_buffer_release_callback *xwl_pixmap_buffer_release_callback;
+
+ xwl_pixmap_buffer_release_callback = dixLookupPrivate(&pixmap->devPrivates,
+ &xwl_pixmap_cb_private_key);
+
+ if (xwl_pixmap_buffer_release_callback == NULL) {
+ xwl_pixmap_buffer_release_callback =
+ calloc(1, sizeof (struct xwl_pixmap_buffer_release_callback));
+
+ if (xwl_pixmap_buffer_release_callback == NULL) {
+ ErrorF("Failed to allocate pixmap callback data\n");
+ return FALSE;
+ }
+ dixSetPrivate(&pixmap->devPrivates, &xwl_pixmap_cb_private_key,
+ xwl_pixmap_buffer_release_callback);
+ }
+
+ xwl_pixmap_buffer_release_callback->callback = func;
+ xwl_pixmap_buffer_release_callback->data = data;
+
+ return TRUE;
+}
+
+void
+xwl_pixmap_del_buffer_release_cb(PixmapPtr pixmap)
+{
+ struct xwl_pixmap_buffer_release_callback *xwl_pixmap_buffer_release_callback;
+
+ xwl_pixmap_buffer_release_callback = dixLookupPrivate(&pixmap->devPrivates,
+ &xwl_pixmap_cb_private_key);
+ if (xwl_pixmap_buffer_release_callback) {
+ dixSetPrivate(&pixmap->devPrivates, &xwl_pixmap_cb_private_key, NULL);
+ free(xwl_pixmap_buffer_release_callback);
+ }
+}
+
+void
+xwl_pixmap_buffer_release_cb(void *data, struct wl_buffer *wl_buffer)
+{
+ PixmapPtr pixmap = data;
+ struct xwl_pixmap_buffer_release_callback *xwl_pixmap_buffer_release_callback;
+
+ xwl_pixmap_buffer_release_callback = dixLookupPrivate(&pixmap->devPrivates,
+ &xwl_pixmap_cb_private_key);
+ if (xwl_pixmap_buffer_release_callback)
+ (*xwl_pixmap_buffer_release_callback->callback)
+ (pixmap, xwl_pixmap_buffer_release_callback->data);
+}
+
+Bool
+xwl_pixmap_init(void)
+{
+ if (!dixRegisterPrivateKey(&xwl_pixmap_private_key, PRIVATE_PIXMAP, 0))
+ return FALSE;
+
+ if (!dixRegisterPrivateKey(&xwl_pixmap_cb_private_key, PRIVATE_PIXMAP, 0))
+ return FALSE;
+
+ return TRUE;
+}
diff --git a/hw/xwayland/xwayland-pixmap.h b/hw/xwayland/xwayland-pixmap.h
new file mode 100644
index 000000000..9b926b507
--- /dev/null
+++ b/hw/xwayland/xwayland-pixmap.h
@@ -0,0 +1,47 @@
+/*
+ * Copyright © 2014 Intel Corporation
+ *
+ * Permission to use, copy, modify, distribute, and sell this software
+ * and its documentation for any purpose is hereby granted without
+ * fee, provided that the above copyright notice appear in all copies
+ * and that both that copyright notice and this permission notice
+ * appear in supporting documentation, and that the name of the
+ * copyright holders not be used in advertising or publicity
+ * pertaining to distribution of the software without specific,
+ * written prior permission. The copyright holders make no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied
+ * warranty.
+ *
+ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
+ * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
+ * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
+ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
+ */
+
+#ifndef XWAYLAND_PIXMAP_H
+#define XWAYLAND_PIXMAP_H
+
+#include <xwayland-config.h>
+#include <wayland-client.h>
+
+#include "pixmapstr.h"
+
+/* This is an opaque structure implemented in the different backends */
+struct xwl_pixmap;
+
+typedef void (*xwl_pixmap_cb) (PixmapPtr pixmap, void *data);
+
+void xwl_pixmap_set_private(PixmapPtr pixmap, struct xwl_pixmap *xwl_pixmap);
+struct xwl_pixmap *xwl_pixmap_get(PixmapPtr pixmap);
+Bool xwl_pixmap_set_buffer_release_cb(PixmapPtr pixmap,
+ xwl_pixmap_cb func, void *data);
+void xwl_pixmap_del_buffer_release_cb(PixmapPtr pixmap);
+void xwl_pixmap_buffer_release_cb(void *data, struct wl_buffer *wl_buffer);
+Bool xwl_pixmap_init(void);
+
+#endif /* XWAYLAND_PIXMAP_H */
diff --git a/hw/xwayland/xwayland-present.c b/hw/xwayland/xwayland-present.c
index 1397b4ba4..c766ce19b 100644
--- a/hw/xwayland/xwayland-present.c
+++ b/hw/xwayland/xwayland-present.c
@@ -32,6 +32,7 @@
#include "xwayland.h"
#include "xwayland-window.h"
+#include "xwayland-pixmap.h"
#include "glamor.h"
/*
diff --git a/hw/xwayland/xwayland-shm.c b/hw/xwayland/xwayland-shm.c
index 586874b90..995bf64f8 100644
--- a/hw/xwayland/xwayland-shm.c
+++ b/hw/xwayland/xwayland-shm.c
@@ -26,6 +26,8 @@
#include <xwayland-config.h>
+#include "os.h"
+
#include <sys/mman.h>
#include <sys/types.h>
#include <unistd.h>
@@ -39,6 +41,7 @@
#include "pixmapstr.h"
#include "xwayland.h"
+#include "xwayland-pixmap.h"
#include "xwayland-shm.h"
struct xwl_pixmap {
diff --git a/hw/xwayland/xwayland-window-buffers.c b/hw/xwayland/xwayland-window-buffers.c
index 43c887a82..6d0eac96e 100644
--- a/hw/xwayland/xwayland-window-buffers.c
+++ b/hw/xwayland/xwayland-window-buffers.c
@@ -29,6 +29,7 @@
#include "gcstruct.h"
#include "xwayland-window.h"
+#include "xwayland-pixmap.h"
#include "xwayland-window-buffers.h"
#define BUFFER_TIMEOUT 1 * 1000 /* ms */
diff --git a/hw/xwayland/xwayland.c b/hw/xwayland/xwayland.c
index b8f6b4c16..5476e3c7d 100644
--- a/hw/xwayland/xwayland.c
+++ b/hw/xwayland/xwayland.c
@@ -38,9 +38,10 @@
#include "xwayland.h"
#include "xwayland-glamor.h"
+#include "xwayland-pixmap.h"
#include "xwayland-shm.h"
-#include "xwayland-window.h"
#include "xwayland-window-buffers.h"
+#include "xwayland-window.h"
#ifdef XF86VIDMODE
#include <X11/extensions/xf86vmproto.h>
@@ -171,8 +172,6 @@ ddxProcessArgument(int argc, char *argv[], int i)
static DevPrivateKeyRec xwl_client_private_key;
static DevPrivateKeyRec xwl_screen_private_key;
-static DevPrivateKeyRec xwl_pixmap_private_key;
-static DevPrivateKeyRec xwl_pixmap_cb_private_key;
struct xwl_client *
xwl_client_get(ClientPtr client)
@@ -242,64 +241,6 @@ xwl_property_callback(CallbackListPtr *pcbl, void *closure,
xwl_window_update_property(xwl_window, rec);
}
-struct xwl_pixmap_buffer_release_cb {
- xwl_pixmap_cb callback;
- void *data;
-};
-
-Bool
-xwl_pixmap_set_buffer_release_cb(PixmapPtr pixmap,
- xwl_pixmap_cb func, void *data)
-{
- struct xwl_pixmap_buffer_release_cb *xwl_pixmap_buffer_release_cb;
-
- xwl_pixmap_buffer_release_cb = dixLookupPrivate(&pixmap->devPrivates,
- &xwl_pixmap_cb_private_key);
-
- if (xwl_pixmap_buffer_release_cb == NULL) {
- xwl_pixmap_buffer_release_cb =
- calloc(1, sizeof (struct xwl_pixmap_buffer_release_cb));
-
- if (xwl_pixmap_buffer_release_cb == NULL) {
- ErrorF("Failed to allocate pixmap callback data\n");
- return FALSE;
- }
- dixSetPrivate(&pixmap->devPrivates, &xwl_pixmap_cb_private_key,
- xwl_pixmap_buffer_release_cb);
- }
-
- xwl_pixmap_buffer_release_cb->callback = func;
- xwl_pixmap_buffer_release_cb->data = data;
-
- return TRUE;
-}
-
-void
-xwl_pixmap_del_buffer_release_cb(PixmapPtr pixmap)
-{
- struct xwl_pixmap_buffer_release_cb *xwl_pixmap_buffer_release_cb;
-
- xwl_pixmap_buffer_release_cb = dixLookupPrivate(&pixmap->devPrivates,
- &xwl_pixmap_cb_private_key);
- if (xwl_pixmap_buffer_release_cb) {
- dixSetPrivate(&pixmap->devPrivates, &xwl_pixmap_cb_private_key, NULL);
- free(xwl_pixmap_buffer_release_cb);
- }
-}
-
-void
-xwl_pixmap_buffer_release_cb(void *data, struct wl_buffer *wl_buffer)
-{
- PixmapPtr pixmap = data;
- struct xwl_pixmap_buffer_release_cb *xwl_pixmap_buffer_release_cb;
-
- xwl_pixmap_buffer_release_cb = dixLookupPrivate(&pixmap->devPrivates,
- &xwl_pixmap_cb_private_key);
- if (xwl_pixmap_buffer_release_cb)
- (*xwl_pixmap_buffer_release_cb->callback)
- (pixmap, xwl_pixmap_buffer_release_cb->data);
-}
-
static Bool
xwl_close_screen(ScreenPtr screen)
{
@@ -422,18 +363,6 @@ xwl_cursor_confined_to(DeviceIntPtr device,
xwl_seat_confine_pointer(xwl_seat, xwl_window);
}
-void
-xwl_pixmap_set_private(PixmapPtr pixmap, struct xwl_pixmap *xwl_pixmap)
-{
- dixSetPrivate(&pixmap->devPrivates, &xwl_pixmap_private_key, xwl_pixmap);
-}
-
-struct xwl_pixmap *
-xwl_pixmap_get(PixmapPtr pixmap)
-{
- return dixLookupPrivate(&pixmap->devPrivates, &xwl_pixmap_private_key);
-}
-
void
xwl_screen_check_resolution_change_emulation(struct xwl_screen *xwl_screen)
{
@@ -679,9 +608,7 @@ xwl_screen_init(ScreenPtr pScreen, int argc, char **argv)
if (!dixRegisterPrivateKey(&xwl_screen_private_key, PRIVATE_SCREEN, 0))
return FALSE;
- if (!dixRegisterPrivateKey(&xwl_pixmap_private_key, PRIVATE_PIXMAP, 0))
- return FALSE;
- if (!dixRegisterPrivateKey(&xwl_pixmap_cb_private_key, PRIVATE_PIXMAP, 0))
+ if (!xwl_pixmap_init())
return FALSE;
if (!xwl_window_init())
return FALSE;
diff --git a/hw/xwayland/xwayland.h b/hw/xwayland/xwayland.h
index 5b802c0fd..60cb1b622 100644
--- a/hw/xwayland/xwayland.h
+++ b/hw/xwayland/xwayland.h
@@ -59,8 +59,6 @@ struct xwl_format {
uint64_t *modifiers;
};
-typedef void (*xwl_pixmap_cb) (PixmapPtr pixmap, void *data);
-
struct xwl_screen {
int width;
int height;
@@ -386,13 +384,6 @@ void xwl_output_set_window_randr_emu_props(struct xwl_screen *xwl_screen,
RRModePtr xwayland_cvt(int HDisplay, int VDisplay,
float VRefresh, Bool Reduced, Bool Interlaced);
-void xwl_pixmap_set_private(PixmapPtr pixmap, struct xwl_pixmap *xwl_pixmap);
-struct xwl_pixmap *xwl_pixmap_get(PixmapPtr pixmap);
-Bool xwl_pixmap_set_buffer_release_cb(PixmapPtr pixmap,
- xwl_pixmap_cb func, void *data);
-void xwl_pixmap_del_buffer_release_cb(PixmapPtr pixmap);
-void xwl_pixmap_buffer_release_cb(void *data, struct wl_buffer *wl_buffer);
-
#ifdef XWL_HAS_GLAMOR
#ifdef GLAMOR_HAS_GBM
commit 89e32d00f6e03fcdab267bfd9f0b0c5c2747d380
Author: Olivier Fourdan <ofourdan at redhat.com>
Date: Tue Dec 17 15:07:07 2019 +0100
xwayland: Move Xwayland windows to its own sources
Over time, Xwayland main source file `xwayland.c` has grown in size
which makes it look cluttered and harder to read.
Move the code dealing with Xwayland window to its own source and header
files.
Signed-off-by: Olivier Fourdan <ofourdan at redhat.com>
Reviewed-by: Michel Dänzer <mdaenzer at redhat.com>
diff --git a/hw/xwayland/Makefile.am b/hw/xwayland/Makefile.am
index 7decc8f06..4abc4692a 100644
--- a/hw/xwayland/Makefile.am
+++ b/hw/xwayland/Makefile.am
@@ -20,6 +20,8 @@ Xwayland_SOURCES = \
xwayland-output.c \
xwayland-cvt.c \
xwayland-vidmode.c \
+ xwayland-window.c \
+ xwayland-window.h \
xwayland-window-buffers.c \
xwayland-window-buffers.h \
xwayland.h \
diff --git a/hw/xwayland/meson.build b/hw/xwayland/meson.build
index d4a408cb4..178f9166e 100644
--- a/hw/xwayland/meson.build
+++ b/hw/xwayland/meson.build
@@ -9,6 +9,8 @@ srcs = [
'xwayland-output.c',
'xwayland-cvt.c',
'xwayland-vidmode.c',
+ 'xwayland-window.c',
+ 'xwayland-window.h',
'xwayland-window-buffers.c',
'xwayland-window-buffers.h',
'../../mi/miinitext.c',
diff --git a/hw/xwayland/xwayland-glamor.c b/hw/xwayland/xwayland-glamor.c
index e1ac22348..6330b1f4c 100644
--- a/hw/xwayland/xwayland-glamor.c
+++ b/hw/xwayland/xwayland-glamor.c
@@ -39,6 +39,7 @@
#include "xwayland.h"
#include "xwayland-glamor.h"
+#include "xwayland-window.h"
static void
glamor_egl_make_current(struct glamor_context *glamor_ctx)
diff --git a/hw/xwayland/xwayland-input.c b/hw/xwayland/xwayland-input.c
index 9c574314d..6bec7f762 100644
--- a/hw/xwayland/xwayland-input.c
+++ b/hw/xwayland/xwayland-input.c
@@ -24,18 +24,28 @@
* SOFTWARE.
*/
-#include "xwayland.h"
+#include <xwayland-config.h>
#include <linux/input.h>
-
#include <sys/mman.h>
+
+#include <inputstr.h>
+#include <exevents.h>
#include <xkbsrv.h>
#include <xserver-properties.h>
#include <inpututils.h>
+#include <mi.h>
#include <mipointer.h>
#include <mipointrst.h>
#include <misc.h>
+
+#include "xwayland.h"
+#include "xwayland-window.h"
+
+#include "pointer-constraints-unstable-v1-client-protocol.h"
+#include "relative-pointer-unstable-v1-client-protocol.h"
#include "tablet-unstable-v2-client-protocol.h"
+#include "xwayland-keyboard-grab-unstable-v1-client-protocol.h"
struct axis_discrete_pending {
struct xorg_list l;
diff --git a/hw/xwayland/xwayland-output.c b/hw/xwayland/xwayland-output.c
index da6316930..238bebcdf 100644
--- a/hw/xwayland/xwayland-output.c
+++ b/hw/xwayland/xwayland-output.c
@@ -23,14 +23,16 @@
* SOFTWARE.
*/
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
+#include <xwayland-config.h>
-#include "xwayland.h"
#include <randrstr.h>
#include <X11/Xatom.h>
+#include "xwayland.h"
+#include "xwayland-window.h"
+
+#include "xdg-output-unstable-v1-client-protocol.h"
+
#define DEFAULT_DPI 96
#define ALL_ROTATIONS (RR_Rotate_0 | \
RR_Rotate_90 | \
diff --git a/hw/xwayland/xwayland-present.c b/hw/xwayland/xwayland-present.c
index 32fd6d397..1397b4ba4 100644
--- a/hw/xwayland/xwayland-present.c
+++ b/hw/xwayland/xwayland-present.c
@@ -23,11 +23,17 @@
* SOFTWARE.
*/
-#include "xwayland.h"
-#include "glamor.h"
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+#include <windowstr.h>
#include <present.h>
+#include "xwayland.h"
+#include "xwayland-window.h"
+#include "glamor.h"
+
/*
* When not flipping let Present copy with 60fps.
* When flipping wait on frame_callback, otherwise
diff --git a/hw/xwayland/xwayland-window-buffers.c b/hw/xwayland/xwayland-window-buffers.c
index 22fef3ffd..43c887a82 100644
--- a/hw/xwayland/xwayland-window-buffers.c
+++ b/hw/xwayland/xwayland-window-buffers.c
@@ -24,6 +24,11 @@
* Olivier Fourdan <ofourdan at redhat.com>
*/
+#include <xwayland-config.h>
+
+#include "gcstruct.h"
+
+#include "xwayland-window.h"
#include "xwayland-window-buffers.h"
#define BUFFER_TIMEOUT 1 * 1000 /* ms */
diff --git a/hw/xwayland/xwayland-window.c b/hw/xwayland/xwayland-window.c
new file mode 100644
index 000000000..9246edd02
--- /dev/null
+++ b/hw/xwayland/xwayland-window.c
@@ -0,0 +1,825 @@
+/*
+ * Copyright © 2011-2014 Intel Corporation
+ *
+ * Permission to use, copy, modify, distribute, and sell this software
+ * and its documentation for any purpose is hereby granted without
+ * fee, provided that the above copyright notice appear in all copies
+ * and that both that copyright notice and this permission notice
+ * appear in supporting documentation, and that the name of the
+ * copyright holders not be used in advertising or publicity
+ * pertaining to distribution of the software without specific,
+ * written prior permission. The copyright holders make no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied
+ * warranty.
+ *
+ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
+ * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
+ * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
+ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
+ */
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include <X11/X.h>
+#include <X11/Xatom.h>
+
+#include "compositeext.h"
+#include "compint.h"
+#include "inputstr.h"
+#include "propertyst.h"
+
+#include "xwayland-types.h"
+#include "xwayland-window.h"
+#include "xwayland-window-buffers.h"
+#include "xwayland-shm.h"
+#include "xwayland.h"
+
+#include "viewporter-client-protocol.h"
+
+static DevPrivateKeyRec xwl_window_private_key;
+static DevPrivateKeyRec xwl_damage_private_key;
+
+static void
+xwl_window_set_allow_commits(struct xwl_window *xwl_window, Bool allow,
+ const char *debug_msg)
+{
+ xwl_window->allow_commits = allow;
+ DebugF("xwayland: win %d allow_commits = %d (%s)\n",
+ xwl_window->window->drawable.id, allow, debug_msg);
+}
+
+static void
+xwl_window_set_allow_commits_from_property(struct xwl_window *xwl_window,
+ PropertyPtr prop)
+{
+ static Bool warned = FALSE;
+ CARD32 *propdata;
+
+ if (prop->propertyName != xwl_window->xwl_screen->allow_commits_prop)
+ FatalError("Xwayland internal error: prop mismatch in %s.\n", __func__);
+
+ if (prop->type != XA_CARDINAL || prop->format != 32 || prop->size != 1) {
+ /* Not properly set, so fall back to safe and glitchy */
+ xwl_window_set_allow_commits(xwl_window, TRUE, "WM fault");
+
+ if (!warned) {
+ LogMessage(X_WARNING, "Window manager is misusing property %s.\n",
+ NameForAtom(prop->propertyName));
+ warned = TRUE;
+ }
+ return;
+ }
+
+ propdata = prop->data;
+ xwl_window_set_allow_commits(xwl_window, !!propdata[0], "from property");
+}
+
+struct xwl_window *
+xwl_window_get(WindowPtr window)
+{
+ return dixLookupPrivate(&window->devPrivates, &xwl_window_private_key);
+}
+
+static DamagePtr
+window_get_damage(WindowPtr window)
+{
+ return dixLookupPrivate(&window->devPrivates, &xwl_damage_private_key);
+}
+
+struct xwl_window *
+xwl_window_from_window(WindowPtr window)
+{
+ struct xwl_window *xwl_window;
+
+ while (window) {
+ xwl_window = xwl_window_get(window);
+ if (xwl_window)
+ return xwl_window;
+
+ window = window->parent;
+ }
+
+ return NULL;
+}
+
+void
+xwl_window_update_property(struct xwl_window *xwl_window,
+ PropertyStateRec *propstate)
+{
+ switch (propstate->state) {
+ case PropertyNewValue:
+ xwl_window_set_allow_commits_from_property(xwl_window, propstate->prop);
+ break;
+
+ case PropertyDelete:
+ xwl_window_set_allow_commits(xwl_window, TRUE, "property deleted");
+ break;
+
+ default:
+ break;
+ }
+}
+
+static void
+damage_report(DamagePtr pDamage, RegionPtr pRegion, void *data)
+{
+ WindowPtr window = data;
+ struct xwl_window *xwl_window = xwl_window_get(window);
+ struct xwl_screen *xwl_screen;
+
+ if (!xwl_window)
+ return;
+
+ xwl_screen = xwl_window->xwl_screen;
+
+#ifdef GLAMOR_HAS_GBM
+ if (xwl_window->present_flipped) {
+ /* This damage is from a Present flip, which already committed a new
+ * buffer for the surface, so we don't need to do anything in response
+ */
+ RegionEmpty(DamageRegion(pDamage));
+ xorg_list_del(&xwl_window->link_damage);
+ xwl_window->present_flipped = FALSE;
+ return;
+ }
+#endif
+
+ xorg_list_add(&xwl_window->link_damage, &xwl_screen->damage_window_list);
+}
+
+static void
+damage_destroy(DamagePtr pDamage, void *data)
+{
+}
+
+static Bool
+register_damage(WindowPtr window)
+{
+ DamagePtr damage;
+
+ damage = DamageCreate(damage_report, damage_destroy, DamageReportNonEmpty,
+ FALSE, window->drawable.pScreen, window);
+ if (damage == NULL) {
+ ErrorF("Failed creating damage\n");
+ return FALSE;
+ }
+
+ DamageRegister(&window->drawable, damage);
+ DamageSetReportAfterOp(damage, TRUE);
+
+ dixSetPrivate(&window->devPrivates, &xwl_damage_private_key, damage);
+
+ return TRUE;
+}
+
+static void
+unregister_damage(WindowPtr window)
+{
+ DamagePtr damage;
+
+ damage = dixLookupPrivate(&window->devPrivates, &xwl_damage_private_key);
+ if (!damage)
+ return;
+
+ DamageUnregister(damage);
+ DamageDestroy(damage);
+
+ dixSetPrivate(&window->devPrivates, &xwl_damage_private_key, NULL);
+}
+
+Bool
+xwl_window_has_viewport_enabled(struct xwl_window *xwl_window)
+{
+ return (xwl_window->viewport != NULL);
+}
+
+static void
+xwl_window_disable_viewport(struct xwl_window *xwl_window)
+{
+ assert (xwl_window->viewport);
+
+ DebugF("XWAYLAND: disabling viewport\n");
+ wp_viewport_destroy(xwl_window->viewport);
+ xwl_window->viewport = NULL;
+}
+
+static void
+xwl_window_enable_viewport(struct xwl_window *xwl_window,
+ struct xwl_output *xwl_output,
+ struct xwl_emulated_mode *emulated_mode)
+{
+ /* If necessary disable old viewport to apply new settings */
+ if (xwl_window_has_viewport_enabled(xwl_window))
+ xwl_window_disable_viewport(xwl_window);
+
+ DebugF("XWAYLAND: enabling viewport %dx%d -> %dx%d\n",
+ emulated_mode->width, emulated_mode->height,
+ xwl_output->width, xwl_output->height);
+
+ xwl_window->viewport =
+ wp_viewporter_get_viewport(xwl_window->xwl_screen->viewporter,
+ xwl_window->surface);
+
+ wp_viewport_set_source(xwl_window->viewport,
+ wl_fixed_from_int(0),
+ wl_fixed_from_int(0),
+ wl_fixed_from_int(emulated_mode->width),
+ wl_fixed_from_int(emulated_mode->height));
+ wp_viewport_set_destination(xwl_window->viewport,
+ xwl_output->width,
+ xwl_output->height);
+
+ xwl_window->scale_x = (float)emulated_mode->width / xwl_output->width;
+ xwl_window->scale_y = (float)emulated_mode->height / xwl_output->height;
+}
+
+static Bool
+xwl_screen_client_is_window_manager(struct xwl_screen *xwl_screen,
+ ClientPtr client)
+{
+ WindowPtr root = xwl_screen->screen->root;
+ OtherClients *others;
+
+ for (others = wOtherClients(root); others; others = others->next) {
+ if (SameClient(others, client)) {
+ if (others->mask & (SubstructureRedirectMask | ResizeRedirectMask))
+ return TRUE;
+ }
+ }
+
+ return FALSE;
+}
+
+static ClientPtr
+xwl_window_get_owner(struct xwl_window *xwl_window)
+{
+ WindowPtr window = xwl_window->window;
+ ClientPtr client = wClient(window);
+
+ /* If the toplevel window is owned by the window-manager, then the
+ * actual client toplevel window has been reparented to a window-manager
+ * decoration window. In that case return the client of the
+ * first *and only* child of the toplevel (decoration) window.
+ */
+ if (xwl_screen_client_is_window_manager(xwl_window->xwl_screen, client)) {
+ if (window->firstChild && window->firstChild == window->lastChild)
+ return wClient(window->firstChild);
+ else
+ return NULL; /* Should never happen, skip resolution emulation */
+ }
+
+ return client;
+}
+
+static Bool
+xwl_window_should_enable_viewport(struct xwl_window *xwl_window,
+ struct xwl_output **xwl_output_ret,
+ struct xwl_emulated_mode **emulated_mode_ret)
+{
+ struct xwl_screen *xwl_screen = xwl_window->xwl_screen;
+ struct xwl_emulated_mode *emulated_mode;
+ struct xwl_output *xwl_output;
+ ClientPtr owner;
+
+ if (!xwl_screen_has_resolution_change_emulation(xwl_screen))
+ return FALSE;
+
+ owner = xwl_window_get_owner(xwl_window);
+ if (!owner)
+ return FALSE;
+
+ /* 1. Test if the window matches the emulated mode on one of the outputs
+ * This path gets hit by most games / libs (e.g. SDL, SFML, OGRE)
+ */
+ xorg_list_for_each_entry(xwl_output, &xwl_screen->output_list, link) {
+ emulated_mode = xwl_output_get_emulated_mode_for_client(xwl_output, owner);
+ if (!emulated_mode)
+ continue;
+
+ if (xwl_window->x == xwl_output->x &&
+ xwl_window->y == xwl_output->y &&
+ xwl_window->width == emulated_mode->width &&
+ xwl_window->height == emulated_mode->height) {
+
+ *emulated_mode_ret = emulated_mode;
+ *xwl_output_ret = xwl_output;
+ return TRUE;
+ }
+ }
+
+ /* 2. Test if the window uses override-redirect + vidmode
+ * and matches (fully covers) the entire screen.
+ * This path gets hit by: allegro4, ClanLib-1.0.
+ */
+ xwl_output = xwl_screen_get_first_output(xwl_screen);
+ emulated_mode = xwl_output_get_emulated_mode_for_client(xwl_output, owner);
+ if (xwl_output && xwl_window->window->overrideRedirect &&
+ emulated_mode && emulated_mode->from_vidmode &&
+ xwl_window->x == 0 && xwl_window->y == 0 &&
+ xwl_window->width == xwl_screen->width &&
+ xwl_window->height == xwl_screen->height) {
+
+ *emulated_mode_ret = emulated_mode;
+ *xwl_output_ret = xwl_output;
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+void
+xwl_window_check_resolution_change_emulation(struct xwl_window *xwl_window)
+{
+ struct xwl_emulated_mode *emulated_mode;
+ struct xwl_output *xwl_output;
+
+ if (xwl_window_should_enable_viewport(xwl_window, &xwl_output, &emulated_mode))
+ xwl_window_enable_viewport(xwl_window, xwl_output, emulated_mode);
+ else if (xwl_window_has_viewport_enabled(xwl_window))
+ xwl_window_disable_viewport(xwl_window);
+}
+
+/* This checks if the passed in Window is a toplevel client window, note this
+ * returns false for window-manager decoration windows and returns true for
+ * the actual client top-level window even if it has been reparented to
+ * a window-manager decoration window.
+ */
+Bool
+xwl_window_is_toplevel(WindowPtr window)
+{
+ struct xwl_screen *xwl_screen = xwl_screen_get(window->drawable.pScreen);
+
+ if (xwl_screen_client_is_window_manager(xwl_screen, wClient(window)))
+ return FALSE;
+
+ /* CSD and override-redirect toplevel windows */
+ if (window_get_damage(window))
+ return TRUE;
+
+ /* Normal toplevel client windows, reparented to decoration window */
+ return (window->parent && window_get_damage(window->parent));
+}
+
+static void
+xwl_window_init_allow_commits(struct xwl_window *xwl_window)
+{
+ PropertyPtr prop = NULL;
+ int ret;
+
+ ret = dixLookupProperty(&prop, xwl_window->window,
+ xwl_window->xwl_screen->allow_commits_prop,
+ serverClient, DixReadAccess);
+ if (ret == Success && prop)
+ xwl_window_set_allow_commits_from_property(xwl_window, prop);
+ else
+ xwl_window_set_allow_commits(xwl_window, TRUE, "no property");
+}
+
+static void
+send_surface_id_event(struct xwl_window *xwl_window)
+{
+ static const char atom_name[] = "WL_SURFACE_ID";
+ static Atom type_atom;
+ DeviceIntPtr dev;
+ xEvent e;
+
+ if (type_atom == None)
+ type_atom = MakeAtom(atom_name, strlen(atom_name), TRUE);
+
+ e.u.u.type = ClientMessage;
+ e.u.u.detail = 32;
+ e.u.clientMessage.window = xwl_window->window->drawable.id;
+ e.u.clientMessage.u.l.type = type_atom;
+ e.u.clientMessage.u.l.longs0 =
+ wl_proxy_get_id((struct wl_proxy *) xwl_window->surface);
+ e.u.clientMessage.u.l.longs1 = 0;
+ e.u.clientMessage.u.l.longs2 = 0;
+ e.u.clientMessage.u.l.longs3 = 0;
+ e.u.clientMessage.u.l.longs4 = 0;
+
+ dev = PickPointer(serverClient);
+ DeliverEventsToWindow(dev, xwl_window->xwl_screen->screen->root,
+ &e, 1, SubstructureRedirectMask, NullGrab);
+}
+
+static void
+shell_surface_ping(void *data,
+ struct wl_shell_surface *shell_surface, uint32_t serial)
+{
+ wl_shell_surface_pong(shell_surface, serial);
+}
+
+static void
+shell_surface_configure(void *data,
+ struct wl_shell_surface *wl_shell_surface,
+ uint32_t edges, int32_t width, int32_t height)
+{
+}
+
+static void
+shell_surface_popup_done(void *data, struct wl_shell_surface *wl_shell_surface)
+{
+}
+
+static const struct wl_shell_surface_listener shell_surface_listener = {
+ shell_surface_ping,
+ shell_surface_configure,
+ shell_surface_popup_done
+};
+
+static Bool
+ensure_surface_for_window(WindowPtr window)
+{
+ ScreenPtr screen = window->drawable.pScreen;
+ struct xwl_screen *xwl_screen;
+ struct xwl_window *xwl_window;
+ struct wl_region *region;
+
+ if (xwl_window_get(window))
+ return TRUE;
+
+ xwl_screen = xwl_screen_get(screen);
+
+ if (xwl_screen->rootless) {
+ if (window->redirectDraw != RedirectDrawManual)
+ return TRUE;
+ }
+ else {
+ if (window->parent)
+ return TRUE;
+ }
+
+ xwl_window = calloc(1, sizeof *xwl_window);
+ if (xwl_window == NULL)
+ return FALSE;
+
+ xwl_window->xwl_screen = xwl_screen;
+ xwl_window->window = window;
+ xwl_window->width = window->drawable.width;
+ xwl_window->height = window->drawable.height;
+ xwl_window->surface = wl_compositor_create_surface(xwl_screen->compositor);
+ if (xwl_window->surface == NULL) {
+ ErrorF("wl_display_create_surface failed\n");
+ goto err;
+ }
+
+ if (!xwl_screen->rootless) {
+ xwl_window->shell_surface =
+ wl_shell_get_shell_surface(xwl_screen->shell, xwl_window->surface);
+ if (xwl_window->shell_surface == NULL) {
+ ErrorF("Failed creating shell surface\n");
+ goto err_surf;
+ }
+
+ wl_shell_surface_add_listener(xwl_window->shell_surface,
+ &shell_surface_listener, xwl_window);
+
+ wl_shell_surface_set_toplevel(xwl_window->shell_surface);
+
+ region = wl_compositor_create_region(xwl_screen->compositor);
+ if (region == NULL) {
+ ErrorF("Failed creating region\n");
+ goto err_surf;
+ }
+
+ wl_region_add(region, 0, 0,
+ window->drawable.width, window->drawable.height);
+ wl_surface_set_opaque_region(xwl_window->surface, region);
+ wl_region_destroy(region);
+ }
+
+ wl_display_flush(xwl_screen->display);
+
+ send_surface_id_event(xwl_window);
+
+ wl_surface_set_user_data(xwl_window->surface, xwl_window);
+
+ compRedirectWindow(serverClient, window, CompositeRedirectManual);
+
+ dixSetPrivate(&window->devPrivates, &xwl_window_private_key, xwl_window);
+ xorg_list_init(&xwl_window->link_damage);
+ xorg_list_add(&xwl_window->link_window, &xwl_screen->window_list);
+
+#ifdef GLAMOR_HAS_GBM
+ xorg_list_init(&xwl_window->frame_callback_list);
+#endif
+
+ xwl_window_buffers_init(xwl_window);
+
+ xwl_window_init_allow_commits(xwl_window);
+
+ return TRUE;
+
+err_surf:
+ if (xwl_window->shell_surface)
+ wl_shell_surface_destroy(xwl_window->shell_surface);
+ wl_surface_destroy(xwl_window->surface);
+err:
+ free(xwl_window);
+ return FALSE;
+}
+
+Bool
+xwl_realize_window(WindowPtr window)
+{
+ ScreenPtr screen = window->drawable.pScreen;
+ struct xwl_screen *xwl_screen;
+ Bool ret;
+
+ xwl_screen = xwl_screen_get(screen);
+
+ screen->RealizeWindow = xwl_screen->RealizeWindow;
+ ret = (*screen->RealizeWindow) (window);
+ xwl_screen->RealizeWindow = screen->RealizeWindow;
+ screen->RealizeWindow = xwl_realize_window;
+
+ if (!ret)
+ return FALSE;
+
+ if (xwl_screen->rootless && !window->parent) {
+ BoxRec box = { 0, 0, xwl_screen->width, xwl_screen->height };
+
+ RegionReset(&window->winSize, &box);
+ RegionNull(&window->clipList);
+ RegionNull(&window->borderClip);
+ }
+
+ if (xwl_screen->rootless ?
+ (window->drawable.class == InputOutput &&
+ window->parent == window->drawable.pScreen->root) :
+ !window->parent) {
+ if (!register_damage(window))
+ return FALSE;
+ }
+
+ xwl_output_set_window_randr_emu_props(xwl_screen, window);
+
+ return ensure_surface_for_window(window);
+}
+
+Bool
+xwl_unrealize_window(WindowPtr window)
+{
+ ScreenPtr screen = window->drawable.pScreen;
+ struct xwl_screen *xwl_screen;
+ struct xwl_window *xwl_window;
+ struct xwl_seat *xwl_seat;
+ Bool ret;
+
+ xwl_screen = xwl_screen_get(screen);
+
+ xorg_list_for_each_entry(xwl_seat, &xwl_screen->seat_list, link) {
+ if (xwl_seat->focus_window && xwl_seat->focus_window->window == window)
+ xwl_seat->focus_window = NULL;
+ if (xwl_seat->tablet_focus_window && xwl_seat->tablet_focus_window->window == window)
+ xwl_seat->tablet_focus_window = NULL;
+ if (xwl_seat->last_xwindow == window)
+ xwl_seat->last_xwindow = NullWindow;
+ if (xwl_seat->cursor_confinement_window &&
+ xwl_seat->cursor_confinement_window->window == window)
+ xwl_seat_unconfine_pointer(xwl_seat);
+ if (xwl_seat->pointer_warp_emulator &&
+ xwl_seat->pointer_warp_emulator->locked_window &&
+ xwl_seat->pointer_warp_emulator->locked_window->window == window)
+ xwl_seat_destroy_pointer_warp_emulator(xwl_seat);
+ xwl_seat_clear_touch(xwl_seat, window);
+ }
+
+ compUnredirectWindow(serverClient, window, CompositeRedirectManual);
+
+ screen->UnrealizeWindow = xwl_screen->UnrealizeWindow;
+ ret = (*screen->UnrealizeWindow) (window);
+ xwl_screen->UnrealizeWindow = screen->UnrealizeWindow;
+ screen->UnrealizeWindow = xwl_unrealize_window;
+
+ xwl_window = xwl_window_get(window);
+ if (!xwl_window)
+ return ret;
+
+ if (xwl_window_has_viewport_enabled(xwl_window))
+ xwl_window_disable_viewport(xwl_window);
+
+ wl_surface_destroy(xwl_window->surface);
+ xorg_list_del(&xwl_window->link_damage);
+ xorg_list_del(&xwl_window->link_window);
+ unregister_damage(window);
+
+ xwl_window_buffers_dispose(xwl_window);
+
+ if (xwl_window->frame_callback)
+ wl_callback_destroy(xwl_window->frame_callback);
+
+#ifdef GLAMOR_HAS_GBM
+ if (xwl_screen->present)
+ xwl_present_unrealize_window(window);
+#endif
+
+ free(xwl_window);
+ dixSetPrivate(&window->devPrivates, &xwl_window_private_key, NULL);
+
+ return ret;
+}
+
+void
+xwl_window_set_window_pixmap(WindowPtr window,
+ PixmapPtr pixmap)
+{
+ ScreenPtr screen = window->drawable.pScreen;
+ struct xwl_screen *xwl_screen;
+ struct xwl_window *xwl_window;
+ PixmapPtr old_pixmap;
+
+ old_pixmap = (*screen->GetWindowPixmap) (window);
+ xwl_screen = xwl_screen_get(screen);
+
+ screen->SetWindowPixmap = xwl_screen->SetWindowPixmap;
+ (*screen->SetWindowPixmap) (window, pixmap);
+ xwl_screen->SetWindowPixmap = screen->SetWindowPixmap;
+ screen->SetWindowPixmap = xwl_window_set_window_pixmap;
+
+ if (!RegionNotEmpty(&window->winSize))
+ return;
+
+ ensure_surface_for_window(window);
+
+ if (old_pixmap->drawable.width == pixmap->drawable.width &&
+ old_pixmap->drawable.height == pixmap->drawable.height)
+ return;
+
+ xwl_window = xwl_window_get(window);
+ if (xwl_window)
+ xwl_window_buffers_recycle(xwl_window);
+}
+
+void
+xwl_resize_window(WindowPtr window,
+ int x, int y,
+ unsigned int width, unsigned int height,
+ WindowPtr sib)
+{
+ ScreenPtr screen = window->drawable.pScreen;
+ struct xwl_screen *xwl_screen;
+ struct xwl_window *xwl_window;
+
+ xwl_screen = xwl_screen_get(screen);
+ xwl_window = xwl_window_get(window);
+
+ screen->ResizeWindow = xwl_screen->ResizeWindow;
+ (*screen->ResizeWindow) (window, x, y, width, height, sib);
+ xwl_screen->ResizeWindow = screen->ResizeWindow;
+ screen->ResizeWindow = xwl_resize_window;
+
+ if (xwl_window) {
+ xwl_window->x = x;
+ xwl_window->y = y;
+ xwl_window->width = width;
+ xwl_window->height = height;
+ xwl_window_check_resolution_change_emulation(xwl_window);
+ }
+}
+
+static void
+frame_callback(void *data,
+ struct wl_callback *callback,
+ uint32_t time)
+{
+ struct xwl_window *xwl_window = data;
+
+ wl_callback_destroy (xwl_window->frame_callback);
+ xwl_window->frame_callback = NULL;
+
+#ifdef GLAMOR_HAS_GBM
+ if (xwl_window->xwl_screen->present) {
+ struct xwl_present_window *xwl_present_window, *tmp;
+
+ xorg_list_for_each_entry_safe(xwl_present_window, tmp,
+ &xwl_window->frame_callback_list,
+ frame_callback_list) {
+ xwl_present_frame_callback(xwl_present_window);
+ }
+ }
+#endif
+}
+
+static const struct wl_callback_listener frame_listener = {
+ frame_callback
+};
+
+void
+xwl_window_create_frame_callback(struct xwl_window *xwl_window)
+{
+ xwl_window->frame_callback = wl_surface_frame(xwl_window->surface);
+ wl_callback_add_listener(xwl_window->frame_callback, &frame_listener,
+ xwl_window);
+}
+
+Bool
+xwl_destroy_window(WindowPtr window)
+{
+ ScreenPtr screen = window->drawable.pScreen;
+ struct xwl_screen *xwl_screen = xwl_screen_get(screen);
+ Bool ret;
+
+#ifdef GLAMOR_HAS_GBM
+ if (xwl_screen->present)
+ xwl_present_cleanup(window);
+#endif
+
+ screen->DestroyWindow = xwl_screen->DestroyWindow;
+
+ if (screen->DestroyWindow)
+ ret = screen->DestroyWindow (window);
+ else
+ ret = TRUE;
+
+ xwl_screen->DestroyWindow = screen->DestroyWindow;
+ screen->DestroyWindow = xwl_destroy_window;
+
+ return ret;
+}
+
+void xwl_surface_damage(struct xwl_screen *xwl_screen,
+ struct wl_surface *surface,
+ int32_t x, int32_t y, int32_t width, int32_t height)
+{
+ if (wl_surface_get_version(surface) >= WL_SURFACE_DAMAGE_BUFFER_SINCE_VERSION)
+ wl_surface_damage_buffer(surface, x, y, width, height);
+ else
+ wl_surface_damage(surface, x, y, width, height);
+}
+
+void
+xwl_window_post_damage(struct xwl_window *xwl_window)
+{
+ struct xwl_screen *xwl_screen = xwl_window->xwl_screen;
+ RegionPtr region;
+ BoxPtr box;
+ struct wl_buffer *buffer;
+ PixmapPtr pixmap;
+ int i;
+
+ assert(!xwl_window->frame_callback);
+
+ region = DamageRegion(window_get_damage(xwl_window->window));
+ pixmap = xwl_window_buffers_get_pixmap(xwl_window, region);
+
+#ifdef XWL_HAS_GLAMOR
+ if (xwl_screen->glamor)
+ buffer = xwl_glamor_pixmap_get_wl_buffer(pixmap,
+ NULL);
+ else
+#endif
+ buffer = xwl_shm_pixmap_get_wl_buffer(pixmap);
+
+#ifdef XWL_HAS_GLAMOR
+ if (xwl_screen->glamor)
+ xwl_glamor_post_damage(xwl_window, pixmap, region);
+#endif
+
+ wl_surface_attach(xwl_window->surface, buffer, 0, 0);
+
+ /* Arbitrary limit to try to avoid flooding the Wayland
+ * connection. If we flood it too much anyway, this could
+ * abort in libwayland-client.
+ */
+ if (RegionNumRects(region) > 256) {
+ box = RegionExtents(region);
+ xwl_surface_damage(xwl_screen, xwl_window->surface,
+ box->x1 + xwl_window->window->borderWidth,
+ box->y1 + xwl_window->window->borderWidth,
+ box->x2 - box->x1, box->y2 - box->y1);
+ } else {
+ box = RegionRects(region);
+ for (i = 0; i < RegionNumRects(region); i++, box++) {
+ xwl_surface_damage(xwl_screen, xwl_window->surface,
+ box->x1 + xwl_window->window->borderWidth,
+ box->y1 + xwl_window->window->borderWidth,
+ box->x2 - box->x1, box->y2 - box->y1);
+ }
+ }
+
+ xwl_window_create_frame_callback(xwl_window);
+ wl_surface_commit(xwl_window->surface);
+ DamageEmpty(window_get_damage(xwl_window->window));
+
+ xorg_list_del(&xwl_window->link_damage);
+}
+
+Bool
+xwl_window_init(void)
+{
+ if (!dixRegisterPrivateKey(&xwl_window_private_key, PRIVATE_WINDOW, 0))
+ return FALSE;
+
+ if (!dixRegisterPrivateKey(&xwl_damage_private_key, PRIVATE_WINDOW, 0))
+ return FALSE;
+
+ return TRUE;
+}
diff --git a/hw/xwayland/xwayland-window.h b/hw/xwayland/xwayland-window.h
new file mode 100644
index 000000000..873e191f2
--- /dev/null
+++ b/hw/xwayland/xwayland-window.h
@@ -0,0 +1,81 @@
+/*
+ * Copyright © 2011-2014 Intel Corporation
+ *
+ * Permission to use, copy, modify, distribute, and sell this software
+ * and its documentation for any purpose is hereby granted without
+ * fee, provided that the above copyright notice appear in all copies
+ * and that both that copyright notice and this permission notice
+ * appear in supporting documentation, and that the name of the
+ * copyright holders not be used in advertising or publicity
+ * pertaining to distribution of the software without specific,
+ * written prior permission. The copyright holders make no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied
+ * warranty.
+ *
+ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
+ * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
+ * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
+ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
+ */
+
+#ifndef XWAYLAND_WINDOW_H
+#define XWAYLAND_WINDOW_H
+
+#include <xwayland-config.h>
+
+#include <stdio.h>
+#include <unistd.h>
+#include <X11/X.h>
+#include <dix.h>
+#include <propertyst.h>
+
+#include "xwayland-types.h"
+
+struct xwl_window {
+ struct xwl_screen *xwl_screen;
+ struct wl_surface *surface;
+ struct wp_viewport *viewport;
+ int32_t x, y, width, height;
+ float scale_x, scale_y;
+ struct wl_shell_surface *shell_surface;
+ WindowPtr window;
+ struct xorg_list link_damage;
+ struct xorg_list link_window;
+ struct wl_callback *frame_callback;
+ Bool allow_commits;
+ struct xorg_list window_buffers_available;
+ struct xorg_list window_buffers_unavailable;
+ OsTimerPtr window_buffers_timer;
+#ifdef GLAMOR_HAS_GBM
+ struct xorg_list frame_callback_list;
+ Bool present_flipped;
+#endif
+};
+
+struct xwl_window *xwl_window_get(WindowPtr window);
+struct xwl_window *xwl_window_from_window(WindowPtr window);
+
+void xwl_window_update_property(struct xwl_window *xwl_window,
+ PropertyStateRec *propstate);
+Bool xwl_window_has_viewport_enabled(struct xwl_window *xwl_window);
+Bool xwl_window_is_toplevel(WindowPtr window);
+void xwl_window_check_resolution_change_emulation(struct xwl_window *xwl_window);
+
+void xwl_window_set_window_pixmap(WindowPtr window, PixmapPtr pixmap);
+Bool xwl_realize_window(WindowPtr window);
+Bool xwl_unrealize_window(WindowPtr window);
+void xwl_resize_window(WindowPtr window,
+ int x, int y,
+ unsigned int width, unsigned int height,
+ WindowPtr sib);
+Bool xwl_destroy_window(WindowPtr window);
+void xwl_window_post_damage(struct xwl_window *xwl_window);
+void xwl_window_create_frame_callback(struct xwl_window *xwl_window);
+Bool xwl_window_init(void);
+
+#endif /* XWAYLAND_WINDOW_H */
diff --git a/hw/xwayland/xwayland.c b/hw/xwayland/xwayland.c
index 764511d4e..b8f6b4c16 100644
--- a/hw/xwayland/xwayland.c
+++ b/hw/xwayland/xwayland.c
@@ -23,7 +23,6 @@
* SOFTWARE.
*/
-
#include <stdio.h>
#include <X11/Xatom.h>
@@ -40,6 +39,7 @@
#include "xwayland.h"
#include "xwayland-glamor.h"
#include "xwayland-shm.h"
+#include "xwayland-window.h"
#include "xwayland-window-buffers.h"
#ifdef XF86VIDMODE
@@ -170,11 +170,9 @@ ddxProcessArgument(int argc, char *argv[], int i)
}
static DevPrivateKeyRec xwl_client_private_key;
-static DevPrivateKeyRec xwl_window_private_key;
static DevPrivateKeyRec xwl_screen_private_key;
static DevPrivateKeyRec xwl_pixmap_private_key;
static DevPrivateKeyRec xwl_pixmap_cb_private_key;
-static DevPrivateKeyRec xwl_damage_private_key;
struct xwl_client *
xwl_client_get(ClientPtr client)
@@ -182,12 +180,6 @@ xwl_client_get(ClientPtr client)
return dixLookupPrivate(&client->devPrivates, &xwl_client_private_key);
}
-static struct xwl_window *
-xwl_window_get(WindowPtr window)
-{
- return dixLookupPrivate(&window->devPrivates, &xwl_window_private_key);
-}
-
struct xwl_screen *
xwl_screen_get(ScreenPtr screen)
{
@@ -228,59 +220,6 @@ xwl_screen_get_first_output(struct xwl_screen *xwl_screen)
return xorg_list_first_entry(&xwl_screen->output_list, struct xwl_output, link);
}
-static void
-xwl_window_set_allow_commits(struct xwl_window *xwl_window, Bool allow,
- const char *debug_msg)
-{
- xwl_window->allow_commits = allow;
- DebugF("xwayland: win %d allow_commits = %d (%s)\n",
- xwl_window->window->drawable.id, allow, debug_msg);
-}
-
-static void
-xwl_window_set_allow_commits_from_property(struct xwl_window *xwl_window,
- PropertyPtr prop)
-{
- static Bool warned = FALSE;
- CARD32 *propdata;
-
- if (prop->propertyName != xwl_window->xwl_screen->allow_commits_prop)
- FatalError("Xwayland internal error: prop mismatch in %s.\n", __func__);
-
- if (prop->type != XA_CARDINAL || prop->format != 32 || prop->size != 1) {
- /* Not properly set, so fall back to safe and glitchy */
- xwl_window_set_allow_commits(xwl_window, TRUE, "WM fault");
-
- if (!warned) {
- LogMessage(X_WARNING, "Window manager is misusing property %s.\n",
- NameForAtom(prop->propertyName));
- warned = TRUE;
- }
- return;
- }
-
- propdata = prop->data;
- xwl_window_set_allow_commits(xwl_window, !!propdata[0], "from property");
-}
-
-static void
-xwl_window_property_allow_commits(struct xwl_window *xwl_window,
- PropertyStateRec *propstate)
-{
- switch (propstate->state) {
- case PropertyNewValue:
- xwl_window_set_allow_commits_from_property(xwl_window, propstate->prop);
- break;
-
- case PropertyDelete:
- xwl_window_set_allow_commits(xwl_window, TRUE, "property deleted");
- break;
-
- default:
- break;
- }
-}
-
static void
xwl_property_callback(CallbackListPtr *pcbl, void *closure,
void *calldata)
@@ -300,7 +239,7 @@ xwl_property_callback(CallbackListPtr *pcbl, void *closure,
xwl_screen = xwl_screen_get(screen);
if (rec->prop->propertyName == xwl_screen->allow_commits_prop)
- xwl_window_property_allow_commits(xwl_window, rec);
+ xwl_window_update_property(xwl_window, rec);
}
struct xwl_pixmap_buffer_release_cb {
@@ -390,22 +329,6 @@ xwl_close_screen(ScreenPtr screen)
return screen->CloseScreen(screen);
}
-struct xwl_window *
-xwl_window_from_window(WindowPtr window)
-{
- struct xwl_window *xwl_window;
-
- while (window) {
- xwl_window = xwl_window_get(window);
- if (xwl_window)
- return xwl_window;
-
- window = window->parent;
- }
-
- return NULL;
-}
-
static struct xwl_seat *
xwl_screen_get_default_seat(struct xwl_screen *xwl_screen)
{
@@ -499,104 +422,6 @@ xwl_cursor_confined_to(DeviceIntPtr device,
xwl_seat_confine_pointer(xwl_seat, xwl_window);
}
-static void
-damage_report(DamagePtr pDamage, RegionPtr pRegion, void *data)
-{
- WindowPtr window = data;
- struct xwl_window *xwl_window = xwl_window_get(window);
- struct xwl_screen *xwl_screen;
-
- if (!xwl_window)
- return;
-
- xwl_screen = xwl_window->xwl_screen;
-
-#ifdef GLAMOR_HAS_GBM
- if (xwl_window->present_flipped) {
- /* This damage is from a Present flip, which already committed a new
- * buffer for the surface, so we don't need to do anything in response
- */
- RegionEmpty(DamageRegion(pDamage));
- xorg_list_del(&xwl_window->link_damage);
- xwl_window->present_flipped = FALSE;
- return;
- }
-#endif
-
- xorg_list_add(&xwl_window->link_damage, &xwl_screen->damage_window_list);
-}
-
-static void
-damage_destroy(DamagePtr pDamage, void *data)
-{
-}
-
-static Bool
-register_damage(WindowPtr window)
-{
- DamagePtr damage;
-
- damage = DamageCreate(damage_report, damage_destroy, DamageReportNonEmpty,
- FALSE, window->drawable.pScreen, window);
- if (damage == NULL) {
- ErrorF("Failed creating damage\n");
- return FALSE;
- }
-
- DamageRegister(&window->drawable, damage);
- DamageSetReportAfterOp(damage, TRUE);
-
- dixSetPrivate(&window->devPrivates, &xwl_damage_private_key, damage);
-
- return TRUE;
-}
-
-static void
-unregister_damage(WindowPtr window)
-{
- DamagePtr damage;
-
- damage = dixLookupPrivate(&window->devPrivates, &xwl_damage_private_key);
- if (!damage)
- return;
-
- DamageUnregister(damage);
- DamageDestroy(damage);
-
- dixSetPrivate(&window->devPrivates, &xwl_damage_private_key, NULL);
-}
-
-static DamagePtr
-window_get_damage(WindowPtr window)
-{
- return dixLookupPrivate(&window->devPrivates, &xwl_damage_private_key);
-}
-
-static void
-shell_surface_ping(void *data,
- struct wl_shell_surface *shell_surface, uint32_t serial)
-{
- wl_shell_surface_pong(shell_surface, serial);
-}
-
-static void
-shell_surface_configure(void *data,
- struct wl_shell_surface *wl_shell_surface,
- uint32_t edges, int32_t width, int32_t height)
-{
-}
-
-static void
-shell_surface_popup_done(void *data, struct wl_shell_surface *wl_shell_surface)
-{
-}
-
-static const struct wl_shell_surface_listener shell_surface_listener = {
- shell_surface_ping,
- shell_surface_configure,
- shell_surface_popup_done
-};
-
void
xwl_pixmap_set_private(PixmapPtr pixmap, struct xwl_pixmap *xwl_pixmap)
{
@@ -609,158 +434,6 @@ xwl_pixmap_get(PixmapPtr pixmap)
return dixLookupPrivate(&pixmap->devPrivates, &xwl_pixmap_private_key);
}
-Bool
-xwl_window_has_viewport_enabled(struct xwl_window *xwl_window)
-{
- return (xwl_window->viewport != NULL);
-}
-
-static void
-xwl_window_disable_viewport(struct xwl_window *xwl_window)
-{
- assert (xwl_window->viewport);
-
- DebugF("XWAYLAND: disabling viewport\n");
- wp_viewport_destroy(xwl_window->viewport);
- xwl_window->viewport = NULL;
-}
-
-static void
-xwl_window_enable_viewport(struct xwl_window *xwl_window,
- struct xwl_output *xwl_output,
- struct xwl_emulated_mode *emulated_mode)
-{
- /* If necessary disable old viewport to apply new settings */
- if (xwl_window_has_viewport_enabled(xwl_window))
- xwl_window_disable_viewport(xwl_window);
-
- DebugF("XWAYLAND: enabling viewport %dx%d -> %dx%d\n",
- emulated_mode->width, emulated_mode->height,
- xwl_output->width, xwl_output->height);
-
- xwl_window->viewport =
- wp_viewporter_get_viewport(xwl_window->xwl_screen->viewporter,
- xwl_window->surface);
-
- wp_viewport_set_source(xwl_window->viewport,
- wl_fixed_from_int(0),
- wl_fixed_from_int(0),
- wl_fixed_from_int(emulated_mode->width),
- wl_fixed_from_int(emulated_mode->height));
- wp_viewport_set_destination(xwl_window->viewport,
- xwl_output->width,
- xwl_output->height);
-
- xwl_window->scale_x = (float)emulated_mode->width / xwl_output->width;
- xwl_window->scale_y = (float)emulated_mode->height / xwl_output->height;
-}
-
-static Bool
-xwl_screen_client_is_window_manager(struct xwl_screen *xwl_screen,
- ClientPtr client)
-{
- WindowPtr root = xwl_screen->screen->root;
- OtherClients *others;
-
- for (others = wOtherClients(root); others; others = others->next) {
- if (SameClient(others, client)) {
- if (others->mask & (SubstructureRedirectMask | ResizeRedirectMask))
- return TRUE;
- }
- }
-
- return FALSE;
-}
-
-static ClientPtr
-xwl_window_get_owner(struct xwl_window *xwl_window)
-{
- WindowPtr window = xwl_window->window;
- ClientPtr client = wClient(window);
-
- /* If the toplevel window is owned by the window-manager, then the
- * actual client toplevel window has been reparented to a window-manager
- * decoration window. In that case return the client of the
- * first *and only* child of the toplevel (decoration) window.
- */
- if (xwl_screen_client_is_window_manager(xwl_window->xwl_screen, client)) {
- if (window->firstChild && window->firstChild == window->lastChild)
- return wClient(window->firstChild);
- else
- return NULL; /* Should never happen, skip resolution emulation */
- }
-
- return client;
-}
-
-static Bool
-xwl_window_should_enable_viewport(struct xwl_window *xwl_window,
- struct xwl_output **xwl_output_ret,
- struct xwl_emulated_mode **emulated_mode_ret)
-{
- struct xwl_screen *xwl_screen = xwl_window->xwl_screen;
- struct xwl_emulated_mode *emulated_mode;
- struct xwl_output *xwl_output;
- ClientPtr owner;
-
- if (!xwl_screen_has_resolution_change_emulation(xwl_screen))
- return FALSE;
-
- owner = xwl_window_get_owner(xwl_window);
- if (!owner)
- return FALSE;
-
- /* 1. Test if the window matches the emulated mode on one of the outputs
- * This path gets hit by most games / libs (e.g. SDL, SFML, OGRE)
- */
- xorg_list_for_each_entry(xwl_output, &xwl_screen->output_list, link) {
- emulated_mode = xwl_output_get_emulated_mode_for_client(xwl_output, owner);
- if (!emulated_mode)
- continue;
-
- if (xwl_window->x == xwl_output->x &&
- xwl_window->y == xwl_output->y &&
- xwl_window->width == emulated_mode->width &&
- xwl_window->height == emulated_mode->height) {
-
- *emulated_mode_ret = emulated_mode;
- *xwl_output_ret = xwl_output;
- return TRUE;
- }
- }
-
- /* 2. Test if the window uses override-redirect + vidmode
- * and matches (fully covers) the entire screen.
- * This path gets hit by: allegro4, ClanLib-1.0.
- */
- xwl_output = xwl_screen_get_first_output(xwl_screen);
- emulated_mode = xwl_output_get_emulated_mode_for_client(xwl_output, owner);
- if (xwl_output && xwl_window->window->overrideRedirect &&
- emulated_mode && emulated_mode->from_vidmode &&
- xwl_window->x == 0 && xwl_window->y == 0 &&
- xwl_window->width == xwl_screen->width &&
- xwl_window->height == xwl_screen->height) {
-
- *emulated_mode_ret = emulated_mode;
- *xwl_output_ret = xwl_output;
- return TRUE;
- }
-
- return FALSE;
-}
-
-static void
-xwl_window_check_resolution_change_emulation(struct xwl_window *xwl_window)
-{
- struct xwl_emulated_mode *emulated_mode;
- struct xwl_output *xwl_output;
-
- if (xwl_window_should_enable_viewport(xwl_window, &xwl_output, &emulated_mode))
- xwl_window_enable_viewport(xwl_window, xwl_output, emulated_mode);
- else if (xwl_window_has_viewport_enabled(xwl_window))
- xwl_window_disable_viewport(xwl_window);
-}
-
void
xwl_screen_check_resolution_change_emulation(struct xwl_screen *xwl_screen)
{
@@ -770,447 +443,6 @@ xwl_screen_check_resolution_change_emulation(struct xwl_screen *xwl_screen)
xwl_window_check_resolution_change_emulation(xwl_window);
}
-/* This checks if the passed in Window is a toplevel client window, note this
- * returns false for window-manager decoration windows and returns true for
- * the actual client top-level window even if it has been reparented to
- * a window-manager decoration window.
- */
-Bool
-xwl_window_is_toplevel(WindowPtr window)
-{
- struct xwl_screen *xwl_screen = xwl_screen_get(window->drawable.pScreen);
-
- if (xwl_screen_client_is_window_manager(xwl_screen, wClient(window)))
- return FALSE;
-
- /* CSD and override-redirect toplevel windows */
- if (window_get_damage(window))
- return TRUE;
-
- /* Normal toplevel client windows, reparented to decoration window */
- return (window->parent && window_get_damage(window->parent));
-}
-
-static void
-xwl_window_init_allow_commits(struct xwl_window *xwl_window)
-{
- PropertyPtr prop = NULL;
- int ret;
-
- ret = dixLookupProperty(&prop, xwl_window->window,
- xwl_window->xwl_screen->allow_commits_prop,
- serverClient, DixReadAccess);
- if (ret == Success && prop)
- xwl_window_set_allow_commits_from_property(xwl_window, prop);
- else
- xwl_window_set_allow_commits(xwl_window, TRUE, "no property");
-}
-
-static void
-send_surface_id_event(struct xwl_window *xwl_window)
-{
- static const char atom_name[] = "WL_SURFACE_ID";
- static Atom type_atom;
- DeviceIntPtr dev;
- xEvent e;
-
- if (type_atom == None)
- type_atom = MakeAtom(atom_name, strlen(atom_name), TRUE);
-
- e.u.u.type = ClientMessage;
- e.u.u.detail = 32;
- e.u.clientMessage.window = xwl_window->window->drawable.id;
- e.u.clientMessage.u.l.type = type_atom;
- e.u.clientMessage.u.l.longs0 =
- wl_proxy_get_id((struct wl_proxy *) xwl_window->surface);
- e.u.clientMessage.u.l.longs1 = 0;
- e.u.clientMessage.u.l.longs2 = 0;
- e.u.clientMessage.u.l.longs3 = 0;
- e.u.clientMessage.u.l.longs4 = 0;
-
- dev = PickPointer(serverClient);
- DeliverEventsToWindow(dev, xwl_window->xwl_screen->screen->root,
- &e, 1, SubstructureRedirectMask, NullGrab);
-}
-
-static Bool
-ensure_surface_for_window(WindowPtr window)
-{
- ScreenPtr screen = window->drawable.pScreen;
- struct xwl_screen *xwl_screen;
- struct xwl_window *xwl_window;
- struct wl_region *region;
-
- if (xwl_window_get(window))
- return TRUE;
-
- xwl_screen = xwl_screen_get(screen);
-
- if (xwl_screen->rootless) {
- if (window->redirectDraw != RedirectDrawManual)
- return TRUE;
- }
- else {
- if (window->parent)
- return TRUE;
- }
-
- xwl_window = calloc(1, sizeof *xwl_window);
- if (xwl_window == NULL)
- return FALSE;
-
- xwl_window->xwl_screen = xwl_screen;
- xwl_window->window = window;
- xwl_window->width = window->drawable.width;
- xwl_window->height = window->drawable.height;
- xwl_window->surface = wl_compositor_create_surface(xwl_screen->compositor);
- if (xwl_window->surface == NULL) {
- ErrorF("wl_display_create_surface failed\n");
- goto err;
- }
-
- if (!xwl_screen->rootless) {
- xwl_window->shell_surface =
- wl_shell_get_shell_surface(xwl_screen->shell, xwl_window->surface);
- if (xwl_window->shell_surface == NULL) {
- ErrorF("Failed creating shell surface\n");
- goto err_surf;
- }
-
- wl_shell_surface_add_listener(xwl_window->shell_surface,
- &shell_surface_listener, xwl_window);
-
- wl_shell_surface_set_toplevel(xwl_window->shell_surface);
-
- region = wl_compositor_create_region(xwl_screen->compositor);
- if (region == NULL) {
- ErrorF("Failed creating region\n");
- goto err_surf;
- }
-
- wl_region_add(region, 0, 0,
- window->drawable.width, window->drawable.height);
- wl_surface_set_opaque_region(xwl_window->surface, region);
- wl_region_destroy(region);
- }
-
- wl_display_flush(xwl_screen->display);
-
- send_surface_id_event(xwl_window);
-
- wl_surface_set_user_data(xwl_window->surface, xwl_window);
-
- compRedirectWindow(serverClient, window, CompositeRedirectManual);
-
- dixSetPrivate(&window->devPrivates, &xwl_window_private_key, xwl_window);
- xorg_list_init(&xwl_window->link_damage);
- xorg_list_add(&xwl_window->link_window, &xwl_screen->window_list);
-
-#ifdef GLAMOR_HAS_GBM
- xorg_list_init(&xwl_window->frame_callback_list);
-#endif
-
- xwl_window_buffers_init(xwl_window);
-
- xwl_window_init_allow_commits(xwl_window);
-
- return TRUE;
-
-err_surf:
- if (xwl_window->shell_surface)
- wl_shell_surface_destroy(xwl_window->shell_surface);
- wl_surface_destroy(xwl_window->surface);
-err:
- free(xwl_window);
- return FALSE;
-}
-
-static Bool
-xwl_realize_window(WindowPtr window)
-{
- ScreenPtr screen = window->drawable.pScreen;
- struct xwl_screen *xwl_screen;
- Bool ret;
-
- xwl_screen = xwl_screen_get(screen);
-
- screen->RealizeWindow = xwl_screen->RealizeWindow;
- ret = (*screen->RealizeWindow) (window);
- xwl_screen->RealizeWindow = screen->RealizeWindow;
- screen->RealizeWindow = xwl_realize_window;
-
- if (!ret)
- return FALSE;
-
- if (xwl_screen->rootless && !window->parent) {
- BoxRec box = { 0, 0, xwl_screen->width, xwl_screen->height };
-
- RegionReset(&window->winSize, &box);
- RegionNull(&window->clipList);
- RegionNull(&window->borderClip);
- }
-
- if (xwl_screen->rootless ?
- (window->drawable.class == InputOutput &&
- window->parent == window->drawable.pScreen->root) :
- !window->parent) {
- if (!register_damage(window))
- return FALSE;
- }
-
- xwl_output_set_window_randr_emu_props(xwl_screen, window);
-
- return ensure_surface_for_window(window);
-}
-
-static Bool
-xwl_unrealize_window(WindowPtr window)
-{
- ScreenPtr screen = window->drawable.pScreen;
- struct xwl_screen *xwl_screen;
- struct xwl_window *xwl_window;
- struct xwl_seat *xwl_seat;
- Bool ret;
-
- xwl_screen = xwl_screen_get(screen);
-
- xorg_list_for_each_entry(xwl_seat, &xwl_screen->seat_list, link) {
- if (xwl_seat->focus_window && xwl_seat->focus_window->window == window)
- xwl_seat->focus_window = NULL;
- if (xwl_seat->tablet_focus_window && xwl_seat->tablet_focus_window->window == window)
- xwl_seat->tablet_focus_window = NULL;
- if (xwl_seat->last_xwindow == window)
- xwl_seat->last_xwindow = NullWindow;
- if (xwl_seat->cursor_confinement_window &&
- xwl_seat->cursor_confinement_window->window == window)
- xwl_seat_unconfine_pointer(xwl_seat);
- if (xwl_seat->pointer_warp_emulator &&
- xwl_seat->pointer_warp_emulator->locked_window &&
- xwl_seat->pointer_warp_emulator->locked_window->window == window)
- xwl_seat_destroy_pointer_warp_emulator(xwl_seat);
- xwl_seat_clear_touch(xwl_seat, window);
- }
-
- compUnredirectWindow(serverClient, window, CompositeRedirectManual);
-
- screen->UnrealizeWindow = xwl_screen->UnrealizeWindow;
- ret = (*screen->UnrealizeWindow) (window);
- xwl_screen->UnrealizeWindow = screen->UnrealizeWindow;
- screen->UnrealizeWindow = xwl_unrealize_window;
-
- xwl_window = xwl_window_get(window);
- if (!xwl_window)
- return ret;
-
- if (xwl_window_has_viewport_enabled(xwl_window))
- xwl_window_disable_viewport(xwl_window);
-
- wl_surface_destroy(xwl_window->surface);
- xorg_list_del(&xwl_window->link_damage);
- xorg_list_del(&xwl_window->link_window);
- unregister_damage(window);
-
- xwl_window_buffers_dispose(xwl_window);
-
- if (xwl_window->frame_callback)
- wl_callback_destroy(xwl_window->frame_callback);
-
-#ifdef GLAMOR_HAS_GBM
- if (xwl_screen->present)
- xwl_present_unrealize_window(window);
-#endif
-
- free(xwl_window);
- dixSetPrivate(&window->devPrivates, &xwl_window_private_key, NULL);
-
- return ret;
-}
-
-static void
-xwl_set_window_pixmap(WindowPtr window,
- PixmapPtr pixmap)
-{
- ScreenPtr screen = window->drawable.pScreen;
- struct xwl_screen *xwl_screen;
- struct xwl_window *xwl_window;
- PixmapPtr old_pixmap;
-
- old_pixmap = (*screen->GetWindowPixmap) (window);
- xwl_screen = xwl_screen_get(screen);
-
- screen->SetWindowPixmap = xwl_screen->SetWindowPixmap;
- (*screen->SetWindowPixmap) (window, pixmap);
- xwl_screen->SetWindowPixmap = screen->SetWindowPixmap;
- screen->SetWindowPixmap = xwl_set_window_pixmap;
-
- if (!RegionNotEmpty(&window->winSize))
- return;
-
- ensure_surface_for_window(window);
-
- if (old_pixmap->drawable.width == pixmap->drawable.width &&
- old_pixmap->drawable.height == pixmap->drawable.height)
- return;
-
- xwl_window = xwl_window_get(window);
- if (xwl_window)
- xwl_window_buffers_recycle(xwl_window);
-}
-
-static void
-xwl_resize_window(WindowPtr window,
- int x, int y,
- unsigned int width, unsigned int height,
- WindowPtr sib)
-{
- ScreenPtr screen = window->drawable.pScreen;
- struct xwl_screen *xwl_screen;
- struct xwl_window *xwl_window;
-
- xwl_screen = xwl_screen_get(screen);
- xwl_window = xwl_window_get(window);
-
- screen->ResizeWindow = xwl_screen->ResizeWindow;
- (*screen->ResizeWindow) (window, x, y, width, height, sib);
- xwl_screen->ResizeWindow = screen->ResizeWindow;
- screen->ResizeWindow = xwl_resize_window;
-
- if (xwl_window) {
- xwl_window->x = x;
- xwl_window->y = y;
- xwl_window->width = width;
- xwl_window->height = height;
- xwl_window_check_resolution_change_emulation(xwl_window);
- }
-}
-
-static void
-frame_callback(void *data,
- struct wl_callback *callback,
- uint32_t time)
-{
- struct xwl_window *xwl_window = data;
-
- wl_callback_destroy (xwl_window->frame_callback);
- xwl_window->frame_callback = NULL;
-
-#ifdef GLAMOR_HAS_GBM
- if (xwl_window->xwl_screen->present) {
- struct xwl_present_window *xwl_present_window, *tmp;
-
- xorg_list_for_each_entry_safe(xwl_present_window, tmp,
- &xwl_window->frame_callback_list,
- frame_callback_list) {
- xwl_present_frame_callback(xwl_present_window);
- }
- }
-#endif
-}
-
-static const struct wl_callback_listener frame_listener = {
- frame_callback
-};
-
-void
-xwl_window_create_frame_callback(struct xwl_window *xwl_window)
-{
- xwl_window->frame_callback = wl_surface_frame(xwl_window->surface);
- wl_callback_add_listener(xwl_window->frame_callback, &frame_listener,
- xwl_window);
-}
-
-static Bool
-xwl_destroy_window(WindowPtr window)
-{
- ScreenPtr screen = window->drawable.pScreen;
- struct xwl_screen *xwl_screen = xwl_screen_get(screen);
- Bool ret;
-
-#ifdef GLAMOR_HAS_GBM
- if (xwl_screen->present)
- xwl_present_cleanup(window);
-#endif
-
- screen->DestroyWindow = xwl_screen->DestroyWindow;
-
- if (screen->DestroyWindow)
- ret = screen->DestroyWindow (window);
- else
- ret = TRUE;
-
- xwl_screen->DestroyWindow = screen->DestroyWindow;
- screen->DestroyWindow = xwl_destroy_window;
-
- return ret;
-}
-
-void xwl_surface_damage(struct xwl_screen *xwl_screen,
- struct wl_surface *surface,
- int32_t x, int32_t y, int32_t width, int32_t height)
-{
- if (wl_surface_get_version(surface) >= WL_SURFACE_DAMAGE_BUFFER_SINCE_VERSION)
- wl_surface_damage_buffer(surface, x, y, width, height);
- else
- wl_surface_damage(surface, x, y, width, height);
-}
-
-static void
-xwl_window_post_damage(struct xwl_window *xwl_window)
-{
- struct xwl_screen *xwl_screen = xwl_window->xwl_screen;
- RegionPtr region;
- BoxPtr box;
- struct wl_buffer *buffer;
- PixmapPtr pixmap;
- int i;
-
- assert(!xwl_window->frame_callback);
-
- region = DamageRegion(window_get_damage(xwl_window->window));
- pixmap = xwl_window_buffers_get_pixmap(xwl_window, region);
-
-#ifdef XWL_HAS_GLAMOR
- if (xwl_screen->glamor)
- buffer = xwl_glamor_pixmap_get_wl_buffer(pixmap,
- NULL);
- else
-#endif
- buffer = xwl_shm_pixmap_get_wl_buffer(pixmap);
-
-#ifdef XWL_HAS_GLAMOR
- if (xwl_screen->glamor)
- xwl_glamor_post_damage(xwl_window, pixmap, region);
-#endif
-
- wl_surface_attach(xwl_window->surface, buffer, 0, 0);
-
- /* Arbitrary limit to try to avoid flooding the Wayland
- * connection. If we flood it too much anyway, this could
- * abort in libwayland-client.
- */
- if (RegionNumRects(region) > 256) {
- box = RegionExtents(region);
- xwl_surface_damage(xwl_screen, xwl_window->surface,
- box->x1 + xwl_window->window->borderWidth,
- box->y1 + xwl_window->window->borderWidth,
- box->x2 - box->x1, box->y2 - box->y1);
- } else {
- box = RegionRects(region);
- for (i = 0; i < RegionNumRects(region); i++, box++) {
- xwl_surface_damage(xwl_screen, xwl_window->surface,
- box->x1 + xwl_window->window->borderWidth,
- box->y1 + xwl_window->window->borderWidth,
- box->x2 - box->x1, box->y2 - box->y1);
- }
- }
-
- xwl_window_create_frame_callback(xwl_window);
- wl_surface_commit(xwl_window->surface);
- DamageEmpty(window_get_damage(xwl_window->window));
-
- xorg_list_del(&xwl_window->link_damage);
-}
-
static void
xwl_screen_post_damage(struct xwl_screen *xwl_screen)
{
@@ -1447,13 +679,11 @@ xwl_screen_init(ScreenPtr pScreen, int argc, char **argv)
if (!dixRegisterPrivateKey(&xwl_screen_private_key, PRIVATE_SCREEN, 0))
return FALSE;
- if (!dixRegisterPrivateKey(&xwl_window_private_key, PRIVATE_WINDOW, 0))
- return FALSE;
if (!dixRegisterPrivateKey(&xwl_pixmap_private_key, PRIVATE_PIXMAP, 0))
return FALSE;
if (!dixRegisterPrivateKey(&xwl_pixmap_cb_private_key, PRIVATE_PIXMAP, 0))
return FALSE;
- if (!dixRegisterPrivateKey(&xwl_damage_private_key, PRIVATE_WINDOW, 0))
+ if (!xwl_window_init())
return FALSE;
/* There are no easy to use new / delete client hooks, we could use a
* ClientStateCallback, but it is easier to let the dix code manage the
@@ -1603,7 +833,7 @@ xwl_screen_init(ScreenPtr pScreen, int argc, char **argv)
if (xwl_screen->rootless) {
xwl_screen->SetWindowPixmap = pScreen->SetWindowPixmap;
- pScreen->SetWindowPixmap = xwl_set_window_pixmap;
+ pScreen->SetWindowPixmap = xwl_window_set_window_pixmap;
}
pScreen->CursorWarpedTo = xwl_cursor_warped_to;
diff --git a/hw/xwayland/xwayland.h b/hw/xwayland/xwayland.h
index 8db682a8f..5b802c0fd 100644
--- a/hw/xwayland/xwayland.h
+++ b/hw/xwayland/xwayland.h
@@ -123,27 +123,6 @@ struct xwl_screen {
Atom allow_commits_prop;
};
-struct xwl_window {
- struct xwl_screen *xwl_screen;
- struct wl_surface *surface;
- struct wp_viewport *viewport;
- int32_t x, y, width, height;
- float scale_x, scale_y;
- struct wl_shell_surface *shell_surface;
- WindowPtr window;
- struct xorg_list link_damage;
- struct xorg_list link_window;
- struct wl_callback *frame_callback;
- Bool allow_commits;
- struct xorg_list window_buffers_available;
- struct xorg_list window_buffers_unavailable;
- OsTimerPtr window_buffers_timer;
-#ifdef GLAMOR_HAS_GBM
- struct xorg_list frame_callback_list;
- Bool present_flipped;
-#endif
-};
-
#ifdef GLAMOR_HAS_GBM
struct xwl_present_window {
struct xwl_screen *xwl_screen;
@@ -363,9 +342,6 @@ struct xwl_screen *xwl_screen_get(ScreenPtr screen);
Bool xwl_screen_has_resolution_change_emulation(struct xwl_screen *xwl_screen);
struct xwl_output *xwl_screen_get_first_output(struct xwl_screen *xwl_screen);
void xwl_screen_check_resolution_change_emulation(struct xwl_screen *xwl_screen);
-void xwl_window_create_frame_callback(struct xwl_window *xwl_window);
-Bool xwl_window_has_viewport_enabled(struct xwl_window *xwl_window);
-Bool xwl_window_is_toplevel(WindowPtr window);
void xwl_tablet_tool_set_cursor(struct xwl_tablet_tool *tool);
void xwl_seat_set_cursor(struct xwl_seat *xwl_seat);
@@ -417,8 +393,6 @@ Bool xwl_pixmap_set_buffer_release_cb(PixmapPtr pixmap,
void xwl_pixmap_del_buffer_release_cb(PixmapPtr pixmap);
void xwl_pixmap_buffer_release_cb(void *data, struct wl_buffer *wl_buffer);
-struct xwl_window *xwl_window_from_window(WindowPtr window);
-
#ifdef XWL_HAS_GLAMOR
#ifdef GLAMOR_HAS_GBM
commit 3a59650ba74e9d97473fa39269fdb74ad7e1cd43
Author: Olivier Fourdan <ofourdan at redhat.com>
Date: Mon Dec 16 17:23:30 2019 +0100
xwayland: Move GLAMOR declarations to their own header
Currently, `xwayland.h` contains all the declarations, which is a bit
awkward and hard to follow.
Move the GLAMOR relevant declarations to their own header file.
Signed-off-by: Olivier Fourdan <ofourdan at redhat.com>
Reviewed-by: Michel Dänzer <mdaenzer at redhat.com>
diff --git a/hw/xwayland/Makefile.am b/hw/xwayland/Makefile.am
index c3a159e7a..7decc8f06 100644
--- a/hw/xwayland/Makefile.am
+++ b/hw/xwayland/Makefile.am
@@ -13,6 +13,7 @@ Xwayland_SOURCES = \
xwayland.c \
xwayland-input.c \
xwayland-cursor.c \
+ xwayland-glamor.h \
xwayland-shm.c \
xwayland-shm.h \
xwayland-types.h \
diff --git a/hw/xwayland/meson.build b/hw/xwayland/meson.build
index 61337b0e1..d4a408cb4 100644
--- a/hw/xwayland/meson.build
+++ b/hw/xwayland/meson.build
@@ -2,6 +2,7 @@ srcs = [
'xwayland.c',
'xwayland-input.c',
'xwayland-cursor.c',
+ 'xwayland-glamor.h',
'xwayland-shm.c',
'xwayland-shm.h',
'xwayland-types.h',
diff --git a/hw/xwayland/xwayland-glamor-eglstream.c b/hw/xwayland/xwayland-glamor-eglstream.c
index ed10355ed..b9d3bc45d 100644
--- a/hw/xwayland/xwayland-glamor-eglstream.c
+++ b/hw/xwayland/xwayland-glamor-eglstream.c
@@ -27,10 +27,7 @@
*
*/
-#include "xwayland.h"
-
-#include "wayland-eglstream-client-protocol.h"
-#include "wayland-eglstream-controller-client-protocol.h"
+#include <xwayland-config.h>
#define MESA_EGL_NO_X11_HEADERS
#define EGL_NO_X11
@@ -43,6 +40,12 @@
#include <epoxy/egl.h>
+#include "xwayland.h"
+#include "xwayland-glamor.h"
+
+#include "wayland-eglstream-client-protocol.h"
+#include "wayland-eglstream-controller-client-protocol.h"
+
struct xwl_eglstream_pending_stream {
PixmapPtr pixmap;
WindowPtr window;
diff --git a/hw/xwayland/xwayland-glamor-gbm.c b/hw/xwayland/xwayland-glamor-gbm.c
index 9b7d6e286..e4718da52 100644
--- a/hw/xwayland/xwayland-glamor-gbm.c
+++ b/hw/xwayland/xwayland-glamor-gbm.c
@@ -28,9 +28,10 @@
*
*/
-#include "xwayland.h"
+#include <xwayland-config.h>
#include <fcntl.h>
+#include <errno.h>
#include <sys/stat.h>
#include <xf86drm.h>
#include <drm_fourcc.h>
@@ -45,6 +46,11 @@
#include <dri3.h>
#include "drm-client-protocol.h"
+#include "xwayland.h"
+#include "xwayland-glamor.h"
+
+#include "linux-dmabuf-unstable-v1-client-protocol.h"
+
struct xwl_gbm_private {
char *device_name;
struct gbm_device *gbm;
diff --git a/hw/xwayland/xwayland-glamor-xv.c b/hw/xwayland/xwayland-glamor-xv.c
index 8e0f8da94..fe6849cc3 100644
--- a/hw/xwayland/xwayland-glamor-xv.c
+++ b/hw/xwayland/xwayland-glamor-xv.c
@@ -30,11 +30,15 @@
* implementations
*/
-#include "xwayland.h"
+#include <xwayland-config.h>
+
#include "glamor_priv.h"
#include <X11/extensions/Xv.h>
+#include "xwayland.h"
+#include "xwayland-glamor.h"
+
#define NUM_FORMATS 3
#define NUM_PORTS 16
#define ADAPTOR_NAME "glamor textured video"
diff --git a/hw/xwayland/xwayland-glamor.c b/hw/xwayland/xwayland-glamor.c
index bf7f0ffb4..e1ac22348 100644
--- a/hw/xwayland/xwayland-glamor.c
+++ b/hw/xwayland/xwayland-glamor.c
@@ -23,7 +23,9 @@
* SOFTWARE.
*/
-#include "xwayland.h"
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
#define MESA_EGL_NO_X11_HEADERS
#define EGL_NO_X11
@@ -35,6 +37,9 @@
#include "glx_extinit.h"
#endif
+#include "xwayland.h"
+#include "xwayland-glamor.h"
+
static void
glamor_egl_make_current(struct glamor_context *glamor_ctx)
{
diff --git a/hw/xwayland/xwayland-glamor.h b/hw/xwayland/xwayland-glamor.h
new file mode 100644
index 000000000..78e0d6ddd
--- /dev/null
+++ b/hw/xwayland/xwayland-glamor.h
@@ -0,0 +1,134 @@
+/*
+ * Copyright © 2011-2014 Intel Corporation
+ *
+ * Permission to use, copy, modify, distribute, and sell this software
+ * and its documentation for any purpose is hereby granted without
+ * fee, provided that the above copyright notice appear in all copies
+ * and that both that copyright notice and this permission notice
+ * appear in supporting documentation, and that the name of the
+ * copyright holders not be used in advertising or publicity
+ * pertaining to distribution of the software without specific,
+ * written prior permission. The copyright holders make no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied
+ * warranty.
+ *
+ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
+ * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
+ * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
+ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
+ */
+
+#ifndef XWAYLAND_GLAMOR_H
+#define XWAYLAND_GLAMOR_H
+
+#include <xwayland-config.h>
+
+#include "xwayland-types.h"
+
+struct xwl_egl_backend {
+ /* Set by the backend if available */
+ Bool is_available;
+
+ /* Called once for each interface in the global registry. Backends
+ * should use this to bind to any wayland interfaces they need.
+ */
+ Bool (*init_wl_registry)(struct xwl_screen *xwl_screen,
+ struct wl_registry *wl_registry,
+ uint32_t id, const char *name,
+ uint32_t version);
+
+ /* Check that the required Wayland interfaces are available.
+ */
+ Bool (*has_wl_interfaces)(struct xwl_screen *xwl_screen);
+
+ /* Called before glamor has been initialized. Backends should setup a
+ * valid, glamor compatible EGL context in this hook.
+ */
+ Bool (*init_egl)(struct xwl_screen *xwl_screen);
+
+ /* Called after glamor has been initialized, and after all of the
+ * common Xwayland DDX hooks have been connected. Backends should use
+ * this to setup any required wraps around X server callbacks like
+ * CreatePixmap.
+ */
+ Bool (*init_screen)(struct xwl_screen *xwl_screen);
+
+ /* Called by Xwayland to retrieve a pointer to a valid wl_buffer for
+ * the given window/pixmap combo so that damage to the pixmap may be
+ * displayed on-screen. Backends should use this to create a new
+ * wl_buffer for a currently buffer-less pixmap, or simply return the
+ * pixmap they've prepared beforehand.
+ */
+ struct wl_buffer *(*get_wl_buffer_for_pixmap)(PixmapPtr pixmap,
+ Bool *created);
+
+ /* Called by Xwayland to perform any pre-wl_surface damage routines
+ * that are required by the backend. If your backend is poorly
+ * designed and lacks the ability to render directly to a surface,
+ * you should implement blitting from the glamor pixmap to the wayland
+ * pixmap here. Otherwise, this callback is optional.
+ */
+ void (*post_damage)(struct xwl_window *xwl_window,
+ PixmapPtr pixmap, RegionPtr region);
+
+ /* Called by Xwayland to confirm with the egl backend that the given
+ * pixmap is completely setup and ready for display on-screen. This
+ * callback is optional.
+ */
+ Bool (*allow_commits)(struct xwl_window *xwl_window);
+};
+
+#ifdef XWL_HAS_GLAMOR
+
+void xwl_glamor_init_backends(struct xwl_screen *xwl_screen,
+ Bool use_eglstream);
+void xwl_glamor_select_backend(struct xwl_screen *xwl_screen,
+ Bool use_eglstream);
+Bool xwl_glamor_init(struct xwl_screen *xwl_screen);
+
+Bool xwl_screen_set_drm_interface(struct xwl_screen *xwl_screen,
+ uint32_t id, uint32_t version);
+Bool xwl_screen_set_dmabuf_interface(struct xwl_screen *xwl_screen,
+ uint32_t id, uint32_t version);
+struct wl_buffer *xwl_glamor_pixmap_get_wl_buffer(PixmapPtr pixmap,
+ Bool *created);
+void xwl_glamor_init_wl_registry(struct xwl_screen *xwl_screen,
+ struct wl_registry *registry,
+ uint32_t id, const char *interface,
+ uint32_t version);
+Bool xwl_glamor_has_wl_interfaces(struct xwl_screen *xwl_screen,
+ struct xwl_egl_backend *xwl_egl_backend);
+void xwl_glamor_post_damage(struct xwl_window *xwl_window,
+ PixmapPtr pixmap, RegionPtr region);
+Bool xwl_glamor_allow_commits(struct xwl_window *xwl_window);
+void xwl_glamor_egl_make_current(struct xwl_screen *xwl_screen);
+
+#ifdef XV
+/* glamor Xv Adaptor */
+Bool xwl_glamor_xv_init(ScreenPtr pScreen);
+#endif /* XV */
+
+#endif /* XWL_HAS_GLAMOR */
+
+#ifdef GLAMOR_HAS_GBM
+void xwl_glamor_init_gbm(struct xwl_screen *xwl_screen);
+#else
+static inline void xwl_glamor_init_gbm(struct xwl_screen *xwl_screen)
+{
+}
+#endif
+
+#ifdef XWL_HAS_EGLSTREAM
+void xwl_glamor_init_eglstream(struct xwl_screen *xwl_screen);
+#else
+static inline void xwl_glamor_init_eglstream(struct xwl_screen *xwl_screen)
+{
+}
+#endif
+
+#endif /* XWAYLAND_GLAMOR_H */
diff --git a/hw/xwayland/xwayland.c b/hw/xwayland/xwayland.c
index 726be02de..764511d4e 100644
--- a/hw/xwayland/xwayland.c
+++ b/hw/xwayland/xwayland.c
@@ -23,6 +23,7 @@
* SOFTWARE.
*/
+
#include <stdio.h>
#include <X11/Xatom.h>
@@ -37,6 +38,7 @@
#include <propertyst.h>
#include "xwayland.h"
+#include "xwayland-glamor.h"
#include "xwayland-shm.h"
#include "xwayland-window-buffers.h"
diff --git a/hw/xwayland/xwayland.h b/hw/xwayland/xwayland.h
index f4cdc5be0..8db682a8f 100644
--- a/hw/xwayland/xwayland.h
+++ b/hw/xwayland/xwayland.h
@@ -51,6 +51,7 @@
#include "viewporter-client-protocol.h"
#include "xwayland-types.h"
+#include "xwayland-glamor.h"
struct xwl_format {
uint32_t format;
@@ -60,59 +61,6 @@ struct xwl_format {
typedef void (*xwl_pixmap_cb) (PixmapPtr pixmap, void *data);
-struct xwl_egl_backend {
- /* Set by the backend if available */
- Bool is_available;
-
- /* Called once for each interface in the global registry. Backends
- * should use this to bind to any wayland interfaces they need.
- */
- Bool (*init_wl_registry)(struct xwl_screen *xwl_screen,
- struct wl_registry *wl_registry,
- uint32_t id, const char *name,
- uint32_t version);
-
- /* Check that the required Wayland interfaces are available.
- */
- Bool (*has_wl_interfaces)(struct xwl_screen *xwl_screen);
-
- /* Called before glamor has been initialized. Backends should setup a
- * valid, glamor compatible EGL context in this hook.
- */
- Bool (*init_egl)(struct xwl_screen *xwl_screen);
-
- /* Called after glamor has been initialized, and after all of the
- * common Xwayland DDX hooks have been connected. Backends should use
- * this to setup any required wraps around X server callbacks like
- * CreatePixmap.
- */
- Bool (*init_screen)(struct xwl_screen *xwl_screen);
-
- /* Called by Xwayland to retrieve a pointer to a valid wl_buffer for
- * the given window/pixmap combo so that damage to the pixmap may be
- * displayed on-screen. Backends should use this to create a new
- * wl_buffer for a currently buffer-less pixmap, or simply return the
- * pixmap they've prepared beforehand.
- */
- struct wl_buffer *(*get_wl_buffer_for_pixmap)(PixmapPtr pixmap,
- Bool *created);
-
- /* Called by Xwayland to perform any pre-wl_surface damage routines
- * that are required by the backend. If your backend is poorly
- * designed and lacks the ability to render directly to a surface,
- * you should implement blitting from the glamor pixmap to the wayland
- * pixmap here. Otherwise, this callback is optional.
- */
- void (*post_damage)(struct xwl_window *xwl_window,
- PixmapPtr pixmap, RegionPtr region);
-
- /* Called by Xwayland to confirm with the egl backend that the given
- * pixmap is completely setup and ready for display on-screen. This
- * callback is optional.
- */
- Bool (*allow_commits)(struct xwl_window *xwl_window);
-};
-
struct xwl_screen {
int width;
int height;
@@ -472,28 +420,6 @@ void xwl_pixmap_buffer_release_cb(void *data, struct wl_buffer *wl_buffer);
struct xwl_window *xwl_window_from_window(WindowPtr window);
#ifdef XWL_HAS_GLAMOR
-void xwl_glamor_init_backends(struct xwl_screen *xwl_screen,
- Bool use_eglstream);
-void xwl_glamor_select_backend(struct xwl_screen *xwl_screen,
- Bool use_eglstream);
-Bool xwl_glamor_init(struct xwl_screen *xwl_screen);
-
-Bool xwl_screen_set_drm_interface(struct xwl_screen *xwl_screen,
- uint32_t id, uint32_t version);
-Bool xwl_screen_set_dmabuf_interface(struct xwl_screen *xwl_screen,
- uint32_t id, uint32_t version);
-struct wl_buffer *xwl_glamor_pixmap_get_wl_buffer(PixmapPtr pixmap,
- Bool *created);
-void xwl_glamor_init_wl_registry(struct xwl_screen *xwl_screen,
- struct wl_registry *registry,
- uint32_t id, const char *interface,
- uint32_t version);
-Bool xwl_glamor_has_wl_interfaces(struct xwl_screen *xwl_screen,
- struct xwl_egl_backend *xwl_egl_backend);
-void xwl_glamor_post_damage(struct xwl_window *xwl_window,
- PixmapPtr pixmap, RegionPtr region);
-Bool xwl_glamor_allow_commits(struct xwl_window *xwl_window);
-void xwl_glamor_egl_make_current(struct xwl_screen *xwl_screen);
#ifdef GLAMOR_HAS_GBM
void xwl_present_frame_callback(struct xwl_present_window *xwl_present_window);
@@ -502,11 +428,6 @@ void xwl_present_cleanup(WindowPtr window);
void xwl_present_unrealize_window(WindowPtr window);
#endif /* GLAMOR_HAS_GBM */
-#ifdef XV
-/* glamor Xv Adaptor */
-Bool xwl_glamor_xv_init(ScreenPtr pScreen);
-#endif /* XV */
-
#endif /* XWL_HAS_GLAMOR */
void xwl_screen_release_tablet_manager(struct xwl_screen *xwl_screen);
@@ -517,22 +438,6 @@ void xwl_screen_init_xdg_output(struct xwl_screen *xwl_screen);
void xwlVidModeExtensionInit(void);
#endif
-#ifdef GLAMOR_HAS_GBM
-void xwl_glamor_init_gbm(struct xwl_screen *xwl_screen);
-#else
-static inline void xwl_glamor_init_gbm(struct xwl_screen *xwl_screen)
-{
-}
-#endif
-
-#ifdef XWL_HAS_EGLSTREAM
-void xwl_glamor_init_eglstream(struct xwl_screen *xwl_screen);
-#else
-static inline void xwl_glamor_init_eglstream(struct xwl_screen *xwl_screen)
-{
-}
-#endif
-
#ifdef GLXEXT
#include "glx_extinit.h"
extern __GLXprovider glamor_provider;
commit 177c8a230232d114cdbe1650bd22a396d182f5f8
Author: Olivier Fourdan <ofourdan at redhat.com>
Date: Mon Dec 16 17:07:02 2019 +0100
xwayland: Move SHM declarations to their own header
Currently, `xwayland.h` contains all the declarations, which is a bit
awkward and hard to follow.
Move the SHM relevant declarations to their own header file.
Signed-off-by: Olivier Fourdan <ofourdan at redhat.com>
Reviewed-by: Michel Dänzer <mdaenzer at redhat.com>
diff --git a/hw/xwayland/Makefile.am b/hw/xwayland/Makefile.am
index 0a6b3ee87..c3a159e7a 100644
--- a/hw/xwayland/Makefile.am
+++ b/hw/xwayland/Makefile.am
@@ -14,6 +14,7 @@ Xwayland_SOURCES = \
xwayland-input.c \
xwayland-cursor.c \
xwayland-shm.c \
+ xwayland-shm.h \
xwayland-types.h \
xwayland-output.c \
xwayland-cvt.c \
diff --git a/hw/xwayland/meson.build b/hw/xwayland/meson.build
index 4f9ff434a..61337b0e1 100644
--- a/hw/xwayland/meson.build
+++ b/hw/xwayland/meson.build
@@ -3,6 +3,7 @@ srcs = [
'xwayland-input.c',
'xwayland-cursor.c',
'xwayland-shm.c',
+ 'xwayland-shm.h',
'xwayland-types.h',
'xwayland-output.c',
'xwayland-cvt.c',
diff --git a/hw/xwayland/xwayland-cursor.c b/hw/xwayland/xwayland-cursor.c
index 6c73553bd..cba8e20cd 100644
--- a/hw/xwayland/xwayland-cursor.c
+++ b/hw/xwayland/xwayland-cursor.c
@@ -24,9 +24,19 @@
* SOFTWARE.
*/
+#include <xwayland-config.h>
+
+#include "scrnintstr.h"
+#include "servermd.h"
+#include "cursorstr.h"
+#include "inputstr.h"
+#include "mipointer.h"
+
#include "xwayland.h"
+#include "xwayland-shm.h"
+#include "xwayland-types.h"
-#include <mipointer.h>
+#include "tablet-unstable-v2-client-protocol.h"
static DevPrivateKeyRec xwl_cursor_private_key;
diff --git a/hw/xwayland/xwayland-shm.c b/hw/xwayland/xwayland-shm.c
index b76ab1a8f..586874b90 100644
--- a/hw/xwayland/xwayland-shm.c
+++ b/hw/xwayland/xwayland-shm.c
@@ -24,13 +24,7 @@
* SOFTWARE.
*/
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include "os.h"
-
-#include "xwayland.h"
+#include <xwayland-config.h>
#include <sys/mman.h>
#include <sys/types.h>
@@ -40,6 +34,13 @@
#include <string.h>
#include <stdlib.h>
+#include "fb.h"
+#include "os.h"
+#include "pixmapstr.h"
+
+#include "xwayland.h"
+#include "xwayland-shm.h"
+
struct xwl_pixmap {
struct wl_buffer *buffer;
void *data;
diff --git a/hw/xwayland/xwayland-shm.h b/hw/xwayland/xwayland-shm.h
new file mode 100644
index 000000000..3c94000b6
--- /dev/null
+++ b/hw/xwayland/xwayland-shm.h
@@ -0,0 +1,41 @@
+/*
+ * Copyright © 2014 Intel Corporation
+ * Copyright © 2012 Collabora, Ltd.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software
+ * and its documentation for any purpose is hereby granted without
+ * fee, provided that the above copyright notice appear in all copies
+ * and that both that copyright notice and this permission notice
+ * appear in supporting documentation, and that the name of the
+ * copyright holders not be used in advertising or publicity
+ * pertaining to distribution of the software without specific,
+ * written prior permission. The copyright holders make no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied
+ * warranty.
+ *
+ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
+ * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
+ * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
+ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
+ */
+
+#ifndef XWAYLAND_SHM_H
+#define XWAYLAND_SHM_H
+
+#include <xwayland-config.h>
+
+#include "scrnintstr.h"
+#include "pixmapstr.h"
+
+Bool xwl_shm_create_screen_resources(ScreenPtr screen);
+PixmapPtr xwl_shm_create_pixmap(ScreenPtr screen, int width, int height,
+ int depth, unsigned int hint);
+Bool xwl_shm_destroy_pixmap(PixmapPtr pixmap);
+struct wl_buffer *xwl_shm_pixmap_get_wl_buffer(PixmapPtr pixmap);
+
+#endif /* XWAYLAND_SHM_H */
diff --git a/hw/xwayland/xwayland.c b/hw/xwayland/xwayland.c
index 20bc808fb..726be02de 100644
--- a/hw/xwayland/xwayland.c
+++ b/hw/xwayland/xwayland.c
@@ -23,9 +23,6 @@
* SOFTWARE.
*/
-#include "xwayland.h"
-#include "xwayland-window-buffers.h"
-
#include <stdio.h>
#include <X11/Xatom.h>
@@ -39,6 +36,10 @@
#include <xserver_poll.h>
#include <propertyst.h>
+#include "xwayland.h"
+#include "xwayland-shm.h"
+#include "xwayland-window-buffers.h"
+
#ifdef XF86VIDMODE
#include <X11/extensions/xf86vmproto.h>
_X_EXPORT Bool noXFree86VidModeExtension;
diff --git a/hw/xwayland/xwayland.h b/hw/xwayland/xwayland.h
index 27359636e..f4cdc5be0 100644
--- a/hw/xwayland/xwayland.h
+++ b/hw/xwayland/xwayland.h
@@ -471,12 +471,6 @@ void xwl_pixmap_buffer_release_cb(void *data, struct wl_buffer *wl_buffer);
struct xwl_window *xwl_window_from_window(WindowPtr window);
-Bool xwl_shm_create_screen_resources(ScreenPtr screen);
-PixmapPtr xwl_shm_create_pixmap(ScreenPtr screen, int width, int height,
- int depth, unsigned int hint);
-Bool xwl_shm_destroy_pixmap(PixmapPtr pixmap);
-struct wl_buffer *xwl_shm_pixmap_get_wl_buffer(PixmapPtr pixmap);
-
#ifdef XWL_HAS_GLAMOR
void xwl_glamor_init_backends(struct xwl_screen *xwl_screen,
Bool use_eglstream);
commit c20e61fddc8c2b8838533f23f54c1c5acea3e05f
Author: Olivier Fourdan <ofourdan at redhat.com>
Date: Tue Dec 17 08:48:51 2019 +0100
xwayland: Move Xwayland structures to their own header
Currently, `xwayland.h` contains all the declarations, which is a bit
awkward and hard to follow.
Move the Xwayland structures declarations to their own header file.
Signed-off-by: Olivier Fourdan <ofourdan at redhat.com>
Reviewed-by: Michel Dänzer <mdaenzer at redhat.com>
diff --git a/hw/xwayland/Makefile.am b/hw/xwayland/Makefile.am
index 042906074..0a6b3ee87 100644
--- a/hw/xwayland/Makefile.am
+++ b/hw/xwayland/Makefile.am
@@ -14,6 +14,7 @@ Xwayland_SOURCES = \
xwayland-input.c \
xwayland-cursor.c \
xwayland-shm.c \
+ xwayland-types.h \
xwayland-output.c \
xwayland-cvt.c \
xwayland-vidmode.c \
diff --git a/hw/xwayland/meson.build b/hw/xwayland/meson.build
index 6b76c494e..4f9ff434a 100644
--- a/hw/xwayland/meson.build
+++ b/hw/xwayland/meson.build
@@ -3,6 +3,7 @@ srcs = [
'xwayland-input.c',
'xwayland-cursor.c',
'xwayland-shm.c',
+ 'xwayland-types.h',
'xwayland-output.c',
'xwayland-cvt.c',
'xwayland-vidmode.c',
diff --git a/hw/xwayland/xwayland-types.h b/hw/xwayland/xwayland-types.h
new file mode 100644
index 000000000..da80ff98e
--- /dev/null
+++ b/hw/xwayland/xwayland-types.h
@@ -0,0 +1,34 @@
+/*
+ * Copyright © 2014 Intel Corporation
+ *
+ * Permission to use, copy, modify, distribute, and sell this software
+ * and its documentation for any purpose is hereby granted without
+ * fee, provided that the above copyright notice appear in all copies
+ * and that both that copyright notice and this permission notice
+ * appear in supporting documentation, and that the name of the
+ * copyright holders not be used in advertising or publicity
+ * pertaining to distribution of the software without specific,
+ * written prior permission. The copyright holders make no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied
+ * warranty.
+ *
+ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
+ * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
+ * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
+ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
+ */
+
+#ifndef XWAYLAND_TYPES_H
+#define XWAYLAND_TYPES_H
+
+struct xwl_pixmap;
+struct xwl_window;
+struct xwl_screen;
+struct xwl_egl_backend;
+
+#endif /* XWAYLAND_TYPES_H */
diff --git a/hw/xwayland/xwayland.h b/hw/xwayland/xwayland.h
index acf66f889..27359636e 100644
--- a/hw/xwayland/xwayland.h
+++ b/hw/xwayland/xwayland.h
@@ -50,16 +50,14 @@
#include "linux-dmabuf-unstable-v1-client-protocol.h"
#include "viewporter-client-protocol.h"
+#include "xwayland-types.h"
+
struct xwl_format {
uint32_t format;
int num_modifiers;
uint64_t *modifiers;
};
-struct xwl_pixmap;
-struct xwl_window;
-struct xwl_screen;
-
typedef void (*xwl_pixmap_cb) (PixmapPtr pixmap, void *data);
struct xwl_egl_backend {
More information about the xorg-commit
mailing list