From 0ef4ecfccec1b618e21193a1ec2736e7a58864d1 Mon Sep 17 00:00:00 2001 From: g Date: Tue, 16 Sep 2003 19:53:20 +0000 Subject: [PATCH] The default cursor is no more the MOVE cursor. Small bugfixes when many buttons are pressed. git-svn-id: file:///srv/svn/gliv/trunk@87 dbf4865f-1ec6-0310-8412-f61adeb1ccb1 committer: g --- src/cursors.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/cursors.c b/src/cursors.c index f9e5bf9..c99952e 100644 --- a/src/cursors.c +++ b/src/cursors.c @@ -31,18 +31,19 @@ extern rt_struct *rt; extern options_struct *options; extern GtkWidget *gl_widget; -#define NB_CURSORS 5 +#define NB_CURSORS 6 /* Must be kept in sync with init_cursors(). */ typedef enum { - CURSOR_MOVE = 0, + CURSOR_DEFAULT = 0, + CURSOR_MOVE, CURSOR_ROTATE, CURSOR_ZOOM, CURSOR_ZOOM_ROTATE, CURSOR_RECT_ZOOM } cursor_type; -static cursor_type current_type = -1; +static cursor_type current_type = CURSOR_DEFAULT; static GdkCursor **cursors = NULL; static gboolean hide_cursor_enabled = TRUE; @@ -81,6 +82,7 @@ static void init_cursors(void) cursors = fill = g_new(GdkCursor *, NB_CURSORS); + *fill++ = NULL; MAKE_CURSOR(move); MAKE_CURSOR(rotate); MAKE_CURSOR(zoom); @@ -120,9 +122,6 @@ void show_cursor(void) if (cursors == NULL) init_cursors(); - if (current_type >= NB_CURSORS) - set_correct_cursor(); - rt->cursor_hidden = FALSE; gdk_window_set_cursor(gl_widget->window, cursors[current_type]); schedule_hide_cursor(); @@ -140,7 +139,7 @@ void set_correct_cursor(void) gdk_display_get_pointer(gdk_display_get_default(), NULL, NULL, NULL, &state); - if (state & GDK_BUTTON3_MASK) + if (state & GDK_BUTTON3_MASK && (state & GDK_BUTTON1_MASK) == 0) new_cursor = CURSOR_RECT_ZOOM; else if (state & GDK_SHIFT_MASK) { @@ -152,9 +151,12 @@ void set_correct_cursor(void) } else if (state & GDK_CONTROL_MASK) new_cursor = CURSOR_ROTATE; - else + else if (state & GDK_BUTTON1_MASK) new_cursor = CURSOR_MOVE; + else + new_cursor = CURSOR_DEFAULT; + if (new_cursor != current_type) { current_type = new_cursor; if (rt->cursor_hidden == FALSE) -- 2.11.4.GIT