app: pass a GdkWindow not GdkDisplay to gimp_cursor_new()
Preparation for adding HiDPI cursors.
(cherry picked from commit 47ff7e1467
)
This commit is contained in:
@ -245,21 +245,24 @@ get_cursor_pixbuf (GimpCursor *cursor)
|
||||
}
|
||||
|
||||
GdkCursor *
|
||||
gimp_cursor_new (GdkDisplay *display,
|
||||
gimp_cursor_new (GdkWindow *window,
|
||||
GimpHandedness cursor_handedness,
|
||||
GimpCursorType cursor_type,
|
||||
GimpToolCursorType tool_cursor,
|
||||
GimpCursorModifier modifier)
|
||||
{
|
||||
GdkDisplay *display;
|
||||
GimpCursor *bmcursor = NULL;
|
||||
GimpCursor *bmmodifier = NULL;
|
||||
GimpCursor *bmtool = NULL;
|
||||
GdkCursor *cursor;
|
||||
GdkPixbuf *pixbuf;
|
||||
|
||||
g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL);
|
||||
g_return_val_if_fail (GDK_IS_WINDOW (window), NULL);
|
||||
g_return_val_if_fail (cursor_type < GIMP_CURSOR_LAST, NULL);
|
||||
|
||||
display = gdk_window_get_display (window);
|
||||
|
||||
if (cursor_type <= (GimpCursorType) GDK_LAST_CURSOR)
|
||||
return gdk_cursor_new_for_display (display, (GdkCursorType) cursor_type);
|
||||
|
||||
@ -413,20 +416,23 @@ gimp_cursor_set (GtkWidget *widget,
|
||||
GimpToolCursorType tool_cursor,
|
||||
GimpCursorModifier modifier)
|
||||
{
|
||||
GdkWindow *window;
|
||||
GdkCursor *cursor;
|
||||
|
||||
g_return_if_fail (GTK_IS_WIDGET (widget));
|
||||
g_return_if_fail (gtk_widget_get_realized (widget));
|
||||
|
||||
cursor = gimp_cursor_new (gtk_widget_get_display (widget),
|
||||
window = gtk_widget_get_window (widget);
|
||||
|
||||
cursor = gimp_cursor_new (window,
|
||||
cursor_handedness,
|
||||
cursor_type,
|
||||
tool_cursor,
|
||||
modifier);
|
||||
gdk_window_set_cursor (gtk_widget_get_window (widget), cursor);
|
||||
gdk_window_set_cursor (window, cursor);
|
||||
gdk_cursor_unref (cursor);
|
||||
|
||||
gdk_display_flush (gtk_widget_get_display (widget));
|
||||
gdk_display_flush (gdk_window_get_display (window));
|
||||
}
|
||||
|
||||
GimpCursorType
|
||||
|
@ -19,7 +19,7 @@
|
||||
#define __GIMP_CURSOR_H__
|
||||
|
||||
|
||||
GdkCursor * gimp_cursor_new (GdkDisplay *display,
|
||||
GdkCursor * gimp_cursor_new (GdkWindow *window,
|
||||
GimpHandedness cursor_handedness,
|
||||
GimpCursorType cursor_type,
|
||||
GimpToolCursorType tool_cursor,
|
||||
|
@ -1544,9 +1544,7 @@ gimp_dialog_factory_show (GimpDialogFactory *factory)
|
||||
void
|
||||
gimp_dialog_factory_set_busy (GimpDialogFactory *factory)
|
||||
{
|
||||
GdkDisplay *display = NULL;
|
||||
GdkCursor *cursor = NULL;
|
||||
GList *list;
|
||||
GList *list;
|
||||
|
||||
if (! factory)
|
||||
return;
|
||||
@ -1557,27 +1555,20 @@ gimp_dialog_factory_set_busy (GimpDialogFactory *factory)
|
||||
|
||||
if (GTK_IS_WIDGET (widget) && gtk_widget_is_toplevel (widget))
|
||||
{
|
||||
if (!display || display != gtk_widget_get_display (widget))
|
||||
GdkWindow *window = gtk_widget_get_window (widget);
|
||||
|
||||
if (window)
|
||||
{
|
||||
display = gtk_widget_get_display (widget);
|
||||
|
||||
if (cursor)
|
||||
gdk_cursor_unref (cursor);
|
||||
|
||||
cursor = gimp_cursor_new (display,
|
||||
GIMP_HANDEDNESS_RIGHT,
|
||||
(GimpCursorType) GDK_WATCH,
|
||||
GIMP_TOOL_CURSOR_NONE,
|
||||
GIMP_CURSOR_MODIFIER_NONE);
|
||||
GdkCursor *cursor = gimp_cursor_new (window,
|
||||
GIMP_HANDEDNESS_RIGHT,
|
||||
(GimpCursorType) GDK_WATCH,
|
||||
GIMP_TOOL_CURSOR_NONE,
|
||||
GIMP_CURSOR_MODIFIER_NONE);
|
||||
gdk_window_set_cursor (window, cursor);
|
||||
gdk_cursor_unref (cursor);
|
||||
}
|
||||
|
||||
if (gtk_widget_get_window (widget))
|
||||
gdk_window_set_cursor (gtk_widget_get_window (widget), cursor);
|
||||
}
|
||||
}
|
||||
|
||||
if (cursor)
|
||||
gdk_cursor_unref (cursor);
|
||||
}
|
||||
|
||||
void
|
||||
@ -1594,8 +1585,10 @@ gimp_dialog_factory_unset_busy (GimpDialogFactory *factory)
|
||||
|
||||
if (GTK_IS_WIDGET (widget) && gtk_widget_is_toplevel (widget))
|
||||
{
|
||||
if (gtk_widget_get_window (widget))
|
||||
gdk_window_set_cursor (gtk_widget_get_window (widget), NULL);
|
||||
GdkWindow *window = gtk_widget_get_window (widget);
|
||||
|
||||
if (window)
|
||||
gdk_window_set_cursor (window, NULL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user