mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-22 15:25:58 +01:00
Mostly fixes #5
This commit is contained in:
parent
dcb6fc269a
commit
ddcd4fb767
4 changed files with 43 additions and 10 deletions
|
@ -361,6 +361,14 @@ void CCompositor::focusWindow(CWindow* pWindow, wlr_surface* pSurface) {
|
|||
return;
|
||||
}
|
||||
|
||||
if (m_pLastWindow == pWindow)
|
||||
return;
|
||||
|
||||
if (windowValidMapped(m_pLastWindow) && m_pLastWindow->m_bIsX11) {
|
||||
wlr_seat_keyboard_notify_clear_focus(m_sSeat.seat);
|
||||
wlr_seat_pointer_clear_focus(m_sSeat.seat);
|
||||
}
|
||||
|
||||
const auto PWINDOWSURFACE = pSurface ? pSurface : g_pXWaylandManager->getWindowSurface(pWindow);
|
||||
|
||||
focusSurface(PWINDOWSURFACE, pWindow);
|
||||
|
|
|
@ -126,8 +126,7 @@ void Events::listener_mapWindow(void* owner, void* data) {
|
|||
|
||||
PWINDOW->m_szTitle = g_pXWaylandManager->getTitle(PWINDOW);
|
||||
|
||||
if (!PWINDOW->m_bIsModal)
|
||||
g_pCompositor->focusWindow(PWINDOW);
|
||||
g_pCompositor->focusWindow(PWINDOW);
|
||||
|
||||
PWINDOW->m_pSurfaceTree = SubsurfaceTree::createTreeRoot(g_pXWaylandManager->getWindowSurface(PWINDOW), addViewCoords, PWINDOW);
|
||||
|
||||
|
@ -195,7 +194,10 @@ void Events::listener_unmapWindow(void* owner, void* data) {
|
|||
}
|
||||
|
||||
void Events::listener_commitWindow(void* owner, void* data) {
|
||||
// CWindow* PWINDOW = (CWindow*)owner;
|
||||
CWindow* PWINDOW = (CWindow*)owner;
|
||||
|
||||
if (!g_pCompositor->windowValidMapped(PWINDOW))
|
||||
return;
|
||||
|
||||
// Debug::log(LOG, "Window %x committed", PWINDOW); // SPAM!
|
||||
}
|
||||
|
@ -259,10 +261,29 @@ void Events::listener_activateX11(void* owner, void* data) {
|
|||
void Events::listener_configureX11(void* owner, void* data) {
|
||||
CWindow* PWINDOW = (CWindow*)owner;
|
||||
|
||||
if (!g_pCompositor->windowValidMapped(PWINDOW))
|
||||
return;
|
||||
|
||||
const auto E = (wlr_xwayland_surface_configure_event*)data;
|
||||
|
||||
// TODO: ignore if tiled?
|
||||
if (!PWINDOW->m_bIsFloating) {
|
||||
g_pXWaylandManager->setWindowSize(PWINDOW, PWINDOW->m_vRealSize);
|
||||
g_pInputManager->refocus();
|
||||
return;
|
||||
}
|
||||
|
||||
wlr_xwayland_surface_configure(PWINDOW->m_uSurface.xwayland, E->x, E->y, E->width, E->height);
|
||||
wlr_xwayland_surface_restack(PWINDOW->m_uSurface.xwayland, NULL, XCB_STACK_MODE_ABOVE);
|
||||
PWINDOW->m_vEffectivePosition = Vector2D(E->x, E->y);
|
||||
PWINDOW->m_vEffectiveSize = Vector2D(E->width, E->height);
|
||||
PWINDOW->m_vRealPosition = PWINDOW->m_vEffectivePosition;
|
||||
PWINDOW->m_vRealSize = PWINDOW->m_vRealSize;
|
||||
PWINDOW->m_vPosition = PWINDOW->m_vPosition;
|
||||
PWINDOW->m_vSize = PWINDOW->m_vSize;
|
||||
|
||||
wlr_seat_pointer_clear_focus(g_pCompositor->m_sSeat.seat);
|
||||
|
||||
g_pInputManager->refocus();
|
||||
}
|
||||
|
||||
void Events::listener_surfaceXWayland(wl_listener* listener, void* data) {
|
||||
|
|
|
@ -101,14 +101,14 @@ void CInputManager::mouseMoveUnified(uint32_t time) {
|
|||
|
||||
Vector2D surfaceLocal = surfacePos == Vector2D(-1337, -1337) ? surfaceCoords : Vector2D(g_pCompositor->m_sWLRCursor->x, g_pCompositor->m_sWLRCursor->y) - surfacePos;
|
||||
|
||||
wlr_seat_pointer_notify_enter(g_pCompositor->m_sSeat.seat, foundSurface, surfaceLocal.x, surfaceLocal.y);
|
||||
wlr_seat_pointer_notify_motion(g_pCompositor->m_sSeat.seat, time, surfaceLocal.x, surfaceLocal.y);
|
||||
|
||||
if (pFoundWindow)
|
||||
g_pCompositor->focusWindow(pFoundWindow, foundSurface);
|
||||
else
|
||||
g_pCompositor->focusSurface(foundSurface);
|
||||
|
||||
wlr_seat_pointer_notify_enter(g_pCompositor->m_sSeat.seat, foundSurface, surfaceLocal.x, surfaceLocal.y);
|
||||
wlr_seat_pointer_notify_motion(g_pCompositor->m_sSeat.seat, time, surfaceLocal.x, surfaceLocal.y);
|
||||
|
||||
g_pLayoutManager->getCurrentLayout()->onMouseMove(getMouseCoordsInternal());
|
||||
}
|
||||
|
||||
|
|
|
@ -32,17 +32,21 @@ wlr_surface* CHyprXWaylandManager::getWindowSurface(CWindow* pWindow) {
|
|||
void CHyprXWaylandManager::activateSurface(wlr_surface* pSurface, bool activate) {
|
||||
if (wlr_surface_is_xdg_surface(pSurface))
|
||||
wlr_xdg_toplevel_set_activated(wlr_xdg_surface_from_wlr_surface(pSurface)->toplevel, activate);
|
||||
|
||||
else if (wlr_surface_is_xwayland_surface(pSurface))
|
||||
else if (wlr_surface_is_xwayland_surface(pSurface)) {
|
||||
wlr_xwayland_surface_activate(wlr_xwayland_surface_from_wlr_surface(pSurface), activate);
|
||||
wlr_xwayland_surface_restack(wlr_xwayland_surface_from_wlr_surface(pSurface), NULL, XCB_STACK_MODE_ABOVE);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void CHyprXWaylandManager::activateWindow(CWindow* pWindow, bool activate) {
|
||||
if (pWindow == g_pCompositor->m_pLastWindow)
|
||||
return;
|
||||
|
||||
if (pWindow->m_bIsX11)
|
||||
if (pWindow->m_bIsX11) {
|
||||
wlr_xwayland_surface_activate(pWindow->m_uSurface.xwayland, activate);
|
||||
wlr_xwayland_surface_restack(pWindow->m_uSurface.xwayland, NULL, XCB_STACK_MODE_ABOVE);
|
||||
}
|
||||
else
|
||||
wlr_xdg_toplevel_set_activated(pWindow->m_uSurface.xdg->toplevel, activate);
|
||||
|
||||
|
|
Loading…
Reference in a new issue