diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp
index 1751eea990..d890398416 100644
--- a/src/plugins/platforms/xcb/qxcbwindow.cpp
+++ b/src/plugins/platforms/xcb/qxcbwindow.cpp
@@ -1823,24 +1823,21 @@ void QXcbWindow::handlePropertyNotifyEvent(const xcb_property_notify_event_t *ev
     connection()->setTime(event->time);
 
     const bool propertyDeleted = event->state == XCB_PROPERTY_DELETE;
-    const xcb_atom_t netWmStateAtom = atom(QXcbAtom::_NET_WM_STATE);
-    const xcb_atom_t wmStateAtom = atom(QXcbAtom::WM_STATE);
-    const xcb_atom_t netWorkAreaAtom = atom(QXcbAtom::_NET_WORKAREA);
 
-    if (event->atom == netWmStateAtom || event->atom == wmStateAtom) {
+    if (event->atom == atom(QXcbAtom::_NET_WM_STATE) || event->atom == atom(QXcbAtom::WM_STATE)) {
         if (propertyDeleted)
             return;
 
         Qt::WindowState newState = Qt::WindowNoState;
-        if (event->atom == wmStateAtom) { // WM_STATE: Quick check for 'Minimize'.
+        if (event->atom == atom(QXcbAtom::_NET_WM_STATE)) { // WM_STATE: Quick check for 'Minimize'.
             const xcb_get_property_cookie_t get_cookie =
-                xcb_get_property(xcb_connection(), 0, m_window, wmStateAtom,
+            xcb_get_property(xcb_connection(), 0, m_window, atom(QXcbAtom::_NET_WM_STATE),
                                  XCB_ATOM_ANY, 0, 1024);
 
             xcb_get_property_reply_t *reply =
                 xcb_get_property_reply(xcb_connection(), get_cookie, NULL);
 
-            if (reply && reply->format == 32 && reply->type == wmStateAtom) {
+            if (reply && reply->format == 32 && reply->type == atom(QXcbAtom::_NET_WM_STATE)) {
                 const quint32 *data = (const quint32 *)xcb_get_property_value(reply);
                 if (reply->length != 0 && XCB_WM_STATE_ICONIC == data[0])
                     newState = Qt::WindowMinimized;
@@ -1861,7 +1858,7 @@ void QXcbWindow::handlePropertyNotifyEvent(const xcb_property_notify_event_t *ev
             m_windowState = newState;
         }
         return;
-    } else if (event->atom == netWorkAreaAtom && event->window == m_screen->root()) {
+    } else if (event->atom == atom(QXcbAtom::_NET_WORKAREA) && event->window == m_screen->root()) {
         m_screen->updateGeometry(event->time);
     }
 }