Fix T42495: Fullscreen area icon glitch
Tried a couple of things to trigger an update/redraw for the exact right moment (sending azone update event, timer, delayed redraw, etc) but this seems to work rock solid without being *that* ugly.
This commit is contained in:
parent
de8e89d4f5
commit
3bffcc675b
Notes:
blender-bot
2023-02-14 09:51:49 +01:00
Referenced by issue #44514, Crash under cycles rendering using F12 Referenced by issue #42495, fullscreen area icon glitch
|
@ -86,6 +86,7 @@ void ED_area_tag_redraw(ScrArea *sa);
|
|||
void ED_area_tag_redraw_regiontype(ScrArea *sa, int type);
|
||||
void ED_area_tag_refresh(ScrArea *sa);
|
||||
void ED_area_do_refresh(struct bContext *C, ScrArea *sa);
|
||||
void ED_area_azones_update(ScrArea *sa, const int mouse_xy[]);
|
||||
void ED_area_headerprint(ScrArea *sa, const char *str);
|
||||
void ED_area_newspace(struct bContext *C, ScrArea *sa, int type);
|
||||
void ED_area_prevspace(struct bContext *C, ScrArea *sa);
|
||||
|
|
|
@ -151,6 +151,34 @@ void ED_area_do_refresh(bContext *C, ScrArea *sa)
|
|||
sa->do_refresh = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Action zones are only updated if the mouse is inside of them, but in some cases (currently only fullscreen icon)
|
||||
* it might be needed to update their properties and redraw if the mouse isn't inside.
|
||||
*/
|
||||
void ED_area_azones_update(ScrArea *sa, const int mouse_xy[2])
|
||||
{
|
||||
AZone *az;
|
||||
bool changed = false;
|
||||
|
||||
for (az = sa->actionzones.first; az; az = az->next) {
|
||||
if (az->type == AZONE_FULLSCREEN) {
|
||||
/* only if mouse is not hovering the azone */
|
||||
if (BLI_rcti_isect_pt_v(&az->rect, mouse_xy) == false) {
|
||||
az->alpha = 0.0f;
|
||||
changed = true;
|
||||
|
||||
/* can break since currently only this is handled here */
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (changed) {
|
||||
sa->flag &= ~AREA_FLAG_ACTIONZONES_UPDATE;
|
||||
ED_area_tag_redraw(sa);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Corner widget use for quitting fullscreen.
|
||||
*/
|
||||
|
@ -369,6 +397,11 @@ static void region_draw_azone_tria(AZone *az)
|
|||
glDisable(GL_BLEND);
|
||||
}
|
||||
|
||||
static void area_azone_tag_update(ScrArea *sa)
|
||||
{
|
||||
sa->flag |= AREA_FLAG_ACTIONZONES_UPDATE;
|
||||
}
|
||||
|
||||
static void region_draw_azones(ScrArea *sa, ARegion *ar)
|
||||
{
|
||||
AZone *az;
|
||||
|
@ -409,6 +442,10 @@ static void region_draw_azones(ScrArea *sa, ARegion *ar)
|
|||
}
|
||||
else if (az->type == AZONE_FULLSCREEN) {
|
||||
area_draw_azone_fullscreen(az->x1, az->y1, az->x2, az->y2, az->alpha);
|
||||
|
||||
if (az->alpha != 0.0f) {
|
||||
area_azone_tag_update(sa);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -281,6 +281,8 @@ enum {
|
|||
AREA_FLAG_TEMP_TYPE = (1 << 6),
|
||||
/* for temporary fullscreens (file browser, image editor render) that are opened above user set fullscreens */
|
||||
AREA_FLAG_STACKED_FULLSCREEN = (1 << 7),
|
||||
/* update action zones (even if the mouse is not intersecting them) */
|
||||
AREA_FLAG_ACTIONZONES_UPDATE = (1 << 8),
|
||||
};
|
||||
|
||||
#define EDGEWIDTH 1
|
||||
|
|
|
@ -2330,6 +2330,11 @@ void wm_event_do_handlers(bContext *C)
|
|||
break;
|
||||
}
|
||||
|
||||
/* update azones if needed - done here because it needs to be independent from redraws */
|
||||
if (sa->flag & AREA_FLAG_ACTIONZONES_UPDATE) {
|
||||
ED_area_azones_update(sa, &event->x);
|
||||
}
|
||||
|
||||
if (wm_event_inside_i(event, &sa->totrct)) {
|
||||
CTX_wm_area_set(C, sa);
|
||||
|
||||
|
|
Loading…
Reference in New Issue