macOS: Add an option :opt:macos_traditional_fullscreen to make full-screening of kitty windows much faster, but less pretty.
See #911
This commit is contained in:
parent
4e99194022
commit
772d6597a9
@ -25,10 +25,8 @@ Changelog
|
||||
on macs thicker, which makes it similar to the result of
|
||||
sub-pixel antialiasing (:pull:`950`)
|
||||
|
||||
- macOS: Make full screening of kitty much faster by using the "traditional full
|
||||
screen" mode of cocoa, similar to iTerm and MacVim (:iss:`911`). Also should
|
||||
hopefully workaround a bug in glfw that causes crashes when unplugging
|
||||
monitors with full screen windows. (:iss:`898`)
|
||||
- macOS: Add an option :opt:`macos_traditional_fullscreen` to make
|
||||
full-screening of kitty windows much faster, but less pretty. (:iss:`911`)
|
||||
|
||||
- Fix a bug causing incorrect line ordering when viewing the scrollback buffer
|
||||
if the scrollback buffer is full (:iss:`960`)
|
||||
|
||||
@ -225,12 +225,13 @@ cocoa_focus_window(void *w) {
|
||||
}
|
||||
|
||||
bool
|
||||
cocoa_toggle_fullscreen(void *w) {
|
||||
cocoa_toggle_fullscreen(void *w, bool traditional) {
|
||||
NSWindow *window = (NSWindow*)w;
|
||||
bool made_fullscreen = true;
|
||||
NSWindowStyleMask sm = [window styleMask];
|
||||
bool made_fullscreen;
|
||||
if (!(sm & NSWindowStyleMaskFullScreen)) {
|
||||
made_fullscreen = true;
|
||||
bool in_fullscreen = sm & NSWindowStyleMaskFullScreen;
|
||||
if (traditional) {
|
||||
if (!(in_fullscreen)) {
|
||||
sm |= NSWindowStyleMaskBorderless | NSWindowStyleMaskFullScreen;
|
||||
[[NSApplication sharedApplication] setPresentationOptions: NSApplicationPresentationAutoHideMenuBar | NSApplicationPresentationAutoHideDock];
|
||||
} else {
|
||||
@ -239,6 +240,10 @@ cocoa_toggle_fullscreen(void *w) {
|
||||
[[NSApplication sharedApplication] setPresentationOptions: NSApplicationPresentationDefault];
|
||||
}
|
||||
[window setStyleMask: sm];
|
||||
} else {
|
||||
if (in_fullscreen) made_fullscreen = false;
|
||||
[window toggleFullScreen: nil];
|
||||
}
|
||||
return made_fullscreen;
|
||||
}
|
||||
|
||||
|
||||
@ -786,6 +786,10 @@ legibility at small font sizes. For example, a value of 0.75 will
|
||||
result in rendering that looks similar to sub-pixel antialiasing at
|
||||
common font sizes.
|
||||
'''))
|
||||
|
||||
o('macos_traditional_fullscreen', False, long_text=_('''
|
||||
Use the traditional full-screen transition, that is faster, but less pretty.
|
||||
'''))
|
||||
# }}}
|
||||
|
||||
g('shortcuts') # {{{
|
||||
|
||||
10
kitty/glfw.c
10
kitty/glfw.c
@ -10,7 +10,7 @@
|
||||
#include "glfw-wrapper.h"
|
||||
extern bool cocoa_make_window_resizable(void *w, bool);
|
||||
extern void cocoa_focus_window(void *w);
|
||||
extern bool cocoa_toggle_fullscreen(void *w);
|
||||
extern bool cocoa_toggle_fullscreen(void *w, bool);
|
||||
extern void cocoa_create_global_menu(void);
|
||||
extern void cocoa_set_hide_from_tasks(void);
|
||||
extern void cocoa_set_titlebar_color(void *w, color_type color);
|
||||
@ -362,7 +362,8 @@ toggle_fullscreen_for_os_window(OSWindow *w) {
|
||||
glfwGetWindowSize(w->handle, &width, &height);
|
||||
glfwGetWindowPos(w->handle, &x, &y);
|
||||
#ifdef __APPLE__
|
||||
if (cocoa_toggle_fullscreen(glfwGetCocoaWindow(w->handle))) {
|
||||
if (OPT(macos_traditional_fullscreen)) {
|
||||
if (cocoa_toggle_fullscreen(glfwGetCocoaWindow(w->handle), true)) {
|
||||
w->before_fullscreen.is_set = true;
|
||||
w->before_fullscreen.w = width; w->before_fullscreen.h = height; w->before_fullscreen.x = x; w->before_fullscreen.y = y;
|
||||
return true;
|
||||
@ -372,6 +373,9 @@ toggle_fullscreen_for_os_window(OSWindow *w) {
|
||||
glfwSetWindowPos(w->handle, w->before_fullscreen.x, w->before_fullscreen.y);
|
||||
}
|
||||
return false;
|
||||
} else {
|
||||
return cocoa_toggle_fullscreen(glfwGetCocoaWindow(w->handle), false);
|
||||
}
|
||||
#else
|
||||
GLFWmonitor *monitor;
|
||||
if ((monitor = glfwGetWindowMonitor(w->handle)) == NULL) {
|
||||
@ -418,7 +422,7 @@ on_application_reopen(int has_visible_windows) {
|
||||
|
||||
static int
|
||||
intercept_cocoa_fullscreen(GLFWwindow *w) {
|
||||
if (!set_callback_window(w)) return 0;
|
||||
if (!OPT(macos_traditional_fullscreen) || !set_callback_window(w)) return 0;
|
||||
toggle_fullscreen_for_os_window(global_state.callback_os_window);
|
||||
global_state.callback_os_window = NULL;
|
||||
return 1;
|
||||
|
||||
@ -386,6 +386,7 @@ PYWRAP1(set_options) {
|
||||
S(close_on_child_death, PyObject_IsTrue);
|
||||
S(window_alert_on_bell, PyObject_IsTrue);
|
||||
S(macos_option_as_alt, PyObject_IsTrue);
|
||||
S(macos_traditional_fullscreen, PyObject_IsTrue);
|
||||
S(macos_hide_titlebar, PyObject_IsTrue);
|
||||
S(macos_quit_when_last_window_closed, PyObject_IsTrue);
|
||||
S(macos_window_resizable, PyObject_IsTrue);
|
||||
|
||||
@ -23,7 +23,7 @@ typedef struct {
|
||||
color_type url_color, background, active_border_color, inactive_border_color, bell_border_color;
|
||||
double repaint_delay, input_delay;
|
||||
bool focus_follows_mouse;
|
||||
bool macos_option_as_alt, macos_hide_titlebar, macos_hide_from_tasks, x11_hide_window_decorations, macos_quit_when_last_window_closed, macos_window_resizable;
|
||||
bool macos_option_as_alt, macos_hide_titlebar, macos_hide_from_tasks, x11_hide_window_decorations, macos_quit_when_last_window_closed, macos_window_resizable, macos_traditional_fullscreen;
|
||||
float macos_thicken_font;
|
||||
int adjust_line_height_px, adjust_column_width_px;
|
||||
float adjust_line_height_frac, adjust_column_width_frac;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user