mirror of
https://gitlab.gnome.org/GNOME/gimp.git
synced 2025-07-03 17:33:25 +00:00
app: pass a GdkWindow not GdkDisplay to gimp_cursor_new()
Preparation for adding HiDPI cursors.
This commit is contained in:
parent
3738ff3ffd
commit
47ff7e1467
3 changed files with 27 additions and 28 deletions
|
@ -243,21 +243,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);
|
||||
|
||||
|
@ -411,20 +414,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);
|
||||
g_object_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,
|
||||
|
|
|
@ -1553,9 +1553,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;
|
||||
|
@ -1566,27 +1564,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)
|
||||
g_object_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);
|
||||
g_object_unref (cursor);
|
||||
}
|
||||
|
||||
if (gtk_widget_get_window (widget))
|
||||
gdk_window_set_cursor (gtk_widget_get_window (widget), cursor);
|
||||
}
|
||||
}
|
||||
|
||||
if (cursor)
|
||||
g_object_unref (cursor);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -1603,8 +1594,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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue