summaryrefslogtreecommitdiff
path: root/util
diff options
context:
space:
mode:
authormathias <mathias>2004-11-22 20:10:26 (GMT)
committermathias <mathias>2004-11-22 20:10:26 (GMT)
commita65f840b68aabf79df22aedc729c53c8ebd0fbe6 (patch)
treea53219c5ea2225d73f6d23b541ad512fafe0d49e /util
parentb47f050367409a26f70e57f130aedde3005589ea (diff)
downloadfluxbox_lack-a65f840b68aabf79df22aedc729c53c8ebd0fbe6.zip
fluxbox_lack-a65f840b68aabf79df22aedc729c53c8ebd0fbe6.tar.bz2
dont overlap with screenborder
added xinerama-support
Diffstat (limited to 'util')
-rw-r--r--util/fbrun/main.cc48
1 files changed, 44 insertions, 4 deletions
diff --git a/util/fbrun/main.cc b/util/fbrun/main.cc
index f032486..c808628 100644
--- a/util/fbrun/main.cc
+++ b/util/fbrun/main.cc
@@ -26,6 +26,12 @@
26#include "StringUtil.hh" 26#include "StringUtil.hh"
27#include "Color.hh" 27#include "Color.hh"
28 28
29#ifdef XINERAMA
30extern "C" {
31#include <X11/extensions/Xinerama.h>
32}
33#endif // XINERAMA
34
29#include <string> 35#include <string>
30#include <iostream> 36#include <iostream>
31 37
@@ -158,10 +164,44 @@ int main(int argc, char **argv) {
158 &ret_win, &child_win, 164 &ret_win, &child_win,
159 &x, &y, &wx, &wy, &mask)) { 165 &x, &y, &wx, &wy, &mask)) {
160 166
161 if ( x - (fbrun.width()/2) > 0 ) 167 int root_x = 0;
162 x-= fbrun.width()/2; 168 int root_y = 0;
163 if ( y - (fbrun.height()/2) > 0 ) 169 unsigned int root_w = WidthOfScreen(DefaultScreenOfDisplay(dpy));
164 y-= fbrun.height()/2; 170 unsigned int root_h = HeightOfScreen(DefaultScreenOfDisplay(dpy));
171#ifdef XINERAMA
172 if(XineramaIsActive(dpy)) {
173 XineramaScreenInfo* screen_info = 0;
174 int number = 0;
175 screen_info = XineramaQueryScreens(dpy, &number);
176 if (screen_info) {
177 for(int i= 0; i < number; i++) {
178 if (x >= screen_info[i].x_org &&
179 x < screen_info[i].x_org + screen_info[i].width &&
180 y >= screen_info[i].y_org &&
181 y < screen_info[i].y_org + screen_info[i].height) {
182 root_x = screen_info[i].x_org;
183 root_y = screen_info[i].y_org;
184 root_w = screen_info[i].width;
185 root_h = screen_info[i].height;
186 break;
187 }
188 }
189
190 XFree(screen_info);
191 }
192 }
193#endif // XINERAMA
194 x-= fbrun.width()/2;
195 y-= fbrun.height()/2;
196
197 if (x < root_x)
198 x = root_x;
199 if (x + fbrun.width() > root_x + root_w)
200 x = root_x + root_w - fbrun.width();
201 if (y < root_y)
202 y = root_y;
203 if (y + fbrun.height() > root_y + root_h)
204 y = root_y + root_h - fbrun.height();
165 } 205 }
166 } 206 }
167 207