mirror of
https://github.com/hyprwm/Hypr.git
synced 2024-11-25 22:35:58 +01:00
Fixed WM crashes on wonky windows opening
This commit is contained in:
parent
6224ffb078
commit
5a0a8fb0d1
2 changed files with 10 additions and 1 deletions
|
@ -135,7 +135,6 @@ void IPCRecieveMessageB(const std::string path) {
|
||||||
std::sort(g_pWindowManager->statusBar->openWorkspaces.begin(), g_pWindowManager->statusBar->openWorkspaces.end());
|
std::sort(g_pWindowManager->statusBar->openWorkspaces.begin(), g_pWindowManager->statusBar->openWorkspaces.end());
|
||||||
} else if (PROPNAME == "lastwindowname") {
|
} else if (PROPNAME == "lastwindowname") {
|
||||||
g_pWindowManager->statusBar->setLastWindowName(PROPVALUE);
|
g_pWindowManager->statusBar->setLastWindowName(PROPVALUE);
|
||||||
Debug::log(LOG, "update window name to " + PROPVALUE);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch(...) {
|
} catch(...) {
|
||||||
|
|
|
@ -7,6 +7,10 @@
|
||||||
std::pair<std::string, std::string> getClassName(int64_t window) {
|
std::pair<std::string, std::string> getClassName(int64_t window) {
|
||||||
PROP(class_cookie, XCB_ATOM_WM_CLASS, 128);
|
PROP(class_cookie, XCB_ATOM_WM_CLASS, 128);
|
||||||
|
|
||||||
|
if (!class_cookiereply) {
|
||||||
|
return std::make_pair<>("Error", "Error");
|
||||||
|
}
|
||||||
|
|
||||||
const size_t PROPLEN = xcb_get_property_value_length(class_cookiereply);
|
const size_t PROPLEN = xcb_get_property_value_length(class_cookiereply);
|
||||||
char* NEWCLASS = (char*)xcb_get_property_value(class_cookiereply);
|
char* NEWCLASS = (char*)xcb_get_property_value(class_cookiereply);
|
||||||
const size_t CLASSNAMEINDEX = strnlen(NEWCLASS, PROPLEN) + 1;
|
const size_t CLASSNAMEINDEX = strnlen(NEWCLASS, PROPLEN) + 1;
|
||||||
|
@ -27,6 +31,9 @@ std::pair<std::string, std::string> getClassName(int64_t window) {
|
||||||
std::string getRoleName(int64_t window) {
|
std::string getRoleName(int64_t window) {
|
||||||
PROP(role_cookie, HYPRATOMS["WM_WINDOW_ROLE"], 128);
|
PROP(role_cookie, HYPRATOMS["WM_WINDOW_ROLE"], 128);
|
||||||
|
|
||||||
|
if (!role_cookiereply)
|
||||||
|
return "Error";
|
||||||
|
|
||||||
std::string returns = "";
|
std::string returns = "";
|
||||||
|
|
||||||
if (role_cookiereply == NULL || xcb_get_property_value_length(role_cookiereply)) {
|
if (role_cookiereply == NULL || xcb_get_property_value_length(role_cookiereply)) {
|
||||||
|
@ -48,6 +55,9 @@ std::string getRoleName(int64_t window) {
|
||||||
std::string getWindowName(uint64_t window) {
|
std::string getWindowName(uint64_t window) {
|
||||||
PROP(name_cookie, HYPRATOMS["_NET_WM_NAME"], 128);
|
PROP(name_cookie, HYPRATOMS["_NET_WM_NAME"], 128);
|
||||||
|
|
||||||
|
if (!name_cookiereply)
|
||||||
|
return "Error";
|
||||||
|
|
||||||
const int len = xcb_get_property_value_length(name_cookiereply);
|
const int len = xcb_get_property_value_length(name_cookiereply);
|
||||||
char* name = strndup((const char*)xcb_get_property_value(name_cookiereply), len);
|
char* name = strndup((const char*)xcb_get_property_value(name_cookiereply), len);
|
||||||
std::string stringname(name);
|
std::string stringname(name);
|
||||||
|
|
Loading…
Reference in a new issue