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:
authorTon Roosendaal <ton@blender.org>2010-01-26 21:18:21 +0300
committerTon Roosendaal <ton@blender.org>2010-01-26 21:18:21 +0300
commitb119ce5fcc91466c6aeb1232e8bf4dca401adaed (patch)
tree1e3e7d0fde9aaaf1d4f622c518795c3aa9a366b0 /source/blender/windowmanager
parent722f57ca75a7c4fb77e07d9ee43d5ea79c02c04b (diff)
Drag and drop 2.5 integration! Finally, slashdot regulars can use
Blender too now! :) ** Drag works as follows: - drag-able items are defined by the standard interface ui toolkit - each button can get this feature, via uiButSetDragXXX(but, ...). There are calls to define drag-able images, ID blocks, RNA paths, file paths, and so on. By default you drag an icon, exceptionally an ImBuf - Drag items are registered centrally in the WM, it allows more drag items simultaneous too, but not implemented ** Drop works as follows: - On mouse release, and if drag items exist in the WM, it converts the mouse event to an EVT_DROP type. This event then gets the full drag info as customdata - drop regions are defined with WM_dropbox_add(), similar to keymaps you can make a "drop map" this way, which become 'drop map handlers' in the queues. - next to that the UI kit handles some common button types (like accepting ID or names) to be catching a drop event too. - Every "drop box" has two callbacks: - poll() = check if the event drag data is relevant for this box - copy() = fill in custom properties in the dropbox to initialize an operator - The dropbox handler then calls its standard Operator with its dropbox properties. ** Currently implemented Drag items: - ID icons in browse buttons - ID icons in context menu of properties region - ID icons in outliner and rna viewer - FileBrowser icons - FileBrowser preview images Drag-able icons are subtly visualized by making them brighter a bit on mouse-over. In case the icon is a button or UI element too (most cases), the drag-able feature will make the item react to mouse-release instead of mouse-press. Drop options: - UI buttons: ID and text buttons (paste name) - View3d: Object ID drop copies object - View3d: Material ID drop assigns to object under cursor - View3d: Image ID drop assigns to object UV texture under cursor - Sequencer: Path drop will add either Image or Movie strip - Image window: Path drop will open image ** Drag and drop Notes: - Dropping into another Blender window (from same application) works too. I've added code that passes on mousemoves and clicks to other windows, without activating them though. This does make using multi-window Blender a bit friendler. - Dropping a file path to an image, is not the same as dropping an Image ID... keep this in mind. Sequencer for example wants paths to be dropped, textures in 3d window wants an Image ID. - Although drop boxes could be defined via Python, I suggest they're part of the UI and editor design (= how we want an editor to work), and not default offered configurable like keymaps. - At the moment only one item can be dragged at a time. This is for several reasons.... For one, Blender doesn't have a well defined uniform way to define "what is selected" (files, outliner items, etc). Secondly there's potential conflicts on what todo when you drop mixed drag sets on spots. All undefined stuff... nice for later. - Example to bypass the above: a collection of images that form a strip, should be represented in filewindow as a single sequence anyway. This then will fit well and gets handled neatly by design. - Another option to check is to allow multiple options per drop... it could show the operator as a sort of menu, allowing arrow or scrollwheel to choose. For time being I'd prefer to try to design a singular drop though, just offer only one drop action per data type on given spots. - What does work already, but a tad slow, is to use a function that detects an object (type) under cursor, so a drag item's option can be further refined (like drop object on object = parent). (disabled) ** More notes - Added saving for Region layouts (like split points for toolbar) - Label buttons now handle mouse over - File list: added full path entry for drop feature. - Filesel bugfix: wm_operator_exec() got called there and fully handled, while WM event code tried same. Added new OPERATOR_HANDLED flag for this. Maybe python needs it too? - Cocoa: added window move event, so multi-win setups work OK (didnt save). - Interface_handlers.c: removed win->active - Severe area copy bug: area handlers were not set to NULL - Filesel bugfix: next/prev folder list was not copied on area copies ** Leftover todos - Cocoa windows seem to hang on cases still... needs check - Cocoa 'draw overlap' swap doesn't work - Cocoa window loses focus permanently on using Spotlight (for these reasons, makefile building has Carbon as default atm) - ListView templates in UI cannot become dragged yet, needs review... it consists of two overlapping UI elements, preventing handling icon clicks. - There's already Ghost library code to handle dropping from OS into Blender window. I've noticed this code is unfinished for Macs, but seems to be complete for Windows. Needs test... currently, an external drop event will print in console when succesfully delivered to Blender's WM.
Diffstat (limited to 'source/blender/windowmanager')
-rw-r--r--source/blender/windowmanager/WM_api.h16
-rw-r--r--source/blender/windowmanager/WM_types.h48
-rw-r--r--source/blender/windowmanager/intern/wm.c1
-rw-r--r--source/blender/windowmanager/intern/wm_cursors.c6
-rw-r--r--source/blender/windowmanager/intern/wm_dragdrop.c370
-rw-r--r--source/blender/windowmanager/intern/wm_draw.c31
-rw-r--r--source/blender/windowmanager/intern/wm_event_system.c201
-rw-r--r--source/blender/windowmanager/intern/wm_gesture.c16
-rw-r--r--source/blender/windowmanager/intern/wm_init_exit.c1
-rw-r--r--source/blender/windowmanager/intern/wm_operators.c9
-rw-r--r--source/blender/windowmanager/intern/wm_window.c38
-rw-r--r--source/blender/windowmanager/wm_cursors.h1
-rw-r--r--source/blender/windowmanager/wm_event_system.h9
-rw-r--r--source/blender/windowmanager/wm_event_types.h2
14 files changed, 713 insertions, 36 deletions
diff --git a/source/blender/windowmanager/WM_api.h b/source/blender/windowmanager/WM_api.h
index b4cedf82a50..e4ae6ad4f5b 100644
--- a/source/blender/windowmanager/WM_api.h
+++ b/source/blender/windowmanager/WM_api.h
@@ -44,6 +44,9 @@ struct rcti;
struct PointerRNA;
struct EnumPropertyItem;
struct MenuType;
+struct wmDropBox;
+struct wmDrag;
+struct ImBuf;
typedef struct wmJob wmJob;
@@ -155,9 +158,13 @@ void WM_event_remove_area_handler(struct ListBase *handlers, void *area);
struct wmEventHandler *WM_event_add_modal_handler(struct bContext *C, struct wmOperator *op);
void WM_event_remove_handlers(struct bContext *C, ListBase *handlers);
+struct wmEventHandler *WM_event_add_dropbox_handler(ListBase *handlers, ListBase *dropboxes);
+
+ /* mouse */
void WM_event_add_mousemove(struct bContext *C);
int WM_modal_tweak_exit(struct wmEvent *evt, int tweak_event);
+ /* notifiers */
void WM_event_add_notifier(const struct bContext *C, unsigned int type, void *reference);
void WM_main_add_notifier(unsigned int type, void *reference);
@@ -248,6 +255,7 @@ void WM_OT_tweak_gesture(struct wmOperatorType *ot);
/* Gesture manager API */
struct wmGesture *WM_gesture_new(struct bContext *C, struct wmEvent *event, int type);
void WM_gesture_end(struct bContext *C, struct wmGesture *gesture);
+void WM_gestures_remove(struct bContext *C);
/* radial control operator */
int WM_radial_control_invoke(struct bContext *C, struct wmOperator *op, struct wmEvent *event);
@@ -259,6 +267,14 @@ void WM_radial_control_string(struct wmOperator *op, char str[], int maxlen);
void WM_event_add_fileselect(struct bContext *C, struct wmOperator *op);
void WM_event_fileselect_event(struct bContext *C, void *ophandle, int eventval);
+ /* drag and drop */
+struct wmDrag *WM_event_start_drag(struct bContext *C, int icon, int type, void *poin, double value);
+void WM_event_drag_image(struct wmDrag *, struct ImBuf *, float scale, int sx, int sy);
+
+struct wmDropBox *WM_dropbox_add(ListBase *lb, const char *idname, int (*poll)(struct bContext *, struct wmDrag *, struct wmEvent *event),
+ void (*copy)(struct wmDrag *, struct wmDropBox *));
+ListBase *WM_dropboxmap_find(char *idname, int spaceid, int regionid);
+
/* OpenGL wrappers, mimicking opengl syntax */
void wmSubWindowSet (struct wmWindow *win, int swinid);
void wmSubWindowScissorSet (struct wmWindow *win, int swinid, struct rcti *srct);
diff --git a/source/blender/windowmanager/WM_types.h b/source/blender/windowmanager/WM_types.h
index 4caa4b973f1..0439fa8b8f5 100644
--- a/source/blender/windowmanager/WM_types.h
+++ b/source/blender/windowmanager/WM_types.h
@@ -33,9 +33,11 @@ struct wmEvent;
struct wmWindowManager;
struct uiLayout;
struct wmOperator;
+struct ImBuf;
#include "RNA_types.h"
#include "DNA_listBase.h"
+#include "BKE_utildefines.h" /* FILE_MAX */
/* exported types for WM */
#include "wm_cursors.h"
@@ -437,7 +439,51 @@ typedef struct wmReport {
char *message;
} wmReport;
-/* *************** migrated stuff, clean later? ******************************** */
+/* *************** Drag and drop *************** */
+
+#define WM_DRAG_ID 0
+#define WM_DRAG_RNA 1
+#define WM_DRAG_PATH 2
+#define WM_DRAG_NAME 3
+#define WM_DRAG_VALUE 4
+
+/* note: structs need not exported? */
+
+typedef struct wmDrag {
+ struct wmDrag *next, *prev;
+
+ int icon, type; /* type, see WM_DRAG defines above */
+ void *poin;
+ char path[FILE_MAX];
+ double value;
+
+ struct ImBuf *imb; /* if no icon but imbuf should be drawn around cursor */
+ float scale;
+ short sx, sy;
+
+ char opname[FILE_MAX]; /* if set, draws operator name*/
+} wmDrag;
+
+/* dropboxes are like keymaps, part of the screen/area/region definition */
+/* allocation and free is on startup and exit */
+typedef struct wmDropBox {
+ struct wmDropBox *next, *prev;
+
+ /* test if the dropbox is active, then can print optype name */
+ int (*poll)(struct bContext *, struct wmDrag *, wmEvent *);
+
+ /* before exec, this copies drag info to wmDrop properties */
+ void (*copy)(struct wmDrag *, struct wmDropBox *);
+
+ /* if poll survives, operator is called */
+ wmOperatorType *ot; /* not saved in file, so can be pointer */
+
+ struct IDProperty *properties; /* operator properties, assigned to ptr->data and can be written to a file */
+ struct PointerRNA *ptr; /* rna pointer to access properties */
+
+} wmDropBox;
+
+/* *************** migrated stuff, clean later? ************** */
typedef struct RecentFile {
struct RecentFile *next, *prev;
diff --git a/source/blender/windowmanager/intern/wm.c b/source/blender/windowmanager/intern/wm.c
index ee1d76020c2..7f4bb59bbae 100644
--- a/source/blender/windowmanager/intern/wm.c
+++ b/source/blender/windowmanager/intern/wm.c
@@ -298,6 +298,7 @@ void wm_close_and_free(bContext *C, wmWindowManager *wm)
BLI_freelistN(&wm->queue);
BLI_freelistN(&wm->paintcursors);
+ BLI_freelistN(&wm->drags);
BKE_reports_clear(&wm->reports);
if(C && CTX_wm_manager(C)==wm) CTX_wm_manager_set(C, NULL);
diff --git a/source/blender/windowmanager/intern/wm_cursors.c b/source/blender/windowmanager/intern/wm_cursors.c
index dfcc1fcd227..f23688404b1 100644
--- a/source/blender/windowmanager/intern/wm_cursors.c
+++ b/source/blender/windowmanager/intern/wm_cursors.c
@@ -64,6 +64,7 @@ static GHOST_TStandardCursor convert_cursor(int curs)
case CURSOR_X_MOVE: return GHOST_kStandardCursorLeftRight;
case CURSOR_Y_MOVE: return GHOST_kStandardCursorUpDown;
case CURSOR_PENCIL: return GHOST_kStandardCursorPencil;
+ case CURSOR_COPY: return GHOST_kStandardCursorCopy;
}
}
@@ -136,9 +137,10 @@ void WM_cursor_set(wmWindow *win, int curs)
void WM_cursor_modal(wmWindow *win, int val)
{
- if(win->lastcursor == 0)
+ if(win->lastcursor == 0) {
win->lastcursor = win->cursor;
- WM_cursor_set(win, val);
+ WM_cursor_set(win, val);
+ }
}
void WM_cursor_restore(wmWindow *win)
diff --git a/source/blender/windowmanager/intern/wm_dragdrop.c b/source/blender/windowmanager/intern/wm_dragdrop.c
new file mode 100644
index 00000000000..d976c42bb8c
--- /dev/null
+++ b/source/blender/windowmanager/intern/wm_dragdrop.c
@@ -0,0 +1,370 @@
+/**
+ * $Id:
+ *
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * The Original Code is Copyright (C) 2010 Blender Foundation.
+ * All rights reserved.
+ *
+ *
+ * Contributor(s): Blender Foundation
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#include "string.h"
+
+#include "DNA_windowmanager_types.h"
+#include "DNA_screen_types.h"
+
+#include "MEM_guardedalloc.h"
+
+#include "BLI_blenlib.h"
+
+#include "BIF_gl.h"
+#include "BIF_glutil.h"
+
+#include "BKE_blender.h"
+#include "BKE_context.h"
+#include "BKE_idprop.h"
+#include "BKE_library.h"
+#include "BKE_main.h"
+#include "BKE_screen.h"
+#include "BKE_global.h"
+
+#include "IMB_imbuf_types.h"
+#include "IMB_imbuf.h"
+
+#include "UI_interface.h"
+#include "UI_interface_icons.h"
+
+#include "WM_api.h"
+#include "WM_types.h"
+#include "wm_event_system.h"
+#include "wm.h"
+
+#include "RNA_types.h"
+
+/* ****************************************************** */
+
+static ListBase dropboxes= {NULL, NULL};
+
+/* drop box maps are stored global for now */
+/* these are part of blender's UI/space specs, and not like keymaps */
+/* when editors become configurable, they can add own dropbox definitions */
+
+typedef struct wmDropBoxMap {
+ struct wmDropBoxMap *next, *prev;
+
+ ListBase dropboxes;
+ short spaceid, regionid;
+ char idname[KMAP_MAX_NAME];
+
+} wmDropBoxMap;
+
+ListBase *WM_dropboxmap_find(char *idname, int spaceid, int regionid)
+{
+ wmDropBoxMap *dm;
+
+ for(dm= dropboxes.first; dm; dm= dm->next)
+ if(dm->spaceid==spaceid && dm->regionid==regionid)
+ if(0==strncmp(idname, dm->idname, KMAP_MAX_NAME))
+ return &dm->dropboxes;
+
+ dm= MEM_callocN(sizeof(struct wmDropBoxMap), "dropmap list");
+ BLI_strncpy(dm->idname, idname, KMAP_MAX_NAME);
+ dm->spaceid= spaceid;
+ dm->regionid= regionid;
+ BLI_addtail(&dropboxes, dm);
+
+ return &dm->dropboxes;
+}
+
+
+
+wmDropBox *WM_dropbox_add(ListBase *lb, const char *idname, int (*poll)(bContext *, wmDrag *, wmEvent *),
+ void (*copy)(wmDrag *, wmDropBox *))
+{
+ wmDropBox *drop= MEM_callocN(sizeof(wmDropBox), "wmDropBox");
+
+ drop->poll= poll;
+ drop->copy= copy;
+ drop->ot= WM_operatortype_find(idname, 0);
+
+ if(drop->ot==NULL) {
+ MEM_freeN(drop);
+ printf("Error: dropbox with unknown operator: %s\n", idname);
+ return NULL;
+ }
+ WM_operator_properties_alloc(&(drop->ptr), &(drop->properties), idname);
+
+ BLI_addtail(lb, drop);
+
+ return drop;
+}
+
+void wm_dropbox_free(void)
+{
+ wmDropBoxMap *dm;
+
+ for(dm= dropboxes.first; dm; dm= dm->next) {
+ wmDropBox *drop;
+
+ for(drop= dm->dropboxes.first; drop; drop= drop->next) {
+ if(drop->ptr) {
+ WM_operator_properties_free(drop->ptr);
+ MEM_freeN(drop->ptr);
+ }
+ }
+ BLI_freelistN(&dm->dropboxes);
+ }
+
+ BLI_freelistN(&dropboxes);
+}
+
+/* *********************************** */
+
+/* note that the pointer should be valid allocated and not on stack */
+wmDrag *WM_event_start_drag(struct bContext *C, int icon, int type, void *poin, double value)
+{
+ wmWindowManager *wm= CTX_wm_manager(C);
+ wmDrag *drag= MEM_callocN(sizeof(struct wmDrag), "new drag");
+
+ /* keep track of future multitouch drag too, add a mousepointer id or so */
+ /* if multiple drags are added, they're drawn as list */
+
+ BLI_addtail(&wm->drags, drag);
+ drag->icon= icon;
+ drag->type= type;
+ if(type==WM_DRAG_PATH)
+ BLI_strncpy(drag->path, poin, FILE_MAX);
+ else
+ drag->poin= poin;
+ drag->value= value;
+
+ return drag;
+}
+
+void WM_event_drag_image(wmDrag *drag, ImBuf *imb, float scale, int sx, int sy)
+{
+ drag->imb= imb;
+ drag->scale= scale;
+ drag->sx= sx;
+ drag->sy= sy;
+}
+
+
+static char *dropbox_active(bContext *C, ListBase *handlers, wmDrag *drag, wmEvent *event)
+{
+ wmEventHandler *handler= handlers->first;
+ for(; handler; handler= handler->next) {
+ if(handler->dropboxes) {
+ wmDropBox *drop= handler->dropboxes->first;
+ for(; drop; drop= drop->next) {
+ if(drop->poll(C, drag, event))
+ return drop->ot->name;
+ }
+ }
+ }
+ return NULL;
+}
+
+/* return active operator name when mouse is in box */
+static char *wm_dropbox_active(bContext *C, wmDrag *drag, wmEvent *event)
+{
+ wmWindow *win= CTX_wm_window(C);
+ ScrArea *sa= CTX_wm_area(C);
+ ARegion *ar= CTX_wm_region(C);
+ char *name;
+
+ name= dropbox_active(C, &win->handlers, drag, event);
+ if(name) return name;
+
+ name= dropbox_active(C, &sa->handlers, drag, event);
+ if(name) return name;
+
+ name= dropbox_active(C, &ar->handlers, drag, event);
+ if(name) return name;
+
+ return NULL;
+}
+
+
+static void wm_drop_operator_options(bContext *C, wmDrag *drag, wmEvent *event)
+{
+ wmWindow *win= CTX_wm_window(C);
+
+ /* for multiwin drags, we only do this if mouse inside */
+ if(event->x<0 || event->y<0 || event->x>win->sizex || event->y>win->sizey)
+ return;
+
+ drag->opname[0]= 0;
+
+ /* check buttons (XXX todo rna and value) */
+ if( UI_but_active_drop_name(C) ) {
+ strcpy(drag->opname, "Paste name");
+ }
+ else {
+ char *opname= wm_dropbox_active(C, drag, event);
+
+ if(opname) {
+ BLI_strncpy(drag->opname, opname, FILE_MAX);
+ // WM_cursor_modal(win, CURSOR_COPY);
+ }
+ // else
+ // WM_cursor_restore(win);
+ /* unsure about cursor type, feels to be too much */
+ }
+}
+
+/* called in inner handler loop, region context */
+void wm_drags_check_ops(bContext *C, wmEvent *event)
+{
+ wmWindowManager *wm= CTX_wm_manager(C);
+ wmDrag *drag;
+
+ for(drag= wm->drags.first; drag; drag= drag->next) {
+ wm_drop_operator_options(C, drag, event);
+ }
+}
+
+/* ************** draw ***************** */
+
+static void wm_drop_operator_draw(char *name, int x, int y)
+{
+ int width= UI_GetStringWidth(name);
+
+ glColor4ub(0, 0, 0, 128);
+
+ uiSetRoundBox(15);
+ uiRoundBox(x, y, x + width + 8, y + 15, 7);
+
+ glColor4ub(255, 255, 255, 255);
+ UI_DrawString(x+4, y+4, name);
+}
+
+static char *wm_drag_name(wmDrag *drag)
+{
+ switch(drag->type) {
+ case WM_DRAG_ID:
+ {
+ ID *id= (ID *)drag->poin;
+ return id->name+2;
+ }
+ case WM_DRAG_PATH:
+ return drag->path;
+ case WM_DRAG_NAME:
+ return (char *)drag->path;
+ }
+ return "";
+}
+
+static void drag_rect_minmax(rcti *rect, int x1, int y1, int x2, int y2)
+{
+ if(rect->xmin > x1)
+ rect->xmin= x1;
+ if(rect->xmax < x2)
+ rect->xmax= x2;
+ if(rect->ymin > y1)
+ rect->ymin= y1;
+ if(rect->ymax < y2)
+ rect->ymax= y2;
+}
+
+/* called in wm_draw.c */
+/* if rect set, do not draw */
+void wm_drags_draw(bContext *C, wmWindow *win, rcti *rect)
+{
+ wmWindowManager *wm= CTX_wm_manager(C);
+ wmDrag *drag;
+ int cursorx, cursory, x, y;
+
+ cursorx= win->eventstate->x;
+ cursory= win->eventstate->y;
+ if(rect) {
+ rect->xmin= rect->xmax= cursorx;
+ rect->ymin= rect->ymax= cursory;
+ }
+
+ /* XXX todo, multiline drag draws... but maybe not, more types mixed wont work well */
+ glEnable(GL_BLEND);
+ for(drag= wm->drags.first; drag; drag= drag->next) {
+
+ /* image or icon */
+ if(drag->imb) {
+ x= cursorx - drag->sx/2;
+ y= cursory - drag->sy/2;
+
+ if(rect)
+ drag_rect_minmax(rect, x, y, x+drag->sx, y+drag->sy);
+ else {
+ glColor4f(1.0, 1.0, 1.0, 0.65); /* this blends texture */
+ glaDrawPixelsTexScaled(x, y, drag->imb->x, drag->imb->y, GL_UNSIGNED_BYTE, drag->imb->rect, drag->scale, drag->scale);
+ }
+ }
+ else {
+ x= cursorx - 8;
+ y= cursory - 2;
+
+ /* icons assumed to be 16 pixels */
+ if(rect)
+ drag_rect_minmax(rect, x, y, x+16, y+16);
+ else
+ UI_icon_draw_aspect(x, y, drag->icon, 1.0, 0.8);
+ }
+
+ /* item name */
+ if(drag->imb) {
+ x= cursorx - drag->sx/2;
+ y= cursory - drag->sy/2 - 16;
+ }
+ else {
+ x= cursorx + 10;
+ y= cursory + 1;
+ }
+
+ if(rect) {
+ int w= UI_GetStringWidth(wm_drag_name(drag));
+ drag_rect_minmax(rect, x, y, x+w, y+16);
+ }
+ else {
+ glColor4ub(255, 255, 255, 255);
+ UI_DrawString(x, y, wm_drag_name(drag));
+ }
+
+ /* operator name with roundbox */
+ if(drag->opname[0]) {
+ if(drag->imb) {
+ x= cursorx - drag->sx/2;
+ y= cursory + drag->sy/2 + 4;
+ }
+ else {
+ x= cursorx - 8;
+ y= cursory + 16;
+ }
+
+ if(rect) {
+ int w= UI_GetStringWidth(wm_drag_name(drag));
+ drag_rect_minmax(rect, x, y, x+w, y+16);
+ }
+ else
+ wm_drop_operator_draw(drag->opname, x, y);
+
+ }
+ }
+ glDisable(GL_BLEND);
+}
diff --git a/source/blender/windowmanager/intern/wm_draw.c b/source/blender/windowmanager/intern/wm_draw.c
index 9ee67cd4047..0d2f1043d0b 100644
--- a/source/blender/windowmanager/intern/wm_draw.c
+++ b/source/blender/windowmanager/intern/wm_draw.c
@@ -63,7 +63,8 @@
#define WIN_FRONT_OK 2
#define WIN_BOTH_OK 3
-/* ********************* drawing, swap ****************** */
+/* ******************* drawing, overlays *************** */
+
static void wm_paintcursor_draw(bContext *C, ARegion *ar)
{
@@ -91,6 +92,8 @@ static void wm_paintcursor_draw(bContext *C, ARegion *ar)
}
}
+/* ********************* drawing, swap ****************** */
+
static void wm_area_mark_invalid_backbuf(ScrArea *sa)
{
if(sa->spacetype == SPACE_VIEW3D)
@@ -179,9 +182,11 @@ static void wm_flush_regions_up(bScreen *screen, rcti *dirty)
static void wm_method_draw_overlap_all(bContext *C, wmWindow *win)
{
+ wmWindowManager *wm= CTX_wm_manager(C);
bScreen *screen= win->screen;
ScrArea *sa;
ARegion *ar;
+ static rcti rect= {0, 0, 0, 0};
int exchange= (G.f & G_SWAP_EXCHANGE);
/* flush overlapping regions */
@@ -203,6 +208,16 @@ static void wm_method_draw_overlap_all(bContext *C, wmWindow *win)
wm_flush_regions_down(screen, &ar->winrct);
}
+ /* flush drag item */
+ if(rect.xmin!=rect.xmax) {
+ wm_flush_regions_down(screen, &rect);
+ rect.xmin= rect.xmax = 0;
+ }
+ if(wm->drags.first) {
+ /* doesnt draw, fills rect with boundbox */
+ wm_drags_draw(C, win, &rect);
+ }
+
/* draw marked area regions */
for(sa= screen->areabase.first; sa; sa= sa->next) {
CTX_wm_area_set(C, sa);
@@ -273,6 +288,11 @@ static void wm_method_draw_overlap_all(bContext *C, wmWindow *win)
if(screen->do_draw_gesture)
wm_gesture_draw(win);
+
+ /* needs pixel coords in screen */
+ if(wm->drags.first) {
+ wm_drags_draw(C, win, NULL);
+ }
}
#if 0
@@ -607,6 +627,12 @@ static void wm_method_draw_triple(bContext *C, wmWindow *win)
wmSubWindowSet(win, screen->mainwin);
}
+
+ /* needs pixel coords in screen */
+ if(wm->drags.first) {
+ wm_drags_draw(C, win, NULL);
+ }
+
}
/****************** main update call **********************/
@@ -625,6 +651,8 @@ static int wm_draw_update_test_window(wmWindow *win)
return 1;
if(win->screen->do_draw_paintcursor)
return 1;
+ if(win->screen->do_draw_drag)
+ return 1;
for(ar= win->screen->regionbase.first; ar; ar= ar->next)
if(ar->swinid && ar->do_draw)
@@ -672,6 +700,7 @@ void wm_draw_update(bContext *C)
win->screen->do_draw_gesture= 0;
win->screen->do_draw_paintcursor= 0;
+ win->screen->do_draw_drag= 0;
wm_window_swap_buffers(win);
diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c
index 7fa5f9b61c0..8ba8ed1824d 100644
--- a/source/blender/windowmanager/intern/wm_event_system.c
+++ b/source/blender/windowmanager/intern/wm_event_system.c
@@ -81,8 +81,15 @@ void wm_event_add(wmWindow *win, wmEvent *event_to_add)
void wm_event_free(wmEvent *event)
{
- if(event->customdata && event->customdatafree)
- MEM_freeN(event->customdata);
+ if(event->customdata) {
+ if(event->customdatafree) {
+ /* note: pointer to listbase struct elsewhere */
+ if(event->custom==EVT_DATA_LISTBASE)
+ BLI_freelistN(event->customdata);
+ else
+ MEM_freeN(event->customdata);
+ }
+ }
MEM_freeN(event);
}
@@ -336,7 +343,7 @@ static int wm_operator_exec(bContext *C, wmOperator *op, int repeat)
else if(repeat==0)
WM_operator_free(op);
- return retval;
+ return retval | OPERATOR_HANDLED;
}
@@ -483,7 +490,9 @@ static int wm_operator_invoke(bContext *C, wmOperatorType *ot, wmEvent *event, P
wm_operator_print(op);
}
- if(retval & OPERATOR_FINISHED) {
+ if(retval & OPERATOR_HANDLED)
+ ; /* do nothing, wm_operator_exec() has been called somewhere */
+ else if(retval & OPERATOR_FINISHED) {
op->customdata= NULL;
if(ot->flag & OPTYPE_UNDO)
@@ -1227,6 +1236,26 @@ static int wm_handlers_do(bContext *C, wmEvent *event, ListBase *handlers)
/* screen context changes here */
action |= wm_handler_fileselect_call(C, handlers, handler, event);
}
+ else if(handler->dropboxes) {
+ if(event->type==EVT_DROP) {
+ wmDropBox *drop= handler->dropboxes->first;
+ for(; drop; drop= drop->next) {
+ /* other drop custom types allowed */
+ if(event->custom==EVT_DATA_LISTBASE) {
+ ListBase *lb= (ListBase *)event->customdata;
+ wmDrag *drag;
+ for(drag= lb->first; drag; drag= drag->next) {
+ if(drop->poll(C, drag, event)) {
+ drop->copy(drag, drop);
+
+ wm_operator_invoke(C, drop->ot, event, drop->ptr, NULL);
+ action |= WM_HANDLER_BREAK;
+ }
+ }
+ }
+ }
+ }
+ }
else {
/* modal, swallows all */
action |= wm_handler_operator_call(C, handlers, handler, event, NULL);
@@ -1353,13 +1382,51 @@ static void wm_paintcursor_test(bContext *C, wmEvent *event)
}
}
+static void wm_event_drag_test(wmWindowManager *wm, wmWindow *win, wmEvent *event)
+{
+ if(wm->drags.first==NULL) return;
+
+ if(event->type==MOUSEMOVE)
+ win->screen->do_draw_drag= 1;
+ else if(event->type==ESCKEY) {
+ BLI_freelistN(&wm->drags);
+ win->screen->do_draw_drag= 1;
+ }
+ else if(event->type==LEFTMOUSE && event->val==KM_RELEASE) {
+ event->type= EVT_DROP;
+
+ /* create customdata, first free existing */
+ if(event->customdata) {
+ if(event->customdatafree)
+ MEM_freeN(event->customdata);
+ }
+
+ event->custom= EVT_DATA_LISTBASE;
+ event->customdata= &wm->drags;
+ event->customdatafree= 1;
+
+ /* clear drop icon */
+ win->screen->do_draw_drag= 1;
+
+ /* restore cursor (disabled, see wm_dragdrop.c) */
+ // WM_cursor_restore(win);
+ }
+
+ /* overlap fails otherwise */
+ if(win->screen->do_draw_drag)
+ if(win->drawmethod == USER_DRAW_OVERLAP)
+ win->screen->do_draw= 1;
+
+}
+
/* called in main loop */
/* goes over entire hierarchy: events -> window -> screen -> area -> region */
void wm_event_do_handlers(bContext *C)
{
+ wmWindowManager *wm= CTX_wm_manager(C);
wmWindow *win;
- for(win= CTX_wm_manager(C)->windows.first; win; win= win->next) {
+ for(win= wm->windows.first; win; win= win->next) {
wmEvent *event;
if( win->screen==NULL )
@@ -1386,6 +1453,9 @@ void wm_event_do_handlers(bContext *C)
if(CTX_wm_window(C)==NULL)
return;
+ /* check dragging, creates new event or frees, adds draw tag */
+ wm_event_drag_test(wm, win, event);
+
/* builtin tweak, if action is break it removes tweak */
wm_tweakevent_test(C, event, action);
@@ -1410,8 +1480,16 @@ void wm_event_do_handlers(bContext *C)
for(ar=sa->regionbase.first; ar; ar= ar->next) {
if(wm_event_inside_i(event, &ar->winrct)) {
CTX_wm_region_set(C, ar);
+
+ /* does polls for drop regions and checks uibuts */
+ /* need to be here to make sure region context is true */
+ if(event->type==MOUSEMOVE) {
+ wm_region_mouse_co(C, event);
+ wm_drags_check_ops(C, event);
+ }
+
action |= wm_handlers_do(C, event, &ar->handlers);
-
+
doit |= (BLI_in_rcti(&ar->winrct, event->x, event->y));
if(action & WM_HANDLER_BREAK)
@@ -1657,6 +1735,25 @@ void WM_event_remove_ui_handler(ListBase *handlers, wmUIHandlerFunc func, wmUIHa
}
}
+wmEventHandler *WM_event_add_dropbox_handler(ListBase *handlers, ListBase *dropboxes)
+{
+ wmEventHandler *handler;
+
+ /* only allow same dropbox once */
+ for(handler= handlers->first; handler; handler= handler->next)
+ if(handler->dropboxes==dropboxes)
+ return handler;
+
+ handler= MEM_callocN(sizeof(wmEventHandler), "dropbox handler");
+
+ /* dropbox stored static, no free or copy */
+ handler->dropboxes= dropboxes;
+ BLI_addhead(handlers, handler);
+
+ return handler;
+}
+
+/* XXX solution works, still better check the real cause (ton) */
void WM_event_remove_area_handler(ListBase *handlers, void *area)
{
wmEventHandler *handler, *nexthandler;
@@ -1705,7 +1802,6 @@ int WM_modal_tweak_exit(wmEvent *evt, int tweak_event)
return 0;
}
-
/* ********************* ghost stuff *************** */
static int convert_key(GHOST_TKey key)
@@ -1804,10 +1900,43 @@ static void update_tablet_data(wmWindow *win, wmEvent *event)
}
}
+/* imperfect but probably usable... draw/enable drags to other windows */
+static wmWindow *wm_event_cursor_other_windows(wmWindowManager *wm, wmWindow *win, wmEvent *evt)
+{
+ short mx= evt->x, my= evt->y;
+
+ if(wm->windows.first== wm->windows.last)
+ return NULL;
+
+ /* top window bar... */
+ if(mx<0 || my<0 || mx>win->sizex || my>win->sizey+30) {
+ wmWindow *owin;
+
+ /* to desktop space */
+ mx+= win->posx;
+ my+= win->posy;
+
+ /* check other windows to see if it has mouse inside */
+ for(owin= wm->windows.first; owin; owin= owin->next) {
+ if(owin!=win) {
+ if(mx-owin->posx >= 0 && my-owin->posy >= 0 &&
+ mx-owin->posx <= owin->sizex && my-owin->posy <= owin->sizey) {
+ evt->x= mx-owin->posx;
+ evt->y= my-owin->posy;
+
+ return owin;
+ }
+ }
+ }
+ }
+ return NULL;
+}
/* windows store own event queues, no bContext here */
-void wm_event_add_ghostevent(wmWindow *win, int type, void *customdata)
+/* time is in 1000s of seconds, from ghost */
+void wm_event_add_ghostevent(wmWindowManager *wm, wmWindow *win, int type, int time, void *customdata)
{
+ wmWindow *owin;
wmEvent event, *evt= win->eventstate;
/* initialize and copy state (only mouse x y and modifiers) */
@@ -1818,20 +1947,42 @@ void wm_event_add_ghostevent(wmWindow *win, int type, void *customdata)
case GHOST_kEventCursorMove: {
if(win->active) {
GHOST_TEventCursorData *cd= customdata;
+
#if defined(__APPLE__) && defined(GHOST_COCOA)
//Cocoa already uses coordinates with y=0 at bottom, and returns inwindow coordinates on mouse moved event
- event.type= MOUSEMOVE;
- event.x= evt->x = cd->x;
- event.y = evt->y = cd->y;
+ evt->x= cd->x;
+ evt->y= cd->y;
#else
int cx, cy;
+
GHOST_ScreenToClient(win->ghostwin, cd->x, cd->y, &cx, &cy);
- event.type= MOUSEMOVE;
- event.x= evt->x= cx;
- event.y= evt->y= (win->sizey-1) - cy;
+ evt->x= cx;
+ evt->y= (win->sizey-1) - cy;
#endif
+
+ event.x= evt->x;
+ event.y= evt->y;
+
+ event.type= MOUSEMOVE;
+
update_tablet_data(win, &event);
wm_event_add(win, &event);
+
+ /* also add to other window if event is there, this makes overdraws disappear nicely */
+ /* it remaps mousecoord to other window in event */
+ owin= wm_event_cursor_other_windows(wm, win, &event);
+ if(owin) {
+ wmEvent oevent= *(owin->eventstate);
+
+ oevent.x= event.x;
+ oevent.y= event.y;
+ oevent.type= MOUSEMOVE;
+
+ *(owin->eventstate)= oevent;
+ update_tablet_data(owin, &oevent);
+ wm_event_add(owin, &oevent);
+ }
+
}
break;
}
@@ -1888,8 +2039,23 @@ void wm_event_add_ghostevent(wmWindow *win, int type, void *customdata)
else
event.type= MIDDLEMOUSE;
- update_tablet_data(win, &event);
- wm_event_add(win, &event);
+ /* add to other window if event is there (not to both!) */
+ owin= wm_event_cursor_other_windows(wm, win, &event);
+ if(owin) {
+ wmEvent oevent= *(owin->eventstate);
+
+ oevent.x= event.x;
+ oevent.y= event.y;
+ oevent.type= event.type;
+ oevent.val= event.val;
+
+ update_tablet_data(owin, &oevent);
+ wm_event_add(owin, &oevent);
+ }
+ else {
+ update_tablet_data(win, &event);
+ wm_event_add(win, &event);
+ }
break;
}
@@ -1943,7 +2109,7 @@ void wm_event_add_ghostevent(wmWindow *win, int type, void *customdata)
/* if test_break set, it catches this. XXX Keep global for now? */
if(event.type==ESCKEY)
G.afbreek= 1;
-
+
wm_event_add(win, &event);
break;
@@ -1980,6 +2146,7 @@ void wm_event_add_ghostevent(wmWindow *win, int type, void *customdata)
wm_event_add(win, &event);
break;
+
}
}
diff --git a/source/blender/windowmanager/intern/wm_gesture.c b/source/blender/windowmanager/intern/wm_gesture.c
index e94aab7ab89..47d8c8d9831 100644
--- a/source/blender/windowmanager/intern/wm_gesture.c
+++ b/source/blender/windowmanager/intern/wm_gesture.c
@@ -101,11 +101,24 @@ wmGesture *WM_gesture_new(bContext *C, wmEvent *event, int type)
void WM_gesture_end(bContext *C, wmGesture *gesture)
{
- BLI_remlink(&CTX_wm_window(C)->gesture, gesture);
+ wmWindow *win= CTX_wm_window(C);
+
+ if(win->tweak==gesture)
+ win->tweak= NULL;
+ BLI_remlink(&win->gesture, gesture);
MEM_freeN(gesture->customdata);
MEM_freeN(gesture);
}
+void WM_gestures_remove(bContext *C)
+{
+ wmWindow *win= CTX_wm_window(C);
+
+ while(win->gesture.first)
+ WM_gesture_end(C, win->gesture.first);
+}
+
+
/* tweak and line gestures */
#define TWEAK_THRESHOLD 10
int wm_gesture_evaluate(bContext *C, wmGesture *gesture)
@@ -338,3 +351,4 @@ void wm_gesture_tag_redraw(bContext *C)
ED_region_tag_redraw(ar);
}
+
diff --git a/source/blender/windowmanager/intern/wm_init_exit.c b/source/blender/windowmanager/intern/wm_init_exit.c
index 48164b5ac16..93612430967 100644
--- a/source/blender/windowmanager/intern/wm_init_exit.c
+++ b/source/blender/windowmanager/intern/wm_init_exit.c
@@ -227,6 +227,7 @@ void WM_exit(bContext *C)
}
}
wm_operatortype_free();
+ wm_dropbox_free();
WM_menutype_free();
/* all non-screen and non-space stuff editors did, like editmode */
diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c
index 2f2aebbc525..8f088efe8a8 100644
--- a/source/blender/windowmanager/intern/wm_operators.c
+++ b/source/blender/windowmanager/intern/wm_operators.c
@@ -2123,7 +2123,6 @@ static void tweak_gesture_modal(bContext *C, wmEvent *event)
wm_event_add(window, &event);
WM_gesture_end(C, gesture); /* frees gesture itself, and unregisters from window */
- window->tweak= NULL;
}
break;
@@ -2133,7 +2132,6 @@ static void tweak_gesture_modal(bContext *C, wmEvent *event)
case MIDDLEMOUSE:
if(gesture->event_type==event->type) {
WM_gesture_end(C, gesture);
- window->tweak= NULL;
/* when tweak fails we should give the other keymap entries a chance */
event->val= KM_RELEASE;
@@ -2142,7 +2140,6 @@ static void tweak_gesture_modal(bContext *C, wmEvent *event)
default:
if(!ISTIMER(event->type)) {
WM_gesture_end(C, gesture);
- window->tweak= NULL;
}
break;
}
@@ -2155,16 +2152,16 @@ void wm_tweakevent_test(bContext *C, wmEvent *event, int action)
if(win->tweak==NULL) {
if(CTX_wm_region(C)) {
- if(event->val==KM_PRESS) { // pressed
+ if(event->val==KM_PRESS) {
if( ELEM3(event->type, LEFTMOUSE, MIDDLEMOUSE, RIGHTMOUSE) )
win->tweak= WM_gesture_new(C, event, WM_GESTURE_TWEAK);
}
}
}
else {
- if(action & WM_HANDLER_BREAK) {
+ /* no tweaks if event was handled */
+ if((action & WM_HANDLER_BREAK)) {
WM_gesture_end(C, win->tweak);
- win->tweak= NULL;
}
else
tweak_gesture_modal(C, event);
diff --git a/source/blender/windowmanager/intern/wm_window.c b/source/blender/windowmanager/intern/wm_window.c
index aaa24957715..ed593cb8dcd 100644
--- a/source/blender/windowmanager/intern/wm_window.c
+++ b/source/blender/windowmanager/intern/wm_window.c
@@ -554,6 +554,7 @@ static int ghost_event_proc(GHOST_EventHandle evt, GHOST_TUserDataPtr private)
bContext *C= private;
wmWindowManager *wm= CTX_wm_manager(C);
GHOST_TEventType type= GHOST_GetEventType(evt);
+ int time= GHOST_GetEventTime(evt);
if (type == GHOST_kEventQuit) {
WM_exit(C);
@@ -578,7 +579,7 @@ static int ghost_event_proc(GHOST_EventHandle evt, GHOST_TUserDataPtr private)
switch(type) {
case GHOST_kEventWindowDeactivate:
- wm_event_add_ghostevent(win, type, data);
+ wm_event_add_ghostevent(wm, win, type, time, data);
win->active= 0; /* XXX */
break;
case GHOST_kEventWindowActivate:
@@ -595,19 +596,19 @@ static int ghost_event_proc(GHOST_EventHandle evt, GHOST_TUserDataPtr private)
kdata.ascii= 0;
if (win->eventstate->shift && !query_qual('s')) {
kdata.key= GHOST_kKeyLeftShift;
- wm_event_add_ghostevent(win, GHOST_kEventKeyUp, &kdata);
+ wm_event_add_ghostevent(wm, win, GHOST_kEventKeyUp, time, &kdata);
}
if (win->eventstate->ctrl && !query_qual('c')) {
kdata.key= GHOST_kKeyLeftControl;
- wm_event_add_ghostevent(win, GHOST_kEventKeyUp, &kdata);
+ wm_event_add_ghostevent(wm, win, GHOST_kEventKeyUp, time, &kdata);
}
if (win->eventstate->alt && !query_qual('a')) {
kdata.key= GHOST_kKeyLeftAlt;
- wm_event_add_ghostevent(win, GHOST_kEventKeyUp, &kdata);
+ wm_event_add_ghostevent(wm, win, GHOST_kEventKeyUp, time, &kdata);
}
if (win->eventstate->oskey && !query_qual('C')) {
kdata.key= GHOST_kKeyCommand;
- wm_event_add_ghostevent(win, GHOST_kEventKeyUp, &kdata);
+ wm_event_add_ghostevent(wm, win, GHOST_kEventKeyUp, time, &kdata);
}
/* keymodifier zero, it hangs on hotkeys that open windows otherwise */
win->eventstate->keymodifier= 0;
@@ -625,6 +626,8 @@ static int ghost_event_proc(GHOST_EventHandle evt, GHOST_TUserDataPtr private)
win->eventstate->y= (win->sizey-1) - cy;
#endif
+ win->addmousemove= 1; /* enables highlighted buttons */
+
wm_window_make_drawable(C, win);
break;
}
@@ -679,7 +682,7 @@ static int ghost_event_proc(GHOST_EventHandle evt, GHOST_TUserDataPtr private)
win->sizey= sizey;
win->posx= posx;
win->posy= posy;
-
+
/* debug prints */
if(0) {
state = GHOST_GetWindowState(win->ghostwin);
@@ -711,8 +714,29 @@ static int ghost_event_proc(GHOST_EventHandle evt, GHOST_TUserDataPtr private)
}
break;
}
+ case GHOST_kEventDraggingDropDone:
+ {
+ wmEvent event= *(win->eventstate); /* copy last state, like mouse coords */
+
+ /* make blender drop event with custom data pointing to wm drags */
+ event.type= EVT_DROP;
+ event.custom= EVT_DATA_LISTBASE;
+ event.customdata= &wm->drags;
+
+ printf("Drop detected\n");
+
+ /* add drag data to wm for paths: */
+ /* need icon type, some dropboxes check for that... see filesel code for this */
+ // WM_event_start_drag(C, icon, WM_DRAG_PATH, void *poin, 0.0);
+ /* void poin should point to string, it makes a copy */
+
+ wm_event_add(win, &event);
+
+ break;
+ }
+
default:
- wm_event_add_ghostevent(win, type, data);
+ wm_event_add_ghostevent(wm, win, type, time, data);
break;
}
diff --git a/source/blender/windowmanager/wm_cursors.h b/source/blender/windowmanager/wm_cursors.h
index 3d1b49983ed..41772ffc661 100644
--- a/source/blender/windowmanager/wm_cursors.h
+++ b/source/blender/windowmanager/wm_cursors.h
@@ -47,6 +47,7 @@ enum {
CURSOR_STD,
CURSOR_NONE,
CURSOR_PENCIL,
+ CURSOR_COPY,
};
diff --git a/source/blender/windowmanager/wm_event_system.h b/source/blender/windowmanager/wm_event_system.h
index 3d7cb3fbad1..58778c5acbf 100644
--- a/source/blender/windowmanager/wm_event_system.h
+++ b/source/blender/windowmanager/wm_event_system.h
@@ -64,6 +64,9 @@ typedef struct wmEventHandler {
/* fileselect handler re-uses modal operator data */
struct bScreen *filescreen; /* screen it started in, to validate exec */
+ /* drop box handler */
+ ListBase *dropboxes;
+
} wmEventHandler;
@@ -89,12 +92,16 @@ void wm_event_free_handler (wmEventHandler *handler);
/* goes over entire hierarchy: events -> window -> screen -> area -> region */
void wm_event_do_handlers (bContext *C);
-void wm_event_add_ghostevent (wmWindow *win, int type, void *customdata);
+void wm_event_add_ghostevent (wmWindowManager *wm, wmWindow *win, int type, int time, void *customdata);
void wm_event_do_notifiers (bContext *C);
/* wm_keymap.c */
+/* wm_dropbox.c */
+void wm_dropbox_free(void);
+void wm_drags_check_ops(bContext *C, wmEvent *event);
+void wm_drags_draw(bContext *C, wmWindow *win, rcti *rect);
#endif /* WM_EVENT_SYSTEM_H */
diff --git a/source/blender/windowmanager/wm_event_types.h b/source/blender/windowmanager/wm_event_types.h
index a90eb702069..be0f5abbc47 100644
--- a/source/blender/windowmanager/wm_event_types.h
+++ b/source/blender/windowmanager/wm_event_types.h
@@ -39,6 +39,7 @@
#define EVT_DATA_TABLET 1
#define EVT_DATA_GESTURE 2
#define EVT_DATA_TIMER 3
+#define EVT_DATA_LISTBASE 4
/* tablet active, matches GHOST_TTabletMode */
#define EVT_TABLET_NONE 0
@@ -265,6 +266,7 @@
/* event->type */
#define EVT_BUT_OPEN 0x5021
#define EVT_MODAL_MAP 0x5022
+#define EVT_DROP 0x5023
/* NOTE: these defines are saved in keymap files, do not change values but just add new ones */
#define GESTURE_MODAL_CANCEL 1