aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2020-01-02 14:58:52 +0000
committerDaniel Eklöf <daniel@ekloef.se>2020-01-02 14:58:52 +0000
commit4ecb0ecf4d1f45df918a8dd2dbabd6e9d7090dcc (patch)
treed86d230522b0386d2a412d5212f3283f8b4828b2
parentREADME: add missing '+' in keyboard shortcut ctrl+shift+w (diff)
wayland: rename focused/moused to kbd_focus/mouse_focus
-rw-r--r--input.c34
-rw-r--r--render.c2
-rw-r--r--terminal.c24
-rw-r--r--wayland.c4
-rw-r--r--wayland.h4
5 files changed, 34 insertions, 34 deletions
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;
diff --git a/render.c b/render.c
index 97284cbb..d02ada3e 100644
--- a/render.c
+++ b/render.c
@@ -279,7 +279,7 @@ draw_cursor(const struct terminal *term, const struct cell *cell,
pixman_image_t *pix, pixman_color_t *fg, const pixman_color_t *bg,
int x, int y, int cols)
{
- bool have_focus = term->wl->focused == term;
+ bool have_focus = term->wl->kbd_focus == term;
pixman_color_t cursor_color;
pixman_color_t text_color;
diff --git a/terminal.c b/terminal.c
index 64bdebe3..a9ed686f 100644
--- a/terminal.c
+++ b/terminal.c
@@ -716,13 +716,13 @@ fdm_shutdown(struct fdm *fdm, int fd, int events, void *data)
* are deferred (for example, when a screen locker is active), and
* thus we can get here without having been unmapped.
*/
- if (wayl->focused == term)
- wayl->focused = NULL;
- if (wayl->moused == term)
- wayl->moused = NULL;
+ if (wayl->kbd_focus == term)
+ wayl->kbd_focus = NULL;
+ if (wayl->mouse_focus == term)
+ wayl->mouse_focus = NULL;
- assert(wayl->focused != term);
- assert(wayl->moused != term);
+ assert(wayl->kbd_focus != term);
+ assert(wayl->mouse_focus != term);
void (*cb)(void *, int) = term->shutdown_cb;
void *cb_data = term->shutdown_data;
@@ -1234,7 +1234,7 @@ void
term_cursor_blink_enable(struct terminal *term)
{
term->cursor_blink.state = CURSOR_BLINK_ON;
- term->cursor_blink.active = term->wl->focused == term
+ term->cursor_blink.active = term->wl->kbd_focus == term
? cursor_blink_start_timer(term) : true;
cursor_refresh(term);
}
@@ -1253,7 +1253,7 @@ term_cursor_blink_restart(struct terminal *term)
{
if (term->cursor_blink.active) {
term->cursor_blink.state = CURSOR_BLINK_ON;
- term->cursor_blink.active = term->wl->focused == term
+ term->cursor_blink.active = term->wl->kbd_focus == term
? cursor_blink_start_timer(term) : true;
}
}
@@ -1508,7 +1508,7 @@ term_mouse_grabbed(const struct terminal *term)
* Mouse is grabbed by us, regardless of whether mouse tracking has been enabled or not.
*/
return
- term->wl->focused == term &&
+ term->wl->kbd_focus == term &&
term->wl->kbd.shift &&
!term->wl->kbd.alt && !term->wl->kbd.ctrl && !term->wl->kbd.meta;
}
@@ -1529,7 +1529,7 @@ term_mouse_down(struct terminal *term, int button, int row, int col)
return;
- bool has_focus = term->wl->focused == term;
+ bool has_focus = term->wl->kbd_focus == term;
bool shift = has_focus ? term->wl->kbd.shift : false;
bool alt = has_focus ? term->wl->kbd.alt : false;
bool ctrl = has_focus ? term->wl->kbd.ctrl : false;
@@ -1573,7 +1573,7 @@ term_mouse_up(struct terminal *term, int button, int row, int col)
if (encoded == -1)
return;
- bool has_focus = term->wl->focused == term;
+ bool has_focus = term->wl->kbd_focus == term;
bool shift = has_focus ? term->wl->kbd.shift : false;
bool alt = has_focus ? term->wl->kbd.alt : false;
bool ctrl = has_focus ? term->wl->kbd.ctrl : false;
@@ -1617,7 +1617,7 @@ term_mouse_motion(struct terminal *term, int button, int row, int col)
} else
encoded = 3; /* "released" */
- bool has_focus = term->wl->focused == term;
+ bool has_focus = term->wl->kbd_focus == term;
bool shift = has_focus ? term->wl->kbd.shift : false;
bool alt = has_focus ? term->wl->kbd.alt : false;
bool ctrl = has_focus ? term->wl->kbd.ctrl : false;
diff --git a/wayland.c b/wayland.c
index cbd49179..380cc526 100644
--- a/wayland.c
+++ b/wayland.c
@@ -849,12 +849,12 @@ wayl_cursor_set(struct wayland *wayl, const struct terminal *term)
if (wayl->pointer.theme == NULL)
return false;
- if (wayl->moused == NULL) {
+ if (wayl->mouse_focus == NULL) {
wayl->pointer.xcursor = NULL;
return true;
}
- if (wayl->moused != term) {
+ if (wayl->mouse_focus != term) {
/* This terminal doesn't have mouse focus */
return true;
}
diff --git a/wayland.h b/wayland.h
index d10f10e3..dfdcfffd 100644
--- a/wayland.h
+++ b/wayland.h
@@ -164,8 +164,8 @@ struct wayland {
tll(struct monitor) monitors; /* All available outputs */
tll(struct terminal *) terms;
- struct terminal *focused;
- struct terminal *moused;
+ struct terminal *kbd_focus;
+ struct terminal *mouse_focus;
};
struct wayland *wayl_init(const struct config *conf, struct fdm *fdm);