cursor: move to a hyprland impl
This moves wlr_cursor to a completely new impl mostly under CPointerManager Also adds beginSimple to OpenGL for simple render passes (e.g. cursor)
This commit is contained in:
parent
e4e84064f2
commit
ed411f53bd
51 changed files with 1550 additions and 496 deletions
|
|
@ -4,7 +4,6 @@
|
|||
#include "../helpers/WLClasses.hpp"
|
||||
#include "../managers/input/InputManager.hpp"
|
||||
#include "../render/Renderer.hpp"
|
||||
#include "../protocols/PointerGestures.hpp"
|
||||
|
||||
// ---------------------------------------------------- //
|
||||
// _____ ________ _______ _____ ______ _____ //
|
||||
|
|
@ -16,26 +15,6 @@
|
|||
// //
|
||||
// ---------------------------------------------------- //
|
||||
|
||||
void Events::listener_mouseFrame(wl_listener* listener, void* data) {
|
||||
wlr_seat_pointer_notify_frame(g_pCompositor->m_sSeat.seat);
|
||||
}
|
||||
|
||||
void Events::listener_mouseMove(wl_listener* listener, void* data) {
|
||||
g_pInputManager->onMouseMoved((wlr_pointer_motion_event*)data);
|
||||
}
|
||||
|
||||
void Events::listener_mouseMoveAbsolute(wl_listener* listener, void* data) {
|
||||
g_pInputManager->onMouseWarp((wlr_pointer_motion_absolute_event*)data);
|
||||
}
|
||||
|
||||
void Events::listener_mouseButton(wl_listener* listener, void* data) {
|
||||
g_pInputManager->onMouseButton((wlr_pointer_button_event*)data);
|
||||
}
|
||||
|
||||
void Events::listener_mouseAxis(wl_listener* listener, void* data) {
|
||||
g_pInputManager->onMouseWheel((wlr_pointer_axis_event*)data);
|
||||
}
|
||||
|
||||
void Events::listener_requestMouse(wl_listener* listener, void* data) {
|
||||
const auto EVENT = (wlr_seat_pointer_request_set_cursor_event*)data;
|
||||
|
||||
|
|
@ -75,62 +54,3 @@ void Events::listener_newInput(wl_listener* listener, void* data) {
|
|||
|
||||
g_pInputManager->updateCapabilities();
|
||||
}
|
||||
|
||||
void Events::listener_swipeBegin(wl_listener* listener, void* data) {
|
||||
const auto EVENT = (wlr_pointer_swipe_begin_event*)data;
|
||||
|
||||
g_pInputManager->onSwipeBegin(EVENT);
|
||||
}
|
||||
|
||||
void Events::listener_swipeUpdate(wl_listener* listener, void* data) {
|
||||
const auto EVENT = (wlr_pointer_swipe_update_event*)data;
|
||||
|
||||
g_pInputManager->onSwipeUpdate(EVENT);
|
||||
}
|
||||
|
||||
void Events::listener_swipeEnd(wl_listener* listener, void* data) {
|
||||
const auto EVENT = (wlr_pointer_swipe_end_event*)data;
|
||||
|
||||
g_pInputManager->onSwipeEnd(EVENT);
|
||||
}
|
||||
|
||||
void Events::listener_pinchBegin(wl_listener* listener, void* data) {
|
||||
const auto EV = (wlr_pointer_pinch_begin_event*)data;
|
||||
PROTO::pointerGestures->pinchBegin(EV->time_msec, EV->fingers);
|
||||
}
|
||||
|
||||
void Events::listener_pinchUpdate(wl_listener* listener, void* data) {
|
||||
const auto EV = (wlr_pointer_pinch_update_event*)data;
|
||||
PROTO::pointerGestures->pinchUpdate(EV->time_msec, {EV->dx, EV->dy}, EV->scale, EV->rotation);
|
||||
}
|
||||
|
||||
void Events::listener_pinchEnd(wl_listener* listener, void* data) {
|
||||
const auto EV = (wlr_pointer_pinch_end_event*)data;
|
||||
PROTO::pointerGestures->pinchEnd(EV->time_msec, EV->cancelled);
|
||||
}
|
||||
|
||||
void Events::listener_touchBegin(wl_listener* listener, void* data) {
|
||||
g_pInputManager->onTouchDown((wlr_touch_down_event*)data);
|
||||
}
|
||||
|
||||
void Events::listener_touchEnd(wl_listener* listener, void* data) {
|
||||
g_pInputManager->onTouchUp((wlr_touch_up_event*)data);
|
||||
}
|
||||
|
||||
void Events::listener_touchUpdate(wl_listener* listener, void* data) {
|
||||
g_pInputManager->onTouchMove((wlr_touch_motion_event*)data);
|
||||
}
|
||||
|
||||
void Events::listener_touchFrame(wl_listener* listener, void* data) {
|
||||
wlr_seat_touch_notify_frame(g_pCompositor->m_sSeat.seat);
|
||||
}
|
||||
|
||||
void Events::listener_holdBegin(wl_listener* listener, void* data) {
|
||||
const auto EV = (wlr_pointer_hold_begin_event*)data;
|
||||
PROTO::pointerGestures->holdBegin(EV->time_msec, EV->fingers);
|
||||
}
|
||||
|
||||
void Events::listener_holdEnd(wl_listener* listener, void* data) {
|
||||
const auto EV = (wlr_pointer_hold_end_event*)data;
|
||||
PROTO::pointerGestures->holdEnd(EV->time_msec, EV->cancelled);
|
||||
}
|
||||
|
|
@ -40,16 +40,6 @@ namespace Events {
|
|||
DYNLISTENFUNC(dissociateX11);
|
||||
DYNLISTENFUNC(ackConfigure);
|
||||
|
||||
// Window subsurfaces
|
||||
// LISTENER(newSubsurfaceWindow);
|
||||
|
||||
// Input events
|
||||
LISTENER(mouseMove);
|
||||
LISTENER(mouseMoveAbsolute);
|
||||
LISTENER(mouseButton);
|
||||
LISTENER(mouseAxis);
|
||||
LISTENER(mouseFrame);
|
||||
|
||||
LISTENER(newInput);
|
||||
|
||||
// Virt Ptr
|
||||
|
|
@ -89,23 +79,6 @@ namespace Events {
|
|||
// session
|
||||
LISTENER(sessionActive);
|
||||
|
||||
// Touchpad shit
|
||||
LISTENER(swipeBegin);
|
||||
LISTENER(swipeEnd);
|
||||
LISTENER(swipeUpdate);
|
||||
LISTENER(pinchBegin);
|
||||
LISTENER(pinchUpdate);
|
||||
LISTENER(pinchEnd);
|
||||
|
||||
// Touch
|
||||
LISTENER(touchBegin);
|
||||
LISTENER(touchEnd);
|
||||
LISTENER(touchUpdate);
|
||||
LISTENER(touchFrame);
|
||||
|
||||
LISTENER(holdBegin);
|
||||
LISTENER(holdEnd);
|
||||
|
||||
// Session Lock
|
||||
LISTENER(newSessionLock);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -16,8 +16,7 @@
|
|||
// //
|
||||
// --------------------------------------------------------- //
|
||||
|
||||
static void checkDefaultCursorWarp(SP<CMonitor>* PNEWMONITORWRAP, std::string monitorName) {
|
||||
const auto PNEWMONITOR = PNEWMONITORWRAP->get();
|
||||
static void checkDefaultCursorWarp(SP<CMonitor> PNEWMONITOR, std::string monitorName) {
|
||||
|
||||
static auto PCURSORMONITOR = CConfigValue<std::string>("general:default_cursor_monitor");
|
||||
static auto firstMonitorAdded = std::chrono::system_clock::now();
|
||||
|
|
@ -61,18 +60,18 @@ void Events::listener_newOutput(wl_listener* listener, void* data) {
|
|||
}
|
||||
|
||||
// add it to real
|
||||
SP<CMonitor>* PNEWMONITORWRAP = nullptr;
|
||||
|
||||
PNEWMONITORWRAP = &g_pCompositor->m_vRealMonitors.emplace_back(makeShared<CMonitor>());
|
||||
auto PNEWMONITOR = g_pCompositor->m_vRealMonitors.emplace_back(makeShared<CMonitor>());
|
||||
if (std::string("HEADLESS-1") == OUTPUT->name)
|
||||
g_pCompositor->m_pUnsafeOutput = PNEWMONITORWRAP->get();
|
||||
g_pCompositor->m_pUnsafeOutput = PNEWMONITOR.get();
|
||||
|
||||
(*PNEWMONITORWRAP)->output = OUTPUT;
|
||||
PNEWMONITOR->output = OUTPUT;
|
||||
PNEWMONITOR->self = PNEWMONITOR;
|
||||
const bool FALLBACK = g_pCompositor->m_pUnsafeOutput ? OUTPUT == g_pCompositor->m_pUnsafeOutput->output : false;
|
||||
(*PNEWMONITORWRAP)->ID = FALLBACK ? -1 : g_pCompositor->getNextAvailableMonitorID(OUTPUT->name);
|
||||
const auto PNEWMONITOR = PNEWMONITORWRAP->get();
|
||||
PNEWMONITOR->ID = FALLBACK ? -1 : g_pCompositor->getNextAvailableMonitorID(OUTPUT->name);
|
||||
PNEWMONITOR->isUnsafeFallback = FALLBACK;
|
||||
|
||||
EMIT_HOOK_EVENT("newMonitor", PNEWMONITOR);
|
||||
|
||||
if (!FALLBACK)
|
||||
PNEWMONITOR->onConnect(false);
|
||||
|
||||
|
|
@ -82,14 +81,14 @@ void Events::listener_newOutput(wl_listener* listener, void* data) {
|
|||
// ready to process if we have a real monitor
|
||||
|
||||
if ((!g_pHyprRenderer->m_pMostHzMonitor || PNEWMONITOR->refreshRate > g_pHyprRenderer->m_pMostHzMonitor->refreshRate) && PNEWMONITOR->m_bEnabled)
|
||||
g_pHyprRenderer->m_pMostHzMonitor = PNEWMONITOR;
|
||||
g_pHyprRenderer->m_pMostHzMonitor = PNEWMONITOR.get();
|
||||
|
||||
g_pCompositor->m_bReadyToProcess = true;
|
||||
|
||||
g_pConfigManager->m_bWantsMonitorReload = true;
|
||||
g_pCompositor->scheduleFrameForMonitor(PNEWMONITOR);
|
||||
g_pCompositor->scheduleFrameForMonitor(PNEWMONITOR.get());
|
||||
|
||||
checkDefaultCursorWarp(PNEWMONITORWRAP, OUTPUT->name);
|
||||
checkDefaultCursorWarp(PNEWMONITOR, OUTPUT->name);
|
||||
|
||||
for (auto& w : g_pCompositor->m_vWindows) {
|
||||
if (w->m_iMonitorID == PNEWMONITOR->ID) {
|
||||
|
|
|
|||
|
|
@ -54,10 +54,10 @@ void Events::listener_mapWindow(void* owner, void* data) {
|
|||
static auto PNEWTAKESOVERFS = CConfigValue<Hyprlang::INT>("misc:new_window_takes_over_fullscreen");
|
||||
static auto PINITIALWSTRACKING = CConfigValue<Hyprlang::INT>("misc:initial_workspace_tracking");
|
||||
|
||||
auto PMONITOR = g_pCompositor->m_pLastMonitor;
|
||||
auto PMONITOR = g_pCompositor->m_pLastMonitor.get();
|
||||
if (!g_pCompositor->m_pLastMonitor) {
|
||||
g_pCompositor->setActiveMonitor(g_pCompositor->getMonitorFromVector({}));
|
||||
PMONITOR = g_pCompositor->m_pLastMonitor;
|
||||
PMONITOR = g_pCompositor->m_pLastMonitor.get();
|
||||
}
|
||||
auto PWORKSPACE = PMONITOR->activeSpecialWorkspace ? PMONITOR->activeSpecialWorkspace : PMONITOR->activeWorkspace;
|
||||
PWINDOW->m_iMonitorID = PMONITOR->ID;
|
||||
|
|
@ -330,7 +330,7 @@ void Events::listener_mapWindow(void* owner, void* data) {
|
|||
else if (PMONITOR->activeWorkspaceID() != REQUESTEDWORKSPACEID)
|
||||
g_pKeybindManager->m_mDispatchers["workspace"](requestedWorkspaceName);
|
||||
|
||||
PMONITOR = g_pCompositor->m_pLastMonitor;
|
||||
PMONITOR = g_pCompositor->m_pLastMonitor.get();
|
||||
}
|
||||
} else
|
||||
workspaceSilent = false;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue