Skip to content

Commit

Permalink
Improved compatibility with KWin.
Browse files Browse the repository at this point in the history
  • Loading branch information
MadFishTheOne committed Apr 23, 2011
1 parent b527cb1 commit ffd4da6
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
5 changes: 4 additions & 1 deletion dockapplet.cpp
Expand Up @@ -175,8 +175,11 @@ Client::~Client()
void Client::updateVisibility()
{
QVector<unsigned long> windowTypes = X11Support::instance()->getWindowPropertyAtomsArray(m_handle, "_NET_WM_WINDOW_TYPE");
m_visible = windowTypes.contains(X11Support::instance()->atom("_NET_WM_WINDOW_TYPE_NORMAL"));
QVector<unsigned long> 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;

Expand Down
14 changes: 14 additions & 0 deletions x11support.cpp
Expand Up @@ -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<XEvent*>(&event));
}

void X11Support::minimizeWindow(unsigned long window)
Expand Down

0 comments on commit ffd4da6

Please sign in to comment.