mirror of
https://github.com/brl/mutter.git
synced 2025-06-14 01:09:30 +00:00
win32: Use an invisible cursor when cursor-visible is FALSE
The win32 backend now handles the WM_SETCURSOR message and sets a fully transparent cursor if the cursor-visible property has been cleared on the stage. The icon is stored in the library via a resource file. The instance handle for the DLL is needed to load the resource so there is now a DllMain function to grab the handle.
This commit is contained in:
@ -216,17 +216,51 @@ clutter_stage_win32_set_title (ClutterStageWindow *stage_window,
|
||||
SetWindowTextW (stage_win32->hwnd, stage_win32->wtitle);
|
||||
}
|
||||
|
||||
void
|
||||
_clutter_stage_win32_update_cursor (ClutterStageWin32 *stage_win32)
|
||||
{
|
||||
HCURSOR cursor;
|
||||
|
||||
if (stage_win32->is_cursor_visible)
|
||||
cursor = (HCURSOR) GetClassLongPtrW (stage_win32->hwnd, GCL_HCURSOR);
|
||||
else
|
||||
{
|
||||
ClutterBackend *backend = clutter_get_default_backend ();
|
||||
/* The documentation implies that we can just use
|
||||
SetCursor(NULL) to get rid of the cursor but apparently this
|
||||
doesn't work very well so instead we create an invisible
|
||||
cursor */
|
||||
cursor = _clutter_backend_win32_get_invisible_cursor (backend);
|
||||
}
|
||||
|
||||
SetCursor (cursor);
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_stage_win32_set_cursor_visible (ClutterStageWindow *stage_window,
|
||||
gboolean cursor_visible)
|
||||
{
|
||||
ClutterStageWin32 *stage_win32 = CLUTTER_STAGE_WIN32 (stage_window);
|
||||
|
||||
if (stage_win32->is_cursor_visible != cursor_visible &&
|
||||
stage_win32->tracking_mouse)
|
||||
ShowCursor (cursor_visible);
|
||||
if (stage_win32->is_cursor_visible != cursor_visible)
|
||||
{
|
||||
POINT cursor_pos;
|
||||
RECT client_rect;
|
||||
|
||||
stage_win32->is_cursor_visible = cursor_visible;
|
||||
stage_win32->is_cursor_visible = cursor_visible;
|
||||
|
||||
/* If the cursor is already over the client area of the window
|
||||
then we need to update it immediately */
|
||||
GetCursorPos (&cursor_pos);
|
||||
if (WindowFromPoint (cursor_pos) == stage_win32->hwnd &&
|
||||
ScreenToClient (stage_win32->hwnd, &cursor_pos) &&
|
||||
GetClientRect (stage_win32->hwnd, &client_rect) &&
|
||||
cursor_pos.x >= client_rect.left &&
|
||||
cursor_pos.y >= client_rect.top &&
|
||||
cursor_pos.x < client_rect.right &&
|
||||
cursor_pos.y < client_rect.bottom)
|
||||
_clutter_stage_win32_update_cursor (stage_win32);
|
||||
}
|
||||
}
|
||||
|
||||
static LONG
|
||||
|
Reference in New Issue
Block a user