mirror of
https://github.com/hyprwm/Hyprland.git
synced 2025-08-04 22:22:00 -07:00
floating windows support
This commit is contained in:
@@ -204,6 +204,14 @@ CWindow* CCompositor::vectorToWindow(const Vector2D& pos) {
|
||||
|
||||
CWindow* CCompositor::vectorToWindowIdeal(const Vector2D& pos) {
|
||||
const auto PMONITOR = getMonitorFromCursor();
|
||||
// first loop over floating cuz they're above
|
||||
// TODO: make an actual Z-system
|
||||
for (auto& w : m_lWindows) {
|
||||
wlr_box box = {w.m_vRealPosition.x, w.m_vRealPosition.y, w.m_vRealSize.x, w.m_vRealSize.y};
|
||||
if (w.m_iMonitorID == PMONITOR->ID && wlr_box_contains_point(&box, m_sWLRCursor->x, m_sWLRCursor->y) && w.m_bIsFloating)
|
||||
return &w;
|
||||
}
|
||||
|
||||
for (auto& w : m_lWindows) {
|
||||
wlr_box box = {w.m_vPosition.x, w.m_vPosition.y, w.m_vSize.x, w.m_vSize.y};
|
||||
if (w.m_iMonitorID == PMONITOR->ID && wlr_box_contains_point(&box, pos.x, pos.y))
|
||||
@@ -215,6 +223,15 @@ CWindow* CCompositor::vectorToWindowIdeal(const Vector2D& pos) {
|
||||
|
||||
CWindow* CCompositor::windowFromCursor() {
|
||||
const auto PMONITOR = getMonitorFromCursor();
|
||||
|
||||
// first loop over floating cuz they're above
|
||||
// TODO: make an actual Z-system
|
||||
for (auto& w : m_lWindows) {
|
||||
wlr_box box = {w.m_vRealPosition.x, w.m_vRealPosition.y, w.m_vRealSize.x, w.m_vRealSize.y};
|
||||
if (w.m_iMonitorID == PMONITOR->ID && wlr_box_contains_point(&box, m_sWLRCursor->x, m_sWLRCursor->y) && w.m_bIsFloating)
|
||||
return &w;
|
||||
}
|
||||
|
||||
for (auto& w : m_lWindows) {
|
||||
wlr_box box = {w.m_vPosition.x, w.m_vPosition.y, w.m_vSize.x, w.m_vSize.y};
|
||||
if (w.m_iMonitorID == PMONITOR->ID && wlr_box_contains_point(&box, m_sWLRCursor->x, m_sWLRCursor->y))
|
||||
@@ -224,6 +241,17 @@ CWindow* CCompositor::windowFromCursor() {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
CWindow* CCompositor::windowFloatingFromCursor() {
|
||||
const auto PMONITOR = getMonitorFromCursor();
|
||||
for (auto& w : m_lWindows) {
|
||||
wlr_box box = {w.m_vRealPosition.x, w.m_vRealPosition.y, w.m_vRealSize.x, w.m_vRealSize.y};
|
||||
if (w.m_iMonitorID == PMONITOR->ID && wlr_box_contains_point(&box, m_sWLRCursor->x, m_sWLRCursor->y) && w.m_bIsFloating)
|
||||
return &w;
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
SMonitor* CCompositor::getMonitorFromOutput(wlr_output* out) {
|
||||
for (auto& m : m_lMonitors) {
|
||||
if (m.output == out) {
|
||||
|
Reference in New Issue
Block a user