diff --git a/source/blender/include/BIF_interface.h b/source/blender/include/BIF_interface.h index 453e4e628fe..4fadfe12297 100644 --- a/source/blender/include/BIF_interface.h +++ b/source/blender/include/BIF_interface.h @@ -188,7 +188,7 @@ void uiGetMouse(int win, short *adr); void uiComposeLinks(uiBlock *block); void uiSetButLock(int val, char *lockstr); void uiClearButLock(void); -int uiDoBlocks(struct ListBase *lb, int event); +int uiDoBlocks(struct ListBase *lb, int event, int movemouse_quit); void uiSetCurFont(uiBlock *block, int index); void uiDefFont(unsigned int index, void *xl, void *large, void *medium, void *small); void uiFreeBlock(uiBlock *block); diff --git a/source/blender/python/api2_2x/Draw.c b/source/blender/python/api2_2x/Draw.c index 54ff927a2b3..9d151bee092 100644 --- a/source/blender/python/api2_2x/Draw.c +++ b/source/blender/python/api2_2x/Draw.c @@ -730,7 +730,7 @@ void BPY_spacescript_do_pywin_event( SpaceScript * sc, unsigned short event, if (val) { - if (uiDoBlocks( &curarea->uiblocks, event ) != UI_NOTHING) event = 0; + if (uiDoBlocks( &curarea->uiblocks, event, 1 ) != UI_NOTHING) event = 0; if (event == UI_BUT_EVENT) { /* check that event is in free range for script button events; @@ -1117,7 +1117,7 @@ static PyObject *Method_UIBlock( PyObject * self, PyObject * args ) /* Done clearing events */ uiBoundsBlock(uiblock, 5); - uiDoBlocks(&listb, 0); + uiDoBlocks(&listb, 0, 1); } uiFreeBlocks(&listb); uiblock = NULL; diff --git a/source/blender/src/drawview.c b/source/blender/src/drawview.c index 0d1551cc24f..19df0f67297 100644 --- a/source/blender/src/drawview.c +++ b/source/blender/src/drawview.c @@ -2807,6 +2807,7 @@ static void draw_sculpt_depths(View3D *v3d) static void draw_viewport_fps(ScrArea *sa); + void drawview3dspace(ScrArea *sa, void *spacedata) { View3D *v3d= spacedata; @@ -3288,11 +3289,12 @@ static void draw_viewport_fps(ScrArea *sa) { float fps; char printable[16]; - printable[0] = '\0'; + if (lredrawtime == redrawtime) return; + printable[0] = '\0'; fps = (float)(1.0/(lredrawtime-redrawtime)); /* is this more then half a frame behind? */ diff --git a/source/blender/src/editaction.c b/source/blender/src/editaction.c index 9f9a32bd35e..dc13e5d3019 100644 --- a/source/blender/src/editaction.c +++ b/source/blender/src/editaction.c @@ -2668,7 +2668,7 @@ void winqreadactionspace(ScrArea *sa, void *spacedata, BWinEvent *evt) data= get_action_context(&datatype); if (val) { - if ( uiDoBlocks(&curarea->uiblocks, event)!=UI_NOTHING ) event= 0; + if ( uiDoBlocks(&curarea->uiblocks, event, 1)!=UI_NOTHING ) event= 0; /* swap mouse buttons based on user preference */ if (U.flag & USER_LMOUSESELECT) { diff --git a/source/blender/src/editimasel.c b/source/blender/src/editimasel.c index d57df3aaccf..cf6a86917b7 100644 --- a/source/blender/src/editimasel.c +++ b/source/blender/src/editimasel.c @@ -859,7 +859,7 @@ void winqreadimaselspace(ScrArea *sa, void *spacedata, BWinEvent *evt) if(val) { if( event!=RETKEY && event!=PADENTER) - if( uiDoBlocks(&curarea->uiblocks, event)!=UI_NOTHING ) event= 0; + if( uiDoBlocks(&curarea->uiblocks, event, 1)!=UI_NOTHING ) event= 0; switch(event) { diff --git a/source/blender/src/editnla.c b/source/blender/src/editnla.c index d871ef371c8..fc79c265f8d 100644 --- a/source/blender/src/editnla.c +++ b/source/blender/src/editnla.c @@ -1717,7 +1717,7 @@ void winqreadnlaspace(ScrArea *sa, void *spacedata, BWinEvent *evt) if (!snla) return; if(val) { - if( uiDoBlocks(&curarea->uiblocks, event)!=UI_NOTHING ) event= 0; + if( uiDoBlocks(&curarea->uiblocks, event, 1)!=UI_NOTHING ) event= 0; /* swap mouse buttons based on user preference */ if (U.flag & USER_LMOUSESELECT) { diff --git a/source/blender/src/editnode.c b/source/blender/src/editnode.c index e5e83152ae2..3c94c31a631 100644 --- a/source/blender/src/editnode.c +++ b/source/blender/src/editnode.c @@ -2073,7 +2073,7 @@ static int node_uiDoBlocks(ScrArea *sa, short event) ((struct Link *)block)->next= NULL; lb->first= lb->last= block; - retval= uiDoBlocks(lb, event); + retval= uiDoBlocks(lb, event, 1); ((struct Link *)block)->prev= prev; ((struct Link *)block)->next= next; diff --git a/source/blender/src/editscreen.c b/source/blender/src/editscreen.c index da6884d4394..b843d820ba5 100644 --- a/source/blender/src/editscreen.c +++ b/source/blender/src/editscreen.c @@ -531,7 +531,7 @@ static void scrarea_dispatch_header_events(ScrArea *sa) while(bwin_qread(sa->headwin, &evt)) { if(evt.val) { - if( uiDoBlocks(&curarea->uiblocks, evt.event)!=UI_NOTHING ) evt.event= 0; + if( uiDoBlocks(&curarea->uiblocks, evt.event, 1)!=UI_NOTHING ) evt.event= 0; switch(evt.event) { case UI_BUT_EVENT: diff --git a/source/blender/src/editsound.c b/source/blender/src/editsound.c index 2e333b9f43e..befcd574ac4 100644 --- a/source/blender/src/editsound.c +++ b/source/blender/src/editsound.c @@ -123,7 +123,7 @@ void winqreadsoundspace(ScrArea *sa, void *spacedata, BWinEvent *evt) if(val) { - if( uiDoBlocks(&curarea->uiblocks, event)!=UI_NOTHING ) event= 0; + if( uiDoBlocks(&curarea->uiblocks, event, 1)!=UI_NOTHING ) event= 0; /* swap mouse buttons based on user preference */ if (U.flag & USER_LMOUSESELECT) { diff --git a/source/blender/src/edittime.c b/source/blender/src/edittime.c index f90fd1c2eda..f5c6fe5a95e 100644 --- a/source/blender/src/edittime.c +++ b/source/blender/src/edittime.c @@ -836,7 +836,7 @@ void winqreadtimespace(ScrArea *sa, void *spacedata, BWinEvent *evt) if(val) { - if( uiDoBlocks(&sa->uiblocks, event)!=UI_NOTHING ) event= 0; + if( uiDoBlocks(&sa->uiblocks, event, 1)!=UI_NOTHING ) event= 0; /* swap mouse buttons based on user preference */ if (U.flag & USER_LMOUSESELECT) { diff --git a/source/blender/src/filesel.c b/source/blender/src/filesel.c index 4789cc1d7bb..d4e41e56e75 100644 --- a/source/blender/src/filesel.c +++ b/source/blender/src/filesel.c @@ -1812,7 +1812,7 @@ void winqreadfilespace(ScrArea *sa, void *spacedata, BWinEvent *evt) if(val) { if( event!=RETKEY && event!=PADENTER) - if( uiDoBlocks(&curarea->uiblocks, event)!=UI_NOTHING ) event= 0; + if( uiDoBlocks(&curarea->uiblocks, event, 1)!=UI_NOTHING ) event= 0; switch(event) { diff --git a/source/blender/src/interface.c b/source/blender/src/interface.c index 96feafef1d0..a17e488ef13 100644 --- a/source/blender/src/interface.c +++ b/source/blender/src/interface.c @@ -1304,7 +1304,7 @@ static int ui_do_but_MENU(uiBut *but) for(bt= block->buttons.first; bt; bt= bt->next) bt->win= block->win; bwin_getsinglematrix(block->win, block->winmat); - event= uiDoBlocks(&listb, 0); + event= uiDoBlocks(&listb, 0, 1); menudata_free(md); @@ -2351,7 +2351,7 @@ static int ui_do_but_ICONROW(uiBut *but) this is needs better implementation */ block->win= G.curscreen->mainwin; - uiDoBlocks(&listb, 0); + uiDoBlocks(&listb, 0, 1); but->flag &= ~UI_SELECT; ui_check_but(but); @@ -2424,7 +2424,7 @@ static int ui_do_but_ICONTEXTROW(uiBut *but) uiBoundsBlock(block, 3); - uiDoBlocks(&listb, 0); + uiDoBlocks(&listb, 0, 1); menudata_free(md); @@ -3302,7 +3302,7 @@ static int ui_do_but_COL(uiBut *but) for(bt= block->buttons.first; bt; bt= bt->next) bt->win= block->win; bwin_getsinglematrix(block->win, block->winmat); - event= uiDoBlocks(&listb, 0); + event= uiDoBlocks(&listb, 0, 1); if(but->pointype==CHA) ui_set_but_vectorf(but, colstore); @@ -4306,7 +4306,7 @@ int uiIsMenu(int *x, int *y, int *sizex, int *sizey) * UI_CONT don't pass event to other ui's * UI_RETURN something happened, return, swallow event */ -static int ui_do_block(uiBlock *block, uiEvent *uevent) +static int ui_do_block(uiBlock *block, uiEvent *uevent, int movemouse_quit) { uiBut *but, *bt; int butevent, event, retval=UI_NOTHING, count, act=0; @@ -4793,7 +4793,7 @@ static int ui_do_block(uiBlock *block, uiEvent *uevent) if((uevent->event==RETKEY || uevent->event==PADENTER) && uevent->val==1) return UI_RETURN_OK; /* check outside */ - if(inside==0) { + if(inside==0 && movemouse_quit) { uiBlock *tblock= NULL; /* check for all parent rects, enables arrowkeys to be used */ @@ -4935,7 +4935,7 @@ static void ui_do_but_tip(uiBut *buttip) } /* returns UI_NOTHING, if nothing happened */ -int uiDoBlocks(ListBase *lb, int event) +int uiDoBlocks(ListBase *lb, int event, int movemouse_quit) { /* return when: firstblock != BLOCK_LOOP * @@ -4990,7 +4990,7 @@ int uiDoBlocks(ListBase *lb, int event) } block->in_use= 1; // bit awkward, but now we can detect if frontbuf flush should be set - retval |= ui_do_block(block, &uevent); /* we 'or' because 2nd loop can return to here, and we we want 'out' to return */ + retval |= ui_do_block(block, &uevent, movemouse_quit); /* we 'or' because 2nd loop can return to here, and we we want 'out' to return */ block->in_use= 0; if(retval & UI_EXIT_LOOP) break; @@ -5034,7 +5034,7 @@ int uiDoBlocks(ListBase *lb, int event) if(uevent.event) { block->in_use= 1; // bit awkward, but now we can detect if frontbuf flush should be set - retval= ui_do_block(block, &uevent); + retval= ui_do_block(block, &uevent, movemouse_quit); block->in_use= 0; if(block->needflush) { // flush (old menu) now, maybe new menu was opened @@ -6530,7 +6530,7 @@ short pupmenu(char *instr) uiBoundsBlock(block, 1); - event= uiDoBlocks(&listb, 0); + event= uiDoBlocks(&listb, 0, 1); /* calculate last selected */ if(event & UI_RETURN_OK) { @@ -6688,7 +6688,7 @@ short pupmenu_col(char *instr, int maxrow) uiBoundsBlock(block, 1); - event= uiDoBlocks(&listb, 0); + event= uiDoBlocks(&listb, 0, 1); menudata_free(md); diff --git a/source/blender/src/space.c b/source/blender/src/space.c index b340af61cd2..84c77521841 100644 --- a/source/blender/src/space.c +++ b/source/blender/src/space.c @@ -1173,7 +1173,7 @@ static void winqreadview3dspace(ScrArea *sa, void *spacedata, BWinEvent *evt) if(val) { - if( uiDoBlocks(&curarea->uiblocks, event)!=UI_NOTHING ) event= 0; + if( uiDoBlocks(&curarea->uiblocks, event, 1)!=UI_NOTHING ) event= 0; if(event==UI_BUT_EVENT) do_butspace(val); /* temporal, view3d deserves own queue? */ @@ -2761,7 +2761,7 @@ static void winqreadipospace(ScrArea *sa, void *spacedata, BWinEvent *evt) if(sa->win==0) return; if(val) { - if( uiDoBlocks(&sa->uiblocks, event)!=UI_NOTHING ) event= 0; + if( uiDoBlocks(&sa->uiblocks, event, 1)!=UI_NOTHING ) event= 0; /* swap mouse buttons based on user preference */ if (U.flag & USER_LMOUSESELECT) { @@ -4136,7 +4136,7 @@ static void winqreadinfospace(ScrArea *sa, void *spacedata, BWinEvent *evt) short val= evt->val; if(val) { - if( uiDoBlocks(&curarea->uiblocks, event)!=UI_NOTHING ) event= 0; + if( uiDoBlocks(&curarea->uiblocks, event, 1)!=UI_NOTHING ) event= 0; switch(event) { case UI_BUT_EVENT: @@ -4255,7 +4255,7 @@ static void winqreadbutspace(ScrArea *sa, void *spacedata, BWinEvent *evt) if(val) { - if( uiDoBlocks(&curarea->uiblocks, event)!=UI_NOTHING ) event= 0; + if( uiDoBlocks(&curarea->uiblocks, event, 1)!=UI_NOTHING ) event= 0; switch(event) { case UI_BUT_EVENT: @@ -4510,7 +4510,7 @@ static void winqreadseqspace(ScrArea *sa, void *spacedata, BWinEvent *evt) if(curarea->win==0) return; if(val) { - if( uiDoBlocks(&curarea->uiblocks, event)!=UI_NOTHING ) event= 0; + if( uiDoBlocks(&curarea->uiblocks, event, 1)!=UI_NOTHING ) event= 0; /* swap mouse buttons based on user preference */ if (U.flag & USER_LMOUSESELECT) { @@ -4969,7 +4969,7 @@ static void winqreadimagespace(ScrArea *sa, void *spacedata, BWinEvent *evt) if(val==0) return; - if(uiDoBlocks(&sa->uiblocks, event)!=UI_NOTHING ) event= 0; + if(uiDoBlocks(&sa->uiblocks, event, 1)!=UI_NOTHING ) event= 0; if (U.flag & USER_LMOUSESELECT) { if (event == LEFTMOUSE) { @@ -5354,7 +5354,7 @@ static void winqreadoopsspace(ScrArea *sa, void *spacedata, BWinEvent *evt) if(val==0) return; - if( uiDoBlocks(&sa->uiblocks, event)!=UI_NOTHING ) event= 0; + if( uiDoBlocks(&sa->uiblocks, event, 1)!=UI_NOTHING ) event= 0; if (U.flag & USER_NONUMPAD) { event= convert_for_nonumpad(event); diff --git a/source/blender/src/toolbox.c b/source/blender/src/toolbox.c index f517eec055c..df8b129aea2 100644 --- a/source/blender/src/toolbox.c +++ b/source/blender/src/toolbox.c @@ -288,7 +288,7 @@ short button(short *var, short min, short max, char *str) uiBoundsBlock(block, 5); - ret= uiDoBlocks(&listb, 0); + ret= uiDoBlocks(&listb, 0, 0); if(ret==UI_RETURN_OK) return 1; return 0; @@ -322,7 +322,7 @@ short sbutton(char *var, float min, float max, char *str) uiBoundsBlock(block, 5); mainqenter_ext(BUT_ACTIVATE, 32766, 0); /* note, button id '32766' is asking for errors some day! */ - ret= uiDoBlocks(&listb, 0); + ret= uiDoBlocks(&listb, 0, 0); if(ret==UI_RETURN_OK) return 1; return 0; @@ -356,7 +356,7 @@ short fbutton(float *var, float min, float max, float a1, float a2, char *str) uiBoundsBlock(block, 2); - ret= uiDoBlocks(&listb, 0); + ret= uiDoBlocks(&listb, 0, 0); if(ret==UI_RETURN_OK) return 1; return 0; @@ -416,7 +416,7 @@ int movetolayer_buts(unsigned int *lay, char *title) uiBoundsBlock(block, 2); - ret= uiDoBlocks(&listb, 0); + ret= uiDoBlocks(&listb, 0, 0); if(ret==UI_RETURN_OK) return 1; return 0; @@ -466,7 +466,7 @@ int movetolayer_short_buts(short *lay, char *title) uiBoundsBlock(block, 2); - ret= uiDoBlocks(&listb, 0); + ret= uiDoBlocks(&listb, 0, 0); if(ret==UI_RETURN_OK) return 1; return 0; @@ -603,7 +603,7 @@ int do_clever_numbuts(char *name, int tot, int winevent) uiBoundsBlock(block, 5); - event= uiDoBlocks(&listb, 0); + event= uiDoBlocks(&listb, 0, 0); areawinset(curarea->win); @@ -2219,7 +2219,7 @@ void toolbox_n(void) } uiBoundsBlock(block, 2); - event= uiDoBlocks(&tb_listb, 0); + event= uiDoBlocks(&tb_listb, 0, 0); /* free all dynamic entries... */ BLI_freelistN(&storage);