Qt 4.8
Classes | Macros | Functions | Variables
qapplication.cpp File Reference
#include "qplatformdefs.h"
#include "qabstracteventdispatcher.h"
#include "qaccessible.h"
#include "qapplication.h"
#include "qclipboard.h"
#include "qcursor.h"
#include "qdesktopwidget.h"
#include "qdir.h"
#include "qevent.h"
#include "qfile.h"
#include "qfileinfo.h"
#include "qgraphicsscene.h"
#include "qhash.h"
#include "qset.h"
#include "qlayout.h"
#include "qsessionmanager.h"
#include "qstyle.h"
#include "qstylefactory.h"
#include "qtextcodec.h"
#include "qtranslator.h"
#include "qvariant.h"
#include "qwidget.h"
#include "qdnd_p.h"
#include "qcolormap.h"
#include "qdebug.h"
#include "private/qgraphicssystemfactory_p.h"
#include "private/qgraphicssystem_p.h"
#include "private/qstylesheetstyle_p.h"
#include "private/qstyle_p.h"
#include "qmessagebox.h"
#include <QtGui/qgraphicsproxywidget.h>
#include "qinputcontext.h"
#include "qkeymapper_p.h"
#include <private/qt_x11_p.h>
#include "qinputcontextfactory.h"
#include "qguiplatformplugin_p.h"
#include <qthread.h>
#include <private/qthread_p.h>
#include <private/qfont_p.h>
#include <stdlib.h>
#include <link.h>
#include "qapplication_p.h"
#include "qevent_p.h"
#include "qwidget_p.h"
#include "qgesture.h"
#include "private/qgesturemanager_p.h"
#include "qlibrary.h"
#include "qdatetime.h"
#include "qguifunctions_wince.h"
#include "moc_qapplication.cpp"

Go to the source code of this file.

Classes

class  QSessionManagerPrivate
 

Macros

#define CoCreateGuid   qt_CoCreateGuid
 
#define QT_GUI_DRAG_DISTANCE   4
 

Functions

static void initResources ()
 
void qInitDrawhelperAsm ()
 
void qInitImageConversions ()
 
int qRegisterGuiStateMachine ()
 
int qRegisterGuiVariant ()
 
FontHashqt_app_fonts_hash ()
 
PaletteHashqt_app_palettes_hash ()
 
Q_CORE_EXPORT void qt_call_post_routines ()
 
void qt_cleanup ()
 
HRESULT qt_CoCreateGuid (GUID *guid)
 
static bool qt_detectRTLLanguage ()
 
void qt_init (QApplicationPrivate *priv, int type, Display *display=0, Qt::HANDLE visual=0, Qt::HANDLE colormap=0)
 
QString qt_mac_applicationmenu_string (int type)
 em>Reimplemented Function More...
 
static int qt_matchLibraryName (dl_phdr_info *info, size_t, void *data)
 
bool qt_sendSpontaneousEvent (QObject *receiver, QEvent *event)
 
Q_GUI_EXPORT void qt_translateRawTouchEvent (QWidget *window, QTouchEvent::DeviceType deviceType, const QList< QTouchEvent::TouchPoint > &touchPoints)
 
Q_GUI_EXPORT bool qt_tryModalHelper (QWidget *widget, QWidget **rettop)
 
bool qt_wince_is_mobile ()
 
bool qt_wince_is_pocket_pc ()
 
bool qt_wince_is_smartphone ()
 
int qUnregisterGuiStateMachine ()
 
int qUnregisterGuiVariant ()
 

Variables

static int aargc = 1
 
static char * aargv [] = { (char*)"unknown", 0 }
 
static const char * application_menu_strings []
 
static const char *const copy_xpm []
 
static int drag_distance = QT_GUI_DRAG_DISTANCE
 
static int drag_time = 500
 
static bool force_reverse = false
 
static const char *const ignore_xpm []
 
static Qt::LayoutDirection layout_direction = Qt::LeftToRight
 
static const char *const link_xpm []
 
static const char *const move_xpm []
 
int qt_antialiasing_threshold = -1
 
QApplication::Type qt_appType =QApplication::Tty
 
QWidgetqt_button_down
 
QClipboardqt_clipboard = 0
 
QDesktopWidgetqt_desktopWidget = 0
 
bool qt_in_tab_key_event = false
 
bool qt_is_gui_used
 
QPointer< QWidgetqt_last_mouse_receiver
 
QWidgetListqt_modal_stack =0
 
QSessionManagerqt_session_manager_self = 0
 
bool Q_GUI_EXPORT qt_tab_all_widgets = true
 
bool qt_tabletChokeMouse = false
 

Macro Definition Documentation

◆ CoCreateGuid

#define CoCreateGuid   qt_CoCreateGuid

◆ QT_GUI_DRAG_DISTANCE

#define QT_GUI_DRAG_DISTANCE   4

Definition at line 498 of file qapplication.cpp.

Function Documentation

◆ initResources()

static void initResources ( )
static

Definition at line 135 of file qapplication.cpp.

Referenced by QApplicationPrivate::construct().

136 {
137 #if defined(Q_WS_WINCE)
138  Q_INIT_RESOURCE_EXTERN(qstyle_wince)
139  Q_INIT_RESOURCE(qstyle_wince);
140 #elif defined(Q_OS_SYMBIAN)
141  Q_INIT_RESOURCE_EXTERN(qstyle_s60)
142  Q_INIT_RESOURCE(qstyle_s60);
143 #else
144  Q_INIT_RESOURCE_EXTERN(qstyle)
145  Q_INIT_RESOURCE(qstyle);
146 #endif
147  Q_INIT_RESOURCE_EXTERN(qmessagebox)
148  Q_INIT_RESOURCE(qmessagebox);
149 #if !defined(QT_NO_PRINTDIALOG)
150  Q_INIT_RESOURCE_EXTERN(qprintdialog)
151  Q_INIT_RESOURCE(qprintdialog);
152 #endif
153 #ifdef Q_WS_MAC
154  Q_INIT_RESOURCE_EXTERN(macresources)
155  Q_INIT_RESOURCE(macresources);
156 #endif
157 }
#define Q_INIT_RESOURCE(name)
Definition: qglobal.h:965
#define Q_INIT_RESOURCE_EXTERN(name)
Definition: qglobal.h:962

◆ qInitDrawhelperAsm()

void qInitDrawhelperAsm ( )

Definition at line 7659 of file qdrawhelper.cpp.

Referenced by QApplication::QApplication(), and qt_qimageScaleAARGB().

7660 {
7661 
7662  qt_memfill32 = qt_memfill_template<quint32, quint32>;
7663  qt_memfill16 = qt_memfill_quint16; //qt_memfill_template<quint16, quint16>;
7664 
7665  CompositionFunction *functionForModeAsm = 0;
7666  CompositionFunctionSolid *functionForModeSolidAsm = 0;
7667 
7668  const uint features = qDetectCPUFeatures();
7669  if (false) {
7670 #ifdef QT_HAVE_SSE2
7671  } else if (features & SSE2) {
7672  qt_memfill32 = qt_memfill32_sse2;
7673  qt_memfill16 = qt_memfill16_sse2;
7674  qDrawHelper[QImage::Format_RGB32].bitmapBlit = qt_bitmapblit32_sse2;
7675  qDrawHelper[QImage::Format_ARGB32].bitmapBlit = qt_bitmapblit32_sse2;
7677  qDrawHelper[QImage::Format_RGB16].bitmapBlit = qt_bitmapblit16_sse2;
7678 #endif
7679 #ifdef QT_HAVE_SSE
7680  } else if (features & SSE) {
7681 // qt_memfill32 = qt_memfill32_sse;
7682  qDrawHelper[QImage::Format_RGB16].bitmapBlit = qt_bitmapblit16_sse;
7683 #ifdef QT_HAVE_3DNOW
7684  if (features & MMX3DNOW) {
7685  qt_memfill32 = qt_memfill32_sse3dnow;
7686  qDrawHelper[QImage::Format_RGB16].bitmapBlit = qt_bitmapblit16_sse3dnow;
7687  }
7688 #endif
7689 #endif // SSE
7690  }
7691 #ifdef QT_HAVE_MMX
7692  if (features & MMX) {
7693  functionForModeAsm = qt_functionForMode_MMX;
7694 
7695  functionForModeSolidAsm = qt_functionForModeSolid_MMX;
7696  qDrawHelper[QImage::Format_ARGB32_Premultiplied].blendColor = qt_blend_color_argb_mmx;
7697 #ifdef QT_HAVE_3DNOW
7698  if (features & MMX3DNOW) {
7699  functionForModeAsm = qt_functionForMode_MMX3DNOW;
7700  functionForModeSolidAsm = qt_functionForModeSolid_MMX3DNOW;
7701  qDrawHelper[QImage::Format_ARGB32_Premultiplied].blendColor = qt_blend_color_argb_mmx3dnow;
7702  }
7703 #endif // 3DNOW
7704 
7705  extern void qt_blend_rgb32_on_rgb32_mmx(uchar *destPixels, int dbpl,
7706  const uchar *srcPixels, int sbpl,
7707  int w, int h,
7708  int const_alpha);
7709  extern void qt_blend_argb32_on_argb32_mmx(uchar *destPixels, int dbpl,
7710  const uchar *srcPixels, int sbpl,
7711  int w, int h,
7712  int const_alpha);
7713 
7714  qBlendFunctions[QImage::Format_RGB32][QImage::Format_RGB32] = qt_blend_rgb32_on_rgb32_mmx;
7718 
7719  }
7720 #endif // MMX
7721 
7722 #ifdef QT_HAVE_SSE
7723  if (features & SSE) {
7724  extern void qt_blend_rgb32_on_rgb32_sse(uchar *destPixels, int dbpl,
7725  const uchar *srcPixels, int sbpl,
7726  int w, int h,
7727  int const_alpha);
7728  extern void qt_blend_argb32_on_argb32_sse(uchar *destPixels, int dbpl,
7729  const uchar *srcPixels, int sbpl,
7730  int w, int h,
7731  int const_alpha);
7732 
7733  qBlendFunctions[QImage::Format_RGB32][QImage::Format_RGB32] = qt_blend_rgb32_on_rgb32_sse;
7737  }
7738 #endif // SSE
7739 
7740 #ifdef QT_HAVE_SSE2
7741  if (features & SSE2) {
7742  extern void qt_blend_rgb32_on_rgb32_sse2(uchar *destPixels, int dbpl,
7743  const uchar *srcPixels, int sbpl,
7744  int w, int h,
7745  int const_alpha);
7746  extern void qt_blend_argb32_on_argb32_sse2(uchar *destPixels, int dbpl,
7747  const uchar *srcPixels, int sbpl,
7748  int w, int h,
7749  int const_alpha);
7750 
7751  qBlendFunctions[QImage::Format_RGB32][QImage::Format_RGB32] = qt_blend_rgb32_on_rgb32_sse2;
7755 
7756  extern const uint * QT_FASTCALL qt_fetch_radial_gradient_sse2(uint *buffer, const Operator *op, const QSpanData *data,
7757  int y, int x, int length);
7758 
7759  qt_fetch_radial_gradient = qt_fetch_radial_gradient_sse2;
7760  }
7761 
7762 #ifdef QT_HAVE_SSSE3
7763  if (features & SSSE3) {
7764  extern void qt_blend_argb32_on_argb32_ssse3(uchar *destPixels, int dbpl,
7765  const uchar *srcPixels, int sbpl,
7766  int w, int h,
7767  int const_alpha);
7768 
7769  qBlendFunctions[QImage::Format_RGB32][QImage::Format_ARGB32_Premultiplied] = qt_blend_argb32_on_argb32_ssse3;
7771  }
7772 #endif // SSSE3
7773 
7774 #endif // SSE2
7775 
7776 #ifdef QT_HAVE_SSE
7777  if (features & SSE) {
7778  functionForModeAsm = qt_functionForMode_SSE;
7779  functionForModeSolidAsm = qt_functionForModeSolid_SSE;
7780  qDrawHelper[QImage::Format_ARGB32_Premultiplied].blendColor = qt_blend_color_argb_sse;
7781 #ifdef QT_HAVE_3DNOW
7782  if (features & MMX3DNOW) {
7783  functionForModeAsm = qt_functionForMode_SSE3DNOW;
7784  functionForModeSolidAsm = qt_functionForModeSolid_SSE3DNOW;
7785  qDrawHelper[QImage::Format_ARGB32_Premultiplied].blendColor = qt_blend_color_argb_sse3dnow;
7786  }
7787 #endif // 3DNOW
7788 
7789 
7790 #ifdef QT_HAVE_SSE2
7791  if (features & SSE2) {
7792  extern void QT_FASTCALL comp_func_SourceOver_sse2(uint *destPixels,
7793  const uint *srcPixels,
7794  int length,
7795  uint const_alpha);
7796  extern void QT_FASTCALL comp_func_solid_SourceOver_sse2(uint *destPixels, int length, uint color, uint const_alpha);
7797  extern void QT_FASTCALL comp_func_Plus_sse2(uint *dst, const uint *src, int length, uint const_alpha);
7798  extern void QT_FASTCALL comp_func_Source_sse2(uint *dst, const uint *src, int length, uint const_alpha);
7799 
7800  functionForModeAsm[0] = comp_func_SourceOver_sse2;
7801  functionForModeAsm[QPainter::CompositionMode_Source] = comp_func_Source_sse2;
7802  functionForModeAsm[QPainter::CompositionMode_Plus] = comp_func_Plus_sse2;
7803  functionForModeSolidAsm[0] = comp_func_solid_SourceOver_sse2;
7804  }
7805 #endif
7806  }
7807 #elif defined(QT_HAVE_SSE2)
7808  // this is the special case when SSE2 is usable but MMX/SSE is not usable (e.g.: Windows x64 + visual studio)
7809  if (features & SSE2) {
7810  functionForModeAsm = qt_functionForMode_onlySSE2;
7811  functionForModeSolidAsm = qt_functionForModeSolid_onlySSE2;
7812  }
7813 #endif
7814 
7815 #ifdef QT_HAVE_IWMMXT
7816  if (features & IWMMXT) {
7817  functionForModeAsm = qt_functionForMode_IWMMXT;
7818  functionForModeSolidAsm = qt_functionForModeSolid_IWMMXT;
7819  qDrawHelper[QImage::Format_ARGB32_Premultiplied].blendColor = qt_blend_color_argb_iwmmxt;
7820  }
7821 #endif // IWMMXT
7822 
7823 #if defined(QT_HAVE_ARM_SIMD)
7824  qBlendFunctions[QImage::Format_RGB32][QImage::Format_RGB32] = qt_blend_rgb32_on_rgb32_arm_simd;
7825  qBlendFunctions[QImage::Format_ARGB32_Premultiplied][QImage::Format_RGB32] = qt_blend_rgb32_on_rgb32_arm_simd;
7826  qBlendFunctions[QImage::Format_RGB32][QImage::Format_ARGB32_Premultiplied] = qt_blend_argb32_on_argb32_arm_simd;
7828 #elif defined(QT_HAVE_NEON)
7829  if (features & NEON) {
7830  qBlendFunctions[QImage::Format_RGB32][QImage::Format_RGB32] = qt_blend_rgb32_on_rgb32_neon;
7836  qBlendFunctions[QImage::Format_RGB16][QImage::Format_RGB16] = qt_blend_rgb16_on_rgb16_neon;
7837 
7838  qScaleFunctions[QImage::Format_RGB16][QImage::Format_ARGB32_Premultiplied] = qt_scale_image_argb32_on_rgb16_neon;
7839  qScaleFunctions[QImage::Format_RGB16][QImage::Format_RGB16] = qt_scale_image_rgb16_on_rgb16_neon;
7840 
7841  qTransformFunctions[QImage::Format_RGB16][QImage::Format_ARGB32_Premultiplied] = qt_transform_image_argb32_on_rgb16_neon;
7842  qTransformFunctions[QImage::Format_RGB16][QImage::Format_RGB16] = qt_transform_image_rgb16_on_rgb16_neon;
7843 
7844  qDrawHelper[QImage::Format_RGB16].alphamapBlit = qt_alphamapblit_quint16_neon;
7845 
7846  functionForMode_C[QPainter::CompositionMode_SourceOver] = qt_blend_argb32_on_argb32_scanline_neon;
7847  functionForModeSolid_C[QPainter::CompositionMode_SourceOver] = comp_func_solid_SourceOver_neon;
7848  functionForMode_C[QPainter::CompositionMode_Plus] = comp_func_Plus_neon;
7849  destFetchProc[QImage::Format_RGB16] = qt_destFetchRGB16_neon;
7850  destStoreProc[QImage::Format_RGB16] = qt_destStoreRGB16_neon;
7851 
7852  qMemRotateFunctions[QImage::Format_RGB16][0] = qt_memrotate90_16_neon;
7853  qMemRotateFunctions[QImage::Format_RGB16][2] = qt_memrotate270_16_neon;
7854  qt_memfill32 = qt_memfill32_neon;
7855 
7856  extern const uint * QT_FASTCALL qt_fetch_radial_gradient_neon(uint *buffer, const Operator *op, const QSpanData *data,
7857  int y, int x, int length);
7858 
7859  qt_fetch_radial_gradient = qt_fetch_radial_gradient_neon;
7860  }
7861 #endif
7862 
7863  if (functionForModeSolidAsm) {
7864  const int destinationMode = QPainter::CompositionMode_Destination;
7865  functionForModeSolidAsm[destinationMode] = functionForModeSolid_C[destinationMode];
7866 
7867  // use the default qdrawhelper implementation for the
7868  // extended composition modes
7869  for (int mode = 12; mode < 24; ++mode)
7870  functionForModeSolidAsm[mode] = functionForModeSolid_C[mode];
7871 
7872  functionForModeSolid = functionForModeSolidAsm;
7873  }
7874  if (functionForModeAsm)
7875  functionForMode = functionForModeAsm;
7876 
7878 }
qt_memfill16_func qt_memfill16
qt_memfill32_func qt_memfill32
AlphamapBlitFunc alphamapBlit
BitmapBlitFunc bitmapBlit
static SourceFetchProc qt_fetch_radial_gradient
static void qt_memfill_quint16(quint16 *dest, quint16 color, int count)
Definition: qsimd_p.h:217
static CompositionFunction functionForMode_C[]
SrcOverBlendFunc qBlendFunctions[QImage::NImageFormats][QImage::NImageFormats]
MemRotateFunc qMemRotateFunctions[QImage::NImageFormats][3]
Definition: qmemrotate.cpp:627
void qt_build_pow_tables()
#define QT_FASTCALL
Definition: qglobal.h:1161
ProcessSpans blendColor
Definition: qsimd_p.h:212
static const CompositionFunctionSolid * functionForModeSolid
unsigned char uchar
Definition: qglobal.h:994
SrcOverTransformFunc qTransformFunctions[QImage::NImageFormats][QImage::NImageFormats]
static DestStoreProc destStoreProc[QImage::NImageFormats]
static const char * data(const QByteArray &arr)
unsigned int uint
Definition: qglobal.h:996
DrawHelper qDrawHelper[QImage::NImageFormats]
static DestFetchProc destFetchProc[QImage::NImageFormats]
uint qDetectCPUFeatures()
Definition: qsimd.cpp:382
void(QT_FASTCALL * CompositionFunction)(uint *dest, const uint *src, int length, uint const_alpha)
Definition: qsimd_p.h:222
static CompositionFunctionSolid functionForModeSolid_C[]
void(QT_FASTCALL * CompositionFunctionSolid)(uint *dest, int length, uint color, uint const_alpha)
static const CompositionFunction * functionForMode
Definition: qsimd_p.h:220
SrcOverScaleFunc qScaleFunctions[QImage::NImageFormats][QImage::NImageFormats]
Definition: qsimd_p.h:216

◆ qInitImageConversions()

void qInitImageConversions ( )

Definition at line 3909 of file qimage.cpp.

Referenced by QApplication::QApplication().

3910 {
3911  const uint features = qDetectCPUFeatures();
3912  Q_UNUSED(features);
3913 
3914 #ifdef QT_HAVE_SSE2
3915  if (features & SSE2) {
3916  extern bool convert_ARGB_to_ARGB_PM_inplace_sse2(QImageData *data, Qt::ImageConversionFlags);
3917  inplace_converter_map[QImage::Format_ARGB32][QImage::Format_ARGB32_Premultiplied] = convert_ARGB_to_ARGB_PM_inplace_sse2;
3918  }
3919 #endif
3920 #ifdef QT_HAVE_SSSE3
3921  if (features & SSSE3) {
3922  extern void convert_RGB888_to_RGB32_ssse3(QImageData *dest, const QImageData *src, Qt::ImageConversionFlags);
3923  converter_map[QImage::Format_RGB888][QImage::Format_RGB32] = convert_RGB888_to_RGB32_ssse3;
3924  converter_map[QImage::Format_RGB888][QImage::Format_ARGB32] = convert_RGB888_to_RGB32_ssse3;
3926  }
3927 #endif
3928 #ifdef QT_HAVE_NEON
3929  if (features & NEON) {
3930  extern void convert_RGB888_to_RGB32_neon(QImageData *dest, const QImageData *src, Qt::ImageConversionFlags);
3931  converter_map[QImage::Format_RGB888][QImage::Format_RGB32] = convert_RGB888_to_RGB32_neon;
3932  converter_map[QImage::Format_RGB888][QImage::Format_ARGB32] = convert_RGB888_to_RGB32_neon;
3934  }
3935 #endif
3936 }
Definition: qsimd_p.h:217
static const char * data(const QByteArray &arr)
unsigned int uint
Definition: qglobal.h:996
uint qDetectCPUFeatures()
Definition: qsimd.cpp:382
Definition: qsimd_p.h:222
static InPlace_Image_Converter inplace_converter_map[QImage::NImageFormats][QImage::NImageFormats]
Definition: qimage.cpp:3812
Definition: qsimd_p.h:220
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
Definition: qglobal.h:1729
static Image_Converter converter_map[QImage::NImageFormats][QImage::NImageFormats]
Definition: qimage.cpp:3513

◆ qRegisterGuiStateMachine()

int qRegisterGuiStateMachine ( )

Definition at line 506 of file qguistatemachine.cpp.

Referenced by QApplication::QApplication().

507 {
510  return 1;
511 }
static const QStateMachinePrivate::Handler * qt_guistatemachine_last_handler
const QStateMachinePrivate::Handler qt_gui_statemachine_handler
static const Handler * handler

◆ qRegisterGuiVariant()

int qRegisterGuiVariant ( )

Definition at line 811 of file qguivariant.cpp.

Referenced by QVariant::operator!=(), and QApplication::QApplication().

812 {
816  return 1;
817 }
const QVariant::Handler qt_gui_variant_handler
static const QMetaTypeGuiHelper qVariantGuiHelper[]
Q_CORE_EXPORT const QMetaTypeGuiHelper * qMetaTypeGuiHelper
Definition: qmetatype.cpp:346
static const Handler * handler
Definition: qvariant.h:419
static const QVariant::Handler * qt_guivariant_last_handler

◆ qt_app_fonts_hash()

FontHash* qt_app_fonts_hash ( )

◆ qt_app_palettes_hash()

PaletteHash* qt_app_palettes_hash ( )

Definition at line 547 of file qapplication.cpp.

Referenced by QGtkStyleFilter::eventFilter(), and QApplicationPrivate::initializeWidgetPaletteHash().

548 {
549  return app_palettes();
550 }

◆ qt_call_post_routines()

Q_CORE_EXPORT void qt_call_post_routines ( )

Definition at line 289 of file qcoreapplication.cpp.

Referenced by initResources(), QApplication::~QApplication(), and QCoreApplication::~QCoreApplication().

290 {
291  QVFuncList *list = 0;
292  QT_TRY {
293  list = postRList();
294  } QT_CATCH(const std::bad_alloc &) {
295  // ignore - if we can't allocate a post routine list,
296  // there's a high probability that there's no post
297  // routine to be executed :)
298  }
299  if (!list)
300  return;
301  while (!list->isEmpty())
302  (list->takeFirst())();
303 }
bool isEmpty() const
Returns true if the list contains no items; otherwise returns false.
Definition: qlist.h:152
T takeFirst()
Removes the first item in the list and returns it.
Definition: qlist.h:489
#define QT_CATCH(A)
Definition: qglobal.h:1537
#define QT_TRY
Definition: qglobal.h:1536
The QList class is a template class that provides lists.
Definition: qdatastream.h:62

◆ qt_cleanup()

void qt_cleanup ( )

Definition at line 1328 of file qapplication_mac.mm.

Referenced by QApplication::~QApplication(), and QApplicationPrivate::~QApplicationPrivate().

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()
QTextStream & center(QTextStream &stream)
Calls QTextStream::setFieldAlignment(QTextStream::AlignCenter) on stream and returns stream...
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
#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_CoCreateGuid()

HRESULT qt_CoCreateGuid ( GUID guid)

Definition at line 5021 of file qapplication.cpp.

5022 {
5023  // We will use the following information to create the GUID
5024  // 1. absolute path to application
5025  wchar_t tempFilename[MAX_PATH];
5026  if (!GetModuleFileName(0, tempFilename, MAX_PATH))
5027  return S_FALSE;
5028  unsigned int hash = qHash(QString::fromWCharArray(tempFilename));
5029  guid->Data1 = hash;
5030  // 2. creation time of file
5031  QFileInfo info(QString::fromWCharArray(tempFilename));
5032  guid->Data2 = qHash(info.created().toTime_t());
5033  // 3. current system time
5034  guid->Data3 = qHash(QDateTime::currentDateTime().toTime_t());
5035  return S_OK;
5036 }
static QString fromWCharArray(const wchar_t *, int size=-1)
Returns a copy of the string, where the encoding of string depends on the size of wchar...
Definition: qstring.cpp:1019
static uint hash(const uchar *p, int n)
Definition: qhash.cpp:68
static mach_timebase_info_data_t info
ulong Data1
Definition: quuid.h:54
uint qHash(const QUrl &url)
Definition: qurl.h:285
ushort Data3
Definition: quuid.h:56
static QDateTime currentDateTime()
Returns the current datetime, as reported by the system clock, in the local time zone.
Definition: qdatetime.cpp:3138
The QFileInfo class provides system-independent file information.
Definition: qfileinfo.h:60
ushort Data2
Definition: quuid.h:55

◆ qt_detectRTLLanguage()

static bool qt_detectRTLLanguage ( )
static

Definition at line 2470 of file qapplication.cpp.

Referenced by QApplication::event().

2471 {
2472  return force_reverse ^
2473  (QApplication::tr("QT_LAYOUT_DIRECTION",
2474  "Translate this string to the string 'LTR' in left-to-right"
2475  " languages or to 'RTL' in right-to-left languages (such as Hebrew"
2476  " and Arabic) to get proper widget layout.") == QLatin1String("RTL"));
2477 }
static bool force_reverse
static QString tr(const char *sourceText, const char *comment=0, int n=-1)
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString

◆ qt_init()

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

Definition at line 1666 of file qapplication_x11.cpp.

Referenced by QApplicationPrivate::construct(), and QApplicationPrivate::~QApplicationPrivate().

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
int qstrncmp(const char *str1, const char *str2, uint len)
Definition: qbytearray.h:101
static PtrWacomConfigTerm ptrWacomConfigTerm
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
int qstrcmp(const char *str1, const char *str2)
A safe strcmp() function.
Definition: qbytearray.cpp:231
#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 *)
static const char * appClass
#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 &)
Q_GUI_EXPORT EGLDisplay display()
Definition: qegl.cpp:589
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
T value(int i) const
Returns the value at index position i in the list.
Definition: qlist.h:661
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
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.
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
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 *)
char * qstrdup(const char *src)
Returns a duplicate string.
Definition: qbytearray.cpp:114
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
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
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_mac_applicationmenu_string()

QString qt_mac_applicationmenu_string ( int  type)

em>Reimplemented Function

Definition at line 2488 of file qapplication.cpp.

Referenced by qt_mac_menu_merge_text().

◆ qt_matchLibraryName()

static int qt_matchLibraryName ( dl_phdr_info *  info,
size_t  ,
void *  data 
)
static

Definition at line 805 of file qapplication.cpp.

Referenced by QApplicationPrivate::construct().

806 {
807  const char *name = static_cast<const char *>(data);
808  return strstr(info->dlpi_name, name) != 0;
809 }
static mach_timebase_info_data_t info
const char * name
static const char * data(const QByteArray &arr)

◆ qt_sendSpontaneousEvent()

bool qt_sendSpontaneousEvent ( QObject receiver,
QEvent event 
)

◆ qt_translateRawTouchEvent()

Q_GUI_EXPORT void qt_translateRawTouchEvent ( QWidget window,
QTouchEvent::DeviceType  deviceType,
const QList< QTouchEvent::TouchPoint > &  touchPoints 
)

Definition at line 6191 of file qapplication.cpp.

Referenced by QTest::QTouchEventSequence::commit().

6194 {
6195  QApplicationPrivate::translateRawTouchEvent(window, deviceType, touchPoints);
6196 }
static void translateRawTouchEvent(QWidget *widget, QTouchEvent::DeviceType deviceType, const QList< QTouchEvent::TouchPoint > &touchPoints)

◆ qt_tryModalHelper()

Q_GUI_EXPORT bool qt_tryModalHelper ( QWidget widget,
QWidget **  rettop 
)

Definition at line 2949 of file qapplication.cpp.

2950 {
2951  return QApplicationPrivate::tryModalHelper(widget, rettop);
2952 }
static bool tryModalHelper(QWidget *widget, QWidget **rettop=0)

◆ qt_wince_is_mobile()

bool qt_wince_is_mobile ( )

Definition at line 296 of file qguifunctions_wince.cpp.

296  {
298 }
bool qt_wince_is_pocket_pc()
bool qt_wince_is_smartphone()

◆ qt_wince_is_pocket_pc()

bool qt_wince_is_pocket_pc ( )

Definition at line 289 of file qguifunctions_wince.cpp.

289  {
290  return qt_wince_is_platform(QString::fromLatin1("PocketPC"));
291 }
bool qt_wince_is_platform(const QString &platformString)
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

◆ qt_wince_is_smartphone()

bool qt_wince_is_smartphone ( )

Definition at line 293 of file qguifunctions_wince.cpp.

293  {
294  return qt_wince_is_platform(QString::fromLatin1("Smartphone"));
295 }
bool qt_wince_is_platform(const QString &platformString)
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

◆ qUnregisterGuiStateMachine()

int qUnregisterGuiStateMachine ( )

Definition at line 514 of file qguistatemachine.cpp.

Referenced by QApplication::QApplication(), and QApplication::~QApplication().

515 {
517  return 1;
518 }
static const QStateMachinePrivate::Handler * qt_guistatemachine_last_handler
static const Handler * handler

◆ qUnregisterGuiVariant()

int qUnregisterGuiVariant ( )

Definition at line 820 of file qguivariant.cpp.

Referenced by QVariant::operator!=(), QApplication::QApplication(), and QApplication::~QApplication().

821 {
823  qMetaTypeGuiHelper = 0;
824  return 1;
825 }
Q_CORE_EXPORT const QMetaTypeGuiHelper * qMetaTypeGuiHelper
Definition: qmetatype.cpp:346
static const Handler * handler
Definition: qvariant.h:419
static const QVariant::Handler * qt_guivariant_last_handler

Variable Documentation

◆ aargc

int aargc = 1
static

Definition at line 896 of file qapplication.cpp.

Referenced by QApplication::QApplication().

◆ aargv

char* aargv[] = { (char*)"unknown", 0 }
static

Definition at line 897 of file qapplication.cpp.

Referenced by QApplication::QApplication().

◆ application_menu_strings

const char* application_menu_strings[]
static
Initial value:
= {
QT_TRANSLATE_NOOP("MAC_APPLICATION_MENU","Services"),
QT_TRANSLATE_NOOP("MAC_APPLICATION_MENU","Hide %1"),
QT_TRANSLATE_NOOP("MAC_APPLICATION_MENU","Hide Others"),
QT_TRANSLATE_NOOP("MAC_APPLICATION_MENU","Show All"),
QT_TRANSLATE_NOOP("MAC_APPLICATION_MENU","Preferences..."),
QT_TRANSLATE_NOOP("MAC_APPLICATION_MENU","Quit %1"),
}
#define QT_TRANSLATE_NOOP(scope, x)
Marks the string literal sourceText for dynamic translation in the given context; i...
Definition: qglobal.h:2487

Definition at line 2479 of file qapplication.cpp.

Referenced by qt_mac_applicationmenu_string().

◆ copy_xpm

const char* const copy_xpm[]
static

Definition at line 6285 of file qapplication.cpp.

Referenced by QApplicationPrivate::getPixmapCursor().

◆ drag_distance

int drag_distance = QT_GUI_DRAG_DISTANCE
static

◆ drag_time

int drag_time = 500
static

◆ force_reverse

bool force_reverse = false
static

Definition at line 527 of file qapplication.cpp.

Referenced by QApplicationPrivate::process_cmdline(), and qt_detectRTLLanguage().

◆ ignore_xpm

const char* const ignore_xpm[]
static

Definition at line 6247 of file qapplication.cpp.

Referenced by QApplicationPrivate::getPixmapCursor().

◆ layout_direction

Qt::LayoutDirection layout_direction = Qt::LeftToRight
static

◆ link_xpm

const char* const link_xpm[]
static

Definition at line 6345 of file qapplication.cpp.

Referenced by QApplicationPrivate::getPixmapCursor().

◆ move_xpm

const char* const move_xpm[]
static
Initial value:
= {
"11 20 3 1",
". c None",
"a c #000000",
"X c #FFFFFF",
"aa.........",
"aXa........",
"aXXa.......",
"aXXXa......",
"aXXXXa.....",
"aXXXXXa....",
"aXXXXXXa...",
"aXXXXXXXa..",
"aXXXXXXXXa.",
"aXXXXXXXXXa",
"aXXXXXXaaaa",
"aXXXaXXa...",
"aXXaaXXa...",
"aXa..aXXa..",
"aa...aXXa..",
"a.....aXXa.",
"......aXXa.",
".......aXXa",
".......aXXa",
"........aa."}

Definition at line 6214 of file qapplication.cpp.

Referenced by QApplicationPrivate::getPixmapCursor().

◆ qt_antialiasing_threshold

int qt_antialiasing_threshold = -1

◆ qt_appType

◆ qt_button_down

QWidget* qt_button_down

Definition at line 188 of file qapplication_mac.mm.

Referenced by QApplicationPrivate::sendMouseEvent().

◆ qt_clipboard

QClipboard* qt_clipboard = 0

◆ qt_desktopWidget

QDesktopWidget* qt_desktopWidget = 0

Definition at line 560 of file qapplication.cpp.

Referenced by QApplication::desktop(), and QApplication::~QApplication().

◆ qt_in_tab_key_event

bool qt_in_tab_key_event = false

◆ qt_is_gui_used

bool qt_is_gui_used

◆ qt_last_mouse_receiver

QPointer<QWidget> qt_last_mouse_receiver

Definition at line 189 of file qapplication_mac.mm.

Referenced by QApplicationPrivate::sendMouseEvent().

◆ qt_modal_stack

QWidgetList* qt_modal_stack =0

◆ qt_session_manager_self

QSessionManager* qt_session_manager_self = 0

Definition at line 5053 of file qapplication.cpp.

◆ qt_tab_all_widgets

bool Q_GUI_EXPORT qt_tab_all_widgets = true

◆ qt_tabletChokeMouse

bool qt_tabletChokeMouse = false