Changeset View
Changeset View
Standalone View
Standalone View
source/blender/windowmanager/intern/wm_window.c
| Show First 20 Lines • Show All 92 Lines • ▼ Show 20 Lines | |||||
| unsigned int uiwidth; | unsigned int uiwidth; | ||||
| unsigned int uiheight; | unsigned int uiheight; | ||||
| GHOST_GetAllDisplayDimensions(g_system, &uiwidth, &uiheight); | GHOST_GetAllDisplayDimensions(g_system, &uiwidth, &uiheight); | ||||
| *r_width = uiwidth; | *r_width = uiwidth; | ||||
| *r_height = uiheight; | *r_height = uiheight; | ||||
| } | } | ||||
| /* keeps offset and size within monitor bounds */ | /* keeps size within monitor bounds */ | ||||
| /* XXX solve dual screen... */ | static void wm_window_check_size(rcti *rect) | ||||
| static void wm_window_check_position(rcti *rect) | |||||
| { | { | ||||
| int width, height; | int width, height; | ||||
| wm_get_screensize(&width, &height); | wm_get_screensize(&width, &height); | ||||
| if (BLI_rcti_size_x(rect) > width) { | |||||
| if (rect->xmin < 0) { | BLI_rcti_resize_x(rect, width); | ||||
| rect->xmax -= rect->xmin; | |||||
| rect->xmin = 0; | |||||
| } | |||||
| if (rect->ymin < 0) { | |||||
| rect->ymax -= rect->ymin; | |||||
| rect->ymin = 0; | |||||
| } | |||||
| if (rect->xmax > width) { | |||||
| int d = rect->xmax - width; | |||||
| rect->xmax -= d; | |||||
| rect->xmin -= d; | |||||
| } | |||||
| if (rect->ymax > height) { | |||||
| int d = rect->ymax - height; | |||||
| rect->ymax -= d; | |||||
| rect->ymin -= d; | |||||
| } | |||||
| if (rect->xmin < 0) { | |||||
| rect->xmin = 0; | |||||
| } | } | ||||
| if (rect->ymin < 0) { | if (BLI_rcti_size_y(rect) > height) { | ||||
| rect->ymin = 0; | BLI_rcti_resize_y(rect, height); | ||||
| } | } | ||||
| } | } | ||||
| static void wm_ghostwindow_destroy(wmWindowManager *wm, wmWindow *win) | static void wm_ghostwindow_destroy(wmWindowManager *wm, wmWindow *win) | ||||
| { | { | ||||
| if (win->ghostwin) { | if (win->ghostwin) { | ||||
| /* Prevents non-drawable state of main windows (bugs T22967, | /* Prevents non-drawable state of main windows (bugs T22967, | ||||
| * T25071 and possibly T22477 too). Always clear it even if | * T25071 and possibly T22477 too). Always clear it even if | ||||
| ▲ Show 20 Lines • Show All 184 Lines • ▼ Show 20 Lines | |||||
| else { | else { | ||||
| /* Positioned absolutely within parent bounds. */ | /* Positioned absolutely within parent bounds. */ | ||||
| } | } | ||||
| rect.xmax = rect.xmin + sizex; | rect.xmax = rect.xmin + sizex; | ||||
| rect.ymax = rect.ymin + sizey; | rect.ymax = rect.ymin + sizey; | ||||
| /* changes rect to fit within desktop */ | /* changes rect to fit within desktop */ | ||||
| wm_window_check_position(&rect); | wm_window_check_size(&rect); | ||||
| /* Reuse temporary windows when they share the same title. */ | /* Reuse temporary windows when they share the same title. */ | ||||
| wmWindow *win = NULL; | wmWindow *win = NULL; | ||||
| if (temp) { | if (temp) { | ||||
| LISTBASE_FOREACH (wmWindow *, win_iter, &wm->windows) { | LISTBASE_FOREACH (wmWindow *, win_iter, &wm->windows) { | ||||
| if (WM_window_is_temp_screen(win_iter)) { | if (WM_window_is_temp_screen(win_iter)) { | ||||
| char *wintitle = GHOST_GetTitle(win_iter->ghostwin); | char *wintitle = GHOST_GetTitle(win_iter->ghostwin); | ||||
| if (strcmp(title, wintitle) == 0) { | if (strcmp(title, wintitle) == 0) { | ||||
| ▲ Show 20 Lines • Show All 92 Lines • Show Last 20 Lines | |||||