|
|
|
@ -105,7 +105,7 @@ static void checkScaleChange(_GLFWwindow* window) |
|
|
|
|
int monitorScale; |
|
|
|
|
|
|
|
|
|
// Check if we will be able to set the buffer scale or not.
|
|
|
|
|
if (_glfw.wl.wl_compositor_version < 3) |
|
|
|
|
if (_glfw.wl.compositorVersion < 3) |
|
|
|
|
return; |
|
|
|
|
|
|
|
|
|
// Get the scale factor from the highest scale monitor.
|
|
|
|
@ -220,33 +220,33 @@ static GLFWbool createSurface(_GLFWwindow* window, |
|
|
|
|
|
|
|
|
|
static GLFWbool createShellSurface(_GLFWwindow* window) |
|
|
|
|
{ |
|
|
|
|
window->wl.shell_surface = wl_shell_get_shell_surface(_glfw.wl.shell, |
|
|
|
|
window->wl.surface); |
|
|
|
|
if (!window->wl.shell_surface) |
|
|
|
|
window->wl.shellSurface = wl_shell_get_shell_surface(_glfw.wl.shell, |
|
|
|
|
window->wl.surface); |
|
|
|
|
if (!window->wl.shellSurface) |
|
|
|
|
return GLFW_FALSE; |
|
|
|
|
|
|
|
|
|
wl_shell_surface_add_listener(window->wl.shell_surface, |
|
|
|
|
wl_shell_surface_add_listener(window->wl.shellSurface, |
|
|
|
|
&shellSurfaceListener, |
|
|
|
|
window); |
|
|
|
|
|
|
|
|
|
if (window->wl.title) |
|
|
|
|
wl_shell_surface_set_title(window->wl.shell_surface, window->wl.title); |
|
|
|
|
wl_shell_surface_set_title(window->wl.shellSurface, window->wl.title); |
|
|
|
|
|
|
|
|
|
if (window->monitor) |
|
|
|
|
{ |
|
|
|
|
wl_shell_surface_set_fullscreen( |
|
|
|
|
window->wl.shell_surface, |
|
|
|
|
window->wl.shellSurface, |
|
|
|
|
WL_SHELL_SURFACE_FULLSCREEN_METHOD_DEFAULT, |
|
|
|
|
0, |
|
|
|
|
window->monitor->wl.output); |
|
|
|
|
} |
|
|
|
|
else if (window->wl.maximized) |
|
|
|
|
{ |
|
|
|
|
wl_shell_surface_set_maximized(window->wl.shell_surface, NULL); |
|
|
|
|
wl_shell_surface_set_maximized(window->wl.shellSurface, NULL); |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
wl_shell_surface_set_toplevel(window->wl.shell_surface); |
|
|
|
|
wl_shell_surface_set_toplevel(window->wl.shellSurface); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return GLFW_TRUE; |
|
|
|
@ -411,7 +411,7 @@ int _glfwPlatformCreateWindow(_GLFWwindow* window, |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
window->wl.shell_surface = NULL; |
|
|
|
|
window->wl.shellSurface = NULL; |
|
|
|
|
window->wl.visible = GLFW_FALSE; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -443,8 +443,8 @@ void _glfwPlatformDestroyWindow(_GLFWwindow* window) |
|
|
|
|
if (window->wl.native) |
|
|
|
|
wl_egl_window_destroy(window->wl.native); |
|
|
|
|
|
|
|
|
|
if (window->wl.shell_surface) |
|
|
|
|
wl_shell_surface_destroy(window->wl.shell_surface); |
|
|
|
|
if (window->wl.shellSurface) |
|
|
|
|
wl_shell_surface_destroy(window->wl.shellSurface); |
|
|
|
|
|
|
|
|
|
if (window->wl.surface) |
|
|
|
|
wl_surface_destroy(window->wl.surface); |
|
|
|
@ -458,8 +458,8 @@ void _glfwPlatformSetWindowTitle(_GLFWwindow* window, const char* title) |
|
|
|
|
if (window->wl.title) |
|
|
|
|
free(window->wl.title); |
|
|
|
|
window->wl.title = strdup(title); |
|
|
|
|
if (window->wl.shell_surface) |
|
|
|
|
wl_shell_surface_set_title(window->wl.shell_surface, title); |
|
|
|
|
if (window->wl.shellSurface) |
|
|
|
|
wl_shell_surface_set_title(window->wl.shellSurface, title); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void _glfwPlatformSetWindowIcon(_GLFWwindow* window, |
|
|
|
@ -546,8 +546,8 @@ void _glfwPlatformRestoreWindow(_GLFWwindow* window) |
|
|
|
|
// TODO: also do the same for iconified.
|
|
|
|
|
if (window->monitor || window->wl.maximized) |
|
|
|
|
{ |
|
|
|
|
if (window->wl.shell_surface) |
|
|
|
|
wl_shell_surface_set_toplevel(window->wl.shell_surface); |
|
|
|
|
if (window->wl.shellSurface) |
|
|
|
|
wl_shell_surface_set_toplevel(window->wl.shellSurface); |
|
|
|
|
|
|
|
|
|
window->wl.maximized = GLFW_FALSE; |
|
|
|
|
} |
|
|
|
@ -557,10 +557,10 @@ void _glfwPlatformMaximizeWindow(_GLFWwindow* window) |
|
|
|
|
{ |
|
|
|
|
if (!window->monitor && !window->wl.maximized) |
|
|
|
|
{ |
|
|
|
|
if (window->wl.shell_surface) |
|
|
|
|
if (window->wl.shellSurface) |
|
|
|
|
{ |
|
|
|
|
// Let the compositor select the best output.
|
|
|
|
|
wl_shell_surface_set_maximized(window->wl.shell_surface, NULL); |
|
|
|
|
wl_shell_surface_set_maximized(window->wl.shellSurface, NULL); |
|
|
|
|
} |
|
|
|
|
window->wl.maximized = GLFW_TRUE; |
|
|
|
|
} |
|
|
|
@ -570,7 +570,7 @@ void _glfwPlatformShowWindow(_GLFWwindow* window) |
|
|
|
|
{ |
|
|
|
|
if (!window->monitor) |
|
|
|
|
{ |
|
|
|
|
if (!window->wl.shell_surface) |
|
|
|
|
if (!window->wl.shellSurface) |
|
|
|
|
createShellSurface(window); |
|
|
|
|
window->wl.visible = GLFW_TRUE; |
|
|
|
|
} |
|
|
|
@ -580,8 +580,8 @@ void _glfwPlatformHideWindow(_GLFWwindow* window) |
|
|
|
|
{ |
|
|
|
|
if (!window->monitor) |
|
|
|
|
{ |
|
|
|
|
if (window->wl.shell_surface) |
|
|
|
|
wl_shell_surface_destroy(window->wl.shell_surface); |
|
|
|
|
if (window->wl.shellSurface) |
|
|
|
|
wl_shell_surface_destroy(window->wl.shellSurface); |
|
|
|
|
window->wl.visible = GLFW_FALSE; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -601,14 +601,14 @@ void _glfwPlatformSetWindowMonitor(_GLFWwindow* window, |
|
|
|
|
if (monitor) |
|
|
|
|
{ |
|
|
|
|
wl_shell_surface_set_fullscreen( |
|
|
|
|
window->wl.shell_surface, |
|
|
|
|
window->wl.shellSurface, |
|
|
|
|
WL_SHELL_SURFACE_FULLSCREEN_METHOD_DEFAULT, |
|
|
|
|
refreshRate * 1000, // Convert Hz to mHz.
|
|
|
|
|
monitor->wl.output); |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
wl_shell_surface_set_toplevel(window->wl.shell_surface); |
|
|
|
|
wl_shell_surface_set_toplevel(window->wl.shellSurface); |
|
|
|
|
} |
|
|
|
|
_glfwInputWindowMonitorChange(window, monitor); |
|
|
|
|
} |
|
|
|
|