summaryrefslogtreecommitdiff
path: root/src/events/Windows.cpp
diff options
context:
space:
mode:
authorvaxerski <43317083+vaxerski@users.noreply.github.com>2023-04-15 19:15:59 +0100
committervaxerski <43317083+vaxerski@users.noreply.github.com>2023-04-15 19:15:59 +0100
commit8944db49be38d978b7592655c7c7bd98edc7c40a (patch)
treed501da423b5f39822d485f7f5cd26141b0070bdb /src/events/Windows.cpp
parent4c4fcc128beb8dd73411b3d20388772018ffac53 (diff)
swallow: fix invalid regexes with empty vals
Diffstat (limited to 'src/events/Windows.cpp')
-rw-r--r--src/events/Windows.cpp14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/events/Windows.cpp b/src/events/Windows.cpp
index 1c95a1e5..d4164dff 100644
--- a/src/events/Windows.cpp
+++ b/src/events/Windows.cpp
@@ -509,7 +509,7 @@ void Events::listener_mapWindow(void* owner, void* data) {
}
// verify swallowing
- if (*PSWALLOW) {
+ if (*PSWALLOW && *PSWALLOWREGEX != STRVAL_EMPTY) {
// don't swallow ourselves
std::regex rgx(*PSWALLOWREGEX);
if (!std::regex_match(g_pXWaylandManager->getAppIDClass(PWINDOW), rgx)) {
@@ -554,10 +554,16 @@ void Events::listener_mapWindow(void* owner, void* data) {
}
if (finalFound) {
- std::regex exc(*PSWALLOWEXREGEX);
+ bool valid = std::regex_match(g_pXWaylandManager->getAppIDClass(finalFound), rgx);
+
+ if (*PSWALLOWEXREGEX != STRVAL_EMPTY) {
+ std::regex exc(*PSWALLOWEXREGEX);
+
+ valid = valid && !std::regex_match(g_pXWaylandManager->getTitle(finalFound), exc);
+ }
+
// check if it's the window we want & not exempt from getting swallowed
- if (std::regex_match(g_pXWaylandManager->getAppIDClass(finalFound), rgx) &&
- !std::regex_match(g_pXWaylandManager->getTitle(finalFound), exc)) {
+ if (valid) {
// swallow
PWINDOW->m_pSwallowed = finalFound;