GNOME Bugzilla – Bug 309466
gdkcursor-win32.c: patch for gdk_cursor_get_image implementation
Last modified: 2005-07-14 15:54:35 UTC
I implemented gdk_cursor_get_image function. This code is from gtkfilesystemwin32.c. Other information:
Created attachment 48641 [details] [review] implemented gdk_cursor_get_image
Ah, gtkfilesystemwin32.c. I thought I had seen code to do that somewhere ;-) Thanks.
BTW, the docs for GetIconInfo() specify that the hbmColor bitmap is optional, and not present for black and white icons (cursors). Isn't this a problem with the code? In that case, only the hbmMask is present, and contains two halves (its height is twice the width): "the upper half is the icon AND bitmask and the lower half is the icon XOR bitmask". (See _gdk_win32_data_to_wcursor() for code that creates a cursor from and "and plane" and "xor plane".) The code to create an GdkPixbuf from a HICON (or HCURSOR) shouldn't be duplicated, of course, but factored out into a non-public _gdk_win32_whatever() function, and gtkfilesystemwin32.c should then call that. Will work on this and commit.
Just nitpicking: to be exported from gdk it should not have the underscore prefix, so gdk_win32_whatever()
Umm, but such a function is for libgtk's use only, so using an underscore prefix would make that more obvious to people tempted to use it. But OK, we do have precedences where such functions are suffixed with _libgtk_only instead, maybe that makes it even more obvious.
an underscore prefix indicates a function that is not static, but also not exported from the library, thus not available to gtk. Thats what the _libgtk_only suffix is for: private interfaces between gdk and gtk
Umm, yes, this is fixed now: 2005-07-06 Tor Lillqvist <tml@novell.com> * gdk/win32/gdkcursor-win32.c: (gdk_win32_icon_to_pixbuf_libgtk_only): New function, code moved here from gtk/gtkfilesystemwin32.c:extract_icon(). (gdk_cursor_get_image): Use gdk_win32_icon_to_pixbuf_libgtk_only().