GDK: Add cursor theme support to W32 backend

Desktop / GNOME / GTK - Руслан Ижбулатов [] - 20 May 2015 03:42 UTC

Load themed cursors from the same places they are loaded on freedesktop systems, but use W32 API functions to do so (works for .cur/.ani cursors instead of X cursors).

Refactor the code for cursor handling. Prefer loading cursors by name.

Do not load actual cursors when loading the theme. Find the files and remember the arguments/calls for loading them instead. Keeping HCURSOR instance in the hashmap would result in multiple GdkCursors using the same HCURSOR. Given that we use DestroyCursor() to off them, this would cause problems (at the very least - DestroyCursor() would fail).

Store GdkCursor instances in a cache. Update cached cursors when theme changes.

Recognize "system" theme as a special (and default) case. When it is set, prefer system cursors and fall back to Adwaita cursors and (as a last resort) built-in X cursors. Otherwise prefer theme cursors and fall back to system and X cursors.

Force GTK to use "left_ptr" cursor when no cursor is set. Using NULL makes it use the system default "arrow", which is not the intended behaviour when a non-system theme is selected.

Ignore cursor size setting and query the OS for the required cursor size, as Windows (almost) does not allow setting cursors of arbitrary size.

26c2432 GDK: Add cursor theme support to W32 backend
docs/reference/gtk/windows.sgml | 27 ++
gdk/win32/gdkcursor-win32.c | 639 ++++++++++++++++++++++++++++++++++-----
gdk/win32/gdkdisplay-win32.c | 102 ++++++-
gdk/win32/gdkdisplay-win32.h | 5 +
gdk/win32/gdkprivate-win32.h | 39 +++
gdk/win32/gdkwin32display.h | 5 +
gdk/win32/gdkwindow-win32.c | 5 +-
gtk/gtksettings.c | 11 +-
8 files changed, 758 insertions(+), 75 deletions(-)


  • Share