Updated for wlroots 0.15.0

This commit is contained in:
Keith Bowes 2022-01-29 14:34:55 -05:00
parent 309ccd2faf
commit 87c32d58ab
8 changed files with 36 additions and 13 deletions

View file

@ -124,6 +124,10 @@ void new_output_notify(struct wl_listener *listener, void *data) {
struct wlr_output *wlr_output = data;
wlr_log(WLR_INFO, "%s: %s", _("New output device detected"), wlr_output->name);
/* Configures the output created by the backend to use our allocator
* and our renderer */
wlr_output_init_render(wlr_output, server->allocator, server->renderer);
if (!wl_list_empty(&wlr_output->modes)) {
struct wlr_output_mode *mode = wlr_output_preferred_mode(wlr_output);
wlr_output_set_mode(wlr_output, mode);

View file

@ -2,22 +2,36 @@
#include "waybox/xdg_shell.h"
bool wb_create_backend(struct wb_server* server) {
// create display
/* The Wayland display is managed by libwayland. It handles accepting
* clients from the Unix socket, manging Wayland globals, and so on. */
server->wl_display = wl_display_create();
if (server->wl_display == NULL) {
wlr_log(WLR_ERROR, "%s", _("Failed to connect to a Wayland display"));
return false;
}
// create backend
/* The backend is a wlroots feature which abstracts the underlying input and
* output hardware. The autocreate option will choose the most suitable
* backend based on the current environment, such as opening an X11 window
* if an X11 server is running. */
server->backend = wlr_backend_autocreate(server->wl_display);
if (server->backend == NULL) {
return false;
}
server->renderer = wlr_backend_get_renderer(server->backend);
/* Autocreates a renderer, either Pixman, GLES2 or Vulkan for us. The user
* can also specify a renderer using the WLR_RENDERER env var.
* The renderer is responsible for defining the various pixel formats it
* supports for shared memory, this configures that for clients. */
server->renderer = wlr_renderer_autocreate(server->backend);
wlr_renderer_init_wl_display(server->renderer, server->wl_display);
/* Autocreates an allocator for us.
* The allocator is the bridge between the renderer and the backend. It
* handles the buffer creation, allowing wlroots to render onto the
* screen */
server->allocator = wlr_allocator_autocreate(server->backend, server->renderer);
server->compositor = wlr_compositor_create(server->wl_display,
server->renderer);
server->layout = wlr_output_layout_create();

View file

@ -8,7 +8,7 @@ void focus_view(struct wb_view *view, struct wlr_surface *surface) {
struct wlr_xdg_surface *xdg_surface = wlr_xdg_surface_from_wlr_surface(surface);
if (xdg_surface)
wlr_log(WLR_INFO, "%s: %s", _("Keyboard focus is now on surface"),
wlr_xdg_surface_from_wlr_surface(surface)->toplevel->app_id);
xdg_surface->toplevel->app_id);
struct wb_server *server = view->server;
struct wlr_seat *seat = server->seat->seat;
struct wlr_surface *prev_surface = seat->keyboard_state.focused_surface;