]> git.mdlowis.com Git - proto/labwc.git/commitdiff
seat: remove seat_focused_surface()
authorJohan Malm <jgm323@gmail.com>
Wed, 7 Oct 2020 20:49:58 +0000 (21:49 +0100)
committerJohan Malm <jgm323@gmail.com>
Wed, 7 Oct 2020 20:49:58 +0000 (21:49 +0100)
include/labwc.h
src/desktop.c
src/output.c
src/seat.c
src/xwayland-unmanaged.c

index 13d6502c50815f64135c018d0fd379e8cc275c9b..8d7c5eb7765e385f65136a766057e1a7d0943e4b 100644 (file)
@@ -241,7 +241,6 @@ void keyboard_init(struct seat *seat);
 void seat_init(struct server *server);
 void seat_finish(struct server *server);
 void seat_focus_surface(struct wlr_seat *seat, struct wlr_surface *surface);
-struct wlr_surface *seat_focused_surface(void);
 
 void interactive_begin(struct view *view, enum cursor_mode mode,
                       uint32_t edges);
index 09f2f8d9f0513ef9c6c41257c9474caead3be948..1f0db9db39cb615095470ec636f908d829fc0068 100644 (file)
@@ -76,7 +76,7 @@ focus_view(struct view *view)
                return;
        }
        if (prev_surface) {
-               set_activated(wlr_seat->keyboard_state.focused_surface, false);
+               set_activated(prev_surface, false);
        }
 
        move_to_front(view);
index 7cf62b73d5275ab4811d083ae05efe661842b333..a355b675b273af0472254098a437ad1fbbea214c 100644 (file)
@@ -134,7 +134,8 @@ render_decorations(struct wlr_output *output, struct view *view)
        draw_rect(&ddata, deco_box(view, LAB_DECO_PART_LEFT));
 
        /* title */
-       if (view->surface == seat_focused_surface())
+       struct wlr_seat *seat = view->server->seat.seat;
+       if (view->surface == seat->keyboard_state.focused_surface)
                ddata.rgba = theme.window_active_title_bg_color;
        else
                ddata.rgba = theme.window_inactive_title_bg_color;
@@ -152,7 +153,7 @@ render_decorations(struct wlr_output *output, struct view *view)
        }
 
        /* buttons */
-       if (view->surface == seat_focused_surface()) {
+       if (view->surface == seat->keyboard_state.focused_surface) {
                render_icon(&ddata, deco_box(view, LAB_DECO_BUTTON_CLOSE),
                            theme.xbm_close_active_unpressed);
                render_icon(&ddata, deco_box(view, LAB_DECO_BUTTON_MAXIMIZE),
index 1fea72f73193465b7a8ef35d63f578a100954e71..d9a09b495106add323339f821b0c7907fad83067 100644 (file)
@@ -128,9 +128,3 @@ seat_focus_surface(struct wlr_seat *seat, struct wlr_surface *surface)
        wlr_seat_keyboard_notify_enter(seat, surface, kb->keycodes,
                kb->num_keycodes, &kb->modifiers);
 }
-
-struct wlr_surface *
-seat_focused_surface(void)
-{
-       return current_seat->seat->keyboard_state.focused_surface;
-}
index 74895a21362b20159d78106c7b3faf602663e59b..606f28b6ec209110d2289198257de6480fd4bf24 100644 (file)
@@ -52,7 +52,8 @@ unmanaged_handle_unmap(struct wl_listener *listener, void *data)
        wl_list_remove(&unmanaged->link);
        wl_list_remove(&unmanaged->commit.link);
 
-       if (seat_focused_surface() == xsurface->surface) {
+       struct wlr_seat *seat = unmanaged->server->seat.seat;
+       if (seat->keyboard_state.focused_surface == xsurface->surface) {
                struct xwayland_unmanaged *u;
                struct wl_list *list = &unmanaged->server->unmanaged_surfaces;
                wl_list_for_each (u, list, link) {
@@ -60,7 +61,6 @@ unmanaged_handle_unmap(struct wl_listener *listener, void *data)
                        if (!wlr_xwayland_or_surface_wants_focus(prev)) {
                                continue;
                        }
-                       struct wlr_seat *seat = unmanaged->server->seat.seat;
                        seat_focus_surface(seat, prev->surface);
                        return;
                }