+static void UpdateCursor( event_thread_t *p_event, bool b_show )
+{
+ if( p_event->is_cursor_hidden == !b_show )
+ return;
+ p_event->is_cursor_hidden = !b_show;
+
+#if 1
+ HCURSOR cursor = b_show ? p_event->cursor_arrow : p_event->cursor_empty;
+ if( p_event->hvideownd )
+ SetClassLongPtr( p_event->hvideownd, GCLP_HCURSOR, (LONG_PTR)cursor );
+ if( p_event->hwnd )
+ SetClassLongPtr( p_event->hwnd, GCLP_HCURSOR, (LONG_PTR)cursor );
+#endif
+
+ /* FIXME I failed to find a cleaner way to force a redraw of the cursor */
+ POINT p;
+ GetCursorPos(&p);
+ HWND hwnd = WindowFromPoint(p);
+ if( hwnd == p_event->hvideownd || hwnd == p_event->hwnd )
+ SetCursorPos(p.x, p.y);
+}
+
+static HCURSOR EmptyCursor( HINSTANCE instance )
+{
+ const int cw = GetSystemMetrics(SM_CXCURSOR);
+ const int ch = GetSystemMetrics(SM_CYCURSOR);
+
+ HCURSOR cursor = NULL;
+ uint8_t *and = malloc(cw * ch);
+ uint8_t *xor = malloc(cw * ch);
+ if( and && xor )
+ {
+ memset(and, 0xff, cw * ch );
+ memset(xor, 0x00, cw * ch );
+ cursor = CreateCursor( instance, 0, 0, cw, ch, and, xor);
+ }
+ free( and );
+ free( xor );
+
+ return cursor;
+}
+