xwayland-view.hh (5507B)
1 #pragma once 2 3 #ifdef XWAYLAND 4 #include <kranewl/tree/view.hh> 5 #include <kranewl/util.hh> 6 7 typedef class Server* Server_ptr; 8 typedef class Model* Model_ptr; 9 typedef class Seat* Seat_ptr; 10 typedef class Output* Output_ptr; 11 typedef class Context* Context_ptr; 12 typedef class Workspace* Workspace_ptr; 13 typedef struct XWayland* XWayland_ptr; 14 15 typedef struct XWaylandView final : public View { 16 XWaylandView( 17 struct wlr_xwayland_surface*, 18 Server_ptr, 19 Model_ptr, 20 Seat_ptr, 21 XWayland_ptr 22 ); 23 24 ~XWaylandView(); 25 26 void format_uid() override; 27 28 std::string const& class_() const { return m_class; } 29 std::string const& instance() const { return m_instance; } 30 void set_class(std::string const& class_) { m_class = class_; } 31 void set_instance(std::string const& instance) { m_instance = instance; } 32 33 Region constraints() override; 34 pid_t retrieve_pid() override; 35 bool prefers_floating() override; 36 37 void focus(Toggle) override; 38 void activate(Toggle) override; 39 void effectuate_fullscreen(bool) override; 40 41 void configure(Region const&, Extents const&, bool) override; 42 void close() override; 43 void close_popups() override; 44 45 static void handle_map(struct wl_listener*, void*); 46 static void handle_unmap(struct wl_listener*, void*); 47 static void handle_commit(struct wl_listener*, void*); 48 static void handle_request_activate(struct wl_listener*, void*); 49 static void handle_request_configure(struct wl_listener*, void*); 50 static void handle_request_fullscreen(struct wl_listener*, void*); 51 static void handle_request_minimize(struct wl_listener*, void*); 52 static void handle_request_maximize(struct wl_listener*, void*); 53 static void handle_request_move(struct wl_listener*, void*); 54 static void handle_request_resize(struct wl_listener*, void*); 55 static void handle_set_override_redirect(struct wl_listener*, void*); 56 static void handle_set_title(struct wl_listener*, void*); 57 static void handle_set_class(struct wl_listener*, void*); 58 static void handle_set_hints(struct wl_listener*, void*); 59 static void handle_destroy(struct wl_listener*, void*); 60 61 XWayland_ptr mp_xwayland; 62 63 struct wlr_xwayland_surface* mp_wlr_xwayland_surface; 64 65 struct wl_listener ml_map; 66 struct wl_listener ml_unmap; 67 struct wl_listener ml_commit; 68 struct wl_listener ml_request_activate; 69 struct wl_listener ml_request_configure; 70 struct wl_listener ml_request_fullscreen; 71 struct wl_listener ml_request_minimize; 72 struct wl_listener ml_request_maximize; 73 struct wl_listener ml_request_move; 74 struct wl_listener ml_request_resize; 75 struct wl_listener ml_set_override_redirect; 76 struct wl_listener ml_set_title; 77 struct wl_listener ml_set_class; 78 struct wl_listener ml_set_hints; 79 struct wl_listener ml_destroy; 80 81 private: 82 std::string m_class; 83 std::string m_instance; 84 85 }* XWaylandView_ptr; 86 87 typedef struct XWaylandUnmanaged final : public Node { 88 XWaylandUnmanaged( 89 struct wlr_xwayland_surface*, 90 Server_ptr, 91 Model_ptr, 92 Seat_ptr, 93 XWayland_ptr 94 ); 95 96 ~XWaylandUnmanaged(); 97 98 void format_uid() override; 99 100 std::string const& title() const { return m_title; } 101 std::string const& title_formatted() const { return m_title_formatted; } 102 std::string const& app_id() const { return m_app_id; } 103 std::string const& class_() const { return m_class; } 104 std::string const& instance() const { return m_instance; } 105 void set_title(std::string const& title) { m_title = title; } 106 void set_title_formatted(std::string const& title_formatted) { m_title_formatted = title_formatted; } 107 void set_app_id(std::string const& app_id) { m_app_id = app_id; } 108 void set_class(std::string const& class_) { m_class = class_; } 109 void set_instance(std::string const& instance) { m_instance = instance; } 110 111 pid_t retrieve_pid(); 112 113 pid_t pid() const { return m_pid; } 114 void set_pid(pid_t pid) { m_pid = pid; } 115 116 static void handle_map(struct wl_listener*, void*); 117 static void handle_unmap(struct wl_listener*, void*); 118 static void handle_commit(struct wl_listener*, void*); 119 static void handle_set_override_redirect(struct wl_listener*, void*); 120 static void handle_set_geometry(struct wl_listener*, void*); 121 static void handle_request_activate(struct wl_listener*, void*); 122 static void handle_request_configure(struct wl_listener*, void*); 123 static void handle_request_fullscreen(struct wl_listener*, void*); 124 static void handle_destroy(struct wl_listener*, void*); 125 126 Server_ptr mp_server; 127 Model_ptr mp_model; 128 Seat_ptr mp_seat; 129 130 Output_ptr mp_output; 131 132 XWayland_ptr mp_xwayland; 133 134 Region m_region; 135 136 struct wlr_xwayland_surface* mp_wlr_xwayland_surface; 137 138 struct wlr_surface* mp_wlr_surface; 139 struct wlr_scene_node* mp_scene; 140 struct wlr_scene_node* mp_scene_surface; 141 142 pid_t m_pid; 143 144 struct wl_listener ml_map; 145 struct wl_listener ml_unmap; 146 struct wl_listener ml_commit; 147 struct wl_listener ml_set_override_redirect; 148 struct wl_listener ml_set_geometry; 149 struct wl_listener ml_request_activate; 150 struct wl_listener ml_request_configure; 151 struct wl_listener ml_request_fullscreen; 152 struct wl_listener ml_destroy; 153 154 private: 155 std::string m_title; 156 std::string m_title_formatted; 157 std::string m_app_id; 158 std::string m_class; 159 std::string m_instance; 160 161 }* XWaylandUnmanaged_ptr; 162 #endif