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@gmail.com>2018-04-29 13:24:08 +0300
committerBrecht Van Lommel <brechtvanlommel@gmail.com>2018-04-29 23:11:12 +0300
commit7a9f64e6657a231289f56b0a8c9949c8f7a23c59 (patch)
treeefee3c4ac1988ad96d743f1d82e7a677096ca0c3 /source/blender/editors/space_topbar
parent0c512a6f951e36e29d2f6865cc975f7e40c4d31d (diff)
UI: better support for dynamically sized regions in topbar.
Dynamically sized regions in the topbar were flickering due to only updating their size after redraws. Now there is an optional layout() callback for all regions in an area to do UI layout first, then refresh the region layout, and then do the actual drawing for each region. Task T54753
Diffstat (limited to 'source/blender/editors/space_topbar')
-rw-r--r--source/blender/editors/space_topbar/space_topbar.c16
1 files changed, 4 insertions, 12 deletions
diff --git a/source/blender/editors/space_topbar/space_topbar.c b/source/blender/editors/space_topbar/space_topbar.c
index f2824b3bf70..fc76fd9c638 100644
--- a/source/blender/editors/space_topbar/space_topbar.c
+++ b/source/blender/editors/space_topbar/space_topbar.c
@@ -132,11 +132,6 @@ static void topbar_main_region_init(wmWindowManager *wm, ARegion *region)
WM_event_add_keymap_handler(&region->handlers, keymap);
}
-static void topbar_main_region_draw(const bContext *C, ARegion *region)
-{
- ED_region_header(C, region);
-}
-
static void topbar_operatortypes(void)
{
@@ -156,11 +151,6 @@ static void topbar_header_region_init(wmWindowManager *UNUSED(wm), ARegion *ar)
ED_region_header_init(ar);
}
-static void topbar_header_region_draw(const bContext *C, ARegion *ar)
-{
- ED_region_header(C, ar);
-}
-
static void topbar_main_region_listener(bScreen *UNUSED(sc), ScrArea *UNUSED(sa), ARegion *ar,
wmNotifier *wmn, const Scene *UNUSED(scene))
{
@@ -263,7 +253,8 @@ void ED_spacetype_topbar(void)
art = MEM_callocN(sizeof(ARegionType), "spacetype topbar main region");
art->regionid = RGN_TYPE_WINDOW;
art->init = topbar_main_region_init;
- art->draw = topbar_main_region_draw;
+ art->layout = ED_region_header_layout;
+ art->draw = ED_region_header_draw;
art->listener = topbar_main_region_listener;
art->prefsizex = UI_UNIT_X * 5; /* Mainly to avoid glitches */
art->keymapflag = ED_KEYMAP_UI | ED_KEYMAP_VIEW2D | ED_KEYMAP_HEADER;
@@ -279,7 +270,8 @@ void ED_spacetype_topbar(void)
art->listener = topbar_header_listener;
art->message_subscribe = topbar_header_region_message_subscribe;
art->init = topbar_header_region_init;
- art->draw = topbar_header_region_draw;
+ art->layout = ED_region_header_layout;
+ art->draw = ED_region_header_draw;
BLI_addhead(&st->regiontypes, art);