summaryrefslogtreecommitdiff
path: root/src/events/Misc.cpp
diff options
context:
space:
mode:
authorvaxerski <43317083+vaxerski@users.noreply.github.com>2022-03-21 15:17:04 +0100
committervaxerski <43317083+vaxerski@users.noreply.github.com>2022-03-21 15:17:04 +0100
commitd06423c9d1fcf908a485b8654d13dd1b154613a4 (patch)
treeaefb3c11ba50505a6aa708d0f4803ed02d1210bb /src/events/Misc.cpp
parentb0c6f9a119dc85efcff6af685b0a71d0193d700d (diff)
moved events to separate files
Diffstat (limited to 'src/events/Misc.cpp')
-rw-r--r--src/events/Misc.cpp66
1 files changed, 66 insertions, 0 deletions
diff --git a/src/events/Misc.cpp b/src/events/Misc.cpp
new file mode 100644
index 00000000..812db15d
--- /dev/null
+++ b/src/events/Misc.cpp
@@ -0,0 +1,66 @@
+#include "Events.hpp"
+
+#include "../Compositor.hpp"
+#include "../helpers/WLClasses.hpp"
+#include "../managers/InputManager.hpp"
+#include "../render/Renderer.hpp"
+
+// ------------------------------ //
+// __ __ _____ _____ _____ //
+// | \/ |_ _|/ ____|/ ____| //
+// | \ / | | | | (___ | | //
+// | |\/| | | | \___ \| | //
+// | | | |_| |_ ____) | |____ //
+// |_| |_|_____|_____/ \_____| //
+// //
+// ------------------------------ //
+
+void Events::listener_outputMgrApply(wl_listener* listener, void* data) {
+ const auto CONFIG = (wlr_output_configuration_v1*)data;
+ g_pHyprRenderer->outputMgrApplyTest(CONFIG, false);
+}
+
+void Events::listener_outputMgrTest(wl_listener* listener, void* data) {
+ const auto CONFIG = (wlr_output_configuration_v1*)data;
+ g_pHyprRenderer->outputMgrApplyTest(CONFIG, true);
+}
+
+void Events::listener_requestSetPrimarySel(wl_listener* listener, void* data) {
+ const auto EVENT = (wlr_seat_request_set_primary_selection_event*)data;
+ wlr_seat_set_primary_selection(g_pCompositor->m_sWLRSeat, EVENT->source, EVENT->serial);
+}
+
+void Events::listener_requestSetSel(wl_listener* listener, void* data) {
+ const auto EVENT = (wlr_seat_request_set_selection_event*)data;
+ wlr_seat_set_selection(g_pCompositor->m_sWLRSeat, EVENT->source, EVENT->serial);
+}
+
+void Events::listener_readyXWayland(wl_listener* listener, void* data) {
+ const auto XCBCONNECTION = xcb_connect(g_pXWaylandManager->m_sWLRXWayland->display_name, NULL);
+ const auto ERR = xcb_connection_has_error(XCBCONNECTION);
+ if (ERR) {
+ Debug::log(LogLevel::ERR, "XWayland -> xcb_connection_has_error failed with %i", ERR);
+ return;
+ }
+
+ for (auto& ATOM : HYPRATOMS) {
+ xcb_intern_atom_cookie_t cookie = xcb_intern_atom(XCBCONNECTION, 0, ATOM.first.length(), ATOM.first.c_str());
+ xcb_intern_atom_reply_t* reply = xcb_intern_atom_reply(XCBCONNECTION, cookie, NULL);
+
+ if (!reply) {
+ Debug::log(LogLevel::ERR, "XWayland -> Atom failed: %s", ATOM.first.c_str());
+ continue;
+ }
+
+ ATOM.second = reply->atom;
+ }
+
+ wlr_xwayland_set_seat(g_pXWaylandManager->m_sWLRXWayland, g_pCompositor->m_sWLRSeat);
+
+ const auto XCURSOR = wlr_xcursor_manager_get_xcursor(g_pCompositor->m_sWLRXCursorMgr, "left_ptr", 1);
+ if (XCURSOR) {
+ wlr_xwayland_set_cursor(g_pXWaylandManager->m_sWLRXWayland, XCURSOR->images[0]->buffer, XCURSOR->images[0]->width * 4, XCURSOR->images[0]->width, XCURSOR->images[0]->height, XCURSOR->images[0]->hotspot_x, XCURSOR->images[0]->hotspot_y);
+ }
+
+ xcb_disconnect(XCBCONNECTION);
+} \ No newline at end of file