Added basic animations for windows

This commit is contained in:
vaxerski 2022-03-23 22:01:59 +01:00
parent 1923b0d170
commit bcf7ee6dc2
10 changed files with 116 additions and 16 deletions

View file

@ -57,8 +57,9 @@ void Events::listener_mouseAxis(wl_listener* listener, void* data) {
void Events::listener_requestMouse(wl_listener* listener, void* data) {
const auto EVENT = (wlr_seat_pointer_request_set_cursor_event*)data;
if (EVENT->seat_client == g_pCompositor->m_sSeat.seat->pointer_state.focused_client)
wlr_cursor_set_surface(g_pCompositor->m_sWLRCursor, EVENT->surface, EVENT->hotspot_x, EVENT->hotspot_y);
// TODO: crashes sometimes
//if (EVENT->seat_client == g_pCompositor->m_sSeat.seat->pointer_state.focused_client)
// wlr_cursor_set_surface(g_pCompositor->m_sWLRCursor, EVENT->surface, EVENT->hotspot_x, EVENT->hotspot_y);
}
void Events::listener_newInput(wl_listener* listener, void* data) {

View file

@ -98,6 +98,14 @@ void Events::listener_newOutput(wl_listener* listener, void* data) {
void Events::listener_monitorFrame(wl_listener* listener, void* data) {
SMonitor* const PMONITOR = wl_container_of(listener, PMONITOR, listen_monitorFrame);
// Hack: only check when monitor number 1 refreshes, saves a bit of resources.
// This is for stuff that should be run every frame
// TODO: do this on the most Hz monitor
if (PMONITOR->ID == 0) {
g_pCompositor->sanityCheckWorkspaces();
g_pAnimationManager->tick();
}
timespec now;
clock_gettime(CLOCK_MONOTONIC, &now);
const float bgcol[4] = {0.1f, 0.1f, 0.1f, 1.f};
@ -115,12 +123,6 @@ void Events::listener_monitorFrame(wl_listener* listener, void* data) {
wlr_renderer_end(g_pCompositor->m_sWLRRenderer);
wlr_output_commit(PMONITOR->output);
// Sanity check the workspaces.
// Hack: only check when monitor number 1 refreshes, saves a bit of resources.
if (PMONITOR->ID == 0) {
g_pCompositor->sanityCheckWorkspaces();
}
}
void Events::listener_monitorDestroy(wl_listener* listener, void* data) {