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:
Neil Roberts
2010-01-15 22:56:37 +00:00
parent 4db89759a0
commit 14a28620ae
10 changed files with 112 additions and 6 deletions

View File

@ -47,6 +47,8 @@ static ClutterBackendWin32 *backend_singleton = NULL;
static gchar *clutter_vblank_name = NULL;
static HINSTANCE clutter_hinst = NULL;
gboolean
clutter_backend_win32_pre_parse (ClutterBackend *backend,
GError **error)
@ -67,6 +69,18 @@ clutter_backend_win32_init_events (ClutterBackend *backend)
_clutter_backend_win32_events_init (backend);
}
HCURSOR
_clutter_backend_win32_get_invisible_cursor (ClutterBackend *backend)
{
ClutterBackendWin32 *backend_win32 = CLUTTER_BACKEND_WIN32 (backend);
if (backend_win32->invisible_cursor == NULL)
backend_win32->invisible_cursor =
LoadCursor (clutter_hinst, MAKEINTRESOURCE (42));
return backend_win32->invisible_cursor;
}
static const GOptionEntry entries[] =
{
{
@ -353,6 +367,7 @@ clutter_backend_win32_init (ClutterBackendWin32 *backend_win32)
backend_win32->gl_context = NULL;
backend_win32->no_event_retrieval = FALSE;
backend_win32->invisible_cursor = NULL;
/* FIXME: get from GetSystemMetric? */
clutter_backend_set_double_click_time (backend, 250);
@ -370,3 +385,13 @@ _clutter_backend_impl_get_type (void)
{
return clutter_backend_win32_get_type ();
}
BOOL WINAPI
DllMain (HINSTANCE hinst, DWORD reason, LPVOID reserved)
{
if (reason == DLL_PROCESS_ATTACH)
/* Store the module handle so that we can use it to load resources */
clutter_hinst = hinst;
return TRUE;
}