Converted sdl_monitor_info into a proper object. (nw)

This commit is contained in:
couriersud 2015-01-29 23:19:27 +01:00
parent f8de24c1e5
commit f952a4a3ba
7 changed files with 112 additions and 128 deletions

View File

@ -593,7 +593,8 @@ static int drawsdl2_window_create(sdl_window_info *window, int width, int height
SDL_SetHint(SDL_HINT_VIDEO_MINIMIZE_ON_FOCUS_LOSS, "0"); SDL_SetHint(SDL_HINT_VIDEO_MINIMIZE_ON_FOCUS_LOSS, "0");
#endif #endif
// create the SDL window // create the SDL window
window->sdl_window = SDL_CreateWindow(window->title, window->monitor()->monitor_x, 0, window->sdl_window = SDL_CreateWindow(window->title,
window->monitor()->position_size().x, window->monitor()->position_size().y,
width, height, extra_flags); width, height, extra_flags);
if (window->fullscreen() && video_config.switchres) if (window->fullscreen() && video_config.switchres)
@ -710,7 +711,7 @@ static int drawsdl2_xy_to_render_target(sdl_window_info *window, int x, int y, i
static void drawsdl2_set_target_bounds(sdl_window_info *window) static void drawsdl2_set_target_bounds(sdl_window_info *window)
{ {
window->target->set_bounds(window->blitwidth, window->blitheight, sdlvideo_monitor_get_aspect(window->monitor())); window->target->set_bounds(window->blitwidth, window->blitheight, window->monitor()->aspect());
} }
//============================================================ //============================================================
@ -761,8 +762,8 @@ static int drawsdl2_window_draw(sdl_window_info *window, UINT32 dc, int update)
if ((window->fullscreen()) && (!video_config.switchres)) if ((window->fullscreen()) && (!video_config.switchres))
{ {
ch = window->monitor()->center_height; ch = window->monitor()->center_height();
cw = window->monitor()->center_width; cw = window->monitor()->center_width();
} }
else else
{ {

View File

@ -558,7 +558,8 @@ static int drawogl_window_create(sdl_window_info *window, int width, int height)
//load_gl_lib(window->machine()); //load_gl_lib(window->machine());
// create the SDL window // create the SDL window
window->sdl_window = SDL_CreateWindow(window->title, window->monitor()->monitor_x, 0, window->sdl_window = SDL_CreateWindow(window->title,
window->monitor()->position_size().x, window->monitor()->position_size().y,
width, height, sdl->extra_flags); width, height, sdl->extra_flags);
if (!window->sdl_window ) if (!window->sdl_window )
@ -570,7 +571,7 @@ static int drawogl_window_create(sdl_window_info *window, int width, int height)
if (window->fullscreen() && video_config.switchres) if (window->fullscreen() && video_config.switchres)
{ {
SDL_DisplayMode mode; SDL_DisplayMode mode;
SDL_GetCurrentDisplayMode(window->monitor()->handle, &mode); SDL_GetCurrentDisplayMode(window->monitor()->handle(), &mode);
mode.w = width; mode.w = width;
mode.h = height; mode.h = height;
if (window->refresh) if (window->refresh)
@ -842,7 +843,7 @@ static int drawogl_xy_to_render_target(sdl_window_info *window, int x, int y, in
static void drawogl_set_target_bounds(sdl_window_info *window) static void drawogl_set_target_bounds(sdl_window_info *window)
{ {
window->target->set_bounds(window->blitwidth, window->blitheight, sdlvideo_monitor_get_aspect(window->monitor())); window->target->set_bounds(window->blitwidth, window->blitheight, window->monitor()->aspect());
} }
//============================================================ //============================================================
@ -1312,8 +1313,8 @@ static int drawogl_window_draw(sdl_window_info *window, UINT32 dc, int update)
if ((window->fullscreen()) && (!video_config.switchres)) if ((window->fullscreen()) && (!video_config.switchres))
{ {
ch = window->monitor()->center_height; ch = window->monitor()->center_height();
cw = window->monitor()->center_width; cw = window->monitor()->center_width();
} }
else else
{ {

View File

@ -251,7 +251,7 @@ static void setup_texture(sdl_window_info *window, int tempwidth, int tempheight
UINT32 fmt; UINT32 fmt;
// Determine preferred pixelformat and set up yuv if necessary // Determine preferred pixelformat and set up yuv if necessary
SDL_GetCurrentDisplayMode(window->monitor()->handle, &mode); SDL_GetCurrentDisplayMode(window->monitor()->handle(), &mode);
if (sdl->yuv_bitmap) if (sdl->yuv_bitmap)
{ {
@ -412,7 +412,7 @@ static int drawsdl_window_create(sdl_window_info *window, int width, int height)
if (window->fullscreen() && video_config.switchres) if (window->fullscreen() && video_config.switchres)
{ {
SDL_DisplayMode mode; SDL_DisplayMode mode;
SDL_GetCurrentDisplayMode(window->monitor()->handle, &mode); SDL_GetCurrentDisplayMode(window->monitor()->handle(), &mode);
mode.w = width; mode.w = width;
mode.h = height; mode.h = height;
if (window->refresh) if (window->refresh)
@ -623,7 +623,7 @@ static void drawsdl_set_target_bounds(sdl_window_info *window)
const sdl_scale_mode *sm = &scale_modes[video_config.scale_mode]; const sdl_scale_mode *sm = &scale_modes[video_config.scale_mode];
if (!sm->is_scale) if (!sm->is_scale)
window->target->set_bounds(window->blitwidth, window->blitheight, sdlvideo_monitor_get_aspect(window->monitor())); window->target->set_bounds(window->blitwidth, window->blitheight, window->monitor()->aspect());
else else
window->target->set_bounds(sdl->hw_scale_width, sdl->hw_scale_height); window->target->set_bounds(sdl->hw_scale_width, sdl->hw_scale_height);
} }
@ -737,8 +737,8 @@ static int drawsdl_window_draw(sdl_window_info *window, UINT32 dc, int update)
// the first one only // the first one only
if ((window->fullscreen()) && (!video_config.switchres)) if ((window->fullscreen()) && (!video_config.switchres))
{ {
ch = window->monitor()->center_height; ch = window->monitor()->center_height();
cw = window->monitor()->center_width; cw = window->monitor()->center_width();
} }
else else
{ {

View File

@ -6,7 +6,6 @@
#include "watchdog.h" #include "watchdog.h"
#include "clifront.h" #include "clifront.h"
#include "modules/lib/osdobj_common.h" #include "modules/lib/osdobj_common.h"
#include "video.h"
#include "modules/osdmodule.h" #include "modules/osdmodule.h"
#include "modules/font/font_module.h" #include "modules/font/font_module.h"
@ -215,8 +214,6 @@ public:
private: private:
virtual void osd_exit(); virtual void osd_exit();
void extract_window_config(int index, sdl_window_config *conf);
// FIXME: remove machine usage // FIXME: remove machine usage
void extract_video_config(running_machine &machine); void extract_video_config(running_machine &machine);

View File

@ -69,20 +69,17 @@ osd_gl_dispatch *gl_dispatch;
#endif #endif
#endif #endif
sdl_monitor_info *sdl_monitor_info::primary_monitor = NULL;
sdl_monitor_info *sdl_monitor_info::list = NULL;
//============================================================ //============================================================
// LOCAL VARIABLES // LOCAL VARIABLES
//============================================================ //============================================================
static sdl_monitor_info *primary_monitor;
static sdl_monitor_info *sdl_monitor_list;
//============================================================ //============================================================
// PROTOTYPES // PROTOTYPES
//============================================================ //============================================================
static void init_monitors(void);
static sdl_monitor_info *pick_monitor(sdl_options &options, int index);
static void check_osd_inputs(running_machine &machine); static void check_osd_inputs(running_machine &machine);
static float get_aspect(const char *defdata, const char *data, int report_error); static float get_aspect(const char *defdata, const char *data, int report_error);
@ -101,7 +98,7 @@ bool sdl_osd_interface::video_init()
extract_video_config(machine()); extract_video_config(machine());
// set up monitors first // set up monitors first
init_monitors(); sdl_monitor_info::init();
// we need the beam width in a float, contrary to what the core does. // we need the beam width in a float, contrary to what the core does.
video_config.beamwidth = options().beam(); video_config.beamwidth = options().beam();
@ -115,8 +112,8 @@ bool sdl_osd_interface::video_init()
{ {
sdl_window_config conf; sdl_window_config conf;
memset(&conf, 0, sizeof(conf)); memset(&conf, 0, sizeof(conf));
extract_window_config(index, &conf); get_resolution(options().resolution(), options().resolution(index), &conf, TRUE);
if (sdlwindow_video_window_create(machine(), index, pick_monitor(options(), index), &conf)) if (sdlwindow_video_window_create(machine(), index, sdl_monitor_info::pick_monitor(options(), index), &conf))
return false; return false;
} }
@ -131,15 +128,7 @@ bool sdl_osd_interface::video_init()
void sdl_osd_interface::video_exit() void sdl_osd_interface::video_exit()
{ {
window_exit(); window_exit();
sdl_monitor_info::exit();
// free all of our monitor information
while (sdl_monitor_list != NULL)
{
sdl_monitor_info *temp = sdl_monitor_list;
sdl_monitor_list = temp->next;
global_free(temp);
}
} }
@ -147,20 +136,19 @@ void sdl_osd_interface::video_exit()
// sdlvideo_monitor_refresh // sdlvideo_monitor_refresh
//============================================================ //============================================================
void sdlvideo_monitor_refresh(sdl_monitor_info *monitor) void sdl_monitor_info::refresh()
{ {
#if (SDLMAME_SDL2) #if (SDLMAME_SDL2)
SDL_DisplayMode dmode; SDL_DisplayMode dmode;
#if defined(SDLMAME_WIN32) #if defined(SDLMAME_WIN32)
SDL_GetDesktopDisplayMode(monitor->handle, &dmode); SDL_GetDesktopDisplayMode(m_handle, &dmode);
#else #else
SDL_GetCurrentDisplayMode(monitor->handle, &dmode); SDL_GetCurrentDisplayMode(m_handle, &dmode);
#endif #endif
monitor->monitor_width = dmode.w; SDL_GetDisplayBounds(m_handle, &m_dimensions);
monitor->monitor_height = dmode.h; m_center_width = m_dimensions.w;
monitor->center_width = dmode.w; m_center_height = m_dimensions.h;
monitor->center_height = dmode.h;
// FIXME: Use SDL_GetDisplayBounds(monitor->handle, &tt) to update monitor_x // FIXME: Use SDL_GetDisplayBounds(monitor->handle, &tt) to update monitor_x
// SDL_Rect tt; // SDL_Rect tt;
@ -169,8 +157,9 @@ void sdlvideo_monitor_refresh(sdl_monitor_info *monitor)
MONITORINFOEX info; MONITORINFOEX info;
info.cbSize = sizeof(info); info.cbSize = sizeof(info);
GetMonitorInfo((HMONITOR)monitor->handle, (LPMONITORINFO)&info); GetMonitorInfo((HMONITOR)monitor->handle, (LPMONITORINFO)&info);
monitor->center_width = monitor->monitor_width = info.rcMonitor.right - info.rcMonitor.left; monitor->m_dimensions.x = monitor->m_dimensions.y = 0;
monitor->center_height = monitor->monitor_height = info.rcMonitor.bottom - info.rcMonitor.top; monitor->m_center_width = monitor->m_dimensions.w = info.rcMonitor.right - info.rcMonitor.left;
monitor->m_center_height = monitor->m_dimensions.h = info.rcMonitor.bottom - info.rcMonitor.top;
char *temp = utf8_from_wstring(info.szDevice); char *temp = utf8_from_wstring(info.szDevice);
strcpy(monitor->monitor_device, temp); strcpy(monitor->monitor_device, temp);
osd_free(temp); osd_free(temp);
@ -285,34 +274,20 @@ void sdlvideo_monitor_refresh(sdl_monitor_info *monitor)
// sdlvideo_monitor_get_aspect // sdlvideo_monitor_get_aspect
//============================================================ //============================================================
float sdlvideo_monitor_get_aspect(sdl_monitor_info *monitor) float sdl_monitor_info::aspect()
{ {
// refresh the monitor information and compute the aspect // refresh the monitor information and compute the aspect
refresh();
// FIXME: returning 0 looks odd, video_config is bad
if (video_config.keepaspect) if (video_config.keepaspect)
{ {
sdlvideo_monitor_refresh(monitor); return m_aspect / ((float)m_dimensions.w / (float)m_dimensions.h);
return monitor->aspect / ((float)monitor->monitor_width / (float)monitor->monitor_height);
} }
return 0.0f; return 0.0f;
} }
//============================================================
// sdlvideo_monitor_from_handle
//============================================================
sdl_monitor_info *sdlvideo_monitor_from_handle(UINT32 hmonitor)
{
sdl_monitor_info *monitor;
// find the matching monitor
for (monitor = sdl_monitor_list; monitor != NULL; monitor = monitor->next)
if (monitor->handle == hmonitor)
return monitor;
return NULL;
}
//============================================================ //============================================================
// update // update
@ -431,13 +406,13 @@ static BOOL CALLBACK monitor_enum_callback(HMONITOR handle, HDC dc, LPRECT rect,
// init_monitors // init_monitors
//============================================================ //============================================================
static void init_monitors(void) void sdl_monitor_info::init()
{ {
sdl_monitor_info **tailptr; sdl_monitor_info **tailptr;
// make a list of monitors // make a list of monitors
sdl_monitor_list = NULL; sdl_monitor_info::list = NULL;
tailptr = &sdl_monitor_list; tailptr = &sdl_monitor_info::list;
#if (SDLMAME_SDL2) #if (SDLMAME_SDL2)
{ {
@ -452,20 +427,19 @@ static void init_monitors(void)
// allocate a new monitor info // allocate a new monitor info
monitor = global_alloc_clear(sdl_monitor_info); monitor = global_alloc_clear(sdl_monitor_info);
monitor->m_handle = i;
snprintf(monitor->monitor_device, sizeof(monitor->monitor_device)-1, "%s%d", OSDOPTION_SCREEN,i); snprintf(monitor->m_monitor_device, sizeof(monitor->m_monitor_device)-1, "%s%d", OSDOPTION_SCREEN,i);
SDL_GetDesktopDisplayMode(i, &dmode); SDL_GetDesktopDisplayMode(i, &dmode);
monitor->monitor_width = dmode.w; SDL_GetDisplayBounds(i, &monitor->m_dimensions);
monitor->monitor_height = dmode.h; monitor->m_center_width = monitor->m_dimensions.w;
monitor->center_width = dmode.w; monitor->m_center_height = monitor->m_dimensions.h;
monitor->center_height = dmode.h;
// FIXME: this should use SDL_GetDisplayBounds!
monitor->monitor_x = monx;
monitor->handle = i;
// guess the aspect ratio assuming square pixels // guess the aspect ratio assuming square pixels
monitor->aspect = (float)(dmode.w) / (float)(dmode.h); monitor->m_aspect = (float)(dmode.w) / (float)(dmode.h);
osd_printf_verbose("Adding monitor %s (%d x %d)\n", monitor->monitor_device, dmode.w, dmode.h);
osd_printf_verbose("Adding monitor %s (%d x %d)\n", monitor->m_monitor_device, dmode.w, dmode.h);
monx += dmode.w; monx += dmode.w;
@ -486,13 +460,24 @@ static void init_monitors(void)
#endif #endif
} }
void sdl_monitor_info::exit()
{
// free all of our monitor information
while (sdl_monitor_info::list != NULL)
{
sdl_monitor_info *temp = sdl_monitor_info::list;
sdl_monitor_info::list = temp->next;
global_free(temp);
}
}
//============================================================ //============================================================
// pick_monitor // pick_monitor
//============================================================ //============================================================
#if (SDLMAME_SDL2) || defined(SDLMAME_WIN32) #if (SDLMAME_SDL2) || defined(SDLMAME_WIN32)
static sdl_monitor_info *pick_monitor(sdl_options &options, int index) sdl_monitor_info *sdl_monitor_info::pick_monitor(sdl_options &options, int index)
{ {
sdl_monitor_info *monitor; sdl_monitor_info *monitor;
const char *scrname, *scrname2; const char *scrname, *scrname2;
@ -513,17 +498,17 @@ static sdl_monitor_info *pick_monitor(sdl_options &options, int index)
// look for a match in the name first // look for a match in the name first
if (scrname != NULL) if (scrname != NULL)
{ {
for (monitor = sdl_monitor_list; monitor != NULL; monitor = monitor->next) for (monitor = sdl_monitor_info::list; monitor != NULL; monitor = monitor->next)
{ {
moncount++; moncount++;
if (strcmp(scrname, monitor->monitor_device) == 0) if (strcmp(scrname, monitor->device()) == 0)
goto finishit; goto finishit;
} }
} }
// didn't find it; alternate monitors until we hit the jackpot // didn't find it; alternate monitors until we hit the jackpot
index %= moncount; index %= moncount;
for (monitor = sdl_monitor_list; monitor != NULL; monitor = monitor->next) for (monitor = sdl_monitor_info::list; monitor != NULL; monitor = monitor->next)
if (index-- == 0) if (index-- == 0)
goto finishit; goto finishit;
@ -533,7 +518,7 @@ static sdl_monitor_info *pick_monitor(sdl_options &options, int index)
finishit: finishit:
if (aspect != 0) if (aspect != 0)
{ {
monitor->aspect = aspect; monitor->set_aspect(aspect);
} }
return monitor; return monitor;
} }
@ -608,16 +593,6 @@ static void check_osd_inputs(running_machine &machine)
window->modify_prescale(machine, 1); window->modify_prescale(machine, 1);
} }
//============================================================
// extract_window_config
//============================================================
void sdl_osd_interface::extract_window_config(int index, sdl_window_config *conf)
{
// per-window options: extract the data
get_resolution(options().resolution(), options().resolution(index), conf, TRUE);
}
//============================================================ //============================================================
// extract_video_config // extract_video_config
//============================================================ //============================================================

View File

@ -12,6 +12,8 @@
#ifndef __SDLVIDEO__ #ifndef __SDLVIDEO__
#define __SDLVIDEO__ #define __SDLVIDEO__
#include "osdsdl.h"
//============================================================ //============================================================
// CONSTANTS // CONSTANTS
//============================================================ //============================================================
@ -56,21 +58,41 @@ struct sdl_mode
int height; int height;
}; };
struct sdl_monitor_info class sdl_monitor_info
{ {
public:
sdl_monitor_info * next; // pointer to next monitor in list sdl_monitor_info * next; // pointer to next monitor in list
#ifdef PTR64
UINT64 handle; // handle to the monitor const UINT64 handle() { return m_handle; }
#else const SDL_Rect &position_size() { refresh(); return m_dimensions; }
UINT32 handle; // handle to the monitor
#endif const char *device() { return m_monitor_device; }
int monitor_width;
int monitor_height; float aspect();
char monitor_device[64]; int center_width() { refresh(); return m_center_width; }
float aspect; // computed/configured aspect ratio of the physical device int center_height() { refresh(); return m_center_height; }
int center_width; // width of first physical screen for centering
int center_height; // height of first physical screen for centering void set_aspect(const float aspect) { m_aspect = aspect; }
int monitor_x; // X position of this monitor in virtual desktop space (SDL virtual space has them all horizontally stacked, not real geometry)
// STATIC
static void init();
static void exit();
static sdl_monitor_info *pick_monitor(sdl_options &options, int index);
private:
void refresh();
UINT64 m_handle; // handle to the monitor
SDL_Rect m_dimensions;
char m_monitor_device[64];
float m_aspect; // computed/configured aspect ratio of the physical device
int m_center_width; // width of first physical screen for centering
int m_center_height; // height of first physical screen for centering
// STATIC
static sdl_monitor_info *primary_monitor;
static sdl_monitor_info *list;
}; };
@ -137,12 +159,4 @@ struct sdl_video_config
extern sdl_video_config video_config; extern sdl_video_config video_config;
//============================================================
// PROTOTYPES
//============================================================
void sdlvideo_monitor_refresh(sdl_monitor_info *monitor);
float sdlvideo_monitor_get_aspect(sdl_monitor_info *monitor);
sdl_monitor_info *sdlvideo_monitor_from_handle(UINT32 monitor); //FIXME: Remove? not referenced
#endif #endif

View File

@ -407,8 +407,7 @@ void sdl_window_info::blit_surface_size(int window_width, int window_height)
if (video_config.keepaspect) if (video_config.keepaspect)
{ {
// make sure the monitor is up-to-date // make sure the monitor is up-to-date
sdlvideo_monitor_refresh(m_monitor); target->compute_visible_area(target_width, target_height, m_monitor->aspect(), target->orientation(), target_width, target_height);
target->compute_visible_area(target_width, target_height, sdlvideo_monitor_get_aspect(m_monitor), target->orientation(), target_width, target_height);
desired_aspect = (float)target_width / (float)target_height; desired_aspect = (float)target_width / (float)target_height;
} }
@ -849,7 +848,7 @@ void sdl_window_info::pick_best_mode(int *fswidth, int *fsheight)
minimum_height -= 4; minimum_height -= 4;
} }
num = SDL_GetNumDisplayModes(m_monitor->handle); num = SDL_GetNumDisplayModes(m_monitor->handle());
if (num == 0) if (num == 0)
{ {
@ -861,7 +860,7 @@ void sdl_window_info::pick_best_mode(int *fswidth, int *fsheight)
for (i = 0; i < num; ++i) for (i = 0; i < num; ++i)
{ {
SDL_DisplayMode mode; SDL_DisplayMode mode;
SDL_GetDisplayMode(m_monitor->handle, i, &mode); SDL_GetDisplayMode(m_monitor->handle(), i, &mode);
// compute initial score based on difference between target and current // compute initial score based on difference between target and current
size_score = 1.0f / (1.0f + fabsf((INT32)mode.w - target_width) + fabsf((INT32)mode.h - target_height)); size_score = 1.0f / (1.0f + fabsf((INT32)mode.w - target_width) + fabsf((INT32)mode.h - target_height));
@ -1024,7 +1023,7 @@ void sdl_window_info::video_window_update(running_machine &machine)
} }
else else
{ {
blit_surface_size(monitor()->center_width, monitor()->center_height); blit_surface_size(monitor()->center_width(), monitor()->center_height());
} }
// ensure the target bounds are up-to-date, and then get the primitives // ensure the target bounds are up-to-date, and then get the primitives
@ -1083,8 +1082,8 @@ static OSDWORK_CALLBACK( complete_create_wt )
if (window->fullscreen()) if (window->fullscreen())
{ {
// default to the current mode exactly // default to the current mode exactly
tempwidth = window->monitor()->monitor_width; tempwidth = window->monitor()->position_size().w;
tempheight = window->monitor()->monitor_height; tempheight = window->monitor()->position_size().h;
// if we're allowed to switch resolutions, override with something better // if we're allowed to switch resolutions, override with something better
if (video_config.switchres) if (video_config.switchres)
@ -1225,11 +1224,8 @@ void sdl_window_info::constrain_to_aspect_ratio(int *window_width, int *window_h
INT32 viswidth, visheight; INT32 viswidth, visheight;
float pixel_aspect; float pixel_aspect;
// make sure the monitor is up-to-date
sdlvideo_monitor_refresh(m_monitor);
// get the pixel aspect ratio for the target monitor // get the pixel aspect ratio for the target monitor
pixel_aspect = sdlvideo_monitor_get_aspect(m_monitor); pixel_aspect = m_monitor->aspect();
// determine the proposed width/height // determine the proposed width/height
propwidth = *window_width - extrawidth; propwidth = *window_width - extrawidth;
@ -1268,13 +1264,13 @@ void sdl_window_info::constrain_to_aspect_ratio(int *window_width, int *window_h
// clamp against the maximum (fit on one screen for full screen mode) // clamp against the maximum (fit on one screen for full screen mode)
if (this->m_fullscreen) if (this->m_fullscreen)
{ {
maxwidth = m_monitor->center_width - extrawidth; maxwidth = m_monitor->center_width() - extrawidth;
maxheight = m_monitor->center_height - extraheight; maxheight = m_monitor->center_height() - extraheight;
} }
else else
{ {
maxwidth = m_monitor->center_width - extrawidth; maxwidth = m_monitor->center_width() - extrawidth;
maxheight = m_monitor->center_height - extraheight; maxheight = m_monitor->center_height() - extraheight;
// further clamp to the maximum width/height in the window // further clamp to the maximum width/height in the window
if (this->m_maxwidth != 0) if (this->m_maxwidth != 0)
@ -1355,8 +1351,8 @@ void sdl_window_info::get_max_bounds(int *window_width, int *window_height, int
INT32 maxwidth, maxheight; INT32 maxwidth, maxheight;
// compute the maximum client area // compute the maximum client area
maxwidth = m_monitor->center_width; maxwidth = m_monitor->center_width();
maxheight = m_monitor->center_height; maxheight = m_monitor->center_height();
// clamp to the window's max // clamp to the window's max
if (this->m_maxwidth != 0) if (this->m_maxwidth != 0)