Commit Graph
749 Commits
Author SHA1 Message Date
Luflosi 628e6cc87f Mark unused parameters in glfw/null_*.c
kitty didn't compile on FreeBSD for me because of unused parameters in glfw/null_joystick.c, so I added the `UNUSED` attribute to them.
I also added `UNUSED` to the unused parameters in glfw/null_monitor.c and glfw/null_window.c as well even though they are probably not used.
2019-09-19 20:21:09 +02:00
Luflosi e619eb9cbb Add more keyboard keys 2019-09-08 12:32:19 +02:00
Luflosi a65ee155c5 Indent lookup table in _glfwGetKeyName() to allow for longer keyboard key names 2019-09-08 12:32:19 +02:00
Luflosi 97e6978ed8 Order keyboard keys by their ASCII value 2019-09-08 12:32:19 +02:00
Luflosi f05eefcc20 Allow adding keys with Unicode names on macOS 2019-09-08 12:32:19 +02:00
Kovid Goyal c398d3d16e Cocoa: Fix glfwSetWindowSize anchor point
This makes glfwSetWindowSize use the top-left corner as anchor point
instead of the bottom-left corner.

Upstream: https://github.com/glfw/glfw/commit/7f02898264d6077738f0e8032f027eb7e252c90e
2019-09-08 09:16:07 +05:30
Kovid Goyal 9dbc54aad6 Fix comparison of video modes of equal area
This fixes the bug of video modes being discarded if they had
a different resolution but the same area as another mode.

Upstream: https://github.com/glfw/glfw/commit/2777f6a754a469eb9b71b4d241ca5f3b1ce5a9b1
2019-09-08 09:12:39 +05:30
James McCoy 34350af61c Only use linux_joystick.c on Linux
Rather than using null_joystick.c when _plat is a bsd, use
linux_joystick.c when _plat is a linux.  This fixes a build issue with
other non-BSD, non-Linux platforms.
2019-09-03 23:02:16 -04:00
Luflosi b3b830bb5f Make adding more printable keys slightly easier
When adding keys after `GLFW_KEY_UNDERSCORE`, one now needs to change a `#define` right below the last printable key instead of changing it elsewhere in the code.
This commit now also marks `GLFW_KEY_PLUS` and `GLFW_KEY_UNDERSCORE` as printable characters.
2019-09-01 11:24:14 +02:00
Luflosi 0459dda5c2 Fix bool indentation
The wrong indentation was caused by the removal of GLFWbool in https://github.com/kovidgoyal/kitty/commit/fe62700825ef4b9bb143b3792797959d85181b29.
2019-08-30 15:32:20 +02:00
Luflosi c0c7cfacc2 Fix NSLog() printing of unicode format strings
See https://stackoverflow.com/questions/720052/nslog-incorrect-encoding.
The `%s` format placeholder for `NSLog()` expects an encoding other than UTF-8, which leads to garbled Unicode characters when trying to print a UTF-8 encoded string.
```Objective-C
NSLog(@"Ä %s %@", "Ä", @("Ä"));
```
prints `Ä √Ñ Ä`.

As can be seen in the example above, the workaround is to convert the UTF-8 encoded C-string to an `NSString` object and print that instead.
`debug_key()` calls `NSLog()`.
2019-08-30 15:03:51 +02:00
Kovid Goyal 90a985b73a Make format_text() more secure 2019-08-28 05:41:20 +05:30
Luflosi 902fc22670 Simplify GLFW compilation code
This commit removes the need for `is_macos` in `glfw/glfw.py` by moving a few lines of code. Instead of relying on the information that the compilation is or isn't happening on macOS, the code now does the right thing based on which `module` is being built.
This changes the order of the compilation flags slightly.
2019-08-26 16:47:19 +02:00
Luflosi 6cc720a350 Fix typos
Inspired by https://github.com/glfw/glfw/pull/1549/commits/4d3ee554b31e734a7c341d4aa5e47d85306f7d74.
Found using `codespell`.
2019-08-26 12:31:15 +02:00
Luflosi 94d56d1a9e Correct indentation for two _glfwInputError() messages
This commit changes the indentation of two error messages to match the indentation in the rest of the code.
2019-08-25 21:29:58 +02:00
Luflosi 06c2263657 macOS: implement drag and drop of text into kitty
Closes #1368.
2019-08-24 01:29:33 +02:00
Luflosi 599be7ddc9 Don't add Apple Frameworks twice
These Frameworks are added again a couple lines below in the check for `module == 'cocoa'`.
2019-08-11 02:26:12 +02:00
Luflosi 28bb123be8 Update the GLFW version number from 3.3 to 3.4
Closes https://github.com/kovidgoyal/kitty/issues/1884.
From https://github.com/glfw/glfw/commit/a337c568486025d22443535b7c047a563bc34373.
2019-08-02 11:00:16 -05:00
Luflosi 5f855ce547 Use context managers to open files
Inspired by https://github.com/kovidgoyal/calibre/commit/d50a6ddc1b71a575283e344a0d7bc539539bc5d1.
2019-08-01 13:21:26 -05:00
Kovid Goyal 9cbb726566 Fix #1865 2019-07-30 06:20:54 +05:30
Kovid Goyal d218900b57 Remove unused header 2019-07-29 09:45:02 +05:30
Kovid Goyal cab949a939 Fix building with compilers that dont support __has_include 2019-07-29 09:44:05 +05:30
Luflosi 464a6c1441 Fix indentation of bool variables in glfw/egl_context.h
Caused by https://github.com/kovidgoyal/kitty/commit/fe62700825ef4b9bb143b3792797959d85181b29.
2019-07-28 00:23:17 -05:00
Luflosi b8d2b76ee4 Reduce the difference of glfw to upstream 2019-07-28 00:10:50 -05:00
Luflosi 922bc62e0e GLFW: Fix invalid ranges for gamepad axis sources
From https://github.com/glfw/glfw/commit/9420e6f0d090f2f3fe61f71d5e05220f5245c861.
2019-07-26 13:30:38 -05:00
Luflosi 61df266df7 Fix indentation of bool variables in glfw/internal.h
Caused by https://github.com/kovidgoyal/kitty/commit/fe62700825ef4b9bb143b3792797959d85181b29.
2019-07-26 11:45:32 -05:00
Luflosi 961b2c9b65 GLFW: Documentation work
From https://github.com/glfw/glfw/commit/3cf7645b96c593d74f089069ac2e1c67938efd7f.
2019-07-25 23:07:00 -05:00
Luflosi cdbe2f13ca Cocoa: Move slightly towards modern Objective-C
Inspired by https://github.com/glfw/glfw/commit/9a9568212c2dfd17fe46845eaa68ec0731de6173.
2019-07-25 17:14:32 -05:00
Kovid Goyal d9f90ef077 Make qsort invocations type independent 2019-07-23 10:20:41 +05:30
Luflosi c02ba03f39 Remove glfw/wgl_context.c and glfw/wgl_context.h 2019-07-21 15:03:39 -05:00
Luflosi 1590c59131 Fix assertion for glfwSetGamma value
From https://github.com/glfw/glfw/commit/751c6f9a2792bfc0c09cd381293db21c5a15a9ed.
2019-07-20 23:17:58 -05:00
Luflosi 489f3e6c9d Add C dialect reminders to each glfw source file
Reduces the difference to upstream.
From https://github.com/glfw/glfw/commit/56aad76b164be741af21688ea3832093c2069cef.
2019-07-20 21:07:27 -05:00
Kovid Goyal 5fef4726a7 Cocoa: Fix file-local function not declared static
From upstream: https://github.com/glfw/glfw/commit/062a1c22b5e346b63fe8dfc09b63f1a57991461a
2019-07-20 19:12:21 +05:30
Kovid Goyal 51fdb8200a X11: Fix focus events not being filtered
From upstream: https://github.com/glfw/glfw/commit/c6b95e3b07b9c20d9adae2ddebf69706540180de
2019-07-20 19:11:00 +05:30
Kovid Goyal fb0d98ead1 Add more debugs to Wayland handleEvents() 2019-07-20 14:48:28 +05:30
Kovid Goyal 4096caba64 Cancel read if dispatch_pending fails 2019-07-20 14:32:57 +05:30
Kovid Goyal 38f77144fa Wayland: dont abort the event handler early if there are no pending events from the compositor. This ensures that the tick callback and other event sources are dispatched. 2019-07-20 14:09:09 +05:30
Kovid Goyal b8041ce17f Wayland: Fix infinite loop if the compositor dies 2019-07-20 13:55:38 +05:30
Luflosi bdc4558a43 Update GLFW copyright years
Reduces the difference to upstream.
From https://github.com/glfw/glfw/commit/ab118b2529a8da3e6b5f847b80ee86bb8c6bf6bb.
2019-07-20 00:30:13 -05:00
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 f5cf6c1dcb Also make the loop flags volatile 2019-07-17 19:55:19 +05:30
Kovid Goyal 89307727e7 Use atomic variables for main loop flags 2019-07-17 19:45:52 +05:30
Kovid Goyal 8244f7cd58 Linux: Only process global state when something interesting happens
This matches behavior on macOS. Had initially set the code to process
on every loop tick in an attmept to workaround the issue of the event
loop freezing on X11 until an X event is delivered. However, in light
of #1782 that workaround was incorrect anyway. Better to have similar
behavior across platforms. This also has the advantage of reducing CPU
consumption.

Also add a simple program to test event loop wakeups.
2019-07-15 21:30:00 +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 f8418d68a6 Fully drain the wakeupfd 2019-07-09 18:49:46 +05:30
Kovid Goyal c0000fb24e Should use an unsigned int for eventfd 2019-07-09 18:42:17 +05:30
Kovid Goyal c169f7ae83 Retry writing to wakeupfd on EAGAIN as well 2019-07-09 18:40:51 +05:30
Kovid Goyal 7e36489034 Dont call detect joysticks if support for them has been disabled 2019-07-08 11:18:00 +05:30
Kovid Goyal d259b12ae7 Micro-optimization: Avoid repeated calls to XQLength 2019-07-08 11:05:04 +05:30
Kovid Goyal e7173f8145 Linux: Fix a regression in 0.14.0 that caused the event loop to tick continuously, wasting CPU even when idle
Fixes #1782
2019-07-07 05:57:18 +05:30