Skip to content
This repository has been archived by the owner on Nov 1, 2021. It is now read-only.

Commit

Permalink
tinywl: declare allocator
Browse files Browse the repository at this point in the history
  • Loading branch information
bl4ckb0ne committed Sep 30, 2021
1 parent 9020d9d commit 05ed616
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
6 changes: 6 additions & 0 deletions tinywl/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
executable(
'tinywl',
['tinywl.c', protocols_server_header['xdg-shell'], protocols_code['xdg-shell']],
dependencies: wlroots,
include_directories: [wlr_inc, proto_inc],
)
8 changes: 8 additions & 0 deletions tinywl/tinywl.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include <time.h>
#include <unistd.h>
#include <wayland-server-core.h>
#include <wlr/allocator.h>
#include <wlr/backend.h>
#include <wlr/render/wlr_renderer.h>
#include <wlr/types/wlr_cursor.h>
Expand Down Expand Up @@ -34,6 +35,7 @@ struct tinywl_server {
struct wl_display *wl_display;
struct wlr_backend *backend;
struct wlr_renderer *renderer;
struct wlr_allocator *allocator;

struct wlr_xdg_shell *xdg_shell;
struct wl_listener new_xdg_surface;
Expand Down Expand Up @@ -847,6 +849,12 @@ int main(int argc, char *argv[]) {
server.renderer = wlr_backend_get_renderer(server.backend);
wlr_renderer_init_wl_display(server.renderer, server.wl_display);

/* The allocator is the bridge between the renderer and the backend.
* It handles the buffer managment between the two, allowing wlroots
* to render onto the screen */
server.allocator = wlr_allocator_autocreate(server.backend,
server.renderer);

/* This creates some hands-off wlroots interfaces. The compositor is
* necessary for clients to allocate surfaces and the data device manager
* handles the clipboard. Each of these wlroots interfaces has room for you
Expand Down

0 comments on commit 05ed616

Please sign in to comment.