示例#1
0
void
gimp_cursor_set (GtkWidget          *widget,
                 GimpHandedness      cursor_handedness,
                 GimpCursorType      cursor_type,
                 GimpToolCursorType  tool_cursor,
                 GimpCursorModifier  modifier)
{
  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),
                            cursor_handedness,
                            cursor_type,
                            tool_cursor,
                            modifier);
  gdk_window_set_cursor (gtk_widget_get_window (widget), cursor);
  gdk_cursor_unref (cursor);

  gdk_display_flush (gtk_widget_get_display (widget));
}
示例#2
0
static void
gimp_dialog_factories_set_busy_foreach (gconstpointer      key,
                                        GimpDialogFactory *factory,
                                        gpointer           data)
{
  GdkDisplay *display = NULL;
  GdkCursor  *cursor  = NULL;
  GList      *list;

  for (list = factory->open_dialogs; list; list = g_list_next (list))
    {
      GtkWidget *widget = list->data;

      if (GTK_IS_WIDGET (widget) && GTK_WIDGET_TOPLEVEL (widget))
        {
          if (!display || display != gtk_widget_get_display (widget))
            {
              display = gtk_widget_get_display (widget);

              if (cursor)
                gdk_cursor_unref (cursor);

              cursor = gimp_cursor_new (display,
                                        GIMP_CURSOR_FORMAT_BITMAP,
                                        GDK_WATCH,
                                        GIMP_TOOL_CURSOR_NONE,
                                        GIMP_CURSOR_MODIFIER_NONE);
            }

          if (widget->window)
            gdk_window_set_cursor (widget->window, cursor);
        }
    }

  if (cursor)
    gdk_cursor_unref (cursor);
}