4 Commits

Author SHA1 Message Date
Ray
f9e2215c49 Update README.md 2026-08-19 21:17:17 +02:00
Ray
d75a6589f0 REVIEWED: GetWindowPosition() #5932 2026-08-19 20:25:01 +02:00
47c8e897ce [rcore][GLFW] Fix borderless-windowed mode being always on top (#5868)
* Fix borderless fullscreen always on top

Don't pass a monitor to glfwSetWindowMonitor(). This avoids setting the flag which keeps the window always on top.

* Update for borderless-windowed always on top bug

Only apply the fix for Windows OS, since that seems to be the only
platform with the issue.
2026-08-19 20:02:32 +02:00
1129d42b48 Mostly rewrote GetPrevDirectoryPath() to correct its behavior in a few cases (#6073) 2026-08-19 19:53:56 +02:00
3 changed files with 28 additions and 8 deletions

View File

@ -54,6 +54,10 @@ features
- Bindings to [+70 programming languages](https://github.com/raysan5/raylib/blob/master/BINDINGS.md)!
- **Free and open source**
limitations
-----------
- No support for rendering during resizing or window movement on windows platforms
basic example
--------------
This is a basic raylib example, it creates a window and draws the text `"Congrats! You created your first window!"` in the middle of the screen. Check this example [running live on web here](https://www.raylib.com/examples/core/loader.html?name=core_basic_window).

View File

@ -287,8 +287,14 @@ void ToggleBorderlessWindowed(void)
CORE.Window.screen.height = mode->height;
// Set screen position and size
#if defined(_WIN32)
// NOTE: To prevent the fullscreen window from always staying on top, don't pass a monitor at this point.
glfwSetWindowMonitor(platform.handle, NULL, CORE.Window.position.x, CORE.Window.position.y,
CORE.Window.screen.width, CORE.Window.screen.height, mode->refreshRate);
#else
glfwSetWindowMonitor(platform.handle, monitors[monitor], CORE.Window.position.x, CORE.Window.position.y,
CORE.Window.screen.width, CORE.Window.screen.height, mode->refreshRate);
#endif
// Refocus window
glfwFocusWindow(platform.handle);
@ -1024,6 +1030,8 @@ const char *GetMonitorName(int monitor)
// Get window position XY on monitor
Vector2 GetWindowPosition(void)
{
glfwGetWindowPos(platform.handle, &CORE.Window.position.x, &CORE.Window.position.y);
return (Vector2){ (float)CORE.Window.position.x, (float)CORE.Window.position.y };
}

View File

@ -2583,19 +2583,27 @@ const char *GetPrevDirectoryPath(const char *dirPath)
{
static char prevDirPath[MAX_FILEPATH_LENGTH] = { 0 };
memset(prevDirPath, 0, MAX_FILEPATH_LENGTH);
int dirPathLength = (int)strlen(dirPath);
if (dirPathLength <= 3) snprintf(prevDirPath, MAX_FILEPATH_LENGTH, "%s", dirPath);
for (int i = (dirPathLength - 1); (i >= 0) && (dirPathLength > 3); i--)
const int lastIndex = (int)strlen(dirPath) - 1;
bool isFile = IsPathFile(dirPath);
for (int i = lastIndex; i >= 0; i--)
{
// If the character is a path separator.
if ((dirPath[i] == '\\') || (dirPath[i] == '/'))
{
// Check for root: "C:\" or "/"
if (((i == 2) && (dirPath[1] ==':')) || (i == 0)) i++;
// If this character is a leading '/' (e.g. the '/' in "/usr") or
// part of a drive root (e.g. "C:\"), include it with the result.
if ((i == 0) || ((i == 2) && (dirPath[1] == ':'))) i += 1;
// If this character is a trailing path separator (e.g. the last
// '/' in "/usr/bin/" or the last '\' in "C:\raylib\"), continue.
else if (i == lastIndex) continue;
memcpy(prevDirPath, dirPath, i);
break;
if (!isFile)
{
memcpy(prevDirPath, dirPath, i);
break;
}
else isFile = false;
}
}