-
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
122 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
#include "subsurface.hpp" | ||
|
||
#include "types.hpp" | ||
|
||
#include <utility> | ||
|
||
#include "wlr-wrap-start.hpp" | ||
#include <wlr/types/wlr_layer_shell_v1.h> | ||
#include <wlr/types/wlr_output_layout.h> | ||
#include <wlr/types/wlr_subcompositor.h> | ||
#include <wlr/util/log.h> | ||
#include "wlr-wrap-end.hpp" | ||
|
||
static void subsurface_destroy_notify(wl_listener* listener, [[maybe_unused]] void* data) { | ||
wlr_log(WLR_DEBUG, "wlr_subsurface.events.destroy(listener=%p, data=%p)", (void*) listener, data); | ||
|
||
Subsurface& subsurface = magpie_container_of(listener, subsurface, destroy); | ||
|
||
subsurface.parent.subsurfaces.erase(std::dynamic_pointer_cast<Subsurface>(subsurface.shared_from_this())); | ||
} | ||
|
||
Subsurface::Subsurface(Surface& parent, wlr_subsurface& subsurface) noexcept | ||
: listeners(*this), parent(parent), wlr(subsurface) { | ||
listeners.destroy.notify = subsurface_destroy_notify; | ||
wl_signal_add(&subsurface.events.destroy, &listeners.destroy); | ||
} | ||
|
||
Subsurface::~Subsurface() noexcept { | ||
wl_list_remove(&listeners.map.link); | ||
wl_list_remove(&listeners.destroy.link); | ||
} | ||
|
||
wlr_surface* Subsurface::get_wlr_surface() const { | ||
return wlr.surface; | ||
} | ||
|
||
Server& Subsurface::get_server() const { | ||
return parent.get_server(); | ||
} | ||
|
||
bool Subsurface::is_view() const { | ||
return false; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#ifndef MAGPIE_SUBSURFACE_HPP | ||
#define MAGPIE_SUBSURFACE_HPP | ||
|
||
#include "server.hpp" | ||
#include "surface.hpp" | ||
#include "types.hpp" | ||
|
||
#include <functional> | ||
#include <memory> | ||
#include <set> | ||
|
||
#include "wlr-wrap-start.hpp" | ||
#include <wlr/types/wlr_subcompositor.h> | ||
#include "wlr-wrap-end.hpp" | ||
|
||
class Subsurface final : public Surface { | ||
public: | ||
struct Listeners { | ||
std::reference_wrapper<Subsurface> parent; | ||
wl_listener map = {}; | ||
wl_listener destroy = {}; | ||
explicit Listeners(Subsurface& parent) noexcept : parent(parent) {} | ||
}; | ||
|
||
private: | ||
Listeners listeners; | ||
|
||
public: | ||
Surface& parent; | ||
wlr_subsurface& wlr; | ||
|
||
Subsurface(Surface& parent, wlr_subsurface& subsurface) noexcept; | ||
~Subsurface() noexcept override; | ||
|
||
[[nodiscard]] wlr_surface* get_wlr_surface() const override; | ||
[[nodiscard]] Server& get_server() const override; | ||
[[nodiscard]] bool is_view() const override; | ||
}; | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters