Cleanup previous PR
Simplify wrapping of toggle_secure_input Dont duplicate debug_keyboard flag in two places
This commit is contained in:
parent
eafd20b4b3
commit
24c44861ef
@ -1894,7 +1894,7 @@ class Boss:
|
||||
from .fonts.box_drawing import set_scale
|
||||
|
||||
# Update options storage
|
||||
set_options(opts, is_wayland(), self.args.debug_keyboard, self.args.debug_rendering, self.args.debug_font_fallback)
|
||||
set_options(opts, is_wayland(), self.args.debug_rendering, self.args.debug_font_fallback)
|
||||
apply_options_update()
|
||||
set_layout_options(opts)
|
||||
set_default_env(opts.env.copy())
|
||||
|
||||
@ -76,7 +76,7 @@ find_app_name(void) {
|
||||
return @"kitty";
|
||||
}
|
||||
|
||||
#define debug_key(...) if (global_state.debug_keyboard) { fprintf(stderr, __VA_ARGS__); fflush(stderr); }
|
||||
#define debug_key(...) if (OPT(debug_keyboard)) { fprintf(stderr, __VA_ARGS__); fflush(stderr); }
|
||||
|
||||
// SecureKeyboardEntryController {{{
|
||||
@interface SecureKeyboardEntryController : NSObject
|
||||
|
||||
@ -526,7 +526,6 @@ def sync_os_window_title(os_window_id: int) -> None:
|
||||
def set_options(
|
||||
opts: Optional[Options],
|
||||
is_wayland: bool = False,
|
||||
debug_keyboard: bool = False,
|
||||
debug_rendering: bool = False,
|
||||
debug_font_fallback: bool = False
|
||||
) -> None:
|
||||
@ -764,9 +763,11 @@ def get_clipboard_string() -> str:
|
||||
def focus_os_window(os_window_id: int, also_raise: bool = True) -> bool:
|
||||
pass
|
||||
|
||||
|
||||
def toggle_secure_input() -> None:
|
||||
pass
|
||||
|
||||
|
||||
def start_profiler(path: str) -> None:
|
||||
pass
|
||||
|
||||
|
||||
16
kitty/glfw.c
16
kitty/glfw.c
@ -966,13 +966,6 @@ focus_os_window(OSWindow *w, bool also_raise) {
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
toggle_secure_input(void) {
|
||||
#ifdef __APPLE__
|
||||
cocoa_toggle_secure_keyboard_entry();
|
||||
#endif
|
||||
}
|
||||
|
||||
// Global functions {{{
|
||||
static void
|
||||
error_callback(int error, const char* description) {
|
||||
@ -1189,6 +1182,14 @@ glfw_window_hint(PyObject UNUSED *self, PyObject *args) {
|
||||
|
||||
// }}}
|
||||
|
||||
static PyObject*
|
||||
toggle_secure_input(PYNOARG) {
|
||||
#ifdef __APPLE__
|
||||
cocoa_toggle_secure_keyboard_entry();
|
||||
#endif
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
static PyObject*
|
||||
get_clipboard_string(PYNOARG) {
|
||||
OSWindow *w = current_os_window();
|
||||
@ -1570,6 +1571,7 @@ static PyMethodDef module_methods[] = {
|
||||
{"create_os_window", (PyCFunction)(void (*) (void))(create_os_window), METH_VARARGS | METH_KEYWORDS, NULL},
|
||||
METHODB(set_default_window_icon, METH_VARARGS),
|
||||
METHODB(get_clipboard_string, METH_NOARGS),
|
||||
METHODB(toggle_secure_input, METH_NOARGS),
|
||||
METHODB(get_content_scale_for_window, METH_NOARGS),
|
||||
METHODB(ring_bell, METH_NOARGS),
|
||||
METHODB(set_clipboard_string, METH_VARARGS),
|
||||
|
||||
@ -191,7 +191,7 @@ class AppRunner:
|
||||
|
||||
def __call__(self, opts: Options, args: CLIOptions, bad_lines: Sequence[BadLine] = ()) -> None:
|
||||
set_scale(opts.box_drawing_scale)
|
||||
set_options(opts, is_wayland(), args.debug_keyboard, args.debug_rendering, args.debug_font_fallback)
|
||||
set_options(opts, is_wayland(), args.debug_rendering, args.debug_font_fallback)
|
||||
try:
|
||||
set_font_family(opts, debug_font_matching=args.debug_font_fallback)
|
||||
_run_app(opts, args, bad_lines)
|
||||
|
||||
@ -684,8 +684,8 @@ PYWRAP0(get_options) {
|
||||
|
||||
PYWRAP1(set_options) {
|
||||
PyObject *opts;
|
||||
int is_wayland = 0, debug_keyboard = 0, debug_rendering = 0, debug_font_fallback = 0;
|
||||
PA("O|pppp", &opts, &is_wayland, &debug_keyboard, &debug_rendering, &debug_font_fallback);
|
||||
int is_wayland = 0, debug_rendering = 0, debug_font_fallback = 0;
|
||||
PA("O|pppp", &opts, &is_wayland, &debug_rendering, &debug_font_fallback);
|
||||
if (opts == Py_None) {
|
||||
Py_CLEAR(options_object);
|
||||
Py_RETURN_NONE;
|
||||
@ -695,7 +695,6 @@ PYWRAP1(set_options) {
|
||||
global_state.has_render_frames = true;
|
||||
#endif
|
||||
if (global_state.is_wayland) global_state.has_render_frames = true;
|
||||
global_state.debug_keyboard = debug_keyboard ? true : false;
|
||||
global_state.debug_rendering = debug_rendering ? true : false;
|
||||
global_state.debug_font_fallback = debug_font_fallback ? true : false;
|
||||
if (!convert_opts_from_python_opts(opts, &global_state.opts)) return NULL;
|
||||
@ -822,11 +821,6 @@ PYWRAP1(focus_os_window) {
|
||||
Py_RETURN_FALSE;
|
||||
}
|
||||
|
||||
PYWRAP0(toggle_secure_input) {
|
||||
toggle_secure_input();
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
PYWRAP1(set_titlebar_color) {
|
||||
id_type os_window_id;
|
||||
unsigned int color;
|
||||
@ -1272,7 +1266,6 @@ static PyMethodDef module_methods[] = {
|
||||
MW(current_application_quit_request, METH_NOARGS),
|
||||
MW(set_titlebar_color, METH_VARARGS),
|
||||
MW(focus_os_window, METH_VARARGS),
|
||||
MW(toggle_secure_input, METH_NOARGS),
|
||||
MW(mark_tab_bar_dirty, METH_O),
|
||||
MW(change_background_opacity, METH_VARARGS),
|
||||
MW(background_opacity_of, METH_O),
|
||||
|
||||
@ -224,7 +224,7 @@ typedef struct {
|
||||
OSWindow *callback_os_window;
|
||||
bool is_wayland;
|
||||
bool has_render_frames;
|
||||
bool debug_keyboard, debug_rendering, debug_font_fallback;
|
||||
bool debug_rendering, debug_font_fallback;
|
||||
bool has_pending_resizes, has_pending_closes;
|
||||
bool in_sequence_mode;
|
||||
bool check_for_active_animated_images;
|
||||
@ -262,7 +262,6 @@ void hide_mouse(OSWindow *w);
|
||||
bool is_mouse_hidden(OSWindow *w);
|
||||
void destroy_os_window(OSWindow *w);
|
||||
void focus_os_window(OSWindow *w, bool also_raise);
|
||||
void toggle_secure_input(void);
|
||||
void set_os_window_title(OSWindow *w, const char *title);
|
||||
OSWindow* os_window_for_kitty_window(id_type);
|
||||
OSWindow* add_os_window(void);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user