mirror of
https://github.com/wizbright/waybox.git
synced 2025-10-29 05:40:20 -04:00
Basic seat support
This commit is contained in:
parent
cb67c24718
commit
1cd178e9ce
5 changed files with 36 additions and 0 deletions
16
include/waybox/seat.h
Normal file
16
include/waybox/seat.h
Normal 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
|
||||||
|
|
@ -24,6 +24,7 @@
|
||||||
|
|
||||||
#include "waybox/output.h"
|
#include "waybox/output.h"
|
||||||
#include "waybox/cursor.h"
|
#include "waybox/cursor.h"
|
||||||
|
#include "waybox/seat.h"
|
||||||
|
|
||||||
struct wb_server {
|
struct wb_server {
|
||||||
struct wl_display *wl_display;
|
struct wl_display *wl_display;
|
||||||
|
|
@ -34,6 +35,7 @@ struct wb_server {
|
||||||
|
|
||||||
struct wlr_output_layout *layout;
|
struct wlr_output_layout *layout;
|
||||||
struct wb_cursor *cursor;
|
struct wb_cursor *cursor;
|
||||||
|
struct wb_seat * seat;
|
||||||
|
|
||||||
struct wl_listener new_output;
|
struct wl_listener new_output;
|
||||||
struct wl_listener new_input;
|
struct wl_listener new_input;
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@ wb_src = files(
|
||||||
'cursor.c',
|
'cursor.c',
|
||||||
'main.c',
|
'main.c',
|
||||||
'output.c',
|
'output.c',
|
||||||
|
'seat.c',
|
||||||
'server.c',
|
'server.c',
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
||||||
15
waybox/seat.c
Normal file
15
waybox/seat.c
Normal 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);
|
||||||
|
}
|
||||||
|
|
@ -36,6 +36,7 @@ bool init_wb(struct wb_server* server) {
|
||||||
server->layout = wlr_output_layout_create();
|
server->layout = wlr_output_layout_create();
|
||||||
server->cursor = wb_cursor_create();
|
server->cursor = wb_cursor_create();
|
||||||
wlr_cursor_attach_output_layout(server->cursor->cursor, server->layout);
|
wlr_cursor_attach_output_layout(server->cursor->cursor, server->layout);
|
||||||
|
server->seat = wb_seat_create(server);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -81,6 +82,7 @@ bool terminate_wb(struct wb_server* server) {
|
||||||
printf("Display destroyed.\n");
|
printf("Display destroyed.\n");
|
||||||
|
|
||||||
wb_cursor_destroy(server->cursor);
|
wb_cursor_destroy(server->cursor);
|
||||||
|
wb_seat_destroy(server->seat);
|
||||||
wlr_output_layout_destroy(server->layout);
|
wlr_output_layout_destroy(server->layout);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue