mirror of
https://github.com/hyprwm/Hypr.git
synced 2024-11-26 06:45:58 +01:00
more multimon fixes + killing better
This commit is contained in:
parent
7b3fc10ef2
commit
4c11e3355f
2 changed files with 14 additions and 23 deletions
|
@ -80,7 +80,7 @@ xcb_keycode_t KeybindManager::getKeycodeFromKeysym(xcb_keysym_t keysym) {
|
||||||
|
|
||||||
void KeybindManager::killactive(std::string args) {
|
void KeybindManager::killactive(std::string args) {
|
||||||
// args unused
|
// args unused
|
||||||
xcb_kill_client(g_pWindowManager->DisplayConnection, g_pWindowManager->LastWindow);
|
xcb_destroy_window(g_pWindowManager->DisplayConnection, g_pWindowManager->LastWindow);
|
||||||
}
|
}
|
||||||
|
|
||||||
void KeybindManager::call(std::string args) {
|
void KeybindManager::call(std::string args) {
|
||||||
|
|
|
@ -45,7 +45,7 @@ void CWindowManager::setupRandrMonitors() {
|
||||||
monitors[monitors.size() - 1].vecPosition = Vector2D(crtcReply->x, crtcReply->y);
|
monitors[monitors.size() - 1].vecPosition = Vector2D(crtcReply->x, crtcReply->y);
|
||||||
monitors[monitors.size() - 1].vecSize = Vector2D(crtcReply->width == 0 ? 1920 : crtcReply->width, crtcReply->height);
|
monitors[monitors.size() - 1].vecSize = Vector2D(crtcReply->width == 0 ? 1920 : crtcReply->width, crtcReply->height);
|
||||||
|
|
||||||
monitors[monitors.size() - 1].ID = i;
|
monitors[monitors.size() - 1].ID = monitors.size() - 1;
|
||||||
|
|
||||||
char* name = (char*)xcb_randr_get_output_info_name(outputReply);
|
char* name = (char*)xcb_randr_get_output_info_name(outputReply);
|
||||||
int nameLen = xcb_randr_get_output_info_name_length(outputReply);
|
int nameLen = xcb_randr_get_output_info_name_length(outputReply);
|
||||||
|
@ -65,6 +65,11 @@ void CWindowManager::setupRandrMonitors() {
|
||||||
//listen for screen change events
|
//listen for screen change events
|
||||||
xcb_randr_select_input(DisplayConnection, Screen->root, XCB_RANDR_NOTIFY_MASK_SCREEN_CHANGE);
|
xcb_randr_select_input(DisplayConnection, Screen->root, XCB_RANDR_NOTIFY_MASK_SCREEN_CHANGE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Sort monitors for my convenience thanks
|
||||||
|
std::sort(monitors.begin(), monitors.end(), [](SMonitor& a, SMonitor& b) {
|
||||||
|
return a.vecPosition.x < b.vecPosition.x;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void CWindowManager::setupManager() {
|
void CWindowManager::setupManager() {
|
||||||
|
@ -78,27 +83,11 @@ void CWindowManager::setupManager() {
|
||||||
|
|
||||||
monitors.push_back(SMonitor());
|
monitors.push_back(SMonitor());
|
||||||
monitors[0].vecPosition = Vector2D(0, 0);
|
monitors[0].vecPosition = Vector2D(0, 0);
|
||||||
monitors[0].vecSize = Vector2D(Screen->width_in_pixels / 3.f, Screen->height_in_pixels);
|
monitors[0].vecSize = Vector2D(Screen->width_in_pixels, Screen->height_in_pixels);
|
||||||
monitors[0].ID = 0;
|
monitors[0].ID = 0;
|
||||||
monitors[0].szName = "Screen";
|
monitors[0].szName = "Screen";
|
||||||
|
|
||||||
monitors.push_back(SMonitor());
|
|
||||||
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.
|
|
||||||
monitors[0].primary = true;
|
|
||||||
monitors[0].hasABar = true;
|
|
||||||
|
|
||||||
Debug::log(LOG, "RandR done.");
|
Debug::log(LOG, "RandR done.");
|
||||||
|
|
||||||
Values[0] = XCB_EVENT_MASK_SUBSTRUCTURE_REDIRECT | XCB_EVENT_MASK_STRUCTURE_NOTIFY | XCB_EVENT_MASK_SUBSTRUCTURE_NOTIFY | XCB_EVENT_MASK_PROPERTY_CHANGE;
|
Values[0] = XCB_EVENT_MASK_SUBSTRUCTURE_REDIRECT | XCB_EVENT_MASK_STRUCTURE_NOTIFY | XCB_EVENT_MASK_SUBSTRUCTURE_NOTIFY | XCB_EVENT_MASK_PROPERTY_CHANGE;
|
||||||
|
@ -385,11 +374,13 @@ void CWindowManager::setEffectiveSizePosUsingConfig(CWindow* pWindow) {
|
||||||
if (!pWindow)
|
if (!pWindow)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
const auto MONITOR = getMonitorFromWindow(pWindow);
|
||||||
|
|
||||||
// set some flags.
|
// set some flags.
|
||||||
const bool DISPLAYLEFT = pWindow->getPosition().x == 0;
|
const bool DISPLAYLEFT = STICKS(pWindow->getPosition().x, MONITOR->vecPosition.x);
|
||||||
const bool DISPLAYRIGHT = pWindow->getPosition().x + pWindow->getSize().x == Screen->width_in_pixels;
|
const bool DISPLAYRIGHT = STICKS(pWindow->getPosition().x + pWindow->getSize().x, MONITOR->vecPosition.x + MONITOR->vecSize.x);
|
||||||
const bool DISPLAYTOP = pWindow->getPosition().y == 0;
|
const bool DISPLAYTOP = STICKS(pWindow->getPosition().y, MONITOR->vecPosition.y);
|
||||||
const bool DISPLAYBOTTOM = pWindow->getPosition().y + pWindow->getSize().y == Screen->height_in_pixels;
|
const bool DISPLAYBOTTOM = STICKS(pWindow->getPosition().y + pWindow->getSize().y, MONITOR->vecPosition.y + MONITOR->vecSize.y);
|
||||||
|
|
||||||
pWindow->setEffectivePosition(pWindow->getPosition() + Vector2D(ConfigManager::getInt("border_size"), ConfigManager::getInt("border_size")));
|
pWindow->setEffectivePosition(pWindow->getPosition() + Vector2D(ConfigManager::getInt("border_size"), ConfigManager::getInt("border_size")));
|
||||||
pWindow->setEffectiveSize(pWindow->getSize() - (Vector2D(ConfigManager::getInt("border_size"), ConfigManager::getInt("border_size")) * 2));
|
pWindow->setEffectiveSize(pWindow->getSize() - (Vector2D(ConfigManager::getInt("border_size"), ConfigManager::getInt("border_size")) * 2));
|
||||||
|
|
Loading…
Reference in a new issue