commit a619f30fd0f4a4183bf3969d446ca9d1027eeb2b
parent b7cfa064e7581bddc9444117000625d715295ad8
Author: deurzen <m.deurzen@tum.de>
Date: Sun, 22 May 2022 22:28:09 +0200
implements xdg shell creation handling
Diffstat:
15 files changed, 708 insertions(+), 50 deletions(-)
diff --git a/.ccls b/.ccls
@@ -21,3 +21,4 @@ c++
-Wdouble-promotion
-Wformat=2
-Weffc++
+-DXWAYLAND
diff --git a/include/kranewl/geometry.hh b/include/kranewl/geometry.hh
@@ -2,6 +2,10 @@
#include <ostream>
+extern "C" {
+#include <wlr/util/box.h>
+}
+
struct Dim final {
int w;
int h;
@@ -176,6 +180,18 @@ struct Region final {
Pos pos;
Dim dim;
+ operator struct wlr_box() const
+ {
+ struct wlr_box box;
+
+ box.x = this->pos.x;
+ box.y = this->pos.y;
+ box.width = this->dim.w;
+ box.height = this->dim.h;
+
+ return box;
+ }
+
void apply_minimum_dim(Dim const&);
void apply_extents(Extents const&);
void remove_extents(Extents const&);
diff --git a/include/kranewl/model.hh b/include/kranewl/model.hh
@@ -19,7 +19,13 @@ typedef class Output* Output_ptr;
typedef class Context* Context_ptr;
typedef class Workspace* Workspace_ptr;
typedef class Server* Server_ptr;
+typedef struct View* View_ptr;
+typedef struct XDGView* XDGView_ptr;
+#ifdef XWAYLAND
+typedef struct XWaylandView* XWaylandView_ptr;
+#endif
class Config;
+
class Model final
{
public:
@@ -33,7 +39,10 @@ public:
void register_output(Output_ptr);
void unregister_output(Output_ptr);
- View_ptr create_view(Surface);
+ XDGView_ptr create_xdg_shell_view(struct wlr_xdg_surface*, Seat_ptr);
+#ifdef XWAYLAND
+ XWaylandView_ptr create_xwayland_view(struct wlr_xwayland_surface*, Seat_ptr);
+#endif
void register_view(View_ptr);
void unregister_view(View_ptr);
diff --git a/include/kranewl/placement.hh b/include/kranewl/placement.hh
@@ -6,7 +6,7 @@
#include <cstdlib>
#include <optional>
-typedef class View* View_ptr;
+typedef struct View* View_ptr;
struct PlacementTarget final {
enum class TargetType
{
diff --git a/include/kranewl/tree/view.hh b/include/kranewl/tree/view.hh
@@ -3,6 +3,9 @@
#include <kranewl/common.hh>
#include <kranewl/decoration.hh>
#include <kranewl/geometry.hh>
+#include <kranewl/context.hh>
+#include <kranewl/workspace.hh>
+#include <kranewl/model.hh>
#include <kranewl/tree/surface.hh>
#include <vector>
@@ -36,14 +39,40 @@ typedef struct View {
#endif
};
-protected:
- View(XDGView_ptr);
+ View(
+ XDGView_ptr,
+ Uid,
+ Server_ptr,
+ Model_ptr,
+ Seat_ptr,
+ Output_ptr,
+ Context_ptr,
+ Workspace_ptr,
+ void(*)(wl_listener*, void*),
+ void(*)(wl_listener*, void*),
+ void(*)(wl_listener*, void*),
+ void(*)(wl_listener*, void*),
+ void(*)(wl_listener*, void*)
+ );
#if XWAYLAND
- View(XWaylandView_ptr);
+ View(
+ XWaylandView_ptr,
+ Uid,
+ Server_ptr,
+ Model_ptr,
+ Seat_ptr,
+ Output_ptr,
+ Context_ptr,
+ Workspace_ptr,
+ void(*)(wl_listener*, void*),
+ void(*)(wl_listener*, void*),
+ void(*)(wl_listener*, void*),
+ void(*)(wl_listener*, void*),
+ void(*)(wl_listener*, void*)
+ );
#endif
-public:
- ~View();
+ virtual ~View();
static bool
is_free(View_ptr view)
@@ -131,7 +160,8 @@ typedef struct ViewChild {
protected:
ViewChild(SubsurfaceViewChild_ptr);
ViewChild(PopupViewChild_ptr);
- ~ViewChild();
+
+ virtual ~ViewChild();
public:
Uid m_uid;
diff --git a/include/kranewl/tree/xdg_view.hh b/include/kranewl/tree/xdg_view.hh
@@ -1,11 +1,47 @@
#pragma once
#include <kranewl/tree/view.hh>
+#include <kranewl/util.hh>
+
+typedef class Server* Server_ptr;
+typedef class Model* Model_ptr;
+typedef class Seat* Seat_ptr;
+typedef class Output* Output_ptr;
+typedef class Context* Context_ptr;
+typedef class Workspace* Workspace_ptr;
+
+typedef struct XDGView final : public View {
+ XDGView(
+ struct wlr_xdg_surface*,
+ Server_ptr,
+ Model_ptr,
+ Seat_ptr,
+ Output_ptr,
+ Context_ptr,
+ Workspace_ptr
+ );
-struct XDGView final : public View {
- XDGView();
~XDGView();
+ static void handle_foreign_activate_request(struct wl_listener*, void*);
+ static void handle_foreign_fullscreen_request(struct wl_listener*, void*);
+ static void handle_foreign_close_request(struct wl_listener*, void*);
+ static void handle_foreign_destroy(struct wl_listener*, void*);
+ static void handle_surface_new_subsurface(struct wl_listener*, void*);
+ static void handle_commit(struct wl_listener*, void*);
+ static void handle_request_move(struct wl_listener*, void*);
+ static void handle_request_resize(struct wl_listener*, void*);
+ static void handle_request_fullscreen(struct wl_listener*, void*);
+ static void handle_set_title(struct wl_listener*, void*);
+ static void handle_set_app_id(struct wl_listener*, void*);
+ static void handle_new_popup(struct wl_listener*, void*);
+ static void handle_map(struct wl_listener*, void*);
+ static void handle_unmap(struct wl_listener*, void*);
+ static void handle_destroy(struct wl_listener*, void*);
+
+ struct wlr_xdg_surface* mp_wlr_xdg_surface;
+ struct wlr_xdg_toplevel* mp_wlr_xdg_toplevel;
+
struct wl_listener ml_commit;
struct wl_listener ml_request_move;
struct wl_listener ml_request_resize;
@@ -17,4 +53,4 @@ struct XDGView final : public View {
struct wl_listener ml_unmap;
struct wl_listener ml_destroy;
-};
+}* XDGView_ptr;
diff --git a/include/kranewl/tree/xwayland_view.hh b/include/kranewl/tree/xwayland_view.hh
@@ -1,12 +1,55 @@
#pragma once
#include <kranewl/tree/view.hh>
+#include <kranewl/util.hh>
+
+typedef class Server* Server_ptr;
+typedef class Model* Model_ptr;
+typedef class Seat* Seat_ptr;
+typedef class Output* Output_ptr;
+typedef class Context* Context_ptr;
+typedef class Workspace* Workspace_ptr;
#if XWAYLAND
-struct XWaylandView final : public View {
- XWaylandView();
+typedef struct XWaylandView final : public View {
+ XWaylandView(
+ struct wlr_xwayland_surface*,
+ Server_ptr,
+ Model_ptr,
+ Seat_ptr,
+ Output_ptr,
+ Context_ptr,
+ Workspace_ptr
+ );
+
~XWaylandView();
+ static void handle_foreign_activate_request(struct wl_listener*, void*);
+ static void handle_foreign_fullscreen_request(struct wl_listener*, void*);
+ static void handle_foreign_close_request(struct wl_listener*, void*);
+ static void handle_foreign_destroy(struct wl_listener*, void*);
+ static void handle_surface_new_subsurface(struct wl_listener*, void*);
+ static void handle_commit(struct wl_listener*, void*);
+ static void handle_request_move(struct wl_listener*, void*);
+ static void handle_request_resize(struct wl_listener*, void*);
+ static void handle_request_maximize(struct wl_listener*, void*);
+ static void handle_request_minimize(struct wl_listener*, void*);
+ static void handle_request_configure(struct wl_listener*, void*);
+ static void handle_request_fullscreen(struct wl_listener*, void*);
+ static void handle_request_activate(struct wl_listener*, void*);
+ static void handle_set_title(struct wl_listener*, void*);
+ static void handle_set_class(struct wl_listener*, void*);
+ static void handle_set_role(struct wl_listener*, void*);
+ static void handle_set_window_type(struct wl_listener*, void*);
+ static void handle_set_hints(struct wl_listener*, void*);
+ static void handle_set_decorations(struct wl_listener*, void*);
+ static void handle_map(struct wl_listener*, void*);
+ static void handle_unmap(struct wl_listener*, void*);
+ static void handle_destroy(struct wl_listener*, void*);
+ static void handle_override_redirect(struct wl_listener*, void*);
+
+ struct wlr_xwayland_surface* mp_wlr_xwayland_surface;
+
struct wl_listener ml_commit;
struct wl_listener ml_request_move;
struct wl_listener ml_request_resize;
@@ -26,15 +69,15 @@ struct XWaylandView final : public View {
struct wl_listener ml_destroy;
struct wl_listener ml_override_redirect;
-};
+}* XWaylandView_ptr;
-struct XWaylandUnmanaged final {
- XWaylandUnmanaged();
+typedef struct XWaylandUnmanaged final {
+ XWaylandUnmanaged(struct wlr_xwayland_surface*);
~XWaylandUnmanaged();
Pos m_pos;
- struct wlr_xwayland_surface* m_wlr_xwayland_surface;
+ struct wlr_xwayland_surface* mp_wlr_xwayland_surface;
struct wl_listener ml_request_activate;
struct wl_listener ml_request_configure;
@@ -46,5 +89,5 @@ struct XWaylandUnmanaged final {
struct wl_listener ml_destroy;
struct wl_listener ml_override_redirect;
-};
+}* XWaylandUnmanaged_ptr;
#endif
diff --git a/include/kranewl/workspace.hh b/include/kranewl/workspace.hh
@@ -7,7 +7,7 @@
#include <kranewl/placement.hh>
#include <kranewl/util.hh>
-typedef class View* View_ptr;
+typedef struct View* View_ptr;
typedef class Context* Context_ptr;
typedef class Workspace final {
public:
diff --git a/include/version.hh b/include/version.hh
@@ -1 +1 @@
-#define VERSION "master/78d93d1+"
-\ No newline at end of file
+#define VERSION "master/b7cfa06+"
+\ No newline at end of file
diff --git a/src/kranewl/input/seat.cc b/src/kranewl/input/seat.cc
@@ -56,19 +56,19 @@ Seat::~Seat()
}
-static void
+static inline void
process_cursor_move(Seat_ptr seat, uint32_t time)
{
}
-static void
+static inline void
process_cursor_resize(Seat_ptr seat, uint32_t time)
{
}
-static void
+static inline void
process_cursor_motion(Seat_ptr seat, uint32_t time)
{
switch (seat->m_cursor_mode) {
diff --git a/src/kranewl/model.cc b/src/kranewl/model.cc
@@ -11,9 +11,15 @@
#include <kranewl/input/mouse.hh>
#include <kranewl/server.hh>
#include <kranewl/tree/output.hh>
+#include <kranewl/tree/view.hh>
+#include <kranewl/tree/xdg_view.hh>
+#include <kranewl/tree/xwayland_view.hh>
#include <kranewl/workspace.hh>
#include <spdlog/spdlog.h>
+#include <spdlog/fmt/bin_to_hex.h>
+
+#include <iomanip>
Model::Model(
Config const& config,
@@ -44,7 +50,7 @@ Model::Model(
#ifdef NDEBUG
if (autostart_path) {
- spdlog::info("Executing autostart file at " + *autostart_path);
+ spdlog::info("Executing autostart file at {}", *autostart_path);
exec_external(*autostart_path);
}
#endif
@@ -130,29 +136,74 @@ Model::unregister_output(Output_ptr output)
delete output;
}
-View_ptr
-Model::create_view(Surface surface)
+XDGView_ptr
+Model::create_xdg_shell_view(
+ struct wlr_xdg_surface* wlr_xdg_surface,
+ Seat_ptr seat
+)
{
- /* View_ptr view = new View( */
- /* mp_server, */
- /* surface, */
- /* mp_output, */
- /* mp_context, */
- /* mp_workspace */
- /* ); */
+ TRACE();
+
+ XDGView_ptr view = new XDGView(
+ wlr_xdg_surface,
+ mp_server,
+ this,
+ seat,
+ mp_output,
+ mp_context,
+ mp_workspace
+ );
- /* register_view(view); */
+ register_view(view);
- /* return view; */
+ return view;
+}
+
+XWaylandView_ptr
+Model::create_xwayland_view(
+ struct wlr_xwayland_surface* wlr_xwayland_surface,
+ Seat_ptr seat
+)
+{
+ TRACE();
+
+ XWaylandView_ptr view = new XWaylandView(
+ wlr_xwayland_surface,
+ mp_server,
+ this,
+ seat,
+ mp_output,
+ mp_context,
+ mp_workspace
+ );
+
+ register_view(view);
+
+ return view;
}
void
Model::register_view(View_ptr view)
{
+ TRACE();
+
+ m_view_map[view->m_uid] = view;
+
+ std::stringstream uid_stream;
+ uid_stream << std::hex << view->m_uid;
+ spdlog::info("Registered view 0x{}", uid_stream.str());
}
void
Model::unregister_view(View_ptr view)
{
+ TRACE();
+
+ std::stringstream uid_stream;
+ uid_stream << std::hex << view->m_uid;
+
+ m_view_map.erase(view->m_uid);
delete view;
+
+ spdlog::info("Unegistered view 0x{}", uid_stream.str());
}
diff --git a/src/kranewl/server.cc b/src/kranewl/server.cc
@@ -7,6 +7,9 @@
#include <kranewl/model.hh>
#include <kranewl/tree/client.hh>
#include <kranewl/tree/output.hh>
+#include <kranewl/tree/view.hh>
+#include <kranewl/tree/xdg_view.hh>
+#include <kranewl/tree/xwayland_view.hh>
#include <spdlog/spdlog.h>
@@ -197,7 +200,7 @@ Server::Server(Model_ptr model)
setenv("WAYLAND_DISPLAY", m_socket.c_str(), true);
setenv("XDG_CURRENT_DESKTOP", "kranewl", true);
- spdlog::info("Server initiated on WAYLAND_DISPLAY=" + m_socket);
+ spdlog::info("Server initiated on WAYLAND_DISPLAY={}", m_socket);
}
Server::~Server()
@@ -226,7 +229,7 @@ Server::handle_new_output(struct wl_listener* listener, void* data)
if (!wlr_output_init_render(wlr_output, server->mp_allocator, server->mp_renderer)) {
spdlog::error("Could not initialize rendering to output");
- spdlog::warn("Ignoring output " + std::string(wlr_output->name));
+ spdlog::warn("Ignoring output {}", std::string(wlr_output->name));
return;
}
@@ -269,11 +272,74 @@ Server::handle_output_manager_test(struct wl_listener*, void*)
}
+static inline View_ptr
+view_from_popup(struct wlr_xdg_popup* popup)
+{
+ struct wlr_xdg_surface* surface = popup->base;
+
+ for (;;)
+ switch (surface->role) {
+ case WLR_XDG_SURFACE_ROLE_POPUP:
+ if (!wlr_surface_is_xdg_surface(surface->popup->parent))
+ return nullptr;
+
+ surface = wlr_xdg_surface_from_wlr_surface(surface->popup->parent);
+ break;
+ case WLR_XDG_SURFACE_ROLE_TOPLEVEL: return reinterpret_cast<View_ptr>(surface->data);
+ case WLR_XDG_SURFACE_ROLE_NONE: return nullptr;
+ }
+}
+
void
-Server::handle_new_xdg_surface(struct wl_listener*, void*)
+Server::handle_new_xdg_surface(struct wl_listener* listener, void* data)
{
TRACE();
+ View_ptr view;
+ Server_ptr server = wl_container_of(listener, server, ml_new_xdg_surface);
+ struct wlr_xdg_surface* xdg_surface
+ = reinterpret_cast<struct wlr_xdg_surface*>(data);
+
+ switch (xdg_surface->role) {
+ case WLR_XDG_SURFACE_ROLE_POPUP:
+ {
+ struct wlr_box mappable_box;
+
+ struct wlr_xdg_surface* parent
+ = wlr_xdg_surface_from_wlr_surface(xdg_surface->popup->parent);
+
+ struct wlr_scene_node* parent_node
+ = reinterpret_cast<struct wlr_scene_node*>(parent->data);
+
+ xdg_surface->data
+ = wlr_scene_xdg_surface_create(parent_node, xdg_surface);
+
+ if (!(view = view_from_popup(xdg_surface->popup)) || !view->mp_output)
+ return;
+
+ mappable_box = view->mp_output->placeable_region();
+ mappable_box.x -= view->m_active_region.pos.x;
+ mappable_box.y -= view->m_active_region.pos.y;
+
+ wlr_xdg_popup_unconstrain_from_box(xdg_surface->popup, &mappable_box);
+ }
+ return;
+ case WLR_XDG_SURFACE_ROLE_NONE: return;
+ default: break;
+ }
+
+ xdg_surface->data = view = server->mp_model->create_xdg_shell_view(
+ xdg_surface,
+ &server->m_seat
+ );
+
+ view->mp_scene = wlr_scene_xdg_surface_create(
+ &server->mp_scene->node,
+ xdg_surface
+ );
+
+ view->mp_scene->data = view;
+ xdg_surface->data = view->mp_scene;
}
void
diff --git a/src/kranewl/tree/view.cc b/src/kranewl/tree/view.cc
@@ -1,12 +1,66 @@
#include <kranewl/tree/view.hh>
-View::View(XDGView_ptr)
- : m_type(Type::XDGShell)
-{}
+View::View(
+ XDGView_ptr,
+ Uid uid,
+ Server_ptr server,
+ Model_ptr model,
+ Seat_ptr seat,
+ Output_ptr output,
+ Context_ptr context,
+ Workspace_ptr workspace,
+ void(*handle_foreign_activate_request)(wl_listener*, void*),
+ void(*handle_foreign_fullscreen_request)(wl_listener*, void*),
+ void(*handle_foreign_close_request)(wl_listener*, void*),
+ void(*handle_foreign_destroy)(wl_listener*, void*),
+ void(*handle_surface_new_subsurface)(wl_listener*, void*)
+)
+ : m_uid(uid),
+ m_type(Type::XDGShell),
+ mp_server(server),
+ mp_model(model),
+ mp_seat(seat),
+ mp_output(output),
+ mp_context(context),
+ mp_workspace(workspace),
+ ml_foreign_activate_request({ .notify = handle_foreign_activate_request }),
+ ml_foreign_fullscreen_request({ .notify = handle_foreign_fullscreen_request }),
+ ml_foreign_close_request({ .notify = handle_foreign_close_request }),
+ ml_foreign_destroy({ .notify = handle_foreign_destroy }),
+ ml_surface_new_subsurface({ .notify = handle_surface_new_subsurface })
+{
+ wl_signal_init(&m_events.unmap);
+}
#if XWAYLAND
-View::View(XWaylandView_ptr)
- : m_type(Type::XWayland)
+View::View(
+ XWaylandView_ptr,
+ Uid uid,
+ Server_ptr server,
+ Model_ptr model,
+ Seat_ptr seat,
+ Output_ptr output,
+ Context_ptr context,
+ Workspace_ptr workspace,
+ void(*handle_foreign_activate_request)(wl_listener*, void*),
+ void(*handle_foreign_fullscreen_request)(wl_listener*, void*),
+ void(*handle_foreign_close_request)(wl_listener*, void*),
+ void(*handle_foreign_destroy)(wl_listener*, void*),
+ void(*handle_surface_new_subsurface)(wl_listener*, void*)
+)
+ : m_uid(uid),
+ m_type(Type::XWayland),
+ mp_server(server),
+ mp_model(model),
+ mp_seat(seat),
+ mp_output(output),
+ mp_context(context),
+ mp_workspace(workspace),
+ ml_foreign_activate_request({ .notify = handle_foreign_activate_request }),
+ ml_foreign_fullscreen_request({ .notify = handle_foreign_fullscreen_request }),
+ ml_foreign_close_request({ .notify = handle_foreign_close_request }),
+ ml_foreign_destroy({ .notify = handle_foreign_destroy }),
+ ml_surface_new_subsurface({ .notify = handle_surface_new_subsurface })
{}
#endif
diff --git a/src/kranewl/tree/xdg_view.cc b/src/kranewl/tree/xdg_view.cc
@@ -1,13 +1,158 @@
+#include <trace.hh>
+
#include <kranewl/tree/view.hh>
#include <kranewl/tree/xdg_view.hh>
-XDGView::XDGView()
- : View(this)
-{
+extern "C" {
+#include <wlr/types/wlr_xdg_shell.h>
+}
+XDGView::XDGView(
+ struct wlr_xdg_surface* wlr_xdg_surface,
+ Server_ptr server,
+ Model_ptr model,
+ Seat_ptr seat,
+ Output_ptr output,
+ Context_ptr context,
+ Workspace_ptr workspace
+)
+ : View(
+ this,
+ reinterpret_cast<std::uintptr_t>(wlr_xdg_surface),
+ server,
+ model,
+ seat,
+ output,
+ context,
+ workspace,
+ XDGView::handle_foreign_activate_request,
+ XDGView::handle_foreign_fullscreen_request,
+ XDGView::handle_foreign_close_request,
+ XDGView::handle_foreign_destroy,
+ XDGView::handle_surface_new_subsurface
+ ),
+ mp_wlr_xdg_surface(wlr_xdg_surface),
+ mp_wlr_xdg_toplevel(wlr_xdg_surface->toplevel),
+ ml_commit({ .notify = XDGView::handle_commit }),
+ ml_request_move({ .notify = XDGView::handle_request_move }),
+ ml_request_resize({ .notify = XDGView::handle_request_resize }),
+ ml_request_fullscreen({ .notify = XDGView::handle_request_fullscreen }),
+ ml_set_title({ .notify = XDGView::handle_set_title }),
+ ml_set_app_id({ .notify = XDGView::handle_set_app_id }),
+ ml_new_popup({ .notify = XDGView::handle_new_popup }),
+ ml_map({ .notify = XDGView::handle_map }),
+ ml_unmap({ .notify = XDGView::handle_unmap }),
+ ml_destroy({ .notify = XDGView::handle_destroy })
+{
+ wl_signal_add(&mp_wlr_xdg_surface->events.map, &ml_map);
+ wl_signal_add(&mp_wlr_xdg_surface->events.unmap, &ml_unmap);
+ wl_signal_add(&mp_wlr_xdg_surface->events.destroy, &ml_destroy);
}
XDGView::~XDGView()
+{}
+
+void
+XDGView::handle_foreign_activate_request(struct wl_listener* listener, void* data)
+{
+ TRACE();
+
+}
+
+void
+XDGView::handle_foreign_fullscreen_request(struct wl_listener* listener, void* data)
+{
+ TRACE();
+
+}
+
+void
+XDGView::handle_foreign_close_request(struct wl_listener* listener, void* data)
+{
+ TRACE();
+
+}
+
+void
+XDGView::handle_foreign_destroy(struct wl_listener* listener, void* data)
+{
+ TRACE();
+
+}
+
+void
+XDGView::handle_surface_new_subsurface(struct wl_listener* listener, void* data)
+{
+ TRACE();
+
+}
+
+void
+XDGView::handle_commit(struct wl_listener* listener, void* data)
+{
+ TRACE();
+
+}
+
+void
+XDGView::handle_request_move(struct wl_listener* listener, void* data)
+{
+ TRACE();
+
+}
+
+void
+XDGView::handle_request_resize(struct wl_listener* listener, void* data)
+{
+ TRACE();
+
+}
+
+void
+XDGView::handle_request_fullscreen(struct wl_listener* listener, void* data)
+{
+ TRACE();
+
+}
+
+void
+XDGView::handle_set_title(struct wl_listener* listener, void* data)
+{
+ TRACE();
+
+}
+
+void
+XDGView::handle_set_app_id(struct wl_listener* listener, void* data)
+{
+ TRACE();
+
+}
+
+void
+XDGView::handle_new_popup(struct wl_listener* listener, void* data)
+{
+ TRACE();
+
+}
+
+void
+XDGView::handle_map(struct wl_listener* listener, void* data)
+{
+ TRACE();
+
+}
+
+void
+XDGView::handle_unmap(struct wl_listener* listener, void* data)
+{
+ TRACE();
+
+}
+
+void
+XDGView::handle_destroy(struct wl_listener* listener, void* data)
{
+ TRACE();
}
diff --git a/src/kranewl/tree/xwayland_view.cc b/src/kranewl/tree/xwayland_view.cc
@@ -1,15 +1,222 @@
+#include <trace.hh>
+
#include <kranewl/tree/view.hh>
#include <kranewl/tree/xwayland_view.hh>
#if XWAYLAND
-XWaylandView::XWaylandView()
- : View(this)
+XWaylandView::XWaylandView(
+ struct wlr_xwayland_surface* wlr_xwayland_surface,
+ Server_ptr server,
+ Model_ptr model,
+ Seat_ptr seat,
+ Output_ptr output,
+ Context_ptr context,
+ Workspace_ptr workspace
+)
+ : View(
+ this,
+ reinterpret_cast<std::uintptr_t>(wlr_xwayland_surface),
+ server,
+ model,
+ seat,
+ output,
+ context,
+ workspace,
+ XWaylandView::handle_foreign_activate_request,
+ XWaylandView::handle_foreign_fullscreen_request,
+ XWaylandView::handle_foreign_close_request,
+ XWaylandView::handle_foreign_destroy,
+ XWaylandView::handle_surface_new_subsurface
+ ),
+ mp_wlr_xwayland_surface(wlr_xwayland_surface),
+ ml_commit({ .notify = XWaylandView::handle_commit }),
+ ml_request_move({ .notify = XWaylandView::handle_request_move }),
+ ml_request_resize({ .notify = XWaylandView::handle_request_resize }),
+ ml_request_maximize({ .notify = XWaylandView::handle_request_maximize }),
+ ml_request_minimize({ .notify = XWaylandView::handle_request_minimize }),
+ ml_request_configure({ .notify = XWaylandView::handle_request_configure }),
+ ml_request_fullscreen({ .notify = XWaylandView::handle_request_fullscreen }),
+ ml_request_activate({ .notify = XWaylandView::handle_request_activate }),
+ ml_set_title({ .notify = XWaylandView::handle_set_title }),
+ ml_set_class({ .notify = XWaylandView::handle_set_class }),
+ ml_set_role({ .notify = XWaylandView::handle_set_role }),
+ ml_set_window_type({ .notify = XWaylandView::handle_set_window_type }),
+ ml_set_hints({ .notify = XWaylandView::handle_set_hints }),
+ ml_set_decorations({ .notify = XWaylandView::handle_set_decorations }),
+ ml_map({ .notify = XWaylandView::handle_map }),
+ ml_unmap({ .notify = XWaylandView::handle_unmap }),
+ ml_destroy({ .notify = XWaylandView::handle_destroy }),
+ ml_override_redirect({ .notify = XWaylandView::handle_override_redirect })
+{}
+
+XWaylandView::~XWaylandView()
+{}
+
+XWaylandUnmanaged::XWaylandUnmanaged(struct wlr_xwayland_surface* wlr_xwayland_surface)
+ : mp_wlr_xwayland_surface(wlr_xwayland_surface)
+{}
+
+XWaylandUnmanaged::~XWaylandUnmanaged()
+{}
+
+void
+XWaylandView::handle_foreign_activate_request(struct wl_listener* listener, void* data)
{
+ TRACE();
}
-XWaylandView::~XWaylandView()
+void
+XWaylandView::handle_foreign_fullscreen_request(struct wl_listener* listener, void* data)
+{
+ TRACE();
+
+}
+
+void
+XWaylandView::handle_foreign_close_request(struct wl_listener* listener, void* data)
+{
+ TRACE();
+
+}
+
+void
+XWaylandView::handle_foreign_destroy(struct wl_listener* listener, void* data)
+{
+ TRACE();
+
+}
+
+void
+XWaylandView::handle_surface_new_subsurface(struct wl_listener* listener, void* data)
+{
+ TRACE();
+
+}
+
+void
+XWaylandView::handle_commit(struct wl_listener* listener, void* data)
+{
+ TRACE();
+
+}
+
+void
+XWaylandView::handle_request_move(struct wl_listener* listener, void* data)
+{
+ TRACE();
+
+}
+
+void
+XWaylandView::handle_request_resize(struct wl_listener* listener, void* data)
+{
+ TRACE();
+
+}
+
+void
+XWaylandView::handle_request_maximize(struct wl_listener* listener, void* data)
+{
+ TRACE();
+
+}
+
+void
+XWaylandView::handle_request_minimize(struct wl_listener* listener, void* data)
+{
+ TRACE();
+
+}
+
+void
+XWaylandView::handle_request_configure(struct wl_listener* listener, void* data)
+{
+ TRACE();
+
+}
+
+void
+XWaylandView::handle_request_fullscreen(struct wl_listener* listener, void* data)
+{
+ TRACE();
+
+}
+
+void
+XWaylandView::handle_request_activate(struct wl_listener* listener, void* data)
+{
+ TRACE();
+
+}
+
+void
+XWaylandView::handle_set_title(struct wl_listener* listener, void* data)
+{
+ TRACE();
+
+}
+
+void
+XWaylandView::handle_set_class(struct wl_listener* listener, void* data)
+{
+ TRACE();
+
+}
+
+void
+XWaylandView::handle_set_role(struct wl_listener* listener, void* data)
+{
+ TRACE();
+
+}
+
+void
+XWaylandView::handle_set_window_type(struct wl_listener* listener, void* data)
+{
+ TRACE();
+
+}
+
+void
+XWaylandView::handle_set_hints(struct wl_listener* listener, void* data)
+{
+ TRACE();
+
+}
+
+void
+XWaylandView::handle_set_decorations(struct wl_listener* listener, void* data)
+{
+ TRACE();
+
+}
+
+void
+XWaylandView::handle_map(struct wl_listener* listener, void* data)
+{
+ TRACE();
+
+}
+
+void
+XWaylandView::handle_unmap(struct wl_listener* listener, void* data)
+{
+ TRACE();
+
+}
+
+void
+XWaylandView::handle_destroy(struct wl_listener* listener, void* data)
+{
+ TRACE();
+
+}
+
+void
+XWaylandView::handle_override_redirect(struct wl_listener* listener, void* data)
{
+ TRACE();
}
#endif