mirror of
https://github.com/hyprwm/Hyprland
synced 2024-12-22 13:29:49 +01:00
pointer focus works now
This commit is contained in:
parent
7590c4d27b
commit
d09d3dc0f3
3 changed files with 19 additions and 8 deletions
|
@ -186,12 +186,23 @@ void CCompositor::focusWindow(CWindow* pWindow) {
|
|||
if (m_sWLRSeat->keyboard_state.focused_surface == PWINDOWSURFACE)
|
||||
return; // Don't focus when already focused on this.
|
||||
|
||||
// Unfocus last window
|
||||
if (m_pLastFocus && windowValidMapped(m_pLastFocus))
|
||||
g_pXWaylandManager->activateSurface(g_pXWaylandManager->getWindowSurface(m_pLastFocus), false);
|
||||
if (m_sWLRSeat->keyboard_state.focused_surface){
|
||||
const auto XDGSURFACE = wlr_xdg_surface_from_wlr_surface(m_sWLRSeat->keyboard_state.focused_surface);
|
||||
if (XDGSURFACE)
|
||||
wlr_xdg_toplevel_set_activated(XDGSURFACE->toplevel, false);
|
||||
|
||||
const auto XWLSURFACE = wlr_xwayland_surface_from_wlr_surface(m_sWLRSeat->keyboard_state.focused_surface);
|
||||
if (XWLSURFACE)
|
||||
wlr_xwayland_surface_activate(XWLSURFACE, false);
|
||||
}
|
||||
|
||||
const auto KEYBOARD = wlr_seat_get_keyboard(m_sWLRSeat);
|
||||
wlr_seat_keyboard_notify_enter(m_sWLRSeat, PWINDOWSURFACE, KEYBOARD->keycodes, KEYBOARD->num_keycodes, &KEYBOARD->modifiers);
|
||||
|
||||
g_pXWaylandManager->activateSurface(PWINDOWSURFACE, true);
|
||||
if (m_pLastFocus && windowValidMapped(m_pLastFocus))
|
||||
g_pXWaylandManager->activateSurface(g_pXWaylandManager->getWindowSurface(m_pLastFocus), false);
|
||||
|
||||
m_pLastFocus = pWindow;
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ void CInputManager::onMouseMoved(wlr_event_pointer_motion* e) {
|
|||
void CInputManager::onMouseWarp(wlr_event_pointer_motion_absolute* e) {
|
||||
wlr_cursor_warp_absolute(g_pCompositor->m_sWLRCursor, e->device, e->x, e->y);
|
||||
|
||||
m_vMouseCoords = Vector2D(e->x, e->y);
|
||||
m_vMouseCoords = Vector2D(g_pCompositor->m_sWLRCursor->x, g_pCompositor->m_sWLRCursor->y);
|
||||
m_vWLRMouseCoords = m_vMouseCoords;
|
||||
|
||||
mouseMoveUnified(e->time_msec);
|
||||
|
@ -45,7 +45,7 @@ void CInputManager::mouseMoveUnified(uint32_t time) {
|
|||
|
||||
g_pCompositor->focusWindow(PWINDOW);
|
||||
|
||||
Vector2D surfaceLocal = m_vMouseCoords - PWINDOW->m_vPosition;
|
||||
Vector2D surfaceLocal = m_vWLRMouseCoords - PWINDOW->m_vPosition;
|
||||
|
||||
wlr_seat_pointer_notify_enter(g_pCompositor->m_sWLRSeat, g_pXWaylandManager->getWindowSurface(PWINDOW), surfaceLocal.x, surfaceLocal.y);
|
||||
wlr_seat_pointer_notify_motion(g_pCompositor->m_sWLRSeat, time, surfaceLocal.x, surfaceLocal.y);
|
||||
|
|
|
@ -76,9 +76,9 @@ void CHyprXWaylandManager::setWindowStyleTiled(CWindow* pWindow, uint32_t edgez)
|
|||
wlr_xdg_toplevel_set_tiled(pWindow->m_uSurface.xdg->toplevel, edgez);
|
||||
}
|
||||
|
||||
wlr_surface* CHyprXWaylandManager::surfaceAt(CWindow* pWindow, const Vector2D& client, Vector2D& server) {
|
||||
if (pWindow->m_bIsX11)
|
||||
return wlr_surface_surface_at(pWindow->m_uSurface.xwayland->surface, client.x, client.y, &server.x, &server.y);
|
||||
wlr_surface* CHyprXWaylandManager::surfaceAt(CWindow* pWindow, const Vector2D& client, Vector2D& surface) {
|
||||
if (pWindow->m_bIsX11)
|
||||
return wlr_surface_surface_at(pWindow->m_uSurface.xwayland->surface, client.x, client.y, &surface.x, &surface.y);
|
||||
|
||||
return wlr_xdg_surface_surface_at(pWindow->m_uSurface.xdg, client.x, client.y, &server.x, &server.y);
|
||||
return wlr_xdg_surface_surface_at(pWindow->m_uSurface.xdg, client.x, client.y, &surface.x, &surface.y);
|
||||
}
|
Loading…
Reference in a new issue