Merge branch 'feat-macos-fullscreen' of https://github.com/page-down/kitty
This commit is contained in:
commit
cfd0872cea
1
glfw/cocoa_platform.h
vendored
1
glfw/cocoa_platform.h
vendored
@ -131,6 +131,7 @@ typedef struct _GLFWwindowNS
|
|||||||
bool maximized;
|
bool maximized;
|
||||||
bool retina;
|
bool retina;
|
||||||
bool in_traditional_fullscreen;
|
bool in_traditional_fullscreen;
|
||||||
|
bool in_fullscreen_transition;
|
||||||
bool titlebar_hidden;
|
bool titlebar_hidden;
|
||||||
unsigned long pre_full_screen_style_mask;
|
unsigned long pre_full_screen_style_mask;
|
||||||
|
|
||||||
|
|||||||
@ -722,6 +722,18 @@ static const NSRange kEmptyRange = { NSNotFound, 0 };
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void)windowDidEnterFullScreen:(NSNotification *)notification
|
||||||
|
{
|
||||||
|
(void)notification;
|
||||||
|
window->ns.in_fullscreen_transition = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)windowDidExitFullScreen:(NSNotification *)notification
|
||||||
|
{
|
||||||
|
(void)notification;
|
||||||
|
window->ns.in_fullscreen_transition = false;
|
||||||
|
}
|
||||||
|
|
||||||
@end // }}}
|
@end // }}}
|
||||||
|
|
||||||
// Text input context class for the GLFW content view {{{
|
// Text input context class for the GLFW content view {{{
|
||||||
@ -1554,8 +1566,10 @@ void _glfwPlatformUpdateIMEState(_GLFWwindow *w, const GLFWIMEUpdateEvent *ev) {
|
|||||||
|
|
||||||
- (void)toggleFullScreen:(nullable id)sender
|
- (void)toggleFullScreen:(nullable id)sender
|
||||||
{
|
{
|
||||||
|
if (glfw_window->ns.in_fullscreen_transition) return;
|
||||||
if (glfw_window && glfw_window->ns.toggleFullscreenCallback && glfw_window->ns.toggleFullscreenCallback((GLFWwindow*)glfw_window) == 1)
|
if (glfw_window && glfw_window->ns.toggleFullscreenCallback && glfw_window->ns.toggleFullscreenCallback((GLFWwindow*)glfw_window) == 1)
|
||||||
return;
|
return;
|
||||||
|
glfw_window->ns.in_fullscreen_transition = true;
|
||||||
// When resizeIncrements is set, Cocoa cannot restore the original window size after returning from fullscreen.
|
// When resizeIncrements is set, Cocoa cannot restore the original window size after returning from fullscreen.
|
||||||
const NSSize original = [self resizeIncrements];
|
const NSSize original = [self resizeIncrements];
|
||||||
[self setResizeIncrements:NSMakeSize(1.0, 1.0)];
|
[self setResizeIncrements:NSMakeSize(1.0, 1.0)];
|
||||||
|
|||||||
@ -1039,6 +1039,7 @@ process_cocoa_pending_actions(void) {
|
|||||||
if (cocoa_pending_actions[CLEAR_TERMINAL_AND_SCROLLBACK]) { call_boss(clear_terminal, "sO", "to_cursor", Py_True ); }
|
if (cocoa_pending_actions[CLEAR_TERMINAL_AND_SCROLLBACK]) { call_boss(clear_terminal, "sO", "to_cursor", Py_True ); }
|
||||||
if (cocoa_pending_actions[RELOAD_CONFIG]) { call_boss(load_config_file, NULL); }
|
if (cocoa_pending_actions[RELOAD_CONFIG]) { call_boss(load_config_file, NULL); }
|
||||||
if (cocoa_pending_actions[TOGGLE_MACOS_SECURE_KEYBOARD_ENTRY]) { call_boss(toggle_macos_secure_keyboard_entry, NULL); }
|
if (cocoa_pending_actions[TOGGLE_MACOS_SECURE_KEYBOARD_ENTRY]) { call_boss(toggle_macos_secure_keyboard_entry, NULL); }
|
||||||
|
if (cocoa_pending_actions[TOGGLE_FULLSCREEN]) { call_boss(toggle_fullscreen, NULL); }
|
||||||
if (cocoa_pending_actions_data.wd) {
|
if (cocoa_pending_actions_data.wd) {
|
||||||
if (cocoa_pending_actions[NEW_OS_WINDOW_WITH_WD]) { call_boss(new_os_window_with_wd, "s", cocoa_pending_actions_data.wd); }
|
if (cocoa_pending_actions[NEW_OS_WINDOW_WITH_WD]) { call_boss(new_os_window_with_wd, "s", cocoa_pending_actions_data.wd); }
|
||||||
if (cocoa_pending_actions[NEW_TAB_WITH_WD]) { call_boss(new_tab_with_wd, "s", cocoa_pending_actions_data.wd); }
|
if (cocoa_pending_actions[NEW_TAB_WITH_WD]) { call_boss(new_tab_with_wd, "s", cocoa_pending_actions_data.wd); }
|
||||||
|
|||||||
@ -234,6 +234,7 @@ PENDING(reset_terminal, RESET_TERMINAL)
|
|||||||
PENDING(clear_terminal_and_scrollback, CLEAR_TERMINAL_AND_SCROLLBACK)
|
PENDING(clear_terminal_and_scrollback, CLEAR_TERMINAL_AND_SCROLLBACK)
|
||||||
PENDING(reload_config, RELOAD_CONFIG)
|
PENDING(reload_config, RELOAD_CONFIG)
|
||||||
PENDING(toggle_macos_secure_keyboard_entry, TOGGLE_MACOS_SECURE_KEYBOARD_ENTRY)
|
PENDING(toggle_macos_secure_keyboard_entry, TOGGLE_MACOS_SECURE_KEYBOARD_ENTRY)
|
||||||
|
PENDING(toggle_fullscreen, TOGGLE_FULLSCREEN)
|
||||||
|
|
||||||
- (void)open_kitty_website_url:(id)sender {
|
- (void)open_kitty_website_url:(id)sender {
|
||||||
(void)sender;
|
(void)sender;
|
||||||
@ -243,6 +244,8 @@ PENDING(toggle_macos_secure_keyboard_entry, TOGGLE_MACOS_SECURE_KEYBOARD_ENTRY)
|
|||||||
- (BOOL)validateMenuItem:(NSMenuItem *)item {
|
- (BOOL)validateMenuItem:(NSMenuItem *)item {
|
||||||
if (item.action == @selector(toggle_macos_secure_keyboard_entry:)) {
|
if (item.action == @selector(toggle_macos_secure_keyboard_entry:)) {
|
||||||
item.state = [SecureKeyboardEntryController sharedInstance].isDesired ? NSControlStateValueOn : NSControlStateValueOff;
|
item.state = [SecureKeyboardEntryController sharedInstance].isDesired ? NSControlStateValueOn : NSControlStateValueOff;
|
||||||
|
} else if (item.action == @selector(toggle_fullscreen:)) {
|
||||||
|
item.title = ([NSApp currentSystemPresentationOptions] & NSApplicationPresentationFullScreen) ? @"Exit Full Screen" : @"Enter Full Screen";
|
||||||
}
|
}
|
||||||
return YES;
|
return YES;
|
||||||
}
|
}
|
||||||
@ -272,7 +275,7 @@ typedef struct {
|
|||||||
typedef struct {
|
typedef struct {
|
||||||
GlobalShortcut new_os_window, close_os_window, close_tab, edit_config_file, reload_config;
|
GlobalShortcut new_os_window, close_os_window, close_tab, edit_config_file, reload_config;
|
||||||
GlobalShortcut previous_tab, next_tab, new_tab, new_window, close_window, reset_terminal, clear_terminal_and_scrollback;
|
GlobalShortcut previous_tab, next_tab, new_tab, new_window, close_window, reset_terminal, clear_terminal_and_scrollback;
|
||||||
GlobalShortcut toggle_macos_secure_keyboard_entry;
|
GlobalShortcut toggle_macos_secure_keyboard_entry, toggle_fullscreen;
|
||||||
} GlobalShortcuts;
|
} GlobalShortcuts;
|
||||||
static GlobalShortcuts global_shortcuts;
|
static GlobalShortcuts global_shortcuts;
|
||||||
|
|
||||||
@ -287,7 +290,7 @@ cocoa_set_global_shortcut(PyObject *self UNUSED, PyObject *args) {
|
|||||||
Q(new_os_window); else Q(close_os_window); else Q(close_tab); else Q(edit_config_file);
|
Q(new_os_window); else Q(close_os_window); else Q(close_tab); else Q(edit_config_file);
|
||||||
else Q(new_tab); else Q(next_tab); else Q(previous_tab);
|
else Q(new_tab); else Q(next_tab); else Q(previous_tab);
|
||||||
else Q(new_window); else Q(close_window); else Q(reset_terminal); else Q(clear_terminal_and_scrollback); else Q(reload_config);
|
else Q(new_window); else Q(close_window); else Q(reset_terminal); else Q(clear_terminal_and_scrollback); else Q(reload_config);
|
||||||
else Q(toggle_macos_secure_keyboard_entry);
|
else Q(toggle_macos_secure_keyboard_entry); else Q(toggle_fullscreen);
|
||||||
#undef Q
|
#undef Q
|
||||||
if (gs == NULL) { PyErr_SetString(PyExc_KeyError, "Unknown shortcut name"); return NULL; }
|
if (gs == NULL) { PyErr_SetString(PyExc_KeyError, "Unknown shortcut name"); return NULL; }
|
||||||
int cocoa_mods;
|
int cocoa_mods;
|
||||||
@ -636,10 +639,7 @@ cocoa_create_global_menu(void) {
|
|||||||
keyEquivalent:@""] setTarget:global_menu_target];
|
keyEquivalent:@""] setTarget:global_menu_target];
|
||||||
|
|
||||||
[windowMenu addItem:[NSMenuItem separatorItem]];
|
[windowMenu addItem:[NSMenuItem separatorItem]];
|
||||||
[[windowMenu addItemWithTitle:@"Enter Full Screen"
|
MENU_ITEM(windowMenu, @"Enter Full Screen", toggle_fullscreen);
|
||||||
action:@selector(toggleFullScreen:)
|
|
||||||
keyEquivalent:@"f"]
|
|
||||||
setKeyEquivalentModifierMask:NSEventModifierFlagControl | NSEventModifierFlagCommand];
|
|
||||||
[NSApp setWindowsMenu:windowMenu];
|
[NSApp setWindowsMenu:windowMenu];
|
||||||
[windowMenu release];
|
[windowMenu release];
|
||||||
|
|
||||||
|
|||||||
@ -151,7 +151,7 @@ def _run_app(opts: Options, args: CLIOptions, bad_lines: Sequence[BadLine] = ())
|
|||||||
func_map[parts].append(k)
|
func_map[parts].append(k)
|
||||||
|
|
||||||
for ac in ('new_os_window', 'close_os_window', 'close_tab', 'edit_config_file', 'previous_tab',
|
for ac in ('new_os_window', 'close_os_window', 'close_tab', 'edit_config_file', 'previous_tab',
|
||||||
'next_tab', 'new_tab', 'new_window', 'close_window', 'toggle_macos_secure_keyboard_entry'):
|
'next_tab', 'new_tab', 'new_window', 'close_window', 'toggle_macos_secure_keyboard_entry', 'toggle_fullscreen'):
|
||||||
val = get_macos_shortcut_for(func_map, ac)
|
val = get_macos_shortcut_for(func_map, ac)
|
||||||
if val is not None:
|
if val is not None:
|
||||||
global_shortcuts[ac] = val
|
global_shortcuts[ac] = val
|
||||||
|
|||||||
@ -3572,6 +3572,10 @@ agr('shortcuts.misc', 'Miscellaneous')
|
|||||||
map('Toggle fullscreen',
|
map('Toggle fullscreen',
|
||||||
'toggle_fullscreen kitty_mod+f11 toggle_fullscreen',
|
'toggle_fullscreen kitty_mod+f11 toggle_fullscreen',
|
||||||
)
|
)
|
||||||
|
map('Toggle fullscreen',
|
||||||
|
'toggle_fullscreen ctrl+cmd+f toggle_fullscreen',
|
||||||
|
only='macos',
|
||||||
|
)
|
||||||
|
|
||||||
map('Toggle maximized',
|
map('Toggle maximized',
|
||||||
'toggle_maximized kitty_mod+f10 toggle_maximized',
|
'toggle_maximized kitty_mod+f10 toggle_maximized',
|
||||||
|
|||||||
1
kitty/options/types.py
generated
1
kitty/options/types.py
generated
@ -905,6 +905,7 @@ if is_macos:
|
|||||||
defaults.map.append(KeyDefinition(trigger=SingleKey(mods=8, key=45), definition='change_font_size all -2.0')) # noqa
|
defaults.map.append(KeyDefinition(trigger=SingleKey(mods=8, key=45), definition='change_font_size all -2.0')) # noqa
|
||||||
defaults.map.append(KeyDefinition(trigger=SingleKey(mods=9, key=45), definition='change_font_size all -2.0')) # noqa
|
defaults.map.append(KeyDefinition(trigger=SingleKey(mods=9, key=45), definition='change_font_size all -2.0')) # noqa
|
||||||
defaults.map.append(KeyDefinition(trigger=SingleKey(mods=8, key=48), definition='change_font_size all 0')) # noqa
|
defaults.map.append(KeyDefinition(trigger=SingleKey(mods=8, key=48), definition='change_font_size all 0')) # noqa
|
||||||
|
defaults.map.append(KeyDefinition(trigger=SingleKey(mods=12, key=102), definition='toggle_fullscreen')) # noqa
|
||||||
defaults.map.append(KeyDefinition(trigger=SingleKey(mods=10, key=115), definition='toggle_macos_secure_keyboard_entry')) # noqa
|
defaults.map.append(KeyDefinition(trigger=SingleKey(mods=10, key=115), definition='toggle_macos_secure_keyboard_entry')) # noqa
|
||||||
defaults.map.append(KeyDefinition(trigger=SingleKey(mods=12, key=32), definition='kitten unicode_input')) # noqa
|
defaults.map.append(KeyDefinition(trigger=SingleKey(mods=12, key=32), definition='kitten unicode_input')) # noqa
|
||||||
defaults.map.append(KeyDefinition(trigger=SingleKey(mods=8, key=44), definition='edit_config_file')) # noqa
|
defaults.map.append(KeyDefinition(trigger=SingleKey(mods=8, key=44), definition='edit_config_file')) # noqa
|
||||||
|
|||||||
@ -308,6 +308,7 @@ typedef enum {
|
|||||||
CLEAR_TERMINAL_AND_SCROLLBACK,
|
CLEAR_TERMINAL_AND_SCROLLBACK,
|
||||||
RELOAD_CONFIG,
|
RELOAD_CONFIG,
|
||||||
TOGGLE_MACOS_SECURE_KEYBOARD_ENTRY,
|
TOGGLE_MACOS_SECURE_KEYBOARD_ENTRY,
|
||||||
|
TOGGLE_FULLSCREEN,
|
||||||
|
|
||||||
NUM_COCOA_PENDING_ACTIONS
|
NUM_COCOA_PENDING_ACTIONS
|
||||||
} CocoaPendingAction;
|
} CocoaPendingAction;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user