Compare commits

...

65 Commits

Author SHA1 Message Date
Kovid Goyal
350cfeb7ef version 0.14.6 2019-09-25 11:28:55 +05:30
Kovid Goyal
97d379b13e Add changelog entry for DPI change PR 2019-09-25 06:34:55 +05:30
Kovid Goyal
2154d555e5 Merge branch 'update_check_interval_constant' of https://github.com/Luflosi/kitty 2019-09-25 06:23:05 +05:30
Luflosi
1389c36657 Use the update CHECK_INTERVAL constant 2019-09-25 02:46:19 +02:00
Kovid Goyal
bd1e7d6942 Merge branch 'master' of https://github.com/dcolascione/kitty 2019-09-25 05:56:17 +05:30
Daniel Colascione
91299a279b Fix window resize on DPI change 2019-09-24 12:41:23 -07:00
Kovid Goyal
fb1c318a09 macOS: Fix a regression in the previous release that caused a crash when pressing a unprintable key, such as the POWER key
Fixes #1997
2019-09-24 16:07:52 +05:30
Kovid Goyal
2a07b3f46a Fix #1995 2019-09-24 06:40:21 +05:30
Kovid Goyal
ffc4e99717 version 0.14.5 2019-09-23 08:41:38 +05:30
Kovid Goyal
fe807dd66f Fix missing parameter name in docs 2019-09-22 19:39:22 +05:30
Kovid Goyal
40ce5db812 Add completion for listen on 2019-09-22 16:08:37 +05:30
Kovid Goyal
649a9f4a6f oops 2019-09-22 16:01:33 +05:30
Kovid Goyal
e17ce875be Complete more CLI args 2019-09-22 16:01:12 +05:30
Kovid Goyal
415701c58a Add completion of filenames for --config 2019-09-22 15:52:45 +05:30
Kovid Goyal
f16f80b459 Merge branch 'glfw_null_unused_params' of https://github.com/Luflosi/kitty 2019-09-20 06:27:13 +05:30
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
Kovid Goyal
8f9a225c3a Use selection foreground color for underlines as well
Fixes #1982
2019-09-19 19:28:33 +05:30
Kovid Goyal
7b41bc95e1 Merge branch 'move_allocation_failure_check' of https://github.com/Luflosi/kitty 2019-09-19 18:45:42 +05:30
Luflosi
2d06ee5822 Move allocation failure check closer to allocation 2019-09-19 14:58:39 +02:00
Kovid Goyal
40b4fb966f Merge branch 'add_missing_key_name_aliases' of https://github.com/Luflosi/kitty 2019-09-19 05:53:42 +05:30
Luflosi
be696a9d76 Add missing keys to key_name_aliases 2019-09-18 19:36:56 +02:00
Luflosi
1ffe9bef35 Order key_name_aliases by their ASCII value 2019-09-18 16:23:38 +02:00
Luflosi
ed70d95c44 Move aliases for common key name variations to the end of key_name_aliases 2019-09-18 16:23:01 +02:00
Kovid Goyal
49bf876f73 Merge branch 'remove_plus_key_alias' of https://github.com/Luflosi/kitty 2019-09-18 19:45:19 +05:30
Luflosi
e512b4d3e3 Remove PLUS key from key_name_aliases 2019-09-18 16:07:55 +02:00
Kovid Goyal
e78b6c7c7c Merge branch 'faq' of https://github.com/jacwah/kitty 2019-09-18 09:49:09 +05:30
Jacob Wahlgren
a7403c0005 Update FAQ with FreeBSD termcap info
Thanks to amarshall's help:
https://github.com/kovidgoyal/kitty/issues/765#issuecomment-487381289
2019-09-17 22:19:51 +02:00
Kovid Goyal
5bed0dddaa typo 2019-09-15 06:19:27 +05:30
Kovid Goyal
bc302dad23 Linux: Allow using fonts with spacing=90 in addition to fonts with spacing=100
Fixes #1968
2019-09-15 06:08:40 +05:30
Kovid Goyal
41b0f8852f Only update config_key_map with those entries in key_name_aliases that exist in ENCODING 2019-09-15 04:24:32 +05:30
Kovid Goyal
2fadd3e7ba Add a note to the fontconfig FAQ about how to override spacing 2019-09-15 04:09:26 +05:30
Kovid Goyal
dcfd2b8d60 Fix incorrect rendering of some symbols when followed by a space while using the PowerLine font which does not have a space glyph
Fixes #1225
2019-09-14 17:56:52 +05:30
Kovid Goyal
7fe63a7aad Add changelog entry for key mapping PR 2019-09-14 10:20:18 +05:30
Kovid Goyal
67f2ec2421 Merge branch 'keyboard_improvement' of https://github.com/Luflosi/kitty 2019-09-14 10:17:35 +05:30
Kovid Goyal
8e7a23a7b9 Merge branch 'use_OPT' of https://github.com/Luflosi/kitty 2019-09-12 13:43:12 +05:30
Luflosi
8e96a27d51 Use the OPT() macro where possible 2019-09-12 10:02:53 +02:00
Kovid Goyal
b337d4d9d5 Merge branch 'master' of https://github.com/copy/kitty 2019-09-12 07:43:35 +05:30
Fabian
d9404c0362 Fix color index 232 (should be #080808, not black) 2019-09-11 20:01:52 +02:00
Kovid Goyal
e4ba5f449f When resetting the terminal, also reset parser state, this allows easy recovery from incomplete escape codes
Fixes #1961
2019-09-09 20:56:35 +05:30
Kovid Goyal
17fd749e8d Add some aliases when parsing config files for common key name variations 2019-09-08 19:28:41 +05:30
Luflosi
f3be5b5e57 Regenerate automatically generated key_encoding.py and keys.h 2019-09-08 12:32:20 +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
4037480d2b Allow for up to 256 keys instead of 128 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
Luflosi
3f926dfd8b Use keyboard key constants instead of hardcoded values 2019-09-08 12:32:18 +02:00
Luflosi
59f64c5e33 Blacklist GLFW_KEY_LAST_PRINTABLE in kitty/keys.py 2019-09-08 12:32:18 +02:00
Luflosi
87059a2004 Add GLFW_KEY_LAST_PRINTABLE as a GLFW constant 2019-09-08 12:32:18 +02:00
Luflosi
7c52dd2bd8 Fix update_encoding() not filtering GLFW_KEY_LAST_PRINTABLE
b3b830bb5f did not actually make `update_encoding()` filter `GLFW_KEY_LAST_PRINTABLE` because `name` contained the key name after applying `symbolic_name()`, which replaces underscores with spaces. Instead of replacing the underscore in `LAST_PRINTABLE` with a space, I moved the check above the call to `symbolic_name()`. This is more readable and future-proof in my opinion.
2019-09-08 12:32:18 +02:00
Kovid Goyal
70c2765a6e Allow reading session file from STDIN 2019-09-08 15:20:37 +05:30
Kovid Goyal
3618f4d642 Only try to wakeup talk thread if it has been started 2019-09-08 15:12:17 +05:30
Kovid Goyal
698569536d Output which loo could not be woken up 2019-09-08 14:58:11 +05:30
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: 7f02898264
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: 2777f6a754
2019-09-08 09:12:39 +05:30
Kovid Goyal
931cb223cd When all visible windows have the same background color, use that as the color for the global padding, instead of the configured background color
See #1957
2019-09-07 18:47:15 +05:30
Kovid Goyal
336ee53fea Merge branch 'joystick-platform' of https://github.com/jamessan/kitty 2019-09-04 08:43:16 +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
Kovid Goyal
72f7cb3b7d Merge branch 'format_key_encoding' of https://github.com/Luflosi/kitty 2019-09-02 07:49:30 +05:30
Luflosi
481047a446 Format kitty/key_encoding.py with yapf 2019-09-01 17:53:52 +02:00
Kovid Goyal
3bf1d73b07 Merge branch 'add_glfw_key_last_printable' of https://github.com/Luflosi/kitty 2019-09-01 17:52:39 +05:30
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
Kovid Goyal
def0c55df3 Merge branch 'add_missing_named_keys' of https://github.com/Luflosi/kitty 2019-09-01 05:43:27 +05:30
Luflosi
b995e00850 Add missing key to named_keys 2019-09-01 02:03:54 +02:00
Kovid Goyal
32dfc94909 Implement a hack to (mostly) preserve tabs when cat a file with them and then copying the text or passing screen contents to another program
It's a simple enough hack that it seems worth doing. If it causes any
issues, can always be reverted.

Fixes #1829
2019-08-31 12:37:05 +05:30
39 changed files with 17447 additions and 11337 deletions

View File

@@ -4,6 +4,39 @@ Changelog
|kitty| is a feature full, cross-platform, *fast*, GPU based terminal emulator.
To update |kitty|, :doc:`follow the instructions <binary>`.
0.14.6 [2019-09-25]
---------------------
- macOS: Fix a regression in the previous release that caused a crash when
pressing a unprintable key, such as the POWER key (:iss:`1997`)
- Fix a regression in the previous release that caused kitty to not always
respond to DPI changes (:pull:`1999`)
0.14.5 [2019-09-23]
---------------------
- Implement a hack to (mostly) preserve tabs when cat-ting a file with them and then
copying the text or passing screen contents to another program (:iss:`1829`)
- When all visible windows have the same background color, use that as the
color for the global padding, instead of the configured background color
(:iss:`1957`)
- When resetting the terminal, also reset parser state, this allows easy
recovery from incomplete escape codes (:iss:`1961`)
- Allow mapping keys commonly found on European keyboards (:pull:`1928`)
- Fix incorrect rendering of some symbols when followed by a space while using
the PowerLine font which does not have a space glyph (:iss:`1225`)
- Linux: Allow using fonts with spacing=90 in addition to fonts with
spacing=100 (:iss:`1968`)
- Use selection foreground color for underlines as well (:iss:`1982`)
0.14.4 [2019-08-31]
---------------------

View File

@@ -63,6 +63,18 @@ Really, the correct solution for this is to convince the OpenSSH maintainers to
have ssh do this automatically, if possible, when connecting to a server, so that
all terminals work transparently.
If the server is running FreeBSD, or another system that relies on termcap
rather than terminfo, you will need to convert the terminfo file on your local
machine by running (on local machine with |kitty|)::
infocmp -C xterm-kitty
The output of this command is the termcap description, which should be appended
to :file:`/usr/share/misc/termcap` on the remote server. Then run the following
command to apply your change (on the server)::
cap_mkdb /usr/share/misc/termcap
Keys such as arrow keys, backspace, delete, home/end, etc. do not work when using su or sudo?
-------------------------------------------------------------------------------------------------
@@ -152,7 +164,27 @@ only monospace fonts, since every cell in the grid has to be the same size. If
your font is not listed in ``kitty list-fonts`` it means that it is not
monospace. On Linux you can list all monospace fonts with::
fc-list : family spacing | grep spacing=100
fc-list : family spacing | grep -e spacing=100 -e spacing=90
Note that the spacing property is calculated by fontconfig based on actual
glyph widths in the font. If for some reason fontconfig concludes your favorite
monospace font does not have ``spacing=100`` you can override it by using the
following :file:`~/.config/fontconfig/fonts.conf`::
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
<match target="scan">
<test name="family">
<string>Your Font Family Name</string>
</test>
<edit name="spacing">
<int>100</int>
</edit>
</match>
</fontconfig>
Then, the font will be available in ``kitty list-fonts``.
How can I assign a single global shortcut to bring up the kitty terminal?
@@ -172,7 +204,7 @@ For example::
map alt+s send_text all \x13
This maps :kbd:`alt+s`` to :kbd:`ctrl+s`. To figure out what bytes to use for
This maps :kbd:`alt+s` to :kbd:`ctrl+s`. To figure out what bytes to use for
the :sc:`send_text <send_text>` you can use the ``showkey`` utility. Run::
showkey -a

View File

@@ -34,6 +34,61 @@
// Needed for _NSGetProgname
#include <crt_externs.h>
#define PARAGRAPH_UTF_8 0xc2a7 // §
#define MASCULINE_UTF_8 0xc2ba // º
#define A_DIAERESIS_UPPER_CASE_UTF_8 0xc384 // Ä
#define O_DIAERESIS_UPPER_CASE_UTF_8 0xc396 // Ö
#define U_DIAERESIS_UPPER_CASE_UTF_8 0xc39c // Ü
#define S_SHARP_UTF_8 0xc39f // ß
#define A_GRAVE_LOWER_CASE_UTF_8 0xc3a0 // à
#define A_DIAERESIS_LOWER_CASE_UTF_8 0xc3a4 // ä
#define A_RING_LOWER_CASE_UTF_8 0xc3a5 // å
#define AE_LOWER_CASE_UTF_8 0xc3a6 // æ
#define C_CEDILLA_LOWER_CASE_UTF_8 0xc3a7 // ç
#define E_GRAVE_LOWER_CASE_UTF_8 0xc3a8 // è
#define E_ACUTE_LOWER_CASE_UTF_8 0xc3a9 // é
#define I_GRAVE_LOWER_CASE_UTF_8 0xc3ac // ì
#define N_TILDE_LOWER_CASE_UTF_8 0xc3b1 // ñ
#define O_GRAVE_LOWER_CASE_UTF_8 0xc3b2 // ò
#define O_DIAERESIS_LOWER_CASE_UTF_8 0xc3b6 // ö
#define O_SLASH_LOWER_CASE_UTF_8 0xc3b8 // ø
#define U_GRAVE_LOWER_CASE_UTF_8 0xc3b9 // ù
#define U_DIAERESIS_LOWER_CASE_UTF_8 0xc3bc // ü
#define CYRILLIC_A_LOWER_CASE_UTF_8 0xd0b0 // а
#define CYRILLIC_BE_LOWER_CASE_UTF_8 0xd0b1 // б
#define CYRILLIC_VE_LOWER_CASE_UTF_8 0xd0b2 // в
#define CYRILLIC_GHE_LOWER_CASE_UTF_8 0xd0b3 // г
#define CYRILLIC_DE_LOWER_CASE_UTF_8 0xd0b4 // д
#define CYRILLIC_IE_LOWER_CASE_UTF_8 0xd0b5 // е
#define CYRILLIC_ZHE_LOWER_CASE_UTF_8 0xd0b6 // ж
#define CYRILLIC_ZE_LOWER_CASE_UTF_8 0xd0b7 // з
#define CYRILLIC_I_LOWER_CASE_UTF_8 0xd0b8 // и
#define CYRILLIC_SHORT_I_LOWER_CASE_UTF_8 0xd0b9 // й
#define CYRILLIC_KA_LOWER_CASE_UTF_8 0xd0ba // к
#define CYRILLIC_EL_LOWER_CASE_UTF_8 0xd0bb // л
#define CYRILLIC_EM_LOWER_CASE_UTF_8 0xd0bc // м
#define CYRILLIC_EN_LOWER_CASE_UTF_8 0xd0bd // н
#define CYRILLIC_O_LOWER_CASE_UTF_8 0xd0be // о
#define CYRILLIC_PE_LOWER_CASE_UTF_8 0xd0bf // п
#define CYRILLIC_ER_LOWER_CASE_UTF_8 0xd180 // р
#define CYRILLIC_ES_LOWER_CASE_UTF_8 0xd181 // с
#define CYRILLIC_TE_LOWER_CASE_UTF_8 0xd182 // т
#define CYRILLIC_U_LOWER_CASE_UTF_8 0xd183 // у
#define CYRILLIC_EF_LOWER_CASE_UTF_8 0xd184 // ф
#define CYRILLIC_HA_LOWER_CASE_UTF_8 0xd185 // х
#define CYRILLIC_TSE_LOWER_CASE_UTF_8 0xd186 // ц
#define CYRILLIC_CHE_LOWER_CASE_UTF_8 0xd187 // ч
#define CYRILLIC_SHA_LOWER_CASE_UTF_8 0xd188 // ш
#define CYRILLIC_SHCHA_LOWER_CASE_UTF_8 0xd189 // щ
#define CYRILLIC_HARD_SIGN_LOWER_CASE_UTF_8 0xd18a // ъ
#define CYRILLIC_YERU_LOWER_CASE_UTF_8 0xd18b // ы
#define CYRILLIC_SOFT_SIGN_LOWER_CASE_UTF_8 0xd18c // ь
#define CYRILLIC_E_LOWER_CASE_UTF_8 0xd18d // э
#define CYRILLIC_YU_LOWER_CASE_UTF_8 0xd18e // ю
#define CYRILLIC_YA_LOWER_CASE_UTF_8 0xd18f // я
#define CYRILLIC_IO_LOWER_CASE_UTF_8 0xd191 // ё
// Returns the style mask corresponding to the window settings
//
static NSUInteger getStyleMask(_GLFWwindow* window)
@@ -288,11 +343,47 @@ static int translateKey(unsigned int key, bool apply_keymap)
{
if (apply_keymap) {
// Look for the effective key name after applying any keyboard layouts/mappings
const char *name = _glfwPlatformGetScancodeName(key);
if (name && name[1] == 0) {
// Single letter key name
switch(name[0]) {
const char *name_chars = _glfwPlatformGetScancodeName(key);
uint32_t name = 0;
if (name_chars) {
for (int i = 0; i < 4; i++) {
if (!name_chars[i]) break;
name <<= 8;
name |= (uint8_t)name_chars[i];
}
}
if (name) {
// Key name
switch(name) {
#define K(ch, name) case ch: return GLFW_KEY_##name
K('!', EXCLAM);
K('"', DOUBLE_QUOTE);
K('#', NUMBER_SIGN);
K('$', DOLLAR);
K('&', AMPERSAND);
K('\'', APOSTROPHE);
K('(', PARENTHESIS_LEFT);
K(')', PARENTHESIS_RIGHT);
K('+', PLUS);
K(',', COMMA);
K('-', MINUS);
K('.', PERIOD);
K('/', SLASH);
K('0', 0);
K('1', 1);
K('2', 2);
K('3', 3);
K('5', 5);
K('6', 6);
K('7', 7);
K('8', 8);
K('9', 9);
K(':', COLON);
K(';', SEMICOLON);
K('<', LESS);
K('=', EQUAL);
K('>', GREATER);
K('@', AT);
K('A', A); K('a', A);
K('B', B); K('b', B);
K('C', C); K('c', C);
@@ -319,28 +410,64 @@ static int translateKey(unsigned int key, bool apply_keymap)
K('X', X); K('x', X);
K('Y', Y); K('y', Y);
K('Z', Z); K('z', Z);
K('0', 0);
K('1', 1);
K('2', 2);
K('3', 3);
K('5', 5);
K('6', 6);
K('7', 7);
K('8', 8);
K('9', 9);
K('\'', APOSTROPHE);
K(',', COMMA);
K('.', PERIOD);
K('/', SLASH);
K('-', MINUS);
K('=', EQUAL);
K(';', SEMICOLON);
K('[', LEFT_BRACKET);
K('\\', BACKSLASH);
K(']', RIGHT_BRACKET);
K('+', PLUS);
K('_', UNDERSCORE);
K('`', GRAVE_ACCENT);
K('\\', BACKSLASH);
K(PARAGRAPH_UTF_8, PARAGRAPH);
K(MASCULINE_UTF_8, MASCULINE);
K(A_DIAERESIS_UPPER_CASE_UTF_8, A_DIAERESIS);
K(O_DIAERESIS_UPPER_CASE_UTF_8, O_DIAERESIS);
K(U_DIAERESIS_UPPER_CASE_UTF_8, U_DIAERESIS);
K(S_SHARP_UTF_8, S_SHARP);
K(A_GRAVE_LOWER_CASE_UTF_8, A_GRAVE);
K(A_DIAERESIS_LOWER_CASE_UTF_8, A_DIAERESIS);
K(A_RING_LOWER_CASE_UTF_8, A_RING);
K(AE_LOWER_CASE_UTF_8, AE);
K(C_CEDILLA_LOWER_CASE_UTF_8, C_CEDILLA);
K(E_GRAVE_LOWER_CASE_UTF_8, E_GRAVE);
K(E_ACUTE_LOWER_CASE_UTF_8, E_ACUTE);
K(I_GRAVE_LOWER_CASE_UTF_8, I_GRAVE);
K(N_TILDE_LOWER_CASE_UTF_8, N_TILDE);
K(O_GRAVE_LOWER_CASE_UTF_8, O_GRAVE);
K(O_DIAERESIS_LOWER_CASE_UTF_8, O_DIAERESIS);
K(O_SLASH_LOWER_CASE_UTF_8, O_SLASH);
K(U_GRAVE_LOWER_CASE_UTF_8, U_GRAVE);
K(U_DIAERESIS_LOWER_CASE_UTF_8, U_DIAERESIS);
K(CYRILLIC_A_LOWER_CASE_UTF_8, CYRILLIC_A);
K(CYRILLIC_BE_LOWER_CASE_UTF_8, CYRILLIC_BE);
K(CYRILLIC_VE_LOWER_CASE_UTF_8, CYRILLIC_VE);
K(CYRILLIC_GHE_LOWER_CASE_UTF_8, CYRILLIC_GHE);
K(CYRILLIC_DE_LOWER_CASE_UTF_8, CYRILLIC_DE);
K(CYRILLIC_IE_LOWER_CASE_UTF_8, CYRILLIC_IE);
K(CYRILLIC_ZHE_LOWER_CASE_UTF_8, CYRILLIC_ZHE);
K(CYRILLIC_ZE_LOWER_CASE_UTF_8, CYRILLIC_ZE);
K(CYRILLIC_I_LOWER_CASE_UTF_8, CYRILLIC_I);
K(CYRILLIC_SHORT_I_LOWER_CASE_UTF_8, CYRILLIC_SHORT_I);
K(CYRILLIC_KA_LOWER_CASE_UTF_8, CYRILLIC_KA);
K(CYRILLIC_EL_LOWER_CASE_UTF_8, CYRILLIC_EL);
K(CYRILLIC_EM_LOWER_CASE_UTF_8, CYRILLIC_EM);
K(CYRILLIC_EN_LOWER_CASE_UTF_8, CYRILLIC_EN);
K(CYRILLIC_O_LOWER_CASE_UTF_8, CYRILLIC_O);
K(CYRILLIC_PE_LOWER_CASE_UTF_8, CYRILLIC_PE);
K(CYRILLIC_ER_LOWER_CASE_UTF_8, CYRILLIC_ER);
K(CYRILLIC_ES_LOWER_CASE_UTF_8, CYRILLIC_ES);
K(CYRILLIC_TE_LOWER_CASE_UTF_8, CYRILLIC_TE);
K(CYRILLIC_U_LOWER_CASE_UTF_8, CYRILLIC_U);
K(CYRILLIC_EF_LOWER_CASE_UTF_8, CYRILLIC_EF);
K(CYRILLIC_HA_LOWER_CASE_UTF_8, CYRILLIC_HA);
K(CYRILLIC_TSE_LOWER_CASE_UTF_8, CYRILLIC_TSE);
K(CYRILLIC_CHE_LOWER_CASE_UTF_8, CYRILLIC_CHE);
K(CYRILLIC_SHA_LOWER_CASE_UTF_8, CYRILLIC_SHA);
K(CYRILLIC_SHCHA_LOWER_CASE_UTF_8, CYRILLIC_SHCHA);
K(CYRILLIC_HARD_SIGN_LOWER_CASE_UTF_8, CYRILLIC_HARD_SIGN);
K(CYRILLIC_YERU_LOWER_CASE_UTF_8, CYRILLIC_YERU);
K(CYRILLIC_SOFT_SIGN_LOWER_CASE_UTF_8, CYRILLIC_SOFT_SIGN);
K(CYRILLIC_E_LOWER_CASE_UTF_8, CYRILLIC_E);
K(CYRILLIC_YU_LOWER_CASE_UTF_8, CYRILLIC_YU);
K(CYRILLIC_YA_LOWER_CASE_UTF_8, CYRILLIC_YA);
K(CYRILLIC_IO_LOWER_CASE_UTF_8, CYRILLIC_IO);
#undef K
default:
break;
@@ -1638,7 +1765,14 @@ void _glfwPlatformSetWindowSize(_GLFWwindow* window, int width, int height)
acquireMonitor(window);
}
else
[window->ns.object setContentSize:NSMakeSize(width, height)];
{
NSRect contentRect =
[window->ns.object contentRectForFrameRect:[window->ns.object frame]];
contentRect.origin.y += contentRect.size.height - height;
contentRect.size = NSMakeSize(width, height);
[window->ns.object setFrame:[window->ns.object frameRectForContentRect:contentRect]
display:YES];
}
}
void _glfwPlatformSetWindowSizeLimits(_GLFWwindow* window,
@@ -2283,6 +2417,39 @@ GLFWAPI void glfwGetCocoaKeyEquivalent(int glfw_key, int glfw_mods, unsigned sho
START_ALLOW_CASE_RANGE
switch(glfw_key) {
#define K(ch, name) case GLFW_KEY_##name: *cocoa_key = ch; break;
K('!', EXCLAM);
K('"', DOUBLE_QUOTE);
K('#', NUMBER_SIGN);
K('$', DOLLAR);
K('&', AMPERSAND);
K('\'', APOSTROPHE);
K('(', PARENTHESIS_LEFT);
K(')', PARENTHESIS_RIGHT);
K('+', PLUS);
K(',', COMMA);
K('-', MINUS);
K('.', PERIOD);
K('/', SLASH);
K('0', 0);
K('1', 1);
K('2', 2);
K('3', 3);
K('5', 5);
K('6', 6);
K('7', 7);
K('8', 8);
K('9', 9);
K(':', COLON);
K(';', SEMICOLON);
K('<', LESS);
K('=', EQUAL);
K('>', GREATER);
K('@', AT);
K('[', LEFT_BRACKET);
K('\\', BACKSLASH);
K(']', RIGHT_BRACKET);
K('_', UNDERSCORE);
K('`', GRAVE_ACCENT);
K('a', A);
K('b', B);
K('c', C);
@@ -2309,28 +2476,56 @@ START_ALLOW_CASE_RANGE
K('x', X);
K('y', Y);
K('z', Z);
K('0', 0);
K('1', 1);
K('2', 2);
K('3', 3);
K('5', 5);
K('6', 6);
K('7', 7);
K('8', 8);
K('9', 9);
K('\'', APOSTROPHE);
K(',', COMMA);
K('.', PERIOD);
K('/', SLASH);
K('-', MINUS);
K('=', EQUAL);
K(';', SEMICOLON);
K('[', LEFT_BRACKET);
K(']', RIGHT_BRACKET);
K('+', PLUS);
K('_', UNDERSCORE);
K('`', GRAVE_ACCENT);
K('\\', BACKSLASH);
K(PARAGRAPH_UTF_8, PARAGRAPH);
K(MASCULINE_UTF_8, MASCULINE);
K(S_SHARP_UTF_8, S_SHARP);
K(A_GRAVE_LOWER_CASE_UTF_8, A_GRAVE);
K(A_DIAERESIS_LOWER_CASE_UTF_8, A_DIAERESIS);
K(A_RING_LOWER_CASE_UTF_8, A_RING);
K(AE_LOWER_CASE_UTF_8, AE);
K(C_CEDILLA_LOWER_CASE_UTF_8, C_CEDILLA);
K(E_GRAVE_LOWER_CASE_UTF_8, E_GRAVE);
K(E_ACUTE_LOWER_CASE_UTF_8, E_ACUTE);
K(I_GRAVE_LOWER_CASE_UTF_8, I_GRAVE);
K(N_TILDE_LOWER_CASE_UTF_8, N_TILDE);
K(O_GRAVE_LOWER_CASE_UTF_8, O_GRAVE);
K(O_DIAERESIS_LOWER_CASE_UTF_8, O_DIAERESIS);
K(O_SLASH_LOWER_CASE_UTF_8, O_SLASH);
K(U_GRAVE_LOWER_CASE_UTF_8, U_GRAVE);
K(U_DIAERESIS_LOWER_CASE_UTF_8, U_DIAERESIS);
K(CYRILLIC_A_LOWER_CASE_UTF_8, CYRILLIC_A);
K(CYRILLIC_BE_LOWER_CASE_UTF_8, CYRILLIC_BE);
K(CYRILLIC_VE_LOWER_CASE_UTF_8, CYRILLIC_VE);
K(CYRILLIC_GHE_LOWER_CASE_UTF_8, CYRILLIC_GHE);
K(CYRILLIC_DE_LOWER_CASE_UTF_8, CYRILLIC_DE);
K(CYRILLIC_IE_LOWER_CASE_UTF_8, CYRILLIC_IE);
K(CYRILLIC_ZHE_LOWER_CASE_UTF_8, CYRILLIC_ZHE);
K(CYRILLIC_ZE_LOWER_CASE_UTF_8, CYRILLIC_ZE);
K(CYRILLIC_I_LOWER_CASE_UTF_8, CYRILLIC_I);
K(CYRILLIC_SHORT_I_LOWER_CASE_UTF_8, CYRILLIC_SHORT_I);
K(CYRILLIC_KA_LOWER_CASE_UTF_8, CYRILLIC_KA);
K(CYRILLIC_EL_LOWER_CASE_UTF_8, CYRILLIC_EL);
K(CYRILLIC_EM_LOWER_CASE_UTF_8, CYRILLIC_EM);
K(CYRILLIC_EN_LOWER_CASE_UTF_8, CYRILLIC_EN);
K(CYRILLIC_O_LOWER_CASE_UTF_8, CYRILLIC_O);
K(CYRILLIC_PE_LOWER_CASE_UTF_8, CYRILLIC_PE);
K(CYRILLIC_ER_LOWER_CASE_UTF_8, CYRILLIC_ER);
K(CYRILLIC_ES_LOWER_CASE_UTF_8, CYRILLIC_ES);
K(CYRILLIC_TE_LOWER_CASE_UTF_8, CYRILLIC_TE);
K(CYRILLIC_U_LOWER_CASE_UTF_8, CYRILLIC_U);
K(CYRILLIC_EF_LOWER_CASE_UTF_8, CYRILLIC_EF);
K(CYRILLIC_HA_LOWER_CASE_UTF_8, CYRILLIC_HA);
K(CYRILLIC_TSE_LOWER_CASE_UTF_8, CYRILLIC_TSE);
K(CYRILLIC_CHE_LOWER_CASE_UTF_8, CYRILLIC_CHE);
K(CYRILLIC_SHA_LOWER_CASE_UTF_8, CYRILLIC_SHA);
K(CYRILLIC_SHCHA_LOWER_CASE_UTF_8, CYRILLIC_SHCHA);
K(CYRILLIC_HARD_SIGN_LOWER_CASE_UTF_8, CYRILLIC_HARD_SIGN);
K(CYRILLIC_YERU_LOWER_CASE_UTF_8, CYRILLIC_YERU);
K(CYRILLIC_SOFT_SIGN_LOWER_CASE_UTF_8, CYRILLIC_SOFT_SIGN);
K(CYRILLIC_E_LOWER_CASE_UTF_8, CYRILLIC_E);
K(CYRILLIC_YU_LOWER_CASE_UTF_8, CYRILLIC_YU);
K(CYRILLIC_YA_LOWER_CASE_UTF_8, CYRILLIC_YA);
K(CYRILLIC_IO_LOWER_CASE_UTF_8, CYRILLIC_IO);
K(0x35, ESCAPE);
K('\r', ENTER);

View File

@@ -8,10 +8,7 @@ import re
import sys
_plat = sys.platform.lower()
is_freebsd = 'freebsd' in _plat
is_netbsd = 'netbsd' in _plat
is_dragonflybsd = 'dragonfly' in _plat
is_bsd = is_freebsd or is_netbsd or is_dragonflybsd
is_linux = 'linux' in _plat
base = os.path.dirname(os.path.abspath(__file__))
@@ -30,7 +27,7 @@ def init_env(env, pkg_config, at_least_version, test_compile, module='x11'):
sinfo = json.load(f)
module_sources = list(sinfo[module]['sources'])
if module in ('x11', 'wayland'):
remove = 'linux_joystick.c' if is_bsd else 'null_joystick.c'
remove = 'null_joystick.c' if is_linux else 'linux_joystick.c'
module_sources.remove(remove)
ans.sources = sinfo['common']['sources'] + module_sources

140
glfw/glfw3.h vendored
View File

@@ -342,7 +342,15 @@ extern "C" {
/* Printable keys */
#define GLFW_KEY_SPACE 32
#define GLFW_KEY_EXCLAM 33 /* ! */
#define GLFW_KEY_DOUBLE_QUOTE 34 /* " */
#define GLFW_KEY_NUMBER_SIGN 35 /* # */
#define GLFW_KEY_DOLLAR 36 /* $ */
#define GLFW_KEY_AMPERSAND 38 /* & */
#define GLFW_KEY_APOSTROPHE 39 /* ' */
#define GLFW_KEY_PARENTHESIS_LEFT 40 /* ( */
#define GLFW_KEY_PARENTHESIS_RIGHT 41 /* ) */
#define GLFW_KEY_PLUS 43 /* + */
#define GLFW_KEY_COMMA 44 /* , */
#define GLFW_KEY_MINUS 45 /* - */
#define GLFW_KEY_PERIOD 46 /* . */
@@ -357,8 +365,12 @@ extern "C" {
#define GLFW_KEY_7 55
#define GLFW_KEY_8 56
#define GLFW_KEY_9 57
#define GLFW_KEY_COLON 58 /* : */
#define GLFW_KEY_SEMICOLON 59 /* ; */
#define GLFW_KEY_LESS 60 /* < */
#define GLFW_KEY_EQUAL 61 /* = */
#define GLFW_KEY_GREATER 62 /* > */
#define GLFW_KEY_AT 64 /* @ */
#define GLFW_KEY_A 65
#define GLFW_KEY_B 66
#define GLFW_KEY_C 67
@@ -388,11 +400,62 @@ extern "C" {
#define GLFW_KEY_LEFT_BRACKET 91 /* [ */
#define GLFW_KEY_BACKSLASH 92 /* \ */
#define GLFW_KEY_RIGHT_BRACKET 93 /* ] */
#define GLFW_KEY_UNDERSCORE 95 /* _ */
#define GLFW_KEY_GRAVE_ACCENT 96 /* ` */
#define GLFW_KEY_WORLD_1 161 /* non-US #1 */
#define GLFW_KEY_WORLD_2 162 /* non-US #2 */
#define GLFW_KEY_PLUS 163
#define GLFW_KEY_UNDERSCORE 164
#define GLFW_KEY_PARAGRAPH 167 /* § */
#define GLFW_KEY_MASCULINE 186 /* º */
#define GLFW_KEY_A_GRAVE 192 /* À */
#define GLFW_KEY_A_DIAERESIS 196 /* Ä */
#define GLFW_KEY_A_RING 197 /* Å */
#define GLFW_KEY_AE 198 /* Æ */
#define GLFW_KEY_C_CEDILLA 199 /* Ç */
#define GLFW_KEY_E_GRAVE 200 /* È */
#define GLFW_KEY_E_ACUTE 201 /* É */
#define GLFW_KEY_I_GRAVE 204 /* Ì */
#define GLFW_KEY_N_TILDE 209 /* Ñ */
#define GLFW_KEY_O_GRAVE 210 /* Ò */
#define GLFW_KEY_O_DIAERESIS 214 /* Ö */
#define GLFW_KEY_O_SLASH 216 /* Ø */
#define GLFW_KEY_U_GRAVE 217 /* Ù */
#define GLFW_KEY_U_DIAERESIS 220 /* Ü */
#define GLFW_KEY_S_SHARP 222 /* ß */
#define GLFW_KEY_CYRILLIC_A 223 /* А */
#define GLFW_KEY_CYRILLIC_BE 224 /* Б */
#define GLFW_KEY_CYRILLIC_VE 225 /* В */
#define GLFW_KEY_CYRILLIC_GHE 226 /* Г */
#define GLFW_KEY_CYRILLIC_DE 227 /* Д */
#define GLFW_KEY_CYRILLIC_IE 228 /* Е */
#define GLFW_KEY_CYRILLIC_ZHE 229 /* Ж */
#define GLFW_KEY_CYRILLIC_ZE 230 /* З */
#define GLFW_KEY_CYRILLIC_I 231 /* И */
#define GLFW_KEY_CYRILLIC_SHORT_I 232 /* Й */
#define GLFW_KEY_CYRILLIC_KA 233 /* К */
#define GLFW_KEY_CYRILLIC_EL 234 /* Л */
#define GLFW_KEY_CYRILLIC_EM 235 /* М */
#define GLFW_KEY_CYRILLIC_EN 236 /* Н */
#define GLFW_KEY_CYRILLIC_O 237 /* О */
#define GLFW_KEY_CYRILLIC_PE 238 /* П */
#define GLFW_KEY_CYRILLIC_ER 239 /* Р */
#define GLFW_KEY_CYRILLIC_ES 240 /* С */
#define GLFW_KEY_CYRILLIC_TE 241 /* Т */
#define GLFW_KEY_CYRILLIC_U 242 /* У */
#define GLFW_KEY_CYRILLIC_EF 243 /* Ф */
#define GLFW_KEY_CYRILLIC_HA 244 /* Х */
#define GLFW_KEY_CYRILLIC_TSE 245 /* Ц */
#define GLFW_KEY_CYRILLIC_CHE 246 /* Ч */
#define GLFW_KEY_CYRILLIC_SHA 247 /* Ш */
#define GLFW_KEY_CYRILLIC_SHCHA 248 /* Щ */
#define GLFW_KEY_CYRILLIC_HARD_SIGN 249 /* Ъ */
#define GLFW_KEY_CYRILLIC_YERU 250 /* Ы */
#define GLFW_KEY_CYRILLIC_SOFT_SIGN 251 /* Ь */
#define GLFW_KEY_CYRILLIC_E 252 /* Э */
#define GLFW_KEY_CYRILLIC_YU 253 /* Ю */
#define GLFW_KEY_CYRILLIC_YA 254 /* Я */
#define GLFW_KEY_CYRILLIC_IO 255 /* Ё */
#define GLFW_KEY_LAST_PRINTABLE GLFW_KEY_CYRILLIC_IO
/* Function keys */
#define GLFW_KEY_ESCAPE 256
@@ -1405,7 +1468,7 @@ typedef void (* GLFWscrollfun)(GLFWwindow*,double,double,int);
* @param[in] mods Bit field describing which [modifier keys](@ref mods) were
* held down.
* @param[in] text UTF-8 encoded text generated by this key event or empty string.
* @param[in] Used for Input Method events. Zero for normal key events.
* @param[in] status Used for Input Method events. Zero for normal key events.
* A value of 1 means the pre-edit text for the input event has been changed.
* A value of 2 means the text should be committed.
*
@@ -3844,20 +3907,85 @@ GLFWAPI void glfwSetInputMode(GLFWwindow* window, int mode, int value);
* [key callback](@ref input_key) without modification.
*
* The printable keys are:
* - `GLFW_KEY_SPACE`
* - `GLFW_KEY_EXCLAM`
* - `GLFW_KEY_DOUBLE_QUOTE`
* - `GLFW_KEY_NUMBER_SIGN`
* - `GLFW_KEY_DOLLAR`
* - `GLFW_KEY_AMPERSAND`
* - `GLFW_KEY_APOSTROPHE`
* - `GLFW_KEY_PARENTHESIS_LEFT`
* - `GLFW_KEY_PARENTHESIS_RIGHT`
* - `GLFW_KEY_PLUS`
* - `GLFW_KEY_COMMA`
* - `GLFW_KEY_MINUS`
* - `GLFW_KEY_PERIOD`
* - `GLFW_KEY_SLASH`
* - `GLFW_KEY_0` to `GLFW_KEY_9`
* - `GLFW_KEY_COLON`
* - `GLFW_KEY_SEMICOLON`
* - `GLFW_KEY_LESS`
* - `GLFW_KEY_EQUAL`
* - `GLFW_KEY_GREATER`
* - `GLFW_KEY_AT`
* - `GLFW_KEY_A` to `GLFW_KEY_Z`
* - `GLFW_KEY_LEFT_BRACKET`
* - `GLFW_KEY_RIGHT_BRACKET`
* - `GLFW_KEY_BACKSLASH`
* - `GLFW_KEY_RIGHT_BRACKET`
* - `GLFW_KEY_UNDERSCORE`
* - `GLFW_KEY_GRAVE_ACCENT`
* - `GLFW_KEY_WORLD_1`
* - `GLFW_KEY_WORLD_2`
* - `GLFW_KEY_0` to `GLFW_KEY_9`
* - `GLFW_KEY_A` to `GLFW_KEY_Z`
* - `GLFW_KEY_PARAGRAPH`
* - `GLFW_KEY_MASCULINE`
* - `GLFW_KEY_A_GRAVE`
* - `GLFW_KEY_A_DIAERESIS`
* - `GLFW_KEY_A_RING`
* - `GLFW_KEY_AE`
* - `GLFW_KEY_C_CEDILLA`
* - `GLFW_KEY_E_GRAVE`
* - `GLFW_KEY_E_ACUTE`
* - `GLFW_KEY_I_GRAVE`
* - `GLFW_KEY_N_TILDE`
* - `GLFW_KEY_O_GRAVE`
* - `GLFW_KEY_O_DIAERESIS`
* - `GLFW_KEY_O_SLASH`
* - `GLFW_KEY_U_GRAVE`
* - `GLFW_KEY_U_DIAERESIS`
* - `GLFW_KEY_S_SHARP`
* - `GLFW_KEY_CYRILLIC_A`
* - `GLFW_KEY_CYRILLIC_BE`
* - `GLFW_KEY_CYRILLIC_VE`
* - `GLFW_KEY_CYRILLIC_GHE`
* - `GLFW_KEY_CYRILLIC_DE`
* - `GLFW_KEY_CYRILLIC_IE`
* - `GLFW_KEY_CYRILLIC_ZHE`
* - `GLFW_KEY_CYRILLIC_ZE`
* - `GLFW_KEY_CYRILLIC_I`
* - `GLFW_KEY_CYRILLIC_SHORT_I`
* - `GLFW_KEY_CYRILLIC_KA`
* - `GLFW_KEY_CYRILLIC_EL`
* - `GLFW_KEY_CYRILLIC_EM`
* - `GLFW_KEY_CYRILLIC_EN`
* - `GLFW_KEY_CYRILLIC_O`
* - `GLFW_KEY_CYRILLIC_PE`
* - `GLFW_KEY_CYRILLIC_ER`
* - `GLFW_KEY_CYRILLIC_ES`
* - `GLFW_KEY_CYRILLIC_TE`
* - `GLFW_KEY_CYRILLIC_U`
* - `GLFW_KEY_CYRILLIC_EF`
* - `GLFW_KEY_CYRILLIC_HA`
* - `GLFW_KEY_CYRILLIC_TSE`
* - `GLFW_KEY_CYRILLIC_CHE`
* - `GLFW_KEY_CYRILLIC_SHA`
* - `GLFW_KEY_CYRILLIC_SHCHA`
* - `GLFW_KEY_CYRILLIC_HARD_SIGN`
* - `GLFW_KEY_CYRILLIC_YERU`
* - `GLFW_KEY_CYRILLIC_SOFT_SIGN`
* - `GLFW_KEY_CYRILLIC_E`
* - `GLFW_KEY_CYRILLIC_YU`
* - `GLFW_KEY_CYRILLIC_YA`
* - `GLFW_KEY_CYRILLIC_IO`
* - `GLFW_KEY_KP_0` to `GLFW_KEY_KP_9`
* - `GLFW_KEY_KP_DECIMAL`
* - `GLFW_KEY_KP_DIVIDE`

309
glfw/input.c vendored
View File

@@ -439,132 +439,193 @@ const char* _glfwGetKeyName(int key)
switch (key)
{
// Printable keys
case GLFW_KEY_A: return "A";
case GLFW_KEY_B: return "B";
case GLFW_KEY_C: return "C";
case GLFW_KEY_D: return "D";
case GLFW_KEY_E: return "E";
case GLFW_KEY_F: return "F";
case GLFW_KEY_G: return "G";
case GLFW_KEY_H: return "H";
case GLFW_KEY_I: return "I";
case GLFW_KEY_J: return "J";
case GLFW_KEY_K: return "K";
case GLFW_KEY_L: return "L";
case GLFW_KEY_M: return "M";
case GLFW_KEY_N: return "N";
case GLFW_KEY_O: return "O";
case GLFW_KEY_P: return "P";
case GLFW_KEY_Q: return "Q";
case GLFW_KEY_R: return "R";
case GLFW_KEY_S: return "S";
case GLFW_KEY_T: return "T";
case GLFW_KEY_U: return "U";
case GLFW_KEY_V: return "V";
case GLFW_KEY_W: return "W";
case GLFW_KEY_X: return "X";
case GLFW_KEY_Y: return "Y";
case GLFW_KEY_Z: return "Z";
case GLFW_KEY_1: return "1";
case GLFW_KEY_2: return "2";
case GLFW_KEY_3: return "3";
case GLFW_KEY_4: return "4";
case GLFW_KEY_5: return "5";
case GLFW_KEY_6: return "6";
case GLFW_KEY_7: return "7";
case GLFW_KEY_8: return "8";
case GLFW_KEY_9: return "9";
case GLFW_KEY_0: return "0";
case GLFW_KEY_SPACE: return "SPACE";
case GLFW_KEY_MINUS: return "MINUS";
case GLFW_KEY_EQUAL: return "EQUAL";
case GLFW_KEY_LEFT_BRACKET: return "LEFT BRACKET";
case GLFW_KEY_RIGHT_BRACKET: return "RIGHT BRACKET";
case GLFW_KEY_BACKSLASH: return "BACKSLASH";
case GLFW_KEY_SEMICOLON: return "SEMICOLON";
case GLFW_KEY_APOSTROPHE: return "APOSTROPHE";
case GLFW_KEY_GRAVE_ACCENT: return "GRAVE ACCENT";
case GLFW_KEY_COMMA: return "COMMA";
case GLFW_KEY_PERIOD: return "PERIOD";
case GLFW_KEY_SLASH: return "SLASH";
case GLFW_KEY_WORLD_1: return "WORLD 1";
case GLFW_KEY_WORLD_2: return "WORLD 2";
case GLFW_KEY_PLUS: return "PLUS";
case GLFW_KEY_UNDERSCORE: return "UNDERSCORE";
case GLFW_KEY_SPACE: return "SPACE";
case GLFW_KEY_EXCLAM: return "EXCLAM";
case GLFW_KEY_DOUBLE_QUOTE: return "DOUBLE_QUOTE";
case GLFW_KEY_NUMBER_SIGN: return "NUMBER_SIGN";
case GLFW_KEY_DOLLAR: return "DOLLAR";
case GLFW_KEY_AMPERSAND: return "AMPERSAND";
case GLFW_KEY_APOSTROPHE: return "APOSTROPHE";
case GLFW_KEY_PARENTHESIS_LEFT: return "PARENTHESIS_LEFT";
case GLFW_KEY_PARENTHESIS_RIGHT: return "PARENTHESIS_RIGHT";
case GLFW_KEY_PLUS: return "PLUS";
case GLFW_KEY_COMMA: return "COMMA";
case GLFW_KEY_MINUS: return "MINUS";
case GLFW_KEY_PERIOD: return "PERIOD";
case GLFW_KEY_SLASH: return "SLASH";
case GLFW_KEY_0: return "0";
case GLFW_KEY_1: return "1";
case GLFW_KEY_2: return "2";
case GLFW_KEY_3: return "3";
case GLFW_KEY_4: return "4";
case GLFW_KEY_5: return "5";
case GLFW_KEY_6: return "6";
case GLFW_KEY_7: return "7";
case GLFW_KEY_8: return "8";
case GLFW_KEY_9: return "9";
case GLFW_KEY_COLON: return "COLON";
case GLFW_KEY_SEMICOLON: return "SEMICOLON";
case GLFW_KEY_LESS: return "LESS";
case GLFW_KEY_EQUAL: return "EQUAL";
case GLFW_KEY_GREATER: return "GREATER";
case GLFW_KEY_AT: return "AT";
case GLFW_KEY_A: return "A";
case GLFW_KEY_B: return "B";
case GLFW_KEY_C: return "C";
case GLFW_KEY_D: return "D";
case GLFW_KEY_E: return "E";
case GLFW_KEY_F: return "F";
case GLFW_KEY_G: return "G";
case GLFW_KEY_H: return "H";
case GLFW_KEY_I: return "I";
case GLFW_KEY_J: return "J";
case GLFW_KEY_K: return "K";
case GLFW_KEY_L: return "L";
case GLFW_KEY_M: return "M";
case GLFW_KEY_N: return "N";
case GLFW_KEY_O: return "O";
case GLFW_KEY_P: return "P";
case GLFW_KEY_Q: return "Q";
case GLFW_KEY_R: return "R";
case GLFW_KEY_S: return "S";
case GLFW_KEY_T: return "T";
case GLFW_KEY_U: return "U";
case GLFW_KEY_V: return "V";
case GLFW_KEY_W: return "W";
case GLFW_KEY_X: return "X";
case GLFW_KEY_Y: return "Y";
case GLFW_KEY_Z: return "Z";
case GLFW_KEY_LEFT_BRACKET: return "LEFT_BRACKET";
case GLFW_KEY_BACKSLASH: return "BACKSLASH";
case GLFW_KEY_RIGHT_BRACKET: return "RIGHT_BRACKET";
case GLFW_KEY_UNDERSCORE: return "UNDERSCORE";
case GLFW_KEY_GRAVE_ACCENT: return "GRAVE_ACCENT";
case GLFW_KEY_WORLD_1: return "WORLD_1";
case GLFW_KEY_WORLD_2: return "WORLD_2";
case GLFW_KEY_PARAGRAPH: return "PARAGRAPH";
case GLFW_KEY_MASCULINE: return "MASCULINE";
case GLFW_KEY_A_GRAVE: return "A_GRAVE";
case GLFW_KEY_A_DIAERESIS: return "A_DIAERESIS";
case GLFW_KEY_A_RING: return "A_RING";
case GLFW_KEY_AE: return "AE";
case GLFW_KEY_C_CEDILLA: return "C_CEDILLA";
case GLFW_KEY_E_GRAVE: return "E_GRAVE";
case GLFW_KEY_E_ACUTE: return "E_ACUTE";
case GLFW_KEY_I_GRAVE: return "I_GRAVE";
case GLFW_KEY_N_TILDE: return "N_TILDE";
case GLFW_KEY_O_GRAVE: return "O_GRAVE";
case GLFW_KEY_O_DIAERESIS: return "O_DIAERESIS";
case GLFW_KEY_O_SLASH: return "O_SLASH";
case GLFW_KEY_U_GRAVE: return "U_GRAVE";
case GLFW_KEY_U_DIAERESIS: return "U_DIAERESIS";
case GLFW_KEY_S_SHARP: return "S_SHARP";
case GLFW_KEY_CYRILLIC_A: return "CYRILLIC_A";
case GLFW_KEY_CYRILLIC_BE: return "CYRILLIC_BE";
case GLFW_KEY_CYRILLIC_VE: return "CYRILLIC_VE";
case GLFW_KEY_CYRILLIC_GHE: return "CYRILLIC_GHE";
case GLFW_KEY_CYRILLIC_DE: return "CYRILLIC_DE";
case GLFW_KEY_CYRILLIC_IE: return "CYRILLIC_IE";
case GLFW_KEY_CYRILLIC_ZHE: return "CYRILLIC_ZHE";
case GLFW_KEY_CYRILLIC_ZE: return "CYRILLIC_ZE";
case GLFW_KEY_CYRILLIC_I: return "CYRILLIC_I";
case GLFW_KEY_CYRILLIC_SHORT_I: return "CYRILLIC_SHORT_I";
case GLFW_KEY_CYRILLIC_KA: return "CYRILLIC_KA";
case GLFW_KEY_CYRILLIC_EL: return "CYRILLIC_EL";
case GLFW_KEY_CYRILLIC_EM: return "CYRILLIC_EM";
case GLFW_KEY_CYRILLIC_EN: return "CYRILLIC_EN";
case GLFW_KEY_CYRILLIC_O: return "CYRILLIC_O";
case GLFW_KEY_CYRILLIC_PE: return "CYRILLIC_PE";
case GLFW_KEY_CYRILLIC_ER: return "CYRILLIC_ER";
case GLFW_KEY_CYRILLIC_ES: return "CYRILLIC_ES";
case GLFW_KEY_CYRILLIC_TE: return "CYRILLIC_TE";
case GLFW_KEY_CYRILLIC_U: return "CYRILLIC_U";
case GLFW_KEY_CYRILLIC_EF: return "CYRILLIC_EF";
case GLFW_KEY_CYRILLIC_HA: return "CYRILLIC_HA";
case GLFW_KEY_CYRILLIC_TSE: return "CYRILLIC_TSE";
case GLFW_KEY_CYRILLIC_CHE: return "CYRILLIC_CHE";
case GLFW_KEY_CYRILLIC_SHA: return "CYRILLIC_SHA";
case GLFW_KEY_CYRILLIC_SHCHA: return "CYRILLIC_SHCHA";
case GLFW_KEY_CYRILLIC_HARD_SIGN: return "CYRILLIC_HARD_SIGN";
case GLFW_KEY_CYRILLIC_YERU: return "CYRILLIC_YERU";
case GLFW_KEY_CYRILLIC_SOFT_SIGN: return "CYRILLIC_SOFT_SIGN";
case GLFW_KEY_CYRILLIC_E: return "CYRILLIC_E";
case GLFW_KEY_CYRILLIC_YU: return "CYRILLIC_YU";
case GLFW_KEY_CYRILLIC_YA: return "CYRILLIC_YA";
case GLFW_KEY_CYRILLIC_IO: return "CYRILLIC_IO";
// Function keys
case GLFW_KEY_ESCAPE: return "ESCAPE";
case GLFW_KEY_F1: return "F1";
case GLFW_KEY_F2: return "F2";
case GLFW_KEY_F3: return "F3";
case GLFW_KEY_F4: return "F4";
case GLFW_KEY_F5: return "F5";
case GLFW_KEY_F6: return "F6";
case GLFW_KEY_F7: return "F7";
case GLFW_KEY_F8: return "F8";
case GLFW_KEY_F9: return "F9";
case GLFW_KEY_F10: return "F10";
case GLFW_KEY_F11: return "F11";
case GLFW_KEY_F12: return "F12";
case GLFW_KEY_F13: return "F13";
case GLFW_KEY_F14: return "F14";
case GLFW_KEY_F15: return "F15";
case GLFW_KEY_F16: return "F16";
case GLFW_KEY_F17: return "F17";
case GLFW_KEY_F18: return "F18";
case GLFW_KEY_F19: return "F19";
case GLFW_KEY_F20: return "F20";
case GLFW_KEY_F21: return "F21";
case GLFW_KEY_F22: return "F22";
case GLFW_KEY_F23: return "F23";
case GLFW_KEY_F24: return "F24";
case GLFW_KEY_F25: return "F25";
case GLFW_KEY_UP: return "UP";
case GLFW_KEY_DOWN: return "DOWN";
case GLFW_KEY_LEFT: return "LEFT";
case GLFW_KEY_RIGHT: return "RIGHT";
case GLFW_KEY_LEFT_SHIFT: return "LEFT SHIFT";
case GLFW_KEY_RIGHT_SHIFT: return "RIGHT SHIFT";
case GLFW_KEY_LEFT_CONTROL: return "LEFT CONTROL";
case GLFW_KEY_RIGHT_CONTROL: return "RIGHT CONTROL";
case GLFW_KEY_LEFT_ALT: return "LEFT ALT";
case GLFW_KEY_RIGHT_ALT: return "RIGHT ALT";
case GLFW_KEY_TAB: return "TAB";
case GLFW_KEY_ENTER: return "ENTER";
case GLFW_KEY_BACKSPACE: return "BACKSPACE";
case GLFW_KEY_INSERT: return "INSERT";
case GLFW_KEY_DELETE: return "DELETE";
case GLFW_KEY_PAGE_UP: return "PAGE UP";
case GLFW_KEY_PAGE_DOWN: return "PAGE DOWN";
case GLFW_KEY_HOME: return "HOME";
case GLFW_KEY_END: return "END";
case GLFW_KEY_KP_0: return "KEYPAD 0";
case GLFW_KEY_KP_1: return "KEYPAD 1";
case GLFW_KEY_KP_2: return "KEYPAD 2";
case GLFW_KEY_KP_3: return "KEYPAD 3";
case GLFW_KEY_KP_4: return "KEYPAD 4";
case GLFW_KEY_KP_5: return "KEYPAD 5";
case GLFW_KEY_KP_6: return "KEYPAD 6";
case GLFW_KEY_KP_7: return "KEYPAD 7";
case GLFW_KEY_KP_8: return "KEYPAD 8";
case GLFW_KEY_KP_9: return "KEYPAD 9";
case GLFW_KEY_KP_DIVIDE: return "KEYPAD DIVIDE";
case GLFW_KEY_KP_MULTIPLY: return "KEYPAD MULTIPLY";
case GLFW_KEY_KP_SUBTRACT: return "KEYPAD SUBTRACT";
case GLFW_KEY_KP_ADD: return "KEYPAD ADD";
case GLFW_KEY_KP_DECIMAL: return "KEYPAD DECIMAL";
case GLFW_KEY_KP_EQUAL: return "KEYPAD EQUAL";
case GLFW_KEY_KP_ENTER: return "KEYPAD ENTER";
case GLFW_KEY_PRINT_SCREEN: return "PRINT SCREEN";
case GLFW_KEY_NUM_LOCK: return "NUM LOCK";
case GLFW_KEY_CAPS_LOCK: return "CAPS LOCK";
case GLFW_KEY_SCROLL_LOCK: return "SCROLL LOCK";
case GLFW_KEY_PAUSE: return "PAUSE";
case GLFW_KEY_LEFT_SUPER: return "LEFT SUPER";
case GLFW_KEY_RIGHT_SUPER: return "RIGHT SUPER";
case GLFW_KEY_MENU: return "MENU";
case GLFW_KEY_ESCAPE: return "ESCAPE";
case GLFW_KEY_F1: return "F1";
case GLFW_KEY_F2: return "F2";
case GLFW_KEY_F3: return "F3";
case GLFW_KEY_F4: return "F4";
case GLFW_KEY_F5: return "F5";
case GLFW_KEY_F6: return "F6";
case GLFW_KEY_F7: return "F7";
case GLFW_KEY_F8: return "F8";
case GLFW_KEY_F9: return "F9";
case GLFW_KEY_F10: return "F10";
case GLFW_KEY_F11: return "F11";
case GLFW_KEY_F12: return "F12";
case GLFW_KEY_F13: return "F13";
case GLFW_KEY_F14: return "F14";
case GLFW_KEY_F15: return "F15";
case GLFW_KEY_F16: return "F16";
case GLFW_KEY_F17: return "F17";
case GLFW_KEY_F18: return "F18";
case GLFW_KEY_F19: return "F19";
case GLFW_KEY_F20: return "F20";
case GLFW_KEY_F21: return "F21";
case GLFW_KEY_F22: return "F22";
case GLFW_KEY_F23: return "F23";
case GLFW_KEY_F24: return "F24";
case GLFW_KEY_F25: return "F25";
case GLFW_KEY_UP: return "UP";
case GLFW_KEY_DOWN: return "DOWN";
case GLFW_KEY_LEFT: return "LEFT";
case GLFW_KEY_RIGHT: return "RIGHT";
case GLFW_KEY_LEFT_SHIFT: return "LEFT SHIFT";
case GLFW_KEY_RIGHT_SHIFT: return "RIGHT SHIFT";
case GLFW_KEY_LEFT_CONTROL: return "LEFT CONTROL";
case GLFW_KEY_RIGHT_CONTROL: return "RIGHT CONTROL";
case GLFW_KEY_LEFT_ALT: return "LEFT ALT";
case GLFW_KEY_RIGHT_ALT: return "RIGHT ALT";
case GLFW_KEY_TAB: return "TAB";
case GLFW_KEY_ENTER: return "ENTER";
case GLFW_KEY_BACKSPACE: return "BACKSPACE";
case GLFW_KEY_INSERT: return "INSERT";
case GLFW_KEY_DELETE: return "DELETE";
case GLFW_KEY_PAGE_UP: return "PAGE UP";
case GLFW_KEY_PAGE_DOWN: return "PAGE DOWN";
case GLFW_KEY_HOME: return "HOME";
case GLFW_KEY_END: return "END";
case GLFW_KEY_KP_0: return "KEYPAD 0";
case GLFW_KEY_KP_1: return "KEYPAD 1";
case GLFW_KEY_KP_2: return "KEYPAD 2";
case GLFW_KEY_KP_3: return "KEYPAD 3";
case GLFW_KEY_KP_4: return "KEYPAD 4";
case GLFW_KEY_KP_5: return "KEYPAD 5";
case GLFW_KEY_KP_6: return "KEYPAD 6";
case GLFW_KEY_KP_7: return "KEYPAD 7";
case GLFW_KEY_KP_8: return "KEYPAD 8";
case GLFW_KEY_KP_9: return "KEYPAD 9";
case GLFW_KEY_KP_DIVIDE: return "KEYPAD DIVIDE";
case GLFW_KEY_KP_MULTIPLY: return "KEYPAD MULTIPLY";
case GLFW_KEY_KP_SUBTRACT: return "KEYPAD SUBTRACT";
case GLFW_KEY_KP_ADD: return "KEYPAD ADD";
case GLFW_KEY_KP_DECIMAL: return "KEYPAD DECIMAL";
case GLFW_KEY_KP_EQUAL: return "KEYPAD EQUAL";
case GLFW_KEY_KP_ENTER: return "KEYPAD ENTER";
case GLFW_KEY_PRINT_SCREEN: return "PRINT SCREEN";
case GLFW_KEY_NUM_LOCK: return "NUM LOCK";
case GLFW_KEY_CAPS_LOCK: return "CAPS LOCK";
case GLFW_KEY_SCROLL_LOCK: return "SCROLL LOCK";
case GLFW_KEY_PAUSE: return "PAUSE";
case GLFW_KEY_LEFT_SUPER: return "LEFT SUPER";
case GLFW_KEY_RIGHT_SUPER: return "RIGHT SUPER";
case GLFW_KEY_MENU: return "MENU";
default: return "UNKNOWN";
default: return "UNKNOWN";
}
}
@@ -691,7 +752,7 @@ GLFWAPI const char* glfwGetKeyName(int key, int scancode)
{
if (key != GLFW_KEY_KP_EQUAL &&
(key < GLFW_KEY_KP_0 || key > GLFW_KEY_KP_ADD) &&
(key < GLFW_KEY_APOSTROPHE || key > GLFW_KEY_WORLD_2))
(key < GLFW_KEY_APOSTROPHE || key > GLFW_KEY_LAST_PRINTABLE))
{
return NULL;
}

4
glfw/monitor.c vendored
View File

@@ -56,6 +56,10 @@ static int compareVideoModes(const void* fp, const void* sp)
if (farea != sarea)
return farea - sarea;
// Then sort on width
if (fm->width != sm->width)
return fm->width - sm->width;
// Lastly sort on refresh rate
return fm->refreshRate - sm->refreshRate;
}

View File

@@ -33,12 +33,12 @@
////// GLFW platform API //////
//////////////////////////////////////////////////////////////////////////
int _glfwPlatformPollJoystick(_GLFWjoystick* js, int mode)
int _glfwPlatformPollJoystick(_GLFWjoystick* js UNUSED, int mode UNUSED)
{
return false;
}
void _glfwPlatformUpdateGamepadGUID(char* guid)
void _glfwPlatformUpdateGamepadGUID(char* guid UNUSED)
{
}

20
glfw/null_monitor.c vendored
View File

@@ -34,15 +34,15 @@
////// GLFW platform API //////
//////////////////////////////////////////////////////////////////////////
void _glfwPlatformFreeMonitor(_GLFWmonitor* monitor)
void _glfwPlatformFreeMonitor(_GLFWmonitor* monitor UNUSED)
{
}
void _glfwPlatformGetMonitorPos(_GLFWmonitor* monitor, int* xpos, int* ypos)
void _glfwPlatformGetMonitorPos(_GLFWmonitor* monitor UNUSED, int* xpos UNUSED, int* ypos UNUSED)
{
}
void _glfwPlatformGetMonitorContentScale(_GLFWmonitor* monitor,
void _glfwPlatformGetMonitorContentScale(_GLFWmonitor* monitor UNUSED,
float* xscale, float* yscale)
{
if (xscale)
@@ -51,27 +51,27 @@ void _glfwPlatformGetMonitorContentScale(_GLFWmonitor* monitor,
*yscale = 1.f;
}
void _glfwPlatformGetMonitorWorkarea(_GLFWmonitor* monitor,
int* xpos, int* ypos,
int* width, int* height)
void _glfwPlatformGetMonitorWorkarea(_GLFWmonitor* monitor UNUSED,
int* xpos UNUSED, int* ypos UNUSED,
int* width UNUSED, int* height UNUSED)
{
}
GLFWvidmode* _glfwPlatformGetVideoModes(_GLFWmonitor* monitor, int* found)
GLFWvidmode* _glfwPlatformGetVideoModes(_GLFWmonitor* monitor UNUSED, int* found UNUSED)
{
return NULL;
}
void _glfwPlatformGetVideoMode(_GLFWmonitor* monitor, GLFWvidmode* mode)
void _glfwPlatformGetVideoMode(_GLFWmonitor* monitor UNUSED, GLFWvidmode* mode UNUSED)
{
}
bool _glfwPlatformGetGammaRamp(_GLFWmonitor* monitor, GLFWgammaramp* ramp)
bool _glfwPlatformGetGammaRamp(_GLFWmonitor* monitor UNUSED, GLFWgammaramp* ramp UNUSED)
{
return false;
}
void _glfwPlatformSetGammaRamp(_GLFWmonitor* monitor, const GLFWgammaramp* ramp)
void _glfwPlatformSetGammaRamp(_GLFWmonitor* monitor UNUSED, const GLFWgammaramp* ramp UNUSED)
{
}

122
glfw/null_window.c vendored
View File

@@ -78,28 +78,28 @@ void _glfwPlatformDestroyWindow(_GLFWwindow* window)
window->context.destroy(window);
}
void _glfwPlatformSetWindowTitle(_GLFWwindow* window, const char* title)
void _glfwPlatformSetWindowTitle(_GLFWwindow* window UNUSED, const char* title UNUSED)
{
}
void _glfwPlatformSetWindowIcon(_GLFWwindow* window, int count,
const GLFWimage* images)
void _glfwPlatformSetWindowIcon(_GLFWwindow* window UNUSED, int count UNUSED,
const GLFWimage* images UNUSED)
{
}
void _glfwPlatformSetWindowMonitor(_GLFWwindow* window,
_GLFWmonitor* monitor,
int xpos, int ypos,
int width, int height,
int refreshRate)
void _glfwPlatformSetWindowMonitor(_GLFWwindow* window UNUSED,
_GLFWmonitor* monitor UNUSED,
int xpos UNUSED, int ypos UNUSED,
int width UNUSED, int height UNUSED,
int refreshRate UNUSED)
{
}
void _glfwPlatformGetWindowPos(_GLFWwindow* window, int* xpos, int* ypos)
void _glfwPlatformGetWindowPos(_GLFWwindow* window UNUSED, int* xpos UNUSED, int* ypos UNUSED)
{
}
void _glfwPlatformSetWindowPos(_GLFWwindow* window, int xpos, int ypos)
void _glfwPlatformSetWindowPos(_GLFWwindow* window UNUSED, int xpos UNUSED, int ypos UNUSED)
{
}
@@ -117,13 +117,13 @@ void _glfwPlatformSetWindowSize(_GLFWwindow* window, int width, int height)
window->null.height = height;
}
void _glfwPlatformSetWindowSizeLimits(_GLFWwindow* window,
int minwidth, int minheight,
int maxwidth, int maxheight)
void _glfwPlatformSetWindowSizeLimits(_GLFWwindow* window UNUSED,
int minwidth UNUSED, int minheight UNUSED,
int maxwidth UNUSED, int maxheight UNUSED)
{
}
void _glfwPlatformSetWindowAspectRatio(_GLFWwindow* window, int n, int d)
void _glfwPlatformSetWindowAspectRatio(_GLFWwindow* window UNUSED, int n UNUSED, int d UNUSED)
{
}
@@ -135,13 +135,13 @@ void _glfwPlatformGetFramebufferSize(_GLFWwindow* window, int* width, int* heigh
*height = window->null.height;
}
void _glfwPlatformGetWindowFrameSize(_GLFWwindow* window,
int* left, int* top,
int* right, int* bottom)
void _glfwPlatformGetWindowFrameSize(_GLFWwindow* window UNUSED,
int* left UNUSED, int* top UNUSED,
int* right UNUSED, int* bottom UNUSED)
{
}
void _glfwPlatformGetWindowContentScale(_GLFWwindow* window,
void _glfwPlatformGetWindowContentScale(_GLFWwindow* window UNUSED,
float* xscale, float* yscale)
{
if (xscale)
@@ -150,101 +150,101 @@ void _glfwPlatformGetWindowContentScale(_GLFWwindow* window,
*yscale = 1.f;
}
double _glfwPlatformGetDoubleClickInterval(_GLFWwindow* window)
double _glfwPlatformGetDoubleClickInterval(_GLFWwindow* window UNUSED)
{
return 0.5;
}
void _glfwPlatformIconifyWindow(_GLFWwindow* window)
void _glfwPlatformIconifyWindow(_GLFWwindow* window UNUSED)
{
}
void _glfwPlatformRestoreWindow(_GLFWwindow* window)
void _glfwPlatformRestoreWindow(_GLFWwindow* window UNUSED)
{
}
void _glfwPlatformMaximizeWindow(_GLFWwindow* window)
void _glfwPlatformMaximizeWindow(_GLFWwindow* window UNUSED)
{
}
int _glfwPlatformWindowMaximized(_GLFWwindow* window)
int _glfwPlatformWindowMaximized(_GLFWwindow* window UNUSED)
{
return false;
}
int _glfwPlatformWindowHovered(_GLFWwindow* window)
int _glfwPlatformWindowHovered(_GLFWwindow* window UNUSED)
{
return false;
}
int _glfwPlatformFramebufferTransparent(_GLFWwindow* window)
int _glfwPlatformFramebufferTransparent(_GLFWwindow* window UNUSED)
{
return false;
}
void _glfwPlatformSetWindowResizable(_GLFWwindow* window, bool enabled)
void _glfwPlatformSetWindowResizable(_GLFWwindow* window UNUSED, bool enabled UNUSED)
{
}
void _glfwPlatformSetWindowDecorated(_GLFWwindow* window, bool enabled)
void _glfwPlatformSetWindowDecorated(_GLFWwindow* window UNUSED, bool enabled UNUSED)
{
}
void _glfwPlatformSetWindowFloating(_GLFWwindow* window, bool enabled)
void _glfwPlatformSetWindowFloating(_GLFWwindow* window UNUSED, bool enabled UNUSED)
{
}
float _glfwPlatformGetWindowOpacity(_GLFWwindow* window)
float _glfwPlatformGetWindowOpacity(_GLFWwindow* window UNUSED)
{
return 1.f;
}
void _glfwPlatformSetWindowOpacity(_GLFWwindow* window, float opacity)
void _glfwPlatformSetWindowOpacity(_GLFWwindow* window UNUSED, float opacity UNUSED)
{
}
void _glfwPlatformShowWindow(_GLFWwindow* window)
void _glfwPlatformShowWindow(_GLFWwindow* window UNUSED)
{
}
void _glfwPlatformRequestWindowAttention(_GLFWwindow* window)
void _glfwPlatformRequestWindowAttention(_GLFWwindow* window UNUSED)
{
}
int _glfwPlatformWindowBell(_GLFWwindow* window)
int _glfwPlatformWindowBell(_GLFWwindow* window UNUSED)
{
return false;
}
void _glfwPlatformUnhideWindow(_GLFWwindow* window)
void _glfwPlatformUnhideWindow(_GLFWwindow* window UNUSED)
{
}
void _glfwPlatformHideWindow(_GLFWwindow* window)
void _glfwPlatformHideWindow(_GLFWwindow* window UNUSED)
{
}
void _glfwPlatformFocusWindow(_GLFWwindow* window)
void _glfwPlatformFocusWindow(_GLFWwindow* window UNUSED)
{
}
int _glfwPlatformWindowFocused(_GLFWwindow* window)
int _glfwPlatformWindowFocused(_GLFWwindow* window UNUSED)
{
return false;
}
int _glfwPlatformWindowOccluded(_GLFWwindow* window)
int _glfwPlatformWindowOccluded(_GLFWwindow* window UNUSED)
{
return false;
}
int _glfwPlatformWindowIconified(_GLFWwindow* window)
int _glfwPlatformWindowIconified(_GLFWwindow* window UNUSED)
{
return false;
}
int _glfwPlatformWindowVisible(_GLFWwindow* window)
int _glfwPlatformWindowVisible(_GLFWwindow* window UNUSED)
{
return false;
}
@@ -257,7 +257,7 @@ void _glfwPlatformWaitEvents(void)
{
}
void _glfwPlatformWaitEventsTimeout(double timeout)
void _glfwPlatformWaitEventsTimeout(double timeout UNUSED)
{
}
@@ -265,39 +265,39 @@ void _glfwPlatformPostEmptyEvent(void)
{
}
void _glfwPlatformGetCursorPos(_GLFWwindow* window, double* xpos, double* ypos)
void _glfwPlatformGetCursorPos(_GLFWwindow* window UNUSED, double* xpos UNUSED, double* ypos UNUSED)
{
}
void _glfwPlatformSetCursorPos(_GLFWwindow* window, double x, double y)
void _glfwPlatformSetCursorPos(_GLFWwindow* window UNUSED, double x UNUSED, double y UNUSED)
{
}
void _glfwPlatformSetCursorMode(_GLFWwindow* window, int mode)
void _glfwPlatformSetCursorMode(_GLFWwindow* window UNUSED, int mode UNUSED)
{
}
int _glfwPlatformCreateCursor(_GLFWcursor* cursor,
const GLFWimage* image,
int xhot, int yhot, int count)
int _glfwPlatformCreateCursor(_GLFWcursor* cursor UNUSED,
const GLFWimage* image UNUSED,
int xhot UNUSED, int yhot UNUSED, int count UNUSED)
{
return true;
}
int _glfwPlatformCreateStandardCursor(_GLFWcursor* cursor, int shape)
int _glfwPlatformCreateStandardCursor(_GLFWcursor* cursor UNUSED, int shape UNUSED)
{
return true;
}
void _glfwPlatformDestroyCursor(_GLFWcursor* cursor)
void _glfwPlatformDestroyCursor(_GLFWcursor* cursor UNUSED)
{
}
void _glfwPlatformSetCursor(_GLFWwindow* window, _GLFWcursor* cursor)
void _glfwPlatformSetCursor(_GLFWwindow* window UNUSED, _GLFWcursor* cursor UNUSED)
{
}
void _glfwPlatformSetClipboardString(const char* string)
void _glfwPlatformSetClipboardString(const char* string UNUSED)
{
}
@@ -306,31 +306,31 @@ const char* _glfwPlatformGetClipboardString(void)
return NULL;
}
const char* _glfwPlatformGetScancodeName(int scancode)
const char* _glfwPlatformGetScancodeName(int scancode UNUSED)
{
return "";
}
int _glfwPlatformGetKeyScancode(int key)
int _glfwPlatformGetKeyScancode(int key UNUSED)
{
return -1;
}
void _glfwPlatformGetRequiredInstanceExtensions(char** extensions)
void _glfwPlatformGetRequiredInstanceExtensions(char** extensions UNUSED)
{
}
int _glfwPlatformGetPhysicalDevicePresentationSupport(VkInstance instance,
VkPhysicalDevice device,
uint32_t queuefamily)
int _glfwPlatformGetPhysicalDevicePresentationSupport(VkInstance instance UNUSED,
VkPhysicalDevice device UNUSED,
uint32_t queuefamily UNUSED)
{
return false;
}
VkResult _glfwPlatformCreateWindowSurface(VkInstance instance,
_GLFWwindow* window,
const VkAllocationCallbacks* allocator,
VkSurfaceKHR* surface)
VkResult _glfwPlatformCreateWindowSurface(VkInstance instance UNUSED,
_GLFWwindow* window UNUSED,
const VkAllocationCallbacks* allocator UNUSED,
VkSurfaceKHR* surface UNUSED)
{
// This seems like the most appropriate error to return here
return VK_ERROR_INITIALIZATION_FAILED;

116
glfw/xkb_glfw.c vendored
View File

@@ -37,19 +37,130 @@ START_ALLOW_CASE_RANGE
#define map_key(key) \
switch(key) { \
S(space, SPACE); \
S(exclam, EXCLAM); \
S(quotedbl, DOUBLE_QUOTE); \
S(numbersign, NUMBER_SIGN); \
S(dollar, DOLLAR); \
S(ampersand, AMPERSAND); \
S(apostrophe, APOSTROPHE); \
S(parenleft, PARENTHESIS_LEFT); \
S(parenright, PARENTHESIS_RIGHT); \
S(plus, PLUS); \
S(comma, COMMA); \
S(minus, MINUS); \
S(period, PERIOD); \
S(slash, SLASH); \
R(0, 9, 0, 9); \
S(colon, COLON); \
S(semicolon, SEMICOLON); \
S(less, LESS); \
S(equal, EQUAL); \
S(greater, GREATER); \
S(at, AT); \
D(A, Z, A, Z); \
S(bracketleft, LEFT_BRACKET); \
S(backslash, BACKSLASH); \
S(bracketright, RIGHT_BRACKET); \
S(plus, PLUS); \
S(underscore, UNDERSCORE); \
S(grave, GRAVE_ACCENT); \
R(a, z, A, Z); \
S(paragraph, PARAGRAPH); \
S(masculine, MASCULINE); \
S(agrave, A_GRAVE); \
F(Agrave, A_GRAVE); \
S(adiaeresis, A_DIAERESIS); \
F(Adiaeresis, A_DIAERESIS); \
S(aring, A_RING); \
F(Aring, A_RING); \
S(ae, AE); \
F(AE, AE); \
S(ccedilla, C_CEDILLA); \
F(Ccedilla, C_CEDILLA); \
S(egrave, E_GRAVE); \
F(Egrave, E_GRAVE); \
S(aacute, E_ACUTE); \
F(Eacute, E_ACUTE); \
S(igrave, I_GRAVE); \
F(Igrave, I_GRAVE); \
S(ntilde, N_TILDE); \
F(Ntilde, N_TILDE); \
S(ograve, O_GRAVE); \
F(Ograve, O_GRAVE); \
S(odiaeresis, O_DIAERESIS); \
F(Odiaeresis, O_DIAERESIS); \
S(oslash, O_SLASH); \
F(Oslash, O_SLASH); \
S(ugrave, U_GRAVE); \
F(Ugrave, U_GRAVE); \
S(udiaeresis, U_DIAERESIS); \
F(Udiaeresis, U_DIAERESIS); \
S(ssharp, S_SHARP); \
S(Cyrillic_a, CYRILLIC_A); \
F(Cyrillic_A, CYRILLIC_A); \
S(Cyrillic_be, CYRILLIC_BE); \
F(Cyrillic_BE, CYRILLIC_BE); \
S(Cyrillic_ve, CYRILLIC_VE); \
F(Cyrillic_VE, CYRILLIC_VE); \
S(Cyrillic_ghe, CYRILLIC_GHE); \
F(Cyrillic_GHE, CYRILLIC_GHE); \
S(Cyrillic_de, CYRILLIC_DE); \
F(Cyrillic_DE, CYRILLIC_DE); \
S(Cyrillic_ie, CYRILLIC_IE); \
F(Cyrillic_IE, CYRILLIC_IE); \
S(Cyrillic_zhe, CYRILLIC_ZHE); \
F(Cyrillic_ZHE, CYRILLIC_ZHE); \
S(Cyrillic_ze, CYRILLIC_ZE); \
F(Cyrillic_ZE, CYRILLIC_ZE); \
S(Cyrillic_i, CYRILLIC_I); \
F(Cyrillic_I, CYRILLIC_I); \
S(Cyrillic_shorti, CYRILLIC_SHORT_I); \
F(Cyrillic_SHORTI, CYRILLIC_SHORT_I); \
S(Cyrillic_ka, CYRILLIC_KA); \
F(Cyrillic_KA, CYRILLIC_KA); \
S(Cyrillic_el, CYRILLIC_EL); \
F(Cyrillic_EL, CYRILLIC_EL); \
S(Cyrillic_em, CYRILLIC_EM); \
F(Cyrillic_EM, CYRILLIC_EM); \
S(Cyrillic_en, CYRILLIC_EN); \
F(Cyrillic_EN, CYRILLIC_EN); \
S(Cyrillic_o, CYRILLIC_O); \
F(Cyrillic_O, CYRILLIC_O); \
S(Cyrillic_pe, CYRILLIC_PE); \
F(Cyrillic_PE, CYRILLIC_PE); \
S(Cyrillic_er, CYRILLIC_ER); \
F(Cyrillic_ER, CYRILLIC_ER); \
S(Cyrillic_es, CYRILLIC_ES); \
F(Cyrillic_ES, CYRILLIC_ES); \
S(Cyrillic_te, CYRILLIC_TE); \
F(Cyrillic_TE, CYRILLIC_TE); \
S(Cyrillic_u, CYRILLIC_U); \
F(Cyrillic_U, CYRILLIC_U); \
S(Cyrillic_ef, CYRILLIC_EF); \
F(Cyrillic_EF, CYRILLIC_EF); \
S(Cyrillic_ha, CYRILLIC_HA); \
F(Cyrillic_HA, CYRILLIC_HA); \
S(Cyrillic_tse, CYRILLIC_TSE); \
F(Cyrillic_TSE, CYRILLIC_TSE); \
S(Cyrillic_che, CYRILLIC_CHE); \
F(Cyrillic_CHE, CYRILLIC_CHE); \
S(Cyrillic_sha, CYRILLIC_SHA); \
F(Cyrillic_SHA, CYRILLIC_SHA); \
S(Cyrillic_shcha, CYRILLIC_SHCHA); \
F(Cyrillic_SHCHA, CYRILLIC_SHCHA); \
S(Cyrillic_hardsign, CYRILLIC_HARD_SIGN); \
F(Cyrillic_HARDSIGN, CYRILLIC_HARD_SIGN); \
S(Cyrillic_yeru, CYRILLIC_YERU); \
F(Cyrillic_YERU, CYRILLIC_YERU); \
S(Cyrillic_softsign, CYRILLIC_SOFT_SIGN); \
F(Cyrillic_SOFTSIGN, CYRILLIC_SOFT_SIGN); \
S(Cyrillic_e, CYRILLIC_E); \
F(Cyrillic_E, CYRILLIC_E); \
S(Cyrillic_yu, CYRILLIC_YU); \
F(Cyrillic_YU, CYRILLIC_YU); \
S(Cyrillic_ya, CYRILLIC_YA); \
F(Cyrillic_YA, CYRILLIC_YA); \
S(Cyrillic_io, CYRILLIC_IO); \
F(Cyrillic_IO, CYRILLIC_IO); \
S(Escape, ESCAPE); \
S(Return, ENTER); \
S(Tab, TAB); \
@@ -91,9 +202,6 @@ START_ALLOW_CASE_RANGE
S(Alt_R, RIGHT_ALT); \
S(Super_R, RIGHT_SUPER); \
S(Menu, MENU); \
R(0, 9, 0, 9); \
R(a, z, A, Z); \
D(A, Z, A, Z); \
R(F1, F25, F1, F25); \
R(KP_0, KP_9, KP_0, KP_9); \

View File

@@ -172,13 +172,15 @@ void main() {
foreground = color_to_vec(resolved_fg);
float has_dim = float((text_attrs >> DIM_SHIFT) & ONE);
effective_text_alpha = inactive_text_alpha * mix(1.0, dim_opacity, has_dim);
#ifdef USE_SELECTION_FG
// Selection
foreground = choose_color(float(is_selected & ONE), color_to_vec(highlight_fg), foreground);
#endif
// Underline and strike through (rendered via sprites)
float in_url = float((is_selected & TWO) >> 1);
decoration_fg = choose_color(in_url, color_to_vec(url_color), to_color(colors[2], resolved_fg));
#ifdef USE_SELECTION_FG
// Selection
vec3 selection_color = color_to_vec(highlight_fg);
foreground = choose_color(float(is_selected & ONE), selection_color, foreground);
decoration_fg = choose_color(float(is_selected & ONE), selection_color, decoration_fg);
#endif
// Underline and strike through (rendered via sprites)
underline_pos = choose_color(in_url, to_sprite_pos(pos, url_style, ZERO, ZERO), to_sprite_pos(pos, (text_attrs >> DECORATION_SHIFT) & THREE, ZERO, ZERO));
strike_pos = to_sprite_pos(pos, ((text_attrs >> STRIKE_SHIFT) & ONE) * FOUR, ZERO, ZERO);

View File

@@ -168,7 +168,7 @@ dealloc(ChildMonitor* self) {
static void
wakeup_io_loop(ChildMonitor *self, bool in_signal_handler) {
wakeup_loop(&self->io_loop_data, in_signal_handler);
wakeup_loop(&self->io_loop_data, in_signal_handler, "io_loop");
}
static void* io_loop(void *data);
@@ -526,7 +526,7 @@ update_window_title(Window *w, OSWindow *os_window) {
}
static inline bool
prepare_to_render_os_window(OSWindow *os_window, double now, unsigned int *active_window_id, color_type *active_window_bg, unsigned int *num_visible_windows) {
prepare_to_render_os_window(OSWindow *os_window, double now, unsigned int *active_window_id, color_type *active_window_bg, unsigned int *num_visible_windows, bool *all_windows_have_same_bg) {
#define TD os_window->tab_bar_render_data
bool needs_render = os_window->needs_render;
os_window->needs_render = false;
@@ -543,11 +543,17 @@ prepare_to_render_os_window(OSWindow *os_window, double now, unsigned int *activ
}
Tab *tab = os_window->tabs + os_window->active_tab;
*active_window_bg = OPT(background);
*all_windows_have_same_bg = true;
*num_visible_windows = 0;
color_type first_window_bg = 0;
for (unsigned int i = 0; i < tab->num_windows; i++) {
Window *w = tab->windows + i;
#define WD w->render_data
if (w->visible && WD.screen) {
*num_visible_windows += 1;
color_type window_bg = colorprofile_to_color(WD.screen->color_profile, WD.screen->color_profile->overridden.default_bg, WD.screen->color_profile->configured.default_bg);
if (*num_visible_windows == 1) first_window_bg = window_bg;
if (first_window_bg != window_bg) all_windows_have_same_bg = false;
if (w->last_drag_scroll_at > 0) {
if (now - w->last_drag_scroll_at >= 0.02) {
if (drag_scroll(w, os_window)) {
@@ -563,7 +569,7 @@ prepare_to_render_os_window(OSWindow *os_window, double now, unsigned int *activ
collect_cursor_info(&WD.screen->cursor_render_info, w, now, os_window);
if (w->cursor_visible_at_last_render != WD.screen->cursor_render_info.is_visible || w->last_cursor_x != WD.screen->cursor_render_info.x || w->last_cursor_y != WD.screen->cursor_render_info.y || w->last_cursor_shape != WD.screen->cursor_render_info.shape) needs_render = true;
update_window_title(w, os_window);
*active_window_bg = colorprofile_to_color(WD.screen->color_profile, WD.screen->color_profile->overridden.default_bg, WD.screen->color_profile->configured.default_bg);
*active_window_bg = window_bg;
} else WD.screen->cursor_render_info.is_visible = false;
if (send_cell_data_to_gpu(WD.vao_idx, WD.gvao_idx, WD.xstart, WD.ystart, WD.dx, WD.dy, WD.screen, os_window)) needs_render = true;
if (WD.screen->start_visual_bell_at != 0) needs_render = true;
@@ -573,7 +579,7 @@ prepare_to_render_os_window(OSWindow *os_window, double now, unsigned int *activ
}
static inline void
render_os_window(OSWindow *os_window, double now, unsigned int active_window_id, color_type active_window_bg, unsigned int num_visible_windows) {
render_os_window(OSWindow *os_window, double now, unsigned int active_window_id, color_type active_window_bg, unsigned int num_visible_windows, bool all_windows_have_same_bg) {
// ensure all pixels are cleared to background color at least once in every buffer
if (os_window->clear_count++ < 3) blank_os_window(os_window);
Tab *tab = os_window->tabs + os_window->active_tab;
@@ -585,7 +591,7 @@ render_os_window(OSWindow *os_window, double now, unsigned int active_window_id,
y_ratio = os_window->viewport_height / (double) os_window->live_resize.height;
}
if (!static_live_resize_in_progress) {
draw_borders(br->vao_idx, br->num_border_rects, br->rect_buf, br->is_dirty, os_window->viewport_width, os_window->viewport_height, active_window_bg, num_visible_windows, os_window);
draw_borders(br->vao_idx, br->num_border_rects, br->rect_buf, br->is_dirty, os_window->viewport_width, os_window->viewport_height, active_window_bg, num_visible_windows, all_windows_have_same_bg, os_window);
br->is_dirty = false;
}
if (TD.screen && os_window->num_tabs >= OPT(tab_bar_min_tabs)) draw_cells(TD.vao_idx, 0, TD.xstart, TD.ystart, TD.dx * x_ratio, TD.dy * y_ratio, TD.screen, os_window, true, false);
@@ -595,7 +601,7 @@ render_os_window(OSWindow *os_window, double now, unsigned int active_window_id,
bool is_active_window = i == tab->active_window;
draw_cells(WD.vao_idx, WD.gvao_idx, WD.xstart, WD.ystart, WD.dx * x_ratio, WD.dy * y_ratio, WD.screen, os_window, is_active_window, true);
if (WD.screen->start_visual_bell_at != 0) {
double bell_left = global_state.opts.visual_bell_duration - (now - WD.screen->start_visual_bell_at);
double bell_left = OPT(visual_bell_duration) - (now - WD.screen->start_visual_bell_at);
set_maximum_wait(bell_left);
}
w->cursor_visible_at_last_render = WD.screen->cursor_render_info.is_visible; w->last_cursor_x = WD.screen->cursor_render_info.x; w->last_cursor_y = WD.screen->cursor_render_info.y; w->last_cursor_shape = WD.screen->cursor_render_info.shape;
@@ -676,11 +682,12 @@ render(double now, bool input_read) {
needs_render = true;
}
unsigned int active_window_id = 0, num_visible_windows = 0;
bool all_windows_have_same_bg;
color_type active_window_bg = 0;
if (!w->fonts_data) { log_error("No fonts data found for window id: %llu", w->id); continue; }
if (prepare_to_render_os_window(w, now, &active_window_id, &active_window_bg, &num_visible_windows)) needs_render = true;
if (prepare_to_render_os_window(w, now, &active_window_id, &active_window_bg, &num_visible_windows, &all_windows_have_same_bg)) needs_render = true;
if (w->last_active_window_id != active_window_id || w->last_active_tab != w->active_tab || w->focused_at_last_render != w->is_focused) needs_render = true;
if (needs_render) render_os_window(w, now, active_window_id, active_window_bg, num_visible_windows);
if (needs_render) render_os_window(w, now, active_window_id, active_window_bg, num_visible_windows, all_windows_have_same_bg);
}
last_render_at = now;
#undef TD
@@ -1414,7 +1421,7 @@ prune_finished_writes(void) {
static void
wakeup_talk_loop(bool in_signal_handler) {
wakeup_loop(&talk_data.loop_data, in_signal_handler);
if (talk_thread_started) wakeup_loop(&talk_data.loop_data, in_signal_handler, "talk_loop");
}
static inline void

View File

@@ -514,7 +514,7 @@ Detach from the controlling terminal, if any
--session
Path to a file containing the startup :italic:`session` (tabs, windows, layout, programs).
See the README file for details and an example.
Use - to read from STDIN. See the README file for details and an example.
--hold

View File

@@ -36,12 +36,12 @@ init_FG_BG_table(void) {
// colors 16..232: the 6x6x6 color cube
const uint8_t valuerange[6] = {0x00, 0x5f, 0x87, 0xaf, 0xd7, 0xff};
uint8_t i, j=16;
for(i = 0; i < 217; i++, j++) {
for(i = 0; i < 216; i++, j++) {
uint8_t r = valuerange[(i / 36) % 6], g = valuerange[(i / 6) % 6], b = valuerange[i % 6];
FG_BG_256[j] = (r << 16) | (g << 8) | b;
}
// colors 233..255: grayscale
for(i = 1; i < 24; i++, j++) {
// colors 232..255: grayscale
for(i = 0; i < 24; i++, j++) {
uint8_t v = 8 + i * 10;
FG_BG_256[j] = (v << 16) | (v << 8) | v;
}

View File

@@ -185,11 +185,37 @@ def kitty_cli_opts(ans, prefix=None):
def complete_kitty_cli_arg(ans, opt, prefix):
prefix = prefix or ''
if opt and opt['dest'] == 'override':
if not opt:
return
dest = opt['dest']
if dest == 'override':
from kitty.config import option_names_for_completion
k = 'Config directives'
ans.match_groups[k] = {k+'=': None for k in option_names_for_completion() if k.startswith(prefix)}
ans.no_space_groups.add(k)
elif dest == 'config':
def is_conf_file(x):
if os.path.isdir(x):
return True
return x.lower().endswith('.conf')
complete_files_and_dirs(ans, prefix, files_group_name='Config files', predicate=is_conf_file)
elif dest == 'session':
complete_files_and_dirs(ans, prefix, files_group_name='Session files')
elif dest == 'directory':
complete_files_and_dirs(ans, prefix, files_group_name='Directories', predicate=os.path.isdir)
elif dest == 'start_as':
k = 'Start as'
ans.match_groups[k] = {x: x for x in 'normal,fullscreen,maximized,minimized'.split(',') if x.startswith(prefix)}
ans.no_space_groups.add(k)
elif dest == 'listen_on':
if ':' not in prefix:
k = 'Address type'
ans.match_groups[k] = {x: x for x in ('unix:', 'tcp:') if x.startswith(prefix)}
ans.no_space_groups.add(k)
elif prefix.startswith('unix:') and not prefix.startswith('@'):
complete_files_and_dirs(ans, prefix[len('unix:'):], files_group_name='UNIX sockets', add_prefix='unix:')
def complete_alias_map(ans, words, new_word, option_map, complete_args=None):
@@ -273,9 +299,12 @@ def path_completion(prefix=''):
return dirs, files
def complete_files_and_dirs(ans, prefix, files_group_name='Files', predicate=None):
def complete_files_and_dirs(ans, prefix, files_group_name='Files', predicate=None, add_prefix=None):
dirs, files = path_completion(prefix or '')
files = filter(predicate, files)
if add_prefix:
dirs = (add_prefix + x for x in dirs)
files = (add_prefix + x for x in files)
if dirs:
ans.match_groups['Directories'] = dict.fromkeys(dirs)

View File

@@ -20,21 +20,7 @@ from .conf.utils import (
from .config_data import all_options, parse_mods, type_map
from .constants import cache_dir, defconf, is_macos
from .utils import log_error
from .key_names import get_key_name_lookup
named_keys = {
"'": 'APOSTROPHE',
',': 'COMMA',
'-': 'MINUS',
'_': 'UNDERSCORE',
'.': 'PERIOD',
'/': 'SLASH',
';': 'SEMICOLON',
'=': 'EQUAL',
'[': 'LEFT_BRACKET',
']': 'RIGHT_BRACKET',
'`': 'GRAVE_ACCENT'
}
from .key_names import get_key_name_lookup, key_name_aliases
def parse_shortcut(sc):
@@ -45,7 +31,7 @@ def parse_shortcut(sc):
if mods is None:
return None, None, None
key = parts[-1].upper()
key = getattr(defines, 'GLFW_KEY_' + named_keys.get(key, key), None)
key = getattr(defines, 'GLFW_KEY_' + key_name_aliases.get(key, key), None)
is_native = False
if key is None:
q = parts[-1]

View File

@@ -1100,7 +1100,9 @@ with::
'''))
if is_macos:
k('new_window', 'cmd+enter', 'new_window', _('New window'), add_to_docs=False)
k('new_os_window', 'kitty_mod+n', 'new_os_window', _('New OS window'))
k('new_os_window', 'kitty_mod+n', 'new_os_window', _('New OS window'), _(
'Works like new_window above, except that it opens a top level OS kitty window.'
' In particular you can use new_os_window_with_cwd to open a window with the current working directory.'))
if is_macos:
k('new_os_window', 'cmd+n', 'new_os_window', _('New OS window'), add_to_docs=False)
k('close_window', 'kitty_mod+w', 'close_window', _('Close window'))

View File

@@ -9,7 +9,7 @@ from collections import namedtuple
from contextlib import suppress
appname = 'kitty'
version = (0, 14, 4)
version = (0, 14, 6)
str_version = '.'.join(map(str, version))
_plat = sys.platform.lower()
is_macos = 'darwin' in _plat

View File

@@ -437,7 +437,7 @@ render_glyphs(CTFontRef font, unsigned int width, unsigned int height, unsigned
CGContextSetShouldSmoothFonts(render_ctx, true);
CGContextSetGrayFillColor(render_ctx, 1, 1); // white glyphs
CGContextSetGrayStrokeColor(render_ctx, 1, 1);
CGContextSetLineWidth(render_ctx, global_state.opts.macos_thicken_font);
CGContextSetLineWidth(render_ctx, OPT(macos_thicken_font));
CGContextSetTextDrawingMode(render_ctx, kCGTextFillStroke);
CGContextSetTextMatrix(render_ctx, CGAffineTransformIdentity);
CGContextSetTextPosition(render_ctx, 0, height - baseline);

View File

@@ -83,19 +83,19 @@ font_set(FcFontSet *fs) {
static PyObject*
fc_list(PyObject UNUSED *self, PyObject *args) {
int allow_bitmapped_fonts = 0, only_monospaced_fonts = 1;
int allow_bitmapped_fonts = 0, spacing = -1;
PyObject *ans = NULL;
FcObjectSet *os = NULL;
FcPattern *pat = NULL;
FcFontSet *fs = NULL;
if (!PyArg_ParseTuple(args, "|pp", &only_monospaced_fonts, &allow_bitmapped_fonts)) return NULL;
if (!PyArg_ParseTuple(args, "|ip", &spacing, &allow_bitmapped_fonts)) return NULL;
pat = FcPatternCreate();
if (pat == NULL) return PyErr_NoMemory();
if (!allow_bitmapped_fonts) {
AP(FcPatternAddBool, FC_OUTLINE, true, "outline");
AP(FcPatternAddBool, FC_SCALABLE, true, "scalable");
}
if (only_monospaced_fonts) AP(FcPatternAddInteger, FC_SPACING, FC_MONO, "spacing");
if (spacing > -1) AP(FcPatternAddInteger, FC_SPACING, spacing, "spacing");
os = FcObjectSetBuild(FC_FILE, FC_POSTSCRIPT_NAME, FC_FAMILY, FC_STYLE, FC_FULLNAME, FC_WEIGHT, FC_WIDTH, FC_SLANT, FC_HINT_STYLE, FC_INDEX, FC_HINTING, FC_SCALABLE, FC_OUTLINE, FC_COLOR, FC_SPACING, NULL);
if (!os) { PyErr_SetString(PyExc_ValueError, "Failed to create fontconfig object set"); goto end; }
fs = FcFontList(NULL, pat, os);
@@ -147,21 +147,21 @@ end:
static PyObject*
fc_match(PyObject UNUSED *self, PyObject *args) {
char *family = NULL;
int bold = 0, italic = 0, allow_bitmapped_fonts = 0, monospaced = 0;
int bold = 0, italic = 0, allow_bitmapped_fonts = 0, spacing = FC_MONO;
double size_in_pts = 0, dpi = 0;
FcPattern *pat = NULL;
PyObject *ans = NULL;
if (!PyArg_ParseTuple(args, "|zppppdd", &family, &bold, &italic, &monospaced, &allow_bitmapped_fonts, &size_in_pts, &dpi)) return NULL;
if (!PyArg_ParseTuple(args, "|zppppdd", &family, &bold, &italic, &spacing, &allow_bitmapped_fonts, &size_in_pts, &dpi)) return NULL;
pat = FcPatternCreate();
if (pat == NULL) return PyErr_NoMemory();
if (family && strlen(family) > 0) AP(FcPatternAddString, FC_FAMILY, (const FcChar8*)family, "family");
if (monospaced) {
if (spacing >= FC_DUAL) {
// pass the family,monospace as the family parameter to fc-match,
// which will fallback to using monospace if the family does not match.
AP(FcPatternAddString, FC_FAMILY, (const FcChar8*)"monospace", "family");
AP(FcPatternAddInteger, FC_SPACING, FC_MONO, "spacing");
AP(FcPatternAddInteger, FC_SPACING, spacing, "spacing");
}
if (!allow_bitmapped_fonts) {
AP(FcPatternAddBool, FC_OUTLINE, true, "outline");
@@ -243,5 +243,9 @@ init_fontconfig_library(PyObject *module) {
PyModule_AddIntMacro(module, FC_WEIGHT_BOLD);
PyModule_AddIntMacro(module, FC_SLANT_ITALIC);
PyModule_AddIntMacro(module, FC_SLANT_ROMAN);
PyModule_AddIntMacro(module, FC_PROPORTIONAL);
PyModule_AddIntMacro(module, FC_DUAL);
PyModule_AddIntMacro(module, FC_MONO);
PyModule_AddIntMacro(module, FC_CHARCELL);
return true;
}

View File

@@ -550,6 +550,7 @@ START_ALLOW_CASE_RANGE
switch(cpu_cell->ch) {
case 0:
case ' ':
case '\t':
return BLANK_FONT;
case 0x2500 ... 0x2570:
case 0x2574 ... 0x259f:
@@ -954,8 +955,11 @@ merge_groups_for_pua_space_ligature(void) {
while (G(group_idx) > 0) {
Group *g = G(groups), *g1 = G(groups) + 1;
g->num_cells += g1->num_cells;
g->num_glyphs += g1->num_glyphs;
g->num_glyphs = MIN(g->num_glyphs, MAX_NUM_EXTRA_GLYPHS + 1);
// We dont want the space glyphs rendered because some stupid
// fonts like PowerLine dont have a space glyph
// https://github.com/kovidgoyal/kitty/issues/1225
/* g->num_glyphs += g1->num_glyphs; */
/* g->num_glyphs = MIN(g->num_glyphs, MAX_NUM_EXTRA_GLYPHS + 1); */
G(group_idx)--;
}
}
@@ -1256,7 +1260,6 @@ send_prerendered_sprites_for_window(OSWindow *w) {
FontGroup *fg = (FontGroup*)w->fonts_data;
if (!fg->sprite_map) {
fg->sprite_map = alloc_sprite_map(fg->cell_width, fg->cell_height);
if (!fg->sprite_map) fatal("Out of memory allocating a sprite map");
send_prerendered_sprites(fg);
}
}

View File

@@ -7,7 +7,7 @@ from functools import lru_cache
from kitty.fast_data_types import (
FC_SLANT_ITALIC, FC_SLANT_ROMAN, FC_WEIGHT_BOLD, FC_WEIGHT_REGULAR,
fc_list, fc_match as fc_match_impl,
fc_list, fc_match as fc_match_impl, FC_DUAL, FC_MONO
)
attr_map = {(False, False): 'font_family',
@@ -32,15 +32,19 @@ def create_font_map(all_fonts):
@lru_cache()
def all_fonts_map(monospaced=True):
return create_font_map(fc_list(monospaced))
if monospaced:
ans = fc_list(FC_DUAL) + fc_list(FC_MONO)
else:
ans = fc_list()
return create_font_map(ans)
def list_fonts():
for fd in fc_list(False):
for fd in fc_list():
f = fd.get('family')
if f:
fn = fd.get('full_name') or (f + ' ' + fd.get('style', '')).strip()
is_mono = fd.get('spacing') == 'MONO'
is_mono = fd.get('spacing') in ('MONO', 'DUAL')
yield {'family': f, 'full_name': fn, 'is_monospace': is_mono}
@@ -49,8 +53,8 @@ def family_name_to_key(family):
@lru_cache()
def fc_match(family, bold, italic):
return fc_match_impl(family, bold, italic)
def fc_match(family, bold, italic, spacing=FC_MONO):
return fc_match_impl(family, bold, italic, spacing)
def find_best_match(family, bold=False, italic=False, monospaced=True):
@@ -71,20 +75,21 @@ def find_best_match(family, bold=False, italic=False, monospaced=True):
return candidates[0]
# Use fc-match to see if we can find a monospaced font that matches family
possibility = fc_match(family, False, False)
for key, map_key in (('postscript_name', 'ps_map'), ('full_name', 'full_map'), ('family', 'family_map')):
val = possibility.get(key)
if val:
candidates = font_map[map_key].get(family_name_to_key(val))
if candidates:
if len(candidates) == 1:
# happens if the family name is an alias, so we search with
# the actual family name to see if we can find all the
# fonts in the family.
family_name_candidates = font_map['family_map'].get(family_name_to_key(candidates[0]['family']))
if family_name_candidates and len(family_name_candidates) > 1:
candidates = family_name_candidates
return sorted(candidates, key=score)[0]
for spacing in (FC_MONO, FC_DUAL):
possibility = fc_match(family, False, False, spacing)
for key, map_key in (('postscript_name', 'ps_map'), ('full_name', 'full_map'), ('family', 'family_map')):
val = possibility.get(key)
if val:
candidates = font_map[map_key].get(family_name_to_key(val))
if candidates:
if len(candidates) == 1:
# happens if the family name is an alias, so we search with
# the actual family name to see if we can find all the
# fonts in the family.
family_name_candidates = font_map['family_map'].get(family_name_to_key(candidates[0]['family']))
if family_name_candidates and len(family_name_candidates) > 1:
candidates = family_name_candidates
return sorted(candidates, key=score)[0]
# Use fc-match with a generic family
family = 'monospace' if monospaced else 'sans-serif'

67
kitty/glfw-wrapper.h generated
View File

@@ -99,7 +99,15 @@
/* Printable keys */
#define GLFW_KEY_SPACE 32
#define GLFW_KEY_EXCLAM 33 /* ! */
#define GLFW_KEY_DOUBLE_QUOTE 34 /* " */
#define GLFW_KEY_NUMBER_SIGN 35 /* # */
#define GLFW_KEY_DOLLAR 36 /* $ */
#define GLFW_KEY_AMPERSAND 38 /* & */
#define GLFW_KEY_APOSTROPHE 39 /* ' */
#define GLFW_KEY_PARENTHESIS_LEFT 40 /* ( */
#define GLFW_KEY_PARENTHESIS_RIGHT 41 /* ) */
#define GLFW_KEY_PLUS 43 /* + */
#define GLFW_KEY_COMMA 44 /* , */
#define GLFW_KEY_MINUS 45 /* - */
#define GLFW_KEY_PERIOD 46 /* . */
@@ -114,8 +122,12 @@
#define GLFW_KEY_7 55
#define GLFW_KEY_8 56
#define GLFW_KEY_9 57
#define GLFW_KEY_COLON 58 /* : */
#define GLFW_KEY_SEMICOLON 59 /* ; */
#define GLFW_KEY_LESS 60 /* < */
#define GLFW_KEY_EQUAL 61 /* = */
#define GLFW_KEY_GREATER 62 /* > */
#define GLFW_KEY_AT 64 /* @ */
#define GLFW_KEY_A 65
#define GLFW_KEY_B 66
#define GLFW_KEY_C 67
@@ -145,11 +157,62 @@
#define GLFW_KEY_LEFT_BRACKET 91 /* [ */
#define GLFW_KEY_BACKSLASH 92 /* \ */
#define GLFW_KEY_RIGHT_BRACKET 93 /* ] */
#define GLFW_KEY_UNDERSCORE 95 /* _ */
#define GLFW_KEY_GRAVE_ACCENT 96 /* ` */
#define GLFW_KEY_WORLD_1 161 /* non-US #1 */
#define GLFW_KEY_WORLD_2 162 /* non-US #2 */
#define GLFW_KEY_PLUS 163
#define GLFW_KEY_UNDERSCORE 164
#define GLFW_KEY_PARAGRAPH 167 /* § */
#define GLFW_KEY_MASCULINE 186 /* º */
#define GLFW_KEY_A_GRAVE 192 /* À */
#define GLFW_KEY_A_DIAERESIS 196 /* Ä */
#define GLFW_KEY_A_RING 197 /* Å */
#define GLFW_KEY_AE 198 /* Æ */
#define GLFW_KEY_C_CEDILLA 199 /* Ç */
#define GLFW_KEY_E_GRAVE 200 /* È */
#define GLFW_KEY_E_ACUTE 201 /* É */
#define GLFW_KEY_I_GRAVE 204 /* Ì */
#define GLFW_KEY_N_TILDE 209 /* Ñ */
#define GLFW_KEY_O_GRAVE 210 /* Ò */
#define GLFW_KEY_O_DIAERESIS 214 /* Ö */
#define GLFW_KEY_O_SLASH 216 /* Ø */
#define GLFW_KEY_U_GRAVE 217 /* Ù */
#define GLFW_KEY_U_DIAERESIS 220 /* Ü */
#define GLFW_KEY_S_SHARP 222 /* ß */
#define GLFW_KEY_CYRILLIC_A 223 /* А */
#define GLFW_KEY_CYRILLIC_BE 224 /* Б */
#define GLFW_KEY_CYRILLIC_VE 225 /* В */
#define GLFW_KEY_CYRILLIC_GHE 226 /* Г */
#define GLFW_KEY_CYRILLIC_DE 227 /* Д */
#define GLFW_KEY_CYRILLIC_IE 228 /* Е */
#define GLFW_KEY_CYRILLIC_ZHE 229 /* Ж */
#define GLFW_KEY_CYRILLIC_ZE 230 /* З */
#define GLFW_KEY_CYRILLIC_I 231 /* И */
#define GLFW_KEY_CYRILLIC_SHORT_I 232 /* Й */
#define GLFW_KEY_CYRILLIC_KA 233 /* К */
#define GLFW_KEY_CYRILLIC_EL 234 /* Л */
#define GLFW_KEY_CYRILLIC_EM 235 /* М */
#define GLFW_KEY_CYRILLIC_EN 236 /* Н */
#define GLFW_KEY_CYRILLIC_O 237 /* О */
#define GLFW_KEY_CYRILLIC_PE 238 /* П */
#define GLFW_KEY_CYRILLIC_ER 239 /* Р */
#define GLFW_KEY_CYRILLIC_ES 240 /* С */
#define GLFW_KEY_CYRILLIC_TE 241 /* Т */
#define GLFW_KEY_CYRILLIC_U 242 /* У */
#define GLFW_KEY_CYRILLIC_EF 243 /* Ф */
#define GLFW_KEY_CYRILLIC_HA 244 /* Х */
#define GLFW_KEY_CYRILLIC_TSE 245 /* Ц */
#define GLFW_KEY_CYRILLIC_CHE 246 /* Ч */
#define GLFW_KEY_CYRILLIC_SHA 247 /* Ш */
#define GLFW_KEY_CYRILLIC_SHCHA 248 /* Щ */
#define GLFW_KEY_CYRILLIC_HARD_SIGN 249 /* Ъ */
#define GLFW_KEY_CYRILLIC_YERU 250 /* Ы */
#define GLFW_KEY_CYRILLIC_SOFT_SIGN 251 /* Ь */
#define GLFW_KEY_CYRILLIC_E 252 /* Э */
#define GLFW_KEY_CYRILLIC_YU 253 /* Ю */
#define GLFW_KEY_CYRILLIC_YA 254 /* Я */
#define GLFW_KEY_CYRILLIC_IO 255 /* Ё */
#define GLFW_KEY_LAST_PRINTABLE GLFW_KEY_CYRILLIC_IO
/* Function keys */
#define GLFW_KEY_ESCAPE 256

View File

@@ -41,7 +41,10 @@ update_os_window_viewport(OSWindow *window, bool notify_boss) {
int w, h, fw, fh;
glfwGetFramebufferSize(window->handle, &fw, &fh);
glfwGetWindowSize(window->handle, &w, &h);
if (fw == window->viewport_width && fh == window->viewport_height && w == window->window_width && h == window->window_height) {
double xdpi = window->logical_dpi_x, ydpi = window->logical_dpi_y;
set_os_window_dpi(window);
if (fw == window->viewport_width && fh == window->viewport_height && w == window->window_width && h == window->window_height && xdpi == window->logical_dpi_x && ydpi == window->logical_dpi_y) {
return; // no change, ignore
}
if (w <= 0 || h <= 0 || fw / w > 5 || fh / h > 5 || fw < min_width || fh < min_height || fw < w || fh < h) {
@@ -62,8 +65,6 @@ update_os_window_viewport(OSWindow *window, bool notify_boss) {
double xr = window->viewport_x_ratio, yr = window->viewport_y_ratio;
window->viewport_x_ratio = w > 0 ? (double)window->viewport_width / (double)w : xr;
window->viewport_y_ratio = h > 0 ? (double)window->viewport_height / (double)h : yr;
double xdpi = window->logical_dpi_x, ydpi = window->logical_dpi_y;
set_os_window_dpi(window);
bool dpi_changed = (xr != 0.0 && xr != window->viewport_x_ratio) || (yr != 0.0 && yr != window->viewport_y_ratio) || (xdpi != window->logical_dpi_x) || (ydpi != window->logical_dpi_y);
window->viewport_size_dirty = true;
@@ -781,7 +782,7 @@ glfw_init(PyObject UNUSED *self, PyObject *args) {
// Joysticks cause slow startup on some linux systems, see
// https://github.com/kovidgoyal/kitty/issues/830
glfwInitHint(GLFW_ENABLE_JOYSTICKS, 0);
global_state.opts.debug_keyboard = debug_keyboard != 0;
OPT(debug_keyboard) = debug_keyboard != 0;
#ifdef __APPLE__
glfwInitHint(GLFW_COCOA_CHDIR_RESOURCES, 0);
glfwInitHint(GLFW_COCOA_MENUBAR, 0);
@@ -1234,7 +1235,15 @@ init_glfw(PyObject *m) {
// --- Printable keys ----------------------------------------------------------
ADDC(GLFW_KEY_SPACE);
ADDC(GLFW_KEY_EXCLAM);
ADDC(GLFW_KEY_DOUBLE_QUOTE);
ADDC(GLFW_KEY_NUMBER_SIGN);
ADDC(GLFW_KEY_DOLLAR);
ADDC(GLFW_KEY_AMPERSAND);
ADDC(GLFW_KEY_APOSTROPHE);
ADDC(GLFW_KEY_PARENTHESIS_LEFT);
ADDC(GLFW_KEY_PARENTHESIS_RIGHT);
ADDC(GLFW_KEY_PLUS);
ADDC(GLFW_KEY_COMMA);
ADDC(GLFW_KEY_MINUS);
ADDC(GLFW_KEY_PERIOD);
@@ -1249,8 +1258,12 @@ init_glfw(PyObject *m) {
ADDC(GLFW_KEY_7);
ADDC(GLFW_KEY_8);
ADDC(GLFW_KEY_9);
ADDC(GLFW_KEY_COLON);
ADDC(GLFW_KEY_SEMICOLON);
ADDC(GLFW_KEY_LESS);
ADDC(GLFW_KEY_EQUAL);
ADDC(GLFW_KEY_GREATER);
ADDC(GLFW_KEY_AT);
ADDC(GLFW_KEY_A);
ADDC(GLFW_KEY_B);
ADDC(GLFW_KEY_C);
@@ -1280,11 +1293,61 @@ init_glfw(PyObject *m) {
ADDC(GLFW_KEY_LEFT_BRACKET);
ADDC(GLFW_KEY_BACKSLASH);
ADDC(GLFW_KEY_RIGHT_BRACKET);
ADDC(GLFW_KEY_UNDERSCORE);
ADDC(GLFW_KEY_GRAVE_ACCENT);
ADDC(GLFW_KEY_WORLD_1);
ADDC(GLFW_KEY_WORLD_2);
ADDC(GLFW_KEY_PLUS);
ADDC(GLFW_KEY_UNDERSCORE);
ADDC(GLFW_KEY_PARAGRAPH);
ADDC(GLFW_KEY_MASCULINE);
ADDC(GLFW_KEY_A_GRAVE);
ADDC(GLFW_KEY_A_DIAERESIS);
ADDC(GLFW_KEY_A_RING);
ADDC(GLFW_KEY_AE);
ADDC(GLFW_KEY_C_CEDILLA);
ADDC(GLFW_KEY_E_GRAVE);
ADDC(GLFW_KEY_E_ACUTE);
ADDC(GLFW_KEY_I_GRAVE);
ADDC(GLFW_KEY_N_TILDE);
ADDC(GLFW_KEY_O_GRAVE);
ADDC(GLFW_KEY_O_DIAERESIS);
ADDC(GLFW_KEY_O_SLASH);
ADDC(GLFW_KEY_U_GRAVE);
ADDC(GLFW_KEY_U_DIAERESIS);
ADDC(GLFW_KEY_S_SHARP);
ADDC(GLFW_KEY_CYRILLIC_A);
ADDC(GLFW_KEY_CYRILLIC_BE);
ADDC(GLFW_KEY_CYRILLIC_VE);
ADDC(GLFW_KEY_CYRILLIC_GHE);
ADDC(GLFW_KEY_CYRILLIC_DE);
ADDC(GLFW_KEY_CYRILLIC_IE);
ADDC(GLFW_KEY_CYRILLIC_ZHE);
ADDC(GLFW_KEY_CYRILLIC_ZE);
ADDC(GLFW_KEY_CYRILLIC_I);
ADDC(GLFW_KEY_CYRILLIC_SHORT_I);
ADDC(GLFW_KEY_CYRILLIC_KA);
ADDC(GLFW_KEY_CYRILLIC_EL);
ADDC(GLFW_KEY_CYRILLIC_EM);
ADDC(GLFW_KEY_CYRILLIC_EN);
ADDC(GLFW_KEY_CYRILLIC_O);
ADDC(GLFW_KEY_CYRILLIC_PE);
ADDC(GLFW_KEY_CYRILLIC_ER);
ADDC(GLFW_KEY_CYRILLIC_ES);
ADDC(GLFW_KEY_CYRILLIC_TE);
ADDC(GLFW_KEY_CYRILLIC_U);
ADDC(GLFW_KEY_CYRILLIC_EF);
ADDC(GLFW_KEY_CYRILLIC_HA);
ADDC(GLFW_KEY_CYRILLIC_TSE);
ADDC(GLFW_KEY_CYRILLIC_CHE);
ADDC(GLFW_KEY_CYRILLIC_SHA);
ADDC(GLFW_KEY_CYRILLIC_SHCHA);
ADDC(GLFW_KEY_CYRILLIC_HARD_SIGN);
ADDC(GLFW_KEY_CYRILLIC_YERU);
ADDC(GLFW_KEY_CYRILLIC_SOFT_SIGN);
ADDC(GLFW_KEY_CYRILLIC_E);
ADDC(GLFW_KEY_CYRILLIC_YU);
ADDC(GLFW_KEY_CYRILLIC_YA);
ADDC(GLFW_KEY_CYRILLIC_IO);
ADDC(GLFW_KEY_LAST_PRINTABLE);
// --- Function keys -----------------------------------------------------------
ADDC(GLFW_KEY_ESCAPE);

155
kitty/key_encoding.py generated
View File

@@ -6,6 +6,7 @@ import string
from collections import namedtuple
from . import fast_data_types as defines
from .key_names import key_name_aliases
# ENCODING {{{
ENCODING = {
@@ -130,11 +131,80 @@ ENCODING = {
'Z': 'r',
'PLUS': 'Bi',
'UNDERSCORE': 'Bj',
'MENU': 'Bk'
'MENU': 'Bk',
'EXCLAM': 'Bl',
'DOUBLE QUOTE': 'Bm',
'NUMBER SIGN': 'Bn',
'DOLLAR': 'Bo',
'AMPERSAND': 'Bp',
'PARENTHESIS LEFT': 'Bq',
'PARENTHESIS RIGHT': 'Br',
'COLON': 'Bs',
'LESS': 'Bt',
'GREATER': 'Bu',
'AT': 'Bv',
'PARAGRAPH': 'Bw',
'MASCULINE': 'Bx',
'A GRAVE': 'By',
'A DIAERESIS': 'Bz',
'A RING': 'B0',
'AE': 'B1',
'C CEDILLA': 'B2',
'E GRAVE': 'B3',
'E ACUTE': 'B4',
'I GRAVE': 'B5',
'N TILDE': 'B6',
'O GRAVE': 'B7',
'O DIAERESIS': 'B8',
'O SLASH': 'B9',
'U GRAVE': 'B.',
'U DIAERESIS': 'B-',
'S SHARP': 'B:',
'CYRILLIC A': 'B+',
'CYRILLIC BE': 'B=',
'CYRILLIC VE': 'B^',
'CYRILLIC GHE': 'B!',
'CYRILLIC DE': 'B/',
'CYRILLIC IE': 'B*',
'CYRILLIC ZHE': 'B?',
'CYRILLIC ZE': 'B&',
'CYRILLIC I': 'B<',
'CYRILLIC SHORT I': 'B>',
'CYRILLIC KA': 'B(',
'CYRILLIC EL': 'B)',
'CYRILLIC EM': 'B[',
'CYRILLIC EN': 'B]',
'CYRILLIC O': 'B{',
'CYRILLIC PE': 'B}',
'CYRILLIC ER': 'B@',
'CYRILLIC ES': 'B%',
'CYRILLIC TE': 'B$',
'CYRILLIC U': 'B#',
'CYRILLIC EF': 'CA',
'CYRILLIC HA': 'CB',
'CYRILLIC TSE': 'CC',
'CYRILLIC CHE': 'CD',
'CYRILLIC SHA': 'CE',
'CYRILLIC SHCHA': 'CF',
'CYRILLIC HARD SIGN': 'CG',
'CYRILLIC YERU': 'CH',
'CYRILLIC SOFT SIGN': 'CI',
'CYRILLIC E': 'CJ',
'CYRILLIC YU': 'CK',
'CYRILLIC YA': 'CL',
'CYRILLIC IO': 'CM'
}
KEY_MAP = {
32: 'A',
33: 'Bl',
34: 'Bm',
35: 'Bn',
36: 'Bo',
38: 'Bp',
39: 'B',
40: 'Bq',
41: 'Br',
43: 'Bi',
44: 'C',
45: 'D',
46: 'E',
@@ -149,8 +219,12 @@ KEY_MAP = {
55: 'N',
56: 'O',
57: 'P',
58: 'Bs',
59: 'Q',
60: 'Bt',
61: 'R',
62: 'Bu',
64: 'Bv',
65: 'S',
66: 'T',
67: 'U',
@@ -180,11 +254,60 @@ KEY_MAP = {
91: 's',
92: 't',
93: 'u',
95: 'Bj',
96: 'v',
161: 'w',
162: 'x',
163: 'Bi',
164: 'Bj',
167: 'Bw',
186: 'Bx',
192: 'By',
196: 'Bz',
197: 'B0',
198: 'B1',
199: 'B2',
200: 'B3',
201: 'B4',
204: 'B5',
209: 'B6',
210: 'B7',
214: 'B8',
216: 'B9',
217: 'B.',
220: 'B-',
222: 'B:',
223: 'B+',
224: 'B=',
225: 'B^',
226: 'B!',
227: 'B/',
228: 'B*',
229: 'B?',
230: 'B&',
231: 'B<',
232: 'B>',
233: 'B(',
234: 'B)',
235: 'B[',
236: 'B]',
237: 'B{',
238: 'B}',
239: 'B@',
240: 'B%',
241: 'B$',
242: 'B#',
243: 'CA',
244: 'CB',
245: 'CC',
246: 'CD',
247: 'CE',
248: 'CF',
249: 'CG',
250: 'CH',
251: 'CI',
252: 'CJ',
253: 'CK',
254: 'CL',
255: 'CM',
256: 'y',
257: 'z',
258: '0',
@@ -258,7 +381,11 @@ KEY_MAP = {
}
# END_ENCODING }}}
text_keys = string.ascii_uppercase + string.ascii_lowercase + string.digits + '`~!@#$%^&*()_-+=[{]}\\|<,>./?;:\'" '
text_keys = (
string.ascii_uppercase + string.ascii_lowercase + string.digits +
'`~!@#$%^&*()_-+=[{]}\\|<,>./?;:\'" '
'ÄäÖöÜüß§ºàåæçèéìñòøùабвгдежзийклмнопрстуфхцчшщъыьэюяё'
)
def text_match(key):
@@ -296,9 +423,11 @@ def update_encoding():
key_map = {}
i = len(ans)
for k in sorted(keys, key=lambda k: getattr(defines, k)):
if k in ('GLFW_KEY_LAST', 'GLFW_KEY_LAST_PRINTABLE'):
continue
val = getattr(defines, k)
name = symbolic_name(k)
if val <= defines.GLFW_KEY_LAST and name != 'LAST' and val != defines.GLFW_KEY_UNKNOWN:
if val <= defines.GLFW_KEY_LAST and val != defines.GLFW_KEY_UNKNOWN:
if name not in ans:
ans[name] = encode(i)
i += 1
@@ -345,21 +474,7 @@ for key_name, enc in ENCODING.items():
key_name = key_name.replace(' ', '_')
g[key_name] = config_key_map[key_name] = key_name
key_rmap[enc] = key_name
config_key_map.update({
'`': g['GRAVE_ACCENT'],
'-': g['MINUS'],
'=': g['EQUAL'],
'[': g['LEFT_BRACKET'],
']': g['RIGHT_BRACKET'],
'\\': g['BACKSLASH'],
';': g['SEMICOLON'],
"'": g['APOSTROPHE'],
',': g['COMMA'],
'.': g['PERIOD'],
'/': g['SLASH'],
'ESC': g['ESCAPE'],
'+': g['PLUS'],
})
config_key_map.update({k: g[v] for k, v in key_name_aliases.items() if v in g})
enter_key = KeyEvent(PRESS, 0, g['ENTER'])
backspace_key = KeyEvent(PRESS, 0, g['BACKSPACE'])

View File

@@ -8,6 +8,94 @@ from contextlib import suppress
from .constants import is_macos
key_name_aliases = {
'!': 'EXCLAM',
'"': 'DOUBLE_QUOTE',
'#': 'NUMBER_SIGN',
'$': 'DOLLAR',
'&': 'AMPERSAND',
"'": 'APOSTROPHE',
'(': 'PARENTHESIS_LEFT',
')': 'PARENTHESIS_RIGHT',
',': 'COMMA',
'-': 'MINUS',
'.': 'PERIOD',
'/': 'SLASH',
':': 'COLON',
';': 'SEMICOLON',
'<': 'LESS',
'=': 'EQUAL',
'>': 'GREATER',
'@': 'AT',
'[': 'LEFT_BRACKET',
'\\': 'BACKSLASH',
']': 'RIGHT_BRACKET',
'_': 'UNDERSCORE',
'`': 'GRAVE_ACCENT',
'§': 'PARAGRAPH',
'º': 'MASCULINE',
'À': 'A_GRAVE',
'Ä': 'A_DIAERESIS',
'Å': 'A_RING',
'Æ': 'AE',
'Ç': 'C_CEDILLA',
'È': 'E_GRAVE',
'É': 'E_ACUTE',
'Ì': 'I_GRAVE',
'Ñ': 'N_TILDE',
'Ò': 'O_GRAVE',
'Ö': 'O_DIAERESIS',
'Ø': 'O_SLASH',
'Ù': 'U_GRAVE',
'Ü': 'U_DIAERESIS',
'SS': 'S_SHARP', # 'ß'.upper() == 'SS'
'А': 'CYRILLIC_A',
'Б': 'CYRILLIC_BE',
'В': 'CYRILLIC_VE',
'Г': 'CYRILLIC_GHE',
'Д': 'CYRILLIC_DE',
'Е': 'CYRILLIC_IE',
'Ж': 'CYRILLIC_ZHE',
'З': 'CYRILLIC_ZE',
'И': 'CYRILLIC_I',
'Й': 'CYRILLIC_SHORT_I',
'К': 'CYRILLIC_KA',
'Л': 'CYRILLIC_EL',
'М': 'CYRILLIC_EM',
'Н': 'CYRILLIC_EN',
'О': 'CYRILLIC_O',
'П': 'CYRILLIC_PE',
'Р': 'CYRILLIC_ER',
'С': 'CYRILLIC_ES',
'Т': 'CYRILLIC_TE',
'У': 'CYRILLIC_U',
'Ф': 'CYRILLIC_EF',
'Х': 'CYRILLIC_HA',
'Ц': 'CYRILLIC_TSE',
'Ч': 'CYRILLIC_CHE',
'Ш': 'CYRILLIC_SHA',
'Щ': 'CYRILLIC_SHCHA',
'Ъ': 'CYRILLIC_HARD_SIGN',
'Ы': 'CYRILLIC_YERU',
'Ь': 'CYRILLIC_SOFT_SIGN',
'Э': 'CYRILLIC_E',
'Ю': 'CYRILLIC_YU',
'Я': 'CYRILLIC_YA',
'Ё': 'CYRILLIC_IO',
'ESC': 'ESCAPE',
'PGUP': 'PAGE_UP',
'PAGEUP': 'PAGE_UP',
'PGDN': 'PAGE_DOWN',
'PAGEDOWN': 'PAGE_DOWN',
'RETURN': 'ENTER',
'ARROWUP': 'UP',
'ARROWDOWN': 'DOWN',
'ARROWRIGHT': 'RIGHT',
'ARROWLEFT': 'LEFT'
}
def null_lookup(name, case_sensitive=False):
pass

27017
kitty/keys.h generated

File diff suppressed because it is too large Load Diff

View File

@@ -161,7 +161,7 @@ action_map = {
def extended_key_event(key, mods, action):
if key >= defines.GLFW_KEY_LAST or key == defines.GLFW_KEY_UNKNOWN or (
# Shifted printable key should be handled by on_text_input()
mods <= defines.GLFW_MOD_SHIFT and 32 <= key <= 126
mods <= defines.GLFW_MOD_SHIFT and defines.GLFW_KEY_SPACE <= key <= defines.GLFW_KEY_LAST_PRINTABLE
):
return b''
if mods == 0 and key in (
@@ -304,7 +304,7 @@ def generate_key_table_impl(w):
def key_name(k):
return k[len('GLFW_KEY_'):]
keys = {v: k for k, v in vars(defines).items() if k.startswith('GLFW_KEY_') and k not in {'GLFW_KEY_LAST', 'GLFW_KEY_UNKNOWN'}}
keys = {v: k for k, v in vars(defines).items() if k.startswith('GLFW_KEY_') and k not in {'GLFW_KEY_LAST', 'GLFW_KEY_LAST_PRINTABLE', 'GLFW_KEY_UNKNOWN'}}
key_rmap = []
for i in range(number_of_keys):
k = keys.get(i)
@@ -314,7 +314,7 @@ def generate_key_table_impl(w):
w('%d, /* %s */' % (key_count, key_name(k)))
key_rmap.append(i)
key_count += 1
if key_count > 128:
if key_count > 256:
raise OverflowError('Too many keys')
w('};\n')
w('static inline const char* key_name(int key) { switch(key) {')
@@ -354,7 +354,7 @@ def generate_key_table_impl(w):
ind('case 0x{:x}:'.format(mods))
i += 1
if key_bytes:
ind('switch(key & 0x7f) { default: return NULL;')
ind('switch(key & 0xff) { default: return NULL;')
i += 1
for key, (data, glfw_key) in key_bytes.items():
ind('case {}: // {}'.format(key, key_name(keys[glfw_key])))

View File

@@ -187,15 +187,19 @@ size_t
cell_as_unicode_for_fallback(CPUCell *cell, Py_UCS4 *buf) {
size_t n = 1;
buf[0] = cell->ch ? cell->ch : ' ';
for (unsigned i = 0; i < arraysz(cell->cc_idx) && cell->cc_idx[i]; i++) {
if (cell->cc_idx[i] != VS15 && cell->cc_idx[i] != VS16) buf[n++] = codepoint_for_mark(cell->cc_idx[i]);
}
if (buf[0] != '\t') {
for (unsigned i = 0; i < arraysz(cell->cc_idx) && cell->cc_idx[i]; i++) {
if (cell->cc_idx[i] != VS15 && cell->cc_idx[i] != VS16) buf[n++] = codepoint_for_mark(cell->cc_idx[i]);
}
} else buf[0] = ' ';
return n;
}
size_t
cell_as_utf8(CPUCell *cell, bool include_cc, char *buf, char_type zero_char) {
size_t n = encode_utf8(cell->ch ? cell->ch : zero_char, buf);
char_type ch = cell->ch ? cell->ch : zero_char;
if (ch == '\t') { include_cc = false; }
size_t n = encode_utf8(ch, buf);
if (include_cc) {
for (unsigned i = 0; i < arraysz(cell->cc_idx) && cell->cc_idx[i]; i++) n += encode_utf8(codepoint_for_mark(cell->cc_idx[i]), buf + n);
}
@@ -205,10 +209,15 @@ cell_as_utf8(CPUCell *cell, bool include_cc, char *buf, char_type zero_char) {
size_t
cell_as_utf8_for_fallback(CPUCell *cell, char *buf) {
size_t n = encode_utf8(cell->ch ? cell->ch : ' ', buf);
for (unsigned i = 0; i < arraysz(cell->cc_idx) && cell->cc_idx[i]; i++) {
if (cell->cc_idx[i] != VS15 && cell->cc_idx[i] != VS16) {
n += encode_utf8(codepoint_for_mark(cell->cc_idx[i]), buf + n);
char_type ch = cell->ch ? cell->ch : ' ';
bool include_cc = true;
if (ch == '\t') { ch = ' '; include_cc = false; }
size_t n = encode_utf8(ch, buf);
if (include_cc) {
for (unsigned i = 0; i < arraysz(cell->cc_idx) && cell->cc_idx[i]; i++) {
if (cell->cc_idx[i] != VS15 && cell->cc_idx[i] != VS16) {
n += encode_utf8(codepoint_for_mark(cell->cc_idx[i]), buf + n);
}
}
}
buf[n] = 0;
@@ -228,7 +237,16 @@ unicode_in_range(Line *self, index_type start, index_type limit, bool include_cc
if (ch == 0) {
if (previous_width == 2) { previous_width = 0; continue; };
}
n += cell_as_unicode(self->cpu_cells + i, include_cc, buf + n, ' ');
if (ch == '\t') {
buf[n++] = '\t';
unsigned num_cells_to_skip_for_tab = self->cpu_cells[i].cc_idx[0];
while (num_cells_to_skip_for_tab && i + 1 < limit && self->cpu_cells[i+1].ch == ' ') {
i++;
num_cells_to_skip_for_tab--;
}
} else {
n += cell_as_unicode(self->cpu_cells + i, include_cc, buf + n, ' ');
}
previous_width = self->gpu_cells[i].attrs & WIDTH_MASK;
}
return PyUnicode_FromKindAndData(PyUnicode_4BYTE_KIND, buf, n);
@@ -288,8 +306,15 @@ line_as_ansi(Line *self, Py_UCS4 *buf, index_type buflen, bool *truncated, const
}
*prev_cell = cell;
WRITE_CH(ch);
for(unsigned c = 0; c < arraysz(self->cpu_cells[pos].cc_idx) && self->cpu_cells[pos].cc_idx[c]; c++) {
WRITE_CH(codepoint_for_mark(self->cpu_cells[pos].cc_idx[c]));
if (ch == '\t') {
unsigned num_cells_to_skip_for_tab = self->cpu_cells[pos].cc_idx[0];
while (num_cells_to_skip_for_tab && pos + 1 < limit && self->cpu_cells[pos+1].ch == ' ') {
num_cells_to_skip_for_tab--; pos++;
}
} else {
for(unsigned c = 0; c < arraysz(self->cpu_cells[pos].cc_idx) && self->cpu_cells[pos].cc_idx[c]; c++) {
WRITE_CH(codepoint_for_mark(self->cpu_cells[pos].cc_idx[c]));
}
}
previous_width = cell->attrs & WIDTH_MASK;
}

View File

@@ -76,7 +76,7 @@ free_loop_data(LoopData *ld) {
void
wakeup_loop(LoopData *ld, bool in_signal_handler) {
wakeup_loop(LoopData *ld, bool in_signal_handler, const char *loop_name) {
while(true) {
#ifdef HAS_EVENT_FD
static const int64_t value = 1;
@@ -86,7 +86,7 @@ wakeup_loop(LoopData *ld, bool in_signal_handler) {
#endif
if (ret < 0) {
if (errno == EINTR) continue;
if (!in_signal_handler) log_error("Failed to write to loop wakeup fd with error: %s", strerror(errno));
if (!in_signal_handler) log_error("Failed to write to %s wakeup fd with error: %s", loop_name, strerror(errno));
}
break;
}

View File

@@ -41,7 +41,7 @@ typedef void(*handle_signal_func)(int, void *data);
bool init_loop_data(LoopData *ld);
void free_loop_data(LoopData *ld);
void wakeup_loop(LoopData *ld, bool in_signal_handler);
void wakeup_loop(LoopData *ld, bool in_signal_handler, const char*);
bool install_signal_handlers(LoopData *ld);
void read_signals(int fd, handle_signal_func callback, void *data);

View File

@@ -153,6 +153,10 @@ screen_reset(Screen *self) {
set_dynamic_color(self, 110, NULL);
set_dynamic_color(self, 111, NULL);
set_color_table_color(self, 104, NULL);
self->parser_state = 0;
self->parser_text_start = 0;
self->parser_buf_pos = 0;
self->parser_has_pending_text = false;
}
void
@@ -737,6 +741,24 @@ screen_tab(Screen *self) {
}
if (!found) found = self->columns - 1;
if (found != self->cursor->x) {
if (self->cursor->x < self->columns) {
linebuf_init_line(self->linebuf, self->cursor->y);
combining_type diff = found - self->cursor->x;
CPUCell *cpu_cell = self->linebuf->line->cpu_cells + self->cursor->x;
bool ok = true;
for (combining_type i = 0; i < diff; i++) {
CPUCell *c = cpu_cell + i;
if (c->ch != ' ' && c->ch != 0) { ok = false; break; }
}
if (ok) {
for (combining_type i = 0; i < diff; i++) {
CPUCell *c = cpu_cell + i;
c->ch = ' '; zero_at_ptr_count(c->cc_idx, arraysz(c->cc_idx));
}
cpu_cell->ch = '\t';
cpu_cell->cc_idx[0] = diff;
}
}
self->cursor->x = found;
}
}

View File

@@ -3,14 +3,14 @@
# License: GPL v3 Copyright: 2016, Kovid Goyal <kovid at kovidgoyal.net>
import shlex
import sys
from collections import namedtuple
from .config_data import to_layout_names
from .constants import shell_path, kitty_exe
from .constants import kitty_exe, shell_path
from .layout import all_layouts
from .utils import log_error
WindowSizeOpts = namedtuple(
'WindowSizeOpts', 'initial_window_width initial_window_height window_margin_width window_padding_width remember_window_size')
@@ -131,9 +131,14 @@ def parse_session(raw, opts, default_title=None):
def create_sessions(opts, args=None, special_window=None, cwd_from=None, respect_cwd=False, default_session=None):
if args and args.session:
with open(args.session) as f:
yield from parse_session(f.read(), opts, getattr(args, 'title', None))
return
if args.session == '-':
f = sys.stdin
else:
f = open(args.session)
with f:
session_data = f.read()
yield from parse_session(session_data, opts, getattr(args, 'title', None))
return
if default_session and default_session != 'none':
try:
with open(default_session) as f:

View File

@@ -37,12 +37,11 @@ alloc_sprite_map(unsigned int cell_width, unsigned int cell_height) {
sprite_tracker_set_limits(max_texture_size, max_array_texture_layers);
}
SpriteMap *ans = calloc(1, sizeof(SpriteMap));
if (ans) {
*ans = NEW_SPRITE_MAP;
ans->max_texture_size = max_texture_size;
ans->max_array_texture_layers = max_array_texture_layers;
ans->cell_width = cell_width; ans->cell_height = cell_height;
}
if (!ans) fatal("Out of memory allocating a sprite map");
*ans = NEW_SPRITE_MAP;
ans->max_texture_size = max_texture_size;
ans->max_array_texture_layers = max_array_texture_layers;
ans->cell_width = cell_width; ans->cell_height = cell_height;
return (SPRITE_MAP_HANDLE)ans;
}
@@ -564,7 +563,7 @@ create_border_vao(void) {
}
void
draw_borders(ssize_t vao_idx, unsigned int num_border_rects, BorderRect *rect_buf, bool rect_data_is_dirty, uint32_t viewport_width, uint32_t viewport_height, color_type active_window_bg, unsigned int num_visible_windows, OSWindow *w) {
draw_borders(ssize_t vao_idx, unsigned int num_border_rects, BorderRect *rect_buf, bool rect_data_is_dirty, uint32_t viewport_width, uint32_t viewport_height, color_type active_window_bg, unsigned int num_visible_windows, bool all_windows_have_same_bg, OSWindow *w) {
if (num_border_rects) {
if (rect_data_is_dirty) {
size_t sz = sizeof(GLuint) * 5 * num_border_rects;
@@ -579,7 +578,7 @@ draw_borders(ssize_t vao_idx, unsigned int num_border_rects, BorderRect *rect_bu
glUniform3f(border_uniform_locations[BORDER_inactive_border_color], CV3(OPT(inactive_border_color)));
glUniform3f(border_uniform_locations[BORDER_bell_border_color], CV3(OPT(bell_border_color)));
glUniform2ui(border_uniform_locations[BORDER_viewport], viewport_width, viewport_height);
color_type default_bg = num_visible_windows > 1 ? OPT(background) : active_window_bg;
color_type default_bg = (num_visible_windows > 1 && !all_windows_have_same_bg) ? OPT(background) : active_window_bg;
glUniform3f(border_uniform_locations[BORDER_default_bg], CV3(default_bg));
#undef CV3
bind_vertex_array(vao_idx);

View File

@@ -387,7 +387,7 @@ PYWRAP1(set_options) {
global_state.debug_font_fallback = debug_font_fallback ? true : false;
#define GA(name) ret = PyObject_GetAttrString(opts, #name); if (ret == NULL) return NULL;
#define SS(name, dest, convert) { GA(name); dest = convert(ret); Py_DECREF(ret); if (PyErr_Occurred()) return NULL; }
#define S(name, convert) SS(name, global_state.opts.name, convert)
#define S(name, convert) SS(name, OPT(name), convert)
SS(kitty_mod, kitty_mod, PyLong_AsLong);
S(hide_window_decorations, PyObject_IsTrue);
S(visual_bell_duration, PyFloat_AsDouble);
@@ -724,7 +724,7 @@ PYWRAP1(patch_global_colors) {
#define P(name) { \
PyObject *val = PyDict_GetItemString(spec, #name); \
if (val) { \
global_state.opts.name = PyLong_AsLong(val); \
OPT(name) = PyLong_AsLong(val); \
} \
}
P(active_border_color); P(inactive_border_color); P(bell_border_color);

View File

@@ -207,7 +207,7 @@ OSWindow* add_os_window(void);
OSWindow* current_os_window(void);
void os_window_regions(OSWindow*, Region *main, Region *tab_bar);
bool drag_scroll(Window *, OSWindow*);
void draw_borders(ssize_t vao_idx, unsigned int num_border_rects, BorderRect *rect_buf, bool rect_data_is_dirty, uint32_t viewport_width, uint32_t viewport_height, color_type, unsigned int, OSWindow *w);
void draw_borders(ssize_t vao_idx, unsigned int num_border_rects, BorderRect *rect_buf, bool rect_data_is_dirty, uint32_t viewport_width, uint32_t viewport_height, color_type, unsigned int, bool, OSWindow *w);
ssize_t create_cell_vao(void);
ssize_t create_graphics_vao(void);
ssize_t create_border_vao(void);

View File

@@ -117,6 +117,6 @@ def update_check(timer_id=None):
return True
def run_update_check(interval=24 * 60 * 60):
def run_update_check(interval=CHECK_INTERVAL):
if update_check():
add_timer(update_check, interval)

View File

@@ -293,11 +293,7 @@ class TestScreen(BaseTest):
s.tab()
s.draw('*')
s.cursor_position(2, 2)
for col in range(2, s.columns - 1, 6):
for i in range(5):
s.draw(' ')
s.draw('*')
self.ae(str(s.line(0)), str(s.line(1)))
self.ae(str(s.line(0)), '\t*'*13)
def test_margins(self):
# Taken from vttest/main.c
@@ -338,7 +334,8 @@ class TestScreen(BaseTest):
s.cursor_position(region, s.columns), s.draw(ch.lower())
for l in range(2, region + 2):
c = chr(ord('I') + l - 2)
self.ae(c + ' ' * (s.columns - 2) + c.lower(), str(s.line(l)))
before = '\t' if l % 4 == 0 else ' '
self.ae(c + ' ' * (s.columns - 3) + before + c.lower(), str(s.line(l)))
s.reset_mode(DECOM)
# Test that moving cursor outside the margins works as expected
s = self.create_screen(10, 10)