mirror of
https://github.com/wizbright/waybox.git
synced 2025-10-29 05:40:20 -04:00
Merge branch 'master' of https://github.com/wizbright/waybox
This commit is contained in:
commit
cd22c7cf74
7 changed files with 44 additions and 6 deletions
|
|
@ -11,6 +11,7 @@
|
|||
|
||||
#include <wlr/render/wlr_renderer.h>
|
||||
#include <wlr/render/wlr_texture.h>
|
||||
#include <wlr/types/wlr_xdg_output_v1.h>
|
||||
|
||||
#include "waybox/server.h"
|
||||
|
||||
|
|
@ -18,6 +19,8 @@ struct wb_output {
|
|||
struct wlr_output *wlr_output;
|
||||
struct wb_server *server;
|
||||
|
||||
struct wlr_xdg_output_manager_v1 *manager;
|
||||
|
||||
struct wl_listener destroy;
|
||||
struct wl_listener frame;
|
||||
|
||||
|
|
|
|||
|
|
@ -2,6 +2,8 @@
|
|||
#define _WB_SEAT_H
|
||||
|
||||
#include <wlr/types/wlr_keyboard.h>
|
||||
#include <wlr/types/wlr_primary_selection.h>
|
||||
#include <wlr/types/wlr_primary_selection_v1.h>
|
||||
#include <wlr/types/wlr_seat.h>
|
||||
|
||||
#include "waybox/server.h"
|
||||
|
|
@ -10,6 +12,9 @@ struct wb_seat {
|
|||
struct wlr_seat *seat;
|
||||
|
||||
struct wl_list keyboards;
|
||||
|
||||
struct wl_listener request_set_primary_selection;
|
||||
struct wl_listener request_set_selection;
|
||||
};
|
||||
|
||||
struct wb_keyboard {
|
||||
|
|
|
|||
|
|
@ -16,7 +16,6 @@
|
|||
#include <wlr/types/wlr_screencopy_v1.h>
|
||||
#include <wlr/types/wlr_matrix.h>
|
||||
#include <wlr/types/wlr_gamma_control_v1.h>
|
||||
#include <wlr/types/wlr_primary_selection_v1.h>
|
||||
#include <wlr/types/wlr_output_layout.h>
|
||||
#include <wlr/types/wlr_xdg_shell.h>
|
||||
#include <wlr/util/log.h>
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ protocols = [
|
|||
[wl_protocol_dir, 'unstable/linux-dmabuf/linux-dmabuf-unstable-v1.xml'],
|
||||
[wl_protocol_dir, 'unstable/primary-selection/primary-selection-unstable-v1.xml'],
|
||||
[wl_protocol_dir, 'unstable/xdg-decoration/xdg-decoration-unstable-v1.xml'],
|
||||
[wl_protocol_dir, 'unstable/xdg-output/xdg-output-unstable-v1.xml'],
|
||||
'wlr-gamma-control-unstable-v1.xml',
|
||||
'idle.xml',
|
||||
'wlr-screencopy-unstable-v1.xml',
|
||||
|
|
|
|||
|
|
@ -7,7 +7,8 @@ struct render_data {
|
|||
struct timespec *when;
|
||||
};
|
||||
|
||||
static void render_surface(struct wlr_surface *surface, int sx, int sy, void *data) {
|
||||
static void render_surface(struct wlr_surface *surface,
|
||||
int sx, int sy, void *data) {
|
||||
/* This function is called for every surface that needs to be rendered. */
|
||||
struct render_data *rdata = data;
|
||||
struct wb_view *view = rdata->view;
|
||||
|
|
@ -50,8 +51,7 @@ static void render_surface(struct wlr_surface *surface, int sx, int sy, void *da
|
|||
* prepares an orthographic projection and multiplies the necessary
|
||||
* transforms to produce a model-view-projection matrix.
|
||||
*
|
||||
* Naturally you can do this any way you like, for example to make a 3D
|
||||
* compositor.
|
||||
* Naturally you can do this any way you like.
|
||||
*/
|
||||
float matrix[9];
|
||||
enum wl_output_transform transform =
|
||||
|
|
@ -99,7 +99,8 @@ void output_frame_notify(struct wl_listener *listener, void *data) {
|
|||
.when = &now,
|
||||
};
|
||||
|
||||
wlr_xdg_surface_for_each_surface(view->xdg_surface, render_surface, &rdata);
|
||||
wlr_xdg_surface_for_each_surface(view->xdg_surface,
|
||||
render_surface, &rdata);
|
||||
}
|
||||
|
||||
wlr_output_render_software_cursors(output->wlr_output, NULL);
|
||||
|
|
@ -146,4 +147,7 @@ void new_output_notify(struct wl_listener *listener, void *data) {
|
|||
|
||||
wlr_output_layout_add_auto(server->layout, wlr_output);
|
||||
wlr_output_create_global(wlr_output);
|
||||
|
||||
output->manager = wlr_xdg_output_manager_v1_create(server->wl_display,
|
||||
server->layout);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -147,6 +147,22 @@ static void new_input_notify(struct wl_listener *listener, void *data) {
|
|||
wlr_seat_set_capabilities(server->seat->seat, caps);
|
||||
}
|
||||
|
||||
static void handle_request_set_primary_selection(struct wl_listener *listener,
|
||||
void *data) {
|
||||
struct wb_seat *seat =
|
||||
wl_container_of(listener, seat, request_set_primary_selection);
|
||||
struct wlr_seat_request_set_primary_selection_event *event = data;
|
||||
wlr_seat_set_primary_selection(seat->seat, event->source, event->serial);
|
||||
}
|
||||
|
||||
static void handle_request_set_selection(struct wl_listener *listener, void
|
||||
*data) {
|
||||
struct wb_seat *seat =
|
||||
wl_container_of(listener, seat, request_set_selection);
|
||||
struct wlr_seat_request_set_selection_event *event = data;
|
||||
wlr_seat_set_selection(seat->seat, event->source, event->serial);
|
||||
}
|
||||
|
||||
struct wb_seat *wb_seat_create(struct wb_server *server) {
|
||||
struct wb_seat *seat = malloc(sizeof(struct wb_seat));
|
||||
|
||||
|
|
@ -155,10 +171,21 @@ struct wb_seat *wb_seat_create(struct wb_server *server) {
|
|||
wl_signal_add(&server->backend->events.new_input, &server->new_input);
|
||||
seat->seat = wlr_seat_create(server->wl_display, "seat0");
|
||||
|
||||
wlr_primary_selection_v1_device_manager_create(server->wl_display);
|
||||
seat->request_set_primary_selection.notify =
|
||||
handle_request_set_primary_selection;
|
||||
wl_signal_add(&seat->seat->events.request_set_primary_selection,
|
||||
&seat->request_set_primary_selection);
|
||||
seat->request_set_selection.notify = handle_request_set_selection;
|
||||
wl_signal_add(&seat->seat->events.request_set_selection,
|
||||
&seat->request_set_selection);
|
||||
|
||||
return seat;
|
||||
}
|
||||
|
||||
void wb_seat_destroy(struct wb_seat *seat) {
|
||||
wl_list_remove(&seat->request_set_primary_selection.link);
|
||||
wl_list_remove(&seat->request_set_selection.link);
|
||||
wlr_seat_destroy(seat->seat);
|
||||
free(seat);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -51,7 +51,6 @@ bool wb_start_server(struct wb_server* server) {
|
|||
|
||||
wlr_gamma_control_manager_v1_create(server->wl_display);
|
||||
wlr_screencopy_manager_v1_create(server->wl_display);
|
||||
wlr_primary_selection_v1_device_manager_create(server->wl_display);
|
||||
wlr_idle_create(server->wl_display);
|
||||
|
||||
wlr_data_device_manager_create(server->wl_display);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue