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>2009-12-08 16:02:03 +0300
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2009-12-08 16:02:03 +0300
commit0151be0210bf58a108d90f2c36b2ab3be2294d5a (patch)
tree2f3c969e2f1184c7c78228082edebe9b818ccc1b /source/blender/editors
parent0304b623f559a515e844cdb12bec6a27e01251c2 (diff)
UI: fix trailing tooltips when deactivating window, and when opening
right click menu. Added window deactivate event for this.
Diffstat (limited to 'source/blender/editors')
-rw-r--r--source/blender/editors/interface/interface_handlers.c35
1 files changed, 25 insertions, 10 deletions
diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c
index d2545e530e4..c7c0849927c 100644
--- a/source/blender/editors/interface/interface_handlers.c
+++ b/source/blender/editors/interface/interface_handlers.c
@@ -3405,7 +3405,8 @@ static int ui_but_menu(bContext *C, uiBut *but)
if((but->rnapoin.data && but->rnaprop)==0 && but->optype==NULL)
return 0;
-
+
+ button_timers_tooltip_remove(C, but);
if(but->rnaprop)
name= (char*)RNA_property_ui_name(but->rnaprop);
@@ -3604,7 +3605,7 @@ static int ui_do_button(bContext *C, uiBlock *block, uiBut *but, wmEvent *event)
char buf[512];
if(WM_key_event_operator_string(C, but->optype->idname, but->opcontext, prop, buf, sizeof(buf))) {
-
+ button_timers_tooltip_remove(C, but);
uiPupBlock(C, menu_change_hotkey, but);
}
@@ -3832,12 +3833,14 @@ static int ui_mouse_inside_button(ARegion *ar, uiBut *but, int x, int y)
return 1;
}
-static uiBut *ui_but_find_mouse_over(ARegion *ar, int x, int y)
+static uiBut *ui_but_find_mouse_over(wmWindow *win, ARegion *ar, int x, int y)
{
uiBlock *block;
uiBut *but, *butover= NULL;
int mx, my;
+ if(!win->active)
+ return NULL;
if(!ui_mouse_inside_region(ar, x, y))
return NULL;
@@ -3859,12 +3862,14 @@ static uiBut *ui_but_find_mouse_over(ARegion *ar, int x, int y)
return butover;
}
-static uiBut *ui_list_find_mouse_over(ARegion *ar, int x, int y)
+static uiBut *ui_list_find_mouse_over(wmWindow *win, ARegion *ar, int x, int y)
{
uiBlock *block;
uiBut *but;
int mx, my;
+ if(!win->active)
+ return NULL;
if(!ui_mouse_inside_region(ar, x, y))
return NULL;
@@ -4171,10 +4176,11 @@ static uiBut *uit_but_find_open_event(ARegion *ar, wmEvent *event)
static int ui_handle_button_over(bContext *C, wmEvent *event, ARegion *ar)
{
+ wmWindow *win= CTX_wm_window(C);
uiBut *but;
if(event->type == MOUSEMOVE) {
- but= ui_but_find_mouse_over(ar, event->x, event->y);
+ but= ui_but_find_mouse_over(win, ar, event->x, event->y);
if(but)
button_activate_init(C, ar, but, BUTTON_ACTIVATE_OVER);
}
@@ -4240,14 +4246,18 @@ static int ui_handle_button_event(bContext *C, wmEvent *event, uiBut *but)
if(data->state == BUTTON_STATE_HIGHLIGHT) {
switch(event->type) {
-
+ case WINDEACTIVATE:
+ data->cancel= 1;
+ button_activate_state(C, but, BUTTON_STATE_EXIT);
+ retval= WM_UI_HANDLER_CONTINUE;
+ break;
case MOUSEMOVE:
/* verify if we are still over the button, if not exit */
if(!ui_mouse_inside_button(ar, but, event->x, event->y)) {
data->cancel= 1;
button_activate_state(C, but, BUTTON_STATE_EXIT);
}
- else if(ui_but_find_mouse_over(ar, event->x, event->y) != but) {
+ else if(ui_but_find_mouse_over(data->window, ar, event->x, event->y) != but) {
data->cancel= 1;
button_activate_state(C, but, BUTTON_STATE_EXIT);
}
@@ -4295,8 +4305,12 @@ static int ui_handle_button_event(bContext *C, wmEvent *event, uiBut *but)
}
else if(data->state == BUTTON_STATE_WAIT_RELEASE) {
switch(event->type) {
+ case WINDEACTIVATE:
+ data->cancel= 1;
+ button_activate_state(C, but, BUTTON_STATE_EXIT);
+ break;
+
case MOUSEMOVE:
-
if(ELEM(but->type,LINK, INLINK)) {
but->flag |= UI_SELECT;
ui_do_button(C, block, but, event);
@@ -4341,7 +4355,7 @@ static int ui_handle_button_event(bContext *C, wmEvent *event, uiBut *but)
else if(data->state == BUTTON_STATE_MENU_OPEN) {
switch(event->type) {
case MOUSEMOVE: {
- uiBut *bt= ui_but_find_mouse_over(ar, event->x, event->y);
+ uiBut *bt= ui_but_find_mouse_over(data->window, ar, event->x, event->y);
if(bt && bt->active != data) {
if(but->type != COL) /* exception */
@@ -4376,7 +4390,8 @@ static int ui_handle_button_event(bContext *C, wmEvent *event, uiBut *but)
static int ui_handle_list_event(bContext *C, wmEvent *event, ARegion *ar)
{
- uiBut *but= ui_list_find_mouse_over(ar, event->x, event->y);
+ wmWindow *win= CTX_wm_window(C);
+ uiBut *but= ui_list_find_mouse_over(win, ar, event->x, event->y);
int retval= WM_UI_HANDLER_CONTINUE;
int value, min, max;