Fix T72000: Key shortcuts unavailable in popovers
This commit is contained in:
parent
56283464b8
commit
f478fef9d6
Notes:
blender-bot
2023-02-14 04:24:05 +01:00
Referenced by issue #72216, Copied Particles not refreshing in the viewport. Referenced by issue #72054, Sculpt Mode crash when using Relax Mesh Filter with Dyntopo enabled Referenced by issue #72000, Key shortcuts unavailable in popovers
|
@ -294,6 +294,7 @@ typedef struct uiHandleButtonMulti {
|
|||
typedef struct uiHandleButtonData {
|
||||
wmWindowManager *wm;
|
||||
wmWindow *window;
|
||||
ScrArea *area;
|
||||
ARegion *region;
|
||||
|
||||
bool interactive;
|
||||
|
@ -7721,7 +7722,8 @@ static void button_tooltip_timer_reset(bContext *C, uiBut *but)
|
|||
if (!wm->drags.first) {
|
||||
bool is_label = UI_but_has_tooltip_label(but);
|
||||
double delay = is_label ? UI_TOOLTIP_DELAY_LABEL : UI_TOOLTIP_DELAY;
|
||||
WM_tooltip_timer_init_ex(C, data->window, data->region, ui_but_tooltip_init, delay);
|
||||
WM_tooltip_timer_init_ex(
|
||||
C, data->window, data->area, data->region, ui_but_tooltip_init, delay);
|
||||
if (is_label) {
|
||||
bScreen *sc = WM_window_get_active_screen(data->window);
|
||||
if (sc->tool_tip) {
|
||||
|
@ -7927,6 +7929,7 @@ static void button_activate_init(bContext *C, ARegion *ar, uiBut *but, uiButtonA
|
|||
data = MEM_callocN(sizeof(uiHandleButtonData), "uiHandleButtonData");
|
||||
data->wm = CTX_wm_manager(C);
|
||||
data->window = CTX_wm_window(C);
|
||||
data->area = CTX_wm_area(C);
|
||||
BLI_assert(ar != NULL);
|
||||
data->region = ar;
|
||||
|
||||
|
@ -8009,7 +8012,7 @@ static void button_activate_init(bContext *C, ARegion *ar, uiBut *but, uiButtonA
|
|||
/* Show a label for this button. */
|
||||
bScreen *sc = WM_window_get_active_screen(data->window);
|
||||
if ((PIL_check_seconds_timer() - WM_tooltip_time_closed()) < 0.1) {
|
||||
WM_tooltip_immediate_init(C, CTX_wm_window(C), ar, ui_but_tooltip_init);
|
||||
WM_tooltip_immediate_init(C, CTX_wm_window(C), data->area, ar, ui_but_tooltip_init);
|
||||
if (sc->tool_tip) {
|
||||
sc->tool_tip->pass = 1;
|
||||
}
|
||||
|
|
|
@ -821,15 +821,18 @@ typedef struct ARegion *(*wmTooltipInitFn)(struct bContext *C,
|
|||
|
||||
void WM_tooltip_immediate_init(struct bContext *C,
|
||||
struct wmWindow *win,
|
||||
struct ScrArea *sa,
|
||||
struct ARegion *ar,
|
||||
wmTooltipInitFn init);
|
||||
void WM_tooltip_timer_init_ex(struct bContext *C,
|
||||
struct wmWindow *win,
|
||||
struct ScrArea *sa,
|
||||
struct ARegion *ar,
|
||||
wmTooltipInitFn init,
|
||||
double delay);
|
||||
void WM_tooltip_timer_init(struct bContext *C,
|
||||
struct wmWindow *win,
|
||||
struct ScrArea *sa,
|
||||
struct ARegion *ar,
|
||||
wmTooltipInitFn init);
|
||||
void WM_tooltip_timer_clear(struct bContext *C, struct wmWindow *win);
|
||||
|
|
|
@ -894,6 +894,8 @@ typedef struct wmDropBox {
|
|||
typedef struct wmTooltipState {
|
||||
/** Create tooltip on this event. */
|
||||
struct wmTimer *timer;
|
||||
/** The area the tooltip is created in. */
|
||||
struct ScrArea *area_from;
|
||||
/** The region the tooltip is created in. */
|
||||
struct ARegion *region_from;
|
||||
/** The tooltip region. */
|
||||
|
|
|
@ -2850,7 +2850,7 @@ static int wm_handlers_do_intern(bContext *C, wmEvent *event, ListBase *handlers
|
|||
if (wm_gizmomap_highlight_set(gzmap, C, gz, part)) {
|
||||
if (gz != NULL) {
|
||||
if (U.flag & USER_TOOLTIPS) {
|
||||
WM_tooltip_timer_init(C, CTX_wm_window(C), region, WM_gizmomap_tooltip_init);
|
||||
WM_tooltip_timer_init(C, CTX_wm_window(C), area, region, WM_gizmomap_tooltip_init);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -42,7 +42,8 @@ double WM_tooltip_time_closed(void)
|
|||
return g_tooltip_time_closed;
|
||||
}
|
||||
|
||||
void WM_tooltip_immediate_init(bContext *C, wmWindow *win, ARegion *ar, wmTooltipInitFn init)
|
||||
void WM_tooltip_immediate_init(
|
||||
bContext *C, wmWindow *win, ScrArea *sa, ARegion *ar, wmTooltipInitFn init)
|
||||
{
|
||||
WM_tooltip_timer_clear(C, win);
|
||||
|
||||
|
@ -50,13 +51,14 @@ void WM_tooltip_immediate_init(bContext *C, wmWindow *win, ARegion *ar, wmToolti
|
|||
if (screen->tool_tip == NULL) {
|
||||
screen->tool_tip = MEM_callocN(sizeof(*screen->tool_tip), __func__);
|
||||
}
|
||||
screen->tool_tip->area_from = sa;
|
||||
screen->tool_tip->region_from = ar;
|
||||
screen->tool_tip->init = init;
|
||||
WM_tooltip_init(C, win);
|
||||
}
|
||||
|
||||
void WM_tooltip_timer_init_ex(
|
||||
bContext *C, wmWindow *win, ARegion *ar, wmTooltipInitFn init, double delay)
|
||||
bContext *C, wmWindow *win, ScrArea *sa, ARegion *ar, wmTooltipInitFn init, double delay)
|
||||
{
|
||||
WM_tooltip_timer_clear(C, win);
|
||||
|
||||
|
@ -65,14 +67,16 @@ void WM_tooltip_timer_init_ex(
|
|||
if (screen->tool_tip == NULL) {
|
||||
screen->tool_tip = MEM_callocN(sizeof(*screen->tool_tip), __func__);
|
||||
}
|
||||
screen->tool_tip->area_from = sa;
|
||||
screen->tool_tip->region_from = ar;
|
||||
screen->tool_tip->timer = WM_event_add_timer(wm, win, TIMER, delay);
|
||||
screen->tool_tip->init = init;
|
||||
}
|
||||
|
||||
void WM_tooltip_timer_init(bContext *C, wmWindow *win, ARegion *ar, wmTooltipInitFn init)
|
||||
void WM_tooltip_timer_init(
|
||||
bContext *C, wmWindow *win, ScrArea *sa, ARegion *ar, wmTooltipInitFn init)
|
||||
{
|
||||
WM_tooltip_timer_init_ex(C, win, ar, init, UI_TOOLTIP_DELAY);
|
||||
WM_tooltip_timer_init_ex(C, win, sa, ar, init, UI_TOOLTIP_DELAY);
|
||||
}
|
||||
|
||||
void WM_tooltip_timer_clear(bContext *C, wmWindow *win)
|
||||
|
@ -112,11 +116,21 @@ void WM_tooltip_init(bContext *C, wmWindow *win)
|
|||
}
|
||||
const int pass_prev = screen->tool_tip->pass;
|
||||
double pass_delay = 0.0;
|
||||
screen->tool_tip->region = screen->tool_tip->init(C,
|
||||
screen->tool_tip->region_from,
|
||||
&screen->tool_tip->pass,
|
||||
&pass_delay,
|
||||
&screen->tool_tip->exit_on_event);
|
||||
|
||||
{
|
||||
ScrArea *area_prev = CTX_wm_area(C);
|
||||
ARegion *ar_prev = CTX_wm_region(C);
|
||||
CTX_wm_area_set(C, screen->tool_tip->area_from);
|
||||
CTX_wm_region_set(C, screen->tool_tip->region_from);
|
||||
screen->tool_tip->region = screen->tool_tip->init(C,
|
||||
screen->tool_tip->region_from,
|
||||
&screen->tool_tip->pass,
|
||||
&pass_delay,
|
||||
&screen->tool_tip->exit_on_event);
|
||||
CTX_wm_area_set(C, area_prev);
|
||||
CTX_wm_region_set(C, ar_prev);
|
||||
}
|
||||
|
||||
copy_v2_v2_int(screen->tool_tip->event_xy, &win->eventstate->x);
|
||||
if (pass_prev != screen->tool_tip->pass) {
|
||||
/* The pass changed, add timer for next pass. */
|
||||
|
|
Loading…
Reference in New Issue