Commit Graph

46 Commits

Author SHA1 Message Date
Kovid Goyal
caba27240b Add some missing assertions
Port from upstream glfw: 38ec7abd3baffdd3ec4e6f8cbb5384cda8882ae3
2025-08-16 07:38:54 +05:30
Kovid Goyal
c0f04231ed Move CVDisplayLink code into its own module
Apple has deprecated CVDisplayLink in favor of CADisplayLink which has
different semantics. So turn off deprecation warnings for
CVDisplayLink related code only until I can be bothered to port it to
CADisplayLink.
2024-09-27 12:12:12 +05:30
Kovid Goyal
271665dbaf Temporary workaround for CVDisplayLink deprecation
Apple simply cannot get its APIs right on the first try, ever.
2024-09-26 01:13:10 +05:30
Kovid Goyal
bddc552433 ... 2024-04-04 10:40:09 +05:30
Kovid Goyal
b76e94059d Propagate failures to get video mode 2024-04-04 10:31:30 +05:30
Derek Schrock
3b57acf03c More cases of #5477 functions with empty argument lists
Building on macOS 13.3.1 (22E261) clang 14.0.3 (clang-1403.0.22.14.1)
running to errors like #5477 where functions without argument lists at
least need void.

Looking for possible suspect functions via:

  git grep -E "^([A-Za-z_]+ )?[A-Za-z_]+\()" \*.c \*.m
2023-04-16 01:09:36 -04:00
Kovid Goyal
99d06f0714 See if 0 makes Apple happy 2021-12-15 13:14:02 +05:30
Kovid Goyal
e973c45968 Fix build on XCode 13.1
Apple go on making it harder and harder to support multiple
versions of their pathetic operating system in one code base.

kIOMainPortDefault is the "non-deprecated" replacement for
kIOMasterPortDefault. However, it is now marked as being available only
on macOS 12 and later so it refuses to build in a codebase designed to
run on earlier versions of macOS. Le bubbling sigh.

According to https://developer.apple.com/documentation/iokit/kiomasterportdefault?language=objc
passing NULL has the same effect and avoids the stupid warning.
Hopefully this will work till Apple decides to spend their trillion
dollars doing more stupid shit.
2021-12-15 12:57:46 +05:30
Kovid Goyal
ade4e67b51 Possible fix for #3890
Try to ensure we have a functioning displaylink always.
GLFW skips over sleeping monitors during a poll and also
had a bug where the display link was not re-created for a monitor
that already had a glfw monitor entry.

Also add a bunch more debug reporting
2021-08-01 12:53:35 +05:30
Danilo Horta
890181172f Fix "Cocoa: Failed to find service port...". 2021-07-28 00:39:50 +01:00
Kovid Goyal
219bf564f7 Fix #3719 2021-06-13 09:07:08 +05:30
Kovid Goyal
e4b4a35375 macOS: Fix rendering getting stuck on some machines after sleep/screensaver
This is caused, as far as I can tell, by CVDisplayLink getting stuck.
Apple apparently are incapable of writing a simple timer robustly.
So if it remains stuck after a second delete and recreate it to force it
to restart.

Fixes #2016
2021-05-12 07:30:17 +05:30
Kovid Goyal
0fc93118f2 Make the error message when failing to get monitor display name more informative 2021-01-29 12:45:22 +05:30
Kovid Goyal
68423b3603 Fix compiler warning on newer Xcode
Fixes #3271
2021-01-29 11:29:29 +05:30
Luflosi
0edfa88755 Reduce the difference of GLFW to upstream 2020-10-04 17:34:51 +02:00
Luflosi
6b3f774f05 GLFW: Cocoa: Fix potential leak of CFNumber object
From upstream: a2674a9034.
2020-07-24 10:59:04 +02:00
Luflosi
803fba9cfd Cocoa: Replace display link with IOKit query
From upstream: 4ec7daf3e9.
2020-05-23 16:28:31 +02:00
Luflosi
e725c647ef Cocoa: Only create per-monitor display link once
From upstream: b4a8eb9b19.
2020-01-02 18:05:38 +01:00
Luflosi
c05cbed5b2 Reduce difference to GLFW upstream 2019-11-23 13:19:06 +01:00
Kovid Goyal
46d49e18c0 More macOS float fixes 2019-09-27 20:07:09 +05:30
Luflosi
28bb123be8 Update the GLFW version number from 3.3 to 3.4
Closes https://github.com/kovidgoyal/kitty/issues/1884.
From a337c56848.
2019-08-02 11:00:16 -05:00
Luflosi
489f3e6c9d Add C dialect reminders to each glfw source file
Reduces the difference to upstream.
From 56aad76b16.
2019-07-20 21:07:27 -05:00
Kovid Goyal
5fef4726a7 Cocoa: Fix file-local function not declared static
From upstream: 062a1c22b5
2019-07-20 19:12:21 +05:30
Luflosi
bdc4558a43 Update GLFW copyright years
Reduces the difference to upstream.
From ab118b2529.
2019-07-20 00:30:13 -05:00
Kovid Goyal
39f6071c68 macOS: Fix a deadlock with CVDisplayLink
I had added an optimization to not pass messages to
main thread every time the CVDisplayLink timer fired, unless
a render frame for that monitor was actually requested.

However, this optimization is impossible to implement wihtout a deadlock
since CVDisplayLink has its own internal lock that it does not expose.

So I guess macOS users with multiple monitors will simply have to take
the performance hit of useless wakeups sixty times a second for every
extra monitor.

Fixes #1779
2019-07-05 20:16:32 +05:30
Kovid Goyal
841c907efc Build glfw with all warnings enabled 2019-07-01 10:42:07 +05:30
Kovid Goyal
9bc288cd8e ... 2019-07-01 08:49:18 +05:30
Kovid Goyal
2ef0391b08 Convert some declarations to C99 style
From upstream: 0c6b505619
2019-07-01 08:32:47 +05:30
Kovid Goyal
86305fdeb3 Use CVDisplayLinkIsRunning() rather than tracking started state since the OS can apparently shutdown the thread on its own in some scenarios 2019-06-28 17:46:59 +05:30
Luflosi
8ffc841a3a Reduce the difference of glfw/cocoa_* to upstream
This only changes some formatting, whitespace, etc.. There are no
changes to the functionality.
Let me know if you don't like some of those changes.
2019-06-21 15:53:26 +02:00
Kovid Goyal
47acc9ff2f Get rid of GLFW_(TRUE|FALSE) 2019-06-08 08:14:30 +05:30
Kovid Goyal
fe62700825 Get rid of GLFWbool 2019-06-08 08:12:42 +05:30
Luflosi
fbc4d3e1be Remove extra spaces 2019-06-08 00:48:09 +02:00
Kovid Goyal
abf9c4117d macOS: Fix a regression that could cause rendering of a kitty window to occasionally freeze in certain situations, such as moving it between monitors or transitioning from/to fullscreen
Fixes #1641
2019-05-28 17:54:34 +05:30
Kovid Goyal
b3f1acd400 Cocoa: Fix coordinate transformations
From upstream: 3c3981a4f0
2019-04-18 10:12:41 +05:30
Kovid Goyal
fcb26e5dc7 Cocoa: User performSelectorOnMainLoop for render frames as well which means render frames work during modal loops 2019-03-21 16:51:01 +05:30
Kovid Goyal
4c4c6ab0e6 Various fixes for monitor work area retrieval from upstream 2019-03-06 09:08:08 +05:30
Kovid Goyal
0899019518 Add glfwGetMonitorWorkarea
From upstream: be295ccbea
2019-03-06 08:47:01 +05:30
Kovid Goyal
aa2b21456f Round refresh rate instead of truncating
From upstream: 621ece63c8
2019-03-06 08:36:59 +05:30
Kovid Goyal
f0a2c34eca Port cocoa backed to use glfw mainloop 2019-03-04 19:52:46 +05:30
Kovid Goyal
4629ef627f GLFW: Add support for render frames on Cocoa (CVDisplayLink)
Allows vsync to work again since Apple broke OpenGL swap intervals on
Mojave
2019-02-20 15:08:07 +05:30
Kovid Goyal
a1eb236616 Fix glfwGetGammaRamp error handling
751c6f9a27
2018-12-28 08:13:28 +05:30
Kovid Goyal
1edf1524f8 Update bundled glfw 2018-03-03 11:21:09 +05:30
Kovid Goyal
77d46630d7 Update bundled glfw 2018-02-08 09:15:40 +05:30
Kovid Goyal
6ad21fc98f Update bundled glfw 2018-01-29 12:30:05 +05:30
Kovid Goyal
9307486254 Initial import of glfw 2017-12-01 12:15:36 +05:30