<URL: http://bugs.freeciv.org/Ticket/Display.html?id=33399 >
> [dmarks - Fr 12. Jan 2007, 14:28:33]:
>
> Running the SDL client on a recent dev snapshot:
>
> To recreate bug, select a unit, then left click and drag pointer to
> goto target. When you release mouse button, nothing happens and you
> will have to click one more time to execute goto.
>
> Is this the intended behavior?
>
> Also reported by mzet on IRC.
>
> ~Daniel
>
Patch attached.
Index: client/gui-sdl/gui_main.c
===================================================================
--- client/gui-sdl/gui_main.c (Revision 12506)
+++ client/gui-sdl/gui_main.c (Arbeitskopie)
@@ -327,8 +327,9 @@
#ifdef UNDER_CE
if (!check_scroll_area(pButtonEvent->x, pButtonEvent->y)) {
#endif
- if (!button_behavior.button_down_ticks) {
+ if (!button_behavior.counting) {
/* start counting */
+ button_behavior.counting = TRUE;
button_behavior.button_down_ticks = SDL_GetTicks();
*button_behavior.event = *pButtonEvent;
button_behavior.hold_state = MB_HOLD_SHORT;
@@ -349,6 +350,7 @@
button_up_on_map(&button_behavior);
}
+ button_behavior.counting = FALSE;
button_behavior.button_down_ticks = 0;
#ifdef UNDER_CE
@@ -374,7 +376,7 @@
ptile = canvas_pos_to_tile(pMotionEvent->x, pMotionEvent->y);
if ((ptile->x != button_behavior.ptile->x)
|| (ptile->y != button_behavior.ptile->y)) {
- button_behavior.button_down_ticks = 0;
+ button_behavior.counting = FALSE;
}
}
@@ -410,7 +412,7 @@
static void update_button_hold_state(void)
{
/* button pressed */
- if (button_behavior.button_down_ticks) {
+ if (button_behavior.counting) {
if (((SDL_GetTicks() - button_behavior.button_down_ticks) >= MB_MEDIUM_HOLD_DELAY)
&& ((SDL_GetTicks() - button_behavior.button_down_ticks) < MB_LONG_HOLD_DELAY)) {
@@ -749,6 +751,7 @@
SDL_Surface *pBgd;
Uint32 iSDL_Flags;
+ button_behavior.counting = FALSE;
button_behavior.button_down_ticks = 0;
button_behavior.hold_state = MB_HOLD_SHORT;
button_behavior.event = fc_calloc(1, sizeof(SDL_MouseButtonEvent));
Index: client/gui-sdl/gui_main.h
===================================================================
--- client/gui-sdl/gui_main.h (Revision 12506)
+++ client/gui-sdl/gui_main.h (Arbeitskopie)
@@ -66,6 +66,7 @@
};
struct mouse_button_behavior {
+ bool counting;
Uint32 button_down_ticks;
enum mouse_button_hold_state hold_state;
SDL_MouseButtonEvent *event;
_______________________________________________
Freeciv-dev mailing list
[email protected]
https://mail.gna.org/listinfo/freeciv-dev