fortrangoingonforty/fortty / 11fd979

Browse files

Fix Wayland compositor timeout on inactive workspaces

- Replace glfwPollEvents with glfwWaitEventsTimeout for proper Wayland
ping-pong handling when window is on inactive workspace
- Add desktop entry file for application launchers (wofi, rofi, etc.)
- Reduces CPU usage when terminal is idle
Authored by mfwolffe <wolffemf@dukes.jmu.edu>
SHA
11fd979f53fe8065a6da7b1e189267acb67ed8f6
Parents
daf3994
Tree
16a07cd

3 changed files

StatusFile+-
A fortty.desktop 9 0
M src/window/glfw_bindings.f90 8 0
M src/window/window.f90 5 1
fortty.desktopadded
@@ -0,0 +1,9 @@
1
+[Desktop Entry]
2
+Name=fortty
3
+Comment=GPU-accelerated terminal emulator written in Fortran
4
+Exec=fortty
5
+Icon=utilities-terminal
6
+Terminal=false
7
+Type=Application
8
+Categories=System;TerminalEmulator;
9
+Keywords=terminal;console;shell;
src/window/glfw_bindings.f90modified
@@ -235,6 +235,14 @@ module glfw_bindings
235235
     subroutine glfwPollEvents() bind(C, name="glfwPollEvents")
236236
     end subroutine glfwPollEvents
237237
 
238
+    ! void glfwWaitEventsTimeout(double timeout)
239
+    ! Waits for events with timeout in seconds - critical for Wayland compositor
240
+    ! responsiveness when window is on inactive workspace
241
+    subroutine glfwWaitEventsTimeout(timeout) bind(C, name="glfwWaitEventsTimeout")
242
+      import :: c_double
243
+      real(c_double), value :: timeout
244
+    end subroutine glfwWaitEventsTimeout
245
+
238246
     ! double glfwGetTime(void)
239247
     real(c_double) function glfwGetTime() bind(C, name="glfwGetTime")
240248
       import :: c_double
src/window/window.f90modified
@@ -196,7 +196,11 @@ contains
196196
   end subroutine window_swap_buffers
197197
 
198198
   subroutine window_poll_events()
199
-    call glfwPollEvents()
199
+    ! Use WaitEventsTimeout instead of PollEvents for Wayland compatibility
200
+    ! This allows the compositor to send ping-pong messages to verify the app
201
+    ! is responsive, even when on an inactive workspace. 10ms timeout provides
202
+    ! ~100Hz max update rate while allowing proper event processing.
203
+    call glfwWaitEventsTimeout(0.01d0)
200204
   end subroutine window_poll_events
201205
 
202206
   ! Get current framebuffer size