Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorElia Sarti <vekoon@gmail.com>2009-07-25 19:26:06 +0400
committerElia Sarti <vekoon@gmail.com>2009-07-25 19:26:06 +0400
commit24d39c0de496cb8c3640564757cae2c383efa154 (patch)
treeb7f7f0c5c168ac00da14404893e7bab62769a130 /source/blender/windowmanager
parent5b12cb937890f1f85f365b4b1658cef241384ea2 (diff)
2.5 / Drag & Drop
Commit of basic architecture. Sorry, nothing fun to play with yet. Added two events: MOUSEDRAG and MOUSEDROP. MOUSEDRAG is sent when left-mouse clicking and then moving the cursor and every time the cursor is moved until the user releases the mouse button, thus generating a MOUSEDROP. Also added two dummy drag operators in view3d and outliner (place holders for now). Brecht and Ton: feel free to check/edit especially the event system code. I'm not sure that's the right way to do it. Also, I'm getting some mem leaks which I suspect are caused by my code.
Diffstat (limited to 'source/blender/windowmanager')
-rw-r--r--source/blender/windowmanager/intern/wm_event_system.c30
-rw-r--r--source/blender/windowmanager/wm_event_types.h3
2 files changed, 33 insertions, 0 deletions
diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c
index 7f40ec401a8..78c7f7a7383 100644
--- a/source/blender/windowmanager/intern/wm_event_system.c
+++ b/source/blender/windowmanager/intern/wm_event_system.c
@@ -1435,6 +1435,19 @@ void wm_event_add_ghostevent(wmWindow *win, int type, void *customdata)
update_tablet_data(win, &event);
wm_event_add(win, &event);
+
+ 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)) {
+ wmEvent dragevt= *evt;
+ dragevt.type= MOUSEDRAG;
+ dragevt.customdata= NULL;
+ dragevt.customdatafree= 0;
+
+ wm_event_add(win, &dragevt);
+ }
}
break;
}
@@ -1458,6 +1471,23 @@ void wm_event_add_ghostevent(wmWindow *win, int type, void *customdata)
update_tablet_data(win, &event);
wm_event_add(win, &event);
+
+ if (event.val) {
+ win->downstate= event.type;
+ win->downx= event.x;
+ win->downy= event.y;
+ }
+ else if (win->downstate) {
+ wmEvent dropevt= *evt;
+ dropevt.type= MOUSEDROP;
+ dropevt.customdata= NULL;
+ dropevt.customdatafree= 0;
+ win->downstate= 0;
+ win->downx= 0;
+ win->downy= 0;
+
+ wm_event_add(win, &dropevt);
+ }
break;
}
diff --git a/source/blender/windowmanager/wm_event_types.h b/source/blender/windowmanager/wm_event_types.h
index 6f64cdbde32..6e7186542de 100644
--- a/source/blender/windowmanager/wm_event_types.h
+++ b/source/blender/windowmanager/wm_event_types.h
@@ -56,6 +56,9 @@
/* only use if you want user option switch possible */
#define ACTIONMOUSE 0x005
#define SELECTMOUSE 0x006
+ /* drag & drop support */
+#define MOUSEDRAG 0x007
+#define MOUSEDROP 0x008
/* defaults from ghost */
#define WHEELUPMOUSE 0x00a
#define WHEELDOWNMOUSE 0x00b