mirror of
https://github.com/wizbright/waybox.git
synced 2025-10-29 05:40:20 -04:00
react to wlroots changes
This commit is contained in:
parent
2b38536dec
commit
7fb889d171
4 changed files with 25 additions and 9 deletions
|
|
@ -49,6 +49,7 @@ struct wb_server {
|
|||
struct wlr_xdg_output_manager_v1 *output_manager;
|
||||
struct wlr_renderer *renderer;
|
||||
struct wlr_scene *scene;
|
||||
struct wlr_scene_output_layout *scene_layout;
|
||||
struct wlr_subcompositor *subcompositor;
|
||||
|
||||
struct wb_config *config;
|
||||
|
|
|
|||
|
|
@ -35,7 +35,11 @@ void output_frame_notify(struct wl_listener *listener, void *data) {
|
|||
}
|
||||
|
||||
/* Render the scene if needed and commit the output */
|
||||
#if WLR_CHECK_VERSION(0, 17, 0)
|
||||
wlr_scene_output_commit(scene_output, NULL);
|
||||
#else
|
||||
wlr_scene_output_commit(scene_output);
|
||||
#endif
|
||||
|
||||
/* This lets the client know that we've displayed that frame and it can
|
||||
* prepare another one now if it likes. */
|
||||
|
|
@ -101,8 +105,8 @@ void new_output_notify(struct wl_listener *listener, void *data) {
|
|||
wlr_output_state_set_mode(&state, mode);
|
||||
}
|
||||
|
||||
wlr_output_state_finish(&state);
|
||||
wlr_output_commit_state(wlr_output, &state);
|
||||
wlr_output_state_finish(&state);
|
||||
#else
|
||||
if (!wl_list_empty(&wlr_output->modes)) {
|
||||
struct wlr_output_mode *mode = wlr_output_preferred_mode(wlr_output);
|
||||
|
|
@ -156,10 +160,15 @@ void new_output_notify(struct wl_listener *listener, void *data) {
|
|||
* output (such as DPI, scale factor, manufacturer, etc).
|
||||
*/
|
||||
#if WLR_CHECK_VERSION(0, 17, 0)
|
||||
if (!wlr_output_layout_add_auto(server->output_layout, wlr_output)) {
|
||||
struct wlr_output_layout_output *l_output =
|
||||
wlr_output_layout_add_auto(server->output_layout, wlr_output);
|
||||
if (!l_output) {
|
||||
wlr_log(WLR_ERROR, "%s", _("Could not add an output layout."));
|
||||
return;
|
||||
}
|
||||
|
||||
struct wlr_scene_output *scene_output = wlr_scene_output_create(server->scene, wlr_output);
|
||||
wlr_scene_output_layout_add_output(server->scene_layout, l_output, scene_output);
|
||||
#else
|
||||
wlr_output_layout_add_auto(server->output_layout, wlr_output);
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -78,6 +78,9 @@ bool wb_start_server(struct wb_server* server) {
|
|||
* necessary.
|
||||
*/
|
||||
server->scene = wlr_scene_create();
|
||||
#if WLR_CHECK_VERSION(0, 17, 0)
|
||||
server->scene_layout =
|
||||
#endif
|
||||
wlr_scene_attach_output_layout(server->scene, server->output_layout);
|
||||
|
||||
const char *socket = wl_display_add_socket_auto(server->wl_display);
|
||||
|
|
|
|||
|
|
@ -72,7 +72,8 @@ void focus_view(struct wb_view *view, struct wlr_surface *surface) {
|
|||
previous = wlr_xdg_surface_from_wlr_surface(prev_surface);
|
||||
}
|
||||
#endif
|
||||
if (previous != NULL && previous->role == WLR_XDG_SURFACE_ROLE_TOPLEVEL) {
|
||||
if (previous != NULL && previous->role == WLR_XDG_SURFACE_ROLE_TOPLEVEL &&
|
||||
previous->toplevel != NULL) {
|
||||
wlr_xdg_toplevel_set_activated(previous->toplevel, false);
|
||||
}
|
||||
}
|
||||
|
|
@ -155,12 +156,14 @@ static void xdg_toplevel_unmap(struct wl_listener *listener, void *data) {
|
|||
reset_cursor_mode(view->server);
|
||||
|
||||
/* Focus the next view, if any. */
|
||||
if (wl_list_length(&view->link) > 1) {
|
||||
struct wb_view *next_view = wl_container_of(view->link.next, next_view, link);
|
||||
if (next_view && next_view->scene_tree && next_view->scene_tree->node.enabled) {
|
||||
if (next_view && next_view->xdg_toplevel && next_view->scene_tree && next_view->scene_tree->node.enabled) {
|
||||
wlr_log(WLR_INFO, "%s: %s", _("Focusing next view"),
|
||||
next_view->xdg_toplevel->app_id);
|
||||
focus_view(next_view, next_view->xdg_toplevel->base->surface);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void xdg_toplevel_destroy(struct wl_listener *listener, void *data) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue