aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2024-11-24 20:25:31 +0100
committerdec05eba <dec05eba@protonmail.com>2024-11-24 20:25:31 +0100
commitb57bc8505d2c62d79ca1c980f902bde1cc4b3f99 (patch)
tree5b4a3977fe10098bb54ffbc257dd6d8a381b34fc
parent9b363d3c0d197e129e67f04e5702d4e07729bbe8 (diff)
Poll all text from linux global hotkeys instead of once per update
-rw-r--r--src/GlobalHotkeysLinux.cpp32
1 files changed, 17 insertions, 15 deletions
diff --git a/src/GlobalHotkeysLinux.cpp b/src/GlobalHotkeysLinux.cpp
index 7b1a412..08803d7 100644
--- a/src/GlobalHotkeysLinux.cpp
+++ b/src/GlobalHotkeysLinux.cpp
@@ -89,20 +89,22 @@ namespace gsr {
}
char buffer[256];
- char *line = fgets(buffer, sizeof(buffer), read_file);
- if(!line)
- return;
-
- const int line_len = strlen(line);
- if(line_len == 0)
- return;
-
- if(line[line_len - 1] == '\n')
- line[line_len - 1] = '\0';
-
- const std::string action = line;
- auto it = bound_actions_by_id.find(action);
- if(it != bound_actions_by_id.end())
- it->second(action);
+ while(true) {
+ char *line = fgets(buffer, sizeof(buffer), read_file);
+ if(!line)
+ break;
+
+ const int line_len = strlen(line);
+ if(line_len == 0)
+ continue;
+
+ if(line[line_len - 1] == '\n')
+ line[line_len - 1] = '\0';
+
+ const std::string action = line;
+ auto it = bound_actions_by_id.find(action);
+ if(it != bound_actions_by_id.end())
+ it->second(action);
+ }
}
}