made all kinds of notifications and dialogs floating by default

This commit is contained in:
vaxerski 2021-11-28 16:14:12 +01:00
parent 5303743157
commit d73b3bf92b
4 changed files with 46 additions and 4 deletions

View file

@ -80,6 +80,8 @@ void Events::eventDestroy(xcb_generic_event_t* event) {
xcb_kill_client(g_pWindowManager->DisplayConnection, E->window);
g_pWindowManager->closeWindowAllChecks(E->window);
// Can someone tell me why the fuck some dialogs do not report they are closed and still respond to XCB even after they disappear???
}
CWindow* Events::remapFloatingWindow(int windowID, int forcemonitor) {
@ -114,6 +116,12 @@ CWindow* Events::remapFloatingWindow(int windowID, int forcemonitor) {
window.setDefaultSize(Vector2D(g_pWindowManager->Screen->width_in_pixels / 2.f, g_pWindowManager->Screen->height_in_pixels / 2.f));
}
if (nextWindowCentered) {
nextWindowCentered = false;
window.setDefaultPosition(g_pWindowManager->monitors[CURRENTSCREEN].vecSize / 2.f - window.getDefaultSize() / 2.f);
}
//
// Dock Checks
//

View file

@ -24,4 +24,7 @@ namespace Events {
void setThread();
inline timer_t timerid;
// For docks etc
inline bool nextWindowCentered = false;
};

View file

@ -1,7 +1,7 @@
#include "window.hpp"
#include "windowManager.hpp"
CWindow::CWindow() { this->setImmovable(false); this->setDirty(true); this->setFullscreen(false); this->setIsFloating(false); this->setParentNodeID(0); this->setChildNodeAID(0); this->setChildNodeBID(0); this->setName(""); }
CWindow::CWindow() { this->setImmovable(false); this->setNoInterventions(false); this->setDirty(true); this->setFullscreen(false); this->setIsFloating(false); this->setParentNodeID(0); this->setChildNodeAID(0); this->setChildNodeBID(0); this->setName(""); }
CWindow::~CWindow() { }
void CWindow::generateNodeID() {

View file

@ -491,6 +491,32 @@ void CWindowManager::sanityCheckOnWorkspace(int workspaceID) {
closeWindowAllChecks(w.getDrawable());
continue;
}
// Type 2: is hidden.
const auto window = w.getDrawable();
PROP(wm_type_cookie, HYPRATOMS["_NET_WM_WINDOW_TYPE"], UINT32_MAX);
if (wm_type_cookiereply == NULL || xcb_get_property_value_length(wm_type_cookiereply) < 1) {
Debug::log(LOG, "No preferred type found.");
} else {
const auto ATOMS = (xcb_atom_t*)xcb_get_property_value(wm_type_cookiereply);
if (!ATOMS) {
Debug::log(ERR, "Atoms not found in preferred type!");
} else {
if (xcbContainsAtom(wm_type_cookiereply, HYPRATOMS["_NET_WM_STATE_HIDDEN"])) {
// delete it
// NOTE: this is NOT the cause of windows in tray not being able
// to open.
free(wm_type_cookiereply);
Debug::log(LOG, "Found a dead window, ID: " + std::to_string(w.getDrawable()) + ", removing it.");
closeWindowAllChecks(w.getDrawable());
continue;
}
}
}
free(wm_type_cookiereply);
}
}
}
@ -1244,10 +1270,16 @@ bool CWindowManager::shouldBeFloatedOnInit(int64_t window) {
if (!ATOMS) {
Debug::log(ERR, "Atoms not found in preferred type!");
} else {
if (xcbContainsAtom(wm_type_cookiereply, HYPRATOMS["_NET_WM_WINDOW_TYPE_NOTIFICATION"])) {
if (xcbContainsAtom(wm_type_cookiereply, HYPRATOMS["_NET_WM_WINDOW_TYPE_DOCK"])) {
free(wm_type_cookiereply);
return true;
} else if (xcbContainsAtom(wm_type_cookiereply, HYPRATOMS["_NET_WM_WINDOW_TYPE_DOCK"])) {
} else if (xcbContainsAtom(wm_type_cookiereply, HYPRATOMS["_NET_WM_WINDOW_TYPE_DIALOG"])
|| xcbContainsAtom(wm_type_cookiereply, HYPRATOMS["_NET_WM_WINDOW_TYPE_TOOLBAR"])
|| xcbContainsAtom(wm_type_cookiereply, HYPRATOMS["_NET_WM_WINDOW_TYPE_UTILITY"])
|| xcbContainsAtom(wm_type_cookiereply, HYPRATOMS["_NET_WM_STATE_MODAL"])
|| xcbContainsAtom(wm_type_cookiereply, HYPRATOMS["_NET_WM_WINDOW_TYPE_SPLASH"])) {
Events::nextWindowCentered = true;
free(wm_type_cookiereply);
return true;
}
@ -1281,7 +1313,6 @@ void CWindowManager::doPostCreationChecks(CWindow* pWindow) {
const auto window = pWindow->getDrawable();
PROP(wm_type_cookie, HYPRATOMS["_NET_WM_WINDOW_TYPE"], UINT32_MAX);
xcb_atom_t TYPEATOM = NULL;
if (wm_type_cookiereply == NULL || xcb_get_property_value_length(wm_type_cookiereply) < 1) {
Debug::log(LOG, "No preferred type found.");