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