mirror of
https://github.com/wizbright/waybox.git
synced 2025-11-02 09:01:42 -05:00
Use stable wlroots, making things easier on everybody
This commit is contained in:
parent
f233ac4cc6
commit
fcb38fe44f
9 changed files with 71 additions and 24 deletions
|
|
@ -47,7 +47,11 @@ static void process_cursor_resize(struct wb_server *server) {
|
|||
|
||||
int new_width = new_right - new_left;
|
||||
int new_height = new_bottom - new_top;
|
||||
#if WLR_CHECK_VERSION(0, 16, 0)
|
||||
wlr_xdg_toplevel_set_size(view->xdg_toplevel, new_width, new_height);
|
||||
#else
|
||||
wlr_xdg_toplevel_set_size(view->xdg_surface, new_width, new_height);
|
||||
#endif
|
||||
}
|
||||
|
||||
static void process_cursor_motion(struct wb_server *server, uint32_t time) {
|
||||
|
|
|
|||
|
|
@ -76,7 +76,11 @@ static bool handle_keybinding(struct wb_server *server, xkb_keysym_t sym, uint32
|
|||
struct wb_view *current_view = wl_container_of(
|
||||
server->views.next, current_view, link);
|
||||
if (wlr_surface_is_xdg_surface(current_view->xdg_toplevel->base->surface))
|
||||
#if WLR_CHECK_VERSION(0, 16, 0)
|
||||
wlr_xdg_toplevel_send_close(current_view->xdg_toplevel);
|
||||
#else
|
||||
wlr_xdg_toplevel_send_close(current_view->xdg_surface);
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
case ACTION_EXECUTE:
|
||||
|
|
|
|||
|
|
@ -34,7 +34,9 @@ bool wb_create_backend(struct wb_server* server) {
|
|||
|
||||
server->compositor = wlr_compositor_create(server->wl_display,
|
||||
server->renderer);
|
||||
#if WLR_CHECK_VERSION(0, 16, 0)
|
||||
server->subcompositor = wlr_subcompositor_create(server->wl_display);
|
||||
#endif
|
||||
server->output_layout = wlr_output_layout_create();
|
||||
server->seat = wb_seat_create(server);
|
||||
server->cursor = wb_cursor_create(server);
|
||||
|
|
|
|||
|
|
@ -24,14 +24,22 @@ void focus_view(struct wb_view *view, struct wlr_surface *surface) {
|
|||
*/
|
||||
struct wlr_xdg_surface *previous = wlr_xdg_surface_from_wlr_surface(
|
||||
seat->keyboard_state.focused_surface);
|
||||
#if WLR_CHECK_VERSION(0, 16, 0)
|
||||
wlr_xdg_toplevel_set_activated(previous->toplevel, false);
|
||||
#else
|
||||
wlr_xdg_toplevel_set_activated(previous, false);
|
||||
#endif
|
||||
}
|
||||
struct wlr_keyboard *keyboard = wlr_seat_get_keyboard(seat);
|
||||
/* Move the view to the front */
|
||||
wl_list_remove(&view->link);
|
||||
wl_list_insert(&server->views, &view->link);
|
||||
/* Activate the new surface */
|
||||
#if WLR_CHECK_VERSION(0, 16, 0)
|
||||
wlr_xdg_toplevel_set_activated(view->xdg_toplevel, true);
|
||||
#else
|
||||
wlr_xdg_toplevel_set_activated(view->xdg_surface, true);
|
||||
#endif
|
||||
/*
|
||||
* Tell the seat to have the keyboard enter this surface. wlroots will keep
|
||||
* track of this and automatically send key events to the appropriate
|
||||
|
|
@ -62,7 +70,11 @@ static void xdg_surface_ack_configure(struct wl_listener *listener, void *data)
|
|||
view->configured = view->y > 0;
|
||||
|
||||
/* Set size here, so the view->y value will be known */
|
||||
#if WLR_CHECK_VERSION(0, 16, 0)
|
||||
wlr_xdg_toplevel_set_size(view->xdg_toplevel, geo_box.width - view->x, geo_box.height - view->y);
|
||||
#else
|
||||
wlr_xdg_toplevel_set_size(view->xdg_surface, geo_box.width - view->x, geo_box.height - view->y);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -172,6 +184,9 @@ static void handle_new_xdg_surface(struct wl_listener *listener, void *data) {
|
|||
calloc(1, sizeof(struct wb_view));
|
||||
view->server = server;
|
||||
view->xdg_toplevel = xdg_surface->toplevel;
|
||||
#if !WLR_CHECK_VERSION(0, 16, 0)
|
||||
view->xdg_surface = view->xdg_toplevel->base;
|
||||
#endif
|
||||
|
||||
/* Listen to the various events it can emit */
|
||||
view->ack_configure.notify = xdg_surface_ack_configure;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue