GUI: All controls are now 'sticky', ie. when you're dragging a slider/scroller and you move the mouse too far, it no longer activate other buttons. (Issue 191)

git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@918 416bcca6-2ee7-4201-b75f-2eb2f807beb1
This commit is contained in:
Yves Rizoud
2009-07-13 19:10:48 +00:00
parent 7bde7d90ce
commit 77728125fb
3 changed files with 151 additions and 62 deletions

12
input.c
View File

@@ -31,6 +31,8 @@
void Handle_window_resize(SDL_ResizeEvent event);
void Handle_window_exit(SDL_QuitEvent event);
int Input_sticky_control = 0;
byte Directional_up;
byte Directional_up_right;
byte Directional_right;
@@ -155,8 +157,14 @@ int Move_cursor_with_constraints()
(Input_new_mouse_Y != Mouse_Y) ||
(Input_new_mouse_K != Mouse_K))
{
// On every change of mouse state
if ((Input_new_mouse_K != Mouse_K))
feedback=1;
{
feedback=1;
if (Input_new_mouse_K == 0)
Input_sticky_control = 0;
}
Hide_cursor(); // On efface le curseur AVANT de le déplacer...
if (Input_new_mouse_X != Mouse_X || Input_new_mouse_Y != Mouse_Y)
{
@@ -298,6 +306,8 @@ int Handle_mouse_release(SDL_MouseButtonEvent event)
Input_new_mouse_K &= ~2;
break;
}
Input_sticky_control = -1;
return Move_cursor_with_constraints();
}