Merge branch 'master' into wlr_mirror_v1

This commit is contained in:
Alexander Courtis 2022-01-21 10:24:53 +11:00
commit bdc60ac342
50 changed files with 2036 additions and 1961 deletions

View file

@ -14,7 +14,6 @@
#include <wlr/types/wlr_matrix.h>
#include <wlr/types/wlr_output_layout.h>
#include <wlr/types/wlr_output.h>
#include <wlr/types/wlr_surface.h>
#include <wlr/util/box.h>
#include <wlr/util/log.h>

View file

@ -13,7 +13,6 @@
#include <wlr/types/wlr_compositor.h>
#include <wlr/types/wlr_output.h>
#include <wlr/types/wlr_scene.h>
#include <wlr/types/wlr_surface.h>
#include <wlr/types/wlr_xdg_shell.h>
#include <wlr/util/log.h>
@ -30,8 +29,7 @@ struct server {
struct wlr_allocator *allocator;
struct wlr_scene *scene;
struct wl_list outputs;
struct wl_list surfaces;
uint32_t surface_offset;
struct wl_listener new_output;
struct wl_listener new_surface;
@ -65,11 +63,7 @@ static void output_handle_frame(struct wl_listener *listener, void *data) {
struct timespec now;
clock_gettime(CLOCK_MONOTONIC, &now);
struct surface *surface;
wl_list_for_each(surface, &output->server->surfaces, link) {
wlr_surface_send_frame_done(surface->wlr, &now);
}
wlr_scene_output_send_frame_done(output->scene_output, &now);
}
static void server_handle_new_output(struct wl_listener *listener, void *data) {
@ -84,7 +78,6 @@ static void server_handle_new_output(struct wl_listener *listener, void *data) {
output->server = server;
output->frame.notify = output_handle_frame;
wl_signal_add(&wlr_output->events.frame, &output->frame);
wl_list_insert(&server->outputs, &output->link);
output->scene_output = wlr_scene_output_create(server->scene, wlr_output);
@ -118,7 +111,8 @@ static void server_handle_new_surface(struct wl_listener *listener,
struct server *server = wl_container_of(listener, server, new_surface);
struct wlr_surface *wlr_surface = data;
int pos = 50 * wl_list_length(&server->surfaces);
int pos = server->surface_offset;
server->surface_offset += 50;
struct surface *surface = calloc(1, sizeof(struct surface));
surface->wlr = wlr_surface;
@ -134,7 +128,6 @@ static void server_handle_new_surface(struct wl_listener *listener,
surface->scene_surface =
wlr_scene_surface_create(&server->scene->node, wlr_surface);
wl_list_insert(server->surfaces.prev, &surface->link);
wlr_scene_node_set_position(&surface->scene_surface->node,
pos + border_width, pos + border_width);
@ -162,6 +155,7 @@ int main(int argc, char *argv[]) {
}
struct server server = {0};
server.surface_offset = 0;
server.display = wl_display_create();
server.backend = wlr_backend_autocreate(server.display);
server.scene = wlr_scene_create();
@ -177,9 +171,6 @@ int main(int argc, char *argv[]) {
wlr_xdg_shell_create(server.display);
wl_list_init(&server.outputs);
wl_list_init(&server.surfaces);
server.new_output.notify = server_handle_new_output;
wl_signal_add(&server.backend->events.new_output, &server.new_output);