| 1 | /****************************************************************************
|
|---|
| 2 | **
|
|---|
| 3 | ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
|---|
| 4 | ** Contact: Qt Software Information (qt-info@nokia.com)
|
|---|
| 5 | **
|
|---|
| 6 | ** This file is part of the QtGui module of the Qt Toolkit.
|
|---|
| 7 | **
|
|---|
| 8 | ** $QT_BEGIN_LICENSE:LGPL$
|
|---|
| 9 | ** Commercial Usage
|
|---|
| 10 | ** Licensees holding valid Qt Commercial licenses may use this file in
|
|---|
| 11 | ** accordance with the Qt Commercial License Agreement provided with the
|
|---|
| 12 | ** Software or, alternatively, in accordance with the terms contained in
|
|---|
| 13 | ** a written agreement between you and Nokia.
|
|---|
| 14 | **
|
|---|
| 15 | ** GNU Lesser General Public License Usage
|
|---|
| 16 | ** Alternatively, this file may be used under the terms of the GNU Lesser
|
|---|
| 17 | ** General Public License version 2.1 as published by the Free Software
|
|---|
| 18 | ** Foundation and appearing in the file LICENSE.LGPL included in the
|
|---|
| 19 | ** packaging of this file. Please review the following information to
|
|---|
| 20 | ** ensure the GNU Lesser General Public License version 2.1 requirements
|
|---|
| 21 | ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
|---|
| 22 | **
|
|---|
| 23 | ** In addition, as a special exception, Nokia gives you certain
|
|---|
| 24 | ** additional rights. These rights are described in the Nokia Qt LGPL
|
|---|
| 25 | ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
|
|---|
| 26 | ** package.
|
|---|
| 27 | **
|
|---|
| 28 | ** GNU General Public License Usage
|
|---|
| 29 | ** Alternatively, this file may be used under the terms of the GNU
|
|---|
| 30 | ** General Public License version 3.0 as published by the Free Software
|
|---|
| 31 | ** Foundation and appearing in the file LICENSE.GPL included in the
|
|---|
| 32 | ** packaging of this file. Please review the following information to
|
|---|
| 33 | ** ensure the GNU General Public License version 3.0 requirements will be
|
|---|
| 34 | ** met: http://www.gnu.org/copyleft/gpl.html.
|
|---|
| 35 | **
|
|---|
| 36 | ** If you are unsure which license is appropriate for your use, please
|
|---|
| 37 | ** contact the sales department at qt-sales@nokia.com.
|
|---|
| 38 | ** $QT_END_LICENSE$
|
|---|
| 39 | **
|
|---|
| 40 | ****************************************************************************/
|
|---|
| 41 |
|
|---|
| 42 | #include "qwidget.h"
|
|---|
| 43 | #include "qpixmap.h"
|
|---|
| 44 | #include "qx11info_x11.h"
|
|---|
| 45 | #include "qt_x11_p.h"
|
|---|
| 46 |
|
|---|
| 47 | QT_BEGIN_NAMESPACE
|
|---|
| 48 |
|
|---|
| 49 | /*!
|
|---|
| 50 | \class QX11Info
|
|---|
| 51 | \brief The QX11Info class provides information about the X display
|
|---|
| 52 | configuration.
|
|---|
| 53 |
|
|---|
| 54 | \ingroup shared
|
|---|
| 55 |
|
|---|
| 56 | The class provides two APIs: a set of non-static functions that
|
|---|
| 57 | provide information about a specific widget or pixmap, and a set
|
|---|
| 58 | of static functions that provide the default information for the
|
|---|
| 59 | application.
|
|---|
| 60 |
|
|---|
| 61 | \warning This class is only available on X11. For querying
|
|---|
| 62 | per-screen information in a portable way, use QDesktopWidget.
|
|---|
| 63 |
|
|---|
| 64 | \sa QWidget::x11Info(), QPixmap::x11Info(), QDesktopWidget
|
|---|
| 65 | */
|
|---|
| 66 |
|
|---|
| 67 | /*!
|
|---|
| 68 | Constructs an empty QX11Info object.
|
|---|
| 69 | */
|
|---|
| 70 | QX11Info::QX11Info()
|
|---|
| 71 | : x11data(0)
|
|---|
| 72 | {
|
|---|
| 73 | }
|
|---|
| 74 |
|
|---|
| 75 | /*!
|
|---|
| 76 | Constructs a copy of \a other.
|
|---|
| 77 | */
|
|---|
| 78 | QX11Info::QX11Info(const QX11Info &other)
|
|---|
| 79 | {
|
|---|
| 80 | x11data = other.x11data;
|
|---|
| 81 | if (x11data)
|
|---|
| 82 | ++x11data->ref;
|
|---|
| 83 | }
|
|---|
| 84 |
|
|---|
| 85 | /*!
|
|---|
| 86 | Assigns \a other to this object and returns a reference to this
|
|---|
| 87 | object.
|
|---|
| 88 | */
|
|---|
| 89 | QX11Info &QX11Info::operator=(const QX11Info &other)
|
|---|
| 90 | {
|
|---|
| 91 | if (other.x11data)
|
|---|
| 92 | ++other.x11data->ref;
|
|---|
| 93 | if (x11data && !--x11data->ref)
|
|---|
| 94 | delete x11data;
|
|---|
| 95 | x11data = other.x11data;
|
|---|
| 96 | return *this;
|
|---|
| 97 | }
|
|---|
| 98 |
|
|---|
| 99 | /*!
|
|---|
| 100 | Destroys the QX11Info object.
|
|---|
| 101 | */
|
|---|
| 102 | QX11Info::~QX11Info()
|
|---|
| 103 | {
|
|---|
| 104 | if (x11data && !--x11data->ref)
|
|---|
| 105 | delete x11data;
|
|---|
| 106 | }
|
|---|
| 107 |
|
|---|
| 108 | /*!
|
|---|
| 109 | \internal
|
|---|
| 110 | Makes a shallow copy of the X11-specific data of \a fromDevice, if it is not
|
|---|
| 111 | null. Otherwise this function sets it to null.
|
|---|
| 112 | */
|
|---|
| 113 |
|
|---|
| 114 | void QX11Info::copyX11Data(const QPaintDevice *fromDevice)
|
|---|
| 115 | {
|
|---|
| 116 | QX11InfoData *xd = 0;
|
|---|
| 117 | if (fromDevice) {
|
|---|
| 118 | if (fromDevice->devType() == QInternal::Widget)
|
|---|
| 119 | xd = static_cast<const QWidget *>(fromDevice)->x11Info().x11data;
|
|---|
| 120 | else if (fromDevice->devType() == QInternal::Pixmap)
|
|---|
| 121 | xd = static_cast<const QPixmap *>(fromDevice)->x11Info().x11data;
|
|---|
| 122 | }
|
|---|
| 123 | setX11Data(xd);
|
|---|
| 124 | }
|
|---|
| 125 |
|
|---|
| 126 | /*!
|
|---|
| 127 | \internal
|
|---|
| 128 | Makes a deep copy of the X11-specific data of \a fromDevice, if it is not
|
|---|
| 129 | null. Otherwise this function sets it to null.
|
|---|
| 130 | */
|
|---|
| 131 |
|
|---|
| 132 | void QX11Info::cloneX11Data(const QPaintDevice *fromDevice)
|
|---|
| 133 | {
|
|---|
| 134 | QX11InfoData *d = 0;
|
|---|
| 135 | if (fromDevice) {
|
|---|
| 136 | QX11InfoData *xd;
|
|---|
| 137 | if (fromDevice->devType() == QInternal::Widget) {
|
|---|
| 138 | xd = static_cast<const QWidget *>(fromDevice)->x11Info().x11data;
|
|---|
| 139 | } else {
|
|---|
| 140 | Q_ASSERT(fromDevice->devType() == QInternal::Pixmap);
|
|---|
| 141 | xd = static_cast<const QPixmap *>(fromDevice)->x11Info().x11data;
|
|---|
| 142 | }
|
|---|
| 143 | d = new QX11InfoData(*xd);
|
|---|
| 144 | d->ref = 0;
|
|---|
| 145 | }
|
|---|
| 146 | setX11Data(d);
|
|---|
| 147 | }
|
|---|
| 148 |
|
|---|
| 149 | /*!
|
|---|
| 150 | \internal
|
|---|
| 151 | Makes a shallow copy of the X11-specific data \a d and assigns it to this
|
|---|
| 152 | class. This function increments the reference code of \a d.
|
|---|
| 153 | */
|
|---|
| 154 |
|
|---|
| 155 | void QX11Info::setX11Data(const QX11InfoData* d)
|
|---|
| 156 | {
|
|---|
| 157 | if (x11data && !--x11data->ref)
|
|---|
| 158 | delete x11data;
|
|---|
| 159 | x11data = (QX11InfoData *)d;
|
|---|
| 160 | if (x11data)
|
|---|
| 161 | ++x11data->ref;
|
|---|
| 162 | }
|
|---|
| 163 |
|
|---|
| 164 |
|
|---|
| 165 | /*!
|
|---|
| 166 | \internal
|
|---|
| 167 | If \a def is false, returns a deep copy of the x11Data, or 0 if x11Data is 0.
|
|---|
| 168 | If \a def is true, makes a QX11Data struct filled with the default
|
|---|
| 169 | values.
|
|---|
| 170 |
|
|---|
| 171 | In either case the caller is responsible for deleting the returned
|
|---|
| 172 | struct. But notice that the struct is a shared class, so other
|
|---|
| 173 | classes might also have a reference to it. The reference count of
|
|---|
| 174 | the returned QX11Data* is 0.
|
|---|
| 175 | */
|
|---|
| 176 |
|
|---|
| 177 | QX11InfoData* QX11Info::getX11Data(bool def) const
|
|---|
| 178 | {
|
|---|
| 179 | QX11InfoData* res = 0;
|
|---|
| 180 | if (def) {
|
|---|
| 181 | res = new QX11InfoData;
|
|---|
| 182 | res->screen = appScreen();
|
|---|
| 183 | res->depth = appDepth();
|
|---|
| 184 | res->cells = appCells();
|
|---|
| 185 | res->colormap = colormap();
|
|---|
| 186 | res->defaultColormap = appDefaultColormap();
|
|---|
| 187 | res->visual = (Visual*) appVisual();
|
|---|
| 188 | res->defaultVisual = appDefaultVisual();
|
|---|
| 189 | } else if (x11data) {
|
|---|
| 190 | res = new QX11InfoData;
|
|---|
| 191 | *res = *x11data;
|
|---|
| 192 | }
|
|---|
| 193 | res->ref = 0;
|
|---|
| 194 | return res;
|
|---|
| 195 | }
|
|---|
| 196 |
|
|---|
| 197 | /*!
|
|---|
| 198 | Returns the horizontal resolution of the given \a screen in terms of the
|
|---|
| 199 | number of dots per inch.
|
|---|
| 200 |
|
|---|
| 201 | The \a screen argument is an X screen number. Be aware that if
|
|---|
| 202 | the user's system uses Xinerama (as opposed to traditional X11
|
|---|
| 203 | multiscreen), there is only one X screen. Use QDesktopWidget to
|
|---|
| 204 | query for information about Xinerama screens.
|
|---|
| 205 |
|
|---|
| 206 | \sa setAppDpiX(), appDpiY()
|
|---|
| 207 | */
|
|---|
| 208 | int QX11Info::appDpiX(int screen)
|
|---|
| 209 | {
|
|---|
| 210 | if (!X11)
|
|---|
| 211 | return 75;
|
|---|
| 212 | if (screen < 0)
|
|---|
| 213 | screen = X11->defaultScreen;
|
|---|
| 214 | if (screen > X11->screenCount)
|
|---|
| 215 | return 0;
|
|---|
| 216 | return X11->screens[screen].dpiX;
|
|---|
| 217 | }
|
|---|
| 218 |
|
|---|
| 219 | /*!
|
|---|
| 220 | Sets the horizontal resolution of the given \a screen to the number of
|
|---|
| 221 | dots per inch specified by \a xdpi.
|
|---|
| 222 |
|
|---|
| 223 | The \a screen argument is an X screen number. Be aware that if
|
|---|
| 224 | the user's system uses Xinerama (as opposed to traditional X11
|
|---|
| 225 | multiscreen), there is only one X screen. Use QDesktopWidget to
|
|---|
| 226 | query for information about Xinerama screens.
|
|---|
| 227 |
|
|---|
| 228 | \sa appDpiX(), setAppDpiY()
|
|---|
| 229 | */
|
|---|
| 230 |
|
|---|
| 231 | void QX11Info::setAppDpiX(int screen, int xdpi)
|
|---|
| 232 | {
|
|---|
| 233 | if (!X11)
|
|---|
| 234 | return;
|
|---|
| 235 | if (screen < 0)
|
|---|
| 236 | screen = X11->defaultScreen;
|
|---|
| 237 | if (screen > X11->screenCount)
|
|---|
| 238 | return;
|
|---|
| 239 | X11->screens[screen].dpiX = xdpi;
|
|---|
| 240 | }
|
|---|
| 241 |
|
|---|
| 242 | /*!
|
|---|
| 243 | Returns the vertical resolution of the given \a screen in terms of the
|
|---|
| 244 | number of dots per inch.
|
|---|
| 245 |
|
|---|
| 246 | The \a screen argument is an X screen number. Be aware that if
|
|---|
| 247 | the user's system uses Xinerama (as opposed to traditional X11
|
|---|
| 248 | multiscreen), there is only one X screen. Use QDesktopWidget to
|
|---|
| 249 | query for information about Xinerama screens.
|
|---|
| 250 |
|
|---|
| 251 | \sa setAppDpiY(), appDpiX()
|
|---|
| 252 | */
|
|---|
| 253 |
|
|---|
| 254 | int QX11Info::appDpiY(int screen)
|
|---|
| 255 | {
|
|---|
| 256 | if (!X11)
|
|---|
| 257 | return 75;
|
|---|
| 258 | if (screen < 0)
|
|---|
| 259 | screen = X11->defaultScreen;
|
|---|
| 260 | if (screen > X11->screenCount)
|
|---|
| 261 | return 0;
|
|---|
| 262 | return X11->screens[screen].dpiY;
|
|---|
| 263 | }
|
|---|
| 264 |
|
|---|
| 265 | /*!
|
|---|
| 266 | Sets the vertical resolution of the given \a screen to the number of
|
|---|
| 267 | dots per inch specified by \a ydpi.
|
|---|
| 268 |
|
|---|
| 269 | The \a screen argument is an X screen number. Be aware that if
|
|---|
| 270 | the user's system uses Xinerama (as opposed to traditional X11
|
|---|
| 271 | multiscreen), there is only one X screen. Use QDesktopWidget to
|
|---|
| 272 | query for information about Xinerama screens.
|
|---|
| 273 |
|
|---|
| 274 | \sa appDpiY(), setAppDpiX()
|
|---|
| 275 | */
|
|---|
| 276 | void QX11Info::setAppDpiY(int screen, int ydpi)
|
|---|
| 277 | {
|
|---|
| 278 | if (!X11)
|
|---|
| 279 | return;
|
|---|
| 280 | if (screen < 0)
|
|---|
| 281 | screen = X11->defaultScreen;
|
|---|
| 282 | if (screen > X11->screenCount)
|
|---|
| 283 | return;
|
|---|
| 284 | X11->screens[screen].dpiY = ydpi;
|
|---|
| 285 | }
|
|---|
| 286 |
|
|---|
| 287 | /*!
|
|---|
| 288 | Returns the X11 time.
|
|---|
| 289 |
|
|---|
| 290 | \sa setAppTime(), appUserTime()
|
|---|
| 291 | */
|
|---|
| 292 | unsigned long QX11Info::appTime()
|
|---|
| 293 | {
|
|---|
| 294 | return X11 ? X11->time : 0;
|
|---|
| 295 | }
|
|---|
| 296 |
|
|---|
| 297 | /*!
|
|---|
| 298 | Sets the X11 time to the value specified by \a time.
|
|---|
| 299 |
|
|---|
| 300 | \sa appTime(), setAppUserTime()
|
|---|
| 301 | */
|
|---|
| 302 | void QX11Info::setAppTime(unsigned long time)
|
|---|
| 303 | {
|
|---|
| 304 | if (X11) {
|
|---|
| 305 | X11->time = time;
|
|---|
| 306 | }
|
|---|
| 307 | }
|
|---|
| 308 |
|
|---|
| 309 | /*!
|
|---|
| 310 | Returns the X11 user time.
|
|---|
| 311 |
|
|---|
| 312 | \sa setAppUserTime(), appTime()
|
|---|
| 313 | */
|
|---|
| 314 | unsigned long QX11Info::appUserTime()
|
|---|
| 315 | {
|
|---|
| 316 | return X11 ? X11->userTime : 0;
|
|---|
| 317 | }
|
|---|
| 318 |
|
|---|
| 319 | /*!
|
|---|
| 320 | Sets the X11 user time as specified by \a time.
|
|---|
| 321 |
|
|---|
| 322 | \sa appUserTime(), setAppTime()
|
|---|
| 323 | */
|
|---|
| 324 | void QX11Info::setAppUserTime(unsigned long time)
|
|---|
| 325 | {
|
|---|
| 326 | if (X11) {
|
|---|
| 327 | X11->userTime = time;
|
|---|
| 328 | }
|
|---|
| 329 | }
|
|---|
| 330 |
|
|---|
| 331 |
|
|---|
| 332 | /*!
|
|---|
| 333 | \fn const char *QX11Info::appClass()
|
|---|
| 334 |
|
|---|
| 335 | Returns the X11 application class.
|
|---|
| 336 |
|
|---|
| 337 | \sa display()
|
|---|
| 338 | */
|
|---|
| 339 |
|
|---|
| 340 | /*!
|
|---|
| 341 | Returns the default display for the application.
|
|---|
| 342 |
|
|---|
| 343 | \sa appScreen()
|
|---|
| 344 | */
|
|---|
| 345 |
|
|---|
| 346 | Display *QX11Info::display()
|
|---|
| 347 | {
|
|---|
| 348 | return X11 ? X11->display : 0;
|
|---|
| 349 | }
|
|---|
| 350 |
|
|---|
| 351 | /*!
|
|---|
| 352 | Returns the number of the screen where the application is being
|
|---|
| 353 | displayed.
|
|---|
| 354 |
|
|---|
| 355 | \sa display(), screen()
|
|---|
| 356 | */
|
|---|
| 357 | int QX11Info::appScreen()
|
|---|
| 358 | {
|
|---|
| 359 | return X11 ? X11->defaultScreen : 0;
|
|---|
| 360 | }
|
|---|
| 361 |
|
|---|
| 362 | /*!
|
|---|
| 363 | Returns a handle for the application's color map on the given \a screen.
|
|---|
| 364 |
|
|---|
| 365 | The \a screen argument is an X screen number. Be aware that if
|
|---|
| 366 | the user's system uses Xinerama (as opposed to traditional X11
|
|---|
| 367 | multiscreen), there is only one X screen. Use QDesktopWidget to
|
|---|
| 368 | query for information about Xinerama screens.
|
|---|
| 369 |
|
|---|
| 370 | \sa colormap(), defaultColormap()
|
|---|
| 371 | */
|
|---|
| 372 | Qt::HANDLE QX11Info::appColormap(int screen)
|
|---|
| 373 | {
|
|---|
| 374 | return X11 ? X11->screens[screen == -1 ? X11->defaultScreen : screen].colormap : 0;
|
|---|
| 375 | }
|
|---|
| 376 |
|
|---|
| 377 | /*!
|
|---|
| 378 | Returns the current visual used by the application on the given
|
|---|
| 379 | \a screen.
|
|---|
| 380 |
|
|---|
| 381 | The \a screen argument is an X screen number. Be aware that if
|
|---|
| 382 | the user's system uses Xinerama (as opposed to traditional X11
|
|---|
| 383 | multiscreen), there is only one X screen. Use QDesktopWidget to
|
|---|
| 384 | query for information about Xinerama screens.
|
|---|
| 385 |
|
|---|
| 386 | \sa visual(), defaultVisual()
|
|---|
| 387 | */
|
|---|
| 388 |
|
|---|
| 389 | void *QX11Info::appVisual(int screen)
|
|---|
| 390 | {
|
|---|
| 391 | return X11 ? X11->screens[screen == -1 ? X11->defaultScreen : screen].visual : 0;
|
|---|
| 392 | }
|
|---|
| 393 |
|
|---|
| 394 | /*!
|
|---|
| 395 | Returns a handle for the applications root window on the given \a screen.
|
|---|
| 396 |
|
|---|
| 397 | The \a screen argument is an X screen number. Be aware that if
|
|---|
| 398 | the user's system uses Xinerama (as opposed to traditional X11
|
|---|
| 399 | multiscreen), there is only one X screen. Use QDesktopWidget to
|
|---|
| 400 | query for information about Xinerama screens.
|
|---|
| 401 |
|
|---|
| 402 | \sa QApplication::desktop()
|
|---|
| 403 | */
|
|---|
| 404 | Qt::HANDLE QX11Info::appRootWindow(int screen)
|
|---|
| 405 | {
|
|---|
| 406 | return X11 ? RootWindow(X11->display, screen == -1 ? X11->defaultScreen : screen) : 0;
|
|---|
| 407 | }
|
|---|
| 408 |
|
|---|
| 409 | /*!
|
|---|
| 410 | Returns the color depth (bits per pixel) used by the application on the
|
|---|
| 411 | given \a screen.
|
|---|
| 412 |
|
|---|
| 413 | The \a screen argument is an X screen number. Be aware that if
|
|---|
| 414 | the user's system uses Xinerama (as opposed to traditional X11
|
|---|
| 415 | multiscreen), there is only one X screen. Use QDesktopWidget to
|
|---|
| 416 | query for information about Xinerama screens.
|
|---|
| 417 |
|
|---|
| 418 | \sa depth()
|
|---|
| 419 | */
|
|---|
| 420 |
|
|---|
| 421 | int QX11Info::appDepth(int screen)
|
|---|
| 422 | {
|
|---|
| 423 | return X11 ? X11->screens[screen == -1 ? X11->defaultScreen : screen].depth : 32;
|
|---|
| 424 | }
|
|---|
| 425 |
|
|---|
| 426 | /*!
|
|---|
| 427 | Returns the number of cells used by the application on the given \a screen.
|
|---|
| 428 |
|
|---|
| 429 | The \a screen argument is an X screen number. Be aware that if
|
|---|
| 430 | the user's system uses Xinerama (as opposed to traditional X11
|
|---|
| 431 | multiscreen), there is only one X screen. Use QDesktopWidget to
|
|---|
| 432 | query for information about Xinerama screens.
|
|---|
| 433 |
|
|---|
| 434 | \sa cells()
|
|---|
| 435 | */
|
|---|
| 436 |
|
|---|
| 437 | int QX11Info::appCells(int screen)
|
|---|
| 438 | { return X11 ? X11->screens[screen == -1 ? X11->defaultScreen : screen].cells : 0; }
|
|---|
| 439 |
|
|---|
| 440 | /*!
|
|---|
| 441 | Returns true if the application has a default color map on the given
|
|---|
| 442 | \a screen; otherwise returns false.
|
|---|
| 443 |
|
|---|
| 444 | The \a screen argument is an X screen number. Be aware that if
|
|---|
| 445 | the user's system uses Xinerama (as opposed to traditional X11
|
|---|
| 446 | multiscreen), there is only one X screen. Use QDesktopWidget to
|
|---|
| 447 | query for information about Xinerama screens.
|
|---|
| 448 | */
|
|---|
| 449 | bool QX11Info::appDefaultColormap(int screen)
|
|---|
| 450 | { return X11 ? X11->screens[screen == -1 ? X11->defaultScreen : screen].defaultColormap : true; }
|
|---|
| 451 |
|
|---|
| 452 | /*!
|
|---|
| 453 | Returns true if the application has a default visual on the given \a screen;
|
|---|
| 454 | otherwise returns false.
|
|---|
| 455 |
|
|---|
| 456 | The \a screen argument is an X screen number. Be aware that if
|
|---|
| 457 | the user's system uses Xinerama (as opposed to traditional X11
|
|---|
| 458 | multiscreen), there is only one X screen. Use QDesktopWidget to
|
|---|
| 459 | query for information about Xinerama screens.
|
|---|
| 460 | */
|
|---|
| 461 | bool QX11Info::appDefaultVisual(int screen)
|
|---|
| 462 | { return X11 ? X11->screens[screen == -1 ? X11->defaultScreen : screen].defaultVisual : true; }
|
|---|
| 463 |
|
|---|
| 464 | /*!
|
|---|
| 465 | Returns the number of the screen currently in use.
|
|---|
| 466 |
|
|---|
| 467 | The return value is an X screen number. Be aware that if the
|
|---|
| 468 | user's system uses Xinerama (as opposed to traditional X11
|
|---|
| 469 | multiscreen), there is only one X screen. Use QDesktopWidget to
|
|---|
| 470 | query for information about Xinerama screens.
|
|---|
| 471 |
|
|---|
| 472 | \sa appScreen()
|
|---|
| 473 | */
|
|---|
| 474 | int QX11Info::screen() const
|
|---|
| 475 | { return x11data ? x11data->screen : QX11Info::appScreen(); }
|
|---|
| 476 |
|
|---|
| 477 | /*!
|
|---|
| 478 | Returns the color depth (bits per pixel) of the X display.
|
|---|
| 479 |
|
|---|
| 480 | \sa appDepth()
|
|---|
| 481 | */
|
|---|
| 482 |
|
|---|
| 483 | int QX11Info::depth() const
|
|---|
| 484 | { return x11data ? x11data->depth : QX11Info::appDepth(); }
|
|---|
| 485 |
|
|---|
| 486 | /*!
|
|---|
| 487 | Returns the number of cells.
|
|---|
| 488 |
|
|---|
| 489 | \sa appCells()
|
|---|
| 490 | */
|
|---|
| 491 |
|
|---|
| 492 | int QX11Info::cells() const
|
|---|
| 493 | { return x11data ? x11data->cells : QX11Info::appCells(); }
|
|---|
| 494 |
|
|---|
| 495 | /*!
|
|---|
| 496 | Returns a handle for the color map.
|
|---|
| 497 |
|
|---|
| 498 | \sa defaultColormap()
|
|---|
| 499 | */
|
|---|
| 500 |
|
|---|
| 501 | Qt::HANDLE QX11Info::colormap() const
|
|---|
| 502 | { return x11data ? x11data->colormap : QX11Info::appColormap(); }
|
|---|
| 503 |
|
|---|
| 504 | /*!
|
|---|
| 505 | Returns true if there is a default color map; otherwise returns false.
|
|---|
| 506 |
|
|---|
| 507 | \sa colormap()
|
|---|
| 508 | */
|
|---|
| 509 |
|
|---|
| 510 | bool QX11Info::defaultColormap() const
|
|---|
| 511 | { return x11data ? x11data->defaultColormap : QX11Info::appDefaultColormap(); }
|
|---|
| 512 |
|
|---|
| 513 | /*!
|
|---|
| 514 | Returns the current visual.
|
|---|
| 515 |
|
|---|
| 516 | \sa appVisual(), defaultVisual()
|
|---|
| 517 | */
|
|---|
| 518 |
|
|---|
| 519 | void *QX11Info::visual() const
|
|---|
| 520 | { return x11data ? x11data->visual : QX11Info::appVisual(); }
|
|---|
| 521 |
|
|---|
| 522 | /*!
|
|---|
| 523 | Returns true if there is a default visual; otherwise returns false.
|
|---|
| 524 |
|
|---|
| 525 | \sa visual(), appVisual()
|
|---|
| 526 | */
|
|---|
| 527 |
|
|---|
| 528 | bool QX11Info::defaultVisual() const
|
|---|
| 529 | { return x11data ? x11data->defaultVisual : QX11Info::appDefaultVisual(); }
|
|---|
| 530 |
|
|---|
| 531 |
|
|---|
| 532 | /*!
|
|---|
| 533 | \since 4.4
|
|---|
| 534 |
|
|---|
| 535 | Returns true if there is a compositing manager running.
|
|---|
| 536 | */
|
|---|
| 537 | bool QX11Info::isCompositingManagerRunning()
|
|---|
| 538 | {
|
|---|
| 539 | return X11 ? X11->compositingManagerRunning : false;
|
|---|
| 540 | }
|
|---|
| 541 |
|
|---|
| 542 | QT_END_NAMESPACE
|
|---|