Compare commits
29 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fbccfb9d0d | ||
|
|
9fdd8e4ae4 | ||
|
|
6b6dea5190 | ||
|
|
5af551c96d | ||
|
|
6761fdca1a | ||
|
|
725da39ecb | ||
|
|
9005fc359d | ||
|
|
33e4a44008 | ||
|
|
3bddb9d95b | ||
|
|
fa01e0b76f | ||
|
|
f8f188ecff | ||
|
|
07935d9bd3 | ||
|
|
a827f4190c | ||
|
|
18c108ed03 | ||
|
|
2d70059f47 | ||
|
|
63ff3cfb9f | ||
|
|
ca70f22d46 | ||
|
|
c247a6c0cc | ||
|
|
7421a0b9e3 | ||
|
|
30b5e8bf8f | ||
|
|
96475ce3ee | ||
|
|
24669fb6af | ||
|
|
851885568f | ||
|
|
8efbc479e1 | ||
|
|
2167bfd5b5 | ||
|
|
490d4455af | ||
|
|
c94e06ccd2 | ||
|
|
ea37799fb0 | ||
|
|
d00fbd73fc |
29
.travis.yml
29
.travis.yml
@@ -4,7 +4,7 @@ matrix:
|
||||
fast_finish: true
|
||||
include:
|
||||
- os: linux
|
||||
dist: trusty
|
||||
dist: xenial
|
||||
group: beta
|
||||
language: python
|
||||
sudo: false
|
||||
@@ -12,6 +12,7 @@ matrix:
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- libgl1-mesa-dev
|
||||
- libxi-dev
|
||||
- libxrandr-dev
|
||||
- libxinerama-dev
|
||||
@@ -20,7 +21,7 @@ matrix:
|
||||
- libdbus-1-dev
|
||||
|
||||
- os: linux
|
||||
dist: trusty
|
||||
dist: xenial
|
||||
group: beta
|
||||
sudo: false
|
||||
env:
|
||||
@@ -30,6 +31,7 @@ matrix:
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- libgl1-mesa-dev
|
||||
- libfontconfig1-dev
|
||||
- libharfbuzz-dev
|
||||
- libxi-dev
|
||||
@@ -42,7 +44,7 @@ matrix:
|
||||
- python3-pil
|
||||
|
||||
- os: linux
|
||||
dist: trusty
|
||||
dist: xenial
|
||||
group: beta
|
||||
sudo: false
|
||||
env:
|
||||
@@ -52,6 +54,7 @@ matrix:
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- libgl1-mesa-dev
|
||||
- libfontconfig1-dev
|
||||
- libharfbuzz-dev
|
||||
- libxi-dev
|
||||
@@ -64,7 +67,7 @@ matrix:
|
||||
- python3-pil
|
||||
|
||||
- os: linux
|
||||
dist: trusty
|
||||
dist: xenial
|
||||
group: beta
|
||||
sudo: false
|
||||
env:
|
||||
@@ -74,6 +77,7 @@ matrix:
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- libgl1-mesa-dev
|
||||
- libfontconfig1-dev
|
||||
- libharfbuzz-dev
|
||||
- libxi-dev
|
||||
@@ -89,10 +93,13 @@ matrix:
|
||||
language: generic
|
||||
env: SWBASE=/Users/Shared/buildbot/sw SW=$SWBASE/sw PATH=$SW/bin:$PATH
|
||||
|
||||
# Disabled because harfbuzz is currently broken in brew
|
||||
# - os: osx
|
||||
# language: generic
|
||||
# env: USE_BREW=1 BUILD_PKG=osx-bundle
|
||||
- os: osx
|
||||
language: generic
|
||||
addons:
|
||||
homebrew:
|
||||
update: true
|
||||
brewfile: true
|
||||
env: USE_BREW=1 BUILD_PKG=osx-bundle
|
||||
|
||||
env:
|
||||
global:
|
||||
@@ -106,12 +113,6 @@ install: |
|
||||
if [[ "$RUN_FLAKE" == "1" ]]; then pip install flake8; fi
|
||||
if [[ "$TRAVIS_OS_NAME" == 'osx' ]]; then
|
||||
if [[ "$USE_BREW" == "1" ]]; then
|
||||
brew update;
|
||||
# brew upgrade python;
|
||||
brew install harfbuzz --without-graphite2 --without-icu4c --without-freetype;
|
||||
brew install imagemagick
|
||||
brew install optipng
|
||||
brew install librsvg
|
||||
logo/make.py
|
||||
else
|
||||
mkdir -p $SW;
|
||||
|
||||
5
Brewfile
Normal file
5
Brewfile
Normal file
@@ -0,0 +1,5 @@
|
||||
brew 'imagemagick'
|
||||
brew 'optipng'
|
||||
brew 'librsvg'
|
||||
brew 'harfbuzz'
|
||||
brew 'python'
|
||||
@@ -3,6 +3,44 @@ Changelog
|
||||
|
||||
|kitty| is a feature full, cross-platform, *fast*, GPU based terminal emulator.
|
||||
|
||||
0.13.3 [2019-01-19]
|
||||
------------------------------
|
||||
|
||||
- icat kitten: Add a ``--stdin`` option to control if image data is read from
|
||||
STDIN (:iss:`1308`)
|
||||
|
||||
- hints kitten: Start hints numbering at one instead of zero by default. Added
|
||||
an option ``--hints-offset`` to control it. (:iss:`1289`)
|
||||
|
||||
- Fix a regression in the previous release that broke using ``background`` for
|
||||
:opt:`cursor_text_color` (:iss:`1288`)
|
||||
|
||||
- macOS: Fix dragging kitty window tabs in traditional full screen mode causing
|
||||
crashes (:iss:`1296`)
|
||||
|
||||
- macOS: Ensure that when running from a bundle, the bundle kitty exe is
|
||||
preferred over any kitty in PATH (:iss:`1280`)
|
||||
|
||||
- macOS: Fix a regression that broke mapping of :kbd:`ctrl+tab` (:iss:`1304`)
|
||||
|
||||
- Add a list of user-created kittens to the docs
|
||||
|
||||
- Fix a regression that broke changing mouse wheel scroll direction with
|
||||
negative :opt:`wheel_scroll_multiplier` values in full-screen applications
|
||||
like vim (:iss:`1299`)
|
||||
|
||||
- Fix :opt:`background_opacity` not working with pure white backgrounds
|
||||
(:iss:`1285`)
|
||||
|
||||
- macOS: Fix "New OS Window" dock action not working when kitty is not focused
|
||||
(:iss:`1312`)
|
||||
|
||||
- macOS: Add aliases for close window and new tab actions that conform to common
|
||||
Apple shortcuts for these actions (:iss:`1313`)
|
||||
|
||||
- macOS: Fix some kittens causing 100% CPU usage
|
||||
|
||||
|
||||
0.13.2 [2019-01-04]
|
||||
------------------------------
|
||||
|
||||
|
||||
@@ -122,7 +122,7 @@ Tabs
|
||||
======================== =======================
|
||||
Action Shortcut
|
||||
======================== =======================
|
||||
New tab :sc:`new_tab`
|
||||
New tab :sc:`new_tab` (also :kbd:`⌘+t` on macOS)
|
||||
Close tab :sc:`close_tab`
|
||||
Next tab :sc:`next_tab` (also :kbd:`control+tab` on macOS)
|
||||
Previous tab :sc:`previous_tab` (also :kbd:`control+shift+tab` on macOS)
|
||||
@@ -141,7 +141,7 @@ Action Shortcut
|
||||
======================== =======================
|
||||
New window :sc:`new_window`
|
||||
New OS window :sc:`new_os_window` (also :kbd:`⌘+n` on macOS)
|
||||
Close window :sc:`close_window`
|
||||
Close window :sc:`close_window` (also :kbd:`⌘+w` on macOS)
|
||||
Next window :sc:`next_window`
|
||||
Previous window :sc:`previous_window`
|
||||
Move window forward :sc:`move_window_forward`
|
||||
|
||||
@@ -43,6 +43,8 @@ Now in :file:`kitty.conf` add the lines::
|
||||
Start kitty and press :kbd:`ctrl+k` and you should see the kitten running.
|
||||
The best way to develop your own kittens is to modify one of the built in
|
||||
kittens. Look in the kittens sub-directory of the kitty source code for those.
|
||||
Or see below for a list of :ref:`third-party kittens <external_kittens>`,
|
||||
that other kitty users have created.
|
||||
|
||||
|
||||
Passing arguments to kittens
|
||||
@@ -127,3 +129,18 @@ layout, by simply adding the line::
|
||||
|
||||
|
||||
to the ``handle_result()`` function, above.
|
||||
|
||||
.. _external_kittens:
|
||||
|
||||
Kittens created by kitty users
|
||||
---------------------------------------------
|
||||
|
||||
`vim-kitty-navigator <https://github.com/knubie/vim-kitty-navigator>`_
|
||||
Allows you to navigate seamlessly between vim and kitty splits using a consistent set of hotkeys.
|
||||
|
||||
`smart-scroll <https://github.com/yurikhan/kitty-smart-scroll>`_
|
||||
Makes the kitty scroll bindings work in full screen applications
|
||||
|
||||
`insert password <https://github.com/kovidgoyal/kitty/issues/1222>`_
|
||||
Insert a password from a CLI password manager, taking care to only do it at
|
||||
a password prompt.
|
||||
|
||||
@@ -299,6 +299,14 @@ static GLFWbool initializeTIS(void)
|
||||
////// GLFW platform API //////
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
static inline bool
|
||||
is_ctrl_tab(NSEvent *event) {
|
||||
NSEventModifierFlags modifierFlags = [event modifierFlags] & NSEventModifierFlagDeviceIndependentFlagsMask;
|
||||
return event.keyCode == kVK_Tab && (modifierFlags == NSEventModifierFlagControl || modifierFlags == (
|
||||
NSEventModifierFlagControl | NSEventModifierFlagShift));
|
||||
}
|
||||
|
||||
|
||||
int _glfwPlatformInit(void)
|
||||
{
|
||||
_glfw.ns.autoreleasePool = [[NSAutoreleasePool alloc] init];
|
||||
@@ -312,8 +320,7 @@ int _glfwPlatformInit(void)
|
||||
|
||||
NSEvent* (^keydown_block)(NSEvent*) = ^ NSEvent* (NSEvent* event)
|
||||
{
|
||||
NSEventModifierFlags modifierFlags = [event modifierFlags];
|
||||
if (event.keyCode == kVK_Tab && (modifierFlags == NSEventModifierFlagControl || modifierFlags == (NSEventModifierFlagControl | NSEventModifierFlagShift))) {
|
||||
if (is_ctrl_tab(event)) {
|
||||
// Cocoa swallows Ctrl+Tab to cycle between views
|
||||
[[NSApp keyWindow].contentView keyDown:event];
|
||||
}
|
||||
@@ -323,14 +330,13 @@ int _glfwPlatformInit(void)
|
||||
|
||||
NSEvent* (^keyup_block)(NSEvent*) = ^ NSEvent* (NSEvent* event)
|
||||
{
|
||||
NSEventModifierFlags modifierFlags = [event modifierFlags];
|
||||
if ([event modifierFlags] & NSEventModifierFlagCommand) {
|
||||
// From http://cocoadev.com/index.pl?GameKeyboardHandlingAlmost
|
||||
// This works around an AppKit bug, where key up events while holding
|
||||
// down the command key don't get sent to the key window.
|
||||
[[NSApp keyWindow] sendEvent:event];
|
||||
}
|
||||
if (event.keyCode == kVK_Tab && (modifierFlags == NSEventModifierFlagControl || modifierFlags == (NSEventModifierFlagControl | NSEventModifierFlagShift))) {
|
||||
if (is_ctrl_tab(event)) {
|
||||
// Cocoa swallows Ctrl+Tab to cycle between views
|
||||
[[NSApp keyWindow].contentView keyUp:event];
|
||||
}
|
||||
|
||||
3
glfw/x11_platform.h
vendored
3
glfw/x11_platform.h
vendored
@@ -198,9 +198,6 @@ typedef struct _GLFWwindowX11
|
||||
// The last position the cursor was warped to by GLFW
|
||||
int warpCursorPosX, warpCursorPosY;
|
||||
|
||||
// The time of the last KeyPress event
|
||||
Time lastKeyTime;
|
||||
|
||||
} _GLFWwindowX11;
|
||||
|
||||
// X11-specific global data
|
||||
|
||||
4
glfw/x11_window.c
vendored
4
glfw/x11_window.c
vendored
@@ -2244,10 +2244,14 @@ void _glfwPlatformSetWindowMonitor(_GLFWwindow* window,
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!window->resizable)
|
||||
updateNormalHints(window, width, height);
|
||||
|
||||
XMoveResizeWindow(_glfw.x11.display, window->x11.handle,
|
||||
xpos, ypos, width, height);
|
||||
}
|
||||
|
||||
XFlush(_glfw.x11.display);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -208,7 +208,7 @@ class DiffHandler(Handler):
|
||||
break
|
||||
|
||||
if num is not None:
|
||||
self.scroll_pos = min(num, self.max_scroll_pos)
|
||||
self.scroll_pos = max(0, min(num, self.max_scroll_pos))
|
||||
|
||||
@property
|
||||
def num_lines(self):
|
||||
|
||||
@@ -18,7 +18,7 @@ worker_processes = []
|
||||
|
||||
|
||||
def find_differ():
|
||||
if shutil.which('git'):
|
||||
if shutil.which('git') and subprocess.Popen(['git', '--help'], stderr=subprocess.DEVNULL, stdout=subprocess.DEVNULL).wait() == 0:
|
||||
return GIT_DIFF
|
||||
if shutil.which('diff'):
|
||||
return DIFF_DIFF
|
||||
|
||||
@@ -315,8 +315,9 @@ def run(args, text):
|
||||
return
|
||||
|
||||
largest_index = all_marks[-1].index
|
||||
offset = max(0, args.hints_offset)
|
||||
for m in all_marks:
|
||||
m.index = largest_index - m.index
|
||||
m.index = largest_index - m.index + offset
|
||||
index_map = {m.index: m for m in all_marks}
|
||||
except Exception:
|
||||
import traceback
|
||||
@@ -378,6 +379,13 @@ default=auto
|
||||
choices=auto,always,never
|
||||
Add trailing space after matched text. Defaults to auto, which adds the space
|
||||
when used together with --multiple.
|
||||
|
||||
|
||||
--hints-offset
|
||||
default=1
|
||||
type=int
|
||||
The offset (from zero) at which to start hint numbering. Note that only numbers
|
||||
greater than zero are respected.
|
||||
'''.format(','.join(sorted(URL_PREFIXES))).format
|
||||
help_text = 'Select text from the screen using the keyboard. Defaults to searching for URLs.'
|
||||
usage = ''
|
||||
|
||||
@@ -81,6 +81,14 @@ type=bool-set
|
||||
Print out the window size as :italic:`widthxheight` (in pixels) and quit. This is a
|
||||
convenience method to query the window size if using kitty icat from a
|
||||
scripting language that cannot make termios calls.
|
||||
|
||||
|
||||
--stdin
|
||||
type=choices
|
||||
choices=detect,yes,no
|
||||
default=detect
|
||||
Read image data from stdin. The default is to do it automatically, when STDIN is not a terminal,
|
||||
but you can turn it off or on explicitly, if needed.
|
||||
'''
|
||||
|
||||
|
||||
@@ -269,9 +277,10 @@ def main(args=sys.argv):
|
||||
if not sys.stdout.isatty():
|
||||
sys.stdout = open(os.ctermid(), 'w')
|
||||
stdin_data = None
|
||||
if not sys.stdin.isatty():
|
||||
if args.stdin == 'yes' or (not sys.stdin.isatty() and args.stdin == 'detect'):
|
||||
stdin_data = sys.stdin.buffer.read()
|
||||
items.insert(0, stdin_data)
|
||||
if stdin_data:
|
||||
items.insert(0, stdin_data)
|
||||
sys.stdin.close()
|
||||
sys.stdin = open(os.ctermid(), 'r')
|
||||
|
||||
@@ -307,7 +316,7 @@ def main(args=sys.argv):
|
||||
raise SystemExit('You must specify at least one file to cat')
|
||||
if args.place:
|
||||
if len(items) > 1 or (isinstance(items[0], str) and os.path.isdir(items[0])):
|
||||
raise SystemExit('The --place option can only be used with a single image')
|
||||
raise SystemExit(f'The --place option can only be used with a single image, not {items}')
|
||||
sys.stdout.buffer.write(b'\0337') # save cursor
|
||||
for item in items:
|
||||
is_tempfile = False
|
||||
|
||||
@@ -153,8 +153,9 @@ class Loop:
|
||||
def __init__(self,
|
||||
sanitize_bracketed_paste='[\x03\x04\x0e\x0f\r\x07\x7f\x8d\x8e\x8f\x90\x9b\x9d\x9e\x9f]'):
|
||||
if is_macos:
|
||||
# On macOS PTY devices are not supported by the KqueueSelector
|
||||
self.asycio_loop = asyncio.SelectorEventLoop(selectors.PollSelector())
|
||||
# On macOS PTY devices are not supported by the KqueueSelector and
|
||||
# the PollSelector is broken, causes 100% CPU usage
|
||||
self.asycio_loop = asyncio.SelectorEventLoop(selectors.SelectSelector())
|
||||
asyncio.set_event_loop(self.asycio_loop)
|
||||
else:
|
||||
self.asycio_loop = asyncio.get_event_loop()
|
||||
|
||||
@@ -4,5 +4,5 @@ in vec3 color;
|
||||
out vec4 final_color;
|
||||
|
||||
void main() {
|
||||
final_color = vec4(color, background_opacity);
|
||||
final_color = vec4(color * background_opacity, background_opacity);
|
||||
}
|
||||
|
||||
@@ -72,7 +72,11 @@ vec4 calculate_foreground() {
|
||||
void main() {
|
||||
#ifdef BACKGROUND
|
||||
#ifdef TRANSPARENT
|
||||
final_color = vec4(background.rgb * bg_alpha, bg_alpha);
|
||||
// bg_alpha is doubled to match rendering in the SIMPLE case
|
||||
// and also rendering of the margin/padding, see https://github.com/kovidgoyal/kitty/pull/1291
|
||||
// to test use background_opacity, window_margin_width and icat to display
|
||||
// an image.
|
||||
final_color = vec4(background.rgb * bg_alpha * bg_alpha, bg_alpha);
|
||||
#else
|
||||
final_color = vec4(background.rgb, 1.0f);
|
||||
#endif
|
||||
@@ -101,7 +105,7 @@ void main() {
|
||||
#else
|
||||
// SIMPLE
|
||||
#ifdef TRANSPARENT
|
||||
final_color = alpha_blend_premul(fg.rgb, fg.a, background, bg_alpha);
|
||||
final_color = alpha_blend_premul(fg.rgb, fg.a, background * bg_alpha, bg_alpha);
|
||||
final_color = vec4(final_color.rgb, final_color.a);
|
||||
#else
|
||||
// since background alpha is 1.0, it is effectively pre-multiplied
|
||||
|
||||
@@ -771,6 +771,9 @@ static unsigned int cocoa_pending_actions = 0;
|
||||
void
|
||||
set_cocoa_pending_action(CocoaPendingAction action) {
|
||||
cocoa_pending_actions |= action;
|
||||
// The main loop may be blocking on the event queue, if e.g. unfocused.
|
||||
// Unjam it so the pending action is processed right now.
|
||||
unjam_event_loop();
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -915,6 +915,8 @@ if is_macos:
|
||||
k('new_os_window', 'cmd+n', 'new_os_window', _('New OS window'))
|
||||
k('new_os_window', 'kitty_mod+n', 'new_os_window', _('New OS window'))
|
||||
k('close_window', 'kitty_mod+w', 'close_window', _('Close window'))
|
||||
if is_macos:
|
||||
k('close_window', 'cmd+w', 'close_window', _('Close window'), add_to_docs=False)
|
||||
k('next_window', 'kitty_mod+]', 'next_window', _('Next window'))
|
||||
k('previous_window', 'kitty_mod+[', 'previous_window', _('Previous window'))
|
||||
k('move_window_forward', 'kitty_mod+f', 'move_window_forward', _('Move window forward'))
|
||||
@@ -935,12 +937,14 @@ k('tenth_window', 'kitty_mod+0', 'tenth_window', _('Tenth window'))
|
||||
|
||||
g('shortcuts.tab') # {{{
|
||||
if is_macos:
|
||||
k('next_tab', 'ctrl+tab', 'next_tab', _('Next tab'))
|
||||
k('next_tab', 'ctrl+tab', 'next_tab', _('Next tab'), add_to_docs=False)
|
||||
k('next_tab', 'kitty_mod+right', 'next_tab', _('Next tab'))
|
||||
if is_macos:
|
||||
k('previous_tab', 'ctrl+shift+tab', 'previous_tab', _('Previous tab'))
|
||||
k('previous_tab', 'ctrl+shift+tab', 'previous_tab', _('Previous tab'), add_to_docs=False)
|
||||
k('previous_tab', 'kitty_mod+left', 'previous_tab', _('Previous tab'))
|
||||
k('new_tab', 'kitty_mod+t', 'new_tab', _('New tab'))
|
||||
if is_macos:
|
||||
k('new_tab', 'cmd+t', 'new_tab', _('New tab'), add_to_docs=False)
|
||||
k('close_tab', 'kitty_mod+q', 'close_tab', _('Close tab'))
|
||||
k('move_tab_forward', 'kitty_mod+.', 'move_tab_forward', _('Move tab forward'))
|
||||
k('move_tab_backward', 'kitty_mod+,', 'move_tab_backward', _('Move tab backward'))
|
||||
|
||||
@@ -8,7 +8,7 @@ import sys
|
||||
from collections import namedtuple
|
||||
|
||||
appname = 'kitty'
|
||||
version = (0, 13, 2)
|
||||
version = (0, 13, 3)
|
||||
str_version = '.'.join(map(str, version))
|
||||
_plat = sys.platform.lower()
|
||||
is_macos = 'darwin' in _plat
|
||||
|
||||
32
kitty/glfw.c
32
kitty/glfw.c
@@ -35,8 +35,8 @@ update_os_window_viewport(OSWindow *window, bool notify_boss) {
|
||||
}
|
||||
window->viewport_width = fw; window->viewport_height = fh;
|
||||
double xr = window->viewport_x_ratio, yr = window->viewport_y_ratio;
|
||||
window->viewport_x_ratio = (double)window->viewport_width / (double)w;
|
||||
window->viewport_y_ratio = (double)window->viewport_height / (double)h;
|
||||
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);
|
||||
@@ -57,6 +57,19 @@ update_os_window_viewport(OSWindow *window, bool notify_boss) {
|
||||
}
|
||||
}
|
||||
|
||||
// On Cocoa, glfwWaitEvents() can block indefinitely because of the way Cocoa
|
||||
// works. See https://github.com/glfw/glfw/issues/1251. I have noticed this
|
||||
// happening in particular with window resize events, when waiting with no
|
||||
// timeout. See https://github.com/kovidgoyal/kitty/issues/458
|
||||
// So we use an unlovely hack to workaround that case
|
||||
void
|
||||
unjam_event_loop() {
|
||||
#ifdef __APPLE__
|
||||
if (event_loop_blocking_with_no_timeout)
|
||||
wakeup_main_loop();
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
// callbacks {{{
|
||||
|
||||
@@ -98,16 +111,6 @@ show_mouse_cursor(GLFWwindow *w) {
|
||||
}
|
||||
|
||||
static int min_width = 100, min_height = 100;
|
||||
// On Cocoa, glfwWaitEvents() can block indefinitely because of the way Cocoa
|
||||
// works. See https://github.com/glfw/glfw/issues/1251. I have noticed this
|
||||
// happening in particular with window resize events, when waiting with no
|
||||
// timeout. See https://github.com/kovidgoyal/kitty/issues/458
|
||||
// So we use an unlovely hack to workaround that case
|
||||
#ifdef __APPLE__
|
||||
#define unjam_event_loop() { if (event_loop_blocking_with_no_timeout) wakeup_main_loop(); }
|
||||
#else
|
||||
#define unjam_event_loop()
|
||||
#endif
|
||||
|
||||
static void
|
||||
framebuffer_size_callback(GLFWwindow *w, int width, int height) {
|
||||
@@ -352,8 +355,9 @@ get_window_dpi(GLFWwindow *w, double *x, double *y) {
|
||||
float xscale = 1, yscale = 1;
|
||||
if (w) glfwGetWindowContentScale(w, &xscale, &yscale);
|
||||
else glfwGetMonitorContentScale(glfwGetPrimaryMonitor(), &xscale, &yscale);
|
||||
if (!xscale) xscale = 1.0;
|
||||
if (!yscale) yscale = 1.0;
|
||||
// check for zero or NaN values of xscale/yscale
|
||||
if (!xscale || xscale != xscale) xscale = 1.0;
|
||||
if (!yscale || yscale != yscale) yscale = 1.0;
|
||||
#ifdef __APPLE__
|
||||
double factor = 72.0;
|
||||
#else
|
||||
|
||||
@@ -231,7 +231,7 @@ def _main():
|
||||
rpath = os.path.dirname(kitty_exe())
|
||||
items = frozenset(os.environ['PATH'].split(os.pathsep))
|
||||
if rpath and rpath not in items:
|
||||
os.environ['PATH'] += os.pathsep + rpath
|
||||
os.environ['PATH'] = rpath + os.pathsep + os.environ.get('PATH', '')
|
||||
|
||||
args = sys.argv[1:]
|
||||
if is_macos and os.environ.pop('KITTY_LAUNCHED_BY_LAUNCH_SERVICES', None) == '1':
|
||||
|
||||
@@ -615,6 +615,10 @@ scroll_event(double UNUSED xoffset, double yoffset, int flags) {
|
||||
// Only use wheel_scroll_multiplier if we are scrolling kitty scrollback or in mouse
|
||||
// tracking mode, where the application is responsible for interpreting scroll events
|
||||
yoffset *= OPT(wheel_scroll_multiplier);
|
||||
} else if (OPT(wheel_scroll_multiplier) < 0) {
|
||||
// ensure that changing scroll direction still works, even though
|
||||
// we are not using wheel_scroll_multiplier
|
||||
yoffset *= -1;
|
||||
}
|
||||
s = (int) round(yoffset);
|
||||
// apparently on cocoa some mice generate really small yoffset values
|
||||
|
||||
@@ -172,6 +172,7 @@ void make_os_window_context_current(OSWindow *w);
|
||||
void update_os_window_references();
|
||||
void mark_os_window_for_close(OSWindow* w, bool yes);
|
||||
void update_os_window_viewport(OSWindow *window, bool);
|
||||
void unjam_event_loop();
|
||||
bool should_os_window_close(OSWindow* w);
|
||||
bool should_os_window_be_rendered(OSWindow* w);
|
||||
void wakeup_main_loop();
|
||||
|
||||
@@ -93,7 +93,7 @@ def load_shader_programs(semi_transparent=0):
|
||||
def setup_colors(screen, opts):
|
||||
screen.color_profile.update_ansi_color_table(build_ansi_color_table(opts))
|
||||
cursor_text_color = opts.cursor_text_color or (12, 12, 12)
|
||||
cursor_text_color_as_bg = 3 if cursor_text_color is None else 1
|
||||
cursor_text_color_as_bg = 3 if opts.cursor_text_color is None else 1
|
||||
screen.color_profile.set_configured_colors(*map(color_as_int, (
|
||||
opts.foreground, opts.background, opts.cursor,
|
||||
cursor_text_color, (0, 0, cursor_text_color_as_bg),
|
||||
|
||||
5
setup.py
5
setup.py
@@ -394,7 +394,8 @@ def compile_c_extension(kenv, module, incremental, compilation_database, all_key
|
||||
if todo:
|
||||
parallel_run(todo)
|
||||
dest = os.path.join(base, module + '.temp.so')
|
||||
if not incremental or newer(dest, *objects):
|
||||
real_dest = dest[:-len('.temp.so')] + '.so'
|
||||
if not incremental or newer(real_dest, *objects):
|
||||
# Old versions of clang don't like -pthread being passed to the linker
|
||||
# Don't treat linker warnings as errors (linker generates spurious
|
||||
# warnings on some old systems)
|
||||
@@ -408,7 +409,7 @@ def compile_c_extension(kenv, module, incremental, compilation_database, all_key
|
||||
except EnvironmentError:
|
||||
pass
|
||||
else:
|
||||
os.rename(dest, dest[:-len('.temp.so')] + '.so')
|
||||
os.rename(dest, real_dest)
|
||||
|
||||
|
||||
def find_c_files():
|
||||
|
||||
Reference in New Issue
Block a user