Commit graph raylib/src/platforms
Author SHA1 Message Date
SuperUserNameMan
79316b2da9
typos 2024-07-22 18:14:24 +02:00
SuperUserNameMan
2ffca57629
GetWindowScaleDPI() return {1,1} if HDPI or fullscreen modes 2024-07-22 17:45:08 +02:00
SuperUserNameMan
19020153ca
rcore_desktop_glfw.c : disable FLAG_WINDOW_HIGHDPI on Wayland
If Ubuntu is not mistaking me, on Wayland `FLAG_WINDOW_HIHDPI` could just be ignored because the window decorator (or whatever subsystem in charge) already rescale the window and its content according to the display scale.
2024-07-22 17:09:42 +02:00
SuperUserNameMan
1a7657ebd0
rcore_desktop_glfw.c : SetWindowMonitor() workaround for Wayland
According to my understanding of current GLFW version, on Wayland, the only way to move the windowed window from one monitor to another is to toggle it to fullscreen twice (since only a fullscreen window can be moved to another monitor by code).
2024-07-22 16:06:32 +02:00
SuperUserNameMan
c5f90a5edd
rcore_desktop_glfw.c : improved Wayland support 2024-07-22 15:35:26 +02:00
SuperUserNameMan
9fb406ac1a
rcore_desktop_glfw.c - Wayland compatibility
Because Wayland does not let know or set the position of a window, it broke some basic Raylib's features and functions. I tried to find a balance between crossplatform compatibilities, and the Wayland way of doing things. So, on Wayland, `SetWindowMonitor()` won't move a windowed window from a monitor to another, but can be used to select on which monitor the user wants the hardware fullscreen mode.
2024-07-21 16:01:58 +02:00
SuperUserNameMan
04138459f0
invalid window size default to 3/4 of the display 2024-07-21 09:54:27 +02:00
SuperUserNameMan
b2c9c5ef88
make SetWindowMonitor() works with FLAG_BORDERLESS_WINDOWED 2024-07-20 15:48:40 +02:00
SuperUserNameMan
05b172008f
GLFW : Wayland don't support setting or getting window pos
Using `glfwGetWindowPos()` or `glfwSetWindowPos()` trigger errors that should be cleared with `glGetError(NULL)` to avoid misinterpretation of later use of `glGetError()`
2024-07-20 15:23:54 +02:00
SuperUserNameMan
a2ccd820e5
CodeQL bot : Variable result hides another variable of the same name (on ). 2024-07-17 18:47:50 +02:00
SuperUserNameMan
2d225145d7
Merge branch 'raysan5:master' into fix-ToggleBorderlessWindowed 2024-07-17 18:24:00 +02:00
SuperUserNameMan
a2d1e66ec4
Update rcore_desktop_glfw.c : replace old PR with new branch PR 2024-07-17 18:10:15 +02:00
MrScautHD
576bee5cce
Adding GetKeyName(int key) (WIP) (#4161) 2024-07-16 14:00:00 +02:00
SuperUserNameMan
dc4c60bf62
detect Wayland special case at runtime 2024-07-15 18:42:45 +02:00
SuperUserNameMan
312f9c2cb7
disable GLFW_AUTO_ICONIFY for all fullscreen modes
If the user requires this feature, they can replicate the behavior on their code side using a simple : `if ( ! IsWindowFocused() ) MinimizeWindow();`
2024-07-15 14:49:02 +02:00
SuperUserNameMan
32e9d882d7
InitPlatform() set GLFW_SCALE_FRAMEBUFFER to false by default 2024-07-13 10:45:16 +02:00
SuperUserNameMan
1b800a14eb
explicit focus request in ToggleFullscreen()
fix issue mentioned by @paulmelis ?
2024-07-12 13:09:38 +02:00
SuperUserNameMan
b004531efb
immediate access to GetScreenWidth/Height(), GetRenderWidth/Height()
Call `WindowSizeCallback()` manually so we don't have to wait for after the next `EndDrawing()` to have access to up to date `GetScreenWidth()` etc value.
2024-07-11 19:02:47 +02:00
SuperUserNameMan
545665da87
toggle currently active fullscreen mode and leave
Trying to go straight forward from one fullscreen mode to another make things more complicated to control. 
Seems a full loop is required when trying to change fullscreen modes and window size properly for now.
Maybe will restore the ability to jump from one fullscreen mode to another when more cleaning will be done deeper in the rabbit hole.
2024-07-11 18:36:56 +02:00
SuperUserNameMan
a76adf9a48
little ToggleFullscreen() cleanup 2024-07-11 18:14:12 +02:00
SuperUserNameMan
21bff481ff
comment clarification 2024-07-11 17:53:08 +02:00
SuperUserNameMan
7ddb880f02
should fix all issues related to HDPI, fullscreen and bordeless
Work perfect on Linux wirth X11
Needs confirmation on Linux Wayland, MacOS, and Windows.
2024-07-10 17:13:17 +02:00
SuperUserNameMan
3f605e3143
some code style convention and we should be good 2024-07-10 12:02:40 +02:00
SuperUserNameMan
949aa21a7a
should fix ToggleBorderlessWindowed() on Linux and Macos
should fix issue #4149

Linux MATE : tested
Macos : tested

Windows : need confirmation

---

thanks to @SoloByte and to @paulmelis for their help and efforts to solve this issue
2024-07-10 11:48:09 +02:00
SuperUserNameMan
174313acbf
WindowSizeCallback() should not try to handle DPI since already managed by GLFW (#4143)
If `FLAG_WINDOW_HIGHDPI` is set, `InitPlatform()` will aks GLFW to handle resize window content area based on the monitor content scale using : ` glfwWindowHint(GLFW_SCALE_TO_MONITOR, GLFW_TRUE); `

So `WindowSizeCallback()` does not have to handle it a second time.
2024-07-09 09:23:14 +02:00
Ray
fa03246d0e REVIEWED: Code formatting to follow raylib conventions 2024-07-09 09:21:57 +02:00
Colleague Riley
98662b6a4a
update RGFW to RGFW 1.0 (#4144)
* update RGFW

* fix bug with GetCurrentMonitor
2024-07-09 09:12:03 +02:00
Ray
3abe728712 Minor tweaks 2024-07-08 22:54:19 +02:00
NishiOwO
598b7f5210
Add workaround for NetBSD (#4139) 2024-07-08 22:47:35 +02:00
Frank Kartheuser
8fbb447a6d
Change SDL_Joystick to SDL_GameController (#4129)
With SDL_Joystick my game controller wasn't working properly. That's why I changed it to SDL_GameController.
2024-07-04 00:01:40 +02:00
Ray
d243094ede WARNING: BREAKING: Renamed PLATFORM_DESKTOP to PLATFORM_DESKTOP_GLFW
This could potentially be a breaking change, for consistency, now every possible desktop backend has the proper name assigned: GLFW, SDL, RGFW
raylib build system has been reviewed to fallback to `PLATFORM_DESKTOP_GLFW` by default when `PLATFORM_DESKTOP` defined
2024-07-01 18:28:44 +02:00
Ray
61cfd1afcb Minor tweaks 2024-07-01 13:05:20 +02:00
Ray
c8313d9ebc Update Storage base path, use provided SDL base path 2024-07-01 11:44:20 +02:00
Ray
1e1061d5c7 REVIEWED: Formatting, follow raylib coding conventions 2024-06-30 11:37:58 +02:00
Ray
17cbc75aa7 REVIEWED: Formatting, follow raylib coding conventions 2024-06-30 11:07:38 +02:00
Colleague Riley
84971d81f3
Update RGFW and replace long switch in rcore_desktop_rgfw.c with a lookup table (#4108)
* Fix Makefile issues (RGFW) (linux) (macOS)

* Do not use nanosleep on windows at all (PLATFORM_DESKTOP_RGFW)

* remove #define RGFWDEF and make the #undefs only happen for their OS

* Update RGFW.h

* fix to match the RGFW updates

* remove line that shows the cursor for no reason

* Update RGFW, replace long switch with an array, update rgfw platform for RGFW

* update RGFW (fix reported glitch with drag and drop files) (linux)

* remove u16
2024-06-28 09:55:14 +02:00
Anthony Carbajal
52f2a10db6
fixed issue with GetScreenWidth/GetScreenHeight (#4074) 2024-06-17 13:42:53 +02:00
Colleague Riley
8c712f82d1
Update RGFW (#4048)
* Fix Makefile issues (RGFW) (linux) (macOS)

* Do not use nanosleep on windows at all (PLATFORM_DESKTOP_RGFW)

* remove #define RGFWDEF and make the #undefs only happen for their OS

* Update RGFW.h

* fix to match the RGFW updates

* remove line that shows the cursor for no reason
2024-06-08 22:26:46 +02:00
Ray
5767c4cd05 Update rcore_desktop.c 2024-06-04 23:00:12 +02:00
Ray
b212750b85 Update rcore_desktop_sdl.c 2024-05-21 20:53:51 +02:00
JupiterRider
c7f098f4d2
Call SDL_GL_SetSwapInterval() after GL context creation (#3997) 2024-05-21 20:48:48 +02:00
Cemal Gönültaş
1d52985943
[rcore_web] Relative mouse mode issues. (#3940)
* [rcore_web] Relative mouse mode issues.

* Review formatting.
2024-05-16 12:01:27 +02:00
Colleague Riley
f62202198e
remove #define RGFWDEF and make the #undefs only happen for their OS (RGFW) (#3971)
* Fix Makefile issues (RGFW) (linux) (macOS)

* Do not use nanosleep on windows at all (PLATFORM_DESKTOP_RGFW)

* remove #define RGFWDEF and make the #undefs only happen for their OS
2024-05-10 21:09:22 +02:00
Colleague Riley
9805fe0b1a
make RGFW a custom platform (#3941)
* fix minor bugs and errors (x86) for the RGFW platform, update RGFW platform license, update makefile info for RGFW platform

* revert

* (RGFW) (winapi) fix mouse hide bug when cursor changes

* ensure PLATFORM_SHELL is defined (PLATFORM_RGFW)

---------

Co-authored-by: ColleagueRiley <ColleagueRiley@gmail.com>
2024-05-07 20:30:52 +02:00
gabriel-marques
fa2b1c8f09
Implementing GetMonitorWidth/Height for DRM (#3956)
* Implementing GetMonitorWidth/Height and GetMonitorPhysicalWidth/Height for drm

Added implementation for DRM for functions :
 - GetMonitorWidth()
 - GetMonitorHeight()
 - GetMonitorPhysicalWidth()
 - GetMonitorPhysicalHeight()
 - GetMonnitorName()

These functions take an argument but only the value 0 is accepted. This is because the DRM platform implementation manages only one screen for now

* Refactor "GetMonitor" properties for DRM Platform

Refactored GetMonitorHeight, GetMonitorWidth, GetMonitorPhysicalHeight,
GetMonitorPhysicalWidth and GetMonitorName to accept only argument "0"
as more than one screen is not supported in DRM platform.
2024-05-07 10:33:56 +02:00
Christian Haas
3d9aafed3b
[rcore_desktop] Fix 3693 initial window geometry (#3950)
* Rework window placement and dimensions for multi-monitor setups;

- fullscreen apps use primary monitor, exclusively
- non-fullscreen apps come in two variants:
a) pre-determined window size by user
b) use-active-monitor dimensions by user specifying 0x0
Either way, the window shall be centred at the monitor where it was created

This may have been the original intent, yet the primary monitor was used also for the second case, regardless where the window opened.

* Clean up code, handle error, fix integer-overflow for centering windowed fullscreen
2024-05-05 20:22:58 +02:00
Ray
3caa424ad4 Review formatting 2024-04-21 12:29:09 +02:00
Rafael Bordoni
88f7762921
Fix window not initializing on primary monitor on GLFW backend (#3923)
The way the current code worked was by calling `GetCurrentMonitor()`,
which would always return the monitor at position (0,0). This isn't the
primary monitor on all platforms, on Linux in particular it isn't the
case.

This isn't the case on the SDL backend, after calling `InitWindow()` the
window would always show up on the primary monitor. Even on the GLFW
backend, if the full screen flag was set it would attempt to put it on
the primary monitor as it would call `glfwGetPrimaryMonitor()` to do it,
so for consistency's sake we should do it on windowed mode too.
2024-04-19 15:17:22 +02:00
Arthur
e42f9263b8
Fix GetKeyPressed for PLATFORM_DESKTOP_SDL (#3869)
The key handling in PLATFORM_DESKTOP_SDL was faulty in two ways, which
led to GetKeyPressed returning incorrect data.

CORE.Input.Keyboard.keyPressedQueue was updated only on SDL_TEXTINPUT,
meaning only text characters were registered as a pressed key, but not
function keys (eg. tab, backspace...). Also on such event, both
CORE.Input.Keyboard.keyPressedQueue and
CORE.Input.Keyboard.charPressedQueue were assigned the key's
corresponding codepoint, when CORE.Input.Keyboard.keyPressedQueue
should get the raylib keycode instead.

CORE.Input.Keyboard.keyPressedQueue is now updated on SDL_KEYDOWN event
instead.

Co-authored-by: Arthur <hi@thenightwat.ch>
2024-04-15 23:09:20 +02:00
Aria
a1f5e34d81
Update rcore_android.c (#3910)
add gamepad previous button state tracking to Android
2024-04-10 10:34:05 +02:00