mirror of
https://github.com/glfw/glfw.git
synced 2025-10-04 05:36:35 +00:00
Fix borderless fullscreen.
This commit is contained in:
parent
d834f01ca4
commit
b2db1fa2d3
1
.gitignore
vendored
1
.gitignore
vendored
@ -83,3 +83,4 @@ tests/title
|
|||||||
tests/triangle-vulkan
|
tests/triangle-vulkan
|
||||||
tests/windows
|
tests/windows
|
||||||
|
|
||||||
|
/[Bb]uild*/
|
@ -54,6 +54,7 @@ void reshape( GLFWwindow* window, int w, int h );
|
|||||||
void key_callback( GLFWwindow* window, int key, int scancode, int action, int mods );
|
void key_callback( GLFWwindow* window, int key, int scancode, int action, int mods );
|
||||||
void mouse_button_callback( GLFWwindow* window, int button, int action, int mods );
|
void mouse_button_callback( GLFWwindow* window, int button, int action, int mods );
|
||||||
void cursor_position_callback( GLFWwindow* window, double x, double y );
|
void cursor_position_callback( GLFWwindow* window, double x, double y );
|
||||||
|
void window_maximize_callback( GLFWwindow* window, int maximized );
|
||||||
void DrawBoingBall( void );
|
void DrawBoingBall( void );
|
||||||
void BounceBall( double dt );
|
void BounceBall( double dt );
|
||||||
void DrawBoingBallBand( GLfloat long_lo, GLfloat long_hi );
|
void DrawBoingBallBand( GLfloat long_lo, GLfloat long_hi );
|
||||||
@ -297,6 +298,25 @@ void cursor_position_callback( GLFWwindow* window, double x, double y )
|
|||||||
set_ball_pos(cursor_x, cursor_y);
|
set_ball_pos(cursor_x, cursor_y);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void window_maximize_callback( GLFWwindow* window, int maximize )
|
||||||
|
{
|
||||||
|
if (maximize) {
|
||||||
|
GLFWmonitor* monitor = glfwGetPrimaryMonitor();
|
||||||
|
if (monitor == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
|
const GLFWvidmode* mode = glfwGetVideoMode(monitor);
|
||||||
|
if (mode == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
|
glfwSetWindowMonitor(window, monitor, 0, 0, mode->width,
|
||||||
|
mode->height, mode->refreshRate);
|
||||||
|
} else {
|
||||||
|
glfwSetWindowMonitor(window, NULL, windowed_xpos,
|
||||||
|
windowed_ypos, windowed_width, windowed_height, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
* Draw the Boing ball.
|
* Draw the Boing ball.
|
||||||
*
|
*
|
||||||
@ -628,6 +648,8 @@ int main( void )
|
|||||||
if( !glfwInit() )
|
if( !glfwInit() )
|
||||||
exit( EXIT_FAILURE );
|
exit( EXIT_FAILURE );
|
||||||
|
|
||||||
|
glfwWindowHint(GLFW_AUTO_ICONIFY, GLFW_FALSE);
|
||||||
|
|
||||||
window = glfwCreateWindow( 400, 400, "Boing (classic Amiga demo)", NULL, NULL );
|
window = glfwCreateWindow( 400, 400, "Boing (classic Amiga demo)", NULL, NULL );
|
||||||
if (!window)
|
if (!window)
|
||||||
{
|
{
|
||||||
@ -641,6 +663,7 @@ int main( void )
|
|||||||
glfwSetKeyCallback(window, key_callback);
|
glfwSetKeyCallback(window, key_callback);
|
||||||
glfwSetMouseButtonCallback(window, mouse_button_callback);
|
glfwSetMouseButtonCallback(window, mouse_button_callback);
|
||||||
glfwSetCursorPosCallback(window, cursor_position_callback);
|
glfwSetCursorPosCallback(window, cursor_position_callback);
|
||||||
|
glfwSetWindowMaximizeCallback(window, window_maximize_callback);
|
||||||
|
|
||||||
glfwMakeContextCurrent(window);
|
glfwMakeContextCurrent(window);
|
||||||
gladLoadGL(glfwGetProcAddress);
|
gladLoadGL(glfwGetProcAddress);
|
||||||
|
@ -1735,6 +1735,7 @@ void _glfwPlatformSetWindowMonitor(_GLFWwindow* window,
|
|||||||
DWORD style = GetWindowLongW(window->win32.handle, GWL_STYLE);
|
DWORD style = GetWindowLongW(window->win32.handle, GWL_STYLE);
|
||||||
style &= ~WS_OVERLAPPEDWINDOW;
|
style &= ~WS_OVERLAPPEDWINDOW;
|
||||||
style |= getWindowStyle(window);
|
style |= getWindowStyle(window);
|
||||||
|
style |= WS_POPUPWINDOW;
|
||||||
SetWindowLongW(window->win32.handle, GWL_STYLE, style);
|
SetWindowLongW(window->win32.handle, GWL_STYLE, style);
|
||||||
flags |= SWP_FRAMECHANGED;
|
flags |= SWP_FRAMECHANGED;
|
||||||
}
|
}
|
||||||
@ -1742,7 +1743,13 @@ void _glfwPlatformSetWindowMonitor(_GLFWwindow* window,
|
|||||||
acquireMonitor(window);
|
acquireMonitor(window);
|
||||||
|
|
||||||
GetMonitorInfo(window->monitor->win32.handle, &mi);
|
GetMonitorInfo(window->monitor->win32.handle, &mi);
|
||||||
SetWindowPos(window->win32.handle, HWND_TOPMOST,
|
|
||||||
|
HWND z_mode = HWND_TOP;
|
||||||
|
if (window->floating) {
|
||||||
|
z_mode = HWND_TOPMOST;
|
||||||
|
}
|
||||||
|
|
||||||
|
SetWindowPos(window->win32.handle, z_mode,
|
||||||
mi.rcMonitor.left,
|
mi.rcMonitor.left,
|
||||||
mi.rcMonitor.top,
|
mi.rcMonitor.top,
|
||||||
mi.rcMonitor.right - mi.rcMonitor.left,
|
mi.rcMonitor.right - mi.rcMonitor.left,
|
||||||
|
Loading…
Reference in New Issue
Block a user