mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-22 20:25:59 +01:00
fix crash and log more
This commit is contained in:
parent
d09d3dc0f3
commit
03da5a3ef5
3 changed files with 9 additions and 12 deletions
|
@ -189,15 +189,6 @@ void CCompositor::focusWindow(CWindow* pWindow) {
|
||||||
// Unfocus last window
|
// Unfocus last window
|
||||||
if (m_pLastFocus && windowValidMapped(m_pLastFocus))
|
if (m_pLastFocus && windowValidMapped(m_pLastFocus))
|
||||||
g_pXWaylandManager->activateSurface(g_pXWaylandManager->getWindowSurface(m_pLastFocus), false);
|
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);
|
const auto KEYBOARD = wlr_seat_get_keyboard(m_sWLRSeat);
|
||||||
wlr_seat_keyboard_notify_enter(m_sWLRSeat, PWINDOWSURFACE, KEYBOARD->keycodes, KEYBOARD->num_keycodes, &KEYBOARD->modifiers);
|
wlr_seat_keyboard_notify_enter(m_sWLRSeat, PWINDOWSURFACE, KEYBOARD->keycodes, KEYBOARD->num_keycodes, &KEYBOARD->modifiers);
|
||||||
|
@ -206,7 +197,7 @@ void CCompositor::focusWindow(CWindow* pWindow) {
|
||||||
|
|
||||||
m_pLastFocus = pWindow;
|
m_pLastFocus = pWindow;
|
||||||
|
|
||||||
Debug::log(LOG, "Set focus to %x", pWindow);
|
Debug::log(LOG, "Set keyboard %x focus to %x, with name: %s", KEYBOARD, pWindow, pWindow->m_szTitle.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CCompositor::windowValidMapped(CWindow* pWindow) {
|
bool CCompositor::windowValidMapped(CWindow* pWindow) {
|
||||||
|
|
|
@ -222,7 +222,7 @@ void Events::listener_unmapWindow(wl_listener* listener, void* data) {
|
||||||
void Events::listener_commitWindow(wl_listener* listener, void* data) {
|
void Events::listener_commitWindow(wl_listener* listener, void* data) {
|
||||||
CWindow* PWINDOW = wl_container_of(listener, PWINDOW, listen_commitWindow);
|
CWindow* PWINDOW = wl_container_of(listener, PWINDOW, listen_commitWindow);
|
||||||
|
|
||||||
Debug::log(LOG, "Window %x committed", PWINDOW);
|
PWINDOW;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Events::listener_destroyWindow(wl_listener* listener, void* data) {
|
void Events::listener_destroyWindow(wl_listener* listener, void* data) {
|
||||||
|
|
|
@ -93,6 +93,8 @@ void CInputManager::newKeyboard(wlr_input_device* keyboard) {
|
||||||
wl_signal_add(&keyboard->events.destroy, &PNEWKEYBOARD->listen_keyboardDestroy);
|
wl_signal_add(&keyboard->events.destroy, &PNEWKEYBOARD->listen_keyboardDestroy);
|
||||||
|
|
||||||
wlr_seat_set_keyboard(g_pCompositor->m_sWLRSeat, keyboard);
|
wlr_seat_set_keyboard(g_pCompositor->m_sWLRSeat, keyboard);
|
||||||
|
|
||||||
|
Debug::log(LOG, "New keyboard created, pointers Hypr: %x and WLR: %x", PNEWKEYBOARD, keyboard);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CInputManager::newMouse(wlr_input_device* mouse) {
|
void CInputManager::newMouse(wlr_input_device* mouse) {
|
||||||
|
@ -107,6 +109,8 @@ void CInputManager::newMouse(wlr_input_device* mouse) {
|
||||||
}
|
}
|
||||||
|
|
||||||
wlr_cursor_attach_input_device(g_pCompositor->m_sWLRCursor, mouse);
|
wlr_cursor_attach_input_device(g_pCompositor->m_sWLRCursor, mouse);
|
||||||
|
|
||||||
|
Debug::log(LOG, "New mouse created, pointer WLR: %x", mouse);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CInputManager::destroyKeyboard(SKeyboard* pKeyboard) {
|
void CInputManager::destroyKeyboard(SKeyboard* pKeyboard) {
|
||||||
|
@ -133,7 +137,9 @@ void CInputManager::onKeyboardKey(wlr_event_keyboard_key* e, SKeyboard* pKeyboar
|
||||||
|
|
||||||
if (e->state == WL_KEYBOARD_KEY_STATE_PRESSED) {
|
if (e->state == WL_KEYBOARD_KEY_STATE_PRESSED) {
|
||||||
// TODO: keybinds
|
// TODO: keybinds
|
||||||
|
Debug::log(LOG, "Keyboard %x key %i pressed on focused window %x", pKeyboard, KEYCODE, g_pCompositor->m_pLastFocus);
|
||||||
|
} else if (e->state == WL_KEYBOARD_KEY_STATE_RELEASED) {
|
||||||
|
Debug::log(LOG, "Keyboard %x key %i released on focused window %x", pKeyboard, KEYCODE, g_pCompositor->m_pLastFocus);
|
||||||
}
|
}
|
||||||
|
|
||||||
wlr_seat_set_keyboard(g_pCompositor->m_sWLRSeat, pKeyboard->keyboard);
|
wlr_seat_set_keyboard(g_pCompositor->m_sWLRSeat, pKeyboard->keyboard);
|
||||||
|
|
Loading…
Reference in a new issue