gnif / LookingGlass

An extremely low latency KVMFR (KVM FrameRelay) implementation for guests with VGA PCI Passthrough.
GNU General Public License v2.0
4.64k stars 257 forks source link

showCursorDot Arrow Feature Request #1126

Closed GFoxPM closed 3 months ago

GFoxPM commented 3 months ago

spice:showCursorDot replaced with spice:showCursor Also added spice:dotCursor, which switches the cursor to a dot or arrow

path ```diff diff --git a/client/src/app.c b/client/src/app.c index f57f0d11..264f2e0f 100644 --- a/client/src/app.c +++ b/client/src/app.c @@ -120,7 +120,7 @@ void app_handleFocusEvent(bool focused) g_state.escapeActive = false; - if (!g_params.showCursorDot) + if (!g_params.showCursor) g_state.ds->setPointer(LG_POINTER_NONE); if (g_params.minimizeOnFocusLoss) diff --git a/client/src/config.c b/client/src/config.c index 9f415165..61650d7e 100644 --- a/client/src/config.c +++ b/client/src/config.c @@ -480,11 +480,18 @@ static struct Option options[] = }, { .module = "spice", - .name = "showCursorDot", + .name = "dotCursor", .description = "Use a \"dot\" cursor when the window does not have focus", .type = OPTION_TYPE_BOOL, .value.x_bool = true }, + { + .module = "spice", + .name = "showCursor", + .description = "Show cursor when the window does not have focus", + .type = OPTION_TYPE_BOOL, + .value.x_bool = true + }, // audio options { @@ -704,7 +711,8 @@ bool config_load(int argc, char * argv[]) g_params.scaleMouseInput = option_get_bool("spice", "scaleCursor"); g_params.captureOnStart = option_get_bool("spice", "captureOnStart"); g_params.alwaysShowCursor = option_get_bool("spice", "alwaysShowCursor"); - g_params.showCursorDot = option_get_bool("spice", "showCursorDot"); + g_params.dotCursor = option_get_bool("spice", "dotCursor"); + g_params.showCursor = option_get_bool("spice", "showCursor"); } g_params.audioPeriodSize = option_get_int("audio", "periodSize"); diff --git a/client/src/core.c b/client/src/core.c index 8a6ccdd7..6db74586 100644 --- a/client/src/core.c +++ b/client/src/core.c @@ -83,7 +83,7 @@ void core_invalidatePointer(bool detectInView) else { if (g_params.hideMouse) - g_state.ds->setPointer(LG_POINTER_SQUARE); + g_state.ds->setPointer(g_params.dotCursor ? LG_POINTER_SQUARE : LG_POINTER_ARROW); if (warpSupport != LG_DS_WARP_NONE) g_state.ds->ungrabPointer(); @@ -121,7 +121,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->setPointer(enable ? LG_POINTER_NONE : LG_POINTER_SQUARE); + g_state.ds->setPointer(enable ? LG_POINTER_NONE : (g_params.dotCursor ? LG_POINTER_SQUARE : LG_POINTER_ARROW)); if (g_cursor.grab == enable) return; diff --git a/client/src/main.c b/client/src/main.c index a8d6e486..007adebb 100644 --- a/client/src/main.c +++ b/client/src/main.c @@ -96,10 +96,10 @@ static void lgInit(void) g_cursor.guest.valid = false; // if spice is not in use, hide the local cursor - if ((!g_params.useSpiceInput && g_params.hideMouse) || !g_params.showCursorDot) + if ((!g_params.useSpiceInput && g_params.hideMouse) || !g_params.showCursor) g_state.ds->setPointer(LG_POINTER_NONE); else - g_state.ds->setPointer(LG_POINTER_SQUARE); + g_state.ds->setPointer(g_params.dotCursor ? LG_POINTER_SQUARE : LG_POINTER_ARROW); } static bool fpsTimerFn(void * unused) diff --git a/client/src/main.h b/client/src/main.h index 3f9b6a2f..b516e1ce 100644 --- a/client/src/main.h +++ b/client/src/main.h @@ -214,7 +214,8 @@ struct AppParams bool rawMouse; bool autoCapture; bool captureInputOnly; - bool showCursorDot; + bool dotCursor; + bool showCursor; int audioPeriodSize; int audioBufferLatency; diff --git a/doc/usage.rst b/doc/usage.rst index 658fc401..c5d64031 100644 --- a/doc/usage.rst +++ b/doc/usage.rst @@ -296,7 +296,8 @@ All command line options | spice:scaleCursor | -j | yes | Scale cursor input position to screen size when up/down scaled | | spice:captureOnStart | | no | Capture mouse and keyboard on start | | spice:alwaysShowCursor | | no | Always show host cursor | - | spice:showCursorDot | | yes | Use a "dot" cursor when the window does not have focus | + | spice:dotCursor | | yes | Use a "dot" cursor when the window does not have focus | + | spice:showCursor | | yes | Show cursor when the window does not have focus | +------------------------+-------+-----------+---------------------------------------------------------------------+ +------------------------+-------+--------+-------------------------------------------------------------------------------+ ```
gnif commented 3 months ago

The purpose of the dot cursor is to show that the mouse is not active. If you wish the cursor to always show why not just use spice:alwaysShowCursor?

As this extra setting will just cause confusion to the end user, and I can't figure out what it's usefulness would be, I am not inclined to accept this.

GFoxPM commented 3 months ago

Because spice:alwaysShowCursor does not enable the cursor display when the LookingGlass window is not in focus. When the spice:alwaysShowCursor option is enabled, the LookingGlass window still displays a dot. Users have been dreaming about this additional setting for two years now) The problem with a dot cursor is that it is difficult to find with your eyes, especially on HiDPI monitors.

You can also implement the option in your own way. But this is a necessary option, because the user may not want to know that the LookingGlass window is not in focus. When disabling spice:showCursorDot -- we do not see any cursor at all.

Tested on B6

gnif commented 3 months ago

1) any patches provided must apply to the master branch. 2) It seems you're unaware that we changed the 'dot' to an actual cursor (https://github.com/gnif/LookingGlass/blob/master/resources/no-input-cursor/32.png) 3) Wayland doesn't yet load and support this new cursor, the correct fix is to add support here, not hack in a workaround.

Sorry but this is not the proper solution to this, closing.