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:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>2010-06-23 22:47:56 +0400
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2010-06-23 22:47:56 +0400
commitf507428d1189b48ba66a4a7826cd5db178b383a1 (patch)
tree1e84574805835bec71b6d3e197e2100c36c037d5 /source/blender/windowmanager
parent5b9059e2bd5be30500f7207ff4728f8cb1f4b2ff (diff)
Fix #22553: dragging number buttons would run update functions more often than
necessary due to the more accurate mouse move events that are useful for sculpting and painting (at least on Linux/X11, not sure about other platforms). If the update function takes a while to run, this in turn causes more mouse move events to be accumulated, making things even slower, .. going into a spiral of slower and slower redraws. As a solution I've added a INBETWEEN_MOUSEMOVE event next to MOUSEMOVE. A MOUSEMOVE event is automatically changed to INBETWEEN_MOUSEMOVE when a MOUSEMOVE event is added after it. This new event type is only handled by painting/sculpting operators, everything else can happily ignore it.
Diffstat (limited to 'source/blender/windowmanager')
-rw-r--r--source/blender/windowmanager/intern/wm_event_system.c9
-rw-r--r--source/blender/windowmanager/wm_event_types.h1
2 files changed, 9 insertions, 1 deletions
diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c
index 70e804758b2..330244e910e 100644
--- a/source/blender/windowmanager/intern/wm_event_system.c
+++ b/source/blender/windowmanager/intern/wm_event_system.c
@@ -1614,7 +1614,7 @@ void wm_event_do_handlers(bContext *C)
while( (event= win->queue.first) ) {
int action = WM_HANDLER_CONTINUE;
- if((G.f & G_DEBUG) && event && event->type!=MOUSEMOVE)
+ if((G.f & G_DEBUG) && event && !ELEM(event->type, MOUSEMOVE, INBETWEEN_MOUSEMOVE))
printf("pass on evt %d val %d\n", event->type, event->val);
wm_eventemulation(event);
@@ -2138,6 +2138,7 @@ void wm_event_add_ghostevent(wmWindowManager *wm, wmWindow *win, int type, int t
case GHOST_kEventCursorMove: {
if(win->active) {
GHOST_TEventCursorData *cd= customdata;
+ wmEvent *lastevent= win->queue.last;
#if defined(__APPLE__) && defined(GHOST_COCOA)
//Cocoa already uses coordinates with y=0 at bottom, and returns inwindow coordinates on mouse moved event
@@ -2156,6 +2157,12 @@ void wm_event_add_ghostevent(wmWindowManager *wm, wmWindow *win, int type, int t
event.type= MOUSEMOVE;
+ /* some painting operators want accurate mouse events, they can
+ handle inbetween mouse move moves, others can happily ignore
+ them for better performance */
+ if(lastevent && lastevent->type == MOUSEMOVE)
+ lastevent->type = INBETWEEN_MOUSEMOVE;
+
update_tablet_data(win, &event);
wm_event_add(win, &event);
diff --git a/source/blender/windowmanager/wm_event_types.h b/source/blender/windowmanager/wm_event_types.h
index a93214e9a54..6cb3971bd21 100644
--- a/source/blender/windowmanager/wm_event_types.h
+++ b/source/blender/windowmanager/wm_event_types.h
@@ -70,6 +70,7 @@
/* mapped with userdef */
#define WHEELINMOUSE 0x00c
#define WHEELOUTMOUSE 0x00d
+#define INBETWEEN_MOUSEMOVE 0x011
/* SYSTEM : 0x01xx */