diff options
-rw-r--r-- | src/SystemTray.cc | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/src/SystemTray.cc b/src/SystemTray.cc index 9811508..c908f3e 100644 --- a/src/SystemTray.cc +++ b/src/SystemTray.cc | |||
@@ -45,6 +45,30 @@ using std::endl; | |||
45 | using std::hex; | 45 | using std::hex; |
46 | using std::dec; | 46 | using std::dec; |
47 | 47 | ||
48 | void getScreenCoordinates(Window win, int x, int y, int &screen_x, int &screen_y) { | ||
49 | XWindowAttributes attr; | ||
50 | if (XGetWindowAttributes(FbTk::App::instance()->display(), win, &attr) == 0) { | ||
51 | return; | ||
52 | } | ||
53 | |||
54 | Window child_win; // not used | ||
55 | Window parent_win; // not used | ||
56 | Window root_win = 0; | ||
57 | Window* child_windows; // not used | ||
58 | unsigned int num_child_windows; // not used | ||
59 | XQueryTree(FbTk::App::instance()->display(), win, | ||
60 | &root_win, | ||
61 | &parent_win, | ||
62 | &child_windows, &num_child_windows); | ||
63 | if (child_windows != 0) { | ||
64 | XFree(child_windows); | ||
65 | } | ||
66 | XTranslateCoordinates(FbTk::App::instance()->display(), | ||
67 | parent_win, root_win, | ||
68 | x, y, | ||
69 | &screen_x, &screen_y, &child_win); | ||
70 | } | ||
71 | |||
48 | /// helper class for tray windows, so we dont call XDestroyWindow | 72 | /// helper class for tray windows, so we dont call XDestroyWindow |
49 | class TrayWindow: public FbTk::FbWindow { | 73 | class TrayWindow: public FbTk::FbWindow { |
50 | public: | 74 | public: |
@@ -470,9 +494,11 @@ void SystemTray::rearrangeClients() { | |||
470 | next_x += h_rot0+bw; | 494 | next_x += h_rot0+bw; |
471 | translateCoords(orientation(), x, y, w_rot0, h_rot0); | 495 | translateCoords(orientation(), x, y, w_rot0, h_rot0); |
472 | translatePosition(orientation(), x, y, h_rot0, h_rot0, 0); | 496 | translatePosition(orientation(), x, y, h_rot0, h_rot0, 0); |
497 | int screen_x = 0, screen_y = 0; | ||
498 | getScreenCoordinates((*client_it)->window(), (*client_it)->x(), (*client_it)->y(), screen_x, screen_y); | ||
473 | 499 | ||
474 | (*client_it)->moveResize(x, y, h_rot0, h_rot0); | 500 | (*client_it)->moveResize(x, y, h_rot0, h_rot0); |
475 | (*client_it)->sendConfigureNotify(x, y, h_rot0, h_rot0); | 501 | (*client_it)->sendConfigureNotify(screen_x, screen_y, h_rot0, h_rot0); |
476 | } | 502 | } |
477 | } | 503 | } |
478 | 504 | ||