rcore_desktop_glfw.c : simplies SetWindowState() and ClearWindowState()
i was trying to follow the code-style involved in these two function, but it confused me so much that it caused a bug i could not identify. So I just rewrote them using helpers, and the bug disappeared.
This commit is contained in:
parent
108e3bd834
commit
eac2e6f3e7
|
|
@ -135,6 +135,9 @@ static void _SetupPlatformMouseScaleAndOffset(); // Update mouse scale and offse
|
||||||
static void _SetPlatformMouseOffset(int offsetX, int offsetY);
|
static void _SetPlatformMouseOffset(int offsetX, int offsetY);
|
||||||
static void _SetPlatformMouseScale(float scaleX, float scaleY);
|
static void _SetPlatformMouseScale(float scaleX, float scaleY);
|
||||||
|
|
||||||
|
inline bool _FlagIsRequestedAndUnset(unsigned int requestedFlags, unsigned int flagName); // function helper required by SetWindowState()
|
||||||
|
inline bool _FlagIsRequestedAndSet(unsigned int requestedFlags, unsigned int flagName); // function helper required by ClearWindowState()
|
||||||
|
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
// Module Functions Declaration
|
// Module Functions Declaration
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
|
|
@ -295,122 +298,114 @@ void RestoreWindow(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// For the sake of code readability and debugging, we use some function helper :
|
||||||
|
inline bool _FlagIsRequestedAndUnset(unsigned int requestedFlags, unsigned int flagName)
|
||||||
|
{
|
||||||
|
return ((requestedFlags & flagName)!=0 && (CORE.Window.flags & flagName)==0);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline bool _FlagIsRequestedAndSet(unsigned int requestedFlags, unsigned int flagName)
|
||||||
|
{
|
||||||
|
return ((requestedFlags & flagName)!=0 && (CORE.Window.flags & flagName)!=0);
|
||||||
|
}
|
||||||
|
|
||||||
// Set window configuration state using flags
|
// Set window configuration state using flags
|
||||||
void SetWindowState(unsigned int flags)
|
void SetWindowState(unsigned int flags)
|
||||||
{
|
{
|
||||||
// Check previous state and requested state to apply required changes
|
// Check previous state and requested state to apply required changes
|
||||||
// NOTE: In most cases the functions already change the flags internally
|
// NOTE: In most cases the functions already change the flags internally
|
||||||
|
|
||||||
// State change: FLAG_VSYNC_HINT
|
if (_FlagIsRequestedAndUnset(flags, FLAG_VSYNC_HINT))
|
||||||
if (((CORE.Window.flags & FLAG_VSYNC_HINT) != (flags & FLAG_VSYNC_HINT)) && ((flags & FLAG_VSYNC_HINT) > 0))
|
|
||||||
{
|
{
|
||||||
glfwSwapInterval(1);
|
glfwSwapInterval(1);
|
||||||
CORE.Window.flags |= FLAG_VSYNC_HINT;
|
CORE.Window.flags |= FLAG_VSYNC_HINT;
|
||||||
}
|
}
|
||||||
|
|
||||||
// State change: FLAG_BORDERLESS_WINDOWED_MODE
|
if (_FlagIsRequestedAndUnset(flags, FLAG_BORDERLESS_WINDOWED_MODE))
|
||||||
// NOTE: This must be handled before FLAG_FULLSCREEN_MODE because ToggleBorderlessWindowed() needs to get some fullscreen values if fullscreen is running
|
|
||||||
if (((CORE.Window.flags & FLAG_BORDERLESS_WINDOWED_MODE) != (flags & FLAG_BORDERLESS_WINDOWED_MODE)) && ((flags & FLAG_BORDERLESS_WINDOWED_MODE) > 0))
|
|
||||||
{
|
{
|
||||||
ToggleBorderlessWindowed(); // NOTE: Window state flag updated inside function
|
ToggleBorderlessWindowed(); // NOTE: Window state flag updated inside function
|
||||||
}
|
}
|
||||||
|
else //!\ We can't have both fullscreen mode set at the same time. TODO : add a TRACELOG warnin ?
|
||||||
// State change: FLAG_FULLSCREEN_MODE
|
if (_FlagIsRequestedAndUnset(flags, FLAG_FULLSCREEN_MODE))
|
||||||
if ((CORE.Window.flags & FLAG_FULLSCREEN_MODE) != (flags & FLAG_FULLSCREEN_MODE))
|
|
||||||
{
|
{
|
||||||
ToggleFullscreen(); // NOTE: Window state flag updated inside function
|
ToggleFullscreen(); // NOTE: Window state flag updated inside function
|
||||||
}
|
}
|
||||||
|
|
||||||
// State change: FLAG_WINDOW_RESIZABLE
|
if (_FlagIsRequestedAndUnset(flags, FLAG_WINDOW_RESIZABLE))
|
||||||
if (((CORE.Window.flags & FLAG_WINDOW_RESIZABLE) != (flags & FLAG_WINDOW_RESIZABLE)) && ((flags & FLAG_WINDOW_RESIZABLE) > 0))
|
|
||||||
{
|
{
|
||||||
glfwSetWindowAttrib(platform.handle, GLFW_RESIZABLE, GLFW_TRUE);
|
glfwSetWindowAttrib(platform.handle, GLFW_RESIZABLE, GLFW_TRUE);
|
||||||
CORE.Window.flags |= FLAG_WINDOW_RESIZABLE;
|
CORE.Window.flags |= FLAG_WINDOW_RESIZABLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
// State change: FLAG_WINDOW_UNDECORATED
|
if (_FlagIsRequestedAndUnset(flags, FLAG_WINDOW_UNDECORATED))
|
||||||
if (((CORE.Window.flags & FLAG_WINDOW_UNDECORATED) != (flags & FLAG_WINDOW_UNDECORATED)) && (flags & FLAG_WINDOW_UNDECORATED))
|
|
||||||
{
|
{
|
||||||
glfwSetWindowAttrib(platform.handle, GLFW_DECORATED, GLFW_FALSE);
|
glfwSetWindowAttrib(platform.handle, GLFW_DECORATED, GLFW_FALSE);
|
||||||
CORE.Window.flags |= FLAG_WINDOW_UNDECORATED;
|
CORE.Window.flags |= FLAG_WINDOW_UNDECORATED;
|
||||||
}
|
}
|
||||||
|
|
||||||
// State change: FLAG_WINDOW_HIDDEN
|
if (_FlagIsRequestedAndUnset(flags, FLAG_WINDOW_HIDDEN))
|
||||||
if (((CORE.Window.flags & FLAG_WINDOW_HIDDEN) != (flags & FLAG_WINDOW_HIDDEN)) && ((flags & FLAG_WINDOW_HIDDEN) > 0))
|
|
||||||
{
|
{
|
||||||
glfwHideWindow(platform.handle);
|
glfwHideWindow(platform.handle);
|
||||||
CORE.Window.flags |= FLAG_WINDOW_HIDDEN;
|
CORE.Window.flags |= FLAG_WINDOW_HIDDEN;
|
||||||
}
|
}
|
||||||
|
|
||||||
// State change: FLAG_WINDOW_MINIMIZED
|
if (_FlagIsRequestedAndUnset(flags, FLAG_WINDOW_MINIMIZED))
|
||||||
if (((CORE.Window.flags & FLAG_WINDOW_MINIMIZED) != (flags & FLAG_WINDOW_MINIMIZED)) && ((flags & FLAG_WINDOW_MINIMIZED) > 0))
|
|
||||||
{
|
{
|
||||||
//GLFW_ICONIFIED
|
//GLFW_ICONIFIED
|
||||||
MinimizeWindow(); // NOTE: Window state flag updated inside function
|
MinimizeWindow(); // NOTE: Window state flag updated inside function
|
||||||
}
|
}
|
||||||
|
|
||||||
// State change: FLAG_WINDOW_MAXIMIZED
|
if (_FlagIsRequestedAndUnset(flags, FLAG_WINDOW_MAXIMIZED))
|
||||||
if (((CORE.Window.flags & FLAG_WINDOW_MAXIMIZED) != (flags & FLAG_WINDOW_MAXIMIZED)) && ((flags & FLAG_WINDOW_MAXIMIZED) > 0))
|
|
||||||
{
|
{
|
||||||
//GLFW_MAXIMIZED
|
//GLFW_MAXIMIZED
|
||||||
MaximizeWindow(); // NOTE: Window state flag updated inside function
|
MaximizeWindow(); // NOTE: Window state flag updated inside function
|
||||||
}
|
}
|
||||||
|
|
||||||
// State change: FLAG_WINDOW_UNFOCUSED
|
if (_FlagIsRequestedAndUnset(flags, FLAG_WINDOW_UNFOCUSED))
|
||||||
if (((CORE.Window.flags & FLAG_WINDOW_UNFOCUSED) != (flags & FLAG_WINDOW_UNFOCUSED)) && ((flags & FLAG_WINDOW_UNFOCUSED) > 0))
|
|
||||||
{
|
{
|
||||||
glfwSetWindowAttrib(platform.handle, GLFW_FOCUS_ON_SHOW, GLFW_FALSE);
|
glfwSetWindowAttrib(platform.handle, GLFW_FOCUS_ON_SHOW, GLFW_FALSE);
|
||||||
CORE.Window.flags |= FLAG_WINDOW_UNFOCUSED;
|
CORE.Window.flags |= FLAG_WINDOW_UNFOCUSED;
|
||||||
}
|
}
|
||||||
|
|
||||||
// State change: FLAG_WINDOW_TOPMOST
|
if (_FlagIsRequestedAndUnset(flags, FLAG_WINDOW_TOPMOST))
|
||||||
if (((CORE.Window.flags & FLAG_WINDOW_TOPMOST) != (flags & FLAG_WINDOW_TOPMOST)) && ((flags & FLAG_WINDOW_TOPMOST) > 0))
|
|
||||||
{
|
{
|
||||||
glfwSetWindowAttrib(platform.handle, GLFW_FLOATING, GLFW_TRUE);
|
glfwSetWindowAttrib(platform.handle, GLFW_FLOATING, GLFW_TRUE);
|
||||||
CORE.Window.flags |= FLAG_WINDOW_TOPMOST;
|
CORE.Window.flags |= FLAG_WINDOW_TOPMOST;
|
||||||
}
|
}
|
||||||
|
|
||||||
// State change: FLAG_WINDOW_ALWAYS_RUN
|
if (_FlagIsRequestedAndUnset(flags, FLAG_WINDOW_ALWAYS_RUN))
|
||||||
if (((CORE.Window.flags & FLAG_WINDOW_ALWAYS_RUN) != (flags & FLAG_WINDOW_ALWAYS_RUN)) && ((flags & FLAG_WINDOW_ALWAYS_RUN) > 0))
|
|
||||||
{
|
{
|
||||||
CORE.Window.flags |= FLAG_WINDOW_ALWAYS_RUN;
|
CORE.Window.flags |= FLAG_WINDOW_ALWAYS_RUN;
|
||||||
}
|
}
|
||||||
|
|
||||||
// The following states can not be changed after window creation
|
if (_FlagIsRequestedAndUnset(flags, FLAG_WINDOW_TRANSPARENT))
|
||||||
|
|
||||||
// State change: FLAG_WINDOW_TRANSPARENT
|
|
||||||
if (((CORE.Window.flags & FLAG_WINDOW_TRANSPARENT) != (flags & FLAG_WINDOW_TRANSPARENT)) && ((flags & FLAG_WINDOW_TRANSPARENT) > 0))
|
|
||||||
{
|
{
|
||||||
TRACELOG(LOG_WARNING, "WINDOW: Framebuffer transparency can only be configured before window initialization");
|
TRACELOG(LOG_WARNING, "WINDOW: Framebuffer transparency can only be configured before window initialization");
|
||||||
}
|
}
|
||||||
|
|
||||||
// State change: FLAG_WINDOW_HIGHDPI
|
if (_FlagIsRequestedAndUnset(flags, FLAG_WINDOW_HIGHDPI))
|
||||||
if (((CORE.Window.flags & FLAG_WINDOW_HIGHDPI) != (flags & FLAG_WINDOW_HIGHDPI)) && ((flags & FLAG_WINDOW_HIGHDPI) > 0))
|
|
||||||
{
|
{
|
||||||
TRACELOG(LOG_WARNING, "WINDOW: High DPI can only be configured before window initialization");
|
TRACELOG(LOG_WARNING, "WINDOW: High DPI can only be configured before window initialization");
|
||||||
}
|
}
|
||||||
|
|
||||||
// State change: FLAG_WINDOW_MOUSE_PASSTHROUGH
|
if (_FlagIsRequestedAndUnset(flags, FLAG_WINDOW_MOUSE_PASSTHROUGH))
|
||||||
if (((CORE.Window.flags & FLAG_WINDOW_MOUSE_PASSTHROUGH) != (flags & FLAG_WINDOW_MOUSE_PASSTHROUGH)) && ((flags & FLAG_WINDOW_MOUSE_PASSTHROUGH) > 0))
|
|
||||||
{
|
{
|
||||||
glfwSetWindowAttrib(platform.handle, GLFW_MOUSE_PASSTHROUGH, GLFW_TRUE);
|
glfwSetWindowAttrib(platform.handle, GLFW_MOUSE_PASSTHROUGH, GLFW_TRUE);
|
||||||
CORE.Window.flags |= FLAG_WINDOW_MOUSE_PASSTHROUGH;
|
CORE.Window.flags |= FLAG_WINDOW_MOUSE_PASSTHROUGH;
|
||||||
}
|
}
|
||||||
|
|
||||||
// State change: FLAG_MSAA_4X_HINT
|
if (_FlagIsRequestedAndUnset(flags, FLAG_MSAA_4X_HINT))
|
||||||
if (((CORE.Window.flags & FLAG_MSAA_4X_HINT) != (flags & FLAG_MSAA_4X_HINT)) && ((flags & FLAG_MSAA_4X_HINT) > 0))
|
|
||||||
{
|
{
|
||||||
TRACELOG(LOG_WARNING, "WINDOW: MSAA can only be configured before window initialization");
|
TRACELOG(LOG_WARNING, "WINDOW: MSAA can only be configured before window initialization");
|
||||||
}
|
}
|
||||||
|
|
||||||
// State change: FLAG_INTERLACED_HINT
|
if (_FlagIsRequestedAndUnset(flags, FLAG_INTERLACED_HINT))
|
||||||
if (((CORE.Window.flags & FLAG_INTERLACED_HINT) != (flags & FLAG_INTERLACED_HINT)) && ((flags & FLAG_INTERLACED_HINT) > 0))
|
|
||||||
{
|
{
|
||||||
TRACELOG(LOG_WARNING, "RPI: Interlaced mode can only be configured before window initialization");
|
TRACELOG(LOG_WARNING, "RPI: Interlaced mode can only be configured before window initialization");
|
||||||
}
|
}
|
||||||
|
|
||||||
// State change: FLAG_RESCALE_CONTENT
|
if (_FlagIsRequestedAndUnset(flags, FLAG_RESCALE_CONTENT))
|
||||||
if (((CORE.Window.flags & FLAG_RESCALE_CONTENT) != (flags & FLAG_RESCALE_CONTENT)) && ((flags & FLAG_RESCALE_CONTENT) > 0))
|
|
||||||
{
|
{
|
||||||
CORE.Window.flags |= FLAG_RESCALE_CONTENT;
|
CORE.Window.flags |= FLAG_RESCALE_CONTENT;
|
||||||
int fbWidth;
|
int fbWidth;
|
||||||
|
|
@ -419,8 +414,7 @@ void SetWindowState(unsigned int flags)
|
||||||
WindowSizeCallback(platform.handle, fbWidth, fbHeight);
|
WindowSizeCallback(platform.handle, fbWidth, fbHeight);
|
||||||
}
|
}
|
||||||
|
|
||||||
// State change: FLAG_TEXT_LINEAR_FILTER
|
if (_FlagIsRequestedAndUnset(flags, FLAG_TEXT_LINEAR_FILTER))
|
||||||
if (((CORE.Window.flags & FLAG_TEXT_LINEAR_FILTER) != (flags & FLAG_TEXT_LINEAR_FILTER)) && ((flags & FLAG_TEXT_LINEAR_FILTER) > 0))
|
|
||||||
{
|
{
|
||||||
CORE.Window.flags |= FLAG_TEXT_LINEAR_FILTER;
|
CORE.Window.flags |= FLAG_TEXT_LINEAR_FILTER;
|
||||||
rlTextureParameters(GetFontDefault().texture.id, RL_TEXTURE_MIN_FILTER, RL_TEXTURE_FILTER_LINEAR);
|
rlTextureParameters(GetFontDefault().texture.id, RL_TEXTURE_MIN_FILTER, RL_TEXTURE_FILTER_LINEAR);
|
||||||
|
|
@ -434,114 +428,94 @@ void ClearWindowState(unsigned int flags)
|
||||||
// Check previous state and requested state to apply required changes
|
// Check previous state and requested state to apply required changes
|
||||||
// NOTE: In most cases the functions already change the flags internally
|
// NOTE: In most cases the functions already change the flags internally
|
||||||
|
|
||||||
// State change: FLAG_VSYNC_HINT
|
if (_FlagIsRequestedAndSet(flags, FLAG_VSYNC_HINT))
|
||||||
if (((CORE.Window.flags & FLAG_VSYNC_HINT) > 0) && ((flags & FLAG_VSYNC_HINT) > 0))
|
|
||||||
{
|
{
|
||||||
glfwSwapInterval(0);
|
glfwSwapInterval(0);
|
||||||
CORE.Window.flags &= ~FLAG_VSYNC_HINT;
|
CORE.Window.flags &= ~FLAG_VSYNC_HINT;
|
||||||
}
|
}
|
||||||
|
|
||||||
// State change: FLAG_BORDERLESS_WINDOWED_MODE
|
if (_FlagIsRequestedAndSet(flags, FLAG_BORDERLESS_WINDOWED_MODE))
|
||||||
// NOTE: This must be handled before FLAG_FULLSCREEN_MODE because ToggleBorderlessWindowed() needs to get some fullscreen values if fullscreen is running
|
|
||||||
if (((CORE.Window.flags & FLAG_BORDERLESS_WINDOWED_MODE) > 0) && ((flags & FLAG_BORDERLESS_WINDOWED_MODE) > 0))
|
|
||||||
{
|
{
|
||||||
ToggleBorderlessWindowed(); // NOTE: Window state flag updated inside function
|
ToggleBorderlessWindowed(); // NOTE: Window state flag updated inside function
|
||||||
}
|
}
|
||||||
|
|
||||||
// State change: FLAG_FULLSCREEN_MODE
|
if (_FlagIsRequestedAndSet(flags, FLAG_FULLSCREEN_MODE))
|
||||||
if (((CORE.Window.flags & FLAG_FULLSCREEN_MODE) > 0) && ((flags & FLAG_FULLSCREEN_MODE) > 0))
|
|
||||||
{
|
{
|
||||||
ToggleFullscreen(); // NOTE: Window state flag updated inside function
|
ToggleFullscreen(); // NOTE: Window state flag updated inside function
|
||||||
}
|
}
|
||||||
|
|
||||||
// State change: FLAG_WINDOW_RESIZABLE
|
if (_FlagIsRequestedAndSet(flags, FLAG_WINDOW_RESIZABLE))
|
||||||
if (((CORE.Window.flags & FLAG_WINDOW_RESIZABLE) > 0) && ((flags & FLAG_WINDOW_RESIZABLE) > 0))
|
|
||||||
{
|
{
|
||||||
glfwSetWindowAttrib(platform.handle, GLFW_RESIZABLE, GLFW_FALSE);
|
glfwSetWindowAttrib(platform.handle, GLFW_RESIZABLE, GLFW_FALSE);
|
||||||
CORE.Window.flags &= ~FLAG_WINDOW_RESIZABLE;
|
CORE.Window.flags &= ~FLAG_WINDOW_RESIZABLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
// State change: FLAG_WINDOW_HIDDEN
|
if (_FlagIsRequestedAndSet(flags, FLAG_WINDOW_HIDDEN))
|
||||||
if (((CORE.Window.flags & FLAG_WINDOW_HIDDEN) > 0) && ((flags & FLAG_WINDOW_HIDDEN) > 0))
|
|
||||||
{
|
{
|
||||||
glfwShowWindow(platform.handle);
|
glfwShowWindow(platform.handle);
|
||||||
CORE.Window.flags &= ~FLAG_WINDOW_HIDDEN;
|
CORE.Window.flags &= ~FLAG_WINDOW_HIDDEN;
|
||||||
}
|
}
|
||||||
|
|
||||||
// State change: FLAG_WINDOW_MINIMIZED
|
if (_FlagIsRequestedAndSet(flags, FLAG_WINDOW_MINIMIZED))
|
||||||
if (((CORE.Window.flags & FLAG_WINDOW_MINIMIZED) > 0) && ((flags & FLAG_WINDOW_MINIMIZED) > 0))
|
|
||||||
{
|
{
|
||||||
RestoreWindow(); // NOTE: Window state flag updated inside function
|
RestoreWindow(); // NOTE: Window state flag updated inside function
|
||||||
}
|
}
|
||||||
|
|
||||||
// State change: FLAG_WINDOW_MAXIMIZED
|
if (_FlagIsRequestedAndSet(flags, FLAG_WINDOW_MAXIMIZED))
|
||||||
if (((CORE.Window.flags & FLAG_WINDOW_MAXIMIZED) > 0) && ((flags & FLAG_WINDOW_MAXIMIZED) > 0))
|
|
||||||
{
|
{
|
||||||
RestoreWindow(); // NOTE: Window state flag updated inside function
|
RestoreWindow(); // NOTE: Window state flag updated inside function
|
||||||
}
|
}
|
||||||
|
|
||||||
// State change: FLAG_WINDOW_UNDECORATED
|
if (_FlagIsRequestedAndSet(flags, FLAG_WINDOW_UNDECORATED))
|
||||||
if (((CORE.Window.flags & FLAG_WINDOW_UNDECORATED) > 0) && ((flags & FLAG_WINDOW_UNDECORATED) > 0))
|
|
||||||
{
|
{
|
||||||
glfwSetWindowAttrib(platform.handle, GLFW_DECORATED, GLFW_TRUE);
|
glfwSetWindowAttrib(platform.handle, GLFW_DECORATED, GLFW_TRUE);
|
||||||
CORE.Window.flags &= ~FLAG_WINDOW_UNDECORATED;
|
CORE.Window.flags &= ~FLAG_WINDOW_UNDECORATED;
|
||||||
}
|
}
|
||||||
|
|
||||||
// State change: FLAG_WINDOW_UNFOCUSED
|
if (_FlagIsRequestedAndSet(flags, FLAG_WINDOW_UNFOCUSED))
|
||||||
if (((CORE.Window.flags & FLAG_WINDOW_UNFOCUSED) > 0) && ((flags & FLAG_WINDOW_UNFOCUSED) > 0))
|
|
||||||
{
|
{
|
||||||
glfwSetWindowAttrib(platform.handle, GLFW_FOCUS_ON_SHOW, GLFW_TRUE);
|
glfwSetWindowAttrib(platform.handle, GLFW_FOCUS_ON_SHOW, GLFW_TRUE);
|
||||||
CORE.Window.flags &= ~FLAG_WINDOW_UNFOCUSED;
|
CORE.Window.flags &= ~FLAG_WINDOW_UNFOCUSED;
|
||||||
}
|
}
|
||||||
|
|
||||||
// State change: FLAG_WINDOW_TOPMOST
|
if (_FlagIsRequestedAndSet(flags, FLAG_WINDOW_TOPMOST))
|
||||||
if (((CORE.Window.flags & FLAG_WINDOW_TOPMOST) > 0) && ((flags & FLAG_WINDOW_TOPMOST) > 0))
|
|
||||||
{
|
{
|
||||||
glfwSetWindowAttrib(platform.handle, GLFW_FLOATING, GLFW_FALSE);
|
glfwSetWindowAttrib(platform.handle, GLFW_FLOATING, GLFW_FALSE);
|
||||||
CORE.Window.flags &= ~FLAG_WINDOW_TOPMOST;
|
CORE.Window.flags &= ~FLAG_WINDOW_TOPMOST;
|
||||||
}
|
}
|
||||||
|
|
||||||
// State change: FLAG_WINDOW_ALWAYS_RUN
|
if (_FlagIsRequestedAndSet(flags, FLAG_WINDOW_ALWAYS_RUN))
|
||||||
if (((CORE.Window.flags & FLAG_WINDOW_ALWAYS_RUN) > 0) && ((flags & FLAG_WINDOW_ALWAYS_RUN) > 0))
|
|
||||||
{
|
{
|
||||||
CORE.Window.flags &= ~FLAG_WINDOW_ALWAYS_RUN;
|
CORE.Window.flags &= ~FLAG_WINDOW_ALWAYS_RUN;
|
||||||
}
|
}
|
||||||
|
|
||||||
// The following states can not be changed after window creation
|
if (_FlagIsRequestedAndSet(flags, FLAG_WINDOW_TRANSPARENT))
|
||||||
|
|
||||||
// State change: FLAG_WINDOW_TRANSPARENT
|
|
||||||
if (((CORE.Window.flags & FLAG_WINDOW_TRANSPARENT) > 0) && ((flags & FLAG_WINDOW_TRANSPARENT) > 0))
|
|
||||||
{
|
{
|
||||||
TRACELOG(LOG_WARNING, "WINDOW: Framebuffer transparency can only be configured before window initialization");
|
TRACELOG(LOG_WARNING, "WINDOW: Framebuffer transparency can only be configured before window initialization");
|
||||||
}
|
}
|
||||||
|
|
||||||
// State change: FLAG_WINDOW_HIGHDPI
|
if (_FlagIsRequestedAndSet(flags, FLAG_WINDOW_HIGHDPI))
|
||||||
if (((CORE.Window.flags & FLAG_WINDOW_HIGHDPI) > 0) && ((flags & FLAG_WINDOW_HIGHDPI) > 0))
|
|
||||||
{
|
{
|
||||||
TRACELOG(LOG_WARNING, "WINDOW: High DPI can only be configured before window initialization");
|
TRACELOG(LOG_WARNING, "WINDOW: High DPI can only be configured before window initialization");
|
||||||
}
|
}
|
||||||
|
|
||||||
// State change: FLAG_WINDOW_MOUSE_PASSTHROUGH
|
if (_FlagIsRequestedAndSet(flags, FLAG_WINDOW_MOUSE_PASSTHROUGH))
|
||||||
if (((CORE.Window.flags & FLAG_WINDOW_MOUSE_PASSTHROUGH) > 0) && ((flags & FLAG_WINDOW_MOUSE_PASSTHROUGH) > 0))
|
|
||||||
{
|
{
|
||||||
glfwSetWindowAttrib(platform.handle, GLFW_MOUSE_PASSTHROUGH, GLFW_FALSE);
|
glfwSetWindowAttrib(platform.handle, GLFW_MOUSE_PASSTHROUGH, GLFW_FALSE);
|
||||||
CORE.Window.flags &= ~FLAG_WINDOW_MOUSE_PASSTHROUGH;
|
CORE.Window.flags &= ~FLAG_WINDOW_MOUSE_PASSTHROUGH;
|
||||||
}
|
}
|
||||||
|
|
||||||
// State change: FLAG_MSAA_4X_HINT
|
if (_FlagIsRequestedAndSet(flags, FLAG_MSAA_4X_HINT))
|
||||||
if (((CORE.Window.flags & FLAG_MSAA_4X_HINT) > 0) && ((flags & FLAG_MSAA_4X_HINT) > 0))
|
|
||||||
{
|
{
|
||||||
TRACELOG(LOG_WARNING, "WINDOW: MSAA can only be configured before window initialization");
|
TRACELOG(LOG_WARNING, "WINDOW: MSAA can only be configured before window initialization");
|
||||||
}
|
}
|
||||||
|
|
||||||
// State change: FLAG_INTERLACED_HINT
|
if (_FlagIsRequestedAndSet(flags, FLAG_INTERLACED_HINT))
|
||||||
if (((CORE.Window.flags & FLAG_INTERLACED_HINT) > 0) && ((flags & FLAG_INTERLACED_HINT) > 0))
|
|
||||||
{
|
{
|
||||||
TRACELOG(LOG_WARNING, "RPI: Interlaced mode can only be configured before window initialization");
|
TRACELOG(LOG_WARNING, "RPI: Interlaced mode can only be configured before window initialization");
|
||||||
}
|
}
|
||||||
|
|
||||||
// State change: FLAG_RESCALE_CONTENT
|
if (_FlagIsRequestedAndSet(flags, FLAG_RESCALE_CONTENT))
|
||||||
if (((CORE.Window.flags & FLAG_RESCALE_CONTENT) > 0) && ((flags & FLAG_RESCALE_CONTENT) > 0))
|
|
||||||
{
|
{
|
||||||
CORE.Window.flags &= ~FLAG_RESCALE_CONTENT;
|
CORE.Window.flags &= ~FLAG_RESCALE_CONTENT;
|
||||||
int fbWidth;
|
int fbWidth;
|
||||||
|
|
@ -550,8 +524,7 @@ void ClearWindowState(unsigned int flags)
|
||||||
WindowSizeCallback(platform.handle, fbWidth, fbHeight);
|
WindowSizeCallback(platform.handle, fbWidth, fbHeight);
|
||||||
}
|
}
|
||||||
|
|
||||||
// State change: FLAG_TEXT_LINEAR_FILTER
|
if (_FlagIsRequestedAndSet(flags, FLAG_TEXT_LINEAR_FILTER))
|
||||||
if (((CORE.Window.flags & FLAG_TEXT_LINEAR_FILTER) > 0) && ((flags & FLAG_TEXT_LINEAR_FILTER) > 0))
|
|
||||||
{
|
{
|
||||||
CORE.Window.flags &= ~FLAG_TEXT_LINEAR_FILTER;
|
CORE.Window.flags &= ~FLAG_TEXT_LINEAR_FILTER;
|
||||||
rlTextureParameters(GetFontDefault().texture.id, RL_TEXTURE_MIN_FILTER, RL_TEXTURE_FILTER_NEAREST);
|
rlTextureParameters(GetFontDefault().texture.id, RL_TEXTURE_MIN_FILTER, RL_TEXTURE_FILTER_NEAREST);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user