mirror of
https://github.com/hyprwm/Hyprland.git
synced 2024-11-23 21:14:24 +03:00
handle buttons
This commit is contained in:
parent
d086fa3faa
commit
00098aef4f
@ -64,6 +64,8 @@ CCompositor::CCompositor() {
|
|||||||
|
|
||||||
m_sWLRPresentation = wlr_presentation_create(m_sWLDisplay, m_sWLRBackend);
|
m_sWLRPresentation = wlr_presentation_create(m_sWLDisplay, m_sWLRBackend);
|
||||||
|
|
||||||
|
m_sWLRIdle = wlr_idle_create(m_sWLDisplay);
|
||||||
|
|
||||||
// TODO: XWayland
|
// TODO: XWayland
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -191,7 +191,7 @@ void Events::listener_mouseAxis(wl_listener* listener, void* data) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Events::listener_mouseButton(wl_listener* listener, void* data) {
|
void Events::listener_mouseButton(wl_listener* listener, void* data) {
|
||||||
|
g_pInputManager->onMouseButton((wlr_event_pointer_button*)data);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Events::listener_keyboardDestroy(wl_listener* listener, void* data) {
|
void Events::listener_keyboardDestroy(wl_listener* listener, void* data) {
|
||||||
|
@ -14,10 +14,36 @@ void CInputManager::onMouseMoved(wlr_event_pointer_motion* e) {
|
|||||||
|
|
||||||
wlr_cursor_move(g_pCompositor->m_sWLRCursor, e->device, delta.floor().x, delta.floor().y);
|
wlr_cursor_move(g_pCompositor->m_sWLRCursor, e->device, delta.floor().x, delta.floor().y);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (e->time_msec)
|
||||||
|
wlr_idle_notify_activity(g_pCompositor->m_sWLRIdle, g_pCompositor->m_sWLRSeat);
|
||||||
|
|
||||||
|
// todo: focus
|
||||||
|
// todo: pointer
|
||||||
}
|
}
|
||||||
|
|
||||||
void CInputManager::onMouseWarp(wlr_event_pointer_motion_absolute* e) {
|
void CInputManager::onMouseWarp(wlr_event_pointer_motion_absolute* e) {
|
||||||
wlr_cursor_warp_absolute(g_pCompositor->m_sWLRCursor, e->device, e->x, e->y);
|
wlr_cursor_warp_absolute(g_pCompositor->m_sWLRCursor, e->device, e->x, e->y);
|
||||||
|
|
||||||
|
if (e->time_msec)
|
||||||
|
wlr_idle_notify_activity(g_pCompositor->m_sWLRIdle, g_pCompositor->m_sWLRSeat);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CInputManager::onMouseButton(wlr_event_pointer_button* e) {
|
||||||
|
wlr_idle_notify_activity(g_pCompositor->m_sWLRIdle, g_pCompositor->m_sWLRSeat);
|
||||||
|
|
||||||
|
switch (e->state) {
|
||||||
|
case WLR_BUTTON_PRESSED:
|
||||||
|
// todo: keybinds
|
||||||
|
break;
|
||||||
|
case WLR_BUTTON_RELEASED:
|
||||||
|
// todo: keybinds
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
// notify app if we didnt handle it
|
||||||
|
wlr_seat_pointer_notify_button(g_pCompositor->m_sWLRSeat, e->time_msec, e->button, e->state);
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector2D CInputManager::getMouseCoordsInternal() {
|
Vector2D CInputManager::getMouseCoordsInternal() {
|
||||||
|
@ -9,6 +9,7 @@ public:
|
|||||||
|
|
||||||
void onMouseMoved(wlr_event_pointer_motion*);
|
void onMouseMoved(wlr_event_pointer_motion*);
|
||||||
void onMouseWarp(wlr_event_pointer_motion_absolute*);
|
void onMouseWarp(wlr_event_pointer_motion_absolute*);
|
||||||
|
void onMouseButton(wlr_event_pointer_button*);
|
||||||
void onKeyboardKey(wlr_event_keyboard_key*);
|
void onKeyboardKey(wlr_event_keyboard_key*);
|
||||||
void onKeyboardMod(void*);
|
void onKeyboardMod(void*);
|
||||||
|
|
||||||
|
@ -43,18 +43,17 @@ void CHyprRenderer::renderAllClientsForMonitor(const int& ID, timespec* time) {
|
|||||||
if (w.m_bIsX11)
|
if (w.m_bIsX11)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
const wlr_box geom = { w.m_vPosition.x, w.m_vPosition.y, w.m_vSize.x, w.m_vSize.y };
|
wlr_box geometry = { w.m_vPosition.x, w.m_vPosition.y, w.m_vSize.x, w.m_vSize.y };
|
||||||
|
|
||||||
if (!wlr_output_layout_intersects(g_pCompositor->m_sWLROutputLayout, PMONITOR->output, &geom))
|
if (!wlr_output_layout_intersects(g_pCompositor->m_sWLROutputLayout, PMONITOR->output, &geometry))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// render the bad boy
|
// render the bad boy
|
||||||
|
|
||||||
wlr_output_layout_output_coords(g_pCompositor->m_sWLROutputLayout, PMONITOR->output, &w.m_vPosition.x, &w.m_vPosition.y);
|
wlr_output_layout_output_coords(g_pCompositor->m_sWLROutputLayout, PMONITOR->output, &w.m_vPosition.x, &w.m_vPosition.y);
|
||||||
|
|
||||||
SRenderData renderdata = {PMONITOR->output, time, w.m_vSize.x, w.m_vSize.y};
|
SRenderData renderdata = {PMONITOR->output, time, w.m_vSize.x, w.m_vSize.y};
|
||||||
|
|
||||||
wlr_surface_for_each_surface(w.m_uSurface.xdg->surface, renderSurface, &renderdata);
|
wlr_surface_for_each_surface(g_pXWaylandManager->getWindowSurface(&w), renderSurface, &renderdata);
|
||||||
wlr_xdg_surface_for_each_popup_surface(w.m_uSurface.xdg, renderSurface, &renderdata);
|
wlr_xdg_surface_for_each_popup_surface(w.m_uSurface.xdg, renderSurface, &renderdata);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -68,9 +67,12 @@ void CHyprRenderer::renderAllClientsForMonitor(const int& ID, timespec* time) {
|
|||||||
if (!wlr_output_layout_intersects(g_pCompositor->m_sWLROutputLayout, PMONITOR->output, &geometry))
|
if (!wlr_output_layout_intersects(g_pCompositor->m_sWLROutputLayout, PMONITOR->output, &geometry))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
// render the bad boy
|
||||||
|
wlr_output_layout_output_coords(g_pCompositor->m_sWLROutputLayout, PMONITOR->output, &w.m_vPosition.x, &w.m_vPosition.y);
|
||||||
|
|
||||||
SRenderData renderdata = {PMONITOR->output, time, w.m_vSize.x, w.m_vSize.y};
|
SRenderData renderdata = {PMONITOR->output, time, w.m_vSize.x, w.m_vSize.y};
|
||||||
|
|
||||||
if (w.m_uSurface.xwayland->surface)
|
if (w.m_uSurface.xwayland->surface)
|
||||||
wlr_surface_for_each_surface(w.m_uSurface.xwayland->surface, renderSurface, &renderdata);
|
wlr_surface_for_each_surface(g_pXWaylandManager->getWindowSurface(&w), renderSurface, &renderdata);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user