]> git.mdlowis.com Git - proto/labwc.git/commitdiff
seat: refactor seat_focus_surface()
authorJohan Malm <jgm323@gmail.com>
Tue, 6 Oct 2020 20:31:01 +0000 (21:31 +0100)
committerJohan Malm <jgm323@gmail.com>
Tue, 6 Oct 2020 20:31:01 +0000 (21:31 +0100)
include/labwc.h
src/desktop.c
src/seat.c
src/xwayland-unmanaged.c

index 622247a190ffb9eb71b6993fd02e9ad98069e13d..13d6502c50815f64135c018d0fd379e8cc275c9b 100644 (file)
@@ -235,10 +235,12 @@ struct view *desktop_view_at(struct server *server, double lx, double ly,
                             double *sy, int *view_area);
 
 void cursor_init(struct seat *seat);
+
 void keyboard_init(struct seat *seat);
+
 void seat_init(struct server *server);
 void seat_finish(struct server *server);
-void seat_focus_surface(struct wlr_surface *surface);
+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,
index bf5d38bb6c01bd152adfa80817b01eaf7ac18f2f..09f2f8d9f0513ef9c6c41257c9474caead3be948 100644 (file)
@@ -93,7 +93,7 @@ void
 desktop_focus_view(struct view *view)
 {
        if (!view) {
-               seat_focus_surface(NULL);
+               seat_focus_surface(view->server->seat.seat, NULL);
                return;
        }
        if (view->minimized) {
index 3ebf3a6df0d0e494f54fa590bfe46fb92bc475e0..1fea72f73193465b7a8ef35d63f578a100954e71 100644 (file)
@@ -118,15 +118,14 @@ seat_finish(struct server *server)
 }
 
 void
-seat_focus_surface(struct wlr_surface *surface)
+seat_focus_surface(struct wlr_seat *seat, struct wlr_surface *surface)
 {
-       struct wlr_seat *wlr_seat = current_seat->seat;
        if (!surface) {
-               wlr_seat_keyboard_notify_clear_focus(wlr_seat);
+               wlr_seat_keyboard_notify_clear_focus(seat);
                return;
        }
        struct wlr_keyboard *kb = &current_seat->keyboard_group->keyboard;
-       wlr_seat_keyboard_notify_enter(wlr_seat, surface, kb->keycodes,
+       wlr_seat_keyboard_notify_enter(seat, surface, kb->keycodes,
                kb->num_keycodes, &kb->modifiers);
 }
 
index 0bd5e5728af739575c29aa28fcbf5e6676718076..74895a21362b20159d78106c7b3faf602663e59b 100644 (file)
@@ -38,7 +38,8 @@ unmanaged_handle_map(struct wl_listener *listener, void *data)
        unmanaged->ly = xsurface->y;
 
        if (wlr_xwayland_or_surface_wants_focus(xsurface)) {
-               seat_focus_surface(xsurface->surface);
+               struct wlr_seat *seat = unmanaged->server->seat.seat;
+               seat_focus_surface(seat, xsurface->surface);
        }
 }
 
@@ -59,7 +60,8 @@ unmanaged_handle_unmap(struct wl_listener *listener, void *data)
                        if (!wlr_xwayland_or_surface_wants_focus(prev)) {
                                continue;
                        }
-                       seat_focus_surface(prev->surface);
+                       struct wlr_seat *seat = unmanaged->server->seat.seat;
+                       seat_focus_surface(seat, prev->surface);
                        return;
                }
        }