[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [48182] branches/soc-2012-bratwurst/source /blender: I'm not sure G is the best place to store this, but it' s an improvement over RNA.
Jorge Rodriguez
bs.vino at gmail.com
Fri Jun 22 02:04:32 CEST 2012
Revision: 48182
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=48182
Author: vino
Date: 2012-06-22 00:04:31 +0000 (Fri, 22 Jun 2012)
Log Message:
-----------
I'm not sure G is the best place to store this, but it's an improvement over RNA.
Modified Paths:
--------------
branches/soc-2012-bratwurst/source/blender/blenkernel/BKE_global.h
branches/soc-2012-bratwurst/source/blender/editors/interface/interface_handlers.c
branches/soc-2012-bratwurst/source/blender/editors/interface/interface_regions.c
Modified: branches/soc-2012-bratwurst/source/blender/blenkernel/BKE_global.h
===================================================================
--- branches/soc-2012-bratwurst/source/blender/blenkernel/BKE_global.h 2012-06-21 22:39:26 UTC (rev 48181)
+++ branches/soc-2012-bratwurst/source/blender/blenkernel/BKE_global.h 2012-06-22 00:04:31 UTC (rev 48182)
@@ -91,6 +91,8 @@
/* save the allowed windowstate of blender when using -W or -w */
int windowstate;
+
+ double last_tooltip_close;
} Global;
/* **************** GLOBAL ********************* */
Modified: branches/soc-2012-bratwurst/source/blender/editors/interface/interface_handlers.c
===================================================================
--- branches/soc-2012-bratwurst/source/blender/editors/interface/interface_handlers.c 2012-06-21 22:39:26 UTC (rev 48181)
+++ branches/soc-2012-bratwurst/source/blender/editors/interface/interface_handlers.c 2012-06-22 00:04:31 UTC (rev 48182)
@@ -61,6 +61,7 @@
#include "BKE_texture.h"
#include "BKE_tracking.h"
#include "BKE_unit.h"
+#include "BKE_global.h"
#include "ED_screen.h"
#include "ED_util.h"
@@ -83,6 +84,7 @@
/***************** structs and defines ****************/
+#define BUTTON_TOOLTIP_RESET 0.200
#define BUTTON_TOOLTIP_DELAY 0.500
#define BUTTON_FLASH_DELAY 0.020
#define MENU_SCROLL_INTERVAL 0.1
@@ -5104,10 +5106,16 @@
data->tooltiptimer = NULL;
}
- if (U.flag & USER_TOOLTIPS)
- if (!but->block->tooltipdisabled)
- if (!wm->drags.first)
- data->tooltiptimer = WM_event_add_timer(data->wm, data->window, TIMER, BUTTON_TOOLTIP_DELAY);
+ if (U.flag & USER_TOOLTIPS) {
+ if (!but->block->tooltipdisabled) {
+ if (!wm->drags.first) {
+ if (!data->tooltip && PIL_check_seconds_timer() - G.last_tooltip_close < BUTTON_TOOLTIP_RESET)
+ data->tooltip = ui_tooltip_create(C, data->region, but);
+ else
+ data->tooltiptimer = WM_event_add_timer(data->wm, data->window, TIMER, BUTTON_TOOLTIP_DELAY);
+ }
+ }
+ }
}
static void button_activate_state(bContext *C, uiBut *but, uiHandleButtonState state)
Modified: branches/soc-2012-bratwurst/source/blender/editors/interface/interface_regions.c
===================================================================
--- branches/soc-2012-bratwurst/source/blender/editors/interface/interface_regions.c 2012-06-21 22:39:26 UTC (rev 48181)
+++ branches/soc-2012-bratwurst/source/blender/editors/interface/interface_regions.c 2012-06-22 00:04:31 UTC (rev 48182)
@@ -46,6 +46,7 @@
#include "BKE_context.h"
#include "BKE_screen.h"
+#include "BKE_global.h"
#include "WM_api.h"
#include "WM_types.h"
@@ -64,6 +65,8 @@
#include "BLF_api.h"
#include "BLF_translation.h"
+#include "PIL_time.h"
+
#include "ED_screen.h"
#include "interface_intern.h"
@@ -688,6 +691,8 @@
void ui_tooltip_free(bContext *C, ARegion *ar)
{
+ G.last_tooltip_close = PIL_check_seconds_timer();
+
ui_remove_temporary_region(C, CTX_wm_screen(C), ar);
}
More information about the Bf-blender-cvs
mailing list