From 8f224149f176fb8de90a82b44f4dd1c6a1b89a4f Mon Sep 17 00:00:00 2001 From: Nicholas Noll Date: Mon, 4 Oct 2021 10:02:50 -0700 Subject: feat(wm): tiling prototype working --- sys/cmd/wm/main.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'sys/cmd/wm/main.c') diff --git a/sys/cmd/wm/main.c b/sys/cmd/wm/main.c index 7cc2f92..25981ca 100644 --- a/sys/cmd/wm/main.c +++ b/sys/cmd/wm/main.c @@ -6,6 +6,10 @@ Server server = { .make_monitor = { .notify = make_monitor }, .make_xdg_surface = { .notify = make_xdg_surface }, + .monitor_change = { .notify = monitor_change }, + .monitor_test = { .notify = monitor_test }, + .monitor_apply = { .notify = monitor_apply }, + .cursor_move = { .notify = cursor_move }, .cursor_move_abs = { .notify = cursor_move_abs }, .cursor_button = { .notify = cursor_button }, @@ -43,9 +47,15 @@ init_compositor(void) wlr_data_device_manager_create(server.display); server.monitor.layout = wlr_output_layout_create(); + wl_signal_add(&server.monitor.layout->events.change, &server.event.monitor_change); wl_list_init(&server.monitor.list); wl_signal_add(&server.backend->events.new_output, &server.event.make_monitor); + + /* rearrange monitor layouts */ + server.monitor.manager = wlr_output_manager_v1_create(server.display); + wl_signal_add(&server.monitor.manager->events.test, &server.event.monitor_test); + wl_signal_add(&server.monitor.manager->events.apply, &server.event.monitor_apply); } static inline @@ -156,6 +166,10 @@ main(int argc, char *argv[]) } wlr_log(WLR_INFO, "Running Wayland compositor on WAYLAND_DISPLAY=%s", socket); + server.monitor.selected = monitor_at(server.cursor.dot->x, server.cursor.dot->y); + wlr_cursor_warp_closest(server.cursor.dot, nil, server.cursor.dot->x, server.cursor.dot->y); + wlr_xcursor_manager_set_cursor_image(server.cursor.manager, "left_ptr", server.cursor.dot); + wl_display_run(server.display); /* event loop */ cleanup(); -- cgit v1.2.1