Qt 4.8
Public Functions | Static Public Functions | Protected Functions | Protected Variables | Friends | List of all members
QX11Info Class Reference

The QX11Info class provides information about the X display configuration. More...

#include <qx11info_x11.h>

Public Functions

int cells () const
 Returns the number of cells. More...
 
Qt::HANDLE colormap () const
 Returns a handle for the color map. More...
 
bool defaultColormap () const
 Returns true if there is a default color map; otherwise returns false. More...
 
bool defaultVisual () const
 Returns true if there is a default visual; otherwise returns false. More...
 
int depth () const
 Returns the color depth (bits per pixel) of the X display. More...
 
QX11Infooperator= (const QX11Info &other)
 Assigns other to this object and returns a reference to this object. More...
 
 QX11Info ()
 Constructs an empty QX11Info object. More...
 
 QX11Info (const QX11Info &other)
 Constructs a copy of other. More...
 
int screen () const
 Returns the number of the screen currently in use. More...
 
void * visual () const
 Returns the current visual. More...
 
 ~QX11Info ()
 Destroys the QX11Info object. More...
 

Static Public Functions

static int appCells (int screen=-1)
 Returns the number of cells used by the application on the given screen. More...
 
static const char * appClass ()
 Returns the X11 application class. More...
 
static Qt::HANDLE appColormap (int screen=-1)
 Returns a handle for the application's color map on the given screen. More...
 
static bool appDefaultColormap (int screen=-1)
 Returns true if the application has a default color map on the given screen; otherwise returns false. More...
 
static bool appDefaultVisual (int screen=-1)
 Returns true if the application has a default visual on the given screen; otherwise returns false. More...
 
static int appDepth (int screen=-1)
 Returns the color depth (bits per pixel) used by the application on the given screen. More...
 
static int appDpiX (int screen=-1)
 Returns the horizontal resolution of the given screen in terms of the number of dots per inch. More...
 
static int appDpiY (int screen=-1)
 Returns the vertical resolution of the given screen in terms of the number of dots per inch. More...
 
static Qt::HANDLE appRootWindow (int screen=-1)
 Returns a handle for the applications root window on the given screen. More...
 
static int appScreen ()
 Returns the number of the screen where the application is being displayed. More...
 
static unsigned long appTime ()
 Returns the X11 time. More...
 
static unsigned long appUserTime ()
 Returns the X11 user time. More...
 
static void * appVisual (int screen=-1)
 Returns the current visual used by the application on the given screen. More...
 
static Displaydisplay ()
 Returns the default display for the application. More...
 
static bool isCompositingManagerRunning ()
 Returns true if there is a compositing manager running. More...
 
static void setAppDpiX (int screen, int dpi)
 Sets the horizontal resolution of the given screen to the number of dots per inch specified by xdpi. More...
 
static void setAppDpiY (int screen, int dpi)
 Sets the vertical resolution of the given screen to the number of dots per inch specified by ydpi. More...
 
static void setAppTime (unsigned long time)
 Sets the X11 time to the value specified by time. More...
 
static void setAppUserTime (unsigned long time)
 Sets the X11 user time as specified by time. More...
 

Protected Functions

void cloneX11Data (const QPaintDevice *)
 Makes a deep copy of the X11-specific data of fromDevice, if it is not null. More...
 
void copyX11Data (const QPaintDevice *)
 Makes a shallow copy of the X11-specific data of fromDevice, if it is not null. More...
 
QX11InfoDatagetX11Data (bool def=false) const
 
void setX11Data (const QX11InfoData *)
 Makes a shallow copy of the X11-specific data d and assigns it to this class. More...
 

Protected Variables

QX11InfoDatax11data
 

Friends

class QGLWidget
 
class QPixmap
 
void qt_cleanup ()
 
void qt_init (QApplicationPrivate *priv, int, Display *display, Qt::HANDLE visual, Qt::HANDLE colormap)
 
void qt_x11_getX11InfoForWindow (QX11Info *xinfo, const QX11WindowAttributes &a)
 
class QWidget
 
class QWidgetPrivate
 
class QX11PaintEngine
 
class QX11PixmapData
 

Detailed Description

The QX11Info class provides information about the X display configuration.

The class provides two APIs: a set of non-static functions that provide information about a specific widget or pixmap, and a set of static functions that provide the default information for the application.

Warning
This class is only available on X11. For querying per-screen information in a portable way, use QDesktopWidget.
See also
QWidget::x11Info(), QPixmap::x11Info(), QDesktopWidget

Definition at line 63 of file qx11info_x11.h.

Constructors and Destructors

◆ QX11Info() [1/2]

QX11Info::QX11Info ( )

Constructs an empty QX11Info object.

Definition at line 73 of file qx11info_x11.cpp.

74  : x11data(0)
75 {
76 }
QX11InfoData * x11data
Definition: qx11info_x11.h:105

◆ ~QX11Info()

QX11Info::~QX11Info ( )

Destroys the QX11Info object.

Definition at line 105 of file qx11info_x11.cpp.

106 {
107  if (x11data && !--x11data->ref)
108  delete x11data;
109 }
QX11InfoData * x11data
Definition: qx11info_x11.h:105

◆ QX11Info() [2/2]

QX11Info::QX11Info ( const QX11Info other)

Constructs a copy of other.

Definition at line 81 of file qx11info_x11.cpp.

82 {
83  x11data = other.x11data;
84  if (x11data)
85  ++x11data->ref;
86 }
QX11InfoData * x11data
Definition: qx11info_x11.h:105

Functions

◆ appCells()

int QX11Info::appCells ( int  screen = -1)
static

Returns the number of cells used by the application on the given screen.

The screen argument is an X screen number. Be aware that if the user's system uses Xinerama (as opposed to traditional X11 multiscreen), there is only one X screen. Use QDesktopWidget to query for information about Xinerama screens.

See also
cells()

Definition at line 450 of file qx11info_x11.cpp.

Referenced by cells(), QX11PixmapData::convertToARGB32(), QX11PixmapData::fromImage(), getX11Data(), QPaintDevice::qt_x11Info(), QX11PixmapData::resize(), and QX11PixmapData::transformed().

451 { return X11 ? X11->screens[screen == -1 ? X11->defaultScreen : screen].cells : 0; }
#define X11
Definition: qt_x11_p.h:724
int screen() const
Returns the number of the screen currently in use.

◆ appClass()

const char * QX11Info::appClass ( )
static

Returns the X11 application class.

See also
display()

Definition at line 2820 of file qapplication_x11.cpp.

Referenced by getNetWmState(), and sm_performSaveYourself().

2821 {
2823 }
static const char * appClass()
Returns the X11 application class.
#define QT_PREPEND_NAMESPACE(name)
This macro qualifies identifier with the full namespace.
Definition: qglobal.h:87

◆ appColormap()

Qt::HANDLE QX11Info::appColormap ( int  screen = -1)
static

Returns a handle for the application's color map on the given screen.

The screen argument is an X screen number. Be aware that if the user's system uses Xinerama (as opposed to traditional X11 multiscreen), there is only one X screen. Use QDesktopWidget to query for information about Xinerama screens.

See also
colormap(), defaultColormap()

Definition at line 385 of file qx11info_x11.cpp.

Referenced by colormap(), QX11PixmapData::convertToARGB32(), QX11PixmapData::fromImage(), qt_gl_choose_cmap(), qt_x11_getX11InfoForWindow(), QPaintDevice::qt_x11Info(), QX11PixmapData::resize(), QColor::setColorFromString(), and QX11PixmapData::transformed().

386 {
387  return X11 ? X11->screens[screen == -1 ? X11->defaultScreen : screen].colormap : 0;
388 }
#define X11
Definition: qt_x11_p.h:724
int screen() const
Returns the number of the screen currently in use.

◆ appDefaultColormap()

bool QX11Info::appDefaultColormap ( int  screen = -1)
static

Returns true if the application has a default color map on the given screen; otherwise returns false.

The screen argument is an X screen number. Be aware that if the user's system uses Xinerama (as opposed to traditional X11 multiscreen), there is only one X screen. Use QDesktopWidget to query for information about Xinerama screens.

Definition at line 462 of file qx11info_x11.cpp.

Referenced by QX11PixmapData::convertToARGB32(), defaultColormap(), QX11PixmapData::fromImage(), getX11Data(), qstring_to_xtp(), QPaintDevice::qt_x11Info(), QX11PixmapData::resize(), and QX11PixmapData::transformed().

463 { return X11 ? X11->screens[screen == -1 ? X11->defaultScreen : screen].defaultColormap : true; }
#define X11
Definition: qt_x11_p.h:724
int screen() const
Returns the number of the screen currently in use.

◆ appDefaultVisual()

bool QX11Info::appDefaultVisual ( int  screen = -1)
static

Returns true if the application has a default visual on the given screen; otherwise returns false.

The screen argument is an X screen number. Be aware that if the user's system uses Xinerama (as opposed to traditional X11 multiscreen), there is only one X screen. Use QDesktopWidget to query for information about Xinerama screens.

Definition at line 474 of file qx11info_x11.cpp.

Referenced by QX11PixmapData::convertToARGB32(), defaultVisual(), QX11PixmapData::fromImage(), getX11Data(), qstring_to_xtp(), QPaintDevice::qt_x11Info(), QX11PixmapData::resize(), and QX11PixmapData::transformed().

475 { return X11 ? X11->screens[screen == -1 ? X11->defaultScreen : screen].defaultVisual : true; }
#define X11
Definition: qt_x11_p.h:724
int screen() const
Returns the number of the screen currently in use.

◆ appDepth()

int QX11Info::appDepth ( int  screen = -1)
static

Returns the color depth (bits per pixel) used by the application on the given screen.

The screen argument is an X screen number. Be aware that if the user's system uses Xinerama (as opposed to traditional X11 multiscreen), there is only one X screen. Use QDesktopWidget to query for information about Xinerama screens.

See also
depth()

Definition at line 434 of file qx11info_x11.cpp.

Referenced by QX11PixmapData::convertToARGB32(), QPixmap::defaultDepth(), depth(), QX11PixmapData::fromImage(), getX11Data(), qt_addPatternProps(), QPaintDevice::qt_x11Info(), QX11PixmapData::resize(), QStyle::standardPalette(), QMotifStyle::standardPalette(), QNativeImage::systemFormat(), QX11PixmapData::transformed(), and QX11PixmapData::x11ConvertToDefaultDepth().

435 {
436  return X11 ? X11->screens[screen == -1 ? X11->defaultScreen : screen].depth : 32;
437 }
#define X11
Definition: qt_x11_p.h:724
int screen() const
Returns the number of the screen currently in use.

◆ appDpiX()

int QX11Info::appDpiX ( int  screen = -1)
static

Returns the horizontal resolution of the given screen in terms of the number of dots per inch.

The screen argument is an X screen number. Be aware that if the user's system uses Xinerama (as opposed to traditional X11 multiscreen), there is only one X screen. Use QDesktopWidget to query for information about Xinerama screens.

See also
setAppDpiX(), appDpiY()

Definition at line 221 of file qx11info_x11.cpp.

Referenced by do_size_hints(), QX11PixmapData::metric(), qt_defaultDpiX(), and QPaintDevice::qt_x11Info().

222 {
223  if (!X11)
224  return 75;
225  if (screen < 0)
226  screen = X11->defaultScreen;
227  if (screen > X11->screenCount)
228  return 0;
229  return X11->screens[screen].dpiX;
230 }
#define X11
Definition: qt_x11_p.h:724
int screen() const
Returns the number of the screen currently in use.

◆ appDpiY()

int QX11Info::appDpiY ( int  screen = -1)
static

Returns the vertical resolution of the given screen in terms of the number of dots per inch.

The screen argument is an X screen number. Be aware that if the user's system uses Xinerama (as opposed to traditional X11 multiscreen), there is only one X screen. Use QDesktopWidget to query for information about Xinerama screens.

See also
setAppDpiY(), appDpiX()

Definition at line 267 of file qx11info_x11.cpp.

Referenced by do_size_hints(), QFontDatabase::loadXlfd(), QX11PixmapData::metric(), QFontDatabase::pointSizes(), qt_defaultDpiY(), qt_FcPatternToQFontDef(), qt_set_x11_resources(), QPaintDevice::qt_x11Info(), and QFontDatabase::smoothSizes().

268 {
269  if (!X11)
270  return 75;
271  if (screen < 0)
272  screen = X11->defaultScreen;
273  if (screen > X11->screenCount)
274  return 0;
275  return X11->screens[screen].dpiY;
276 }
#define X11
Definition: qt_x11_p.h:724
int screen() const
Returns the number of the screen currently in use.

◆ appRootWindow()

Qt::HANDLE QX11Info::appRootWindow ( int  screen = -1)
static

Returns a handle for the applications root window on the given screen.

The screen argument is an X screen number. Be aware that if the user's system uses Xinerama (as opposed to traditional X11 multiscreen), there is only one X screen. Use QDesktopWidget to query for information about Xinerama screens.

See also
QApplication::desktop()

Definition at line 417 of file qx11info_x11.cpp.

Referenced by create_wm_client_leader(), QX11PixmapData::createBitmapFromImage(), QX11Data::findClientWindow(), findRealWindow(), QDesktopWidgetPrivate::init(), QSizeGrip::mousePressEvent(), QCursor::QCursor(), qt_get_net_supported(), qt_get_net_virtual_roots(), qt_save_rootinfo(), qt_set_input_encoding(), qt_set_x11_resources(), qt_x11_apply_settings_in_all_apps(), QPaintDevice::qt_x11Info(), QX11EmbedContainerPrivate::rejectClient(), QApplication::syncX(), QSystemTrayIconSys::sysTrayTracker(), QETWidget::translateConfigEvent(), QX11EmbedWidget::x11Event(), and QApplication::x11ProcessEvent().

418 {
419  return X11 ? RootWindow(X11->display, screen == -1 ? X11->defaultScreen : screen) : 0;
420 }
#define X11
Definition: qt_x11_p.h:724
int screen() const
Returns the number of the screen currently in use.

◆ appScreen()

int QX11Info::appScreen ( )
static

Returns the number of the screen where the application is being displayed.

See also
display(), screen()

Definition at line 370 of file qx11info_x11.cpp.

Referenced by QX11PixmapData::fromImage(), getX11Data(), QSystemTrayIconSys::locateSystemTray(), QFontPrivate::QFontPrivate(), qt_x11_getX11InfoForWindow(), qt_x11_set_fallback_font_family(), QPaintDevice::qt_x11Info(), screen(), and QX11PixmapData::transformed().

371 {
372  return X11 ? X11->defaultScreen : 0;
373 }
#define X11
Definition: qt_x11_p.h:724

◆ appTime()

unsigned long QX11Info::appTime ( )
static

Returns the X11 time.

See also
setAppTime(), appUserTime()

Definition at line 305 of file qx11info_x11.cpp.

306 {
307  return X11 ? X11->time : 0;
308 }
#define X11
Definition: qt_x11_p.h:724

◆ appUserTime()

unsigned long QX11Info::appUserTime ( )
static

Returns the X11 user time.

See also
setAppUserTime(), appTime()

Definition at line 327 of file qx11info_x11.cpp.

Referenced by QGtkStylePrivate::setupGtkFileChooser().

328 {
329  return X11 ? X11->userTime : 0;
330 }
#define X11
Definition: qt_x11_p.h:724

◆ appVisual()

void * QX11Info::appVisual ( int  screen = -1)
static

Returns the current visual used by the application on the given screen.

The screen argument is an X screen number. Be aware that if the user's system uses Xinerama (as opposed to traditional X11 multiscreen), there is only one X screen. Use QDesktopWidget to query for information about Xinerama screens.

See also
visual(), defaultVisual()

Definition at line 402 of file qx11info_x11.cpp.

Referenced by QX11PixmapData::convertToARGB32(), QX11PixmapData::fromImage(), getX11Data(), qt_gl_choose_cmap(), qt_init(), qt_transparent_pixel(), qt_x11_getX11InfoForWindow(), QPaintDevice::qt_x11Info(), QX11PixmapData::resize(), QX11PixmapData::transformed(), and visual().

403 {
404  return X11 ? X11->screens[screen == -1 ? X11->defaultScreen : screen].visual : 0;
405 }
#define X11
Definition: qt_x11_p.h:724
int screen() const
Returns the number of the screen currently in use.

◆ cells()

int QX11Info::cells ( ) const

Returns the number of cells.

See also
appCells()

Definition at line 505 of file qx11info_x11.cpp.

Referenced by QPaintDevice::qt_x11Info().

506 { return x11data ? x11data->cells : QX11Info::appCells(); }
QX11InfoData * x11data
Definition: qx11info_x11.h:105
static int appCells(int screen=-1)
Returns the number of cells used by the application on the given screen.

◆ cloneX11Data()

void QX11Info::cloneX11Data ( const QPaintDevice fromDevice)
protected

Makes a deep copy of the X11-specific data of fromDevice, if it is not null.

Warning
This function is not part of the public interface. Otherwise this function sets it to null.

Definition at line 141 of file qx11info_x11.cpp.

142 {
143  QX11InfoData *d = 0;
144  if (fromDevice) {
145  QX11InfoData *xd;
146  if (fromDevice->devType() == QInternal::Widget) {
147  xd = static_cast<const QWidget *>(fromDevice)->x11Info().x11data;
148  } else {
149  Q_ASSERT(fromDevice->devType() == QInternal::Pixmap);
150  xd = static_cast<const QPixmap *>(fromDevice)->x11Info().x11data;
151  }
152  d = new QX11InfoData(*xd);
153  d->ref = 0;
154  }
155  setX11Data(d);
156 }
double d
Definition: qnumeric_p.h:62
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
virtual int devType() const
Definition: qpaintdevice.h:167
The QPixmap class is an off-screen image representation that can be used as a paint device...
Definition: qpixmap.h:71
void setX11Data(const QX11InfoData *)
Makes a shallow copy of the X11-specific data d and assigns it to this class.

◆ colormap()

Qt::HANDLE QX11Info::colormap ( ) const

Returns a handle for the color map.

See also
defaultColormap()

Definition at line 514 of file qx11info_x11.cpp.

Referenced by getX11Data(), and QPaintDevice::qt_x11Info().

QX11InfoData * x11data
Definition: qx11info_x11.h:105
static Qt::HANDLE appColormap(int screen=-1)
Returns a handle for the application&#39;s color map on the given screen.
Colormap colormap
Definition: qt_x11_p.h:317

◆ copyX11Data()

void QX11Info::copyX11Data ( const QPaintDevice fromDevice)
protected

Makes a shallow copy of the X11-specific data of fromDevice, if it is not null.

Warning
This function is not part of the public interface. Otherwise this function sets it to null.

Definition at line 120 of file qx11info_x11.cpp.

121 {
122  QX11InfoData *xd = 0;
123  if (fromDevice) {
124  if (fromDevice->devType() == QInternal::Widget)
125  xd = static_cast<const QWidget *>(fromDevice)->x11Info().x11data;
126  else if (fromDevice->devType() == QInternal::Pixmap)
127  xd = static_cast<const QPixmap *>(fromDevice)->x11Info().x11data;
128  }
129  setX11Data(xd);
130 }
virtual int devType() const
Definition: qpaintdevice.h:167
void setX11Data(const QX11InfoData *)
Makes a shallow copy of the X11-specific data d and assigns it to this class.

◆ defaultColormap()

bool QX11Info::defaultColormap ( ) const

Returns true if there is a default color map; otherwise returns false.

See also
colormap()

Definition at line 523 of file qx11info_x11.cpp.

Referenced by QPaintDevice::qt_x11Info().

QX11InfoData * x11data
Definition: qx11info_x11.h:105
static bool appDefaultColormap(int screen=-1)
Returns true if the application has a default color map on the given screen; otherwise returns false...
bool defaultColormap
Definition: qt_x11_p.h:319

◆ defaultVisual()

bool QX11Info::defaultVisual ( ) const

Returns true if there is a default visual; otherwise returns false.

See also
visual(), appVisual()

Definition at line 541 of file qx11info_x11.cpp.

Referenced by QPaintDevice::qt_x11Info().

static bool appDefaultVisual(int screen=-1)
Returns true if the application has a default visual on the given screen; otherwise returns false...
QX11InfoData * x11data
Definition: qx11info_x11.h:105
bool defaultVisual
Definition: qt_x11_p.h:320

◆ depth()

int QX11Info::depth ( ) const

Returns the color depth (bits per pixel) of the X display.

See also
appDepth()

Definition at line 496 of file qx11info_x11.cpp.

Referenced by buildSpec(), QRasterWindowSurface::flush(), QX11PixmapData::fromImage(), QRasterWindowSurface::QRasterWindowSurface(), QPaintDevice::qt_x11Info(), QX11WindowSurface::QX11WindowSurface(), QX11PixmapData::resize(), and QNativeImage::systemFormat().

497 { return x11data ? x11data->depth : QX11Info::appDepth(); }
static int appDepth(int screen=-1)
Returns the color depth (bits per pixel) used by the application on the given screen.
QX11InfoData * x11data
Definition: qx11info_x11.h:105

◆ display()

Display * QX11Info::display ( )
static

◆ getX11Data()

QX11InfoData * QX11Info::getX11Data ( bool  def = false) const
protected
Warning
This function is not part of the public interface. If def is false, returns a deep copy of the x11Data, or 0 if x11Data is 0. If def is true, makes a QX11Data struct filled with the default values.

In either case the caller is responsible for deleting the returned struct. But notice that the struct is a shared class, so other classes might also have a reference to it. The reference count of the returned QX11Data* is 0.

Definition at line 189 of file qx11info_x11.cpp.

Referenced by QX11PixmapData::convertToARGB32(), QX11PixmapData::fromImage(), qt_x11_getX11InfoForWindow(), QX11PixmapData::resize(), and QX11PixmapData::transformed().

190 {
191  QX11InfoData* res = 0;
192  if (def) {
193  res = new QX11InfoData;
194  res->ref = 0;
195  res->screen = appScreen();
196  res->depth = appDepth();
197  res->cells = appCells();
198  res->colormap = colormap();
200  res->visual = (Visual*) appVisual();
202  } else if (x11data) {
203  res = new QX11InfoData;
204  *res = *x11data;
205  res->ref = 0;
206  }
207  return res;
208 }
static int appScreen()
Returns the number of the screen where the application is being displayed.
static int appDepth(int screen=-1)
Returns the color depth (bits per pixel) used by the application on the given screen.
static bool appDefaultVisual(int screen=-1)
Returns true if the application has a default visual on the given screen; otherwise returns false...
QX11InfoData * x11data
Definition: qx11info_x11.h:105
static bool appDefaultColormap(int screen=-1)
Returns true if the application has a default color map on the given screen; otherwise returns false...
Qt::HANDLE colormap() const
Returns a handle for the color map.
Visual * visual
Definition: qt_x11_p.h:318
static void * appVisual(int screen=-1)
Returns the current visual used by the application on the given screen.
Colormap colormap
Definition: qt_x11_p.h:317
bool defaultColormap
Definition: qt_x11_p.h:319
static int appCells(int screen=-1)
Returns the number of cells used by the application on the given screen.
bool defaultVisual
Definition: qt_x11_p.h:320

◆ isCompositingManagerRunning()

bool QX11Info::isCompositingManagerRunning ( )
static

Returns true if there is a compositing manager running.

Since
4.4

Definition at line 553 of file qx11info_x11.cpp.

Referenced by QWidgetPrivate::mapFromGlobal().

554 {
555  return X11 ? X11->compositingManagerRunning : false;
556 }
#define X11
Definition: qt_x11_p.h:724

◆ operator=()

QX11Info & QX11Info::operator= ( const QX11Info other)

Assigns other to this object and returns a reference to this object.

Definition at line 92 of file qx11info_x11.cpp.

93 {
94  if (other.x11data)
95  ++other.x11data->ref;
96  if (x11data && !--x11data->ref)
97  delete x11data;
98  x11data = other.x11data;
99  return *this;
100 }
QX11InfoData * x11data
Definition: qx11info_x11.h:105

◆ screen()

int QX11Info::screen ( ) const

Returns the number of the screen currently in use.

The return value is an X screen number. Be aware that if the user's system uses Xinerama (as opposed to traditional X11 multiscreen), there is only one X screen. Use QDesktopWidget to query for information about Xinerama screens.

See also
appScreen()

Definition at line 487 of file qx11info_x11.cpp.

Referenced by appCells(), appColormap(), appDefaultColormap(), appDefaultVisual(), appDepth(), appDpiX(), appDpiY(), appVisual(), QGLContextPrivate::bindTextureFromNativePixmap(), buildSpec(), QX11PixmapData::convertToARGB32(), QX11PixmapData::copy(), QEgl::createSurface(), QPixmap::depth(), ShivaVGWindowSurfacePrivate::ensureContext(), QX11PixmapData::fill(), QX11PixmapData::fromImage(), getNetWmState(), QX11GLWindowSurface::grabWidget(), QX11WindowSurface::grabWidget(), QDesktopWidgetPrivate::init(), QWidgetPrivate::isBackgroundInherited(), QX11PixmapData::mask(), QX11PixmapData::metric(), QX11PixmapData::paintEngine(), qCanAllocColors(), QFont::QFont(), QFontMetrics::QFontMetrics(), QFontMetricsF::QFontMetricsF(), qstring_to_xtp(), qt_change_net_wm_state(), qt_format_to_attrib_list(), qt_x11_getX11InfoForWindow(), QPaintDevice::qt_x11Info(), QX11PixmapData::resize(), QWhatsThisPrivate::say(), setAppDpiX(), setAppDpiY(), QX11WindowSurface::setGeometry(), QX11PixmapData::setMask(), QX11PixmapData::toImage(), QX11PixmapData::transformed(), QGLContext::tryVisual(), QApplication::x11ClientMessage(), and QApplication::x11ProcessEvent().

488 { return x11data ? x11data->screen : QX11Info::appScreen(); }
static int appScreen()
Returns the number of the screen where the application is being displayed.
QX11InfoData * x11data
Definition: qx11info_x11.h:105

◆ setAppDpiX()

void QX11Info::setAppDpiX ( int  screen,
int  xdpi 
)
static

Sets the horizontal resolution of the given screen to the number of dots per inch specified by xdpi.

The screen argument is an X screen number. Be aware that if the user's system uses Xinerama (as opposed to traditional X11 multiscreen), there is only one X screen. Use QDesktopWidget to query for information about Xinerama screens.

See also
appDpiX(), setAppDpiY()

Definition at line 244 of file qx11info_x11.cpp.

Referenced by QPaintDevice::qt_x11Info().

245 {
246  if (!X11)
247  return;
248  if (screen < 0)
249  screen = X11->defaultScreen;
250  if (screen > X11->screenCount)
251  return;
252  X11->screens[screen].dpiX = xdpi;
253 }
#define X11
Definition: qt_x11_p.h:724
int screen() const
Returns the number of the screen currently in use.

◆ setAppDpiY()

void QX11Info::setAppDpiY ( int  screen,
int  ydpi 
)
static

Sets the vertical resolution of the given screen to the number of dots per inch specified by ydpi.

The screen argument is an X screen number. Be aware that if the user's system uses Xinerama (as opposed to traditional X11 multiscreen), there is only one X screen. Use QDesktopWidget to query for information about Xinerama screens.

See also
appDpiY(), setAppDpiX()

Definition at line 289 of file qx11info_x11.cpp.

Referenced by QPaintDevice::qt_x11Info().

290 {
291  if (!X11)
292  return;
293  if (screen < 0)
294  screen = X11->defaultScreen;
295  if (screen > X11->screenCount)
296  return;
297  X11->screens[screen].dpiY = ydpi;
298 }
#define X11
Definition: qt_x11_p.h:724
int screen() const
Returns the number of the screen currently in use.

◆ setAppTime()

void QX11Info::setAppTime ( unsigned long  time)
static

Sets the X11 time to the value specified by time.

See also
appTime(), setAppUserTime()

Definition at line 315 of file qx11info_x11.cpp.

316 {
317  if (X11) {
318  X11->time = time;
319  }
320 }
#define X11
Definition: qt_x11_p.h:724

◆ setAppUserTime()

void QX11Info::setAppUserTime ( unsigned long  time)
static

Sets the X11 user time as specified by time.

See also
appUserTime(), setAppTime()

Definition at line 337 of file qx11info_x11.cpp.

338 {
339  if (X11) {
340  X11->userTime = time;
341  }
342 }
#define X11
Definition: qt_x11_p.h:724

◆ setX11Data()

void QX11Info::setX11Data ( const QX11InfoData d)
protected

Makes a shallow copy of the X11-specific data d and assigns it to this class.

Warning
This function is not part of the public interface. This function increments the reference code of d.

Definition at line 167 of file qx11info_x11.cpp.

Referenced by cloneX11Data(), QX11PixmapData::convertToARGB32(), copyX11Data(), QX11PixmapData::fromImage(), qt_x11_getX11InfoForWindow(), QX11PixmapData::resize(), and QX11PixmapData::transformed().

168 {
169  if (x11data && !--x11data->ref)
170  delete x11data;
171  x11data = (QX11InfoData *)d;
172  if (x11data)
173  ++x11data->ref;
174 }
QX11InfoData * x11data
Definition: qx11info_x11.h:105

◆ visual()

void * QX11Info::visual ( ) const

Friends and Related Functions

◆ QGLWidget

friend class QGLWidget
friend

Definition at line 112 of file qx11info_x11.h.

◆ QPixmap

friend class QPixmap
friend

Definition at line 108 of file qx11info_x11.h.

◆ qt_cleanup

void qt_cleanup ( )
friend

Definition at line 1328 of file qapplication_mac.mm.

1329 {
1330  CGDisplayRemoveReconfigurationCallback(qt_mac_display_change_callbk, 0);
1331  CFNotificationCenterRef center = CFNotificationCenterGetDistributedCenter();
1332  CFNotificationCenterRemoveObserver(center, qApp, kCMDeviceUnregisteredNotification, 0);
1333  CFNotificationCenterRemoveObserver(center, qApp, kCMDefaultDeviceNotification, 0);
1334  CFNotificationCenterRemoveObserver(center, qApp, kCMDeviceProfilesNotification, 0);
1335  CFNotificationCenterRemoveObserver(center, qApp, kCMDefaultDeviceProfileNotification, 0);
1336 
1337 #ifndef QT_MAC_USE_COCOA
1339  if (app_proc_handlerUPP) {
1340  DisposeEventHandlerUPP(app_proc_handlerUPP);
1341  app_proc_handlerUPP = 0;
1342  }
1343 #endif
1345 
1346 #ifdef QT_MAC_USE_COCOA
1347  qt_resetNSApplicationSendEvent();
1348 #endif
1349 
1352  DisposeEventHandlerUPP(tablet_proximity_UPP);
1353 
1355  if (qt_is_gui_used) {
1356 #ifndef QT_NO_ACCESSIBILITY
1358 #endif
1359 #ifndef QT_NO_IM
1361 #endif
1363  QFont::cleanup();
1365  if (qt_mac_safe_pdev) {
1366  delete qt_mac_safe_pdev;
1367  qt_mac_safe_pdev = 0;
1368  }
1369  extern void qt_mac_unregister_widget(); // qapplication_mac.cpp
1371  }
1372 }
#define kCMDefaultDeviceNotification
void qt_mac_unregister_widget()
#define kCMDeviceProfilesNotification
static void cleanup()
Internal function that cleans up the font system.
Definition: qfont_mac.cpp:93
static EventHandlerUPP tablet_proximity_UPP
static void cleanup()
void qt_release_app_proc_handler()
#define qApp
static void clear()
Removes all pixmaps from the cache.
#define kCMDefaultDeviceProfileNotification
QPaintDevice * qt_mac_safe_pdev
static EventHandlerUPP app_proc_handlerUPP
Q_CORE_EXPORT QTextStream & center(QTextStream &s)
#define kCMDeviceUnregisteredNotification
static void qt_release_tablet_proximity_handler()
void qt_release_apple_event_handler()
void qt_mac_display_change_callbk(CGDirectDisplayID, CGDisplayChangeSummaryFlags flags, void *)
static void cleanup()
Definition: qcursor.cpp:402
bool qt_is_gui_used
static void cleanup()

◆ qt_init

void qt_init ( QApplicationPrivate priv,
int  type,
Display display = 0,
Qt::HANDLE  visual = 0,
Qt::HANDLE  colormap = 0 
)
friend

Definition at line 1666 of file qapplication_x11.cpp.

1668 {
1669  X11 = new QX11Data;
1670  X11->display = display;
1671  X11->displayName = 0;
1672  X11->foreignDisplay = (display != 0);
1673  X11->focus_model = -1;
1674 
1675  // RANDR
1676  X11->use_xrandr = false;
1677  X11->xrandr_major = 0;
1678  X11->xrandr_eventbase = 0;
1679  X11->xrandr_errorbase = 0;
1680 
1681  // RENDER
1682  X11->use_xrender = false;
1683  X11->xrender_major = 0;
1684  X11->xrender_version = 0;
1685 
1686  // XFIXES
1687  X11->use_xfixes = false;
1688  X11->xfixes_major = 0;
1689  X11->xfixes_eventbase = 0;
1690  X11->xfixes_errorbase = 0;
1691 
1692  // XInputExtension
1693  X11->use_xinput = false;
1694  X11->xinput_major = 0;
1695  X11->xinput_eventbase = 0;
1696  X11->xinput_errorbase = 0;
1697 
1698  X11->use_xkb = false;
1699  X11->xkb_major = 0;
1700  X11->xkb_eventbase = 0;
1701  X11->xkb_errorbase = 0;
1702 
1703  // MIT-SHM
1704  X11->use_mitshm = false;
1705  X11->use_mitshm_pixmaps = false;
1706  X11->mitshm_major = 0;
1707 
1708  X11->sip_serial = 0;
1709  X11->net_supported_list = 0;
1710  X11->net_virtual_root_list = 0;
1711  X11->wm_client_leader = 0;
1712  X11->screens = 0;
1713  X11->argbVisuals = 0;
1714  X11->argbColormaps = 0;
1715  X11->screenCount = 0;
1716  X11->time = CurrentTime;
1717  X11->userTime = CurrentTime;
1718  X11->ignore_badwindow = false;
1719  X11->seen_badwindow = false;
1720 
1721  X11->motifdnd_active = false;
1722 
1723  X11->default_im = QLatin1String("imsw-multi");
1724  priv->inputContext = 0;
1725 
1726  // colormap control
1727  X11->visual_class = -1;
1728  X11->visual_id = -1;
1729  X11->color_count = 0;
1730  X11->custom_cmap = false;
1731 
1732  // outside visual/colormap
1733  X11->visual = reinterpret_cast<Visual *>(visual);
1734  X11->colormap = colormap;
1735 
1736  // Fontconfig
1737  X11->has_fontconfig = false;
1738 #if !defined(QT_NO_FONTCONFIG)
1739  if (qgetenv("QT_X11_NO_FONTCONFIG").isNull())
1740  X11->has_fontconfig = FcInit();
1741  X11->fc_antialias = true;
1742 #endif
1743 
1744 #ifndef QT_NO_XRENDER
1745  memset(X11->solid_fills, 0, sizeof(X11->solid_fills));
1746  for (int i = 0; i < X11->solid_fill_count; ++i)
1747  X11->solid_fills[i].screen = -1;
1748  memset(X11->pattern_fills, 0, sizeof(X11->pattern_fills));
1749  for (int i = 0; i < X11->pattern_fill_count; ++i)
1750  X11->pattern_fills[i].screen = -1;
1751 #endif
1752 
1753  X11->startupId = 0;
1754 
1755  int argc = priv->argc;
1756  char **argv = priv->argv;
1757 
1758  if (X11->display) {
1759  // Qt part of other application
1760 
1761  // Set application name and class
1762  appName = qstrdup("Qt-subapplication");
1763  char *app_class = 0;
1764  if (argv) {
1765  const char* p = strrchr(argv[0], '/');
1766  app_class = qstrdup(p ? p + 1 : argv[0]);
1767  if (app_class[0])
1768  app_class[0] = toupper(app_class[0]);
1769  }
1770  appClass = app_class;
1771  } else {
1772  // Qt controls everything (default)
1773 
1775  XInitThreads();
1776 
1777  // Set application name and class
1778  char *app_class = 0;
1779  if (argv && argv[0]) {
1780  const char *p = strrchr(argv[0], '/');
1781  appName = p ? p + 1 : argv[0];
1782  app_class = qstrdup(appName);
1783  if (app_class[0])
1784  app_class[0] = toupper(app_class[0]);
1785  }
1786  appClass = app_class;
1787  }
1788 
1789  // Install default error handlers
1790  original_x_errhandler = XSetErrorHandler(qt_x_errhandler);
1791  original_xio_errhandler = XSetIOErrorHandler(qt_xio_errhandler);
1792 
1793  // Get command line params
1794  int j = argc ? 1 : 0;
1795  for (int i=1; i<argc; i++) {
1796  if (argv[i] && *argv[i] != '-') {
1797  argv[j++] = argv[i];
1798  continue;
1799  }
1800  QByteArray arg(argv[i]);
1801  if (arg == "-display") {
1802  if (++i < argc && !X11->display)
1803  X11->displayName = argv[i];
1804  } else if (arg == "-fn" || arg == "-font") {
1805  if (++i < argc)
1806  appFont = argv[i];
1807  } else if (arg == "-bg" || arg == "-background") {
1808  if (++i < argc)
1809  appBGCol = argv[i];
1810  } else if (arg == "-btn" || arg == "-button") {
1811  if (++i < argc)
1812  appBTNCol = argv[i];
1813  } else if (arg == "-fg" || arg == "-foreground") {
1814  if (++i < argc)
1815  appFGCol = argv[i];
1816  } else if (arg == "-name") {
1817  if (++i < argc)
1818  appName = argv[i];
1819  } else if (arg == "-title") {
1820  if (++i < argc)
1821  mwTitle = argv[i];
1822  } else if (arg == "-geometry") {
1823  if (++i < argc)
1824  mwGeometry = argv[i];
1825  } else if (arg == "-im") {
1826  if (++i < argc)
1827  qt_ximServer = argv[i];
1828  } else if (arg == "-ncols") { // xv and netscape use this name
1829  if (++i < argc)
1830  X11->color_count = qMax(0,atoi(argv[i]));
1831  } else if (arg == "-visual") { // xv and netscape use this name
1832  if (++i < argc && !X11->visual) {
1833  QString s = QString::fromLocal8Bit(argv[i]).toLower();
1834  if (s == QLatin1String("staticgray"))
1835  X11->visual_class = StaticGray;
1836  else if (s == QLatin1String("grayscale"))
1837  X11->visual_class = XGrayScale;
1838  else if (s == QLatin1String("staticcolor"))
1839  X11->visual_class = StaticColor;
1840  else if (s == QLatin1String("pseudocolor"))
1841  X11->visual_class = PseudoColor;
1842  else if (s == QLatin1String("truecolor"))
1843  X11->visual_class = TrueColor;
1844  else if (s == QLatin1String("directcolor"))
1845  X11->visual_class = DirectColor;
1846  else
1847  X11->visual_id = static_cast<int>(strtol(argv[i], 0, 0));
1848  }
1849 #ifndef QT_NO_XIM
1850  } else if (arg == "-inputstyle") {
1851  if (++i < argc) {
1852  QString s = QString::fromLocal8Bit(argv[i]).toLower();
1853  if (s == QLatin1String("onthespot"))
1854  qt_xim_preferred_style = XIMPreeditCallbacks |
1855  XIMStatusNothing;
1856  else if (s == QLatin1String("overthespot"))
1857  qt_xim_preferred_style = XIMPreeditPosition |
1858  XIMStatusNothing;
1859  else if (s == QLatin1String("offthespot"))
1860  qt_xim_preferred_style = XIMPreeditArea |
1861  XIMStatusArea;
1862  else if (s == QLatin1String("root"))
1863  qt_xim_preferred_style = XIMPreeditNothing |
1864  XIMStatusNothing;
1865  }
1866 #endif
1867  } else if (arg == "-cmap") { // xv uses this name
1868  if (!X11->colormap)
1869  X11->custom_cmap = true;
1870  }
1871  else if (arg == "-sync")
1872  appSync = !appSync;
1873 #if defined(QT_DEBUG)
1874  else if (arg == "-nograb")
1875  appNoGrab = !appNoGrab;
1876  else if (arg == "-dograb")
1877  appDoGrab = !appDoGrab;
1878 #endif
1879  else
1880  argv[j++] = argv[i];
1881  }
1882 
1883  priv->argc = j;
1884 
1885 #if defined(QT_DEBUG) && defined(Q_OS_LINUX)
1886  if (!appNoGrab && !appDoGrab && runningUnderDebugger()) {
1887  appNoGrab = true;
1888  qDebug("Qt: gdb: -nograb added to command-line options.\n"
1889  "\t Use the -dograb option to enforce grabbing.");
1890  }
1891 #endif
1892 
1893  // Connect to X server
1894  if (qt_is_gui_used && !X11->display) {
1895  if ((X11->display = XOpenDisplay(X11->displayName)) == 0) {
1896  qWarning("%s: cannot connect to X server %s", appName,
1897  XDisplayName(X11->displayName));
1899  exit(1);
1900  }
1901 
1902  if (appSync) // if "-sync" argument
1903  XSynchronize(X11->display, true);
1904  }
1905 
1906  // Common code, regardless of whether display is foreign.
1907 
1908  // Get X parameters
1909 
1910  if (qt_is_gui_used) {
1911  X11->defaultScreen = DefaultScreen(X11->display);
1912  X11->screenCount = ScreenCount(X11->display);
1913 
1914  int formatCount = 0;
1915  XPixmapFormatValues *values = XListPixmapFormats(X11->display, &formatCount);
1916  for (int i = 0; i < formatCount; ++i)
1917  X11->bppForDepth[values[i].depth] = values[i].bits_per_pixel;
1918  XFree(values);
1919 
1920  X11->screens = new QX11InfoData[X11->screenCount];
1921  X11->argbVisuals = new Visual *[X11->screenCount];
1922  X11->argbColormaps = new Colormap[X11->screenCount];
1923 
1924  for (int s = 0; s < X11->screenCount; s++) {
1925  QX11InfoData *screen = X11->screens + s;
1926  screen->ref = 1; // ensures it doesn't get deleted
1927  screen->screen = s;
1928 
1929  int widthMM = DisplayWidthMM(X11->display, s);
1930  if (widthMM != 0) {
1931  screen->dpiX = (DisplayWidth(X11->display, s) * 254 + widthMM * 5) / (widthMM * 10);
1932  } else {
1933  screen->dpiX = 72;
1934  }
1935 
1936  int heightMM = DisplayHeightMM(X11->display, s);
1937  if (heightMM != 0) {
1938  screen->dpiY = (DisplayHeight(X11->display, s) * 254 + heightMM * 5) / (heightMM * 10);
1939  } else {
1940  screen->dpiY = 72;
1941  }
1942 
1943  X11->argbVisuals[s] = 0;
1944  X11->argbColormaps[s] = 0;
1945  }
1946 
1947 
1948 #ifndef QT_NO_XRENDER
1949  int xrender_eventbase, xrender_errorbase;
1950  // See if XRender is supported on the connected display
1951  if (XQueryExtension(X11->display, "RENDER", &X11->xrender_major,
1952  &xrender_eventbase, &xrender_errorbase)
1953  && XRenderQueryExtension(X11->display, &xrender_eventbase,
1954  &xrender_errorbase)) {
1955  // Check the version as well - we need v0.4 or higher
1956  int major = 0;
1957  int minor = 0;
1958  XRenderQueryVersion(X11->display, &major, &minor);
1959  if (qgetenv("QT_X11_NO_XRENDER").isNull()) {
1960  X11->use_xrender = (major >= 0 && minor >= 5);
1961  X11->xrender_version = major*100+minor;
1962  // workaround for broken XServer on Ubuntu Breezy (6.8 compiled with 7.0
1963  // protocol headers)
1964  if (X11->xrender_version == 10
1965  && VendorRelease(X11->display) < 60900000
1966  && QByteArray(ServerVendor(X11->display)).contains("X.Org"))
1967  X11->xrender_version = 9;
1968  }
1969  }
1970 #endif // QT_NO_XRENDER
1971 
1972 #ifndef QT_NO_MITSHM
1973  int mitshm_minor;
1974  int mitshm_major;
1975  int mitshm_eventbase;
1976  int mitshm_errorbase;
1977  int mitshm_pixmaps;
1978  if (XQueryExtension(X11->display, "MIT-SHM", &X11->mitshm_major,
1979  &mitshm_eventbase, &mitshm_errorbase)
1980  && XShmQueryVersion(X11->display, &mitshm_major, &mitshm_minor,
1981  &mitshm_pixmaps))
1982  {
1983  QString displayName = QLatin1String(XDisplayName(NULL));
1984 
1985  // MITSHM only works for local displays, so do a quick check here
1986  // to determine whether the display is local or not (not 100 % accurate).
1987  // BGR server layouts are not supported either, since it requires the raster
1988  // engine to work on a QImage with BGR layout.
1989  bool local = displayName.isEmpty() || displayName.lastIndexOf(QLatin1Char(':')) == 0;
1990  if (local && (qgetenv("QT_X11_NO_MITSHM").toInt() == 0)) {
1991  Visual *defaultVisual = DefaultVisual(X11->display, DefaultScreen(X11->display));
1992  X11->use_mitshm = ((defaultVisual->red_mask == 0xff0000
1993  || defaultVisual->red_mask == 0xf800)
1994  && (defaultVisual->green_mask == 0xff00
1995  || defaultVisual->green_mask == 0x7e0)
1996  && (defaultVisual->blue_mask == 0xff
1997  || defaultVisual->blue_mask == 0x1f));
1998  X11->use_mitshm_pixmaps = X11->use_mitshm && mitshm_pixmaps;
1999  }
2000  }
2001 #endif // QT_NO_MITSHM
2002 
2003  // initialize the graphics system - order is imporant here - it must be done before
2004  // the QColormap::initialize() call
2007 
2008  // Support protocols
2009  X11->xdndSetup();
2010 
2011  // Finally create all atoms
2013 
2014  // initialize NET lists
2017 
2018 #ifndef QT_NO_XRANDR
2019  // See if XRandR is supported on the connected display
2020  if (XQueryExtension(X11->display, "RANDR", &X11->xrandr_major,
2021  &X11->xrandr_eventbase, &X11->xrandr_errorbase)) {
2022 
2023 # ifdef QT_RUNTIME_XRANDR
2024  X11->ptrXRRSelectInput = 0;
2025  X11->ptrXRRUpdateConfiguration = 0;
2026  X11->ptrXRRRootToScreen = 0;
2027  X11->ptrXRRQueryExtension = 0;
2028  QLibrary xrandrLib(QLatin1String("Xrandr"), 2);
2029  xrandrLib.setLoadHints(QLibrary::ImprovedSearchHeuristics);
2030  if (!xrandrLib.load()) { // try without the version number
2031  xrandrLib.setFileName(QLatin1String("Xrandr"));
2032  xrandrLib.load();
2033  }
2034  if (xrandrLib.isLoaded()) {
2035  X11->ptrXRRSelectInput =
2036  (PtrXRRSelectInput) xrandrLib.resolve("XRRSelectInput");
2037  X11->ptrXRRUpdateConfiguration =
2038  (PtrXRRUpdateConfiguration) xrandrLib.resolve("XRRUpdateConfiguration");
2039  X11->ptrXRRRootToScreen =
2040  (PtrXRRRootToScreen) xrandrLib.resolve("XRRRootToScreen");
2041  X11->ptrXRRQueryExtension =
2042  (PtrXRRQueryExtension) xrandrLib.resolve("XRRQueryExtension");
2043  }
2044 # else
2045  X11->ptrXRRSelectInput = XRRSelectInput;
2046  X11->ptrXRRUpdateConfiguration = XRRUpdateConfiguration;
2047  X11->ptrXRRRootToScreen = XRRRootToScreen;
2048  X11->ptrXRRQueryExtension = XRRQueryExtension;
2049 # endif
2050 
2051  if (X11->ptrXRRQueryExtension
2052  && X11->ptrXRRQueryExtension(X11->display, &X11->xrandr_eventbase, &X11->xrandr_errorbase)) {
2053  // XRandR is supported
2054  X11->use_xrandr = true;
2055  }
2056  }
2057 #endif // QT_NO_XRANDR
2058 
2059 #ifndef QT_NO_XRENDER
2060  if (X11->use_xrender) {
2061  // XRender is supported, let's see if we have a PictFormat for the
2062  // default visual
2063  XRenderPictFormat *format =
2064  XRenderFindVisualFormat(X11->display,
2065  (Visual *) QX11Info::appVisual(X11->defaultScreen));
2066 
2067  if (!format) {
2068  X11->use_xrender = false;
2069  }
2070  }
2071 #endif // QT_NO_XRENDER
2072 
2073 #ifndef QT_NO_XFIXES
2074  // See if Xfixes is supported on the connected display
2075  if (XQueryExtension(X11->display, "XFIXES", &X11->xfixes_major,
2076  &X11->xfixes_eventbase, &X11->xfixes_errorbase)) {
2077  X11->ptrXFixesQueryExtension = XFIXES_LOAD_V1(XFixesQueryExtension);
2078  X11->ptrXFixesQueryVersion = XFIXES_LOAD_V1(XFixesQueryVersion);
2079  X11->ptrXFixesSetCursorName = XFIXES_LOAD_V2(XFixesSetCursorName);
2080  X11->ptrXFixesSelectSelectionInput = XFIXES_LOAD_V2(XFixesSelectSelectionInput);
2081 
2082  if(X11->ptrXFixesQueryExtension && X11->ptrXFixesQueryVersion
2083  && X11->ptrXFixesQueryExtension(X11->display, &X11->xfixes_eventbase,
2084  &X11->xfixes_errorbase)) {
2085  // Xfixes is supported.
2086  // Note: the XFixes protocol version is negotiated using QueryVersion.
2087  // We supply the highest version we support, the X server replies with
2088  // the highest version it supports, but no higher than the version we
2089  // asked for. The version sent back is the protocol version the X server
2090  // will use to talk us. If this call is removed, the behavior of the
2091  // X server when it receives an XFixes request is undefined.
2092  int major = 3;
2093  int minor = 0;
2094  X11->ptrXFixesQueryVersion(X11->display, &major, &minor);
2095  X11->use_xfixes = (major >= 1);
2096  X11->xfixes_major = major;
2097  }
2098  } else {
2099  X11->ptrXFixesQueryExtension = 0;
2100  X11->ptrXFixesQueryVersion = 0;
2101  X11->ptrXFixesSetCursorName = 0;
2102  X11->ptrXFixesSelectSelectionInput = 0;
2103  }
2104 #endif // QT_NO_XFIXES
2105 
2106 #ifndef QT_NO_XCURSOR
2107 #ifdef QT_RUNTIME_XCURSOR
2108  X11->ptrXcursorLibraryLoadCursor = 0;
2109  QLibrary xcursorLib(QLatin1String("Xcursor"), 1);
2110  xcursorLib.setLoadHints(QLibrary::ImprovedSearchHeuristics);
2111  bool xcursorFound = xcursorLib.load();
2112  if (!xcursorFound) { //try without the version number
2113  xcursorLib.setFileName(QLatin1String("Xcursor"));
2114  xcursorFound = xcursorLib.load();
2115  }
2116  if (xcursorFound) {
2117  X11->ptrXcursorLibraryLoadCursor =
2118  (PtrXcursorLibraryLoadCursor) xcursorLib.resolve("XcursorLibraryLoadCursor");
2119  }
2120 #else
2121  X11->ptrXcursorLibraryLoadCursor = XcursorLibraryLoadCursor;
2122 #endif // QT_RUNTIME_XCURSOR
2123 #endif // QT_NO_XCURSOR
2124 
2125 #ifndef QT_NO_XSYNC
2126  int xsync_evbase, xsync_errbase;
2127  int major, minor;
2128  if (XSyncQueryExtension(X11->display, &xsync_evbase, &xsync_errbase))
2129  XSyncInitialize(X11->display, &major, &minor);
2130 #endif // QT_NO_XSYNC
2131 
2132 #ifndef QT_NO_XINERAMA
2133 #ifdef QT_RUNTIME_XINERAMA
2134  X11->ptrXineramaQueryExtension = 0;
2135  X11->ptrXineramaIsActive = 0;
2136  X11->ptrXineramaQueryScreens = 0;
2137  QLibrary xineramaLib(QLatin1String("Xinerama"), 1);
2138  xineramaLib.setLoadHints(QLibrary::ImprovedSearchHeuristics);
2139  bool xineramaFound = xineramaLib.load();
2140  if (!xineramaFound) { //try without the version number
2141  xineramaLib.setFileName(QLatin1String("Xinerama"));
2142  xineramaFound = xineramaLib.load();
2143  }
2144  if (xineramaFound) {
2145  X11->ptrXineramaQueryExtension =
2146  (PtrXineramaQueryExtension) xineramaLib.resolve("XineramaQueryExtension");
2147  X11->ptrXineramaIsActive =
2148  (PtrXineramaIsActive) xineramaLib.resolve("XineramaIsActive");
2149  X11->ptrXineramaQueryScreens =
2150  (PtrXineramaQueryScreens) xineramaLib.resolve("XineramaQueryScreens");
2151  }
2152 #else
2153  X11->ptrXineramaQueryScreens = XineramaQueryScreens;
2154  X11->ptrXineramaIsActive = XineramaIsActive;
2155  X11->ptrXineramaQueryExtension = XineramaQueryExtension;
2156 #endif // QT_RUNTIME_XINERAMA
2157 #endif // QT_NO_XINERAMA
2158 
2159 #ifndef QT_NO_XINPUT
2160  // See if Xinput is supported on the connected display
2161  X11->ptrXCloseDevice = 0;
2162  X11->ptrXListInputDevices = 0;
2163  X11->ptrXOpenDevice = 0;
2164  X11->ptrXFreeDeviceList = 0;
2165  X11->ptrXSelectExtensionEvent = 0;
2166  X11->use_xinput = XQueryExtension(X11->display, "XInputExtension", &X11->xinput_major,
2167  &X11->xinput_eventbase, &X11->xinput_errorbase);
2168  if (X11->use_xinput) {
2169  X11->ptrXCloseDevice = XINPUT_LOAD(XCloseDevice);
2170  X11->ptrXListInputDevices = XINPUT_LOAD(XListInputDevices);
2171  X11->ptrXOpenDevice = XINPUT_LOAD(XOpenDevice);
2172  X11->ptrXFreeDeviceList = XINPUT_LOAD(XFreeDeviceList);
2173  X11->ptrXSelectExtensionEvent = XINPUT_LOAD(XSelectExtensionEvent);
2174  }
2175 #endif // QT_NO_XINPUT
2176 
2177 #ifndef QT_NO_XKB
2178  int xkblibMajor = XkbMajorVersion;
2179  int xkblibMinor = XkbMinorVersion;
2180  X11->use_xkb = XkbQueryExtension(X11->display,
2181  &X11->xkb_major,
2182  &X11->xkb_eventbase,
2183  &X11->xkb_errorbase,
2184  &xkblibMajor,
2185  &xkblibMinor);
2186  if (X11->use_xkb) {
2187  // If XKB is detected, set the GrabsUseXKBState option so input method
2188  // compositions continue to work (ie. deadkeys)
2189  unsigned int state = XkbPCF_GrabsUseXKBStateMask;
2190  (void) XkbSetPerClientControls(X11->display, state, &state);
2191 
2192  // select for group change events
2193  XkbSelectEventDetails(X11->display,
2194  XkbUseCoreKbd,
2195  XkbStateNotify,
2196  XkbAllStateComponentsMask,
2197  XkbGroupStateMask);
2198 
2199  // current group state is queried when creating the keymapper, no need to do it here
2200  }
2201 #endif
2202 
2203 
2204 #if !defined(QT_NO_FONTCONFIG)
2205  int dpi = 0;
2206  getXDefault("Xft", FC_DPI, &dpi);
2207  if (dpi) {
2208  for (int s = 0; s < ScreenCount(X11->display); ++s) {
2209  QX11Info::setAppDpiX(s, dpi);
2210  QX11Info::setAppDpiY(s, dpi);
2211  }
2212  }
2213  double fc_scale = 1.;
2214  getXDefault("Xft", FC_SCALE, &fc_scale);
2215  X11->fc_scale = fc_scale;
2216  for (int s = 0; s < ScreenCount(X11->display); ++s) {
2217  int subpixel = FC_RGBA_UNKNOWN;
2218 #if !defined(QT_NO_XRENDER) && (RENDER_MAJOR > 0 || RENDER_MINOR >= 6)
2219  if (X11->use_xrender) {
2220  int rsp = XRenderQuerySubpixelOrder(X11->display, s);
2221  switch (rsp) {
2222  default:
2223  case SubPixelUnknown:
2224  subpixel = FC_RGBA_UNKNOWN;
2225  break;
2226  case SubPixelHorizontalRGB:
2227  subpixel = FC_RGBA_RGB;
2228  break;
2229  case SubPixelHorizontalBGR:
2230  subpixel = FC_RGBA_BGR;
2231  break;
2232  case SubPixelVerticalRGB:
2233  subpixel = FC_RGBA_VRGB;
2234  break;
2235  case SubPixelVerticalBGR:
2236  subpixel = FC_RGBA_VBGR;
2237  break;
2238  case SubPixelNone:
2239  subpixel = FC_RGBA_NONE;
2240  break;
2241  }
2242  }
2243 #endif
2244 
2245  char *rgba = XGetDefault(X11->display, "Xft", FC_RGBA);
2246  if (rgba) {
2247  char *end = 0;
2248  int v = strtol(rgba, &end, 0);
2249  if (rgba != end) {
2250  subpixel = v;
2251  } else if (qstrncmp(rgba, "unknown", 7) == 0) {
2252  subpixel = FC_RGBA_UNKNOWN;
2253  } else if (qstrncmp(rgba, "rgb", 3) == 0) {
2254  subpixel = FC_RGBA_RGB;
2255  } else if (qstrncmp(rgba, "bgr", 3) == 0) {
2256  subpixel = FC_RGBA_BGR;
2257  } else if (qstrncmp(rgba, "vrgb", 4) == 0) {
2258  subpixel = FC_RGBA_VRGB;
2259  } else if (qstrncmp(rgba, "vbgr", 4) == 0) {
2260  subpixel = FC_RGBA_VBGR;
2261  } else if (qstrncmp(rgba, "none", 4) == 0) {
2262  subpixel = FC_RGBA_NONE;
2263  }
2264  }
2265  X11->screens[s].subpixel = subpixel;
2266  }
2267  getXDefault("Xft", FC_ANTIALIAS, &X11->fc_antialias);
2268 #ifdef FC_HINT_STYLE
2269  X11->fc_hint_style = -1;
2270  getXDefault("Xft", FC_HINT_STYLE, &X11->fc_hint_style);
2271 #endif
2272 #if 0
2273  // ###### these are implemented by Xft, not sure we need them
2274  getXDefault("Xft", FC_AUTOHINT, &X11->fc_autohint);
2275  getXDefault("Xft", FC_HINTING, &X11->fc_autohint);
2276  getXDefault("Xft", FC_MINSPACE, &X11->fc_autohint);
2277 #endif
2278 #endif // QT_NO_XRENDER
2279 
2280  // initialize key mapper
2282 
2283  // Misc. initialization
2284 #if 0 //disabled for now..
2285  QSegfaultHandler::initialize(priv->argv, priv->argc);
2286 #endif
2288  }
2290 
2291  if(qt_is_gui_used) {
2292  qApp->setObjectName(QString::fromLocal8Bit(appName));
2293 
2294  int screen;
2295  for (screen = 0; screen < X11->screenCount; ++screen) {
2296  XSelectInput(X11->display, QX11Info::appRootWindow(screen),
2297  KeymapStateMask | EnterWindowMask | LeaveWindowMask | PropertyChangeMask);
2298 
2299 #ifndef QT_NO_XRANDR
2300  if (X11->use_xrandr)
2301  X11->ptrXRRSelectInput(X11->display, QX11Info::appRootWindow(screen), True);
2302 #endif // QT_NO_XRANDR
2303  }
2304  }
2305 
2306  if (qt_is_gui_used) {
2307  // Attempt to determine the current running X11 Desktop Enviornment
2308  // Use dbus if/when we can, but fall back to using windowManagerName() for now
2309 
2310 #ifndef QT_NO_XFIXES
2311  if (X11->ptrXFixesSelectSelectionInput)
2312  X11->ptrXFixesSelectSelectionInput(X11->display, QX11Info::appRootWindow(), ATOM(_NET_WM_CM_S0),
2313  XFixesSetSelectionOwnerNotifyMask
2314  | XFixesSelectionWindowDestroyNotifyMask
2315  | XFixesSelectionClientCloseNotifyMask);
2316 #endif // QT_NO_XFIXES
2317  X11->compositingManagerRunning = XGetSelectionOwner(X11->display,
2318  ATOM(_NET_WM_CM_S0));
2319  X11->desktopEnvironment = DE_UNKNOWN;
2320  X11->desktopVersion = 0;
2321 
2322  Atom type;
2323  int format;
2324  unsigned long length, after;
2325  uchar *data = 0;
2326  int rc;
2327 
2328  do {
2329  if (!qgetenv("KDE_FULL_SESSION").isEmpty()) {
2330  X11->desktopEnvironment = DE_KDE;
2331  X11->desktopVersion = qgetenv("KDE_SESSION_VERSION").toInt();
2332  break;
2333  }
2334 
2335  if (qgetenv("DESKTOP_SESSION") == "gnome") {
2336  X11->desktopEnvironment = DE_GNOME;
2337  break;
2338  }
2339 
2340  // GNOME_DESKTOP_SESSION_ID is deprecated for some reason, but still check it
2341  if (!qgetenv("GNOME_DESKTOP_SESSION_ID").isEmpty()) {
2342  X11->desktopEnvironment = DE_GNOME;
2343  break;
2344  }
2345 
2346  rc = XGetWindowProperty(X11->display, QX11Info::appRootWindow(), ATOM(_DT_SAVE_MODE),
2347  0, 2, False, XA_STRING, &type, &format, &length,
2348  &after, &data);
2349  if (rc == Success && length) {
2350  if (!strcmp(reinterpret_cast<char *>(data), "xfce4")) {
2351  // Pretend that xfce4 is gnome, as it uses the same libraries.
2352  // The detection above is stolen from xdg-open.
2353  X11->desktopEnvironment = DE_GNOME;
2354  break;
2355  }
2356 
2357  // We got the property but it wasn't xfce4. Free data before it gets overwritten.
2358  XFree(data);
2359  data = 0;
2360  }
2361 
2362  rc = XGetWindowProperty(X11->display, QX11Info::appRootWindow(), ATOM(DTWM_IS_RUNNING),
2363  0, 1, False, AnyPropertyType, &type, &format, &length,
2364  &after, &data);
2365  if (rc == Success && length) {
2366  // DTWM is running, meaning most likely CDE is running...
2367  X11->desktopEnvironment = DE_CDE;
2368  break;
2369  }
2370 
2371  rc = XGetWindowProperty(X11->display, QX11Info::appRootWindow(),
2372  ATOM(_SGI_DESKS_MANAGER), 0, 1, False, XA_WINDOW,
2373  &type, &format, &length, &after, &data);
2374  if (rc == Success && length) {
2375  X11->desktopEnvironment = DE_4DWM;
2376  break;
2377  }
2378 
2379  if (XGetWindowProperty(X11->display, QX11Info::appRootWindow(),
2381  0, 1024, False, XA_WINDOW, &type,
2382  &format, &length, &after, &data) == Success) {
2383  if (type == XA_WINDOW && format == 32) {
2384  Window windowManagerWindow = *((Window*) data);
2385  XFree(data);
2386  data = 0;
2387 
2388  if (windowManagerWindow != XNone) {
2389  Atom utf8atom = ATOM(UTF8_STRING);
2390  if (XGetWindowProperty(QX11Info::display(), windowManagerWindow, ATOM(_NET_WM_NAME),
2391  0, 1024, False, utf8atom, &type,
2392  &format, &length, &after, &data) == Success) {
2393  if (type == utf8atom && format == 8) {
2394  if (qstrcmp((const char *)data, "MCompositor") == 0)
2395  X11->desktopEnvironment = DE_MEEGO_COMPOSITOR;
2396  }
2397  }
2398  }
2399  }
2400  }
2401 
2402  } while(0);
2403 
2404  if (data)
2405  XFree((char *)data);
2406 
2407 #if !defined(QT_NO_STYLE_GTK)
2408  if (X11->desktopEnvironment == DE_GNOME) {
2409  static bool menusHaveIcons = QGtkStyle::getGConfBool(QLatin1String("/desktop/gnome/interface/menus_have_icons"), true);
2411  }
2412 #endif
2414 
2416 
2417  // be smart about the size of the default font. most X servers have helvetica
2418  // 12 point available at 2 resolutions:
2419  // 75dpi (12 pixels) and 100dpi (17 pixels).
2420  // At 95 DPI, a 12 point font should be 16 pixels tall - in which case a 17
2421  // pixel font is a closer match than a 12 pixel font
2422  int ptsz = (X11->use_xrender
2423  ? 9
2424  : (int) (((QX11Info::appDpiY() >= 95 ? 17. : 12.) *
2425  72. / (float) QX11Info::appDpiY()) + 0.5));
2426 
2428  // no font from settings or RESOURCE_MANAGER, provide a fallback
2429  QFont f(X11->has_fontconfig ? QLatin1String("Sans Serif") : QLatin1String("Helvetica"),
2430  ptsz);
2432  }
2433 
2434 #if !defined (QT_NO_TABLET)
2435  if (X11->use_xinput) {
2436  int ndev,
2437  i,
2438  j;
2439  bool gotStylus,
2440  gotEraser;
2441  XDeviceInfo *devices = 0, *devs;
2442  XInputClassInfo *ip;
2443  XAnyClassPtr any;
2444  XValuatorInfoPtr v;
2445  XAxisInfoPtr a;
2446  XDevice *dev = 0;
2447 
2448  if (X11->ptrXListInputDevices) {
2449  devices = X11->ptrXListInputDevices(X11->display, &ndev);
2450  if (!devices)
2451  qWarning("QApplication: Failed to get list of tablet devices");
2452  }
2453  if (!devices)
2454  ndev = -1;
2455  QTabletEvent::TabletDevice deviceType;
2456  for (devs = devices, i = 0; i < ndev && devs; i++, devs++) {
2457  dev = 0;
2458  deviceType = QTabletEvent::NoDevice;
2459  gotStylus = false;
2460  gotEraser = false;
2461 
2462 #if defined(Q_OS_IRIX)
2463  QString devName = QString::fromLocal8Bit(devs->name).toLower();
2464  if (devName == QLatin1String(WACOM_NAME)) {
2465  deviceType = QTabletEvent::Stylus;
2466  gotStylus = true;
2467  }
2468 #else
2469  // qDebug() << "found input device" << devs->name << "type" << devs->type << XGetAtomName(X11->display, devs->type);
2470  if (devs->type == ATOM(XWacomStylus) || devs->type == ATOM(XTabletStylus) || devs->type == ATOM(XTablet)) {
2471  deviceType = QTabletEvent::Stylus;
2472  if (wacomDeviceName()->isEmpty())
2473  wacomDeviceName()->append(devs->name);
2474  gotStylus = true;
2475  } else if (devs->type == ATOM(XWacomEraser) || devs->type == ATOM(XTabletEraser)) {
2476  deviceType = QTabletEvent::XFreeEraser;
2477  gotEraser = true;
2478  }
2479 #endif
2480  if (deviceType == QTabletEvent::NoDevice)
2481  continue;
2482 
2483  if (gotStylus || gotEraser) {
2484  if (X11->ptrXOpenDevice)
2485  dev = X11->ptrXOpenDevice(X11->display, devs->id);
2486 
2487  if (!dev)
2488  continue;
2489 
2490  QTabletDeviceData device_data;
2491  device_data.deviceType = deviceType;
2492  device_data.eventCount = 0;
2493  device_data.device = dev;
2494  device_data.xinput_motion = -1;
2495  device_data.xinput_key_press = -1;
2496  device_data.xinput_key_release = -1;
2497  device_data.xinput_button_press = -1;
2498  device_data.xinput_button_release = -1;
2499  device_data.xinput_proximity_in = -1;
2500  device_data.xinput_proximity_out = -1;
2501  device_data.widgetToGetPress = 0;
2502 
2503  if (dev->num_classes > 0) {
2504  for (ip = dev->classes, j = 0; j < dev->num_classes;
2505  ip++, j++) {
2506  switch (ip->input_class) {
2507  case KeyClass:
2508  DeviceKeyPress(dev, device_data.xinput_key_press,
2509  device_data.eventList[device_data.eventCount]);
2510  if (device_data.eventList[device_data.eventCount])
2511  ++device_data.eventCount;
2512  DeviceKeyRelease(dev, device_data.xinput_key_release,
2513  device_data.eventList[device_data.eventCount]);
2514  if (device_data.eventList[device_data.eventCount])
2515  ++device_data.eventCount;
2516  break;
2517  case ButtonClass:
2518  DeviceButtonPress(dev, device_data.xinput_button_press,
2519  device_data.eventList[device_data.eventCount]);
2520  if (device_data.eventList[device_data.eventCount])
2521  ++device_data.eventCount;
2522  DeviceButtonRelease(dev, device_data.xinput_button_release,
2523  device_data.eventList[device_data.eventCount]);
2524  if (device_data.eventList[device_data.eventCount])
2525  ++device_data.eventCount;
2526  break;
2527  case ValuatorClass:
2528  // I'm only going to be interested in motion when the
2529  // stylus is already down anyway!
2530  DeviceMotionNotify(dev, device_data.xinput_motion,
2531  device_data.eventList[device_data.eventCount]);
2532  if (device_data.eventList[device_data.eventCount])
2533  ++device_data.eventCount;
2534  ProximityIn(dev, device_data.xinput_proximity_in, device_data.eventList[device_data.eventCount]);
2535  if (device_data.eventList[device_data.eventCount])
2536  ++device_data.eventCount;
2537  ProximityOut(dev, device_data.xinput_proximity_out, device_data.eventList[device_data.eventCount]);
2538  if (device_data.eventList[device_data.eventCount])
2539  ++device_data.eventCount;
2540  default:
2541  break;
2542  }
2543  }
2544  }
2545 
2546  // get the min/max value for pressure!
2547  any = (XAnyClassPtr) (devs->inputclassinfo);
2548  for (j = 0; j < devs->num_classes; j++) {
2549  if (any->c_class == ValuatorClass) {
2550  v = (XValuatorInfoPtr) any;
2551  a = (XAxisInfoPtr) ((char *) v +
2552  sizeof (XValuatorInfo));
2553 #if defined (Q_OS_IRIX)
2554  // I'm not exaclty wild about this, but the
2555  // dimensions of the tablet are more relevant here
2556  // than the min and max values from the axis
2557  // (actually it seems to be 2/3 or what is in the
2558  // axis. So we'll try to parse it from this
2559  // string. --tws
2560  char returnString[SGIDeviceRtrnLen];
2561  int tmp;
2562  if (XSGIMiscQueryExtension(X11->display, &tmp, &tmp)
2563  && XSGIDeviceQuery(X11->display, devs->id,
2564  "dimensions", returnString)) {
2565  QString str = QLatin1String(returnString);
2566  int comma = str.indexOf(',');
2567  device_data.minX = 0;
2568  device_data.minY = 0;
2569  device_data.maxX = str.left(comma).toInt();
2570  device_data.maxY = str.mid(comma + 1).toInt();
2571  } else {
2572  device_data.minX = a[WAC_XCOORD_I].min_value;
2573  device_data.maxX = a[WAC_XCOORD_I].max_value;
2574  device_data.minY = a[WAC_YCOORD_I].min_value;
2575  device_data.maxY = a[WAC_YCOORD_I].max_value;
2576  }
2577  device_data.minPressure = a[WAC_PRESSURE_I].min_value;
2578  device_data.maxPressure = a[WAC_PRESSURE_I].max_value;
2579  device_data.minTanPressure = a[WAC_TAN_PRESSURE_I].min_value;
2580  device_data.maxTanPressure = a[WAC_TAN_PRESSURE_I].max_value;
2581  device_data.minZ = a[WAC_ZCOORD_I].min_value;
2582  device_data.maxZ = a[WAC_ZCOORD_I].max_value;
2583 #else
2584  device_data.minX = a[0].min_value;
2585  device_data.maxX = a[0].max_value;
2586  device_data.minY = a[1].min_value;
2587  device_data.maxY = a[1].max_value;
2588  device_data.minPressure = a[2].min_value;
2589  device_data.maxPressure = a[2].max_value;
2590  device_data.minTanPressure = 0;
2591  device_data.maxTanPressure = 0;
2592  device_data.minZ = 0;
2593  device_data.maxZ = 0;
2594 #endif
2595 
2596  // got the max pressure no need to go further...
2597  break;
2598  }
2599  any = (XAnyClassPtr) ((char *) any + any->length);
2600  } // end of for loop
2601 
2602  tablet_devices()->append(device_data);
2603  } // if (gotStylus || gotEraser)
2604  }
2605  if (X11->ptrXFreeDeviceList)
2606  X11->ptrXFreeDeviceList(devices);
2607  }
2608 #endif // QT_NO_TABLET
2609 
2610  X11->startupId = getenv("DESKTOP_STARTUP_ID");
2611  if (X11->startupId) {
2612 #ifndef QT_NO_UNSETENV
2613  unsetenv("DESKTOP_STARTUP_ID");
2614 #else
2615  // it's a small memory leak, however we won't crash if Qt is
2616  // unloaded and someones tries to use the envoriment.
2617  putenv(strdup("DESKTOP_STARTUP_ID="));
2618 #endif
2619  }
2620  } else {
2621  // read some non-GUI settings when not using the X server...
2622 
2624  QSettings settings(QSettings::UserScope, QLatin1String("Trolltech"));
2625  settings.beginGroup(QLatin1String("Qt"));
2626 
2627  // read library (ie. plugin) path list
2628  QString libpathkey = QString::fromLatin1("%1.%2/libraryPath")
2629  .arg(QT_VERSION >> 16)
2630  .arg((QT_VERSION & 0xff00) >> 8);
2631  QStringList pathlist =
2632  settings.value(libpathkey).toString().split(QLatin1Char(':'));
2633  if (! pathlist.isEmpty()) {
2635  while (it != pathlist.constEnd())
2637  }
2638 
2639  QString defaultcodec = settings.value(QLatin1String("defaultCodec"),
2640  QVariant(QLatin1String("none"))).toString();
2641  if (defaultcodec != QLatin1String("none")) {
2643  if (codec)
2645  }
2646 
2647  settings.endGroup(); // Qt
2648  }
2649  }
2650 
2651 #if !defined (Q_OS_IRIX) && !defined (QT_NO_TABLET)
2652  QLibrary wacom(QString::fromLatin1("wacomcfg"), 0); // version 0 is the latest release at time of writing this.
2653  wacom.setLoadHints(QLibrary::ImprovedSearchHeuristics);
2654  // NOTE: C casts instead of reinterpret_cast for GCC 3.3.x
2655  ptrWacomConfigInit = (PtrWacomConfigInit)wacom.resolve("WacomConfigInit");
2656  ptrWacomConfigOpenDevice = (PtrWacomConfigOpenDevice)wacom.resolve("WacomConfigOpenDevice");
2657  ptrWacomConfigGetRawParam = (PtrWacomConfigGetRawParam)wacom.resolve("WacomConfigGetRawParam");
2658  ptrWacomConfigCloseDevice = (PtrWacomConfigCloseDevice)wacom.resolve("WacomConfigCloseDevice");
2659  ptrWacomConfigTerm = (PtrWacomConfigTerm)wacom.resolve("WacomConfigTerm");
2660 
2662  || ptrWacomConfigCloseDevice == 0 || ptrWacomConfigTerm == 0) { // either we have all, or we have none.
2663  ptrWacomConfigInit = 0;
2667  ptrWacomConfigTerm = 0;
2668  }
2669 #endif
2670 }
The QVariant class acts like a union for the most common Qt data types.
Definition: qvariant.h:92
TabletDevice
This enum defines what type of device is generating the event.
Definition: qevent.h:182
static PtrWacomConfigInit ptrWacomConfigInit
Bool(* PtrXineramaQueryExtension)(Display *dpy, int *event_base, int *error_base)
Definition: qt_x11_p.h:223
Q_CORE_EXPORT QByteArray qgetenv(const char *varName)
static QString fromLocal8Bit(const char *, int size=-1)
Returns a QString initialized with the first size characters of the 8-bit string str.
Definition: qstring.cpp:4245
int type
Definition: qmetatype.cpp:239
static PtrWacomConfigTerm ptrWacomConfigTerm
static const char * appClass()
Returns the X11 application class.
static const char * appFont
static void reset_instance_pointer()
int toInt(bool *ok=0, int base=10) const
Returns the string converted to an int using base base, which is 10 by default and must be between 2 ...
Definition: qstring.cpp:6090
XIMStyle qt_xim_preferred_style
#define it(className, varName)
The QSettings class provides persistent platform-independent application settings.
Definition: qsettings.h:73
The QByteArray class provides an array of bytes.
Definition: qbytearray.h:135
static Qt::HANDLE appRootWindow(int screen=-1)
Returns a handle for the applications root window on the given screen.
static void setAttribute(Qt::ApplicationAttribute attribute, bool on=true)
Sets the attribute attribute if on is true; otherwise clears the attribute.
static void addLibraryPath(const QString &)
Prepends path to the beginning of the library path list, ensuring that it is searched for libraries f...
static const char * appName
const_iterator constBegin() const
Returns a const STL-style iterator pointing to the first item in the list.
Definition: qlist.h:269
int(* PtrXRRUpdateConfiguration)(XEvent *)
Definition: qt_x11_p.h:230
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
long ASN1_INTEGER_get ASN1_INTEGER * a
static void qt_get_net_virtual_roots()
The QString class provides a Unicode character string.
Definition: qstring.h:83
#define X11
Definition: qt_x11_p.h:724
WACOMDEVICE *(* PtrWacomConfigOpenDevice)(WACOMCONFIG *, const char *)
static QFont * sys_font
int *(* PtrWacomConfigGetRawParam)(WACOMDEVICE *, int, int *, int, unsigned *)
Q_DECL_CONSTEXPR const T & qMax(const T &a, const T &b)
Definition: qglobal.h:1217
QPointer< QWidget > widgetToGetPress
bool isEmpty() const
Returns true if the list contains no items; otherwise returns false.
Definition: qlist.h:152
int(* PtrWacomConfigCloseDevice)(WACOMDEVICE *)
#define ATOM(x)
Definition: qt_x11_p.h:723
Q_CORE_EXPORT void qDebug(const char *,...)
static void initialize(char **, int)
unsigned char uchar
Definition: qglobal.h:994
static void qt_set_input_encoding()
static void setSystemFont(const QFont &font)
static bool appSync
static const char * appBTNCol
static QGraphicsSystem * create(const QString &)
static bool isEmpty(const char *str)
static PtrWacomConfigCloseDevice ptrWacomConfigCloseDevice
QString left(int n) const Q_REQUIRED_RESULT
Returns a substring that contains the n leftmost characters of the string.
Definition: qstring.cpp:3664
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
Definition: qstring.h:704
static void initialize()
Internal function that initializes the font system.
Definition: qfont_mac.cpp:131
#define qApp
The QStringList class provides a list of strings.
Definition: qstringlist.h:66
static void setAppDpiY(int screen, int dpi)
Sets the vertical resolution of the given screen to the number of dots per inch specified by ydpi...
static int toInt(const QByteArray &str)
Definition: generator.cpp:167
Q_CORE_EXPORT void qWarning(const char *,...)
static bool getGConfBool(const QString &key, bool fallback=0)
Returns the configuration boolean for key.
Definition: qgtkstyle.cpp:144
static const char * data(const QByteArray &arr)
#define XINPUT_LOAD(symbol)
int indexOf(QChar c, int from=0, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Definition: qstring.cpp:2838
The QLatin1String class provides a thin wrapper around an US-ASCII/Latin-1 encoded string literal...
Definition: qstring.h:654
static QTextCodec * codec(MYSQL *mysql)
Definition: qsql_mysql.cpp:220
bool defaultVisual() const
Returns true if there is a default visual; otherwise returns false.
T value(int i) const
Returns the value at index position i in the list.
Definition: qlist.h:661
Qt::HANDLE colormap() const
Returns a handle for the color map.
QByteArray toLatin1() const Q_REQUIRED_RESULT
Returns a Latin-1 representation of the string as a QByteArray.
Definition: qstring.cpp:3993
#define XFIXES_LOAD_V2(symbol)
XineramaScreenInfo *(* PtrXineramaQueryScreens)(Display *dpy, int *number)
Definition: qt_x11_p.h:225
void * visual() const
Returns the current visual.
quint16 values[128]
WACOMCONFIG *(* PtrWacomConfigInit)(Display *, WACOMERRORFUNC)
bool isNull() const
Returns true if this byte array is null; otherwise returns false.
static QString graphics_system_name
static PtrWacomConfigGetRawParam ptrWacomConfigGetRawParam
char * qt_ximServer
Bool(* PtrXineramaIsActive)(Display *dpy)
Definition: qt_x11_p.h:224
int(* PtrXRRRootToScreen)(Display *, Window)
Definition: qt_x11_p.h:231
QString mid(int position, int n=-1) const Q_REQUIRED_RESULT
Returns a string that contains n characters of this string, starting at the specified position index...
Definition: qstring.cpp:3706
static void qt_set_x11_resources(const char *font=0, const char *fg=0, const char *bg=0, const char *button=0)
QString arg(qlonglong a, int fieldwidth=0, int base=10, const QChar &fillChar=QLatin1Char(' ')) const Q_REQUIRED_RESULT
Definition: qstring.cpp:7186
static const char * mwTitle
static QInputContext * inputContext
The QFont class specifies a font used for drawing text.
Definition: qfont.h:64
static void * appVisual(int screen=-1)
Returns the current visual used by the application on the given screen.
Q_CORE_EXPORT char * qstrdup(const char *)
int lastIndexOf(QChar c, int from=-1, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Definition: qstring.cpp:3000
static QString fromLatin1(const char *, int size=-1)
Returns a QString initialized with the first size characters of the Latin-1 string str...
Definition: qstring.cpp:4188
static void changeKeyboard()
Definition: qkeymapper.cpp:90
int toInt(bool *ok=0, int base=10) const
Returns the byte array converted to an int using base base, which is 10 by default and must be betwee...
static void initialize()
const_iterator ConstIterator
Qt-style synonym for QList::const_iterator.
Definition: qlist.h:279
QString toLower() const Q_REQUIRED_RESULT
Returns a lowercase copy of the string.
Definition: qstring.cpp:5389
long unsigned int eventList[TOTAL_XINPUT_EVENTS]
static bool desktopSettingsAware()
Returns true if Qt is set to use the system&#39;s standard colors, fonts, etc.
static int qt_x_errhandler(Display *dpy, XErrorEvent *err)
bool qt_is_gui_used
int qstrncmp(const char *str1, const char *str2, uint len)
Definition: qbytearray.h:101
static int qt_xio_errhandler(Display *)
if(void) toggleToolbarShown
static QGraphicsSystem * graphics_system
static void qt_get_net_supported()
static QTextCodec * codecForName(const QByteArray &name)
Searches all installed QTextCodec objects and returns the one which best matches name; the match is c...
Bool(* PtrXRRQueryExtension)(Display *, int *, int *)
Definition: qt_x11_p.h:232
void(* PtrWacomConfigTerm)(WACOMCONFIG *)
static const char * mwGeometry
static void initialize()
Definition: qcursor.cpp:417
QStringList split(const QString &sep, SplitBehavior behavior=KeepEmptyParts, Qt::CaseSensitivity cs=Qt::CaseSensitive) const Q_REQUIRED_RESULT
Splits the string into substrings wherever sep occurs, and returns the list of those strings...
Definition: qstring.cpp:6526
int qstrcmp(const QByteArray &str1, const char *str2)
Definition: qbytearray.cpp:336
static int(* original_x_errhandler)(Display *dpy, XErrorEvent *)
static void getXDefault(const char *group, const char *key, int *val)
static const char * appBGCol
static bool appNoGrab
static bool testAttribute(Qt::ApplicationAttribute attribute)
Returns true if attribute attribute is set; otherwise returns false.
static const char * appFGCol
The QTextCodec class provides conversions between text encodings.
Definition: qtextcodec.h:62
static const KeyPair *const end
static int(* original_xio_errhandler)(Display *dpy)
bool runningUnderDebugger()
static void qt_x11_create_intern_atoms()
void(* PtrXRRSelectInput)(Display *, Window, int)
Definition: qt_x11_p.h:229
static void setAppDpiX(int screen, int dpi)
Sets the horizontal resolution of the given screen to the number of dots per inch specified by xdpi...
The QLatin1Char class provides an 8-bit ASCII/Latin-1 character.
Definition: qchar.h:55
static void setCodecForTr(QTextCodec *c)
Definition: qtextcodec.h:156
static Display * display()
Returns the default display for the application.
static bool isNull(const QVariant::Private *d)
Definition: qvariant.cpp:300
int screen() const
Returns the number of the screen currently in use.
Cursor(* PtrXcursorLibraryLoadCursor)(Display *, const char *)
Definition: qt_x11_p.h:219
The QLibrary class loads shared libraries at runtime.
Definition: qlibrary.h:62
QBool contains(char c) const
Returns true if the byte array contains the character ch; otherwise returns false.
Definition: qbytearray.h:525
const_iterator constEnd() const
Returns a const STL-style iterator pointing to the imaginary item after the last item in the list...
Definition: qlist.h:272
#define XFIXES_LOAD_V1(symbol)
#define QT_VERSION
This macro expands a numeric value of the form 0xMMNNPP (MM = major, NN = minor, PP = patch) that spe...
Definition: qglobal.h:51
static PtrWacomConfigOpenDevice ptrWacomConfigOpenDevice
static bool appDoGrab
static int appDpiY(int screen=-1)
Returns the vertical resolution of the given screen in terms of the number of dots per inch...

◆ qt_x11_getX11InfoForWindow

void qt_x11_getX11InfoForWindow ( QX11Info xinfo,
const QX11WindowAttributes a 
)
friend

Definition at line 3114 of file qwidget_x11.cpp.

3115 {
3116  QX11InfoData* xd = xinfo->getX11Data(true);
3117  const XWindowAttributes &a = *(att.att);
3118  // find which screen the window is on...
3119  xd->screen = QX11Info::appScreen(); // by default, use the default :)
3120  int i;
3121  for (i = 0; i < ScreenCount(X11->display); i++) {
3122  if (RootWindow(X11->display, i) == a.root) {
3123  xd->screen = i;
3124  break;
3125  }
3126  }
3127 
3128  xd->depth = a.depth;
3129  xd->cells = DisplayCells(X11->display, xd->screen);
3130  xd->visual = a.visual;
3131  xd->defaultVisual = (XVisualIDFromVisual((Visual *) a.visual) ==
3132  XVisualIDFromVisual((Visual *) QX11Info::appVisual(xinfo->screen())));
3133  xd->colormap = a.colormap;
3134  xd->defaultColormap = (a.colormap == QX11Info::appColormap(xinfo->screen()));
3135  xinfo->setX11Data(xd);
3136 }
static int appScreen()
Returns the number of the screen where the application is being displayed.
#define X11
Definition: qt_x11_p.h:724
QX11InfoData * getX11Data(bool def=false) const
static Qt::HANDLE appColormap(int screen=-1)
Returns a handle for the application&#39;s color map on the given screen.
Visual * visual
Definition: qt_x11_p.h:318
static void * appVisual(int screen=-1)
Returns the current visual used by the application on the given screen.
Colormap colormap
Definition: qt_x11_p.h:317
void setX11Data(const QX11InfoData *)
Makes a shallow copy of the X11-specific data d and assigns it to this class.
bool defaultColormap
Definition: qt_x11_p.h:319
int screen() const
Returns the number of the screen currently in use.
bool defaultVisual
Definition: qt_x11_p.h:320

◆ QWidget

friend class QWidget
friend

Definition at line 110 of file qx11info_x11.h.

◆ QWidgetPrivate

friend class QWidgetPrivate
friend

Definition at line 111 of file qx11info_x11.h.

◆ QX11PaintEngine

friend class QX11PaintEngine
friend

Definition at line 107 of file qx11info_x11.h.

◆ QX11PixmapData

friend class QX11PixmapData
friend

Definition at line 109 of file qx11info_x11.h.

Properties

◆ x11data

QX11InfoData* QX11Info::x11data
protected

The documentation for this class was generated from the following files: