diff options
-rw-r--r-- | backend/drm/backend.c | 2 | ||||
-rw-r--r-- | backend/drm/drm.c | 4 | ||||
-rw-r--r-- | include/backend/drm/drm.h | 1 | ||||
-rw-r--r-- | include/rootston/desktop.h | 1 | ||||
-rw-r--r-- | include/rootston/view.h | 1 | ||||
-rw-r--r-- | include/wlr/xwayland.h | 1 | ||||
-rw-r--r-- | include/wlr/xwm.h | 9 | ||||
-rw-r--r-- | rootston/desktop.c | 6 | ||||
-rw-r--r-- | rootston/output.c | 2 | ||||
-rw-r--r-- | rootston/seat.c | 2 | ||||
-rw-r--r-- | rootston/xwayland.c | 2 | ||||
-rw-r--r-- | xwayland/xwayland.c | 21 | ||||
-rw-r--r-- | xwayland/xwm.c | 20 |
13 files changed, 68 insertions, 4 deletions
diff --git a/backend/drm/backend.c b/backend/drm/backend.c index 47dff227..fec14da9 100644 --- a/backend/drm/backend.c +++ b/backend/drm/backend.c @@ -83,6 +83,8 @@ static void session_signal(struct wl_listener *listener, void *data) { wl_list_for_each(conn, &drm->outputs, link){ if (conn->output.current_mode) { wlr_output_set_mode(&conn->output, conn->output.current_mode); + } else { + wlr_drm_connector_enable(&conn->output, false); } if (!conn->crtc) { diff --git a/backend/drm/drm.c b/backend/drm/drm.c index b2863414..d6388597 100644 --- a/backend/drm/drm.c +++ b/backend/drm/drm.c @@ -282,7 +282,7 @@ void wlr_drm_connector_start_renderer(struct wlr_drm_connector *conn) { } } -static void wlr_drm_connector_enable(struct wlr_output *output, bool enable) { +void wlr_drm_connector_enable(struct wlr_output *output, bool enable) { struct wlr_drm_connector *conn = (struct wlr_drm_connector *)output; if (conn->state != WLR_DRM_CONN_CONNECTED) { return; @@ -296,6 +296,8 @@ static void wlr_drm_connector_enable(struct wlr_output *output, bool enable) { if (enable) { wlr_drm_connector_start_renderer(conn); + } else { + output->current_mode = NULL; } wlr_output_update_enabled(&conn->output, enable); diff --git a/include/backend/drm/drm.h b/include/backend/drm/drm.h index 65db04ef..ee3fd38e 100644 --- a/include/backend/drm/drm.h +++ b/include/backend/drm/drm.h @@ -144,6 +144,7 @@ void wlr_drm_restore_outputs(struct wlr_drm_backend *drm); void wlr_drm_connector_cleanup(struct wlr_drm_connector *conn); void wlr_drm_scan_connectors(struct wlr_drm_backend *state); int wlr_drm_event(int fd, uint32_t mask, void *data); +void wlr_drm_connector_enable(struct wlr_output *output, bool enable); void wlr_drm_connector_start_renderer(struct wlr_drm_connector *conn); diff --git a/include/rootston/desktop.h b/include/rootston/desktop.h index ab3ae61a..467de8ab 100644 --- a/include/rootston/desktop.h +++ b/include/rootston/desktop.h @@ -78,6 +78,7 @@ void view_apply_damage(struct roots_view *view); void view_damage_whole(struct roots_view *view); void view_update_position(struct roots_view *view, double x, double y); void view_update_size(struct roots_view *view, uint32_t width, uint32_t height); +void view_initial_focus(struct roots_view *view); void handle_xdg_shell_v6_surface(struct wl_listener *listener, void *data); void handle_xdg_shell_surface(struct wl_listener *listener, void *data); diff --git a/include/rootston/view.h b/include/rootston/view.h index 7464edc5..ff5ef44a 100644 --- a/include/rootston/view.h +++ b/include/rootston/view.h @@ -95,7 +95,6 @@ struct roots_view { double x, y; uint32_t width, height; float rotation; - float alpha; } saved; struct { diff --git a/include/wlr/xwayland.h b/include/wlr/xwayland.h index ad7ceb83..0d4b91ed 100644 --- a/include/wlr/xwayland.h +++ b/include/wlr/xwayland.h @@ -186,4 +186,5 @@ void wlr_xwayland_surface_set_fullscreen(struct wlr_xwayland_surface *surface, void wlr_xwayland_set_seat(struct wlr_xwayland *xwayland, struct wlr_seat *seat); +bool wlr_xwayland_surface_is_unmanaged(const struct wlr_xwayland_surface *surface); #endif diff --git a/include/wlr/xwm.h b/include/wlr/xwm.h index 65681607..7d518f7e 100644 --- a/include/wlr/xwm.h +++ b/include/wlr/xwm.h @@ -39,6 +39,12 @@ enum atom_name { INCR, TEXT, TIMESTAMP, + NET_WM_WINDOW_TYPE_UTILITY, + NET_WM_WINDOW_TYPE_TOOLTIP, + NET_WM_WINDOW_TYPE_DND, + NET_WM_WINDOW_TYPE_DROPDOWN_MENU, + NET_WM_WINDOW_TYPE_POPUP_MENU, + NET_WM_WINDOW_TYPE_COMBO, ATOM_LAST, }; @@ -113,4 +119,7 @@ void xwm_selection_finish(struct wlr_xwm *xwm); void xwm_set_seat(struct wlr_xwm *xwm, struct wlr_seat *seat); +bool wlr_xwm_atoms_contains(struct wlr_xwm *xwm, xcb_atom_t *atoms, + size_t num_atoms, enum atom_name needle); + #endif diff --git a/rootston/desktop.c b/rootston/desktop.c index b42a71a2..3628b051 100644 --- a/rootston/desktop.c +++ b/rootston/desktop.c @@ -445,13 +445,17 @@ void view_init(struct roots_view *view, struct roots_desktop *desktop) { view_damage_whole(view); } -void view_setup(struct roots_view *view) { +void view_initial_focus(struct roots_view *view) { struct roots_input *input = view->desktop->server->input; // TODO what seat gets focus? the one with the last input event? struct roots_seat *seat; wl_list_for_each(seat, &input->seats, link) { roots_seat_set_focus(seat, view); } +} + +void view_setup(struct roots_view *view) { + view_initial_focus(view); view_center(view); view_update_output(view, NULL); diff --git a/rootston/output.c b/rootston/output.c index 3e954989..4d0a9c05 100644 --- a/rootston/output.c +++ b/rootston/output.c @@ -470,6 +470,7 @@ static void render_output(struct roots_output *output) { .output = output, .when = &now, .damage = &damage, + .alpha = 1.0, }; if (!needs_swap) { @@ -522,6 +523,7 @@ static void render_output(struct roots_output *output) { } // Render drag icons + data.alpha = 1.0; drag_icons_for_each_surface(server->input, render_surface, &data); renderer_end: diff --git a/rootston/seat.c b/rootston/seat.c index 1b7d05c4..9acbb737 100644 --- a/rootston/seat.c +++ b/rootston/seat.c @@ -721,7 +721,7 @@ void roots_seat_set_focus(struct roots_seat *seat, struct roots_view *view) { #ifdef WLR_HAS_XWAYLAND if (view && view->type == ROOTS_XWAYLAND_VIEW && - view->xwayland_surface->override_redirect) { + wlr_xwayland_surface_is_unmanaged(view->xwayland_surface)) { return; } #endif diff --git a/rootston/xwayland.c b/rootston/xwayland.c index f917fe5d..56f068ea 100644 --- a/rootston/xwayland.c +++ b/rootston/xwayland.c @@ -350,5 +350,7 @@ void handle_xwayland_surface(struct wl_listener *listener, void *data) { } view_setup(view); + } else { + view_initial_focus(view); } } diff --git a/xwayland/xwayland.c b/xwayland/xwayland.c index 1d935180..8dffd040 100644 --- a/xwayland/xwayland.c +++ b/xwayland/xwayland.c @@ -405,3 +405,24 @@ void wlr_xwayland_set_seat(struct wlr_xwayland *xwayland, xwayland->seat_destroy.notify = wlr_xwayland_handle_seat_destroy; wl_signal_add(&seat->events.destroy, &xwayland->seat_destroy); } + + +bool wlr_xwayland_surface_is_unmanaged(const struct wlr_xwayland_surface *surface) { + static enum atom_name needles[] = { + NET_WM_WINDOW_TYPE_UTILITY, + NET_WM_WINDOW_TYPE_TOOLTIP, + NET_WM_WINDOW_TYPE_DND, + NET_WM_WINDOW_TYPE_DROPDOWN_MENU, + NET_WM_WINDOW_TYPE_POPUP_MENU, + NET_WM_WINDOW_TYPE_COMBO, + }; + + for (size_t i = 0; i < sizeof(needles) / sizeof(needles[0]); ++i) { + if (wlr_xwm_atoms_contains(surface->xwm, surface->window_type, + surface->window_type_len, needles[i])) { + return true; + } + } + + return false; +} diff --git a/xwayland/xwm.c b/xwayland/xwm.c index 0d957260..c41b8d47 100644 --- a/xwayland/xwm.c +++ b/xwayland/xwm.c @@ -54,6 +54,12 @@ const char *atom_map[ATOM_LAST] = { "INCR", "TEXT", "TIMESTAMP", + "_NET_WM_WINDOW_TYPE_UTILITY", + "_NET_WM_WINDOW_TYPE_TOOLTIP", + "_NET_WM_WINDOW_TYPE_DND", + "_NET_WM_WINDOW_TYPE_DROPDOWN_MENU", + "_NET_WM_WINDOW_TYPE_POPUP_MENU", + "_NET_WM_WINDOW_TYPE_COMBO", }; /* General helpers */ @@ -1446,3 +1452,17 @@ void wlr_xwayland_surface_set_fullscreen(struct wlr_xwayland_surface *surface, xsurface_set_net_wm_state(surface); xcb_flush(surface->xwm->xcb_conn); } + +bool wlr_xwm_atoms_contains(struct wlr_xwm *xwm, xcb_atom_t *atoms, + size_t num_atoms, enum atom_name needle) { + xcb_atom_t atom = xwm->atoms[needle]; + + for (size_t i = 0; i < num_atoms; ++i) { + if (atom == atoms[i]) { + return true; + } + } + + return false; +} + |