From de3e0458a66981f1509c909b1678ace47f46cdd3 Mon Sep 17 00:00:00 2001 From: Michael Carlberg Date: Mon, 31 Oct 2016 05:37:51 +0100 Subject: [PATCH] fix(tray): Catch restack failure --- include/components/x11/tray.hpp | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/include/components/x11/tray.hpp b/include/components/x11/tray.hpp index a1374859..5290c7c3 100644 --- a/include/components/x11/tray.hpp +++ b/include/components/x11/tray.hpp @@ -381,13 +381,18 @@ class traymanager m_settings.width + m_settings.spacing * 2, m_settings.height_fill, 0, XCB_WINDOW_CLASS_INPUT_OUTPUT, scr->root_visual, mask, values); - // Put the tray window above the defined sibling in the window stack - if (m_settings.sibling != XCB_NONE) { - const uint32_t value_mask = XCB_CONFIG_WINDOW_SIBLING | XCB_CONFIG_WINDOW_STACK_MODE; - const uint32_t value_list[2]{m_settings.sibling, XCB_STACK_MODE_ABOVE}; - m_connection.configure_window_checked(m_tray, value_mask, value_list); - m_connection.flush(); - m_restacked = true; + try { + // Put the tray window above the defined sibling in the window stack + if (m_settings.sibling != XCB_NONE) { + const uint32_t value_mask = XCB_CONFIG_WINDOW_SIBLING | XCB_CONFIG_WINDOW_STACK_MODE; + const uint32_t value_list[2]{m_settings.sibling, XCB_STACK_MODE_ABOVE}; + m_connection.configure_window_checked(m_tray, value_mask, value_list); + m_connection.flush(); + m_restacked = true; + } + } catch (const std::exception& err) { + auto id = m_connection.id(m_settings.sibling); + m_log.trace("tray: Failed to put tray above %s in the stack (%s)", id, err.what()); } }