|
|
0b0bd3 |
From 31360bf6bcdc388c8546fefd495163a30b0918e5 Mon Sep 17 00:00:00 2001
|
|
|
0b0bd3 |
From: Adam Jackson <ajax@redhat.com>
|
|
|
0b0bd3 |
Date: Tue, 19 Aug 2014 14:22:30 -0400
|
|
|
0b0bd3 |
Subject: [PATCH] ephyr: Properly implement hardware cursors
|
|
|
0b0bd3 |
|
|
|
0b0bd3 |
Technique is basically the same as in Xnest, just create a new cursor on
|
|
|
0b0bd3 |
the host server every time. Could be optimized to remember cursors on
|
|
|
0b0bd3 |
the host and merely switch among them, if someone's feeling adventurous.
|
|
|
0b0bd3 |
|
|
|
0b0bd3 |
Signed-off-by: Adam Jackson <ajax@redhat.com>
|
|
|
0b0bd3 |
---
|
|
|
0b0bd3 |
configure.ac | 2 +-
|
|
|
0b0bd3 |
hw/kdrive/ephyr/Makefile.am | 1 +
|
|
|
0b0bd3 |
hw/kdrive/ephyr/ephyrcursor.c | 216 ++++++++++++++++++++++++++++++++++++++++++
|
|
|
0b0bd3 |
hw/kdrive/ephyr/ephyrinit.c | 63 ------------
|
|
|
0b0bd3 |
hw/kdrive/ephyr/hostx.c | 74 +++++++++++++++
|
|
|
0b0bd3 |
hw/kdrive/ephyr/hostx.h | 5 +
|
|
|
0b0bd3 |
6 files changed, 297 insertions(+), 64 deletions(-)
|
|
|
0b0bd3 |
create mode 100644 hw/kdrive/ephyr/ephyrcursor.c
|
|
|
0b0bd3 |
|
|
|
0b0bd3 |
diff --git a/configure.ac b/configure.ac
|
|
|
0b0bd3 |
index f3d9654..e83949d 100644
|
|
|
0b0bd3 |
--- a/configure.ac
|
|
|
0b0bd3 |
+++ b/configure.ac
|
|
|
0b0bd3 |
@@ -2364,7 +2364,7 @@ if test "$KDRIVE" = yes; then
|
|
|
0b0bd3 |
AC_DEFINE(KDRIVE_MOUSE, 1, [Enable KDrive mouse driver])
|
|
|
0b0bd3 |
fi
|
|
|
0b0bd3 |
|
|
|
0b0bd3 |
- XEPHYR_REQUIRED_LIBS="xau xdmcp xcb xcb-shape xcb-aux xcb-image xcb-icccm xcb-shm xcb-keysyms"
|
|
|
0b0bd3 |
+ XEPHYR_REQUIRED_LIBS="xau xdmcp xcb xcb-shape xcb-render xcb-aux xcb-image xcb-icccm xcb-shm xcb-keysyms"
|
|
|
0b0bd3 |
if test "x$XV" = xyes; then
|
|
|
0b0bd3 |
XEPHYR_REQUIRED_LIBS="$XEPHYR_REQUIRED_LIBS xcb-xv"
|
|
|
0b0bd3 |
fi
|
|
|
0b0bd3 |
diff --git a/hw/kdrive/ephyr/Makefile.am b/hw/kdrive/ephyr/Makefile.am
|
|
|
0b0bd3 |
index 10c5917..155e11e 100644
|
|
|
0b0bd3 |
--- a/hw/kdrive/ephyr/Makefile.am
|
|
|
0b0bd3 |
+++ b/hw/kdrive/ephyr/Makefile.am
|
|
|
0b0bd3 |
@@ -68,6 +68,7 @@ Xephyr_SOURCES = \
|
|
|
0b0bd3 |
ephyr_draw.c \
|
|
|
0b0bd3 |
os.c \
|
|
|
0b0bd3 |
ephyrinit.c \
|
|
|
0b0bd3 |
+ ephyrcursor.c \
|
|
|
0b0bd3 |
hostx.c \
|
|
|
0b0bd3 |
hostx.h \
|
|
|
0b0bd3 |
$(XV_SRCS) \
|
|
|
0b0bd3 |
diff --git a/hw/kdrive/ephyr/ephyrcursor.c b/hw/kdrive/ephyr/ephyrcursor.c
|
|
|
0b0bd3 |
new file mode 100644
|
|
|
0b0bd3 |
index 0000000..b19e301
|
|
|
0b0bd3 |
--- /dev/null
|
|
|
0b0bd3 |
+++ b/hw/kdrive/ephyr/ephyrcursor.c
|
|
|
0b0bd3 |
@@ -0,0 +1,216 @@
|
|
|
0b0bd3 |
+/*
|
|
|
0b0bd3 |
+ * Copyright © 2014 Red Hat, Inc.
|
|
|
0b0bd3 |
+ *
|
|
|
0b0bd3 |
+ * Permission is hereby granted, free of charge, to any person obtaining a
|
|
|
0b0bd3 |
+ * copy of this software and associated documentation files (the "Software"),
|
|
|
0b0bd3 |
+ * to deal in the Software without restriction, including without limitation
|
|
|
0b0bd3 |
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
|
0b0bd3 |
+ * and/or sell copies of the Software, and to permit persons to whom the
|
|
|
0b0bd3 |
+ * Software is furnished to do so, subject to the following conditions:
|
|
|
0b0bd3 |
+ *
|
|
|
0b0bd3 |
+ * The above copyright notice and this permission notice (including the next
|
|
|
0b0bd3 |
+ * paragraph) shall be included in all copies or substantial portions of the
|
|
|
0b0bd3 |
+ * Software.
|
|
|
0b0bd3 |
+ *
|
|
|
0b0bd3 |
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
0b0bd3 |
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
0b0bd3 |
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
|
0b0bd3 |
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
0b0bd3 |
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
|
0b0bd3 |
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
|
|
0b0bd3 |
+ * DEALINGS IN THE SOFTWARE.
|
|
|
0b0bd3 |
+ *
|
|
|
0b0bd3 |
+ * Author:
|
|
|
0b0bd3 |
+ * Adam Jackson <ajax@redhat.com>
|
|
|
0b0bd3 |
+ */
|
|
|
0b0bd3 |
+
|
|
|
0b0bd3 |
+#ifdef HAVE_CONFIG_H
|
|
|
0b0bd3 |
+#include <kdrive-config.h>
|
|
|
0b0bd3 |
+#endif
|
|
|
0b0bd3 |
+#include "ephyr.h"
|
|
|
0b0bd3 |
+#include "ephyrlog.h"
|
|
|
0b0bd3 |
+#include "hostx.h"
|
|
|
0b0bd3 |
+#include "cursorstr.h"
|
|
|
0b0bd3 |
+#include <xcb/render.h>
|
|
|
0b0bd3 |
+
|
|
|
0b0bd3 |
+static DevPrivateKeyRec ephyrCursorPrivateKey;
|
|
|
0b0bd3 |
+
|
|
|
0b0bd3 |
+typedef struct _ephyrCursor {
|
|
|
0b0bd3 |
+ xcb_cursor_t cursor;
|
|
|
0b0bd3 |
+} ephyrCursorRec, *ephyrCursorPtr;
|
|
|
0b0bd3 |
+
|
|
|
0b0bd3 |
+static ephyrCursorPtr
|
|
|
0b0bd3 |
+ephyrGetCursor(CursorPtr cursor)
|
|
|
0b0bd3 |
+{
|
|
|
0b0bd3 |
+ return dixGetPrivateAddr(&cursor->devPrivates, &ephyrCursorPrivateKey);
|
|
|
0b0bd3 |
+}
|
|
|
0b0bd3 |
+
|
|
|
0b0bd3 |
+static void
|
|
|
0b0bd3 |
+ephyrRealizeCoreCursor(EphyrScrPriv *scr, CursorPtr cursor)
|
|
|
0b0bd3 |
+{
|
|
|
0b0bd3 |
+ ephyrCursorPtr hw = ephyrGetCursor(cursor);
|
|
|
0b0bd3 |
+ xcb_connection_t *conn = hostx_get_xcbconn();
|
|
|
0b0bd3 |
+ xcb_pixmap_t source, mask;
|
|
|
0b0bd3 |
+ xcb_image_t *image;
|
|
|
0b0bd3 |
+ xcb_gcontext_t gc = hostx_get_cursor_gc();
|
|
|
0b0bd3 |
+ int w = cursor->bits->width, h = cursor->bits->height;
|
|
|
0b0bd3 |
+
|
|
|
0b0bd3 |
+ source = xcb_generate_id(conn);
|
|
|
0b0bd3 |
+ mask = xcb_generate_id(conn);
|
|
|
0b0bd3 |
+ xcb_create_pixmap(conn, 1, source, scr->win, w, h);
|
|
|
0b0bd3 |
+ xcb_create_pixmap(conn, 1, mask, scr->win, w, h);
|
|
|
0b0bd3 |
+
|
|
|
0b0bd3 |
+ image = xcb_image_create_native(conn, w, h, XCB_IMAGE_FORMAT_XY_BITMAP,
|
|
|
0b0bd3 |
+ 1, NULL, ~0, NULL);
|
|
|
0b0bd3 |
+ image->data = cursor->bits->source;
|
|
|
0b0bd3 |
+ xcb_image_put(conn, source, gc, image, 0, 0, 0);
|
|
|
0b0bd3 |
+ xcb_image_destroy(image);
|
|
|
0b0bd3 |
+
|
|
|
0b0bd3 |
+ image = xcb_image_create_native(conn, w, h, XCB_IMAGE_FORMAT_XY_BITMAP,
|
|
|
0b0bd3 |
+ 1, NULL, ~0, NULL);
|
|
|
0b0bd3 |
+ image->data = cursor->bits->mask;
|
|
|
0b0bd3 |
+ xcb_image_put(conn, mask, gc, image, 0, 0, 0);
|
|
|
0b0bd3 |
+ xcb_image_destroy(image);
|
|
|
0b0bd3 |
+
|
|
|
0b0bd3 |
+ hw->cursor = xcb_generate_id(conn);
|
|
|
0b0bd3 |
+ xcb_create_cursor(conn, hw->cursor, source, mask,
|
|
|
0b0bd3 |
+ cursor->foreRed, cursor->foreGreen, cursor->foreBlue,
|
|
|
0b0bd3 |
+ cursor->backRed, cursor->backGreen, cursor->backBlue,
|
|
|
0b0bd3 |
+ cursor->bits->xhot, cursor->bits->yhot);
|
|
|
0b0bd3 |
+
|
|
|
0b0bd3 |
+ xcb_free_pixmap(conn, source);
|
|
|
0b0bd3 |
+ xcb_free_pixmap(conn, mask);
|
|
|
0b0bd3 |
+}
|
|
|
0b0bd3 |
+
|
|
|
0b0bd3 |
+#ifdef ARGB_CURSOR
|
|
|
0b0bd3 |
+static void
|
|
|
0b0bd3 |
+ephyrRealizeARGBCursor(EphyrScrPriv *scr, CursorPtr cursor)
|
|
|
0b0bd3 |
+{
|
|
|
0b0bd3 |
+ ephyrCursorPtr hw = ephyrGetCursor(cursor);
|
|
|
0b0bd3 |
+ xcb_connection_t *conn = hostx_get_xcbconn();
|
|
|
0b0bd3 |
+ xcb_gcontext_t gc;
|
|
|
0b0bd3 |
+ xcb_pixmap_t source;
|
|
|
0b0bd3 |
+ xcb_render_picture_t picture;
|
|
|
0b0bd3 |
+ xcb_image_t *image;
|
|
|
0b0bd3 |
+ int w = cursor->bits->width, h = cursor->bits->height;
|
|
|
0b0bd3 |
+
|
|
|
0b0bd3 |
+ /* dix' storage is PICT_a8r8g8b8 */
|
|
|
0b0bd3 |
+ source = xcb_generate_id(conn);
|
|
|
0b0bd3 |
+ xcb_create_pixmap(conn, 32, source, scr->win, w, h);
|
|
|
0b0bd3 |
+
|
|
|
0b0bd3 |
+ gc = xcb_generate_id(conn);
|
|
|
0b0bd3 |
+ xcb_create_gc(conn, gc, source, 0, NULL);
|
|
|
0b0bd3 |
+ image = xcb_image_create_native(conn, w, h, XCB_IMAGE_FORMAT_Z_PIXMAP,
|
|
|
0b0bd3 |
+ 32, NULL, ~0, NULL);
|
|
|
0b0bd3 |
+ image->data = (void *)cursor->bits->argb;
|
|
|
0b0bd3 |
+ xcb_image_put(conn, source, gc, image, 0, 0, 0);
|
|
|
0b0bd3 |
+ xcb_free_gc(conn, gc);
|
|
|
0b0bd3 |
+ xcb_image_destroy(image);
|
|
|
0b0bd3 |
+
|
|
|
0b0bd3 |
+ picture = xcb_generate_id(conn);
|
|
|
0b0bd3 |
+ xcb_render_create_picture(conn, picture, source, hostx_get_argb_format(),
|
|
|
0b0bd3 |
+ 0, NULL);
|
|
|
0b0bd3 |
+ xcb_free_pixmap(conn, source);
|
|
|
0b0bd3 |
+
|
|
|
0b0bd3 |
+ hw->cursor = xcb_generate_id(conn);
|
|
|
0b0bd3 |
+ xcb_render_create_cursor(conn, hw->cursor, picture,
|
|
|
0b0bd3 |
+ cursor->bits->xhot, cursor->bits->yhot);
|
|
|
0b0bd3 |
+
|
|
|
0b0bd3 |
+ xcb_render_free_picture(conn, picture);
|
|
|
0b0bd3 |
+}
|
|
|
0b0bd3 |
+#endif
|
|
|
0b0bd3 |
+
|
|
|
0b0bd3 |
+static Bool
|
|
|
0b0bd3 |
+ephyrRealizeCursor(DeviceIntPtr dev, ScreenPtr screen, CursorPtr cursor)
|
|
|
0b0bd3 |
+{
|
|
|
0b0bd3 |
+ KdScreenPriv(screen);
|
|
|
0b0bd3 |
+ KdScreenInfo *kscr = pScreenPriv->screen;
|
|
|
0b0bd3 |
+ EphyrScrPriv *scr = kscr->driver;
|
|
|
0b0bd3 |
+
|
|
|
0b0bd3 |
+#ifdef ARGB_CURSOR
|
|
|
0b0bd3 |
+ if (cursor->bits->argb)
|
|
|
0b0bd3 |
+ ephyrRealizeARGBCursor(scr, cursor);
|
|
|
0b0bd3 |
+ else
|
|
|
0b0bd3 |
+#endif
|
|
|
0b0bd3 |
+ {
|
|
|
0b0bd3 |
+ ephyrRealizeCoreCursor(scr, cursor);
|
|
|
0b0bd3 |
+ }
|
|
|
0b0bd3 |
+ return TRUE;
|
|
|
0b0bd3 |
+}
|
|
|
0b0bd3 |
+
|
|
|
0b0bd3 |
+static Bool
|
|
|
0b0bd3 |
+ephyrUnrealizeCursor(DeviceIntPtr dev, ScreenPtr screen, CursorPtr cursor)
|
|
|
0b0bd3 |
+{
|
|
|
0b0bd3 |
+ ephyrCursorPtr hw = ephyrGetCursor(cursor);
|
|
|
0b0bd3 |
+
|
|
|
0b0bd3 |
+ if (hw->cursor) {
|
|
|
0b0bd3 |
+ xcb_free_cursor(hostx_get_xcbconn(), hw->cursor);
|
|
|
0b0bd3 |
+ hw->cursor = None;
|
|
|
0b0bd3 |
+ }
|
|
|
0b0bd3 |
+
|
|
|
0b0bd3 |
+ return TRUE;
|
|
|
0b0bd3 |
+}
|
|
|
0b0bd3 |
+
|
|
|
0b0bd3 |
+static void
|
|
|
0b0bd3 |
+ephyrSetCursor(DeviceIntPtr dev, ScreenPtr screen, CursorPtr cursor, int x,
|
|
|
0b0bd3 |
+ int y)
|
|
|
0b0bd3 |
+{
|
|
|
0b0bd3 |
+ KdScreenPriv(screen);
|
|
|
0b0bd3 |
+ KdScreenInfo *kscr = pScreenPriv->screen;
|
|
|
0b0bd3 |
+ EphyrScrPriv *scr = kscr->driver;
|
|
|
0b0bd3 |
+ uint32_t attr = None;
|
|
|
0b0bd3 |
+
|
|
|
0b0bd3 |
+ /* XXX really? */
|
|
|
0b0bd3 |
+ if (cursor)
|
|
|
0b0bd3 |
+ attr = ephyrGetCursor(cursor)->cursor;
|
|
|
0b0bd3 |
+
|
|
|
0b0bd3 |
+ xcb_change_window_attributes(hostx_get_xcbconn(), scr->win,
|
|
|
0b0bd3 |
+ XCB_CW_CURSOR, &attr);
|
|
|
0b0bd3 |
+ xcb_flush(hostx_get_xcbconn());
|
|
|
0b0bd3 |
+}
|
|
|
0b0bd3 |
+
|
|
|
0b0bd3 |
+static void
|
|
|
0b0bd3 |
+ephyrMoveCursor(DeviceIntPtr dev, ScreenPtr screen, int x, int y)
|
|
|
0b0bd3 |
+{
|
|
|
0b0bd3 |
+ ;
|
|
|
0b0bd3 |
+}
|
|
|
0b0bd3 |
+
|
|
|
0b0bd3 |
+static Bool
|
|
|
0b0bd3 |
+ephyrDeviceCursorInitialize(DeviceIntPtr dev, ScreenPtr screen)
|
|
|
0b0bd3 |
+{
|
|
|
0b0bd3 |
+ return TRUE;
|
|
|
0b0bd3 |
+}
|
|
|
0b0bd3 |
+
|
|
|
0b0bd3 |
+static void
|
|
|
0b0bd3 |
+ephyrDeviceCursorCleanup(DeviceIntPtr dev, ScreenPtr screen)
|
|
|
0b0bd3 |
+{
|
|
|
0b0bd3 |
+}
|
|
|
0b0bd3 |
+
|
|
|
0b0bd3 |
+miPointerSpriteFuncRec EphyrPointerSpriteFuncs = {
|
|
|
0b0bd3 |
+ ephyrRealizeCursor,
|
|
|
0b0bd3 |
+ ephyrUnrealizeCursor,
|
|
|
0b0bd3 |
+ ephyrSetCursor,
|
|
|
0b0bd3 |
+ ephyrMoveCursor,
|
|
|
0b0bd3 |
+ ephyrDeviceCursorInitialize,
|
|
|
0b0bd3 |
+ ephyrDeviceCursorCleanup
|
|
|
0b0bd3 |
+};
|
|
|
0b0bd3 |
+
|
|
|
0b0bd3 |
+Bool
|
|
|
0b0bd3 |
+ephyrCursorInit(ScreenPtr screen)
|
|
|
0b0bd3 |
+{
|
|
|
0b0bd3 |
+ if (!dixRegisterPrivateKey(&ephyrCursorPrivateKey, PRIVATE_CURSOR_BITS,
|
|
|
0b0bd3 |
+ sizeof(ephyrCursorRec)))
|
|
|
0b0bd3 |
+ return FALSE;
|
|
|
0b0bd3 |
+
|
|
|
0b0bd3 |
+ miPointerInitialize(screen,
|
|
|
0b0bd3 |
+ &EphyrPointerSpriteFuncs,
|
|
|
0b0bd3 |
+ &ephyrPointerScreenFuncs, FALSE);
|
|
|
0b0bd3 |
+
|
|
|
0b0bd3 |
+ return TRUE;
|
|
|
0b0bd3 |
+}
|
|
|
0b0bd3 |
+
|
|
|
0b0bd3 |
+void
|
|
|
0b0bd3 |
+ephyrCursorEnable(ScreenPtr screen)
|
|
|
0b0bd3 |
+{
|
|
|
0b0bd3 |
+}
|
|
|
0b0bd3 |
+
|
|
|
0b0bd3 |
diff --git a/hw/kdrive/ephyr/ephyrinit.c b/hw/kdrive/ephyr/ephyrinit.c
|
|
|
0b0bd3 |
index fc00010..e823eb8 100644
|
|
|
0b0bd3 |
--- a/hw/kdrive/ephyr/ephyrinit.c
|
|
|
0b0bd3 |
+++ b/hw/kdrive/ephyr/ephyrinit.c
|
|
|
0b0bd3 |
@@ -350,69 +350,6 @@ OsVendorInit(void)
|
|
|
0b0bd3 |
KdOsInit(&EphyrOsFuncs);
|
|
|
0b0bd3 |
}
|
|
|
0b0bd3 |
|
|
|
0b0bd3 |
-/* 'Fake' cursor stuff, could be improved */
|
|
|
0b0bd3 |
-
|
|
|
0b0bd3 |
-static Bool
|
|
|
0b0bd3 |
-ephyrRealizeCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor)
|
|
|
0b0bd3 |
-{
|
|
|
0b0bd3 |
- return TRUE;
|
|
|
0b0bd3 |
-}
|
|
|
0b0bd3 |
-
|
|
|
0b0bd3 |
-static Bool
|
|
|
0b0bd3 |
-ephyrUnrealizeCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor)
|
|
|
0b0bd3 |
-{
|
|
|
0b0bd3 |
- return TRUE;
|
|
|
0b0bd3 |
-}
|
|
|
0b0bd3 |
-
|
|
|
0b0bd3 |
-static void
|
|
|
0b0bd3 |
-ephyrSetCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor, int x,
|
|
|
0b0bd3 |
- int y)
|
|
|
0b0bd3 |
-{
|
|
|
0b0bd3 |
- ;
|
|
|
0b0bd3 |
-}
|
|
|
0b0bd3 |
-
|
|
|
0b0bd3 |
-static void
|
|
|
0b0bd3 |
-ephyrMoveCursor(DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y)
|
|
|
0b0bd3 |
-{
|
|
|
0b0bd3 |
- ;
|
|
|
0b0bd3 |
-}
|
|
|
0b0bd3 |
-
|
|
|
0b0bd3 |
-static Bool
|
|
|
0b0bd3 |
-ephyrDeviceCursorInitialize(DeviceIntPtr pDev, ScreenPtr pScreen)
|
|
|
0b0bd3 |
-{
|
|
|
0b0bd3 |
- return TRUE;
|
|
|
0b0bd3 |
-}
|
|
|
0b0bd3 |
-
|
|
|
0b0bd3 |
-static void
|
|
|
0b0bd3 |
-ephyrDeviceCursorCleanup(DeviceIntPtr pDev, ScreenPtr pScreen)
|
|
|
0b0bd3 |
-{
|
|
|
0b0bd3 |
-}
|
|
|
0b0bd3 |
-
|
|
|
0b0bd3 |
-miPointerSpriteFuncRec EphyrPointerSpriteFuncs = {
|
|
|
0b0bd3 |
- ephyrRealizeCursor,
|
|
|
0b0bd3 |
- ephyrUnrealizeCursor,
|
|
|
0b0bd3 |
- ephyrSetCursor,
|
|
|
0b0bd3 |
- ephyrMoveCursor,
|
|
|
0b0bd3 |
- ephyrDeviceCursorInitialize,
|
|
|
0b0bd3 |
- ephyrDeviceCursorCleanup
|
|
|
0b0bd3 |
-};
|
|
|
0b0bd3 |
-
|
|
|
0b0bd3 |
-Bool
|
|
|
0b0bd3 |
-ephyrCursorInit(ScreenPtr pScreen)
|
|
|
0b0bd3 |
-{
|
|
|
0b0bd3 |
- miPointerInitialize(pScreen,
|
|
|
0b0bd3 |
- &EphyrPointerSpriteFuncs,
|
|
|
0b0bd3 |
- &ephyrPointerScreenFuncs, FALSE);
|
|
|
0b0bd3 |
-
|
|
|
0b0bd3 |
- return TRUE;
|
|
|
0b0bd3 |
-}
|
|
|
0b0bd3 |
-
|
|
|
0b0bd3 |
-void
|
|
|
0b0bd3 |
-ephyrCursorEnable(ScreenPtr pScreen)
|
|
|
0b0bd3 |
-{
|
|
|
0b0bd3 |
- ;
|
|
|
0b0bd3 |
-}
|
|
|
0b0bd3 |
-
|
|
|
0b0bd3 |
KdCardFuncs ephyrFuncs = {
|
|
|
0b0bd3 |
ephyrCardInit, /* cardinit */
|
|
|
0b0bd3 |
ephyrScreenInitialize, /* scrinit */
|
|
|
0b0bd3 |
diff --git a/hw/kdrive/ephyr/hostx.c b/hw/kdrive/ephyr/hostx.c
|
|
|
0b0bd3 |
index 1c75974..f995fc0 100644
|
|
|
0b0bd3 |
--- a/hw/kdrive/ephyr/hostx.c
|
|
|
0b0bd3 |
+++ b/hw/kdrive/ephyr/hostx.c
|
|
|
0b0bd3 |
@@ -70,6 +70,8 @@ struct EphyrHostXVars {
|
|
|
0b0bd3 |
xcb_visualtype_t *visual;
|
|
|
0b0bd3 |
Window winroot;
|
|
|
0b0bd3 |
xcb_gcontext_t gc;
|
|
|
0b0bd3 |
+ xcb_gcontext_t curgc;
|
|
|
0b0bd3 |
+ xcb_render_pictformat_t argb_format;
|
|
|
0b0bd3 |
int depth;
|
|
|
0b0bd3 |
Bool use_sw_cursor;
|
|
|
0b0bd3 |
Bool use_fullscreen;
|
|
|
0b0bd3 |
@@ -1157,6 +1159,78 @@ out:
|
|
|
0b0bd3 |
return is_ok;
|
|
|
0b0bd3 |
}
|
|
|
0b0bd3 |
|
|
|
0b0bd3 |
+xcb_gcontext_t
|
|
|
0b0bd3 |
+hostx_get_cursor_gc(void)
|
|
|
0b0bd3 |
+{
|
|
|
0b0bd3 |
+ uint32_t mask = XCB_GC_FUNCTION |
|
|
|
0b0bd3 |
+ XCB_GC_PLANE_MASK |
|
|
|
0b0bd3 |
+ XCB_GC_FOREGROUND |
|
|
|
0b0bd3 |
+ XCB_GC_BACKGROUND |
|
|
|
0b0bd3 |
+ XCB_GC_CLIP_MASK;
|
|
|
0b0bd3 |
+ uint32_t val[] = {
|
|
|
0b0bd3 |
+ XCB_GX_COPY, /* function */
|
|
|
0b0bd3 |
+ ~0, /* planemask */
|
|
|
0b0bd3 |
+ 1L, /* foreground */
|
|
|
0b0bd3 |
+ 0L, /* background */
|
|
|
0b0bd3 |
+ None, /* clipmask */
|
|
|
0b0bd3 |
+ };
|
|
|
0b0bd3 |
+
|
|
|
0b0bd3 |
+ if (HostX.curgc == None) {
|
|
|
0b0bd3 |
+ xcb_pixmap_t p = xcb_generate_id(HostX.conn);
|
|
|
0b0bd3 |
+ HostX.curgc = xcb_generate_id(HostX.conn);
|
|
|
0b0bd3 |
+
|
|
|
0b0bd3 |
+ xcb_create_pixmap(HostX.conn, 1, p, HostX.winroot /* XXX */,
|
|
|
0b0bd3 |
+ 1, 1);
|
|
|
0b0bd3 |
+ xcb_create_gc(HostX.conn, HostX.curgc, p, mask, val);
|
|
|
0b0bd3 |
+ xcb_free_pixmap(HostX.conn, p);
|
|
|
0b0bd3 |
+ }
|
|
|
0b0bd3 |
+
|
|
|
0b0bd3 |
+ return HostX.curgc;
|
|
|
0b0bd3 |
+}
|
|
|
0b0bd3 |
+
|
|
|
0b0bd3 |
+xcb_render_pictformat_t
|
|
|
0b0bd3 |
+hostx_get_argb_format(void)
|
|
|
0b0bd3 |
+{
|
|
|
0b0bd3 |
+ if (HostX.argb_format == None) {
|
|
|
0b0bd3 |
+ xcb_render_query_pict_formats_reply_t *formats;
|
|
|
0b0bd3 |
+ xcb_render_pictforminfo_iterator_t i;
|
|
|
0b0bd3 |
+
|
|
|
0b0bd3 |
+ formats = xcb_render_query_pict_formats_reply(HostX.conn,
|
|
|
0b0bd3 |
+ xcb_render_query_pict_formats(HostX.conn),
|
|
|
0b0bd3 |
+ NULL);
|
|
|
0b0bd3 |
+
|
|
|
0b0bd3 |
+ for (i = xcb_render_query_pict_formats_formats_iterator(formats);
|
|
|
0b0bd3 |
+ i.rem;
|
|
|
0b0bd3 |
+ xcb_render_pictforminfo_next(&i)) {
|
|
|
0b0bd3 |
+
|
|
|
0b0bd3 |
+ if (i.data->type != XCB_RENDER_PICT_TYPE_DIRECT)
|
|
|
0b0bd3 |
+ continue;
|
|
|
0b0bd3 |
+
|
|
|
0b0bd3 |
+ if (i.data->depth != 32)
|
|
|
0b0bd3 |
+ continue;
|
|
|
0b0bd3 |
+
|
|
|
0b0bd3 |
+ if (i.data->direct.red_mask != 0xff ||
|
|
|
0b0bd3 |
+ i.data->direct.green_mask != 0xff ||
|
|
|
0b0bd3 |
+ i.data->direct.blue_mask != 0xff ||
|
|
|
0b0bd3 |
+ i.data->direct.alpha_mask != 0xff)
|
|
|
0b0bd3 |
+ continue;
|
|
|
0b0bd3 |
+
|
|
|
0b0bd3 |
+ if (i.data->direct.red_shift != 16 ||
|
|
|
0b0bd3 |
+ i.data->direct.green_shift != 8 ||
|
|
|
0b0bd3 |
+ i.data->direct.blue_shift != 0 ||
|
|
|
0b0bd3 |
+ i.data->direct.alpha_shift != 24)
|
|
|
0b0bd3 |
+ continue;
|
|
|
0b0bd3 |
+
|
|
|
0b0bd3 |
+ HostX.argb_format = i.data->id;
|
|
|
0b0bd3 |
+ break;
|
|
|
0b0bd3 |
+ }
|
|
|
0b0bd3 |
+
|
|
|
0b0bd3 |
+ free(formats);
|
|
|
0b0bd3 |
+ }
|
|
|
0b0bd3 |
+
|
|
|
0b0bd3 |
+ return HostX.argb_format;
|
|
|
0b0bd3 |
+}
|
|
|
0b0bd3 |
+
|
|
|
0b0bd3 |
#ifdef XF86DRI
|
|
|
0b0bd3 |
typedef struct {
|
|
|
0b0bd3 |
int is_valid;
|
|
|
0b0bd3 |
diff --git a/hw/kdrive/ephyr/hostx.h b/hw/kdrive/ephyr/hostx.h
|
|
|
0b0bd3 |
index e83323a..de488a4 100644
|
|
|
0b0bd3 |
--- a/hw/kdrive/ephyr/hostx.h
|
|
|
0b0bd3 |
+++ b/hw/kdrive/ephyr/hostx.h
|
|
|
0b0bd3 |
@@ -29,6 +29,7 @@
|
|
|
0b0bd3 |
#include <X11/X.h>
|
|
|
0b0bd3 |
#include <X11/Xmd.h>
|
|
|
0b0bd3 |
#include <xcb/xcb.h>
|
|
|
0b0bd3 |
+#include <xcb/render.h>
|
|
|
0b0bd3 |
#include "ephyr.h"
|
|
|
0b0bd3 |
|
|
|
0b0bd3 |
#define EPHYR_WANT_DEBUG 0
|
|
|
0b0bd3 |
@@ -174,6 +175,10 @@ int hostx_set_window_bounding_rectangles(int a_window,
|
|
|
0b0bd3 |
|
|
|
0b0bd3 |
int host_has_extension(xcb_extension_t *extension);
|
|
|
0b0bd3 |
|
|
|
0b0bd3 |
+xcb_gcontext_t hostx_get_cursor_gc(void);
|
|
|
0b0bd3 |
+
|
|
|
0b0bd3 |
+xcb_render_pictformat_t hostx_get_argb_format(void);
|
|
|
0b0bd3 |
+
|
|
|
0b0bd3 |
#ifdef XF86DRI
|
|
|
0b0bd3 |
int hostx_lookup_peer_window(void *a_local_window,
|
|
|
0b0bd3 |
int *a_host_peer /*out parameter */ );
|
|
|
0b0bd3 |
--
|
|
|
0b0bd3 |
1.9.3
|
|
|
0b0bd3 |
|