summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorvaxerski <43317083+vaxerski@users.noreply.github.com>2022-03-21 17:50:28 +0100
committervaxerski <43317083+vaxerski@users.noreply.github.com>2022-03-21 17:50:28 +0100
commit30ae4be181c4b65cd7d006041364f1642db9d837 (patch)
treea74d60a332bce8f3baecc7aa0c76129588faa630 /src
parent546fff6aa69db5722638cb79a3f3aebc75fde0c9 (diff)
added drag and drop functionality
barebones but functioning
Diffstat (limited to 'src')
-rw-r--r--src/Compositor.cpp3
-rw-r--r--src/events/Events.hpp4
-rw-r--r--src/events/Misc.cpp16
-rw-r--r--src/render/Renderer.cpp2
4 files changed, 24 insertions, 1 deletions
diff --git a/src/Compositor.cpp b/src/Compositor.cpp
index ca36cc5d..8ee3f3fe 100644
--- a/src/Compositor.cpp
+++ b/src/Compositor.cpp
@@ -5,6 +5,8 @@ CCompositor::CCompositor() {
unlink("/tmp/hypr/hyprlandd.log");
unlink("/tmp/hypr/.hyprlandrq");
+ system("mkdir -p /tmp/hypr");
+
m_sWLDisplay = wl_display_create();
m_sWLRBackend = wlr_backend_autocreate(m_sWLDisplay);
@@ -88,6 +90,7 @@ void CCompositor::initAllSignals() {
wl_signal_add(&m_sWLRBackend->events.new_input, &Events::listen_newInput);
wl_signal_add(&m_sWLRSeat->events.request_set_cursor, &Events::listen_requestMouse);
wl_signal_add(&m_sWLRSeat->events.request_set_selection, &Events::listen_requestSetSel);
+ wl_signal_add(&m_sWLRSeat->events.request_start_drag, &Events::listen_requestDrag);
wl_signal_add(&m_sWLRLayerShell->events.new_surface, &Events::listen_newLayerSurface);
wl_signal_add(&m_sWLROutputLayout->events.change, &Events::listen_change);
wl_signal_add(&m_sWLROutputMgr->events.apply, &Events::listen_outputMgrApply);
diff --git a/src/events/Events.hpp b/src/events/Events.hpp
index 4313d8d1..ed727f7a 100644
--- a/src/events/Events.hpp
+++ b/src/events/Events.hpp
@@ -81,4 +81,8 @@ namespace Events {
// XWayland
LISTENER(readyXWayland);
LISTENER(surfaceXWayland);
+
+ // Drag & Drop
+ LISTENER(requestDrag);
+ LISTENER(startDrag);
}; \ No newline at end of file
diff --git a/src/events/Misc.cpp b/src/events/Misc.cpp
index 812db15d..f31ca3b9 100644
--- a/src/events/Misc.cpp
+++ b/src/events/Misc.cpp
@@ -63,4 +63,20 @@ void Events::listener_readyXWayland(wl_listener* listener, void* data) {
}
xcb_disconnect(XCBCONNECTION);
+}
+
+void Events::listener_requestDrag(wl_listener* listener, void* data) {
+ const auto E = (wlr_seat_request_start_drag_event*)data;
+
+ if (!wlr_seat_validate_pointer_grab_serial(g_pCompositor->m_sWLRSeat, E->origin, E->serial)) {
+ Debug::log(LOG, "Ignoring drag and drop request: serial mismatch.");
+ wlr_data_source_destroy(E->drag->source);
+ return;
+ }
+
+ wlr_seat_start_pointer_drag(g_pCompositor->m_sWLRSeat, E->drag, E->serial);
+}
+
+void Events::listener_startDrag(wl_listener* listener, void* data) {
+ // TODO: draw the drag icon
} \ No newline at end of file
diff --git a/src/render/Renderer.cpp b/src/render/Renderer.cpp
index d70fe297..0424931a 100644
--- a/src/render/Renderer.cpp
+++ b/src/render/Renderer.cpp
@@ -315,7 +315,7 @@ void CHyprRenderer::arrangeLayerArray(SMonitor* pMonitor, const std::list<SLayer
wlr_layer_surface_v1_configure(ls->layerSurface, box.width, box.height);
- Debug::log(LOG, "LayerSurface %x arranged: x: %i y: %i w: %i h: %i", &ls, box.x, box.y, box.width, box.height);
+ Debug::log(LOG, "LayerSurface %x arranged: x: %i y: %i w: %i h: %i with margins: t: %i l: %i r: %i b: %i", &ls, box.x, box.y, box.width, box.height, PSTATE->margin.top, PSTATE->margin.left, PSTATE->margin.right, PSTATE->margin.bottom);
}
}