diff --git a/README.md b/README.md index 3e05fef6..ef0f7e93 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,6 @@ Nevertheless, REPORT any you find! Make an issue! - Blur - Fadein/out - Window rules - - Drag and drop - Fix electron rendering issues - Fix sloppy dragging of windows - Optimization 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::listlayerSurface, 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); } }