diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2010-07-05 20:42:42 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2010-07-05 20:42:42 +0400 |
commit | 59b8f8d18c8d8f4a29c1dc70a4faa707118bd632 (patch) | |
tree | 0d37e637d3d91fe07ed6238abbbe2c5986ea97dd /source/blender/windowmanager | |
parent | e738c731c2f3d3dca58656715fcaa724e0ed27b5 (diff) |
Fix #21201: double click didn't use the original mouse position, now
it stores it and sets it later when the double click event is handled.
Decided to not reuse prevx but made prevclickx, because there may be
multiple mousemoves between the two clicks, and prevx is already used
for some other tricky things.
Diffstat (limited to 'source/blender/windowmanager')
-rw-r--r-- | source/blender/windowmanager/WM_types.h | 1 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_event_system.c | 6 |
2 files changed, 7 insertions, 0 deletions
diff --git a/source/blender/windowmanager/WM_types.h b/source/blender/windowmanager/WM_types.h index 927ea00ae37..c84a5e64889 100644 --- a/source/blender/windowmanager/WM_types.h +++ b/source/blender/windowmanager/WM_types.h @@ -326,6 +326,7 @@ typedef struct wmEvent { short prevval; short prevx, prevy; double prevclicktime; + short prevclickx, prevclicky; /* modifier states */ short shift, ctrl, alt, oskey; /* oskey is apple or windowskey, value denotes order of pressed */ diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c index 8355684ac75..b01d2b27364 100644 --- a/source/blender/windowmanager/intern/wm_event_system.c +++ b/source/blender/windowmanager/intern/wm_event_system.c @@ -1433,6 +1433,8 @@ static int wm_handlers_do(bContext *C, wmEvent *event, ListBase *handlers) /* test for double click first */ if ((PIL_check_seconds_timer() - win->eventstate->prevclicktime) * 1000 < U.dbl_click_time) { event->val = KM_DBL_CLICK; + event->x = win->eventstate->prevclickx; + event->y = win->eventstate->prevclicky; action |= wm_handlers_do(C, event, handlers); } @@ -1719,6 +1721,8 @@ void wm_event_do_handlers(bContext *C) /* set click time on first click (press -> release) */ if (win->eventstate->prevval == KM_PRESS && event->val == KM_RELEASE) { win->eventstate->prevclicktime = PIL_check_seconds_timer(); + win->eventstate->prevclickx = event->x; + win->eventstate->prevclicky = event->y; } } else { /* reset click time if event type not the same */ @@ -1731,6 +1735,8 @@ void wm_event_do_handlers(bContext *C) win->eventstate->prevtype = event->type; win->eventstate->prevval = event->val; win->eventstate->prevclicktime = PIL_check_seconds_timer(); + win->eventstate->prevclickx = event->x; + win->eventstate->prevclicky = event->y; } else { /* reset if not */ win->eventstate->prevtype = -1; win->eventstate->prevval = 0; |