mirror of
https://github.com/mamedev/mame.git
synced 2024-11-16 07:48:32 +01:00
Correctly adjust window size based on the computed visible area for different stretching cases. (#9140)
This commit is contained in:
parent
3b6b046d51
commit
5c5828d826
3 changed files with 30 additions and 1 deletions
|
@ -967,6 +967,10 @@ osd_rect sdl_window_info::constrain_to_aspect_ratio(const osd_rect &rect, int ad
|
|||
// compute the visible area based on the proposed rectangle
|
||||
target()->compute_visible_area(propwidth, propheight, pixel_aspect, target()->orientation(), viswidth, visheight);
|
||||
|
||||
// clamp visable area to the proposed rectangle
|
||||
viswidth = std::min(viswidth, propwidth);
|
||||
visheight = std::min(visheight, propheight);
|
||||
|
||||
// compute the adjustments we need to make
|
||||
adjwidth = (viswidth + extrawidth) - rect.width();
|
||||
adjheight = (visheight + extraheight) - rect.height();
|
||||
|
@ -1015,6 +1019,12 @@ osd_dim sdl_window_info::get_min_bounds(int constrain)
|
|||
// get the minimum target size
|
||||
target()->compute_minimum_size(minwidth, minheight);
|
||||
|
||||
// check if visible area is bigger
|
||||
int32_t viswidth, visheight;
|
||||
target()->compute_visible_area(minwidth, minheight, monitor()->aspect(), target()->orientation(), viswidth, visheight);
|
||||
minwidth = std::max(viswidth, minwidth);
|
||||
minheight = std::max(visheight, minheight);
|
||||
|
||||
// expand to our minimum dimensions
|
||||
if (minwidth < MIN_WINDOW_DIM)
|
||||
minwidth = MIN_WINDOW_DIM;
|
||||
|
|
|
@ -305,6 +305,7 @@ win_window_info::win_window_info(
|
|||
, m_targetorient(0)
|
||||
, m_targetvismask(0)
|
||||
, m_targetscalemode(0)
|
||||
, m_targetkeepaspect(machine.options().keep_aspect())
|
||||
, m_lastclicktime(std::chrono::steady_clock::time_point::min())
|
||||
, m_lastclickx(0)
|
||||
, m_lastclicky(0)
|
||||
|
@ -785,13 +786,16 @@ void win_window_info::update()
|
|||
render_layer_config const targetlayerconfig = target()->layer_config();
|
||||
u32 const targetvismask = target()->visibility_mask();
|
||||
int const targetscalemode = target()->scale_mode();
|
||||
if (targetview != m_targetview || targetorient != m_targetorient || targetlayerconfig != m_targetlayerconfig || targetvismask != m_targetvismask || targetscalemode != m_targetscalemode)
|
||||
bool const targetkeepaspect = target()->keepaspect();
|
||||
if (targetview != m_targetview || targetorient != m_targetorient || targetlayerconfig != m_targetlayerconfig || targetvismask != m_targetvismask ||
|
||||
targetscalemode != m_targetscalemode || targetkeepaspect != m_targetkeepaspect)
|
||||
{
|
||||
m_targetview = targetview;
|
||||
m_targetorient = targetorient;
|
||||
m_targetlayerconfig = targetlayerconfig;
|
||||
m_targetvismask = targetvismask;
|
||||
m_targetscalemode = targetscalemode;
|
||||
m_targetkeepaspect = targetkeepaspect;
|
||||
|
||||
// in window mode, reminimize/maximize
|
||||
if (!fullscreen())
|
||||
|
@ -1483,6 +1487,10 @@ osd_rect win_window_info::constrain_to_aspect_ratio(const osd_rect &rect, int ad
|
|||
// compute the visible area based on the proposed rectangle
|
||||
target()->compute_visible_area(propwidth, propheight, pixel_aspect, target()->orientation(), viswidth, visheight);
|
||||
|
||||
// clamp visable area to the proposed rectangle
|
||||
viswidth = std::min(viswidth, propwidth);
|
||||
visheight = std::min(visheight, propheight);
|
||||
|
||||
// compute the adjustments we need to make
|
||||
adjwidth = (viswidth + extrawidth) - rect.width();
|
||||
adjheight = (visheight + extraheight) - rect.height();
|
||||
|
@ -1531,6 +1539,12 @@ osd_dim win_window_info::get_min_bounds(int constrain)
|
|||
// get the minimum target size
|
||||
target()->compute_minimum_size(minwidth, minheight);
|
||||
|
||||
// check if visible area is bigger
|
||||
int32_t viswidth, visheight;
|
||||
target()->compute_visible_area(minwidth, minheight, monitor()->aspect(), target()->orientation(), viswidth, visheight);
|
||||
minwidth = std::max(viswidth, minwidth);
|
||||
minheight = std::max(visheight, minheight);
|
||||
|
||||
// expand to our minimum dimensions
|
||||
if (minwidth < MIN_WINDOW_DIMX)
|
||||
minwidth = MIN_WINDOW_DIMX;
|
||||
|
@ -1634,6 +1648,10 @@ void win_window_info::update_minmax_state()
|
|||
(rect_height(&bounds) == minbounds.height());
|
||||
m_ismaximized = (rect_width(&bounds) == maxbounds.width()) ||
|
||||
(rect_height(&bounds) == maxbounds.height());
|
||||
|
||||
// We can't be maximized and minimized simultaneously
|
||||
if (m_ismaximized)
|
||||
m_isminimized = FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -108,6 +108,7 @@ public:
|
|||
render_layer_config m_targetlayerconfig;
|
||||
u32 m_targetvismask;
|
||||
int m_targetscalemode;
|
||||
bool m_targetkeepaspect;
|
||||
|
||||
// input info
|
||||
std::chrono::steady_clock::time_point m_lastclicktime;
|
||||
|
|
Loading…
Reference in a new issue