diff options
author | Elia Sarti <vekoon@gmail.com> | 2009-07-27 22:26:48 +0400 |
---|---|---|
committer | Elia Sarti <vekoon@gmail.com> | 2009-07-27 22:26:48 +0400 |
commit | 324187b61a92c0c02c0e528a3f918ea73345a28e (patch) | |
tree | aa69d6d3c435e64dd9460bca56f2766674142752 /source/blender/windowmanager | |
parent | 9dc819a56d72cbdbd45994472fe85d3c3dcd8338 (diff) |
2.5 / Drag & Drop
Small tweak for MOUSEDRAG/DROP event generation
Diffstat (limited to 'source/blender/windowmanager')
-rw-r--r-- | source/blender/windowmanager/intern/wm_event_system.c | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c index 2a1fc009baa..d8e904b7c54 100644 --- a/source/blender/windowmanager/intern/wm_event_system.c +++ b/source/blender/windowmanager/intern/wm_event_system.c @@ -1441,13 +1441,17 @@ void wm_event_add_ghostevent(wmWindow *win, int type, void *customdata) cx = abs((win->downx - event.x)); cy = abs((win->downy - event.y)); - /* probably minimum drag size should be #defined instead of hardcoded 3 */ - if (win->downstate == LEFTMOUSE && (cx > 3 || cy > 3)) { + /* probably minimum drag size should be #defined instead of hardcoded 3 + * also, cy seems always to be 6 pixels off, not sure why + */ + if ((win->downstate == LEFTMOUSE || win->downstate == MOUSEDRAG) && (cx > 3 || cy > 9)) { wmEvent dragevt= *evt; dragevt.type= MOUSEDRAG; dragevt.customdata= NULL; dragevt.customdatafree= 0; + win->downstate= MOUSEDRAG; + wm_event_add(win, &dragevt); } } @@ -1479,16 +1483,21 @@ void wm_event_add_ghostevent(wmWindow *win, int type, void *customdata) win->downx= event.x; win->downy= event.y; } - else if (win->downstate) { - wmEvent dropevt= *evt; - dropevt.type= MOUSEDROP; - dropevt.customdata= NULL; - dropevt.customdatafree= 0; + else { + short downstate= win->downstate; + win->downstate= 0; win->downx= 0; win->downy= 0; - wm_event_add(win, &dropevt); + if (downstate == MOUSEDRAG) { + wmEvent dropevt= *evt; + dropevt.type= MOUSEDROP; + dropevt.customdata= NULL; + dropevt.customdatafree= 0; + + wm_event_add(win, &dropevt); + } } break; |