Bugfix #28298
authorTon Roosendaal <ton@blender.org>
Thu, 25 Oct 2012 12:53:27 +0000 (12:53 +0000)
committerTon Roosendaal <ton@blender.org>
Thu, 25 Oct 2012 12:53:27 +0000 (12:53 +0000)
When I added DPI support in the UI, I added code that refreshes views for 2d
regions. These refreshes also happened on screen switches or file select, causing
header views (horizontal scrolled) to clear.

Now the code less intrusive, changing header views in fewer cases.

This is a patch provided by Anthony Edlin. Thanks dude!

source/blender/editors/interface/view2d.c
source/blender/editors/screen/area.c

index 559602b04c04314c5abb405e6d9e8bb4987ae4f9..fb7a26155838fcd6e161ba548449c180047c0104 100644 (file)
@@ -476,8 +476,14 @@ void UI_view2d_curRect_validate_resize(View2D *v2d, int resize)
                                if (winy < v2d->oldwiny) {
                                        float temp = v2d->oldwiny - winy;
                                        
-                                       cur->ymin += temp;
-                                       cur->ymax += temp;
+                                       if (v2d->align & V2D_ALIGN_NO_NEG_Y) {
+                                               cur->ymin -= temp;
+                                               cur->ymax -= temp;
+                                       }
+                                       else { /* Assume V2D_ALIGN_NO_POS_Y or combination */
+                                               cur->ymin += temp;
+                                               cur->ymax += temp;
+                                       }
                                }
 
                        }
index eb08ba7d92ed739b519d9a9430aca559f3e26c0d..c0f8da89306c1d8b0046eab54a20e2ada8471167 100644 (file)
@@ -1259,10 +1259,6 @@ void ED_area_initialize(wmWindowManager *wm, wmWindow *win, ScrArea *sa)
                        /* prevent uiblocks to run */
                        uiFreeBlocks(NULL, &ar->uiblocks);
                }
-               
-               /* rechecks 2d matrix for header on dpi changing, do not do for other regions, it resets view && blocks view2d operator polls (ton) */
-               if (ar->regiontype == RGN_TYPE_HEADER)
-                       ar->v2d.flag &= ~V2D_IS_INITIALISED;
        }
 }
 
@@ -1775,7 +1771,7 @@ void ED_region_header(const bContext *C, ARegion *ar)
        }
 
        /* always as last  */
-       UI_view2d_totRect_set(&ar->v2d, maxco + UI_UNIT_X + 80, BLI_rctf_size_y(&ar->v2d.tot));
+       UI_view2d_totRect_set(&ar->v2d, maxco + UI_UNIT_X + 80, headery);
 
        /* restore view matrix? */
        UI_view2d_view_restore(C);