80 for (
int i = childList.
size(); i > 0 ;) {
106 screens(0), rects(0), workareas(0)
129 int newScreenCount = ScreenCount(
X11->display);
130 #ifndef QT_NO_XINERAMA 132 XineramaScreenInfo *xinerama_screeninfo = 0;
136 if (newScreenCount == 1
137 &&
X11->ptrXineramaQueryExtension
138 &&
X11->ptrXineramaIsActive
139 &&
X11->ptrXineramaQueryScreens) {
142 &&
X11->ptrXineramaIsActive(
X11->display));
146 xinerama_screeninfo =
147 X11->ptrXineramaQueryScreens(
X11->display, &newScreenCount);
150 if (xinerama_screeninfo) {
153 #endif // QT_NO_XINERAMA 156 newScreenCount = ScreenCount(
X11->display);
166 int i, j, x, y, w, h;
167 for (i = 0, j = 0; i < newScreenCount; i++, j++) {
169 #ifndef QT_NO_XINERAMA 171 x = xinerama_screeninfo[i].x_org;
172 y = xinerama_screeninfo[i].y_org;
173 w = xinerama_screeninfo[i].
width;
174 h = xinerama_screeninfo[i].height;
176 #endif // QT_NO_XINERAMA 180 w = WidthOfScreen(ScreenOfDisplay(
X11->display, i));
181 h = HeightOfScreen(ScreenOfDisplay(
X11->display, i));
184 rects[j].setRect(x, y, w, h);
207 #ifndef QT_NO_XINERAMA 211 if (xinerama_screeninfo)
212 XFree(xinerama_screeninfo);
213 #endif // QT_NO_XINERAMA 233 return d->use_xinerama;
239 return d->defaultScreen;
245 return d->screenCount;
254 if (screen < 0 || screen >=
d->screenCount)
255 screen =
d->defaultScreen;
259 d->screens[
d->defaultScreen] =
this;
262 if (!
d->screens[screen] ||
269 return d->screens[screen];
277 for (
int i = 0; i <
d->screenCount; ++i)
278 d->workareas[i] =
QRect();
282 if (screen < 0 || screen >=
d->screenCount)
283 screen =
d->defaultScreen;
285 if (
d->workareas[screen].isValid())
286 return d->workareas[screen];
289 int x11Screen = isVirtualDesktop() ? DefaultScreen(
X11->display) : screen;
293 unsigned char *
data = 0;
294 unsigned long nitems, after;
296 e = XGetWindowProperty(
X11->display,
299 &ret, &format, &nitems, &after, &data);
302 if (e ==
Success && ret == XA_CARDINAL &&
303 format == 32 && nitems == 4) {
304 long *workarea = (
long *) data;
305 workArea =
QRect(workarea[0], workarea[1], workarea[2], workarea[3]);
310 if (isVirtualDesktop()) {
316 d->workareas[screen] = workArea;
324 return d->workareas[screen];
330 if (screen < 0 || screen >=
d->screenCount)
331 screen =
d->defaultScreen;
333 return d->rects[screen];
340 return d->defaultScreen;
342 #ifndef QT_NO_XINERAMA 343 if (
d->use_xinerama) {
352 for (
int i = 0; i <
d->screenCount; ++i) {
353 QRect sect =
d->rects[i].intersected(frame);
355 if (size > maxSize && sect.
width() > 0 && sect.
height() > 0) {
362 #endif // QT_NO_XINERAMA 370 int closestScreen = -1;
371 int shortestDistance =
INT_MAX;
372 for (
int i = 0; i <
d->screenCount; ++i) {
373 int thisDistance =
d->pointToRect(point,
d->rects[i]);
374 if (thisDistance < shortestDistance) {
375 shortestDistance = thisDistance;
379 return closestScreen;
385 int oldScreenCount =
d->screenCount;
387 for (
int i = 0; i < oldScreenCount; ++i) {
388 oldRects[i] =
d->rects[i];
393 for (
int i = 0; i <
qMin(oldScreenCount,
d->screenCount); ++i) {
394 if (oldRects.
at(i) !=
d->rects[i])
398 if (oldScreenCount !=
d->screenCount) {
399 emit screenCountChanged(
d->screenCount);
Q_DECL_CONSTEXPR const T & qMin(const T &a, const T &b)
#define QT_END_NAMESPACE
This macro expands to.
QPointer< QWidget > widget
static Qt::HANDLE appRootWindow(int screen=-1)
Returns a handle for the applications root window on the given screen.
int width() const
Returns the width of the rectangle.
int height() const
Returns the height of the rectangle.
void setParent(QObject *)
Makes the object a child of parent.
#define QT_BEGIN_NAMESPACE
This macro expands to.
const T & at(int i) const
Returns the item at index position i in the list.
The QResizeEvent class contains event parameters for resize events.
void moveTopLeft(const QPoint &p)
Moves the rectangle, leaving the top-left corner at the given position.
const T & at(int i) const
Returns the item at index position i in the vector.
The QPoint class defines a point in the plane using integer precision.
int size() const
Returns the number of items in the list.
if(void) toggleToolbarShown
The QRect class defines a rectangle in the plane using integer precision.
const QObjectList & children() const
Returns a list of child objects.
int screen() const
Returns the number of the screen currently in use.