diff --git a/dockapplet.cpp b/dockapplet.cpp index 9c8ad0b..5d16dc8 100644 --- a/dockapplet.cpp +++ b/dockapplet.cpp @@ -175,8 +175,11 @@ Client::~Client() void Client::updateVisibility() { QVector windowTypes = X11Support::instance()->getWindowPropertyAtomsArray(m_handle, "_NET_WM_WINDOW_TYPE"); - m_visible = windowTypes.contains(X11Support::instance()->atom("_NET_WM_WINDOW_TYPE_NORMAL")); QVector windowStates = X11Support::instance()->getWindowPropertyAtomsArray(m_handle, "_NET_WM_STATE"); + + // Show only regular windows in dock. + m_visible = windowTypes.size() == 1 && windowTypes[0] == X11Support::instance()->atom("_NET_WM_WINDOW_TYPE_NORMAL"); + // Don't show window if requested explicitly in window states. if(windowStates.contains(X11Support::instance()->atom("_NET_WM_STATE_SKIP_TASKBAR"))) m_visible = false; diff --git a/x11support.cpp b/x11support.cpp index cc5cef0..e3704dc 100644 --- a/x11support.cpp +++ b/x11support.cpp @@ -169,6 +169,20 @@ void X11Support::activateWindow(unsigned long window) XWindowChanges wc; wc.stack_mode = Above; XConfigureWindow(QX11Info::display(), window, CWStackMode, &wc); + + // Apparently, KWin won't bring window to top with configure request, + // so we also need to ask it politely by sending a message. + XClientMessageEvent event; + event.type = ClientMessage; + event.window = window; + event.message_type = atom("_NET_ACTIVE_WINDOW"); + event.format = 32; + event.data.l[0] = 2; + event.data.l[1] = CurrentTime; + event.data.l[2] = 0; + event.data.l[3] = 0; + event.data.l[4] = 0; + XSendEvent(QX11Info::display(), rootWindow(), False, SubstructureNotifyMask | SubstructureRedirectMask, reinterpret_cast(&event)); } void X11Support::minimizeWindow(unsigned long window)