mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-22 17:25:59 +01:00
input: pass mouse input to IME popups (#3922)
This commit is contained in:
parent
512a59731b
commit
929c44e361
3 changed files with 28 additions and 3 deletions
|
@ -1106,6 +1106,21 @@ wlr_surface* CCompositor::vectorToLayerSurface(const Vector2D& pos, std::vector<
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SIMEPopup* CCompositor::vectorToIMEPopup(const Vector2D& pos, std::list<SIMEPopup>& popups) {
|
||||||
|
for (auto& popup : popups) {
|
||||||
|
auto surface = popup.pSurface->surface;
|
||||||
|
CBox box{
|
||||||
|
popup.realX,
|
||||||
|
popup.realY,
|
||||||
|
surface->current.width,
|
||||||
|
surface->current.height,
|
||||||
|
};
|
||||||
|
if (box.containsPoint(pos))
|
||||||
|
return &popup;
|
||||||
|
}
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
CWindow* CCompositor::getWindowFromSurface(wlr_surface* pSurface) {
|
CWindow* CCompositor::getWindowFromSurface(wlr_surface* pSurface) {
|
||||||
for (auto& w : m_vWindows) {
|
for (auto& w : m_vWindows) {
|
||||||
if (!w->m_bIsMapped || w->m_bFadingOut || !w->m_bMappedX11)
|
if (!w->m_bIsMapped || w->m_bFadingOut || !w->m_bMappedX11)
|
||||||
|
|
|
@ -139,6 +139,7 @@ class CCompositor {
|
||||||
CWindow* vectorToWindowIdeal(const Vector2D&, CWindow* pIgnoreWindow = nullptr); // used only for finding a window to focus on, basically a "findFocusableWindow"
|
CWindow* vectorToWindowIdeal(const Vector2D&, CWindow* pIgnoreWindow = nullptr); // used only for finding a window to focus on, basically a "findFocusableWindow"
|
||||||
CWindow* vectorToWindowTiled(const Vector2D&);
|
CWindow* vectorToWindowTiled(const Vector2D&);
|
||||||
wlr_surface* vectorToLayerSurface(const Vector2D&, std::vector<std::unique_ptr<SLayerSurface>>*, Vector2D*, SLayerSurface**);
|
wlr_surface* vectorToLayerSurface(const Vector2D&, std::vector<std::unique_ptr<SLayerSurface>>*, Vector2D*, SLayerSurface**);
|
||||||
|
SIMEPopup* vectorToIMEPopup(const Vector2D& pos, std::list<SIMEPopup>& popups);
|
||||||
wlr_surface* vectorWindowToSurface(const Vector2D&, CWindow*, Vector2D& sl);
|
wlr_surface* vectorWindowToSurface(const Vector2D&, CWindow*, Vector2D& sl);
|
||||||
Vector2D vectorToSurfaceLocal(const Vector2D&, CWindow*, wlr_surface*);
|
Vector2D vectorToSurfaceLocal(const Vector2D&, CWindow*, wlr_surface*);
|
||||||
CWindow* windowFromCursor();
|
CWindow* windowFromCursor();
|
||||||
|
|
|
@ -233,10 +233,20 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus) {
|
||||||
surfacePos = PMONITOR->vecPosition;
|
surfacePos = PMONITOR->vecPosition;
|
||||||
}
|
}
|
||||||
|
|
||||||
// overlay is above fullscreen
|
// overlays are above fullscreen
|
||||||
if (!foundSurface)
|
if (!foundSurface)
|
||||||
foundSurface = g_pCompositor->vectorToLayerSurface(mouseCoords, &PMONITOR->m_aLayerSurfaceLayers[ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY], &surfaceCoords, &pFoundLayerSurface);
|
foundSurface = g_pCompositor->vectorToLayerSurface(mouseCoords, &PMONITOR->m_aLayerSurfaceLayers[ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY], &surfaceCoords, &pFoundLayerSurface);
|
||||||
|
|
||||||
|
// also IME popups
|
||||||
|
if (!foundSurface) {
|
||||||
|
auto popup = g_pCompositor->vectorToIMEPopup(mouseCoords, m_sIMERelay.m_lIMEPopups);
|
||||||
|
if (popup) {
|
||||||
|
foundSurface = popup->pSurface->surface;
|
||||||
|
surfacePos = Vector2D(popup->realX, popup->realY);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// also top layers
|
||||||
if (!foundSurface)
|
if (!foundSurface)
|
||||||
foundSurface = g_pCompositor->vectorToLayerSurface(mouseCoords, &PMONITOR->m_aLayerSurfaceLayers[ZWLR_LAYER_SHELL_V1_LAYER_TOP], &surfaceCoords, &pFoundLayerSurface);
|
foundSurface = g_pCompositor->vectorToLayerSurface(mouseCoords, &PMONITOR->m_aLayerSurfaceLayers[ZWLR_LAYER_SHELL_V1_LAYER_TOP], &surfaceCoords, &pFoundLayerSurface);
|
||||||
|
|
||||||
|
@ -471,7 +481,6 @@ void CInputManager::onMouseButton(wlr_pointer_button_event* e) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void CInputManager::processMouseRequest(wlr_seat_pointer_request_set_cursor_event* e) {
|
void CInputManager::processMouseRequest(wlr_seat_pointer_request_set_cursor_event* e) {
|
||||||
|
|
||||||
if (!e->surface)
|
if (!e->surface)
|
||||||
g_pHyprRenderer->m_bWindowRequestedCursorHide = true;
|
g_pHyprRenderer->m_bWindowRequestedCursorHide = true;
|
||||||
else
|
else
|
||||||
|
@ -1636,7 +1645,7 @@ void CInputManager::setCursorIconOnBorder(CWindow* w) {
|
||||||
CBox box = w->getWindowMainSurfaceBox();
|
CBox box = w->getWindowMainSurfaceBox();
|
||||||
eBorderIconDirection direction = BORDERICON_NONE;
|
eBorderIconDirection direction = BORDERICON_NONE;
|
||||||
CBox boxFullGrabInput = {box.x - *PEXTENDBORDERGRAB - BORDERSIZE, box.y - *PEXTENDBORDERGRAB - BORDERSIZE, box.width + 2 * (*PEXTENDBORDERGRAB + BORDERSIZE),
|
CBox boxFullGrabInput = {box.x - *PEXTENDBORDERGRAB - BORDERSIZE, box.y - *PEXTENDBORDERGRAB - BORDERSIZE, box.width + 2 * (*PEXTENDBORDERGRAB + BORDERSIZE),
|
||||||
box.height + 2 * (*PEXTENDBORDERGRAB + BORDERSIZE)};
|
box.height + 2 * (*PEXTENDBORDERGRAB + BORDERSIZE)};
|
||||||
|
|
||||||
if (w->hasPopupAt(mouseCoords))
|
if (w->hasPopupAt(mouseCoords))
|
||||||
direction = BORDERICON_NONE;
|
direction = BORDERICON_NONE;
|
||||||
|
|
Loading…
Reference in a new issue