mirror of
https://github.com/gnif/LookingGlass.git
synced 2024-11-10 08:38:20 +00:00
[client] ds: change showPointer to setPointer for more cursors
Currently everything only supports LG_POINTER_NONE and LG_POINTER_SQUARE.
This commit is contained in:
parent
c991de7ccd
commit
da28db2ca4
@ -101,8 +101,8 @@ void waylandCursorFree(void)
|
||||
wl_buffer_destroy(wlWm.cursorBuffer);
|
||||
}
|
||||
|
||||
void waylandShowPointer(bool show)
|
||||
void waylandSetPointer(LG_DSPointer pointer)
|
||||
{
|
||||
wlWm.showPointer = show;
|
||||
wl_pointer_set_cursor(wlWm.pointer, wlWm.pointerEnterSerial, show ? wlWm.cursor : NULL, 0, 0);
|
||||
wlWm.showPointer = pointer != LG_POINTER_NONE;
|
||||
wl_pointer_set_cursor(wlWm.pointer, wlWm.pointerEnterSerial, wlWm.showPointer ? wlWm.cursor : NULL, 0, 0);
|
||||
}
|
||||
|
@ -165,7 +165,7 @@ struct LG_DisplayServerOps LGDS_Wayland =
|
||||
.glSwapBuffers = waylandGLSwapBuffers,
|
||||
#endif
|
||||
.guestPointerUpdated = waylandGuestPointerUpdated,
|
||||
.showPointer = waylandShowPointer,
|
||||
.setPointer = waylandSetPointer,
|
||||
.grabPointer = waylandGrabPointer,
|
||||
.ungrabPointer = waylandUngrabPointer,
|
||||
.capturePointer = waylandCapturePointer,
|
||||
|
@ -207,7 +207,7 @@ void waylandCBInvalidate(void);
|
||||
// cursor module
|
||||
bool waylandCursorInit(void);
|
||||
void waylandCursorFree(void);
|
||||
void waylandShowPointer(bool show);
|
||||
void waylandSetPointer(LG_DSPointer pointer);
|
||||
|
||||
// gl module
|
||||
#if defined(ENABLE_EGL) || defined(ENABLE_OPENGL)
|
||||
|
@ -1009,9 +1009,9 @@ static void x11GuestPointerUpdated(double x, double y, double localX, double loc
|
||||
XSync(x11.display, False);
|
||||
}
|
||||
|
||||
static void x11ShowPointer(bool show)
|
||||
static void x11SetPointer(LG_DSPointer pointer)
|
||||
{
|
||||
if (show)
|
||||
if (pointer != LG_POINTER_NONE)
|
||||
XDefineCursor(x11.display, x11.window, x11.squareCursor);
|
||||
else
|
||||
XDefineCursor(x11.display, x11.window, x11.blankCursor);
|
||||
@ -1266,7 +1266,7 @@ struct LG_DisplayServerOps LGDS_X11 =
|
||||
.glSwapBuffers = x11GLSwapBuffers,
|
||||
#endif
|
||||
.guestPointerUpdated = x11GuestPointerUpdated,
|
||||
.showPointer = x11ShowPointer,
|
||||
.setPointer = x11SetPointer,
|
||||
.grabPointer = x11GrabPointer,
|
||||
.ungrabPointer = x11UngrabPointer,
|
||||
.capturePointer = x11CapturePointer,
|
||||
|
@ -62,6 +62,24 @@ enum LG_DSWarpSupport
|
||||
LG_DS_WARP_SCREEN,
|
||||
};
|
||||
|
||||
typedef enum LG_DSPointer
|
||||
{
|
||||
LG_POINTER_NONE = 0,
|
||||
LG_POINTER_SQUARE,
|
||||
LG_POINTER_ARROW,
|
||||
LG_POINTER_INPUT,
|
||||
LG_POINTER_MOVE,
|
||||
LG_POINTER_RESIZE_NS,
|
||||
LG_POINTER_RESIZE_EW,
|
||||
LG_POINTER_RESIZE_NESW,
|
||||
LG_POINTER_RESIZE_NWSE,
|
||||
LG_POINTER_HAND,
|
||||
LG_POINTER_NOT_ALLOWED,
|
||||
}
|
||||
LG_DSPointer;
|
||||
|
||||
#define LG_POINTER_COUNT (LG_POINTER_NOT_ALLOWED + 1)
|
||||
|
||||
typedef struct LG_DSInitParams
|
||||
{
|
||||
const char * title;
|
||||
@ -131,7 +149,7 @@ struct LG_DisplayServerOps
|
||||
|
||||
/* dm specific cursor implementations */
|
||||
void (*guestPointerUpdated)(double x, double y, double localX, double localY);
|
||||
void (*showPointer)(bool show);
|
||||
void (*setPointer)(LG_DSPointer pointer);
|
||||
void (*grabKeyboard)();
|
||||
void (*ungrabKeyboard)();
|
||||
/* (un)grabPointer is used to toggle cursor tracking/confine in normal mode */
|
||||
@ -202,7 +220,7 @@ struct LG_DisplayServerOps
|
||||
ASSERT_OPENGL_FN((x)->glSetSwapInterval); \
|
||||
ASSERT_OPENGL_FN((x)->glSwapBuffers ); \
|
||||
assert((x)->guestPointerUpdated); \
|
||||
assert((x)->showPointer ); \
|
||||
assert((x)->setPointer ); \
|
||||
assert((x)->grabPointer ); \
|
||||
assert((x)->ungrabPointer ); \
|
||||
assert((x)->capturePointer ); \
|
||||
|
@ -94,7 +94,7 @@ void app_handleFocusEvent(bool focused)
|
||||
app_handleKeyRelease(key);
|
||||
|
||||
if (!g_params.showCursorDot)
|
||||
g_state.ds->showPointer(false);
|
||||
g_state.ds->setPointer(LG_POINTER_NONE);
|
||||
|
||||
if (g_params.minimizeOnFocusLoss)
|
||||
g_state.ds->minimize();
|
||||
|
@ -66,7 +66,7 @@ void core_setCursorInView(bool enable)
|
||||
if (enable)
|
||||
{
|
||||
if (g_params.hideMouse)
|
||||
g_state.ds->showPointer(false);
|
||||
g_state.ds->setPointer(LG_POINTER_NONE);
|
||||
|
||||
if (warpSupport != LG_DS_WARP_NONE && !g_params.captureInputOnly)
|
||||
g_state.ds->grabPointer();
|
||||
@ -77,7 +77,7 @@ void core_setCursorInView(bool enable)
|
||||
else
|
||||
{
|
||||
if (g_params.hideMouse)
|
||||
g_state.ds->showPointer(true);
|
||||
g_state.ds->setPointer(LG_POINTER_SQUARE);
|
||||
|
||||
if (warpSupport != LG_DS_WARP_NONE)
|
||||
g_state.ds->ungrabPointer();
|
||||
@ -102,7 +102,7 @@ void core_setGrabQuiet(bool enable)
|
||||
{
|
||||
/* we always do this so that at init the cursor is in the right state */
|
||||
if (g_params.captureInputOnly && g_params.hideMouse)
|
||||
g_state.ds->showPointer(!enable);
|
||||
g_state.ds->setPointer(enable ? LG_POINTER_NONE : LG_POINTER_SQUARE);
|
||||
|
||||
if (g_cursor.grab == enable)
|
||||
return;
|
||||
|
@ -92,9 +92,9 @@ static void lgInit(void)
|
||||
|
||||
// if spice is not in use, hide the local cursor
|
||||
if (!core_inputEnabled() && g_params.hideMouse)
|
||||
g_state.ds->showPointer(false);
|
||||
g_state.ds->setPointer(LG_POINTER_NONE);
|
||||
else
|
||||
g_state.ds->showPointer(true);
|
||||
g_state.ds->setPointer(LG_POINTER_SQUARE);
|
||||
}
|
||||
|
||||
static bool fpsTimerFn(void * unused)
|
||||
|
Loading…
Reference in New Issue
Block a user