mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-02 16:45:59 +01:00
multimon fixes
This commit is contained in:
parent
f9a4e9aecd
commit
cf76b90606
12 changed files with 114 additions and 41 deletions
|
@ -7,6 +7,7 @@ monitor=,1280x720,0x0,0.5,1
|
||||||
|
|
||||||
general {
|
general {
|
||||||
max_fps=240
|
max_fps=240
|
||||||
|
sensitivity=0.25
|
||||||
gaps_in=5
|
gaps_in=5
|
||||||
gaps_out=20
|
gaps_out=20
|
||||||
border_size=1
|
border_size=1
|
||||||
|
|
|
@ -159,11 +159,11 @@ SMonitor* CCompositor::getMonitorFromID(const int& id) {
|
||||||
}
|
}
|
||||||
|
|
||||||
SMonitor* CCompositor::getMonitorFromCursor() {
|
SMonitor* CCompositor::getMonitorFromCursor() {
|
||||||
const auto COORDS = g_pInputManager->getMouseCoordsInternal();
|
const auto COORDS = Vector2D(m_sWLRCursor->x, m_sWLRCursor->y);
|
||||||
const auto OUTPUT = wlr_output_layout_output_at(m_sWLROutputLayout, COORDS.x, COORDS.y);
|
const auto OUTPUT = wlr_output_layout_output_at(m_sWLROutputLayout, COORDS.x, COORDS.y);
|
||||||
|
|
||||||
if (!OUTPUT) {
|
if (!OUTPUT) {
|
||||||
Debug::log(WARN, "getMonitorFromCursor: cursour outside monitors??");
|
Debug::log(WARN, "getMonitorFromCursor: cursor outside monitors??");
|
||||||
return &m_lMonitors.front();
|
return &m_lMonitors.front();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -172,6 +172,8 @@ SMonitor* CCompositor::getMonitorFromCursor() {
|
||||||
return &m;
|
return &m;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Debug::log(LOG, "Monitor not in list??");
|
||||||
|
|
||||||
return &m_lMonitors.front();
|
return &m_lMonitors.front();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -190,9 +192,10 @@ bool CCompositor::windowExists(CWindow* pWindow) {
|
||||||
}
|
}
|
||||||
|
|
||||||
CWindow* CCompositor::vectorToWindow(const Vector2D& pos) {
|
CWindow* CCompositor::vectorToWindow(const Vector2D& pos) {
|
||||||
|
const auto PMONITOR = getMonitorFromCursor();
|
||||||
for (auto& w : m_lWindows) {
|
for (auto& w : m_lWindows) {
|
||||||
wlr_box box = {w.m_vRealPosition.x, w.m_vRealPosition.y, w.m_vRealSize.x, w.m_vRealSize.y};
|
wlr_box box = {w.m_vRealPosition.x, w.m_vRealPosition.y, w.m_vRealSize.x, w.m_vRealSize.y};
|
||||||
if (wlr_box_contains_point(&box, pos.x, pos.y))
|
if (w.m_iMonitorID == PMONITOR->ID && wlr_box_contains_point(&box, pos.x, pos.y))
|
||||||
return &w;
|
return &w;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -200,9 +203,21 @@ CWindow* CCompositor::vectorToWindow(const Vector2D& pos) {
|
||||||
}
|
}
|
||||||
|
|
||||||
CWindow* CCompositor::vectorToWindowIdeal(const Vector2D& pos) {
|
CWindow* CCompositor::vectorToWindowIdeal(const Vector2D& pos) {
|
||||||
|
const auto PMONITOR = getMonitorFromCursor();
|
||||||
for (auto& w : m_lWindows) {
|
for (auto& w : m_lWindows) {
|
||||||
wlr_box box = {w.m_vPosition.x, w.m_vPosition.y, w.m_vSize.x, w.m_vSize.y};
|
wlr_box box = {w.m_vPosition.x, w.m_vPosition.y, w.m_vSize.x, w.m_vSize.y};
|
||||||
if (wlr_box_contains_point(&box, pos.x, pos.y))
|
if (w.m_iMonitorID == PMONITOR->ID && wlr_box_contains_point(&box, pos.x, pos.y))
|
||||||
|
return &w;
|
||||||
|
}
|
||||||
|
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
CWindow* CCompositor::windowFromCursor() {
|
||||||
|
const auto PMONITOR = getMonitorFromCursor();
|
||||||
|
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))
|
||||||
return &w;
|
return &w;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -52,6 +52,7 @@ public:
|
||||||
void startCompositor();
|
void startCompositor();
|
||||||
|
|
||||||
CWindow* m_pLastFocus = nullptr;
|
CWindow* m_pLastFocus = nullptr;
|
||||||
|
SMonitor* m_pLastMonitor = nullptr;
|
||||||
|
|
||||||
|
|
||||||
// ------------------------------------------------- //
|
// ------------------------------------------------- //
|
||||||
|
@ -64,6 +65,7 @@ public:
|
||||||
bool windowValidMapped(CWindow*);
|
bool windowValidMapped(CWindow*);
|
||||||
CWindow* vectorToWindow(const Vector2D&);
|
CWindow* vectorToWindow(const Vector2D&);
|
||||||
CWindow* vectorToWindowIdeal(const Vector2D&);
|
CWindow* vectorToWindowIdeal(const Vector2D&);
|
||||||
|
CWindow* windowFromCursor();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void initAllSignals();
|
void initAllSignals();
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
|
|
||||||
CConfigManager::CConfigManager() {
|
CConfigManager::CConfigManager() {
|
||||||
configValues["general:max_fps"].intValue = 240;
|
configValues["general:max_fps"].intValue = 240;
|
||||||
|
configValues["general:sensitivity"].floatValue = 0.25f;
|
||||||
|
|
||||||
configValues["general:border_size"].intValue = 1;
|
configValues["general:border_size"].intValue = 1;
|
||||||
configValues["general:gaps_in"].intValue = 5;
|
configValues["general:gaps_in"].intValue = 5;
|
||||||
|
|
|
@ -210,7 +210,7 @@ void Events::listener_mapWindow(wl_listener* listener, void* data) {
|
||||||
|
|
||||||
g_pCompositor->focusWindow(PWINDOW);
|
g_pCompositor->focusWindow(PWINDOW);
|
||||||
|
|
||||||
Debug::log(LOG, "Map request dispatched.");
|
Debug::log(LOG, "Map request dispatched, monitor %s, xywh: %f %f %f %f", PMONITOR->szName.c_str(), PWINDOW->m_vRealPosition.x, PWINDOW->m_vRealPosition.y, PWINDOW->m_vRealSize.x, PWINDOW->m_vRealSize.y);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Events::listener_unmapWindow(wl_listener* listener, void* data) {
|
void Events::listener_unmapWindow(wl_listener* listener, void* data) {
|
||||||
|
|
|
@ -1,6 +1,36 @@
|
||||||
#include "DwindleLayout.hpp"
|
#include "DwindleLayout.hpp"
|
||||||
#include "../Compositor.hpp"
|
#include "../Compositor.hpp"
|
||||||
|
|
||||||
|
void SDwindleNodeData::recalcSizePosRecursive() {
|
||||||
|
if (children[0]) {
|
||||||
|
|
||||||
|
if (size.x > size.y) {
|
||||||
|
// split sidey
|
||||||
|
children[0]->position = position;
|
||||||
|
children[0]->size = Vector2D(size.x / 2.f, size.y);
|
||||||
|
children[1]->position = Vector2D(position.x + size.x / 2.f, position.y);
|
||||||
|
children[1]->size = Vector2D(size.x / 2.f, size.y);
|
||||||
|
} else {
|
||||||
|
// split toppy bottomy
|
||||||
|
children[0]->position = position;
|
||||||
|
children[0]->size = Vector2D(size.x, size.y / 2.f);
|
||||||
|
children[1]->position = Vector2D(position.x, position.y + size.y / 2.f);
|
||||||
|
children[1]->size = Vector2D(size.x, size.y / 2.f);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (children[0]->isNode)
|
||||||
|
children[0]->recalcSizePosRecursive();
|
||||||
|
else
|
||||||
|
layout->applyNodeDataToWindow(children[0]);
|
||||||
|
if (children[1]->isNode)
|
||||||
|
children[1]->recalcSizePosRecursive();
|
||||||
|
else
|
||||||
|
layout->applyNodeDataToWindow(children[1]);
|
||||||
|
} else {
|
||||||
|
layout->applyNodeDataToWindow(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int CHyprDwindleLayout::getNodesOnMonitor(const int& id) {
|
int CHyprDwindleLayout::getNodesOnMonitor(const int& id) {
|
||||||
int no = 0;
|
int no = 0;
|
||||||
for (auto& n : m_lDwindleNodesData) {
|
for (auto& n : m_lDwindleNodesData) {
|
||||||
|
@ -20,13 +50,21 @@ SDwindleNodeData* CHyprDwindleLayout::getFirstNodeOnMonitor(const int& id) {
|
||||||
|
|
||||||
SDwindleNodeData* CHyprDwindleLayout::getNodeFromWindow(CWindow* pWindow) {
|
SDwindleNodeData* CHyprDwindleLayout::getNodeFromWindow(CWindow* pWindow) {
|
||||||
for (auto& n : m_lDwindleNodesData) {
|
for (auto& n : m_lDwindleNodesData) {
|
||||||
if (n.pWindow == pWindow)
|
if (n.pWindow == pWindow && !n.isNode)
|
||||||
return &n;
|
return &n;
|
||||||
}
|
}
|
||||||
|
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SDwindleNodeData* CHyprDwindleLayout::getMasterNodeOnMonitor(const int& id) {
|
||||||
|
for (auto& n : m_lDwindleNodesData) {
|
||||||
|
if (!n.pParent && n.monitorID == id)
|
||||||
|
return &n;
|
||||||
|
}
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
void CHyprDwindleLayout::applyNodeDataToWindow(SDwindleNodeData* pNode) {
|
void CHyprDwindleLayout::applyNodeDataToWindow(SDwindleNodeData* pNode) {
|
||||||
const auto PMONITOR = g_pCompositor->getMonitorFromID(pNode->monitorID);
|
const auto PMONITOR = g_pCompositor->getMonitorFromID(pNode->monitorID);
|
||||||
|
|
||||||
|
@ -90,6 +128,7 @@ void CHyprDwindleLayout::onWindowCreated(CWindow* pWindow) {
|
||||||
PNODE->monitorID = pWindow->m_iMonitorID;
|
PNODE->monitorID = pWindow->m_iMonitorID;
|
||||||
PNODE->pWindow = pWindow;
|
PNODE->pWindow = pWindow;
|
||||||
PNODE->isNode = false;
|
PNODE->isNode = false;
|
||||||
|
PNODE->layout = this;
|
||||||
|
|
||||||
const auto PMONITOR = g_pCompositor->getMonitorFromID(PNODE->monitorID);
|
const auto PMONITOR = g_pCompositor->getMonitorFromID(PNODE->monitorID);
|
||||||
|
|
||||||
|
@ -132,14 +171,15 @@ void CHyprDwindleLayout::onWindowCreated(CWindow* pWindow) {
|
||||||
NEWPARENT->position = OPENINGON->position;
|
NEWPARENT->position = OPENINGON->position;
|
||||||
NEWPARENT->size = OPENINGON->size;
|
NEWPARENT->size = OPENINGON->size;
|
||||||
NEWPARENT->monitorID = OPENINGON->monitorID;
|
NEWPARENT->monitorID = OPENINGON->monitorID;
|
||||||
|
NEWPARENT->pParent = OPENINGON->pParent;
|
||||||
NEWPARENT->isNode = true; // it is a node
|
NEWPARENT->isNode = true; // it is a node
|
||||||
|
|
||||||
// and update the previous parent if it exists
|
// and update the previous parent if it exists
|
||||||
if (OPENINGON->pParent) {
|
if (OPENINGON->pParent) {
|
||||||
if (OPENINGON->pParent->children[0] == OPENINGON) {
|
if (OPENINGON->pParent->children[0] == OPENINGON) {
|
||||||
OPENINGON->pParent->children[0] == NEWPARENT;
|
OPENINGON->pParent->children[0] = NEWPARENT;
|
||||||
} else {
|
} else {
|
||||||
OPENINGON->pParent->children[1] == NEWPARENT;
|
OPENINGON->pParent->children[1] = NEWPARENT;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -161,8 +201,7 @@ void CHyprDwindleLayout::onWindowCreated(CWindow* pWindow) {
|
||||||
OPENINGON->pParent = NEWPARENT;
|
OPENINGON->pParent = NEWPARENT;
|
||||||
PNODE->pParent = NEWPARENT;
|
PNODE->pParent = NEWPARENT;
|
||||||
|
|
||||||
applyNodeDataToWindow(PNODE);
|
NEWPARENT->recalcSizePosRecursive();
|
||||||
applyNodeDataToWindow(OPENINGON);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CHyprDwindleLayout::onWindowRemoved(CWindow* pWindow) {
|
void CHyprDwindleLayout::onWindowRemoved(CWindow* pWindow) {
|
||||||
|
@ -174,9 +213,14 @@ void CHyprDwindleLayout::onWindowRemoved(CWindow* pWindow) {
|
||||||
if (!PNODE)
|
if (!PNODE)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (PNODE->isNode) {
|
||||||
|
Debug::log(LOG, "WHAT THE FUCKKKKKKKK");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const auto PPARENT = PNODE->pParent;
|
const auto PPARENT = PNODE->pParent;
|
||||||
|
|
||||||
if (!PPARENT){
|
if (!PPARENT) {
|
||||||
m_lDwindleNodesData.remove(*PNODE);
|
m_lDwindleNodesData.remove(*PNODE);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -195,8 +239,11 @@ void CHyprDwindleLayout::onWindowRemoved(CWindow* pWindow) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (PSIBLING->pParent)
|
||||||
|
PSIBLING->pParent->recalcSizePosRecursive();
|
||||||
|
else
|
||||||
|
PSIBLING->recalcSizePosRecursive();
|
||||||
|
|
||||||
m_lDwindleNodesData.remove(*PPARENT);
|
m_lDwindleNodesData.remove(*PPARENT);
|
||||||
m_lDwindleNodesData.remove(*PNODE);
|
m_lDwindleNodesData.remove(*PNODE);
|
||||||
|
|
||||||
applyNodeDataToWindow(PSIBLING);
|
|
||||||
}
|
}
|
|
@ -3,6 +3,8 @@
|
||||||
#include "IHyprLayout.hpp"
|
#include "IHyprLayout.hpp"
|
||||||
#include <list>
|
#include <list>
|
||||||
|
|
||||||
|
class CHyprDwindleLayout;
|
||||||
|
|
||||||
struct SDwindleNodeData {
|
struct SDwindleNodeData {
|
||||||
SDwindleNodeData* pParent = nullptr;
|
SDwindleNodeData* pParent = nullptr;
|
||||||
bool isNode = false;
|
bool isNode = false;
|
||||||
|
@ -18,10 +20,11 @@ struct SDwindleNodeData {
|
||||||
|
|
||||||
// For list lookup
|
// For list lookup
|
||||||
bool operator==(const SDwindleNodeData& rhs) {
|
bool operator==(const SDwindleNodeData& rhs) {
|
||||||
return pWindow == rhs.pWindow && monitorID == rhs.monitorID && position == rhs.position && size == rhs.size && pParent == rhs.pParent;
|
return pWindow == rhs.pWindow && monitorID == rhs.monitorID && position == rhs.position && size == rhs.size && pParent == rhs.pParent && children[0] == rhs.children[0] && children[1] == rhs.children[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: recalcsizepos for dynamic
|
void recalcSizePosRecursive();
|
||||||
|
CHyprDwindleLayout* layout = nullptr;
|
||||||
};
|
};
|
||||||
|
|
||||||
class CHyprDwindleLayout : public IHyprLayout {
|
class CHyprDwindleLayout : public IHyprLayout {
|
||||||
|
@ -37,4 +40,7 @@ private:
|
||||||
void applyNodeDataToWindow(SDwindleNodeData*);
|
void applyNodeDataToWindow(SDwindleNodeData*);
|
||||||
SDwindleNodeData* getNodeFromWindow(CWindow*);
|
SDwindleNodeData* getNodeFromWindow(CWindow*);
|
||||||
SDwindleNodeData* getFirstNodeOnMonitor(const int&);
|
SDwindleNodeData* getFirstNodeOnMonitor(const int&);
|
||||||
|
SDwindleNodeData* getMasterNodeOnMonitor(const int&);
|
||||||
|
|
||||||
|
friend struct SDwindleNodeData;
|
||||||
};
|
};
|
|
@ -4,6 +4,10 @@
|
||||||
#include "config/ConfigManager.hpp"
|
#include "config/ConfigManager.hpp"
|
||||||
|
|
||||||
int main(int argc, char** argv) {
|
int main(int argc, char** argv) {
|
||||||
|
const std::string DEBUGPATH = "/tmp/hypr/hyprland.log";
|
||||||
|
const std::string DEBUGPATH2 = "/tmp/hypr/hyprlandd.log";
|
||||||
|
unlink(DEBUGPATH2.c_str());
|
||||||
|
unlink(DEBUGPATH.c_str());
|
||||||
|
|
||||||
if (!getenv("XDG_RUNTIME_DIR"))
|
if (!getenv("XDG_RUNTIME_DIR"))
|
||||||
RIP("XDG_RUNTIME_DIR not set!");
|
RIP("XDG_RUNTIME_DIR not set!");
|
||||||
|
|
|
@ -4,16 +4,9 @@
|
||||||
void CInputManager::onMouseMoved(wlr_event_pointer_motion* e) {
|
void CInputManager::onMouseMoved(wlr_event_pointer_motion* e) {
|
||||||
// TODO: sensitivity
|
// TODO: sensitivity
|
||||||
|
|
||||||
float sensitivity = 0.25f;
|
float sensitivity = g_pConfigManager->getFloat("general:sensitivity");
|
||||||
|
|
||||||
m_vMouseCoords = m_vMouseCoords + Vector2D(e->delta_x * sensitivity, e->delta_y * sensitivity);
|
wlr_cursor_move(g_pCompositor->m_sWLRCursor, e->device, e->delta_x * sensitivity, e->delta_y * sensitivity);
|
||||||
|
|
||||||
if (m_vMouseCoords.floor() != m_vWLRMouseCoords) {
|
|
||||||
Vector2D delta = m_vMouseCoords - m_vWLRMouseCoords;
|
|
||||||
m_vWLRMouseCoords = m_vMouseCoords.floor();
|
|
||||||
|
|
||||||
wlr_cursor_move(g_pCompositor->m_sWLRCursor, e->device, delta.floor().x, delta.floor().y);
|
|
||||||
}
|
|
||||||
|
|
||||||
mouseMoveUnified(e->time_msec);
|
mouseMoveUnified(e->time_msec);
|
||||||
// todo: pointer
|
// todo: pointer
|
||||||
|
@ -22,15 +15,12 @@ void CInputManager::onMouseMoved(wlr_event_pointer_motion* e) {
|
||||||
void CInputManager::onMouseWarp(wlr_event_pointer_motion_absolute* e) {
|
void CInputManager::onMouseWarp(wlr_event_pointer_motion_absolute* e) {
|
||||||
wlr_cursor_warp_absolute(g_pCompositor->m_sWLRCursor, e->device, e->x, e->y);
|
wlr_cursor_warp_absolute(g_pCompositor->m_sWLRCursor, e->device, e->x, e->y);
|
||||||
|
|
||||||
m_vMouseCoords = Vector2D(g_pCompositor->m_sWLRCursor->x, g_pCompositor->m_sWLRCursor->y);
|
|
||||||
m_vWLRMouseCoords = m_vMouseCoords;
|
|
||||||
|
|
||||||
mouseMoveUnified(e->time_msec);
|
mouseMoveUnified(e->time_msec);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CInputManager::mouseMoveUnified(uint32_t time) {
|
void CInputManager::mouseMoveUnified(uint32_t time) {
|
||||||
|
|
||||||
const auto PWINDOW = g_pCompositor->vectorToWindow(m_vMouseCoords);
|
const auto PWINDOW = g_pCompositor->windowFromCursor();
|
||||||
|
|
||||||
if (!PWINDOW) {
|
if (!PWINDOW) {
|
||||||
wlr_xcursor_manager_set_cursor_image(g_pCompositor->m_sWLRXCursorMgr, "left_ptr", g_pCompositor->m_sWLRCursor);
|
wlr_xcursor_manager_set_cursor_image(g_pCompositor->m_sWLRXCursorMgr, "left_ptr", g_pCompositor->m_sWLRCursor);
|
||||||
|
@ -45,10 +35,12 @@ void CInputManager::mouseMoveUnified(uint32_t time) {
|
||||||
|
|
||||||
g_pCompositor->focusWindow(PWINDOW);
|
g_pCompositor->focusWindow(PWINDOW);
|
||||||
|
|
||||||
Vector2D surfaceLocal = m_vWLRMouseCoords - PWINDOW->m_vEffectivePosition;
|
Vector2D surfaceLocal = Vector2D(g_pCompositor->m_sWLRCursor->x, g_pCompositor->m_sWLRCursor->y) - PWINDOW->m_vEffectivePosition;
|
||||||
|
|
||||||
wlr_seat_pointer_notify_enter(g_pCompositor->m_sWLRSeat, g_pXWaylandManager->getWindowSurface(PWINDOW), surfaceLocal.x, surfaceLocal.y);
|
wlr_seat_pointer_notify_enter(g_pCompositor->m_sWLRSeat, g_pXWaylandManager->getWindowSurface(PWINDOW), surfaceLocal.x, surfaceLocal.y);
|
||||||
wlr_seat_pointer_notify_motion(g_pCompositor->m_sWLRSeat, time, surfaceLocal.x, surfaceLocal.y);
|
wlr_seat_pointer_notify_motion(g_pCompositor->m_sWLRSeat, time, surfaceLocal.x, surfaceLocal.y);
|
||||||
|
|
||||||
|
g_pCompositor->m_pLastMonitor = g_pCompositor->getMonitorFromCursor();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CInputManager::onMouseButton(wlr_event_pointer_button* e) {
|
void CInputManager::onMouseButton(wlr_event_pointer_button* e) {
|
||||||
|
@ -63,12 +55,16 @@ void CInputManager::onMouseButton(wlr_event_pointer_button* e) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
g_pCompositor->focusWindow(g_pCompositor->vectorToWindowIdeal(Vector2D(g_pCompositor->m_sWLRCursor->x, g_pCompositor->m_sWLRCursor->y)));
|
||||||
|
if (g_pCompositor->windowValidMapped(g_pCompositor->m_pLastFocus))
|
||||||
|
Debug::log(LOG, "Clicked, window with focus now: %x (window xy: %f, %f, cursor xy: %f %f)", g_pCompositor->m_pLastFocus, g_pCompositor->m_pLastFocus->m_vRealPosition.x, g_pCompositor->m_pLastFocus->m_vRealPosition.y, g_pCompositor->m_sWLRCursor->x, g_pCompositor->m_sWLRCursor->y);
|
||||||
|
|
||||||
// notify app if we didnt handle it
|
// notify app if we didnt handle it
|
||||||
wlr_seat_pointer_notify_button(g_pCompositor->m_sWLRSeat, e->time_msec, e->button, e->state);
|
wlr_seat_pointer_notify_button(g_pCompositor->m_sWLRSeat, e->time_msec, e->button, e->state);
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector2D CInputManager::getMouseCoordsInternal() {
|
Vector2D CInputManager::getMouseCoordsInternal() {
|
||||||
return m_vMouseCoords;
|
return Vector2D(g_pCompositor->m_sWLRCursor->x, g_pCompositor->m_sWLRCursor->y);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CInputManager::newKeyboard(wlr_input_device* keyboard) {
|
void CInputManager::newKeyboard(wlr_input_device* keyboard) {
|
||||||
|
|
|
@ -21,8 +21,6 @@ public:
|
||||||
Vector2D getMouseCoordsInternal();
|
Vector2D getMouseCoordsInternal();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Vector2D m_vMouseCoords = Vector2D(0,0);
|
|
||||||
Vector2D m_vWLRMouseCoords = Vector2D(0,0);
|
|
||||||
|
|
||||||
std::list<SKeyboard> m_lKeyboards;
|
std::list<SKeyboard> m_lKeyboards;
|
||||||
|
|
||||||
|
|
|
@ -61,6 +61,9 @@ void CHyprXWaylandManager::sendCloseWindow(CWindow* pWindow) {
|
||||||
} else {
|
} else {
|
||||||
wlr_xdg_toplevel_send_close(pWindow->m_uSurface.xdg->toplevel);
|
wlr_xdg_toplevel_send_close(pWindow->m_uSurface.xdg->toplevel);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
g_pLayoutManager->getCurrentLayout()->onWindowRemoved(pWindow);
|
||||||
|
g_pCompositor->removeWindowFromVectorSafe(pWindow);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CHyprXWaylandManager::setWindowSize(CWindow* pWindow, const Vector2D& size) {
|
void CHyprXWaylandManager::setWindowSize(CWindow* pWindow, const Vector2D& size) {
|
||||||
|
|
|
@ -50,7 +50,7 @@ void CHyprRenderer::renderAllClientsForMonitor(const int& ID, timespec* time) {
|
||||||
|
|
||||||
for (auto& w : g_pCompositor->m_lWindows) {
|
for (auto& w : g_pCompositor->m_lWindows) {
|
||||||
|
|
||||||
if (w.m_bIsX11)
|
if (w.m_bIsX11 || w.m_iMonitorID != (uint64_t)ID)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
wlr_box geometry = { w.m_vRealPosition.x, w.m_vRealPosition.y, w.m_vRealSize.x, w.m_vRealSize.y };
|
wlr_box geometry = { w.m_vRealPosition.x, w.m_vRealPosition.y, w.m_vRealSize.x, w.m_vRealSize.y };
|
||||||
|
@ -63,8 +63,6 @@ void CHyprRenderer::renderAllClientsForMonitor(const int& ID, timespec* time) {
|
||||||
// border
|
// border
|
||||||
drawBorderForWindow(&w, PMONITOR);
|
drawBorderForWindow(&w, PMONITOR);
|
||||||
|
|
||||||
wlr_output_layout_output_coords(g_pCompositor->m_sWLROutputLayout, PMONITOR->output, &w.m_vRealPosition.x, &w.m_vRealPosition.y);
|
|
||||||
|
|
||||||
SRenderData renderdata = {PMONITOR->output, time, w.m_vRealPosition.x, w.m_vRealPosition.y};
|
SRenderData renderdata = {PMONITOR->output, time, w.m_vRealPosition.x, w.m_vRealPosition.y};
|
||||||
|
|
||||||
wlr_surface_for_each_surface(g_pXWaylandManager->getWindowSurface(&w), renderSurface, &renderdata);
|
wlr_surface_for_each_surface(g_pXWaylandManager->getWindowSurface(&w), renderSurface, &renderdata);
|
||||||
|
@ -73,7 +71,7 @@ void CHyprRenderer::renderAllClientsForMonitor(const int& ID, timespec* time) {
|
||||||
|
|
||||||
for (auto& w : g_pCompositor->m_lWindows) {
|
for (auto& w : g_pCompositor->m_lWindows) {
|
||||||
|
|
||||||
if (!w.m_bIsX11)
|
if (!w.m_bIsX11 || w.m_iMonitorID != (uint64_t)ID)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (!g_pCompositor->windowValidMapped(&w))
|
if (!g_pCompositor->windowValidMapped(&w))
|
||||||
|
@ -221,21 +219,23 @@ void CHyprRenderer::drawBorderForWindow(CWindow* pWindow, SMonitor* pMonitor) {
|
||||||
|
|
||||||
const float BORDERWLRCOL[4] = {RED(BORDERCOL), GREEN(BORDERCOL), BLUE(BORDERCOL), ALPHA(BORDERCOL)};
|
const float BORDERWLRCOL[4] = {RED(BORDERCOL), GREEN(BORDERCOL), BLUE(BORDERCOL), ALPHA(BORDERCOL)};
|
||||||
|
|
||||||
|
Vector2D correctPos = pWindow->m_vRealPosition - pMonitor->vecPosition;
|
||||||
|
|
||||||
// top
|
// top
|
||||||
wlr_box border = {pWindow->m_vRealPosition.x - BORDERSIZE, pWindow->m_vRealPosition.y - BORDERSIZE, pWindow->m_vRealSize.x + 2 * BORDERSIZE, BORDERSIZE };
|
wlr_box border = {correctPos.x - BORDERSIZE, correctPos.y - BORDERSIZE, pWindow->m_vRealSize.x + 2 * BORDERSIZE, BORDERSIZE };
|
||||||
wlr_render_rect(g_pCompositor->m_sWLRRenderer, &border, BORDERWLRCOL, pMonitor->output->transform_matrix);
|
wlr_render_rect(g_pCompositor->m_sWLRRenderer, &border, BORDERWLRCOL, pMonitor->output->transform_matrix);
|
||||||
|
|
||||||
// bottom
|
// bottom
|
||||||
border.y = pWindow->m_vRealPosition.y + pWindow->m_vRealSize.y;
|
border.y = correctPos.y + pWindow->m_vRealSize.y;
|
||||||
wlr_render_rect(g_pCompositor->m_sWLRRenderer, &border, BORDERWLRCOL, pMonitor->output->transform_matrix);
|
wlr_render_rect(g_pCompositor->m_sWLRRenderer, &border, BORDERWLRCOL, pMonitor->output->transform_matrix);
|
||||||
|
|
||||||
// left
|
// left
|
||||||
border.y = pWindow->m_vRealPosition.y;
|
border.y = correctPos.y;
|
||||||
border.width = BORDERSIZE;
|
border.width = BORDERSIZE;
|
||||||
border.height = pWindow->m_vRealSize.y;
|
border.height = pWindow->m_vRealSize.y;
|
||||||
wlr_render_rect(g_pCompositor->m_sWLRRenderer, &border, BORDERWLRCOL, pMonitor->output->transform_matrix);
|
wlr_render_rect(g_pCompositor->m_sWLRRenderer, &border, BORDERWLRCOL, pMonitor->output->transform_matrix);
|
||||||
|
|
||||||
// right
|
// right
|
||||||
border.x = pWindow->m_vRealPosition.x + pWindow->m_vRealSize.x;
|
border.x = correctPos.x + pWindow->m_vRealSize.x;
|
||||||
wlr_render_rect(g_pCompositor->m_sWLRRenderer, &border, BORDERWLRCOL, pMonitor->output->transform_matrix);
|
wlr_render_rect(g_pCompositor->m_sWLRRenderer, &border, BORDERWLRCOL, pMonitor->output->transform_matrix);
|
||||||
}
|
}
|
Loading…
Reference in a new issue