mirror of
https://github.com/hyprwm/Hypr.git
synced 2024-12-25 18:59:48 +01:00
more monitor fixes
This commit is contained in:
parent
5153db3934
commit
d9fc533725
2 changed files with 16 additions and 10 deletions
|
@ -118,7 +118,7 @@ int getTextWidth(std::string text, xcb_font_t font) {
|
|||
|
||||
const auto WIDTH = reply->overall_width;
|
||||
free(reply);
|
||||
return WIDTH;
|
||||
return WIDTH + 5;
|
||||
}
|
||||
|
||||
void CStatusBar::draw() {
|
||||
|
@ -155,10 +155,10 @@ void CStatusBar::draw() {
|
|||
}
|
||||
|
||||
// Draw time to the right
|
||||
const auto TIMET = std::chrono::system_clock::to_time_t(std::chrono::system_clock::now());
|
||||
const std::string TIME = "Hello World!";
|
||||
std::string TIME = exec("date +%I:%M\\ %p");
|
||||
TIME = TIME.substr(0, TIME.length() - 1);
|
||||
xcb_image_text_8(g_pWindowManager->DisplayConnection, TIME.length(), m_iPixmap,
|
||||
m_mContexts["BASETEXT"].GContext, m_vecSize.x - getTextWidth(TIME, m_mContexts["BASETEXT"].Font) - 2, (m_vecSize.y - (m_vecSize.y - 10) / 2),
|
||||
m_mContexts["BASETEXT"].GContext, m_vecSize.x - getTextWidth(TIME, m_mContexts["BASETEXT"].Font), (m_vecSize.y - (m_vecSize.y - 10) / 2),
|
||||
TIME.c_str());
|
||||
|
||||
xcb_flush(g_pWindowManager->DisplayConnection);
|
||||
|
|
|
@ -78,15 +78,21 @@ void CWindowManager::setupManager() {
|
|||
|
||||
monitors.push_back(SMonitor());
|
||||
monitors[0].vecPosition = Vector2D(0, 0);
|
||||
monitors[0].vecSize = Vector2D(Screen->width_in_pixels / 2.f, Screen->height_in_pixels);
|
||||
monitors[0].vecSize = Vector2D(Screen->width_in_pixels / 3.f, Screen->height_in_pixels);
|
||||
monitors[0].ID = 0;
|
||||
monitors[0].szName = "Screen";
|
||||
|
||||
monitors.push_back(SMonitor());
|
||||
monitors[1].vecPosition = Vector2D(Screen->width_in_pixels / 2.f, 0);
|
||||
monitors[1].vecSize = Vector2D(Screen->width_in_pixels / 2.f, Screen->height_in_pixels);
|
||||
monitors[1].vecPosition = Vector2D(Screen->width_in_pixels / 3.f, 0);
|
||||
monitors[1].vecSize = Vector2D(Screen->width_in_pixels / 3.f, Screen->height_in_pixels);
|
||||
monitors[1].ID = 1;
|
||||
monitors[1].szName = "Screen2";
|
||||
|
||||
monitors.push_back(SMonitor());
|
||||
monitors[2].vecPosition = Vector2D(2 * Screen->width_in_pixels / 3.f, 0);
|
||||
monitors[2].vecSize = Vector2D(Screen->width_in_pixels / 3.f, Screen->height_in_pixels);
|
||||
monitors[2].ID = 2;
|
||||
monitors[2].szName = "Screen3";
|
||||
}
|
||||
|
||||
// TODO: get it normally.
|
||||
|
@ -430,7 +436,7 @@ CWindow* CWindowManager::findWindowAtCursor() {
|
|||
void CWindowManager::calculateNewTileSetOldTile(CWindow* pWindow) {
|
||||
auto PLASTWINDOW = getWindowFromDrawable(LastWindow);
|
||||
|
||||
if (PLASTWINDOW && PLASTWINDOW->getIsFloating()) {
|
||||
if (PLASTWINDOW && (PLASTWINDOW->getIsFloating() || PLASTWINDOW->getWorkspaceID() != pWindow->getWorkspaceID())) {
|
||||
// find a window manually
|
||||
PLASTWINDOW = findWindowAtCursor();
|
||||
}
|
||||
|
@ -482,7 +488,7 @@ void CWindowManager::calculateNewWindowParams(CWindow* pWindow) {
|
|||
|
||||
bool CWindowManager::isNeighbor(CWindow* a, CWindow* b) {
|
||||
|
||||
if (a->getWorkspaceID() != b->getWorkspaceID() || getMonitorFromWindow(a) != getMonitorFromWindow(b))
|
||||
if (a->getWorkspaceID() != b->getWorkspaceID())
|
||||
return false; // Different workspaces
|
||||
|
||||
const auto POSA = a->getPosition();
|
||||
|
@ -571,7 +577,7 @@ void CWindowManager::fixWindowOnClose(CWindow* pClosedWindow) {
|
|||
// get the first neighboring window
|
||||
CWindow* neighbor = nullptr;
|
||||
for(auto& w : windows) {
|
||||
if (w.getDrawable() == pClosedWindow->getDrawable() || getMonitorFromWindow(&w) != getMonitorFromWindow(pClosedWindow))
|
||||
if (w.getDrawable() == pClosedWindow->getDrawable())
|
||||
continue;
|
||||
|
||||
if (isNeighbor(&w, pClosedWindow) && canEatWindow(&w, pClosedWindow)) {
|
||||
|
|
Loading…
Reference in a new issue