Commit 5c2759af authored by Matthias Clasen's avatar Matthias Clasen

Use standard cursor names

This changes GTK+ to use gdk_cursor_new_from_name() with the
'standard' css names, instead of GdkCursorType.

https://bugzilla.gnome.org/show_bug.cgi?id=652085
parent b3fb1aef
...@@ -123,7 +123,7 @@ query_for_toplevel (GdkScreen *screen, ...@@ -123,7 +123,7 @@ query_for_toplevel (GdkScreen *screen,
gtk_container_add (GTK_CONTAINER (frame), label); gtk_container_add (GTK_CONTAINER (frame), label);
gtk_widget_show_all (popup); gtk_widget_show_all (popup);
cursor = gdk_cursor_new_for_display (display, GDK_CROSSHAIR); cursor = gdk_cursor_new_from_name (display, "crosshair");
if (gdk_device_grab (gtk_get_current_event_device (), if (gdk_device_grab (gtk_get_current_event_device (),
gtk_widget_get_window (popup), gtk_widget_get_window (popup),
......
...@@ -253,9 +253,11 @@ do_hypertext (GtkWidget *do_widget) ...@@ -253,9 +253,11 @@ do_hypertext (GtkWidget *do_widget)
GtkWidget *view; GtkWidget *view;
GtkWidget *sw; GtkWidget *sw;
GtkTextBuffer *buffer; GtkTextBuffer *buffer;
GdkDisplay *display;
hand_cursor = gdk_cursor_new_for_display (gtk_widget_get_display (do_widget), GDK_HAND2); display = gtk_widget_get_display (do_widget);
regular_cursor = gdk_cursor_new_for_display (gtk_widget_get_display (do_widget), GDK_XTERM); hand_cursor = gdk_cursor_new_from_name (display, "pointer");
regular_cursor = gdk_cursor_new_from_name (display, "text");
window = gtk_window_new (GTK_WINDOW_TOPLEVEL); window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_title (GTK_WINDOW (window), "Hypertext"); gtk_window_set_title (GTK_WINDOW (window), "Hypertext");
......
...@@ -804,8 +804,8 @@ gtk_about_dialog_realize (GtkWidget *widget) ...@@ -804,8 +804,8 @@ gtk_about_dialog_realize (GtkWidget *widget)
GTK_WIDGET_CLASS (gtk_about_dialog_parent_class)->realize (widget); GTK_WIDGET_CLASS (gtk_about_dialog_parent_class)->realize (widget);
display = gtk_widget_get_display (widget); display = gtk_widget_get_display (widget);
priv->hand_cursor = gdk_cursor_new_for_display (display, GDK_HAND2); priv->hand_cursor = gdk_cursor_new_from_name (display, "pointer");
priv->regular_cursor = gdk_cursor_new_for_display (display, GDK_XTERM); priv->regular_cursor = gdk_cursor_new_from_name (display, "text");
} }
static void static void
......
...@@ -196,8 +196,7 @@ set_cross_cursor (GtkWidget *widget, ...@@ -196,8 +196,7 @@ set_cross_cursor (GtkWidget *widget,
return; return;
if (enabled) if (enabled)
cursor = gdk_cursor_new_for_display (gtk_widget_get_display (GTK_WIDGET (widget)), cursor = gdk_cursor_new_from_name (gtk_widget_get_display (GTK_WIDGET (widget)), "crosshair");
GDK_CROSSHAIR);
gdk_window_set_device_cursor (window, device, cursor); gdk_window_set_device_cursor (window, device, cursor);
......
...@@ -3170,7 +3170,7 @@ update_cursors (GtkWidget *widget) ...@@ -3170,7 +3170,7 @@ update_cursors (GtkWidget *widget)
(icon_info->nonactivatable && icon_info->target_list == NULL))) (icon_info->nonactivatable && icon_info->target_list == NULL)))
{ {
display = gtk_widget_get_display (widget); display = gtk_widget_get_display (widget);
cursor = gdk_cursor_new_for_display (display, GDK_XTERM); cursor = gdk_cursor_new_from_name (display, "text");
gdk_window_set_cursor (icon_info->window, cursor); gdk_window_set_cursor (icon_info->window, cursor);
g_object_unref (cursor); g_object_unref (cursor);
} }
......
...@@ -4229,11 +4229,7 @@ set_busy_cursor (GtkFileChooserWidget *impl, ...@@ -4229,11 +4229,7 @@ set_busy_cursor (GtkFileChooserWidget *impl,
display = gtk_widget_get_display (widget); display = gtk_widget_get_display (widget);
if (busy) if (busy)
{ cursor = gdk_cursor_new_from_name (display, "progress");
cursor = gdk_cursor_new_from_name (display, "left_ptr_watch");
if (cursor == NULL)
cursor = gdk_cursor_new_for_display (display, GDK_WATCH);
}
else else
cursor = NULL; cursor = NULL;
......
...@@ -4080,9 +4080,9 @@ gtk_label_update_cursor (GtkLabel *label) ...@@ -4080,9 +4080,9 @@ gtk_label_update_cursor (GtkLabel *label)
display = gtk_widget_get_display (widget); display = gtk_widget_get_display (widget);
if (priv->select_info->active_link) if (priv->select_info->active_link)
cursor = gdk_cursor_new_for_display (display, GDK_HAND2); cursor = gdk_cursor_new_from_name (display, "pointer");
else if (priv->select_info->selectable) else if (priv->select_info->selectable)
cursor = gdk_cursor_new_for_display (display, GDK_XTERM); cursor = gdk_cursor_new_from_name (display, "text");
else else
cursor = NULL; cursor = NULL;
} }
......
...@@ -298,7 +298,7 @@ set_hand_cursor (GtkWidget *widget, ...@@ -298,7 +298,7 @@ set_hand_cursor (GtkWidget *widget,
cursor = NULL; cursor = NULL;
if (show_hand) if (show_hand)
cursor = gdk_cursor_new_for_display (display, GDK_HAND2); cursor = gdk_cursor_new_from_name (display, "pointer");
gdk_window_set_cursor (gtk_widget_get_window (widget), cursor); gdk_window_set_cursor (gtk_widget_get_window (widget), cursor);
gdk_display_flush (display); gdk_display_flush (display);
......
...@@ -109,7 +109,6 @@ struct _GtkPanedPrivate ...@@ -109,7 +109,6 @@ struct _GtkPanedPrivate
GtkWidget *saved_focus; GtkWidget *saved_focus;
GtkOrientation orientation; GtkOrientation orientation;
GdkCursorType cursor_type;
GdkRectangle handle_pos; GdkRectangle handle_pos;
GdkWindow *handle; GdkWindow *handle;
...@@ -787,7 +786,6 @@ gtk_paned_init (GtkPaned *paned) ...@@ -787,7 +786,6 @@ gtk_paned_init (GtkPaned *paned)
priv = paned->priv; priv = paned->priv;
priv->orientation = GTK_ORIENTATION_HORIZONTAL; priv->orientation = GTK_ORIENTATION_HORIZONTAL;
priv->cursor_type = GDK_SB_H_DOUBLE_ARROW;
priv->child1 = NULL; priv->child1 = NULL;
priv->child2 = NULL; priv->child2 = NULL;
...@@ -841,17 +839,11 @@ gtk_paned_set_property (GObject *object, ...@@ -841,17 +839,11 @@ gtk_paned_set_property (GObject *object,
_gtk_orientable_set_style_classes (GTK_ORIENTABLE (paned)); _gtk_orientable_set_style_classes (GTK_ORIENTABLE (paned));
if (priv->orientation == GTK_ORIENTATION_HORIZONTAL) if (priv->orientation == GTK_ORIENTATION_HORIZONTAL)
{ gtk_gesture_pan_set_orientation (GTK_GESTURE_PAN (priv->pan_gesture),
priv->cursor_type = GDK_SB_H_DOUBLE_ARROW; GTK_ORIENTATION_HORIZONTAL);
gtk_gesture_pan_set_orientation (GTK_GESTURE_PAN (priv->pan_gesture),
GTK_ORIENTATION_HORIZONTAL);
}
else else
{ gtk_gesture_pan_set_orientation (GTK_GESTURE_PAN (priv->pan_gesture),
priv->cursor_type = GDK_SB_V_DOUBLE_ARROW; GTK_ORIENTATION_VERTICAL);
gtk_gesture_pan_set_orientation (GTK_GESTURE_PAN (priv->pan_gesture),
GTK_ORIENTATION_VERTICAL);
}
/* state_flags_changed updates the cursor */ /* state_flags_changed updates the cursor */
gtk_paned_state_flags_changed (GTK_WIDGET (paned), 0); gtk_paned_state_flags_changed (GTK_WIDGET (paned), 0);
...@@ -1609,8 +1601,9 @@ gtk_paned_realize (GtkWidget *widget) ...@@ -1609,8 +1601,9 @@ gtk_paned_realize (GtkWidget *widget)
attributes_mask = GDK_WA_X | GDK_WA_Y; attributes_mask = GDK_WA_X | GDK_WA_Y;
if (gtk_widget_is_sensitive (widget)) if (gtk_widget_is_sensitive (widget))
{ {
attributes.cursor = gdk_cursor_new_for_display (gtk_widget_get_display (widget), attributes.cursor = gdk_cursor_new_from_name (gtk_widget_get_display (widget),
priv->cursor_type); priv->orientation == GTK_ORIENTATION_HORIZONTAL
? "col-resize" : "row-resize");
attributes_mask |= GDK_WA_CURSOR; attributes_mask |= GDK_WA_CURSOR;
} }
...@@ -1884,8 +1877,9 @@ gtk_paned_state_flags_changed (GtkWidget *widget, ...@@ -1884,8 +1877,9 @@ gtk_paned_state_flags_changed (GtkWidget *widget,
if (gtk_widget_get_realized (widget)) if (gtk_widget_get_realized (widget))
{ {
if (gtk_widget_is_sensitive (widget)) if (gtk_widget_is_sensitive (widget))
cursor = gdk_cursor_new_for_display (gtk_widget_get_display (widget), cursor = gdk_cursor_new_from_name (gtk_widget_get_display (widget),
priv->cursor_type); priv->orientation == GTK_ORIENTATION_HORIZONTAL
? "col-resize" : "row-resize");
else else
cursor = NULL; cursor = NULL;
......
...@@ -584,11 +584,7 @@ set_busy_cursor (GtkPrintUnixDialog *dialog, ...@@ -584,11 +584,7 @@ set_busy_cursor (GtkPrintUnixDialog *dialog,
display = gtk_widget_get_display (widget); display = gtk_widget_get_display (widget);
if (busy) if (busy)
{ cursor = gdk_cursor_new_from_name (display, "progress");
cursor = gdk_cursor_new_from_name (display, "left_ptr_watch");
if (cursor == NULL)
cursor = gdk_cursor_new_for_display (display, GDK_WATCH);
}
else else
cursor = NULL; cursor = NULL;
......
...@@ -697,11 +697,7 @@ set_busy_cursor (GtkRecentChooserDefault *impl, ...@@ -697,11 +697,7 @@ set_busy_cursor (GtkRecentChooserDefault *impl,
display = gtk_widget_get_display (GTK_WIDGET (toplevel)); display = gtk_widget_get_display (GTK_WIDGET (toplevel));
if (busy) if (busy)
{ cursor = gdk_cursor_new_from_name (display, "progress");
cursor = gdk_cursor_new_from_name (display, "left_ptr_watch");
if (cursor == NULL)
cursor = gdk_cursor_new_for_display (display, GDK_WATCH);
}
else else
cursor = NULL; cursor = NULL;
......
...@@ -4488,7 +4488,7 @@ gtk_text_view_state_flags_changed (GtkWidget *widget, ...@@ -4488,7 +4488,7 @@ gtk_text_view_state_flags_changed (GtkWidget *widget,
if (gtk_widget_get_realized (widget)) if (gtk_widget_get_realized (widget))
{ {
if (gtk_widget_is_sensitive (widget)) if (gtk_widget_is_sensitive (widget))
cursor = gdk_cursor_new_for_display (gtk_widget_get_display (widget), GDK_XTERM); cursor = gdk_cursor_new_from_name (gtk_widget_get_display (widget), "text");
else else
cursor = NULL; cursor = NULL;
...@@ -4516,7 +4516,7 @@ set_invisible_cursor (GdkWindow *window) ...@@ -4516,7 +4516,7 @@ set_invisible_cursor (GdkWindow *window)
GdkCursor *cursor; GdkCursor *cursor;
display = gdk_window_get_display (window); display = gdk_window_get_display (window);
cursor = gdk_cursor_new_for_display (display, GDK_BLANK_CURSOR); cursor = gdk_cursor_new_from_name (display, "none");
gdk_window_set_cursor (window, cursor); gdk_window_set_cursor (window, cursor);
...@@ -4539,10 +4539,11 @@ gtk_text_view_unobscure_mouse_cursor (GtkTextView *text_view) ...@@ -4539,10 +4539,11 @@ gtk_text_view_unobscure_mouse_cursor (GtkTextView *text_view)
{ {
if (text_view->priv->mouse_cursor_obscured) if (text_view->priv->mouse_cursor_obscured)
{ {
GdkDisplay *display;
GdkCursor *cursor; GdkCursor *cursor;
cursor = gdk_cursor_new_for_display (gtk_widget_get_display (GTK_WIDGET (text_view)), display = gtk_widget_get_display (GTK_WIDGET (text_view));
GDK_XTERM); cursor = gdk_cursor_new_from_name (display, "text");
gdk_window_set_cursor (text_view->priv->text_window->bin_window, cursor); gdk_window_set_cursor (text_view->priv->text_window->bin_window, cursor);
g_object_unref (cursor); g_object_unref (cursor);
text_view->priv->mouse_cursor_obscured = FALSE; text_view->priv->mouse_cursor_obscured = FALSE;
...@@ -9433,6 +9434,7 @@ text_window_realize (GtkTextWindow *win, ...@@ -9433,6 +9434,7 @@ text_window_realize (GtkTextWindow *win,
GdkWindow *window; GdkWindow *window;
GdkWindowAttr attributes; GdkWindowAttr attributes;
gint attributes_mask; gint attributes_mask;
GdkDisplay *display;
GdkCursor *cursor; GdkCursor *cursor;
attributes.window_type = GDK_WINDOW_CHILD; attributes.window_type = GDK_WINDOW_CHILD;
...@@ -9485,12 +9487,11 @@ text_window_realize (GtkTextWindow *win, ...@@ -9485,12 +9487,11 @@ text_window_realize (GtkTextWindow *win,
case GTK_TEXT_WINDOW_TEXT: case GTK_TEXT_WINDOW_TEXT:
if (gtk_widget_is_sensitive (widget)) if (gtk_widget_is_sensitive (widget))
{ {
/* I-beam cursor */ display = gdk_window_get_display (window);
cursor = gdk_cursor_new_for_display (gdk_window_get_display (window), cursor = gdk_cursor_new_from_name (display, "text");
GDK_XTERM);
gdk_window_set_cursor (win->bin_window, cursor); gdk_window_set_cursor (win->bin_window, cursor);
g_object_unref (cursor); g_object_unref (cursor);
} }
gtk_im_context_set_client_window (GTK_TEXT_VIEW (widget)->priv->im_context, gtk_im_context_set_client_window (GTK_TEXT_VIEW (widget)->priv->im_context,
win->window); win->window);
......
...@@ -1342,6 +1342,7 @@ _gtk_tree_view_column_realize_button (GtkTreeViewColumn *column) ...@@ -1342,6 +1342,7 @@ _gtk_tree_view_column_realize_button (GtkTreeViewColumn *column)
GdkWindowAttr attr; GdkWindowAttr attr;
guint attributes_mask; guint attributes_mask;
gboolean rtl; gboolean rtl;
GdkDisplay *display;
tree_view = (GtkTreeView *)priv->tree_view; tree_view = (GtkTreeView *)priv->tree_view;
rtl = (gtk_widget_get_direction (priv->tree_view) == GTK_TEXT_DIR_RTL); rtl = (gtk_widget_get_direction (priv->tree_view) == GTK_TEXT_DIR_RTL);
...@@ -1362,8 +1363,8 @@ _gtk_tree_view_column_realize_button (GtkTreeViewColumn *column) ...@@ -1362,8 +1363,8 @@ _gtk_tree_view_column_realize_button (GtkTreeViewColumn *column)
GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_MASK |
GDK_KEY_PRESS_MASK); GDK_KEY_PRESS_MASK);
attributes_mask = GDK_WA_CURSOR | GDK_WA_X | GDK_WA_Y; attributes_mask = GDK_WA_CURSOR | GDK_WA_X | GDK_WA_Y;
attr.cursor = gdk_cursor_new_for_display display = gdk_window_get_display (_gtk_tree_view_get_header_window (tree_view));
(gdk_window_get_display (_gtk_tree_view_get_header_window (tree_view)), GDK_SB_H_DOUBLE_ARROW); attr.cursor = gdk_cursor_new_from_name (display, "col-resize");
attr.y = 0; attr.y = 0;
attr.width = TREE_VIEW_DRAG_WIDTH; attr.width = TREE_VIEW_DRAG_WIDTH;
attr.height = _gtk_tree_view_get_header_height (tree_view); attr.height = _gtk_tree_view_get_header_height (tree_view);
......
...@@ -7172,15 +7172,10 @@ gtk_window_realize (GtkWidget *widget) ...@@ -7172,15 +7172,10 @@ gtk_window_realize (GtkWidget *widget)
if (priv->client_decorated && priv->type == GTK_WINDOW_TOPLEVEL) if (priv->client_decorated && priv->type == GTK_WINDOW_TOPLEVEL)
{ {
GdkCursorType cursor_type[8] = { const gchar *cursor[8] = {
GDK_TOP_LEFT_CORNER, "nw-resize", "n-resize", "ne-resize",
GDK_TOP_SIDE, "w-resize", "e-resize",
GDK_TOP_RIGHT_CORNER, "sw-resize", "s-resize", "se-resize"
GDK_LEFT_SIDE,
GDK_RIGHT_SIDE,
GDK_BOTTOM_LEFT_CORNER,
GDK_BOTTOM_SIDE,
GDK_BOTTOM_RIGHT_CORNER
}; };
attributes.wclass = GDK_INPUT_ONLY; attributes.wclass = GDK_INPUT_ONLY;
...@@ -7191,7 +7186,7 @@ gtk_window_realize (GtkWidget *widget) ...@@ -7191,7 +7186,7 @@ gtk_window_realize (GtkWidget *widget)
for (i = 0; i < 8; i++) for (i = 0; i < 8; i++)
{ {
attributes.cursor = gdk_cursor_new_for_display (gtk_widget_get_display (widget), cursor_type[i]); attributes.cursor = gdk_cursor_new_from_name (gtk_widget_get_display (widget), cursor[i]);
priv->border_window[i] = gdk_window_new (gdk_window, &attributes, attributes_mask); priv->border_window[i] = gdk_window_new (gdk_window, &attributes, attributes_mask);
g_object_unref (attributes.cursor); g_object_unref (attributes.cursor);
......
...@@ -376,7 +376,7 @@ gtk_inspector_on_inspect (GtkWidget *button, ...@@ -376,7 +376,7 @@ gtk_inspector_on_inspect (GtkWidget *button,
} }
display = gdk_display_get_default (); display = gdk_display_get_default ();
cursor = gdk_cursor_new_for_display (display, GDK_CROSSHAIR); cursor = gdk_cursor_new_from_name (display, "crosshair");
device = gdk_device_manager_get_client_pointer (gdk_display_get_device_manager (display)); device = gdk_device_manager_get_client_pointer (gdk_display_get_device_manager (display));
status = gdk_device_grab (device, status = gdk_device_grab (device,
gtk_widget_get_window (iw->invisible), gtk_widget_get_window (iw->invisible),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment