|
6 | 6 | #include "surface/popup.hpp"
|
7 | 7 | #include "surface/surface.hpp"
|
8 | 8 | #include "surface/view.hpp"
|
| 9 | +#include "surface/xdg_decoration.hpp" |
9 | 10 | #include "types.hpp"
|
10 | 11 | #include "xwayland.hpp"
|
11 | 12 |
|
@@ -253,6 +254,25 @@ static void new_xdg_toplevel_notify(wl_listener* listener, void* data) {
|
253 | 254 | server.views.emplace_back(std::make_shared<XdgView>(server, xdg_toplevel));
|
254 | 255 | }
|
255 | 256 |
|
| 257 | +static void new_toplevel_decoration_notify(wl_listener* listener, void* data) { |
| 258 | + wlr_log(WLR_DEBUG, "wlr_xdg_decoration_v1.events.new_toplevel_decoration(listener=%p, data=%p)", (void*) listener, data); |
| 259 | + |
| 260 | + if (data == nullptr) { |
| 261 | + wlr_log(WLR_ERROR, "No data passed to wlr_xdg_decoration_v1.events.new_toplevel_decoration"); |
| 262 | + return; |
| 263 | + } |
| 264 | + |
| 265 | + auto& xdg_toplevel_decoration = *static_cast<wlr_xdg_toplevel_decoration_v1*>(data); |
| 266 | + |
| 267 | + auto* view = static_cast<XdgView*>(xdg_toplevel_decoration.toplevel->base->data); |
| 268 | + if (view == nullptr) { |
| 269 | + wlr_log(WLR_ERROR, "xdg_toplevel_decoration_v1 created for toplevel surface without data ptr set"); |
| 270 | + return; |
| 271 | + } |
| 272 | + |
| 273 | + view->set_decoration(std::make_shared<XdgDecoration>(*view, xdg_toplevel_decoration)); |
| 274 | +} |
| 275 | + |
256 | 276 | static void new_layer_surface_notify(wl_listener* listener, void* data) {
|
257 | 277 | wlr_log(WLR_DEBUG, "wlr_layer_shell_v1.events.new_surface(listener=%p, data=%p)", (void*) listener, data);
|
258 | 278 |
|
@@ -579,6 +599,10 @@ Server::Server() : listeners(*this) {
|
579 | 599 | listeners.xdg_shell_new_xdg_toplevel.notify = new_xdg_toplevel_notify;
|
580 | 600 | wl_signal_add(&xdg_shell->events.new_toplevel, &listeners.xdg_shell_new_xdg_toplevel);
|
581 | 601 |
|
| 602 | + xdg_decoration_manager = wlr_xdg_decoration_manager_v1_create(display); |
| 603 | + listeners.xdg_decoration_new_toplevel_decoration.notify = new_toplevel_decoration_notify; |
| 604 | + wl_signal_add(&xdg_decoration_manager->events.new_toplevel_decoration, &listeners.xdg_decoration_new_toplevel_decoration); |
| 605 | + |
582 | 606 | layer_shell = wlr_layer_shell_v1_create(display, 4);
|
583 | 607 | listeners.layer_shell_new_layer_surface.notify = new_layer_surface_notify;
|
584 | 608 | wl_signal_add(&layer_shell->events.new_surface, &listeners.layer_shell_new_layer_surface);
|
|
0 commit comments