GDK/GTK on Windows: Fix build

Due to the work on gdk_cursor_new_from_surface (commit b2113b73),
get_cursor_for_pixbuf() in GdkDisplayClass was converted to
get_cursor_for_surface(), which means the GDK Win32 backend needs to be
updated for the code to build and run on Windows, plus some function
prototypes and declarations/calls need to be updated as well.

https://bugzilla.gnome.org/show_bug.cgi?id=705980
This commit is contained in:
Chun-wei Fan 2013-08-21 21:54:09 +08:00
parent a301617f17
commit 0e01f9cc9c
6 changed files with 35 additions and 17 deletions

View File

@ -250,7 +250,9 @@ _gdk_win32_display_get_cursor_for_name (GdkDisplay *display,
} }
GdkPixbuf * GdkPixbuf *
gdk_win32_icon_to_pixbuf_libgtk_only (HICON hicon, gint *x_hot, gint *y_hot) gdk_win32_icon_to_pixbuf_libgtk_only (HICON hicon,
gdouble *x_hot,
gdouble *y_hot)
{ {
GdkPixbuf *pixbuf = NULL; GdkPixbuf *pixbuf = NULL;
ICONINFO ii; ICONINFO ii;
@ -430,7 +432,7 @@ _gdk_win32_cursor_get_surface (GdkCursor *cursor,
gdouble *y_hot) gdouble *y_hot)
{ {
GdkPixbuf *pixbuf; GdkPixbuf *pixbuf;
cairo_surface_t *surface cairo_surface_t *surface;
g_return_val_if_fail (cursor != NULL, NULL); g_return_val_if_fail (cursor != NULL, NULL);
@ -446,19 +448,33 @@ _gdk_win32_cursor_get_surface (GdkCursor *cursor,
} }
GdkCursor * GdkCursor *
_gdk_win32_display_get_cursor_for_pixbuf (GdkDisplay *display, _gdk_win32_display_get_cursor_for_surface (GdkDisplay *display,
GdkPixbuf *pixbuf, cairo_surface_t *surface,
gint x, gdouble x,
gint y) gdouble y)
{ {
HCURSOR hcursor; HCURSOR hcursor;
GdkPixbuf *pixbuf;
gint width, height;
g_return_val_if_fail (display == _gdk_display, NULL); g_return_val_if_fail (display == _gdk_display, NULL);
g_return_val_if_fail (surface != NULL, NULL);
width = cairo_image_surface_get_width (surface);
height = cairo_image_surface_get_height (surface);
pixbuf = gdk_pixbuf_get_from_surface (surface,
0,
0,
width,
height);
g_return_val_if_fail (GDK_IS_PIXBUF (pixbuf), NULL); g_return_val_if_fail (GDK_IS_PIXBUF (pixbuf), NULL);
g_return_val_if_fail (0 <= x && x < gdk_pixbuf_get_width (pixbuf), NULL); g_return_val_if_fail (0 <= x && x < gdk_pixbuf_get_width (pixbuf), NULL);
g_return_val_if_fail (0 <= y && y < gdk_pixbuf_get_height (pixbuf), NULL); g_return_val_if_fail (0 <= y && y < gdk_pixbuf_get_height (pixbuf), NULL);
hcursor = _gdk_win32_pixbuf_to_hcursor (pixbuf, x, y); hcursor = _gdk_win32_pixbuf_to_hcursor (pixbuf, x, y);
g_object_unref (pixbuf);
if (!hcursor) if (!hcursor)
return NULL; return NULL;
return cursor_new_from_hcursor (hcursor, GDK_CURSOR_IS_PIXMAP); return cursor_new_from_hcursor (hcursor, GDK_CURSOR_IS_PIXMAP);

View File

@ -40,8 +40,8 @@ static void gdk_device_wintab_set_window_cursor (GdkDevice *device,
GdkCursor *cursor); GdkCursor *cursor);
static void gdk_device_wintab_warp (GdkDevice *device, static void gdk_device_wintab_warp (GdkDevice *device,
GdkScreen *screen, GdkScreen *screen,
gint x, gdouble x,
gint y); gdouble y);
static void gdk_device_wintab_query_state (GdkDevice *device, static void gdk_device_wintab_query_state (GdkDevice *device,
GdkWindow *window, GdkWindow *window,
GdkWindow **root_window, GdkWindow **root_window,
@ -170,8 +170,8 @@ gdk_device_wintab_set_window_cursor (GdkDevice *device,
static void static void
gdk_device_wintab_warp (GdkDevice *device, gdk_device_wintab_warp (GdkDevice *device,
GdkScreen *screen, GdkScreen *screen,
gint x, gdouble x,
gint y) gdouble y)
{ {
} }

View File

@ -658,7 +658,7 @@ gdk_win32_display_class_init (GdkWin32DisplayClass *klass)
//? display_class->get_app_launch_context = _gdk_win32_display_get_app_launch_context; //? display_class->get_app_launch_context = _gdk_win32_display_get_app_launch_context;
display_class->get_cursor_for_type = _gdk_win32_display_get_cursor_for_type; display_class->get_cursor_for_type = _gdk_win32_display_get_cursor_for_type;
display_class->get_cursor_for_name = _gdk_win32_display_get_cursor_for_name; display_class->get_cursor_for_name = _gdk_win32_display_get_cursor_for_name;
display_class->get_cursor_for_pixbuf = _gdk_win32_display_get_cursor_for_pixbuf; display_class->get_cursor_for_surface = _gdk_win32_display_get_cursor_for_surface;
display_class->get_default_cursor_size = _gdk_win32_display_get_default_cursor_size; display_class->get_default_cursor_size = _gdk_win32_display_get_default_cursor_size;
display_class->get_maximal_cursor_size = _gdk_win32_display_get_maximal_cursor_size; display_class->get_maximal_cursor_size = _gdk_win32_display_get_maximal_cursor_size;
display_class->supports_cursor_alpha = _gdk_win32_display_supports_cursor_alpha; display_class->supports_cursor_alpha = _gdk_win32_display_supports_cursor_alpha;

View File

@ -373,10 +373,10 @@ GdkCursor *_gdk_win32_display_get_cursor_for_type (GdkDisplay *display,
GdkCursorType cursor_type); GdkCursorType cursor_type);
GdkCursor *_gdk_win32_display_get_cursor_for_name (GdkDisplay *display, GdkCursor *_gdk_win32_display_get_cursor_for_name (GdkDisplay *display,
const gchar *name); const gchar *name);
GdkCursor *_gdk_win32_display_get_cursor_for_pixbuf (GdkDisplay *display, GdkCursor *_gdk_win32_display_get_cursor_for_surface (GdkDisplay *display,
GdkPixbuf *pixbuf, cairo_surface_t *surface,
gint x, gdouble x,
gint y); gdouble y);
void _gdk_win32_display_get_default_cursor_size (GdkDisplay *display, void _gdk_win32_display_get_default_cursor_size (GdkDisplay *display,
guint *width, guint *width,
guint *height); guint *height);

View File

@ -98,7 +98,9 @@ GdkWindow * gdk_win32_window_lookup_for_display (GdkDisplay *display,
/* For internal GTK use only */ /* For internal GTK use only */
GDK_AVAILABLE_IN_ALL GDK_AVAILABLE_IN_ALL
GdkPixbuf *gdk_win32_icon_to_pixbuf_libgtk_only (HICON hicon); GdkPixbuf *gdk_win32_icon_to_pixbuf_libgtk_only (HICON hicon,
gdouble *x_hot,
gdouble *y_hot);
GDK_AVAILABLE_IN_ALL GDK_AVAILABLE_IN_ALL
HICON gdk_win32_pixbuf_to_hicon_libgtk_only (GdkPixbuf *pixbuf); HICON gdk_win32_pixbuf_to_hicon_libgtk_only (GdkPixbuf *pixbuf);
GDK_AVAILABLE_IN_ALL GDK_AVAILABLE_IN_ALL

View File

@ -1690,7 +1690,7 @@ choose_icon (GtkIconTheme *icon_theme,
if (hIcon) if (hIcon)
{ {
icon_info = icon_info_new (); icon_info = icon_info_new ();
icon_info->cache_pixbuf = gdk_win32_icon_to_pixbuf_libgtk_only (hIcon); icon_info->cache_pixbuf = gdk_win32_icon_to_pixbuf_libgtk_only (hIcon, NULL, NULL);
DestroyIcon (hIcon); DestroyIcon (hIcon);
icon_info->dir_type = ICON_THEME_DIR_UNTHEMED; icon_info->dir_type = ICON_THEME_DIR_UNTHEMED;
icon_info->dir_size = size; icon_info->dir_size = size;