Fix support for window focus requests

Closes #7
This commit is contained in:
outfoxxed 2023-07-19 04:05:23 -07:00
parent 51d3991783
commit acf3c62aae
No known key found for this signature in database
GPG key ID: 4C88A185FB89301E
4 changed files with 11 additions and 3 deletions

6
flake.lock generated
View file

@ -8,11 +8,11 @@
"xdph": "xdph" "xdph": "xdph"
}, },
"locked": { "locked": {
"lastModified": 1689720698, "lastModified": 1689763185,
"narHash": "sha256-DjW5GZlzULXKdEVag13OEV3/hog1k/5ZjSIRIPOHrcQ=", "narHash": "sha256-YOkboQ2w9Zz+jEeQBtFKQGBSYMPPNpFUrN+XYaslH8Q=",
"owner": "hyprwm", "owner": "hyprwm",
"repo": "Hyprland", "repo": "Hyprland",
"rev": "81f4a4f47182c15ee9436d9ab7b2e425a096ce5b", "rev": "5cd5631fb226e315a233473c961714ed1c73840f",
"type": "github" "type": "github"
}, },
"original": { "original": {

View file

@ -605,6 +605,12 @@ void Hy3Layout::replaceWindowDataWith(CWindow* from, CWindow* to) {
this->applyNodeDataToWindow(node); this->applyNodeDataToWindow(node);
} }
void Hy3Layout::requestFocusForWindow(CWindow* window) {
auto node = this->getNodeFromWindow(window);
if (node == nullptr) return;
node->focusWindow();
}
void Hy3Layout::onEnable() { void Hy3Layout::onEnable() {
for (auto& window: g_pCompositor->m_vWindows) { for (auto& window: g_pCompositor->m_vWindows) {
if (window->isHidden() || !window->m_bIsMapped || window->m_bFadingOut || window->m_bIsFloating) if (window->isHidden() || !window->m_bIsMapped || window->m_bFadingOut || window->m_bIsFloating)

View file

@ -62,6 +62,7 @@ public:
virtual std::string getLayoutName(); virtual std::string getLayoutName();
virtual CWindow* getNextWindowCandidate(CWindow*); virtual CWindow* getNextWindowCandidate(CWindow*);
virtual void replaceWindowDataWith(CWindow* from, CWindow* to); virtual void replaceWindowDataWith(CWindow* from, CWindow* to);
virtual void requestFocusForWindow(CWindow*);
virtual void onEnable(); virtual void onEnable();
virtual void onDisable(); virtual void onDisable();

View file

@ -132,6 +132,7 @@ bool Hy3Node::focusWindow() {
switch (this->data.type) { switch (this->data.type) {
case Hy3NodeType::Window: case Hy3NodeType::Window:
this->markFocused(); this->markFocused();
this->data.as_window->setHidden(false);
g_pCompositor->focusWindow(this->data.as_window); g_pCompositor->focusWindow(this->data.as_window);
return true; return true;