Implement xdg-output

This commit is contained in:
Isaac Freund 2020-04-10 17:23:25 +02:00
parent bd91bacee9
commit 1ffd13ef86
No known key found for this signature in database
GPG Key ID: 86DED400DDFD7A11
2 changed files with 9 additions and 6 deletions

View File

@ -19,6 +19,7 @@ pub usingnamespace @cImport({
@cInclude("wlr/types/wlr_seat.h"); @cInclude("wlr/types/wlr_seat.h");
@cInclude("wlr/types/wlr_xcursor_manager.h"); @cInclude("wlr/types/wlr_xcursor_manager.h");
@cInclude("wlr/types/wlr_xdg_decoration_v1.h"); @cInclude("wlr/types/wlr_xdg_decoration_v1.h");
@cInclude("wlr/types/wlr_xdg_output_v1.h");
@cInclude("wlr/types/wlr_xdg_shell.h"); @cInclude("wlr/types/wlr_xdg_shell.h");
@cInclude("wlr/util/log.h"); @cInclude("wlr/util/log.h");
@cInclude("xkbcommon/xkbcommon.h"); @cInclude("xkbcommon/xkbcommon.h");

View File

@ -64,12 +64,6 @@ pub const Server = struct {
c.wlr_renderer_init_wl_display(self.wlr_renderer, self.wl_display); // orelse c.wlr_renderer_init_wl_display(self.wlr_renderer, self.wl_display); // orelse
// return error.CantInitWlDisplay; // return error.CantInitWlDisplay;
// These both free themselves when the wl_display is destroyed
_ = c.wlr_compositor_create(self.wl_display, self.wlr_renderer) orelse
return error.CantCreateWlrCompositor;
_ = c.wlr_data_device_manager_create(self.wl_display) orelse
return error.CantCreateWlrDataDeviceManager;
self.wlr_xdg_shell = c.wlr_xdg_shell_create(self.wl_display) orelse self.wlr_xdg_shell = c.wlr_xdg_shell_create(self.wl_display) orelse
return error.CantCreateWlrXdgShell; return error.CantCreateWlrXdgShell;
@ -84,6 +78,14 @@ pub const Server = struct {
try self.config.init(self.allocator); try self.config.init(self.allocator);
// These all free themselves when the wl_display is destroyed
_ = c.wlr_compositor_create(self.wl_display, self.wlr_renderer) orelse
return error.CantCreateWlrCompositor;
_ = c.wlr_data_device_manager_create(self.wl_display) orelse
return error.CantCreateWlrDataDeviceManager;
_ = c.wlr_xdg_output_manager_v1_create(self.wl_display, self.root.wlr_output_layout) orelse
return error.CantCreateWlrOutputManager;
// Register listeners for events on our globals // Register listeners for events on our globals
self.listen_new_output.notify = handleNewOutput; self.listen_new_output.notify = handleNewOutput;
c.wl_signal_add(&self.wlr_backend.events.new_output, &self.listen_new_output); c.wl_signal_add(&self.wlr_backend.events.new_output, &self.listen_new_output);