From 4ecb0ecf4d1f45df918a8dd2dbabd6e9d7090dcc Mon Sep 17 00:00:00 2001 From: Daniel Eklöf Date: Thu, 2 Jan 2020 15:58:52 +0100 Subject: wayland: rename focused/moused to kbd_focus/mouse_focus --- input.c | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) (limited to 'input.c') diff --git a/input.c b/input.c index fd15b392..ebbcac74 100644 --- a/input.c +++ b/input.c @@ -87,11 +87,11 @@ keyboard_enter(void *data, struct wl_keyboard *wl_keyboard, uint32_t serial, struct wayland *wayl = data; wayl->input_serial = serial; - wayl->focused = wayl_terminal_from_surface(wayl, surface); - assert(wayl->focused != NULL); + wayl->kbd_focus = wayl_terminal_from_surface(wayl, surface); + assert(wayl->kbd_focus != NULL); - term_focus_in(wayl->focused); - term_xcursor_update(wayl->focused); + term_focus_in(wayl->kbd_focus); + term_xcursor_update(wayl->kbd_focus); } static bool @@ -143,12 +143,12 @@ keyboard_leave(void *data, struct wl_keyboard *wl_keyboard, uint32_t serial, struct wayland *wayl = data; assert( - wayl->focused == NULL || + wayl->kbd_focus == NULL || surface == NULL || /* Seen on Sway 1.2 */ - wayl_terminal_from_surface(wayl, surface) == wayl->focused); + wayl_terminal_from_surface(wayl, surface) == wayl->kbd_focus); - struct terminal *old_focused = wayl->focused; - wayl->focused = NULL; + struct terminal *old_focused = wayl->kbd_focus; + wayl->kbd_focus = NULL; stop_repeater(wayl, -1); if (old_focused != NULL) { @@ -171,7 +171,7 @@ keyboard_key(void *data, struct wl_keyboard *wl_keyboard, uint32_t serial, uint32_t time, uint32_t key, uint32_t state) { struct wayland *wayl = data; - struct terminal *term = wayl->focused; + struct terminal *term = wayl->kbd_focus; /* Workaround buggy Sway 1.2 */ if (term == NULL) { @@ -409,8 +409,8 @@ keyboard_modifiers(void *data, struct wl_keyboard *wl_keyboard, uint32_t serial, wayl->kbd.meta = xkb_state_mod_index_is_active( wayl->kbd.xkb_state, wayl->kbd.mod_meta, XKB_STATE_MODS_DEPRESSED); - if (wayl->focused) - term_xcursor_update(wayl->focused); + if (wayl->kbd_focus) + term_xcursor_update(wayl->kbd_focus); } static void @@ -450,7 +450,7 @@ wl_pointer_enter(void *data, struct wl_pointer *wl_pointer, LOG_DBG("pointer-enter: surface = %p, new-moused = %p", surface, term); - wayl->moused = term; + wayl->mouse_focus = term; int x = wl_fixed_to_int(surface_x) * term->scale; int y = wl_fixed_to_int(surface_y) * term->scale; @@ -466,11 +466,11 @@ wl_pointer_leave(void *data, struct wl_pointer *wl_pointer, uint32_t serial, struct wl_surface *surface) { struct wayland *wayl = data; - struct terminal *old_moused = wayl->moused; + struct terminal *old_moused = wayl->mouse_focus; LOG_DBG("pointer-leave: surface = %p, old-moused = %p", surface, old_moused); - wayl->moused = NULL; + wayl->mouse_focus = NULL; if (old_moused == NULL) { LOG_WARN( "compositor sent pointer_leave event without a pointer_enter " @@ -484,7 +484,7 @@ wl_pointer_motion(void *data, struct wl_pointer *wl_pointer, uint32_t time, wl_fixed_t surface_x, wl_fixed_t surface_y) { struct wayland *wayl = data; - struct terminal *term = wayl->moused; + struct terminal *term = wayl->mouse_focus; /* Workaround buggy Sway 1.2 */ if (term == NULL) { @@ -540,7 +540,7 @@ wl_pointer_button(void *data, struct wl_pointer *wl_pointer, LOG_DBG("BUTTON: button=%x, state=%u", button, state); struct wayland *wayl = data; - struct terminal *term = wayl->moused; + struct terminal *term = wayl->mouse_focus; /* Workaround buggy Sway 1.2 */ if (term == NULL) { @@ -621,7 +621,7 @@ wl_pointer_button(void *data, struct wl_pointer *wl_pointer, static void mouse_scroll(struct wayland *wayl, int amount) { - struct terminal *term = wayl->moused; + struct terminal *term = wayl->mouse_focus; assert(term != NULL); int button = amount < 0 ? BTN_BACK : BTN_FORWARD; -- cgit v1.3 From e9325b958f6fb6416f77a1f0d9f8b049f6a6a46b Mon Sep 17 00:00:00 2001 From: Daniel Eklöf Date: Thu, 2 Jan 2020 19:29:42 +0100 Subject: term: rename term_focus_{in,out} -> term_kbd_focus_{in,out} --- input.c | 4 ++-- terminal.c | 4 ++-- terminal.h | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) (limited to 'input.c') diff --git a/input.c b/input.c index ebbcac74..9df9c5dc 100644 --- a/input.c +++ b/input.c @@ -90,7 +90,7 @@ keyboard_enter(void *data, struct wl_keyboard *wl_keyboard, uint32_t serial, wayl->kbd_focus = wayl_terminal_from_surface(wayl, surface); assert(wayl->kbd_focus != NULL); - term_focus_in(wayl->kbd_focus); + term_kbd_focus_in(wayl->kbd_focus); term_xcursor_update(wayl->kbd_focus); } @@ -157,7 +157,7 @@ keyboard_leave(void *data, struct wl_keyboard *wl_keyboard, uint32_t serial, * keyboard_leave() (and keyboard_key()) without first having * received a keyboard_enter() */ - term_focus_out(old_focused); + term_kbd_focus_out(old_focused); term_xcursor_update(old_focused); } else { LOG_WARN( diff --git a/terminal.c b/terminal.c index a9ed686f..4e1dd201 100644 --- a/terminal.c +++ b/terminal.c @@ -1392,7 +1392,7 @@ term_restore_cursor(struct terminal *term) } void -term_focus_in(struct terminal *term) +term_kbd_focus_in(struct terminal *term) { if (term->cursor_blink.active) cursor_blink_start_timer(term); @@ -1404,7 +1404,7 @@ term_focus_in(struct terminal *term) } void -term_focus_out(struct terminal *term) +term_kbd_focus_out(struct terminal *term) { if (term->cursor_blink.active) cursor_blink_stop_timer(term); diff --git a/terminal.h b/terminal.h index e4eafe77..301ebad1 100644 --- a/terminal.h +++ b/terminal.h @@ -378,8 +378,8 @@ void term_arm_blink_timer(struct terminal *term); void term_restore_cursor(struct terminal *term); -void term_focus_in(struct terminal *term); -void term_focus_out(struct terminal *term); +void term_kbd_focus_in(struct terminal *term); +void term_kbd_focus_out(struct terminal *term); void term_mouse_down(struct terminal *term, int button, int row, int col); void term_mouse_up(struct terminal *term, int button, int row, int col); void term_mouse_motion(struct terminal *term, int button, int row, int col); -- cgit v1.3 From 4be3c04999c821a601951dc47987dec1c8aa4a9c Mon Sep 17 00:00:00 2001 From: Daniel Eklöf Date: Thu, 2 Jan 2020 19:30:34 +0100 Subject: input: keyboard-leave: move comment to where it belongs --- input.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'input.c') diff --git a/input.c b/input.c index 9df9c5dc..7f81da8d 100644 --- a/input.c +++ b/input.c @@ -152,14 +152,14 @@ keyboard_leave(void *data, struct wl_keyboard *wl_keyboard, uint32_t serial, stop_repeater(wayl, -1); if (old_focused != NULL) { + term_kbd_focus_out(old_focused); + term_xcursor_update(old_focused); + } else { /* * Sway bug - under certain conditions we get a * keyboard_leave() (and keyboard_key()) without first having * received a keyboard_enter() */ - term_kbd_focus_out(old_focused); - term_xcursor_update(old_focused); - } else { LOG_WARN( "compositor sent keyboard_leave event without a keyboard_enter " "event: surface=%p", surface); -- cgit v1.3