diff options
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/editors/screen/screen_edit.c | 71 | ||||
-rw-r--r-- | source/blender/editors/screen/screen_intern.h | 4 | ||||
-rw-r--r-- | source/blender/editors/screen/screen_ops.c | 42 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_dragdrop.c | 12 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_draw.c | 15 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_gesture.c | 12 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_subwindow.c | 11 |
7 files changed, 96 insertions, 71 deletions
diff --git a/source/blender/editors/screen/screen_edit.c b/source/blender/editors/screen/screen_edit.c index af00c921d80..61d28a45fac 100644 --- a/source/blender/editors/screen/screen_edit.c +++ b/source/blender/editors/screen/screen_edit.c @@ -265,7 +265,9 @@ int scredge_is_horizontal(ScrEdge *se) } /* need win size to make sure not to include edges along screen edge */ -ScrEdge *screen_find_active_scredge(bScreen *sc, int winsizex, int winsizey, int mx, int my) +ScrEdge *screen_find_active_scredge(bScreen *sc, + const int winsize_x, const int winsize_y, + const int mx, const int my) { ScrEdge *se; int safety = U.widget_unit / 10; @@ -274,7 +276,7 @@ ScrEdge *screen_find_active_scredge(bScreen *sc, int winsizex, int winsizey, int for (se = sc->edgebase.first; se; se = se->next) { if (scredge_is_horizontal(se)) { - if (se->v1->vec.y > 0 && se->v1->vec.y < winsizey - 1) { + if (se->v1->vec.y > 0 && se->v1->vec.y < winsize_y - 1) { short min, max; min = MIN2(se->v1->vec.x, se->v2->vec.x); max = MAX2(se->v1->vec.x, se->v2->vec.x); @@ -284,7 +286,7 @@ ScrEdge *screen_find_active_scredge(bScreen *sc, int winsizex, int winsizey, int } } else { - if (se->v1->vec.x > 0 && se->v1->vec.x < winsizex - 1) { + if (se->v1->vec.x > 0 && se->v1->vec.x < winsize_x - 1) { short min, max; min = MIN2(se->v1->vec.y, se->v2->vec.y); max = MAX2(se->v1->vec.y, se->v2->vec.y); @@ -458,6 +460,9 @@ ScrArea *area_split(bScreen *sc, ScrArea *sa, char dir, float fac, int merge) /* uses window size */ bScreen *ED_screen_add(wmWindow *win, Scene *scene, const char *name) { + const int winsize_x = WM_window_pixels_x(win); + const int winsize_y = WM_window_pixels_y(win); + bScreen *sc; ScrVert *sv1, *sv2, *sv3, *sv4; @@ -468,9 +473,9 @@ bScreen *ED_screen_add(wmWindow *win, Scene *scene, const char *name) sc->winid = win->winid; sv1 = screen_addvert(sc, 0, 0); - sv2 = screen_addvert(sc, 0, WM_window_pixels_y(win) - 1); - sv3 = screen_addvert(sc, WM_window_pixels_x(win) - 1, WM_window_pixels_y(win) - 1); - sv4 = screen_addvert(sc, WM_window_pixels_x(win) - 1, 0); + sv2 = screen_addvert(sc, 0, winsize_y - 1); + sv3 = screen_addvert(sc, winsize_x - 1, winsize_y - 1); + sv4 = screen_addvert(sc, winsize_x - 1, 0); screen_addedge(sc, sv1, sv2); screen_addedge(sc, sv2, sv3); @@ -660,7 +665,7 @@ void select_connected_scredge(bScreen *sc, ScrEdge *edge) } /* test if screen vertices should be scaled */ -static void screen_test_scale(bScreen *sc, int winsizex, int winsizey) +static void screen_test_scale(bScreen *sc, int winsize_x, int winsize_y) { /* clamp Y size of header sized areas when expanding windows * avoids annoying empty space around file menu */ @@ -669,7 +674,7 @@ static void screen_test_scale(bScreen *sc, int winsizex, int winsizey) const int headery_init = ED_area_headersize(); ScrVert *sv = NULL; ScrArea *sa; - int sizex, sizey; + int winsize_x_prev, winsize_y_prev; float facx, facy, tempf, min[2], max[2]; /* calculate size */ @@ -687,8 +692,8 @@ static void screen_test_scale(bScreen *sc, int winsizex, int winsizey) sv->vec.y -= min[1]; } - sizex = max[0] - min[0] + 1; - sizey = max[1] - min[1] + 1; + winsize_x_prev = (max[0] - min[0]) + 1; + winsize_y_prev = (max[1] - min[1]) + 1; #ifdef USE_HEADER_SIZE_CLAMP @@ -696,19 +701,20 @@ static void screen_test_scale(bScreen *sc, int winsizex, int winsizey) #define TEMP_TOP 2 /* if the window's Y axis grows, clamp header sized areas */ - if (sizey < winsizey) { /* growing? */ + if (winsize_y_prev < winsize_y) { /* growing? */ + const int headery_margin_max = headery_init + 4; for (sa = sc->areabase.first; sa; sa = sa->next) { ARegion *ar = BKE_area_find_region_type(sa, RGN_TYPE_HEADER); sa->temp = 0; if (ar && !(ar->flag & RGN_FLAG_HIDDEN)) { - if (sa->v2->vec.y == sizey - 1) { - if ((sa->v2->vec.y - sa->v1->vec.y) < headery_init + 4) { + if (sa->v2->vec.y == winsize_y_prev - 1) { + if ((sa->v2->vec.y - sa->v1->vec.y) < headery_margin_max) { sa->temp = TEMP_TOP; } } else if (sa->v1->vec.y == 0) { - if ((sa->v2->vec.y - sa->v1->vec.y) < headery_init + 4) { + if ((sa->v2->vec.y - sa->v1->vec.y) < headery_margin_max) { sa->temp = TEMP_BOTTOM; } } @@ -718,9 +724,9 @@ static void screen_test_scale(bScreen *sc, int winsizex, int winsizey) #endif - if (sizex != winsizex || sizey != winsizey) { - facx = ((float)winsizex) / ((float)sizex - 1); - facy = ((float)winsizey) / ((float)sizey - 1); + if (winsize_x_prev != winsize_x || winsize_y_prev != winsize_y) { + facx = ((float)winsize_x) / ((float)winsize_x_prev - 1); + facy = ((float)winsize_y) / ((float)winsize_y_prev - 1); /* make sure it fits! */ for (sv = sc->vertbase.first; sv; sv = sv->next) { @@ -731,20 +737,20 @@ static void screen_test_scale(bScreen *sc, int winsizex, int winsizey) //sv->vec.x += AREAGRID - 1; //sv->vec.x -= (sv->vec.x % AREAGRID); - CLAMP(sv->vec.x, 0, winsizex - 1); + CLAMP(sv->vec.x, 0, winsize_x - 1); tempf = ((float)sv->vec.y) * facy; sv->vec.y = (short)(tempf + 0.5f); //sv->vec.y += AREAGRID - 1; //sv->vec.y -= (sv->vec.y % AREAGRID); - CLAMP(sv->vec.y, 0, winsizey - 1); + CLAMP(sv->vec.y, 0, winsize_y - 1); } } #ifdef USE_HEADER_SIZE_CLAMP - if (sizey < winsizey) { /* growing? */ + if (winsize_y_prev < winsize_y) { /* growing? */ for (sa = sc->areabase.first; sa; sa = sa->next) { ScrEdge *se = NULL; @@ -784,6 +790,7 @@ static void screen_test_scale(bScreen *sc, int winsizex, int winsizey) } } +#undef USE_HEADER_SIZE_CLAMP #undef TEMP_BOTTOM #undef TEMP_TOP #endif @@ -799,7 +806,7 @@ static void screen_test_scale(bScreen *sc, int winsizex, int winsizey) /* adjust headery if verts are along the edge of window */ if (sa->v1->vec.y > 0) headery += U.pixelsize; - if (sa->v2->vec.y < winsizey - 1) + if (sa->v2->vec.y < winsize_y - 1) headery += U.pixelsize; if (sa->v2->vec.y - sa->v1->vec.y + 1 < headery) { @@ -1111,6 +1118,9 @@ void ED_screen_do_listen(bContext *C, wmNotifier *note) /* only for edge lines between areas, and the blended join arrows */ void ED_screen_draw(wmWindow *win) { + const int winsize_x = WM_window_pixels_x(win); + const int winsize_y = WM_window_pixels_y(win); + ScrArea *sa; ScrArea *sa1 = NULL; ScrArea *sa2 = NULL; @@ -1124,10 +1134,10 @@ void ED_screen_draw(wmWindow *win) if (sa->flag & AREA_FLAG_DRAWJOINFROM) sa1 = sa; if (sa->flag & AREA_FLAG_DRAWJOINTO) sa2 = sa; if (sa->flag & (AREA_FLAG_DRAWSPLIT_H | AREA_FLAG_DRAWSPLIT_V)) sa3 = sa; - drawscredge_area(sa, WM_window_pixels_x(win), WM_window_pixels_y(win), 0); + drawscredge_area(sa, winsize_x, winsize_y, 0); } for (sa = win->screen->areabase.first; sa; sa = sa->next) - drawscredge_area(sa, WM_window_pixels_x(win), WM_window_pixels_y(win), 1); + drawscredge_area(sa, winsize_x, winsize_y, 1); /* blended join arrow */ if (sa1 && sa2) { @@ -1196,18 +1206,20 @@ void ED_screen_refresh(wmWindowManager *wm, wmWindow *win) { /* exception for bg mode, we only need the screen context */ if (!G.background) { + const int winsize_x = WM_window_pixels_x(win); + const int winsize_y = WM_window_pixels_y(win); ScrArea *sa; rcti winrct; winrct.xmin = 0; - winrct.xmax = WM_window_pixels_x(win) - 1; + winrct.xmax = winsize_x - 1; winrct.ymin = 0; - winrct.ymax = WM_window_pixels_y(win) - 1; + winrct.ymax = winsize_y - 1; /* header size depends on DPI, let's verify */ screen_refresh_headersizes(); - screen_test_scale(win->screen, WM_window_pixels_x(win), WM_window_pixels_y(win)); + screen_test_scale(win->screen, winsize_x, winsize_y); if (win->screen->mainwin == 0) win->screen->mainwin = wm_subwindow_open(win, &winrct); @@ -1334,10 +1346,11 @@ void ED_screen_exit(bContext *C, wmWindow *window, bScreen *screen) /* case when on area-edge or in azones, or outside window */ static void screen_cursor_set(wmWindow *win, wmEvent *event) { + const int winsize_x = WM_window_pixels_x(win); + const int winsize_y = WM_window_pixels_y(win); + AZone *az = NULL; ScrArea *sa; - int winsizex = WM_window_pixels_x(win); - int winsizey = WM_window_pixels_y(win); for (sa = win->screen->areabase.first; sa; sa = sa->next) if ((az = is_in_area_actionzone(sa, &event->x))) @@ -1354,7 +1367,7 @@ static void screen_cursor_set(wmWindow *win, wmEvent *event) } } else { - ScrEdge *actedge = screen_find_active_scredge(win->screen, winsizex, winsizey, event->x, event->y); + ScrEdge *actedge = screen_find_active_scredge(win->screen, winsize_x, winsize_y, event->x, event->y); if (actedge) { if (scredge_is_horizontal(actedge)) diff --git a/source/blender/editors/screen/screen_intern.h b/source/blender/editors/screen/screen_intern.h index e366a336587..66677aed68f 100644 --- a/source/blender/editors/screen/screen_intern.h +++ b/source/blender/editors/screen/screen_intern.h @@ -53,7 +53,9 @@ void removedouble_scrverts(bScreen *sc); void removedouble_scredges(bScreen *sc); void removenotused_scredges(bScreen *sc); int scredge_is_horizontal(ScrEdge *se); -ScrEdge *screen_find_active_scredge(bScreen *sc, int winsizex, int winsizey, int mx, int my); +ScrEdge *screen_find_active_scredge(bScreen *sc, + const int winsize_x, const int winsize_y, + const int mx, const int my); struct AZone *is_in_area_actionzone(ScrArea *sa, const int xy[2]); diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c index 1e169180d18..b5d7030ef82 100644 --- a/source/blender/editors/screen/screen_ops.c +++ b/source/blender/editors/screen/screen_ops.c @@ -698,8 +698,8 @@ static int actionzone_modal(bContext *C, wmOperator *op, const wmEvent *event) wmWindow *win = CTX_wm_window(C); bScreen *sc = CTX_wm_screen(C); sActionzoneData *sad = op->customdata; - int winsizex = WM_window_pixels_x(win); - int winsizey = WM_window_pixels_y(win); + const int winsize_x = WM_window_pixels_x(win); + const int winsize_y = WM_window_pixels_y(win); switch (event->type) { case MOUSEMOVE: @@ -723,7 +723,7 @@ static int actionzone_modal(bContext *C, wmOperator *op, const wmEvent *event) /* once we drag outside the actionzone, register a gesture * check we're not on an edge so join finds the other area */ is_gesture = ((is_in_area_actionzone(sad->sa1, &event->x) != sad->az) && - (screen_find_active_scredge(sc, winsizex, winsizey, event->x, event->y) == NULL)); + (screen_find_active_scredge(sc, winsize_x, winsize_y, event->x, event->y) == NULL)); } else { const int delta_min = 1; @@ -994,7 +994,9 @@ typedef struct sAreaMoveData { /* helper call to move area-edge, sets limits * need window size in order to get correct limits */ -static void area_move_set_limits(bScreen *sc, int dir, int winsizex, int winsizey, int *bigger, int *smaller) +static void area_move_set_limits(bScreen *sc, int dir, + const int winsize_x, const int winsize_y, + int *bigger, int *smaller) { ScrArea *sa; int areaminy = ED_area_headersize(); @@ -1010,7 +1012,7 @@ static void area_move_set_limits(bScreen *sc, int dir, int winsizex, int winsize if (sa->v1->vec.y > 0) areamin += U.pixelsize; - if (sa->v2->vec.y < winsizey - 1) + if (sa->v2->vec.y < winsize_y - 1) areamin += U.pixelsize; y1 = sa->v2->vec.y - sa->v1->vec.y + 1 - areamin; @@ -1027,7 +1029,7 @@ static void area_move_set_limits(bScreen *sc, int dir, int winsizex, int winsize if (sa->v1->vec.x > 0) areamin += U.pixelsize; - if (sa->v4->vec.x < winsizex - 1) + if (sa->v4->vec.x < winsize_x - 1) areamin += U.pixelsize; x1 = sa->v4->vec.x - sa->v1->vec.x + 1 - areamin; @@ -1050,8 +1052,8 @@ static int area_move_init(bContext *C, wmOperator *op) ScrEdge *actedge; sAreaMoveData *md; ScrVert *v1; - int winsizex = WM_window_pixels_x(win); - int winsizey = WM_window_pixels_y(win); + const int winsize_x = WM_window_pixels_x(win); + const int winsize_y = WM_window_pixels_y(win); int x, y; /* required properties */ @@ -1059,7 +1061,7 @@ static int area_move_init(bContext *C, wmOperator *op) y = RNA_int_get(op->ptr, "y"); /* setup */ - actedge = screen_find_active_scredge(sc, winsizex, winsizey, x, y); + actedge = screen_find_active_scredge(sc, winsize_x, winsize_y, x, y); if (actedge == NULL) return 0; md = MEM_callocN(sizeof(sAreaMoveData), "sAreaMoveData"); @@ -1074,7 +1076,7 @@ static int area_move_init(bContext *C, wmOperator *op) for (v1 = sc->vertbase.first; v1; v1 = v1->next) v1->editflag = v1->flag; - area_move_set_limits(sc, md->dir, winsizex, winsizey, &md->bigger, &md->smaller); + area_move_set_limits(sc, md->dir, winsize_x, winsize_y, &md->bigger, &md->smaller); return 1; } @@ -1083,6 +1085,8 @@ static int area_move_init(bContext *C, wmOperator *op) static void area_move_apply_do(bContext *C, int origval, int delta, int dir, int bigger, int smaller) { wmWindow *win = CTX_wm_window(C); + const int winsize_x = WM_window_pixels_x(win); + const int winsize_y = WM_window_pixels_y(win); bScreen *sc = CTX_wm_screen(C); ScrVert *v1; ScrArea *sa; @@ -1094,7 +1098,7 @@ static void area_move_apply_do(bContext *C, int origval, int delta, int dir, int for (v1 = sc->vertbase.first; v1; v1 = v1->next) { if (v1->editflag) { /* that way a nice AREAGRID */ - if ((dir == 'v') && v1->vec.x > 0 && v1->vec.x < WM_window_pixels_x(win) - 1) { + if ((dir == 'v') && v1->vec.x > 0 && v1->vec.x < winsize_x - 1) { oldval = v1->vec.x; v1->vec.x = origval + delta; @@ -1105,7 +1109,7 @@ static void area_move_apply_do(bContext *C, int origval, int delta, int dir, int if (oldval != v1->vec.x) doredraw = 1; } - if ((dir == 'h') && v1->vec.y > 0 && v1->vec.y < WM_window_pixels_y(win) - 1) { + if ((dir == 'h') && v1->vec.y > 0 && v1->vec.y < winsize_y - 1) { oldval = v1->vec.y; v1->vec.y = origval + delta; @@ -1450,8 +1454,8 @@ static int area_split_invoke(bContext *C, wmOperator *op, const wmEvent *event) wmWindow *win = CTX_wm_window(C); bScreen *sc = CTX_wm_screen(C); sAreaSplitData *sd; - int winsizex = WM_window_pixels_x(win); - int winsizey = WM_window_pixels_y(win); + const int winsize_x = WM_window_pixels_x(win); + const int winsize_y = WM_window_pixels_y(win); int dir; /* no full window splitting allowed */ @@ -1504,7 +1508,7 @@ static int area_split_invoke(bContext *C, wmOperator *op, const wmEvent *event) else y = event->x; - actedge = screen_find_active_scredge(sc, winsizex, winsizey, x, y); + actedge = screen_find_active_scredge(sc, winsize_x, winsize_y, x, y); if (actedge == NULL) return OPERATOR_CANCELLED; @@ -1527,7 +1531,7 @@ static int area_split_invoke(bContext *C, wmOperator *op, const wmEvent *event) /* do the split */ if (area_split_apply(C, op)) { - area_move_set_limits(sc, dir, winsizex, winsizey, &sd->bigger, &sd->smaller); + area_move_set_limits(sc, dir, winsize_x, winsize_y, &sd->bigger, &sd->smaller); /* add temp handler for edge move or cancel */ WM_event_add_modal_handler(C, op); @@ -2621,10 +2625,10 @@ static int screen_area_options_invoke(bContext *C, wmOperator *op, const wmEvent uiLayout *layout; PointerRNA ptr1, ptr2; ScrEdge *actedge; - int winsizex = WM_window_pixels_x(win); - int winsizey = WM_window_pixels_y(win); + const int winsize_x = WM_window_pixels_x(win); + const int winsize_y = WM_window_pixels_y(win); - actedge = screen_find_active_scredge(sc, winsizex, winsizey, event->x, event->y); + actedge = screen_find_active_scredge(sc, winsize_x, winsize_y, event->x, event->y); if (actedge == NULL) return OPERATOR_CANCELLED; diff --git a/source/blender/windowmanager/intern/wm_dragdrop.c b/source/blender/windowmanager/intern/wm_dragdrop.c index 819ec365e09..dad8e7bdde0 100644 --- a/source/blender/windowmanager/intern/wm_dragdrop.c +++ b/source/blender/windowmanager/intern/wm_dragdrop.c @@ -217,11 +217,11 @@ static const char *wm_dropbox_active(bContext *C, wmDrag *drag, wmEvent *event) static void wm_drop_operator_options(bContext *C, wmDrag *drag, wmEvent *event) { wmWindow *win = CTX_wm_window(C); - int winsizex = WM_window_pixels_x(win); - int winsizey = WM_window_pixels_y(win); + const int winsize_x = WM_window_pixels_x(win); + const int winsize_y = WM_window_pixels_y(win); /* for multiwin drags, we only do this if mouse inside */ - if (event->x < 0 || event->y < 0 || event->x > winsizex || event->y > winsizey) + if (event->x < 0 || event->y < 0 || event->x > winsize_x || event->y > winsize_y) return; drag->opname[0] = 0; @@ -304,7 +304,7 @@ void wm_drags_draw(bContext *C, wmWindow *win, rcti *rect) { wmWindowManager *wm = CTX_wm_manager(C); wmDrag *drag; - int winsizey = WM_window_pixels_y(win); + const int winsize_y = WM_window_pixels_y(win); int cursorx, cursory, x, y; cursorx = win->eventstate->x; @@ -366,7 +366,7 @@ void wm_drags_draw(bContext *C, wmWindow *win, rcti *rect) if (drag->imb) { x = cursorx - drag->sx / 2; - if (cursory + drag->sy / 2 + padding + iconsize < winsizey) + if (cursory + drag->sy / 2 + padding + iconsize < winsize_y) y = cursory + drag->sy / 2 + padding; else y = cursory - drag->sy / 2 - padding - iconsize - padding - iconsize; @@ -374,7 +374,7 @@ void wm_drags_draw(bContext *C, wmWindow *win, rcti *rect) else { x = cursorx - 2 * padding; - if (cursory + iconsize + iconsize < winsizey) + if (cursory + iconsize + iconsize < winsize_y) y = cursory + iconsize; else y = cursory - iconsize - 2 * UI_DPI_FAC; diff --git a/source/blender/windowmanager/intern/wm_draw.c b/source/blender/windowmanager/intern/wm_draw.c index dac62d624b5..5edc57be40b 100644 --- a/source/blender/windowmanager/intern/wm_draw.c +++ b/source/blender/windowmanager/intern/wm_draw.c @@ -429,6 +429,9 @@ static void wm_draw_triple_fail(bContext *C, wmWindow *win) static int wm_triple_gen_textures(wmWindow *win, wmDrawTriple *triple) { + const int winsize_x = WM_window_pixels_x(win); + const int winsize_y = WM_window_pixels_y(win); + GLint maxsize; int x, y; @@ -437,22 +440,22 @@ static int wm_triple_gen_textures(wmWindow *win, wmDrawTriple *triple) triple->target = GL_TEXTURE_RECTANGLE_ARB; triple->nx = 1; triple->ny = 1; - triple->x[0] = WM_window_pixels_x(win); - triple->y[0] = WM_window_pixels_y(win); + triple->x[0] = winsize_x; + triple->y[0] = winsize_y; } else if (GPU_non_power_of_two_support()) { triple->target = GL_TEXTURE_2D; triple->nx = 1; triple->ny = 1; - triple->x[0] = WM_window_pixels_x(win); - triple->y[0] = WM_window_pixels_y(win); + triple->x[0] = winsize_x; + triple->y[0] = winsize_y; } else { triple->target = GL_TEXTURE_2D; triple->nx = 0; triple->ny = 0; - split_width(WM_window_pixels_x(win), MAX_N_TEX, triple->x, &triple->nx); - split_width(WM_window_pixels_y(win), MAX_N_TEX, triple->y, &triple->ny); + split_width(winsize_x, MAX_N_TEX, triple->x, &triple->nx); + split_width(winsize_y, MAX_N_TEX, triple->y, &triple->ny); } /* generate texture names */ diff --git a/source/blender/windowmanager/intern/wm_gesture.c b/source/blender/windowmanager/intern/wm_gesture.c index 4d4d46d063a..33758d9699d 100644 --- a/source/blender/windowmanager/intern/wm_gesture.c +++ b/source/blender/windowmanager/intern/wm_gesture.c @@ -329,19 +329,19 @@ static void wm_gesture_draw_lasso(wmWindow *win, wmGesture *gt, bool filled) static void wm_gesture_draw_cross(wmWindow *win, wmGesture *gt) { rcti *rect = (rcti *)gt->customdata; - int winsizex = WM_window_pixels_x(win); - int winsizey = WM_window_pixels_y(win); + const int winsize_x = WM_window_pixels_x(win); + const int winsize_y = WM_window_pixels_y(win); glEnable(GL_LINE_STIPPLE); glColor3ub(96, 96, 96); glLineStipple(1, 0xCCCC); - sdrawline(rect->xmin - winsizex, rect->ymin, rect->xmin + winsizex, rect->ymin); - sdrawline(rect->xmin, rect->ymin - winsizey, rect->xmin, rect->ymin + winsizey); + sdrawline(rect->xmin - winsize_x, rect->ymin, rect->xmin + winsize_x, rect->ymin); + sdrawline(rect->xmin, rect->ymin - winsize_y, rect->xmin, rect->ymin + winsize_y); glColor3ub(255, 255, 255); glLineStipple(1, 0x3333); - sdrawline(rect->xmin - winsizex, rect->ymin, rect->xmin + winsizex, rect->ymin); - sdrawline(rect->xmin, rect->ymin - winsizey, rect->xmin, rect->ymin + winsizey); + sdrawline(rect->xmin - winsize_x, rect->ymin, rect->xmin + winsize_x, rect->ymin); + sdrawline(rect->xmin, rect->ymin - winsize_y, rect->xmin, rect->ymin + winsize_y); glDisable(GL_LINE_STIPPLE); } diff --git a/source/blender/windowmanager/intern/wm_subwindow.c b/source/blender/windowmanager/intern/wm_subwindow.c index ae535ed45e8..75608a850ac 100644 --- a/source/blender/windowmanager/intern/wm_subwindow.c +++ b/source/blender/windowmanager/intern/wm_subwindow.c @@ -209,6 +209,9 @@ void wm_subwindow_position(wmWindow *win, int swinid, rcti *winrct) wmSubWindow *swin = swin_from_swinid(win, swinid); if (swin) { + const int winsize_x = WM_window_pixels_x(win); + const int winsize_y = WM_window_pixels_y(win); + int width, height; swin->winrct = *winrct; @@ -226,10 +229,10 @@ void wm_subwindow_position(wmWindow *win, int swinid, rcti *winrct) * fixed it). - zr (2001!) */ - if (swin->winrct.xmax > WM_window_pixels_x(win)) - swin->winrct.xmax = WM_window_pixels_x(win); - if (swin->winrct.ymax > WM_window_pixels_y(win)) - swin->winrct.ymax = WM_window_pixels_y(win); + if (swin->winrct.xmax > winsize_x) + swin->winrct.xmax = winsize_x; + if (swin->winrct.ymax > winsize_y) + swin->winrct.ymax = winsize_y; /* extra service */ wmSubWindowSet(win, swinid); |