Commit Graph
98 Commits
Author SHA1 Message Date
Kovid Goyal 1cb15dedac Simplify the event loop code
Also reduce input latency by ignoring repaint_delay when
there is actual pending input.

Gets rid of request_tick_callback(). Now empty events
result in the tick callback being called so there is only a
single mechanism for waking up the main loop and getting
the tick callback called.
2019-07-18 15:51:54 +05:30
Kovid Goyal eb30ba7722 Cocoa: Fix code to shutdown display link for inactive monitors 2019-07-11 22:34:28 +05:30
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 4b77530c65 Store a reference to the glfw window pointer in the NSWindow class as well 2019-07-04 09:56:59 +05:30
Kovid Goyal c9a574a764 Cocoa: Ensure no callbacks are called on the view even if it is retained after being released
Fixes #1761 (I hope)
2019-07-04 09:03:13 +05:30
Kovid Goyal 841c907efc Build glfw with all warnings enabled 2019-07-01 10:42:07 +05:30
Kovid Goyal 2ef0391b08 Convert some declarations to C99 style
From upstream: https://github.com/glfw/glfw/commit/0c6b5056196a409e6aac244c983244211abf13b1
2019-07-01 08:32:47 +05:30
Kovid Goyal 9b080950a9 Cocoa: Cleanup
This makes the Cocoa _glfwPlatformSetWindowMonitor consistent with its
X11 and Win32 counterparts.

From upstream: https://github.com/glfw/glfw/commit/3262c29440428348e33b746c4783d783b2825228
2019-07-01 05:59:32 +05:30
Kovid Goyal 75d697fa97 Fix #1766 2019-06-30 16:07:45 +05:30
Kovid Goyal 8c9d2d3ca2 macOS: Reduce energy consumption when idle by shutting down Apple's display link thread after 30 second of inactivity
Fixes #1763
2019-06-29 14:21: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
Kovid Goyal d262f43b5b Log ARepeat property 2019-05-28 20:18:50 +05:30
Kovid Goyal 73224e7d95 One less line in the debug log 2019-05-28 20:04:21 +05:30
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 a51239c6ae Add support for the underscore key found in some keyboard layouts
Fixes #1639
2019-05-24 17:59:50 +05:30
Luflosi 05f01525c3 Revert "macOS: Fix cocoa mouse y-coord off by one"
This reverts commit 8969206450.
Fixes #1621.
When committing b3f1acd400, applying the glfw upstream patch https://github.com/glfw/glfw/commit/3c3981a4f00cdee0f20be6866305715a29b94125 for https://github.com/glfw/glfw/issues/1461, this commit should have been reverted as it was just a quick fix for https://github.com/glfw/glfw/issues/1461.
2019-05-21 19:31:57 +02:00
Kovid Goyal 3e964163c0 Pass zero for fullscreen flags on non Cocoa platforms 2019-05-12 16:07:54 +05:30
Kovid Goyal 1fa9b8f102 X11: use the window manager's native full-screen implementation when making windows full-screen
This matches the behavior on Cocoa and Wayland.
Fixes #1605
2019-05-12 15:53:06 +05:30
Kovid Goyal 268e5cef3b Remove useless else 2019-05-03 13:37:57 +05:30
Kovid Goyal f0c663d42d macOS: Improve handling of IME extended input
Compose characters are now highlighted and the IME panel moves along with the text

Fixes #1586
Fixes #1461
2019-05-03 13:30:56 +05:30
BlahGeek e36e44ab3a macOS: do not pass input events while having marked text
fix chinese input method backspacing issue

macOS: Set pre-edit text for IME

macOS: implement glfwPlatformUpdateIMEState

set firstRectForCharacterRange correctly

macOS: update IME position on each input

macOS: use float instead of int for updateIMEState

minor fix

macOS: ignore marked text on deadkey

fixes german keyboard input

macOS: convert markedRect to screen coord
2019-05-03 13:27:06 +05:30
Kovid Goyal b3f1acd400 Cocoa: Fix coordinate transformations
From upstream: https://github.com/glfw/glfw/commit/3c3981a4f00cdee0f20be6866305715a29b94125
2019-04-18 10:12:41 +05:30
Kovid Goyal 5c4462281e Cocoa: Upstream fix for mouse hover detection
https://github.com/glfw/glfw/commit/0e74265426591a9b1e61deef224f920e3b54fd01
2019-04-18 09:58:09 +05:30
Kovid Goyal 8969206450 macOS: Fix cocoa mouse y-coord off by one
See https://github.com/glfw/glfw/issues/1461
2019-04-09 22:02:36 +05:30
Kovid Goyal 8251b906b6 Add a listener for GPU changed events on macOS
Currently does nothing, but could potentially be used to fix:
https://github.com/kovidgoyal/kitty/issues/794

Will need someone with the hardware though to test
exactly what needs to be done to restore the custom cursor image.
2019-04-06 10:05:21 +05:30
Kovid Goyal b10312e249 Upstream fixes for vulkan surface creation and the retina hint
https://github.com/glfw/glfw/commit/e108c0de0d531123b560931c07c5a226e7d7a3da
https://github.com/glfw/glfw/commit/980fc9b52f397ec54ce65f69abe9ff694622b4ab
2019-03-28 13:09:22 +05:30
Kovid Goyal c4e89d9d0c macOS: Consolidate compatibility macros for old SDKs in one place 2019-03-28 12:37:05 +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 0dc6ac26c3 Cocoa: user performSelectorOnMainThread instead of postEvent for the tick callback
performSelectorOnMainThread runs in more loop run modes which means that
the tick callback will behave more like it does on other platforms,
during window resizes and other modal event loops.
2019-03-21 15:55:43 +05:30
Kovid Goyal 5ab8a665be GLFW: Add more standard cursor shapes
Also use an enum for the cursor shapes
2019-03-21 13:06:13 +05:30
Kovid Goyal 7ab63525c7 Dont use a global autorelease variable
Use function local @autorelease blocks instead
2019-03-06 09:34:55 +05:30
Kovid Goyal a1c49a0f7f Cocoa: Disable shadow for transparent framebuffer
From upstream: https://github.com/glfw/glfw/commit/9883cb64f0d55770bf09d2a79f044ba2049ea3e2
2019-03-06 09:12:16 +05:30
Kovid Goyal 4c4c6ab0e6 Various fixes for monitor work area retrieval from upstream 2019-03-06 09:08:08 +05:30
Kovid Goyal 3bd1ca0ac3 Avoid using timing related hacks to detect the end of a live resize on macOS
Since cocoa provides start/end notifications for live resizing, rely on
those instead.
2019-03-04 19:52:46 +05:30
Kovid Goyal f0a2c34eca Port cocoa backed to use glfw mainloop 2019-03-04 19:52:46 +05:30
Kovid Goyal a1e9b854e3 Move cocoa custom even dispatching into the application object
This allows it to work even with the cocoa run loop
2019-02-25 15:51:39 +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 dcb2d95f9a GLFW: Add support for window occluded notifications on macOS
Based on: https://github.com/glfw/glfw/pull/1123
2019-02-18 10:03:21 +05:30
Kovid Goyal 23482e3cf4 macOS: Allow assigning only the left or right :kbd:Option key to work as the :kbd:Alt key. See :opt:macos_option_as_alt for details
Fixes #1022
2019-02-14 20:39:32 +05:30
Kovid Goyal b40ca5800d macOS: Fix using multi-key sequences to input text ignoring the first few key presses if the sequence is aborted
Fixes #1311
2019-02-14 15:10:13 +05:30
Kovid Goyal 3b25081353 Print out current text when ignoring dead keys 2019-02-14 14:56:06 +05:30
Kovid Goyal cb7eb48768 Cleanup
From upstream: https://github.com/glfw/glfw/commit/d5ab3e919a4f163f4010f7112a9cf1bdcd80f805
2019-02-03 20:04:54 +05:30
Kovid Goyal 419b078104 Remove duplicate centerCursor function
From upstream: https://github.com/glfw/glfw/commit/a46104ee69360ee73d59cfd397a7f1b23d751b77
2019-02-03 19:56:16 +05:30
Kovid Goyal 84caf787aa macOS: Workaround for cocoa bug that could cause the mouse cursor to become hidden in other applications in rare circumstances
Use window focus gained/lost events instead of mouse enter/exit events
to hide/show the mouse cursor.

Fixes #1218
2019-02-03 08:58:16 +05:30
Luflosi e47e2b2560 Move check for zero scroll distance to scroll_event() 2018-12-27 15:17:18 +01:00
Luflosi 7652065134 Add more momentum scroll phases 2018-12-27 15:12:57 +01:00
Kovid Goyal fe67e3dde7 Cocoa: Remove subclassing of NSApplication
From upstream: https://github.com/glfw/glfw/commit/88c5edb40925bc0c987e8cfc7d306174f8094453
2018-12-26 12:29:38 +05:30