summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorvaxerski <43317083+vaxerski@users.noreply.github.com>2022-03-22 17:31:19 +0100
committervaxerski <43317083+vaxerski@users.noreply.github.com>2022-03-22 17:31:19 +0100
commitc58b15c6da180c2d141316ef0cf5bd35417da78e (patch)
tree6a52f72ebb69e6ef21465bc8fe48e72e04740c30 /src
parent8fe1cec87ce4a0dc580a36be31fe198d375c21fa (diff)
Fix a crash with setting title
Diffstat (limited to 'src')
-rw-r--r--src/events/Windows.cpp5
-rw-r--r--src/layout/DwindleLayout.cpp13
-rw-r--r--src/managers/XWaylandManager.cpp21
3 files changed, 28 insertions, 11 deletions
diff --git a/src/events/Windows.cpp b/src/events/Windows.cpp
index 2b8baf07..040d49da 100644
--- a/src/events/Windows.cpp
+++ b/src/events/Windows.cpp
@@ -89,6 +89,9 @@ void Events::listener_destroyWindow(wl_listener* listener, void* data) {
void Events::listener_setTitleWindow(wl_listener* listener, void* data) {
CWindow* PWINDOW = wl_container_of(listener, PWINDOW, listen_setTitleWindow);
+ if (!g_pCompositor->windowValidMapped(PWINDOW))
+ return;
+
PWINDOW->m_szTitle = g_pXWaylandManager->getTitle(PWINDOW);
Debug::log(LOG, "Window %x set title to %s", PWINDOW, PWINDOW->m_szTitle.c_str());
@@ -188,4 +191,4 @@ void Events::listener_newSubsurfaceWindow(wl_listener* listener, void* data) {
const auto PSUBSURFACE = (wlr_subsurface*)data;
createSubsurface(PWINDOW, PSUBSURFACE);
-} \ No newline at end of file
+}
diff --git a/src/layout/DwindleLayout.cpp b/src/layout/DwindleLayout.cpp
index 7b02502b..cb96931f 100644
--- a/src/layout/DwindleLayout.cpp
+++ b/src/layout/DwindleLayout.cpp
@@ -271,17 +271,18 @@ void CHyprDwindleLayout::onBeginDragWindow() {
m_vBeginDragSizeXY = Vector2D();
- if (DRAGGINGWINDOW->m_bIsFullscreen) {
- Debug::log(LOG, "Rejecting drag on a fullscreen window.");
- return;
- }
-
// Window will be floating. Let's check if it's valid. It should be, but I don't like crashing.
if (!g_pCompositor->windowValidMapped(DRAGGINGWINDOW)) {
Debug::log(ERR, "Dragging attempted on an invalid window!");
return;
}
+ if (DRAGGINGWINDOW->m_bIsFullscreen) {
+ Debug::log(LOG, "Rejecting drag on a fullscreen window.");
+ return;
+ }
+
+
m_vBeginDragXY = g_pInputManager->getMouseCoordsInternal();
m_vBeginDragPositionXY = DRAGGINGWINDOW->m_vRealPosition;
m_vBeginDragSizeXY = DRAGGINGWINDOW->m_vRealSize;
@@ -400,4 +401,4 @@ void CHyprDwindleLayout::fullscreenRequestForWindow(CWindow* pWindow) {
// we need to fix XWayland windows by sending them to NARNIA
// because otherwise they'd still be recieving mouse events
g_pCompositor->fixXWaylandWindowsOnWorkspace(PMONITOR->activeWorkspace);
-} \ No newline at end of file
+}
diff --git a/src/managers/XWaylandManager.cpp b/src/managers/XWaylandManager.cpp
index ac183023..05717a58 100644
--- a/src/managers/XWaylandManager.cpp
+++ b/src/managers/XWaylandManager.cpp
@@ -49,10 +49,23 @@ void CHyprXWaylandManager::getGeometryForWindow(CWindow* pWindow, wlr_box* pbox)
}
std::string CHyprXWaylandManager::getTitle(CWindow* pWindow) {
- if (pWindow->m_bIsX11)
- return pWindow->m_uSurface.xwayland->title;
+ if (pWindow->m_bIsX11) {
+ if (pWindow->m_uSurface.xwayland) {
+ return pWindow->m_uSurface.xwayland->title;
+ }
+ } else {
+ return "";
+ }
+
+ if (pWindow->m_uSurface.xdg) {
+ if (pWindow->m_uSurface.xdg->toplevel) {
+ return pWindow->m_uSurface.xdg->toplevel->title;
+ }
+ } else {
+ return "";
+ }
- return pWindow->m_uSurface.xdg->toplevel->title;
+ return "";
}
void CHyprXWaylandManager::sendCloseWindow(CWindow* pWindow) {
@@ -114,4 +127,4 @@ void CHyprXWaylandManager::moveXWaylandWindow(CWindow* pWindow, const Vector2D&
if (pWindow->m_bIsX11) {
wlr_xwayland_surface_configure(pWindow->m_uSurface.xwayland, pos.x, pos.y, pWindow->m_vRealSize.x, pWindow->m_vRealSize.y);
}
-} \ No newline at end of file
+}