rootston: add output-management-v1 support

master
emersion 6 years ago committed by Drew DeVault
parent e873c652bf
commit 54d6ba78c3

@ -7,6 +7,7 @@
#include <wlr/types/wlr_foreign_toplevel_management_v1.h> #include <wlr/types/wlr_foreign_toplevel_management_v1.h>
#include <wlr/types/wlr_gamma_control_v1.h> #include <wlr/types/wlr_gamma_control_v1.h>
#include <wlr/types/wlr_gamma_control.h> #include <wlr/types/wlr_gamma_control.h>
#include <wlr/types/wlr_gtk_primary_selection.h>
#include <wlr/types/wlr_idle_inhibit_v1.h> #include <wlr/types/wlr_idle_inhibit_v1.h>
#include <wlr/types/wlr_idle.h> #include <wlr/types/wlr_idle.h>
#include <wlr/types/wlr_input_inhibitor.h> #include <wlr/types/wlr_input_inhibitor.h>
@ -14,10 +15,10 @@
#include <wlr/types/wlr_layer_shell_v1.h> #include <wlr/types/wlr_layer_shell_v1.h>
#include <wlr/types/wlr_list.h> #include <wlr/types/wlr_list.h>
#include <wlr/types/wlr_output_layout.h> #include <wlr/types/wlr_output_layout.h>
#include <wlr/types/wlr_output_management_v1.h>
#include <wlr/types/wlr_output.h> #include <wlr/types/wlr_output.h>
#include <wlr/types/wlr_pointer_gestures_v1.h> #include <wlr/types/wlr_pointer_gestures_v1.h>
#include <wlr/types/wlr_presentation_time.h> #include <wlr/types/wlr_presentation_time.h>
#include <wlr/types/wlr_gtk_primary_selection.h>
#include <wlr/types/wlr_relative_pointer_v1.h> #include <wlr/types/wlr_relative_pointer_v1.h>
#include <wlr/types/wlr_screencopy_v1.h> #include <wlr/types/wlr_screencopy_v1.h>
#include <wlr/types/wlr_screenshooter.h> #include <wlr/types/wlr_screenshooter.h>
@ -69,6 +70,7 @@ struct roots_desktop {
struct wlr_foreign_toplevel_manager_v1 *foreign_toplevel_manager_v1; struct wlr_foreign_toplevel_manager_v1 *foreign_toplevel_manager_v1;
struct wlr_relative_pointer_manager_v1 *relative_pointer_manager; struct wlr_relative_pointer_manager_v1 *relative_pointer_manager;
struct wlr_pointer_gestures_v1 *pointer_gestures; struct wlr_pointer_gestures_v1 *pointer_gestures;
struct wlr_output_manager_v1 *output_manager_v1;
struct wl_listener new_output; struct wl_listener new_output;
struct wl_listener layout_change; struct wl_listener layout_change;
@ -81,6 +83,8 @@ struct roots_desktop {
struct wl_listener input_inhibit_deactivate; struct wl_listener input_inhibit_deactivate;
struct wl_listener virtual_keyboard_new; struct wl_listener virtual_keyboard_new;
struct wl_listener pointer_constraint; struct wl_listener pointer_constraint;
struct wl_listener output_manager_apply;
struct wl_listener output_manager_test;
#if WLR_HAS_XWAYLAND #if WLR_HAS_XWAYLAND
struct wlr_xwayland *xwayland; struct wlr_xwayland *xwayland;

@ -294,6 +294,26 @@ static void handle_pointer_constraint(struct wl_listener *listener,
} }
} }
static void handle_output_manager_apply(struct wl_listener *listener,
void *data) {
struct roots_desktop *desktop =
wl_container_of(listener, desktop, output_manager_apply);
struct wlr_output_configuration_v1 *config = data;
(void)config;
wlr_log(WLR_DEBUG, "APPLY"); // TODO
}
static void handle_output_manager_test(struct wl_listener *listener,
void *data) {
struct roots_desktop *desktop =
wl_container_of(listener, desktop, output_manager_test);
struct wlr_output_configuration_v1 *config = data;
// TODO: implement test-only mode
wlr_output_configuration_v1_send_succeeded(config);
wlr_output_configuration_v1_destroy(config);
}
struct roots_desktop *desktop_create(struct roots_server *server, struct roots_desktop *desktop_create(struct roots_server *server,
struct roots_config *config) { struct roots_config *config) {
wlr_log(WLR_DEBUG, "Initializing roots desktop"); wlr_log(WLR_DEBUG, "Initializing roots desktop");
@ -457,6 +477,15 @@ struct roots_desktop *desktop_create(struct roots_server *server,
desktop->pointer_gestures = desktop->pointer_gestures =
wlr_pointer_gestures_v1_create(server->wl_display); wlr_pointer_gestures_v1_create(server->wl_display);
desktop->output_manager_v1 =
wlr_output_manager_v1_create(server->wl_display);
desktop->output_manager_apply.notify = handle_output_manager_apply;
wl_signal_add(&desktop->output_manager_v1->events.apply,
&desktop->output_manager_apply);
desktop->output_manager_test.notify = handle_output_manager_test;
wl_signal_add(&desktop->output_manager_v1->events.test,
&desktop->output_manager_test);
wlr_primary_selection_v1_device_manager_create(server->wl_display); wlr_primary_selection_v1_device_manager_create(server->wl_display);
wlr_data_control_manager_v1_create(server->wl_display); wlr_data_control_manager_v1_create(server->wl_display);

@ -424,11 +424,27 @@ static void set_mode(struct wlr_output *output,
} }
} }
static void update_output_manager_config(struct roots_desktop *desktop) {
struct wlr_output_configuration_v1 *config =
wlr_output_configuration_v1_create();
struct roots_output *output;
wl_list_for_each(output, &desktop->outputs, link) {
struct wlr_output_configuration_head_v1 *head =
wlr_output_configuration_head_v1_create(config, output->wlr_output);
(void)head;
}
wlr_output_manager_v1_set_configuration(desktop->output_manager_v1, config);
}
static void output_destroy(struct roots_output *output) { static void output_destroy(struct roots_output *output) {
// TODO: cursor // TODO: cursor
//example_config_configure_cursor(sample->config, sample->cursor, //example_config_configure_cursor(sample->config, sample->cursor,
// sample->compositor); // sample->compositor);
struct roots_desktop *desktop = output->desktop;
wl_list_remove(&output->link); wl_list_remove(&output->link);
wl_list_remove(&output->destroy.link); wl_list_remove(&output->destroy.link);
wl_list_remove(&output->mode.link); wl_list_remove(&output->mode.link);
@ -437,6 +453,8 @@ static void output_destroy(struct roots_output *output) {
wl_list_remove(&output->damage_frame.link); wl_list_remove(&output->damage_frame.link);
wl_list_remove(&output->damage_destroy.link); wl_list_remove(&output->damage_destroy.link);
free(output); free(output);
update_output_manager_config(desktop);
} }
static void output_handle_destroy(struct wl_listener *listener, void *data) { static void output_handle_destroy(struct wl_listener *listener, void *data) {
@ -579,4 +597,6 @@ void handle_new_output(struct wl_listener *listener, void *data) {
arrange_layers(output); arrange_layers(output);
output_damage_whole(output); output_damage_whole(output);
update_output_manager_config(desktop);
} }

Loading…
Cancel
Save