mirror of
				https://github.com/gnif/LookingGlass.git
				synced 2025-11-03 22:22:08 +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:
		@@ -101,8 +101,8 @@ void waylandCursorFree(void)
 | 
				
			|||||||
    wl_buffer_destroy(wlWm.cursorBuffer);
 | 
					    wl_buffer_destroy(wlWm.cursorBuffer);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void waylandShowPointer(bool show)
 | 
					void waylandSetPointer(LG_DSPointer pointer)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  wlWm.showPointer = show;
 | 
					  wlWm.showPointer = pointer != LG_POINTER_NONE;
 | 
				
			||||||
  wl_pointer_set_cursor(wlWm.pointer, wlWm.pointerEnterSerial, show ? wlWm.cursor : NULL, 0, 0);
 | 
					  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,
 | 
					  .glSwapBuffers       = waylandGLSwapBuffers,
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
  .guestPointerUpdated = waylandGuestPointerUpdated,
 | 
					  .guestPointerUpdated = waylandGuestPointerUpdated,
 | 
				
			||||||
  .showPointer         = waylandShowPointer,
 | 
					  .setPointer          = waylandSetPointer,
 | 
				
			||||||
  .grabPointer         = waylandGrabPointer,
 | 
					  .grabPointer         = waylandGrabPointer,
 | 
				
			||||||
  .ungrabPointer       = waylandUngrabPointer,
 | 
					  .ungrabPointer       = waylandUngrabPointer,
 | 
				
			||||||
  .capturePointer      = waylandCapturePointer,
 | 
					  .capturePointer      = waylandCapturePointer,
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -207,7 +207,7 @@ void waylandCBInvalidate(void);
 | 
				
			|||||||
// cursor module
 | 
					// cursor module
 | 
				
			||||||
bool waylandCursorInit(void);
 | 
					bool waylandCursorInit(void);
 | 
				
			||||||
void waylandCursorFree(void);
 | 
					void waylandCursorFree(void);
 | 
				
			||||||
void waylandShowPointer(bool show);
 | 
					void waylandSetPointer(LG_DSPointer pointer);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// gl module
 | 
					// gl module
 | 
				
			||||||
#if defined(ENABLE_EGL) || defined(ENABLE_OPENGL)
 | 
					#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);
 | 
					  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);
 | 
					    XDefineCursor(x11.display, x11.window, x11.squareCursor);
 | 
				
			||||||
  else
 | 
					  else
 | 
				
			||||||
    XDefineCursor(x11.display, x11.window, x11.blankCursor);
 | 
					    XDefineCursor(x11.display, x11.window, x11.blankCursor);
 | 
				
			||||||
@@ -1266,7 +1266,7 @@ struct LG_DisplayServerOps LGDS_X11 =
 | 
				
			|||||||
  .glSwapBuffers      = x11GLSwapBuffers,
 | 
					  .glSwapBuffers      = x11GLSwapBuffers,
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
  .guestPointerUpdated = x11GuestPointerUpdated,
 | 
					  .guestPointerUpdated = x11GuestPointerUpdated,
 | 
				
			||||||
  .showPointer         = x11ShowPointer,
 | 
					  .setPointer          = x11SetPointer,
 | 
				
			||||||
  .grabPointer         = x11GrabPointer,
 | 
					  .grabPointer         = x11GrabPointer,
 | 
				
			||||||
  .ungrabPointer       = x11UngrabPointer,
 | 
					  .ungrabPointer       = x11UngrabPointer,
 | 
				
			||||||
  .capturePointer      = x11CapturePointer,
 | 
					  .capturePointer      = x11CapturePointer,
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -62,6 +62,24 @@ enum LG_DSWarpSupport
 | 
				
			|||||||
  LG_DS_WARP_SCREEN,
 | 
					  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
 | 
					typedef struct LG_DSInitParams
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  const char * title;
 | 
					  const char * title;
 | 
				
			||||||
@@ -131,7 +149,7 @@ struct LG_DisplayServerOps
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  /* dm specific cursor implementations */
 | 
					  /* dm specific cursor implementations */
 | 
				
			||||||
  void (*guestPointerUpdated)(double x, double y, double localX, double localY);
 | 
					  void (*guestPointerUpdated)(double x, double y, double localX, double localY);
 | 
				
			||||||
  void (*showPointer)(bool show);
 | 
					  void (*setPointer)(LG_DSPointer pointer);
 | 
				
			||||||
  void (*grabKeyboard)();
 | 
					  void (*grabKeyboard)();
 | 
				
			||||||
  void (*ungrabKeyboard)();
 | 
					  void (*ungrabKeyboard)();
 | 
				
			||||||
  /* (un)grabPointer is used to toggle cursor tracking/confine in normal mode */
 | 
					  /* (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)->glSetSwapInterval); \
 | 
				
			||||||
  ASSERT_OPENGL_FN((x)->glSwapBuffers    ); \
 | 
					  ASSERT_OPENGL_FN((x)->glSwapBuffers    ); \
 | 
				
			||||||
  assert((x)->guestPointerUpdated); \
 | 
					  assert((x)->guestPointerUpdated); \
 | 
				
			||||||
  assert((x)->showPointer        ); \
 | 
					  assert((x)->setPointer         ); \
 | 
				
			||||||
  assert((x)->grabPointer        ); \
 | 
					  assert((x)->grabPointer        ); \
 | 
				
			||||||
  assert((x)->ungrabPointer      ); \
 | 
					  assert((x)->ungrabPointer      ); \
 | 
				
			||||||
  assert((x)->capturePointer     ); \
 | 
					  assert((x)->capturePointer     ); \
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -94,7 +94,7 @@ void app_handleFocusEvent(bool focused)
 | 
				
			|||||||
          app_handleKeyRelease(key);
 | 
					          app_handleKeyRelease(key);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (!g_params.showCursorDot)
 | 
					    if (!g_params.showCursorDot)
 | 
				
			||||||
      g_state.ds->showPointer(false);
 | 
					      g_state.ds->setPointer(LG_POINTER_NONE);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (g_params.minimizeOnFocusLoss)
 | 
					    if (g_params.minimizeOnFocusLoss)
 | 
				
			||||||
      g_state.ds->minimize();
 | 
					      g_state.ds->minimize();
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -66,7 +66,7 @@ void core_setCursorInView(bool enable)
 | 
				
			|||||||
  if (enable)
 | 
					  if (enable)
 | 
				
			||||||
  {
 | 
					  {
 | 
				
			||||||
    if (g_params.hideMouse)
 | 
					    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)
 | 
					    if (warpSupport != LG_DS_WARP_NONE && !g_params.captureInputOnly)
 | 
				
			||||||
      g_state.ds->grabPointer();
 | 
					      g_state.ds->grabPointer();
 | 
				
			||||||
@@ -77,7 +77,7 @@ void core_setCursorInView(bool enable)
 | 
				
			|||||||
  else
 | 
					  else
 | 
				
			||||||
  {
 | 
					  {
 | 
				
			||||||
    if (g_params.hideMouse)
 | 
					    if (g_params.hideMouse)
 | 
				
			||||||
      g_state.ds->showPointer(true);
 | 
					      g_state.ds->setPointer(LG_POINTER_SQUARE);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (warpSupport != LG_DS_WARP_NONE)
 | 
					    if (warpSupport != LG_DS_WARP_NONE)
 | 
				
			||||||
      g_state.ds->ungrabPointer();
 | 
					      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 */
 | 
					  /* we always do this so that at init the cursor is in the right state */
 | 
				
			||||||
  if (g_params.captureInputOnly && g_params.hideMouse)
 | 
					  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)
 | 
					  if (g_cursor.grab == enable)
 | 
				
			||||||
    return;
 | 
					    return;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -92,9 +92,9 @@ static void lgInit(void)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  // if spice is not in use, hide the local cursor
 | 
					  // if spice is not in use, hide the local cursor
 | 
				
			||||||
  if (!core_inputEnabled() && g_params.hideMouse)
 | 
					  if (!core_inputEnabled() && g_params.hideMouse)
 | 
				
			||||||
    g_state.ds->showPointer(false);
 | 
					    g_state.ds->setPointer(LG_POINTER_NONE);
 | 
				
			||||||
  else
 | 
					  else
 | 
				
			||||||
    g_state.ds->showPointer(true);
 | 
					    g_state.ds->setPointer(LG_POINTER_SQUARE);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static bool fpsTimerFn(void * unused)
 | 
					static bool fpsTimerFn(void * unused)
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user