Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Rewrote QxtWindowSystem::activeWindow() on X11 using _NET_ACTIVE_WINDOW

  • Loading branch information...
commit 21119892a0fab6c099c021da0ac19cea44290414 1 parent 9d931b6
jpnurmi authored
Showing with 13 additions and 5 deletions.
  1. +13 −5 src/gui/qxtwindowsystem_x11.cpp
View
18 src/gui/qxtwindowsystem_x11.cpp
@@ -66,11 +66,19 @@ WindowList QxtWindowSystem::windows()
WId QxtWindowSystem::activeWindow()
{
- Window focus;
- int revert = 0;
- Display* display = QX11Info::display();
- XGetInputFocus(display, &focus, &revert);
- return focus;
+ static Atom net_active = 0;
+ if (!net_active)
+ net_active = XInternAtom(QX11Info::display(), "_NET_ACTIVE_WINDOW", True);
+
+ int count = 0;
+ Window* list = 0;
+ qxt_getWindowProperty(QX11Info::appRootWindow(), net_active, 1024 * sizeof(Window), &list, &count);
+
+ Window res = 0;
+ if (count)
+ res = list[0];
+ XFree(list);
+ return res;
}
WId QxtWindowSystem::findWindow(const QString& title)
Please sign in to comment.
Something went wrong with that request. Please try again.