Index: source/blender/include/BIF_screen.h =================================================================== --- source/blender/include/BIF_screen.h (revision 17720) +++ source/blender/include/BIF_screen.h (working copy) @@ -110,6 +110,7 @@ void unlink_screen(struct bScreen *sc); void reset_autosave(void); int area_is_active_area(struct ScrArea *area); +short area_get_headbutofs(struct ScrArea *area); void draw_area_emboss(struct ScrArea *sa); void headerprint(char *str); Index: source/blender/src/editscreen.c =================================================================== --- source/blender/src/editscreen.c (revision 17720) +++ source/blender/src/editscreen.c (working copy) @@ -255,7 +255,7 @@ headerbox(curarea); BIF_ThemeColor(TH_MENU_TEXT); /* better than cpack(0x0) color no? (desoto) */ - glRasterPos2i(20+curarea->headbutofs, 6); + glRasterPos2i(20+area_get_headbutofs(curarea), 6); BMF_DrawString(G.font, str); curarea->head_swap= WIN_BACK_OK; @@ -379,6 +379,7 @@ { float width= area->winx; int active=0; + short butofs = area_get_headbutofs(area); glClearColor(SCR_BACK, SCR_BACK, SCR_BACK, 0.0); glClear(GL_COLOR_BUFFER_BIT); @@ -391,11 +392,11 @@ /* weird values here... is because of window matrix that centers buttons */ if(area->headertype==HEADERTOP) { uiSetRoundBox(3); - uiRoundBoxEmboss(-0.5+area->headbutofs, -10.0, width-1.5+area->headbutofs, HEADERY-2.0, SCR_ROUND, active); + uiRoundBoxEmboss(-0.5+butofs, -10.0, width-1.5+butofs, HEADERY-2.0, SCR_ROUND, active); } else { uiSetRoundBox(12); - uiRoundBoxEmboss(-0.5+area->headbutofs, -3.5, width-1.5+area->headbutofs, HEADERY+10, SCR_ROUND, active); + uiRoundBoxEmboss(-0.5+butofs, -3.5, width-1.5+butofs, HEADERY+10, SCR_ROUND, active); } uiSetRoundBox(15); @@ -406,6 +407,24 @@ return (g_activearea && area==g_activearea); } +short area_get_headbutofs(struct ScrArea *area) +{ + if(area->headbutlen < area->winx) { + return 0; + } + /* I don't know why this calculus was used because it's cryptic and doesn't really work */ + //else if(area->headbutofs + area->winx > area->headbutlen) { + // return (area->headbutlen - area->winx); + //} + /* This one is a bit more clear and straightforward */ + else if (area->winx - area->headbutlen > area->headbutofs) + { + return (area->winx - area->headbutlen); + } + + return area->headbutofs; +} + void scrarea_do_headdraw(ScrArea *area) { if (area->headertype) { @@ -442,7 +461,7 @@ } void scrarea_do_headchange(ScrArea *area) { - float ofs= area->headbutofs; + float ofs= area_get_headbutofs(area); if (area->headertype==HEADERDOWN) { bwin_ortho2(area->headwin, -0.375+ofs, area->headrct.xmax-area->headrct.xmin-0.375+ofs, -3.375, area->headrct.ymax-area->headrct.ymin-3.375+1.0); @@ -2008,13 +2027,16 @@ mywinposition(sa->headwin, sa->headrct.xmin, sa->headrct.xmax, sa->headrct.ymin, sa->headrct.ymax); addqueue(sa->headwin, CHANGED, 1); } - + + /* Offsets validation is generally done on drawing, not by hard-changing the value. */ + /* This causes problems because it forces a user option to change */ + /* instead of just checking if its value is correct or not. */ if(sa->headbutlenwinx) { - sa->headbutofs= 0; + //sa->headbutofs= 0; addqueue(sa->headwin, CHANGED, 1); } else if(sa->headbutofs+sa->winx > sa->headbutlen) { - sa->headbutofs= sa->headbutlen-sa->winx; + //sa->headbutofs= sa->headbutlen-sa->winx; addqueue(sa->headwin, CHANGED, 1); } }