aboutsummaryrefslogtreecommitdiff
path: root/src/WindowUtils.cpp
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2025-02-22 13:31:51 +0100
committerdec05eba <dec05eba@protonmail.com>2025-02-22 13:31:51 +0100
commit189736c1a96a1ad0e571ad69f01039e96455011a (patch)
tree22e1a78f698209e2ce0ef462a5d281b5b3030897 /src/WindowUtils.cpp
parent8003c209fea16cd164817306cb33d46ac61a44f0 (diff)
Add option to take a screenshot (default hotkey: alt+f1)
Diffstat (limited to 'src/WindowUtils.cpp')
-rw-r--r--src/WindowUtils.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/WindowUtils.cpp b/src/WindowUtils.cpp
index ec01e26..d588374 100644
--- a/src/WindowUtils.cpp
+++ b/src/WindowUtils.cpp
@@ -156,7 +156,7 @@ namespace gsr {
std::string result;
for(int i = 0; i < size;) {
// Some games such as the finals has utf8-bom between each character, wtf?
- if(i + 3 < size && memcmp(str + i, "\xEF\xBB\xBF", 3) == 0) {
+ if(i + 3 <= size && memcmp(str + i, "\xEF\xBB\xBF", 3) == 0) {
i += 3;
continue;
}
@@ -246,10 +246,14 @@ namespace gsr {
XClassHint class_hint = {nullptr, nullptr};
XGetClassHint(dpy, focused_window, &class_hint);
- if(class_hint.res_class) {
+ if(class_hint.res_class)
result = strip(class_hint.res_class);
- return result;
- }
+
+ if(class_hint.res_name)
+ XFree(class_hint.res_name);
+
+ if(class_hint.res_class)
+ XFree(class_hint.res_class);
return result;
}