mirror of
https://cagebreak.project-repo.co/cagebreak.git
synced 2026-08-22 21:44:19 +02:00
Fix problems with automatic output configuration
This commit is contained in:
parent
6b89645161
commit
65b6e9e427
4 changed files with 21 additions and 1 deletions
|
|
@ -18,6 +18,7 @@
|
|||
#include <wayland-client.h>
|
||||
#include <wayland-server-core.h>
|
||||
#include <wlr/backend.h>
|
||||
#include <wlr/backend/headless.h>
|
||||
#include <wlr/render/allocator.h>
|
||||
#include <wlr/render/wlr_renderer.h>
|
||||
#include <wlr/types/wlr_compositor.h>
|
||||
|
|
@ -369,6 +370,7 @@ main(int argc, char *argv[]) {
|
|||
server.event_loop = event_loop;
|
||||
|
||||
backend = wlr_backend_autocreate(server.wl_display);
|
||||
server.headless_backend=wlr_headless_backend_create(server.wl_display);
|
||||
if(!backend) {
|
||||
wlr_log(WLR_ERROR, "Unable to create the wlroots backend");
|
||||
ret = 1;
|
||||
|
|
|
|||
|
|
@ -280,6 +280,7 @@ void
|
|||
message_printf_pos(struct cg_output *output, struct wlr_box *position,
|
||||
const enum cg_message_align align, const char *fmt, ...) {
|
||||
if(output->destroyed) {
|
||||
free(position);
|
||||
return;
|
||||
}
|
||||
uint16_t buf_len = 256;
|
||||
|
|
|
|||
18
output.c
18
output.c
|
|
@ -14,6 +14,7 @@
|
|||
#if WLR_HAS_X11_BACKEND
|
||||
#include <wlr/backend/x11.h>
|
||||
#endif
|
||||
#include <wlr/backend/headless.h>
|
||||
#include <wlr/types/wlr_compositor.h>
|
||||
#include <wlr/types/wlr_data_device.h>
|
||||
#include <wlr/types/wlr_output.h>
|
||||
|
|
@ -135,6 +136,11 @@ output_destroy(struct cg_output *output) {
|
|||
if(role == OUTPUT_ROLE_PERMANENT) {
|
||||
wlr_output_layout_get_box(server->output_layout, output->wlr_output,
|
||||
&output->layout_box);
|
||||
wlr_output_layout_remove(server->output_layout, output->wlr_output);
|
||||
output->wlr_output=wlr_headless_add_output(server->headless_backend,output->layout_box.width,output->layout_box.height);
|
||||
wlr_output_layout_add(server->output_layout, output->wlr_output, output->layout_box.x,
|
||||
output->layout_box.y);
|
||||
|
||||
} else {
|
||||
|
||||
output_clear(output);
|
||||
|
|
@ -309,6 +315,13 @@ output_apply_config(struct cg_server *server, struct cg_output *output,
|
|||
}
|
||||
} else {
|
||||
wlr_output_layout_add_auto(server->output_layout, wlr_output);
|
||||
// The following two lines make sure that the output is "manually" managed,
|
||||
// so that its position doesn't change anymore in the future.
|
||||
wlr_output_layout_get_box(server->output_layout, output->wlr_output,
|
||||
&output->layout_box);
|
||||
wlr_output_layout_move(server->output_layout, output->wlr_output, output->layout_box.x,
|
||||
output->layout_box.y);
|
||||
|
||||
|
||||
struct wlr_output_mode *preferred_mode =
|
||||
wlr_output_preferred_mode(wlr_output);
|
||||
|
|
@ -550,7 +563,10 @@ handle_new_output(struct wl_listener *listener, void *data) {
|
|||
output = ito;
|
||||
}
|
||||
}
|
||||
if(!reinit) {
|
||||
if(reinit) {
|
||||
wlr_output_layout_remove(server->output_layout, output->wlr_output);
|
||||
wlr_output_destroy(output->wlr_output);
|
||||
} else {
|
||||
output = calloc(1, sizeof(struct cg_output));
|
||||
}
|
||||
if(!output) {
|
||||
|
|
|
|||
1
server.h
1
server.h
|
|
@ -37,6 +37,7 @@ struct cg_server {
|
|||
struct cg_output *curr_output;
|
||||
struct wl_listener new_output;
|
||||
struct wl_list output_priorities;
|
||||
struct wlr_backend *headless_backend;
|
||||
|
||||
struct wlr_renderer *renderer;
|
||||
struct wlr_allocator *allocator;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue