@ -307,7 +307,7 @@ static void setContentAreaOpaque(_GLFWwindow* window)
static void resizeWindow ( _GLFWwindow * window )
{
int scale = window - > wl . s cale;
int scale = window - > wl . contentS cale;
int scaledWidth = window - > wl . width * scale ;
int scaledHeight = window - > wl . height * scale ;
@ -352,13 +352,13 @@ void _glfwUpdateContentScaleWayland(_GLFWwindow* window)
// Get the scale factor from the highest scale monitor.
int maxScale = 1 ;
for ( int i = 0 ; i < window - > wl . monitor sCount; i + + )
maxScale = _glfw_max ( window - > wl . monitors [ i ] - > wl . scale , maxScale ) ;
for ( int i = 0 ; i < window - > wl . scale Count ; i + + )
maxScale = _glfw_max ( window - > wl . scales [ i ] . factor , maxScale ) ;
// Only change the framebuffer size if the scale changed.
if ( window - > wl . s cale ! = maxScale )
if ( window - > wl . contentS cale ! = maxScale )
{
window - > wl . s cale = maxScale ;
window - > wl . contentS cale = maxScale ;
wl_surface_set_buffer_scale ( window - > wl . surface , maxScale ) ;
_glfwInputWindowContentScale ( window , maxScale , maxScale ) ;
resizeWindow ( window ) ;
@ -377,16 +377,20 @@ static void surfaceHandleEnter(void* userData,
_GLFWwindow * window = userData ;
_GLFWmonitor * monitor = wl_output_get_user_data ( output ) ;
if ( ! window | | ! monitor )
return ;
if ( window - > wl . monitorsCount + 1 > window - > wl . monitorsSize )
if ( window - > wl . scale Count + 1 > window - > wl . scale Size )
{
+ + window - > wl . monitor sSize;
window - > wl . monitor s =
_glfw_realloc ( window - > wl . monitor s,
window - > wl . monitor sSize * sizeof ( _GLFWmonitor * ) ) ;
window - > wl . scale Size + + ;
window - > wl . scale s =
_glfw_realloc ( window - > wl . scale s,
window - > wl . scale Size * sizeof ( _GLFWscaleWayland ) ) ;
}
window - > wl . monitors [ window - > wl . monitorsCount + + ] = monitor ;
window - > wl . scaleCount + + ;
window - > wl . scales [ window - > wl . scaleCount - 1 ] . factor = monitor - > wl . contentScale ;
window - > wl . scales [ window - > wl . scaleCount - 1 ] . output = output ;
_glfwUpdateContentScaleWayland ( window ) ;
}
@ -399,17 +403,16 @@ static void surfaceHandleLeave(void* userData,
return ;
_GLFWwindow * window = userData ;
_GLFWmonitor * monitor = wl_output_get_user_data ( output ) ;
GLFWbool found = GLFW_FALSE ;
for ( int i = 0 ; i < window - > wl . monitorsCount - 1 ; + + i )
for ( int i = 0 ; i < window - > wl . scaleCount ; i + + )
{
if ( monitor = = window - > wl . monitors [ i ] )
found = GLFW_TRUE ;
if ( found )
window - > wl . monitors [ i ] = window - > wl . monitors [ i + 1 ] ;
if ( window - > wl . scales [ i ] . output = = output )
{
window - > wl . scales [ i ] = window - > wl . scales [ window - > wl . scaleCount - 1 ] ;
window - > wl . scaleCount - - ;
break ;
}
}
window - > wl . monitors [ - - window - > wl . monitorsCount ] = NULL ;
_glfwUpdateContentScaleWayland ( window ) ;
}
@ -743,7 +746,7 @@ static GLFWbool createNativeSurface(_GLFWwindow* window,
window - > wl . width = wndconfig - > width ;
window - > wl . height = wndconfig - > height ;
window - > wl . s cale = 1 ;
window - > wl . contentS cale = 1 ;
window - > wl . title = _glfw_strdup ( wndconfig - > title ) ;
window - > wl . appId = _glfw_strdup ( wndconfig - > wl . appId ) ;
@ -770,7 +773,7 @@ static void setCursorImage(_GLFWwindow* window,
buffer = cursorWayland - > buffer ;
else
{
if ( window - > wl . s cale > 1 & & cursorWayland - > cursorHiDPI )
if ( window - > wl . contentS cale > 1 & & cursorWayland - > cursorHiDPI )
{
wlCursor = cursorWayland - > cursorHiDPI ;
scale = 2 ;
@ -1126,7 +1129,7 @@ static void setCursor(_GLFWwindow* window, const char* name)
struct wl_cursor_theme * theme = _glfw . wl . cursorTheme ;
int scale = 1 ;
if ( window - > wl . s cale > 1 & & _glfw . wl . cursorThemeHiDPI )
if ( window - > wl . contentS cale > 1 & & _glfw . wl . cursorThemeHiDPI )
{
// We only support up to scale=2 for now, since libwayland-cursor
// requires us to load a different theme for each size.
@ -1908,7 +1911,7 @@ void _glfwDestroyWindowWayland(_GLFWwindow* window)
_glfw_free ( window - > wl . title ) ;
_glfw_free ( window - > wl . appId ) ;
_glfw_free ( window - > wl . monitor s) ;
_glfw_free ( window - > wl . scale s) ;
}
void _glfwSetWindowTitleWayland ( _GLFWwindow * window , const char * title )
@ -2038,9 +2041,9 @@ void _glfwGetFramebufferSizeWayland(_GLFWwindow* window, int* width, int* height
{
_glfwGetWindowSizeWayland ( window , width , height ) ;
if ( width )
* width * = window - > wl . s cale;
* width * = window - > wl . contentS cale;
if ( height )
* height * = window - > wl . s cale;
* height * = window - > wl . contentS cale;
}
void _glfwGetWindowFrameSizeWayland ( _GLFWwindow * window ,
@ -2064,9 +2067,9 @@ void _glfwGetWindowContentScaleWayland(_GLFWwindow* window,
float * xscale , float * yscale )
{
if ( xscale )
* xscale = ( float ) window - > wl . s cale;
* xscale = ( float ) window - > wl . contentS cale;
if ( yscale )
* yscale = ( float ) window - > wl . s cale;
* yscale = ( float ) window - > wl . contentS cale;
}
void _glfwIconifyWindowWayland ( _GLFWwindow * window )