feat: use signals to stop instead of xdg_toplevel.close (killactive)
All checks were successful
CI / build (push) Successful in 45s
All checks were successful
CI / build (push) Successful in 45s
This commit is contained in:
@@ -8,6 +8,14 @@
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
#include <signal.h>
|
||||||
|
|
||||||
|
static volatile bool running = true;
|
||||||
|
|
||||||
|
static void handle_signal(int sig) {
|
||||||
|
(void)sig;
|
||||||
|
running = false;
|
||||||
|
}
|
||||||
|
|
||||||
#define WIDTH 1920
|
#define WIDTH 1920
|
||||||
#define HEIGHT 1080
|
#define HEIGHT 1080
|
||||||
@@ -119,6 +127,9 @@ int main(void) {
|
|||||||
SetTargetFPS(60);
|
SetTargetFPS(60);
|
||||||
SetExitKey(KEY_NULL);
|
SetExitKey(KEY_NULL);
|
||||||
|
|
||||||
|
signal(SIGTERM, handle_signal);
|
||||||
|
signal(SIGINT, handle_signal);
|
||||||
|
|
||||||
// initialize hyprland socket path
|
// initialize hyprland socket path
|
||||||
hyprland_socket_path = get_hyprland_socket_path();
|
hyprland_socket_path = get_hyprland_socket_path();
|
||||||
|
|
||||||
@@ -153,7 +164,7 @@ int main(void) {
|
|||||||
int textureUnit = 1;
|
int textureUnit = 1;
|
||||||
SetShaderValue(shader, distanceFieldTexLoc, &textureUnit, SHADER_UNIFORM_INT);
|
SetShaderValue(shader, distanceFieldTexLoc, &textureUnit, SHADER_UNIFORM_INT);
|
||||||
|
|
||||||
while (!WindowShouldClose()) {
|
while (running) {
|
||||||
int screenWidth = GetScreenWidth();
|
int screenWidth = GetScreenWidth();
|
||||||
int screenHeight = GetScreenHeight();
|
int screenHeight = GetScreenHeight();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user