[aisleriot] sol: Prefer CSS cursors
- From: Christian Persch <chpe src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [aisleriot] sol: Prefer CSS cursors
- Date: Mon, 17 Oct 2016 16:28:23 +0000 (UTC)
commit 44a6a1001752ab1dde5f7b0b63c4058b383e8516
Author: Trever Adams <trever middleearth sapphiresunday org>
Date: Mon Oct 17 18:27:57 2016 +0200
sol: Prefer CSS cursors
Try the CSS cursor names first.
On wayland, gdk_cursor_new_from_name incorrectly never returns a NULL
cursor for nonexisting names, so we need to try the most-likely-existing
cursor name first.
https://bugzilla.gnome.org/show_bug.cgi?id=772966
https://bugzilla.redhat.com/show_bug.cgi?id=1352244
src/ar-cursor.c | 18 ++++++++++++++----
src/board-noclutter.c | 12 +++++++-----
2 files changed, 21 insertions(+), 9 deletions(-)
---
diff --git a/src/ar-cursor.c b/src/ar-cursor.c
index ac64f21..501722c 100644
--- a/src/ar-cursor.c
+++ b/src/ar-cursor.c
@@ -220,20 +220,30 @@ GdkCursor *ar_cursor_new (GdkDisplay *display,
GdkCursor *cursor;
switch (cursor_type) {
+ case AR_CURSOR_DEFAULT:
+ if ((cursor = gdk_cursor_new_from_name (display, "default")))
+ return cursor;
+ return gdk_cursor_new_for_display (display, GDK_LEFT_PTR);
+
case AR_CURSOR_OPEN:
- if ((cursor = gdk_cursor_new_from_name (display, "openhand")))
+ if ((cursor = gdk_cursor_new_from_name (display, "grab")))
return cursor;
- if ((cursor = gdk_cursor_new_from_name (display, "hand1")))
+ if ((cursor = gdk_cursor_new_from_name (display, "openhand")))
return cursor;
return ar_cursor_new_from_data (display, hand_open_data, sizeof (hand_open_data));
case AR_CURSOR_CLOSED:
- if ((cursor = gdk_cursor_new_from_name (display, "closedhand")))
- return cursor;
if ((cursor = gdk_cursor_new_from_name (display, "grabbing")))
return cursor;
+ if ((cursor = gdk_cursor_new_from_name (display, "closedhand")))
+ return cursor;
return ar_cursor_new_from_data (display, hand_closed_data, sizeof (hand_closed_data));
+ case AR_CURSOR_DROPPABLE:
+ if ((cursor = gdk_cursor_new_from_name (display, "crosshair")))
+ return cursor;
+ return gdk_cursor_new_for_display (display, GDK_DOUBLE_ARROW); /* FIXMEchpe: better cursor */
+
default:
g_assert_not_reached ();
}
diff --git a/src/board-noclutter.c b/src/board-noclutter.c
index a418b3d..e8952a0 100644
--- a/src/board-noclutter.c
+++ b/src/board-noclutter.c
@@ -220,7 +220,7 @@ set_cursor_by_location (AisleriotBoard *board,
get_slot_and_card_from_point (board, x, y, &slot, &card_id);
- if (priv->click_to_move &&
+ if (priv->click_status == STATUS_IS_DRAG &&
slot != NULL &&
selection_slot != NULL &&
slot != selection_slot &&
@@ -2180,10 +2180,10 @@ aisleriot_board_realize (GtkWidget *widget)
display = gtk_widget_get_display (widget);
/* Create cursors */
- priv->cursor[AR_CURSOR_DEFAULT] = gdk_cursor_new_for_display (display, GDK_LEFT_PTR);
+ priv->cursor[AR_CURSOR_DEFAULT] = ar_cursor_new (display, AR_CURSOR_DEFAULT);
priv->cursor[AR_CURSOR_OPEN] = ar_cursor_new (display, AR_CURSOR_OPEN);
priv->cursor[AR_CURSOR_CLOSED] = ar_cursor_new (display, AR_CURSOR_CLOSED);
- priv->cursor[AR_CURSOR_DROPPABLE] = gdk_cursor_new_for_display (display, GDK_DOUBLE_ARROW); /* FIXMEchpe:
better cursor */
+ priv->cursor[AR_CURSOR_DROPPABLE] = ar_cursor_new (display, AR_CURSOR_DROPPABLE);
aisleriot_board_setup_geometry (board);
}
@@ -2765,8 +2765,10 @@ aisleriot_board_motion_notify (GtkWidget *widget,
cairo_region_union_rectangle (region, &mslot->rect);
gtk_widget_queue_draw_region (widget, region);
cairo_region_destroy (region);
-
- set_cursor (board, AR_CURSOR_CLOSED);
+ if (!slot)
+ set_cursor (board, AR_CURSOR_CLOSED);
+ else
+ set_cursor (board, AR_CURSOR_DROPPABLE);
} else if (priv->click_status == STATUS_MAYBE_DRAG &&
gtk_drag_check_threshold (widget,
priv->last_click_x,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]