Skip to content

Commit

Permalink
foreign-toplevel: bypass no activate focus checks
Browse files Browse the repository at this point in the history
ref #5939

those are used by focus switchers so they should bypass stuff like focus_on_activate = false
  • Loading branch information
vaxerski committed May 8, 2024
1 parent 57a1247 commit 5e7925e
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/desktop/Window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1274,15 +1274,15 @@ std::unordered_map<std::string, std::string> CWindow::getEnv() {
return results;
}

void CWindow::activate() {
void CWindow::activate(bool force) {
static auto PFOCUSONACTIVATE = CConfigValue<Hyprlang::INT>("misc:focus_on_activate");

g_pEventManager->postEvent(SHyprIPCEvent{"urgent", std::format("{:x}", (uintptr_t)this)});
EMIT_HOOK_EVENT("urgent", m_pSelf.lock());

m_bIsUrgent = true;

if (!*PFOCUSONACTIVATE || (m_eSuppressedEvents & SUPPRESS_ACTIVATE_FOCUSONLY) || (m_eSuppressedEvents & SUPPRESS_ACTIVATE))
if (!force && (!*PFOCUSONACTIVATE || (m_eSuppressedEvents & SUPPRESS_ACTIVATE_FOCUSONLY) || (m_eSuppressedEvents & SUPPRESS_ACTIVATE)))
return;

if (m_bIsFloating)
Expand Down
2 changes: 1 addition & 1 deletion src/desktop/Window.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,7 @@ class CWindow {
bool visibleOnMonitor(CMonitor* pMonitor);
int workspaceID();
bool onSpecialWorkspace();
void activate();
void activate(bool force = false);

int getRealBorderSize();
void updateSpecialRenderData();
Expand Down
7 changes: 3 additions & 4 deletions src/protocols/ForeignToplevelWlr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,9 @@ CForeignToplevelHandleWlr::CForeignToplevelHandleWlr(SP<CZwlrForeignToplevelHand
if (!PWINDOW)
return;

if (PWINDOW->m_eSuppressedEvents & SUPPRESS_ACTIVATE)
return;

PWINDOW->activate();
// these requests bypass the config'd stuff cuz it's usually like
// window switchers and shit
PWINDOW->activate(true);
});

resource->setSetFullscreen([this](CZwlrForeignToplevelHandleV1* p, wl_resource* output) {
Expand Down

0 comments on commit 5e7925e

Please sign in to comment.