mirror of
https://github.com/hyprwm/Hyprland
synced 2025-02-17 00:22:07 +01:00
Add bringWindowToTop function to IHyprLayout (#2747)
* Add bringWindowToTop function to IHyprLayout * Rename `bringWindowToTop` to `requestFocusForWindow` * Fix doc
This commit is contained in:
parent
b8a7b09092
commit
5cd5631fb2
3 changed files with 17 additions and 10 deletions
|
@ -234,16 +234,7 @@ void CWindow::createToplevelHandle() {
|
||||||
|
|
||||||
// handle events
|
// handle events
|
||||||
hyprListener_toplevelActivate.initCallback(
|
hyprListener_toplevelActivate.initCallback(
|
||||||
&m_phForeignToplevel->events.request_activate,
|
&m_phForeignToplevel->events.request_activate, [&](void* owner, void* data) { g_pLayoutManager->getCurrentLayout()->requestFocusForWindow(this); }, this, "Toplevel");
|
||||||
[&](void* owner, void* data) {
|
|
||||||
if (isHidden() && m_sGroupData.pNextWindow) {
|
|
||||||
// grouped, change the current to us
|
|
||||||
setGroupCurrent(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
g_pCompositor->focusWindow(this);
|
|
||||||
},
|
|
||||||
this, "Toplevel");
|
|
||||||
|
|
||||||
hyprListener_toplevelFullscreen.initCallback(
|
hyprListener_toplevelFullscreen.initCallback(
|
||||||
&m_phForeignToplevel->events.request_fullscreen,
|
&m_phForeignToplevel->events.request_fullscreen,
|
||||||
|
|
|
@ -519,4 +519,13 @@ CWindow* IHyprLayout::getNextWindowCandidate(CWindow* pWindow) {
|
||||||
return PWINDOWCANDIDATE;
|
return PWINDOWCANDIDATE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void IHyprLayout::requestFocusForWindow(CWindow* pWindow) {
|
||||||
|
if (pWindow->isHidden() && pWindow->m_sGroupData.pNextWindow) {
|
||||||
|
// grouped, change the current to this window
|
||||||
|
pWindow->setGroupCurrent(pWindow);
|
||||||
|
}
|
||||||
|
|
||||||
|
g_pCompositor->focusWindow(pWindow);
|
||||||
|
}
|
||||||
|
|
||||||
IHyprLayout::~IHyprLayout() {}
|
IHyprLayout::~IHyprLayout() {}
|
||||||
|
|
|
@ -148,6 +148,13 @@ interface IHyprLayout {
|
||||||
*/
|
*/
|
||||||
virtual void replaceWindowDataWith(CWindow* from, CWindow* to) = 0;
|
virtual void replaceWindowDataWith(CWindow* from, CWindow* to) = 0;
|
||||||
|
|
||||||
|
/*
|
||||||
|
Called via the foreign toplevel activation protocol.
|
||||||
|
Focuses a window, bringing it to the top of its group if applicable.
|
||||||
|
May be ignored.
|
||||||
|
*/
|
||||||
|
virtual void requestFocusForWindow(CWindow*);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Vector2D m_vBeginDragXY;
|
Vector2D m_vBeginDragXY;
|
||||||
Vector2D m_vLastDragXY;
|
Vector2D m_vLastDragXY;
|
||||||
|
|
Loading…
Add table
Reference in a new issue