Basic seat support

This commit is contained in:
Keith Bowes 2020-02-18 07:37:19 -05:00
parent cb67c24718
commit 1cd178e9ce
5 changed files with 36 additions and 0 deletions

16
include/waybox/seat.h Normal file
View file

@ -0,0 +1,16 @@
#ifndef _WB_SEAT_H
#define _WB_SEAT_H
#include <wlr/types/wlr_seat.h>
#include "waybox/server.h"
struct wb_seat {
struct wlr_seat * seat;
};
struct wb_server;
struct wb_seat * wb_seat_create(struct wb_server * server);
void wb_seat_destroy(struct wb_seat * seat);
#endif

View file

@ -24,6 +24,7 @@
#include "waybox/output.h"
#include "waybox/cursor.h"
#include "waybox/seat.h"
struct wb_server {
struct wl_display *wl_display;
@ -34,6 +35,7 @@ struct wb_server {
struct wlr_output_layout *layout;
struct wb_cursor *cursor;
struct wb_seat * seat;
struct wl_listener new_output;
struct wl_listener new_input;

View file

@ -2,6 +2,7 @@ wb_src = files(
'cursor.c',
'main.c',
'output.c',
'seat.c',
'server.c',
)

15
waybox/seat.c Normal file
View file

@ -0,0 +1,15 @@
#include <stdlib.h>
#include "waybox/seat.h"
struct wb_seat * wb_seat_create(struct wb_server * server) {
struct wb_seat * seat = malloc(sizeof(struct wb_seat));
seat->seat = wlr_seat_create(server->wl_display, "seat0");
wlr_seat_set_capabilities(seat->seat, WL_SEAT_CAPABILITY_POINTER | WL_SEAT_CAPABILITY_KEYBOARD);
return seat;
}
void wb_seat_destroy(struct wb_seat * seat) {
wlr_seat_destroy(seat->seat);
free(seat);
}

View file

@ -36,6 +36,7 @@ bool init_wb(struct wb_server* server) {
server->layout = wlr_output_layout_create();
server->cursor = wb_cursor_create();
wlr_cursor_attach_output_layout(server->cursor->cursor, server->layout);
server->seat = wb_seat_create(server);
return true;
}
@ -81,6 +82,7 @@ bool terminate_wb(struct wb_server* server) {
printf("Display destroyed.\n");
wb_cursor_destroy(server->cursor);
wb_seat_destroy(server->seat);
wlr_output_layout_destroy(server->layout);
return true;