Revision: 23446 http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=23446 Author: campbellbarton Date: 2009-09-24 12:35:04 +0200 (Thu, 24 Sep 2009)
Log Message: ----------- fix for middle mouse up events not working with modal keymaps (used for fly mode). With mouse events event->val started as 0/1 for press/release but later the tweak function made LMB and RMB zero value into KM_RELEASE, somehow MMB didnt get used by the tweak function so was left at 0 and the modal keymap function failed when comparing MMB Mouse ups. now initialize event->val as KM_PRESS/KM_RELEASE Modified Paths: -------------- trunk/blender/source/blender/editors/animation/anim_ops.c trunk/blender/source/blender/editors/armature/editarmature_sketch.c trunk/blender/source/blender/editors/interface/interface_handlers.c trunk/blender/source/blender/editors/interface/view2d_ops.c trunk/blender/source/blender/editors/mesh/loopcut.c trunk/blender/source/blender/editors/screen/screen_ops.c trunk/blender/source/blender/editors/sculpt_paint/paint_stroke.c trunk/blender/source/blender/editors/space_image/image_ops.c trunk/blender/source/blender/editors/space_node/node_select.c trunk/blender/source/blender/editors/space_view3d/view3d_edit.c trunk/blender/source/blender/windowmanager/intern/wm_event_system.c trunk/blender/source/blender/windowmanager/intern/wm_operators.c Modified: trunk/blender/source/blender/editors/animation/anim_ops.c =================================================================== --- trunk/blender/source/blender/editors/animation/anim_ops.c 2009-09-24 10:04:43 UTC (rev 23445) +++ trunk/blender/source/blender/editors/animation/anim_ops.c 2009-09-24 10:35:04 UTC (rev 23446) @@ -193,7 +193,7 @@ /* we check for either mouse-button to end, as checking for ACTIONMOUSE (which is used to init * the modal op) doesn't work for some reason */ - if (event->val==0) { + if (event->val==KM_RELEASE) { change_frame_exit(C, op); return OPERATOR_FINISHED; } Modified: trunk/blender/source/blender/editors/armature/editarmature_sketch.c =================================================================== --- trunk/blender/source/blender/editors/armature/editarmature_sketch.c 2009-09-24 10:04:43 UTC (rev 23445) +++ trunk/blender/source/blender/editors/armature/editarmature_sketch.c 2009-09-24 10:35:04 UTC (rev 23446) @@ -2675,7 +2675,7 @@ retval = OPERATOR_CANCELLED; break; case LEFTMOUSE: - if (event->val == 0) + if (event->val == KM_RELEASE) { if (gesture == 0) { Modified: trunk/blender/source/blender/editors/interface/interface_handlers.c =================================================================== --- trunk/blender/source/blender/editors/interface/interface_handlers.c 2009-09-24 10:04:43 UTC (rev 23445) +++ trunk/blender/source/blender/editors/interface/interface_handlers.c 2009-09-24 10:35:04 UTC (rev 23446) @@ -1660,7 +1660,7 @@ break; } case LEFTMOUSE: - if(event->val == 0) + if(event->val == KM_RELEASE) button_activate_state(C, but, BUTTON_STATE_TEXT_EDITING); retval= WM_UI_HANDLER_BREAK; break; Modified: trunk/blender/source/blender/editors/interface/view2d_ops.c =================================================================== --- trunk/blender/source/blender/editors/interface/view2d_ops.c 2009-09-24 10:04:43 UTC (rev 23445) +++ trunk/blender/source/blender/editors/interface/view2d_ops.c 2009-09-24 10:35:04 UTC (rev 23446) @@ -237,7 +237,7 @@ case LEFTMOUSE: case MIDDLEMOUSE: - if (event->val==0) { + if (event->val==KM_RELEASE) { /* calculate overall delta mouse-movement for redo */ RNA_int_set(op->ptr, "deltax", (vpd->startx - vpd->lastx)); RNA_int_set(op->ptr, "deltay", (vpd->starty - vpd->lasty)); @@ -836,7 +836,7 @@ case LEFTMOUSE: case MIDDLEMOUSE: - if (event->val==0) { + if (event->val==KM_RELEASE) { /* for redo, store the overall deltas - need to respect zoom-locks here... */ if ((v2d->keepzoom & V2D_LOCKZOOM_X)==0) RNA_float_set(op->ptr, "deltax", vzd->dx); @@ -1244,7 +1244,7 @@ break; case LEFTMOUSE: - if (event->val==0) { + if (event->val==KM_RELEASE) { scroller_activate_exit(C, op); return OPERATOR_FINISHED; } Modified: trunk/blender/source/blender/editors/mesh/loopcut.c =================================================================== --- trunk/blender/source/blender/editors/mesh/loopcut.c 2009-09-24 10:04:43 UTC (rev 23445) +++ trunk/blender/source/blender/editors/mesh/loopcut.c 2009-09-24 10:35:04 UTC (rev 23446) @@ -380,7 +380,7 @@ switch (event->type) { case RIGHTMOUSE: case LEFTMOUSE: /* confirm */ // XXX hardcoded - if (event->val == 0) { + if (event->val == KM_RELEASE) { /* finish */ ED_region_tag_redraw(lcd->ar); Modified: trunk/blender/source/blender/editors/screen/screen_ops.c =================================================================== --- trunk/blender/source/blender/editors/screen/screen_ops.c 2009-09-24 10:04:43 UTC (rev 23445) +++ trunk/blender/source/blender/editors/screen/screen_ops.c 2009-09-24 10:35:04 UTC (rev 23446) @@ -604,7 +604,7 @@ sad->sa2= screen_areahascursor(CTX_wm_screen(C), event->x, event->y); break; case LEFTMOUSE: /* release LMB */ - if(event->val==0) { + if(event->val==KM_RELEASE) { if(!sad->sa2 || sad->sa1 == sad->sa2) { return area_swap_cancel(C, op); @@ -1225,7 +1225,7 @@ break; case LEFTMOUSE: - if(event->val==0) { /* mouse up */ + if(event->val==KM_RELEASE) { /* mouse up */ area_split_exit(C, op); return OPERATOR_FINISHED; } @@ -1345,7 +1345,7 @@ break; case LEFTMOUSE: - if(event->val==0) { + if(event->val==KM_RELEASE) { if(ABS(event->x - rmd->origx) < 2 && ABS(event->y - rmd->origy) < 2) { if(rmd->ar->flag & RGN_FLAG_HIDDEN) { @@ -1828,7 +1828,7 @@ } break; case LEFTMOUSE: - if(event->val==0) { + if(event->val==KM_RELEASE) { area_join_apply(C, op); WM_event_add_notifier(C, NC_SCREEN|NA_EDITED, NULL); area_join_exit(C, op); Modified: trunk/blender/source/blender/editors/sculpt_paint/paint_stroke.c =================================================================== --- trunk/blender/source/blender/editors/sculpt_paint/paint_stroke.c 2009-09-24 10:04:43 UTC (rev 23445) +++ trunk/blender/source/blender/editors/sculpt_paint/paint_stroke.c 2009-09-24 10:35:04 UTC (rev 23446) @@ -263,7 +263,7 @@ } /* TODO: fix hardcoded event here */ - if(event->type == LEFTMOUSE && event->val == 0) { + if(event->type == LEFTMOUSE && event->val == KM_RELEASE) { /* Exit stroke, free data */ if(stroke->smooth_stroke_cursor) Modified: trunk/blender/source/blender/editors/space_image/image_ops.c =================================================================== --- trunk/blender/source/blender/editors/space_image/image_ops.c 2009-09-24 10:04:43 UTC (rev 23445) +++ trunk/blender/source/blender/editors/space_image/image_ops.c 2009-09-24 10:35:04 UTC (rev 23446) @@ -224,7 +224,7 @@ view_pan_exec(C, op); break; case MIDDLEMOUSE: - if(event->val==0) { + if(event->val==KM_RELEASE) { view_pan_exit(C, op, 0); return OPERATOR_FINISHED; } @@ -339,7 +339,7 @@ ED_area_tag_redraw(CTX_wm_area(C)); break; case MIDDLEMOUSE: - if(event->val==0) { + if(event->val==KM_RELEASE) { view_zoom_exit(C, op, 0); return OPERATOR_FINISHED; } Modified: trunk/blender/source/blender/editors/space_node/node_select.c =================================================================== --- trunk/blender/source/blender/editors/space_node/node_select.c 2009-09-24 10:04:43 UTC (rev 23445) +++ trunk/blender/source/blender/editors/space_node/node_select.c 2009-09-24 10:35:04 UTC (rev 23446) @@ -140,7 +140,7 @@ printf("%d %d\n", event->x, event->y); break; case SELECTMOUSE: - //if (event->val==0) { + //if (event->val==KM_RELEASE) { /* calculate overall delta mouse-movement for redo */ printf("done translating\n"); //WM_cursor_restore(CTX_wm_window(C)); Modified: trunk/blender/source/blender/editors/space_view3d/view3d_edit.c =================================================================== --- trunk/blender/source/blender/editors/space_view3d/view3d_edit.c 2009-09-24 10:04:43 UTC (rev 23445) +++ trunk/blender/source/blender/editors/space_view3d/view3d_edit.c 2009-09-24 10:35:04 UTC (rev 23446) @@ -505,7 +505,7 @@ default: /* origkey may be zero when invoked from a button */ - if(ELEM3(event->type, ESCKEY, LEFTMOUSE, RIGHTMOUSE) || (event->type==vod->origkey && event->val==0)) { + if(ELEM3(event->type, ESCKEY, LEFTMOUSE, RIGHTMOUSE) || (event->type==vod->origkey && event->val==KM_RELEASE)) { request_depth_update(CTX_wm_region_view3d(C)); MEM_freeN(vod); @@ -606,7 +606,7 @@ default: /* origkey may be zero when invoked from a button */ - if(ELEM3(event->type, ESCKEY, LEFTMOUSE, RIGHTMOUSE) || (event->type==vod->origkey && event->val==0)) { + if(ELEM3(event->type, ESCKEY, LEFTMOUSE, RIGHTMOUSE) || (event->type==vod->origkey && event->val==KM_RELEASE)) { request_depth_update(CTX_wm_region_view3d(C)); MEM_freeN(vod); @@ -767,7 +767,7 @@ default: /* origkey may be zero when invoked from a button */ - if(ELEM3(event->type, ESCKEY, LEFTMOUSE, RIGHTMOUSE) || (event->type==vod->origkey && event->val==0)) { + if(ELEM3(event->type, ESCKEY, LEFTMOUSE, RIGHTMOUSE) || (event->type==vod->origkey && event->val==KM_RELEASE)) { request_depth_update(CTX_wm_region_view3d(C)); MEM_freeN(vod); Modified: trunk/blender/source/blender/windowmanager/intern/wm_event_system.c =================================================================== --- trunk/blender/source/blender/windowmanager/intern/wm_event_system.c 2009-09-24 10:04:43 UTC (rev 23445) +++ trunk/blender/source/blender/windowmanager/intern/wm_event_system.c 2009-09-24 10:35:04 UTC (rev 23446) @@ -1004,7 +1004,7 @@ int always_pass; if(handlers==NULL) return action; - + /* modal handlers can get removed in this loop, we keep the loop this way */ for(handler= handlers->first; handler; handler= nexthandler) { nexthandler= handler->next; @@ -1157,7 +1157,7 @@ while( (event= win->queue.first) ) { int action; - + CTX_wm_window_set(C, win); /* we let modal handlers get active area/region, also wm_paintcursor_test needs it */ @@ -1176,7 +1176,7 @@ /* builtin tweak, if action is break it removes tweak */ wm_tweakevent_test(C, event, action); - + if(action==WM_HANDLER_CONTINUE) { ScrArea *sa; ARegion *ar; @@ -1189,7 +1189,7 @@ /* for regions having custom cursors */ wm_paintcursor_test(C, event); } - + for(sa= win->screen->areabase.first; sa; sa= sa->next) { if(wm_event_inside_i(event, &sa->totrct)) { CTX_wm_area_set(C, sa); @@ -1575,7 +1575,7 @@ case GHOST_kEventButtonDown: case GHOST_kEventButtonUp: { GHOST_TEventButtonData *bd= customdata; - event.val= (type==GHOST_kEventButtonDown); + event.val= (type==GHOST_kEventButtonDown) ? KM_PRESS:KM_RELEASE; /* Note!, this starts as 0/1 but later is converted to KM_PRESS/KM_RELEASE by tweak */ if (bd->button == GHOST_kButtonMaskLeft) event.type= LEFTMOUSE; Modified: trunk/blender/source/blender/windowmanager/intern/wm_operators.c =================================================================== --- trunk/blender/source/blender/windowmanager/intern/wm_operators.c 2009-09-24 10:04:43 UTC (rev 23445) +++ trunk/blender/source/blender/windowmanager/intern/wm_operators.c 2009-09-24 10:35:04 UTC (rev 23446) @@ -1485,7 +1485,7 @@ case LEFTMOUSE: case MIDDLEMOUSE: case RIGHTMOUSE: - if(event->val==0) { /* key release */ @@ Diff output truncated at 10240 characters. @@ _______________________________________________ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org http://lists.blender.org/mailman/listinfo/bf-blender-cvs