48 #include "qplatformdefs.h" 77 #include <private/qcrashhandler_p.h> 78 #include <private/qcolor_p.h> 79 #include <private/qcursor_p.h> 80 #include <private/qiconloader_p.h> 86 #include <private/qgraphicssystemfactory_p.h> 90 #if !defined (QT_NO_TABLET) 92 # define class c_class //XIproto.h has a name member named 'class' which the c++ compiler doesn't like 93 # include <wacomcfg.h> 98 #ifndef QT_GUI_DOUBLE_CLICK_RADIUS 99 #define QT_GUI_DOUBLE_CLICK_RADIUS 5 105 #if !defined(QT_NO_GLIB) 109 #include <private/qpaintengine_x11_p.h> 111 #include <private/qkeymapper_p.h> 120 #include <X11/extensions/Xfixes.h> 121 #endif // QT_NO_XFIXES 126 #define XK_MISCELLANY 127 #include <X11/keysymdef.h> 128 #if !defined(QT_NO_XINPUT) 129 #include <X11/extensions/XI.h> 139 #include <private/qbackingstore_p.h> 141 #ifdef QT_RX71_MULTITOUCH 143 # include <linux/input.h> 147 #if _POSIX_VERSION+0 < 200112L && !defined(Q_OS_BSD4) 148 # define QT_NO_UNSETENV 163 extern "C" char *_Xsetlocale(
int category,
const char *locale);
164 char *_Xsetlocale(
int category,
const char *locale)
167 return setlocale(category,locale);
170 #endif // X_NOT_BROKEN 179 "_NET_WM_CONTEXT_HELP\0" 180 "_NET_WM_SYNC_REQUEST\0" 181 "_NET_WM_SYNC_REQUEST_COUNTER\0" 201 "_QT_CLIPBOARD_SENTINEL\0" 202 "_QT_SELECTION_SENTINEL\0" 203 "CLIPBOARD_MANAGER\0" 210 "_QT_INPUT_ENCODING\0" 215 "ENLIGHTENMENT_DESKTOP\0" 217 "_SGI_DESKS_MANAGER\0" 221 "_NET_VIRTUAL_ROOTS\0" 224 "_NET_MOVERESIZE_WINDOW\0" 225 "_NET_WM_MOVERESIZE\0" 228 "_NET_WM_ICON_NAME\0" 233 "_NET_WM_WINDOW_OPACITY\0" 236 "_NET_WM_STATE_ABOVE\0" 237 "_NET_WM_STATE_BELOW\0" 238 "_NET_WM_STATE_FULLSCREEN\0" 239 "_NET_WM_STATE_MAXIMIZED_HORZ\0" 240 "_NET_WM_STATE_MAXIMIZED_VERT\0" 241 "_NET_WM_STATE_MODAL\0" 242 "_NET_WM_STATE_STAYS_ON_TOP\0" 243 "_NET_WM_STATE_DEMANDS_ATTENTION\0" 245 "_NET_WM_USER_TIME\0" 246 "_NET_WM_USER_TIME_WINDOW\0" 247 "_NET_WM_FULL_PLACEMENT\0" 249 "_NET_WM_WINDOW_TYPE\0" 250 "_NET_WM_WINDOW_TYPE_DESKTOP\0" 251 "_NET_WM_WINDOW_TYPE_DOCK\0" 252 "_NET_WM_WINDOW_TYPE_TOOLBAR\0" 253 "_NET_WM_WINDOW_TYPE_MENU\0" 254 "_NET_WM_WINDOW_TYPE_UTILITY\0" 255 "_NET_WM_WINDOW_TYPE_SPLASH\0" 256 "_NET_WM_WINDOW_TYPE_DIALOG\0" 257 "_NET_WM_WINDOW_TYPE_DROPDOWN_MENU\0" 258 "_NET_WM_WINDOW_TYPE_POPUP_MENU\0" 259 "_NET_WM_WINDOW_TYPE_TOOLTIP\0" 260 "_NET_WM_WINDOW_TYPE_NOTIFICATION\0" 261 "_NET_WM_WINDOW_TYPE_COMBO\0" 262 "_NET_WM_WINDOW_TYPE_DND\0" 263 "_NET_WM_WINDOW_TYPE_NORMAL\0" 264 "_KDE_NET_WM_WINDOW_TYPE_OVERRIDE\0" 266 "_KDE_NET_WM_FRAME_STRUT\0" 268 "_NET_STARTUP_INFO\0" 269 "_NET_STARTUP_INFO_BEGIN\0" 271 "_NET_SUPPORTING_WM_CHECK\0" 275 "_NET_SYSTEM_TRAY_VISUAL\0" 277 "_NET_ACTIVE_WINDOW\0" 302 "XdndActionPrivate\0" 305 "_MOTIF_DRAG_AND_DROP_MESSAGE\0" 306 "_MOTIF_DRAG_INITIATOR_INFO\0" 307 "_MOTIF_DRAG_RECEIVER_INFO\0" 308 "_MOTIF_DRAG_WINDOW\0" 309 "_MOTIF_DRAG_TARGETS\0" 311 "XmTRANSFER_SUCCESS\0" 312 "XmTRANSFER_FAILURE\0" 347 #if defined(QT_DEBUG) 393 #if !defined (QT_NO_TABLET) 397 return tablet_devices();
420 list->removeOne(func);
427 if (
qApp->filterEvent(ev, &unused))
436 return qApp->x11EventFilter(ev);
439 #if !defined(QT_NO_XIM) 475 int highestVernum,
const char *symbol)
484 for(
int i = highestVernum; i > vernum; --i)
489 QLibrary xfixesLib(libName, version);
499 # ifdef QT_RUNTIME_XINPUT 500 # define XINPUT_LOAD_RUNTIME(vernum, symbol, symbol_type) \ 501 (symbol_type)qt_load_library_runtime("libXi", vernum, 6, #symbol); 502 # define XINPUT_LOAD(symbol) \ 503 XINPUT_LOAD_RUNTIME(1, symbol, Ptr##symbol) 504 # else // not runtime XInput 505 # define XINPUT_LOAD(symbol) symbol 506 # endif // QT_RUNTIME_XINPUT 507 #else // not using Xinput at all 508 # define XINPUT_LOAD(symbol) 0 509 #endif // QT_NO_XINPUT 512 # ifdef QT_RUNTIME_XFIXES 513 # define XFIXES_LOAD_RUNTIME(vernum, symbol, symbol_type) \ 514 (symbol_type)qt_load_library_runtime("libXfixes", vernum, 4, #symbol); 515 # define XFIXES_LOAD_V1(symbol) \ 516 XFIXES_LOAD_RUNTIME(1, symbol, Ptr##symbol) 517 # define XFIXES_LOAD_V2(symbol) \ 518 XFIXES_LOAD_RUNTIME(2, symbol, Ptr##symbol) 520 # else // not runtime Xfixes 522 # if XFIXES_MAJOR >= 2 523 # define XFIXES_LOAD_V1(symbol) symbol 524 # define XFIXES_LOAD_V2(symbol) symbol 525 # elif XFIXES_MAJOR >= 1 526 # define XFIXES_LOAD_V1(symbol) symbol 527 # define XFIXES_LOAD_V2(symbol) 0 529 # error Unsupported version of Xfixes 531 # endif // QT_RUNTIME_XFIXES 532 #else // not using Xfixes at all 533 # define XFIXES_LOAD_V1(symbol) 0 534 # define XFIXES_LOAD_V2(symbol) 0 535 #endif // QT_NO_XFIXES 545 #if defined(Q_C_CALLBACKS) 553 if (event->type ==
X11->xfixes_eventbase + XFixesSelectionNotify) {
554 XFixesSelectionNotifyEvent *xfixes_event =
reinterpret_cast<XFixesSelectionNotifyEvent*
>(
event);
555 if (xfixes_event->selection == data->
selection)
561 #if defined(Q_C_CALLBACKS) 565 #endif // QT_NO_XFIXES 571 bool translateMouseEvent(
const XEvent *);
572 void translatePaintEvent(
const XEvent *);
573 bool translateConfigEvent(
const XEvent *);
574 bool translateCloseEvent(
const XEvent *);
575 bool translateScrollDoneEvent(
const XEvent *);
576 bool translateWheelEvent(
int global_x,
int global_y,
int delta, Qt::MouseButtons
buttons,
578 #if !defined (QT_NO_TABLET) 581 bool translatePropertyEvent(
const XEvent *);
598 QRect r = geometry();
600 XMoveResizeWindow(
X11->display,
609 memset(&sh, 0,
sizeof(sh));
611 XGetWMNormalHints(
X11->display, internalWinId(), &sh, &unused);
612 sh.flags |= USPosition | PPosition | USSize | PSize | PWinGravity;
615 sh.width = r.
width();
617 sh.win_gravity = StaticGravity;
618 XSetWMNormalHints(
X11->display, internalWinId(), &sh);
623 d_func()->topData()->waitingForMapNotify = 1;
624 XMapWindow(
X11->display, internalWinId());
632 #if !defined(QT_NO_GLIB) 648 #if defined(Q_C_CALLBACKS) 657 if (
X11->display != dpy) {
662 switch (err->error_code) {
664 if (err->request_code == 20
665 && (err->resourceid == XA_RESOURCE_MANAGER
666 || err->resourceid == XA_RGB_DEFAULT_MAP
677 if (err->request_code == 2
678 || err->request_code == 38 ) {
679 for (
int i = 0; i < ScreenCount(dpy); ++i) {
680 if (err->resourceid == RootWindow(dpy, i)) {
686 X11->seen_badwindow =
true;
687 if (err->request_code == 25 ) {
688 for (
int i = 0; i < ScreenCount(dpy); ++i) {
689 if (err->resourceid == RootWindow(dpy, i)) {
694 if (
X11->xdndHandleBadwindow()) {
695 qDebug(
"xdndHandleBadwindow returned true");
699 if (
X11->ignore_badwindow)
704 #if !defined(QT_NO_XINPUT) 705 if (err->request_code ==
X11->xinput_major
706 && err->error_code == (
X11->xinput_errorbase + XI_BadDevice)
707 && err->minor_code == 3 ) {
715 XGetErrorText( dpy, err->error_code, errstr, 256 );
717 char request_str[256];
718 qsnprintf(buffer, 256,
"%d", err->request_code);
719 XGetErrorDatabaseText(dpy,
"XRequest", buffer,
"", request_str, 256);
720 if (err->request_code < 128) {
723 " Major opcode: %d (%s)\n" 724 " Resource id: 0x%lx",
725 errstr, err->error_code,
731 const char *extensionName = 0;
732 if (err->request_code ==
X11->xrender_major)
733 extensionName =
"RENDER";
734 else if (err->request_code ==
X11->xrandr_major)
735 extensionName =
"RANDR";
736 else if (err->request_code ==
X11->xinput_major)
737 extensionName =
"XInputExtension";
738 else if (err->request_code ==
X11->mitshm_major)
739 extensionName =
"MIT-SHM";
741 else if(err->request_code ==
X11->xkb_major)
742 extensionName =
"XKEYBOARD";
747 qsnprintf(buffer, 256,
"%s.%d", extensionName, err->minor_code);
748 XGetErrorDatabaseText(dpy,
"XRequest", buffer,
"", minor_str, 256);
750 extensionName =
"Uknown extension";
751 qsnprintf(minor_str, 256,
"Unknown request");
754 " Extension: %d (%s)\n" 755 " Minor opcode: %d (%s)\n" 756 " Resource id: 0x%lx",
757 errstr, err->error_code,
782 #if defined(Q_C_CALLBACKS) 792 #if defined(Q_C_CALLBACKS) 800 if (event->type == ClientMessage &&
801 event->xany.window == data->
window &&
806 const ulong timestamp = (
const ulong) event->xclient.data.l[1];
807 if (timestamp >
X11->time)
808 X11->time = timestamp;
809 if (timestamp == CurrentTime || timestamp > tlw->syncRequestTimestamp) {
810 tlw->syncRequestTimestamp = timestamp;
811 tlw->newCounterValueLo =
event->xclient.data.l[2];
812 tlw->newCounterValueHi =
event->xclient.data.l[3];
820 #if defined(Q_C_CALLBACKS) 823 #endif // QT_NO_XSYNC 840 QByteArray settings_atom_name(
"_QT_SETTINGS_TIMESTAMP_");
841 settings_atom_name += XDisplayName(
X11->displayName);
842 names[i++] = settings_atom_name;
845 #if defined(XlibSpecificationRelease) && (XlibSpecificationRelease >= 6) 846 XInternAtoms(
X11->display, (
char **)names, i, False,
X11->atoms);
849 X11->atoms[i] = XInternAtom(
X11->display, (
char *)names[i], False);
861 PropModeReplace, (
unsigned char *)stamp.
data(), stamp.
size());
921 if (!usingGtkSettings) {
928 if (!usingGtkSettings) {
932 if (
X11->desktopVersion == 4) {
935 if (fontDescription.
isEmpty()) {
942 if (!fontDescription .
isEmpty()) {
968 static QString currentStyleName = stylename;
973 if (currentStyleName != stylename) {
974 currentStyleName = stylename;
989 #ifndef QT_NO_WHEELEVENT 1037 if (!
X11->has_fontconfig) {
1042 for (; it != fontsubs.
end(); ++
it) {
1096 ulong nitems, after = 1;
1097 unsigned char *
data = 0;
1101 False, XA_STRING, &type, &format, &nitems,
1110 if (!
qstricmp((
char *)data,
"locale"))
1115 if(!qt_input_mapper)
1118 if (qt_input_mapper && qt_input_mapper->
mibEnum() == 11)
1121 XFree((
char *)data);
1127 const char* bg = 0,
const char* button = 0)
1130 QString resFont, resFG, resBG, resButton, resEF, sysFont, selectBackground, selectForeground;
1140 bool paletteAlreadySet =
false;
1151 ulong nitems, after = 1;
1160 offset, 8192, False, AnyPropertyType,
1161 &type, &format, &nitems, &after,
1166 if (type == XA_STRING)
1172 XFree((
char *)data);
1203 }
else if ((apnl && res.
at(l) == apn.
at(0)) || (
appClass && apcl && res.
at(l) == apc.
at(0))) {
1226 else if (!fg && !paletteAlreadySet) {
1231 else if (!bg && !button && key ==
QLatin1String(
"button.background"))
1234 selectBackground = value;
1236 selectForeground = value;
1257 && !
X11->has_fontconfig
1292 if (!gtkStyle && (kdeColors || (button || !resBG.
isEmpty() || !resFG.
isEmpty()))) {
1322 bool bright_mode =
false;
1323 if (v >= 255 - 50) {
1335 QColor highlight, highlightText;
1336 if (!selectBackground.
isEmpty() && !selectForeground.
isEmpty()) {
1337 highlight =
QColor(selectBackground);
1338 highlightText =
QColor(selectForeground);
1347 highlightText.
setHsv(highlightText.
hue(), 0, highlightText.
value(), highlightText.
alpha());
1350 }
else if (bright_mode) {
1394 unsigned long nitems, after;
1395 unsigned char *
data = 0;
1399 False, XA_ATOM, &type, &format, &nitems, &after, &data);
1403 if (
X11->net_supported_list)
1404 delete []
X11->net_supported_list;
1405 X11->net_supported_list = 0;
1407 if (e ==
Success && type == XA_ATOM && format == 32) {
1414 False, XA_ATOM, &type, &format, &nitems, &after, &data);
1416 if (type == XA_ATOM && format == 32) {
1417 ts.
write(reinterpret_cast<char *>(data), nitems *
sizeof(
long));
1427 nitems = buffer.
size() /
sizeof(
Atom);
1428 X11->net_supported_list =
new Atom[nitems + 1];
1431 for (i = 0; i < nitems; i++)
1432 X11->net_supported_list[i] = a[i];
1433 X11->net_supported_list[nitems] = 0;
1440 if (!
X11->net_supported_list)
1443 bool supported =
false;
1445 while (
X11->net_supported_list[i] != 0) {
1446 if (
X11->net_supported_list[i++] == atom) {
1459 if (
X11->net_virtual_root_list)
1460 delete []
X11->net_virtual_root_list;
1461 X11->net_virtual_root_list = 0;
1469 unsigned long nitems, after;
1470 unsigned char *
data;
1474 False, XA_ATOM, &type, &format, &nitems, &after, &data);
1478 if (e ==
Success && type == XA_ATOM && format == 32) {
1485 False, XA_ATOM, &type, &format, &nitems, &after, &data);
1487 if (type == XA_ATOM && format == 32) {
1488 ts.
write(reinterpret_cast<char *>(data), nitems * 4);
1499 X11->net_virtual_root_list =
new Window[nitems + 1];
1502 for (i = 0; i < nitems; i++)
1503 X11->net_virtual_root_list[i] = a[i];
1504 X11->net_virtual_root_list[nitems] = 0;
1511 QTLWExtra *extra = tlw->d_func()->maybeTopData();
1525 QTLWExtra *extra = tlw->d_func()->topData();
1528 if (extra->userTimeWindow || isSupportedByWM) {
1529 if (!extra->userTimeWindow) {
1530 extra->userTimeWindow = XCreateSimpleWindow(
X11->display,
1532 -1, -1, 1, 1, 0, 0, 0);
1533 wid = extra->userTimeWindow;
1535 XA_WINDOW, 32, PropModeReplace,
1536 (
unsigned char *)&wid, 1);
1538 }
else if (!isSupportedByWM) {
1543 wid = extra->userTimeWindow;
1547 XA_CARDINAL, 32, PropModeReplace, (
unsigned char *) ×tamp, 1);
1554 XGetInputFocus(
X11->display, &fw, &unused);
1555 if (fw == PointerRoot)
1561 #ifndef QT_NO_TABLET 1563 #if !defined (Q_OS_IRIX) 1565 # define XWACOM_PARAM_TOOLID 322 1566 # define XWACOM_PARAM_TOOLSERIAL 323 1568 typedef WACOMCONFIG * (*PtrWacomConfigInit) (
Display*, WACOMERRORFUNC);
1569 typedef WACOMDEVICE * (*PtrWacomConfigOpenDevice) (WACOMCONFIG*,
const char*);
1570 typedef int *(*PtrWacomConfigGetRawParam) (WACOMDEVICE*, int,
int*, int,
unsigned*);
1588 #if !defined(QT_NO_FONTCONFIG) 1591 char *str = XGetDefault(
X11->display, group, key);
1594 int v = strtol(str, &end, 0);
1599 FcNameConstant((FcChar8 *) str, val);
1605 char *str = XGetDefault(
X11->display, group, key);
1616 char *str = XGetDefault(
X11->display, group, key);
1619 if (isupper((
int)c))
1621 if (c ==
't' || c ==
'y' || c ==
'1')
1623 else if (c ==
'f' || c ==
'n' || c ==
'0')
1627 if (isupper((
int)c))
1638 #if defined(QT_DEBUG) && defined(Q_OS_LINUX) 1671 X11->displayName = 0;
1672 X11->foreignDisplay = (display != 0);
1673 X11->focus_model = -1;
1676 X11->use_xrandr =
false;
1677 X11->xrandr_major = 0;
1678 X11->xrandr_eventbase = 0;
1679 X11->xrandr_errorbase = 0;
1682 X11->use_xrender =
false;
1683 X11->xrender_major = 0;
1684 X11->xrender_version = 0;
1687 X11->use_xfixes =
false;
1688 X11->xfixes_major = 0;
1689 X11->xfixes_eventbase = 0;
1690 X11->xfixes_errorbase = 0;
1693 X11->use_xinput =
false;
1694 X11->xinput_major = 0;
1695 X11->xinput_eventbase = 0;
1696 X11->xinput_errorbase = 0;
1698 X11->use_xkb =
false;
1700 X11->xkb_eventbase = 0;
1701 X11->xkb_errorbase = 0;
1704 X11->use_mitshm =
false;
1705 X11->use_mitshm_pixmaps =
false;
1706 X11->mitshm_major = 0;
1708 X11->sip_serial = 0;
1709 X11->net_supported_list = 0;
1710 X11->net_virtual_root_list = 0;
1711 X11->wm_client_leader = 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;
1721 X11->motifdnd_active =
false;
1727 X11->visual_class = -1;
1728 X11->visual_id = -1;
1729 X11->color_count = 0;
1730 X11->custom_cmap =
false;
1733 X11->visual =
reinterpret_cast<Visual *
>(visual);
1734 X11->colormap = colormap;
1737 X11->has_fontconfig =
false;
1738 #if !defined(QT_NO_FONTCONFIG) 1740 X11->has_fontconfig = FcInit();
1741 X11->fc_antialias =
true;
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;
1755 int argc = priv->
argc;
1756 char **argv = priv->
argv;
1763 char *app_class = 0;
1765 const char* p = strrchr(argv[0],
'/');
1766 app_class =
qstrdup(p ? p + 1 : argv[0]);
1768 app_class[0] = toupper(app_class[0]);
1778 char *app_class = 0;
1779 if (argv && argv[0]) {
1780 const char *p = strrchr(argv[0],
'/');
1781 appName = p ? p + 1 : argv[0];
1784 app_class[0] = toupper(app_class[0]);
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];
1801 if (arg ==
"-display") {
1802 if (++i < argc && !X11->display)
1803 X11->displayName = argv[i];
1804 }
else if (arg ==
"-fn" || arg ==
"-font") {
1807 }
else if (arg ==
"-bg" || arg ==
"-background") {
1810 }
else if (arg ==
"-btn" || arg ==
"-button") {
1813 }
else if (arg ==
"-fg" || arg ==
"-foreground") {
1816 }
else if (arg ==
"-name") {
1819 }
else if (arg ==
"-title") {
1822 }
else if (arg ==
"-geometry") {
1825 }
else if (arg ==
"-im") {
1828 }
else if (arg ==
"-ncols") {
1830 X11->color_count =
qMax(0,atoi(argv[i]));
1831 }
else if (arg ==
"-visual") {
1832 if (++i < argc && !X11->visual) {
1835 X11->visual_class = StaticGray;
1839 X11->visual_class = StaticColor;
1841 X11->visual_class = PseudoColor;
1843 X11->visual_class = TrueColor;
1845 X11->visual_class = DirectColor;
1847 X11->visual_id =
static_cast<int>(strtol(argv[i], 0, 0));
1850 }
else if (arg ==
"-inputstyle") {
1867 }
else if (arg ==
"-cmap") {
1869 X11->custom_cmap =
true;
1871 else if (arg ==
"-sync")
1873 #if defined(QT_DEBUG) 1874 else if (arg ==
"-nograb")
1876 else if (arg ==
"-dograb")
1880 argv[j++] = argv[i];
1885 #if defined(QT_DEBUG) && defined(Q_OS_LINUX) 1888 qDebug(
"Qt: gdb: -nograb added to command-line options.\n" 1889 "\t Use the -dograb option to enforce grabbing.");
1895 if ((
X11->display = XOpenDisplay(
X11->displayName)) == 0) {
1897 XDisplayName(
X11->displayName));
1903 XSynchronize(
X11->display,
true);
1911 X11->defaultScreen = DefaultScreen(
X11->display);
1912 X11->screenCount = ScreenCount(
X11->display);
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;
1921 X11->argbVisuals =
new Visual *[
X11->screenCount];
1922 X11->argbColormaps =
new Colormap[
X11->screenCount];
1924 for (
int s = 0; s <
X11->screenCount; s++) {
1929 int widthMM = DisplayWidthMM(
X11->display, s);
1931 screen->
dpiX = (DisplayWidth(
X11->display, s) * 254 + widthMM * 5) / (widthMM * 10);
1936 int heightMM = DisplayHeightMM(
X11->display, s);
1937 if (heightMM != 0) {
1938 screen->
dpiY = (DisplayHeight(
X11->display, s) * 254 + heightMM * 5) / (heightMM * 10);
1943 X11->argbVisuals[s] = 0;
1944 X11->argbColormaps[s] = 0;
1948 #ifndef QT_NO_XRENDER 1949 int xrender_eventbase, xrender_errorbase;
1951 if (XQueryExtension(
X11->display,
"RENDER", &
X11->xrender_major,
1952 &xrender_eventbase, &xrender_errorbase)
1953 && XRenderQueryExtension(
X11->display, &xrender_eventbase,
1954 &xrender_errorbase)) {
1958 XRenderQueryVersion(
X11->display, &major, &minor);
1960 X11->use_xrender = (major >= 0 && minor >= 5);
1961 X11->xrender_version = major*100+minor;
1964 if (
X11->xrender_version == 10
1965 && VendorRelease(
X11->display) < 60900000
1967 X11->xrender_version = 9;
1970 #endif // QT_NO_XRENDER 1972 #ifndef QT_NO_MITSHM 1975 int mitshm_eventbase;
1976 int mitshm_errorbase;
1978 if (XQueryExtension(
X11->display,
"MIT-SHM", &
X11->mitshm_major,
1979 &mitshm_eventbase, &mitshm_errorbase)
1980 && XShmQueryVersion(
X11->display, &mitshm_major, &mitshm_minor,
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;
2001 #endif // QT_NO_MITSHM 2018 #ifndef QT_NO_XRANDR 2020 if (XQueryExtension(
X11->display,
"RANDR", &
X11->xrandr_major,
2021 &
X11->xrandr_eventbase, &
X11->xrandr_errorbase)) {
2023 # ifdef QT_RUNTIME_XRANDR 2024 X11->ptrXRRSelectInput = 0;
2025 X11->ptrXRRUpdateConfiguration = 0;
2026 X11->ptrXRRRootToScreen = 0;
2027 X11->ptrXRRQueryExtension = 0;
2030 if (!xrandrLib.
load()) {
2035 X11->ptrXRRSelectInput =
2037 X11->ptrXRRUpdateConfiguration =
2039 X11->ptrXRRRootToScreen =
2041 X11->ptrXRRQueryExtension =
2045 X11->ptrXRRSelectInput = XRRSelectInput;
2046 X11->ptrXRRUpdateConfiguration = XRRUpdateConfiguration;
2047 X11->ptrXRRRootToScreen = XRRRootToScreen;
2048 X11->ptrXRRQueryExtension = XRRQueryExtension;
2051 if (
X11->ptrXRRQueryExtension
2052 &&
X11->ptrXRRQueryExtension(
X11->display, &
X11->xrandr_eventbase, &
X11->xrandr_errorbase)) {
2054 X11->use_xrandr =
true;
2057 #endif // QT_NO_XRANDR 2059 #ifndef QT_NO_XRENDER 2060 if (
X11->use_xrender) {
2063 XRenderPictFormat *
format =
2064 XRenderFindVisualFormat(
X11->display,
2068 X11->use_xrender =
false;
2071 #endif // QT_NO_XRENDER 2073 #ifndef QT_NO_XFIXES 2075 if (XQueryExtension(
X11->display,
"XFIXES", &
X11->xfixes_major,
2076 &
X11->xfixes_eventbase, &
X11->xfixes_errorbase)) {
2080 X11->ptrXFixesSelectSelectionInput =
XFIXES_LOAD_V2(XFixesSelectSelectionInput);
2082 if(
X11->ptrXFixesQueryExtension &&
X11->ptrXFixesQueryVersion
2083 &&
X11->ptrXFixesQueryExtension(
X11->display, &
X11->xfixes_eventbase,
2084 &
X11->xfixes_errorbase)) {
2094 X11->ptrXFixesQueryVersion(
X11->display, &major, &minor);
2095 X11->use_xfixes = (major >= 1);
2096 X11->xfixes_major = major;
2099 X11->ptrXFixesQueryExtension = 0;
2100 X11->ptrXFixesQueryVersion = 0;
2101 X11->ptrXFixesSetCursorName = 0;
2102 X11->ptrXFixesSelectSelectionInput = 0;
2104 #endif // QT_NO_XFIXES 2106 #ifndef QT_NO_XCURSOR 2107 #ifdef QT_RUNTIME_XCURSOR 2108 X11->ptrXcursorLibraryLoadCursor = 0;
2111 bool xcursorFound = xcursorLib.
load();
2112 if (!xcursorFound) {
2114 xcursorFound = xcursorLib.
load();
2117 X11->ptrXcursorLibraryLoadCursor =
2121 X11->ptrXcursorLibraryLoadCursor = XcursorLibraryLoadCursor;
2122 #endif // QT_RUNTIME_XCURSOR 2123 #endif // QT_NO_XCURSOR 2126 int xsync_evbase, xsync_errbase;
2128 if (XSyncQueryExtension(
X11->display, &xsync_evbase, &xsync_errbase))
2129 XSyncInitialize(
X11->display, &major, &minor);
2130 #endif // QT_NO_XSYNC 2132 #ifndef QT_NO_XINERAMA 2133 #ifdef QT_RUNTIME_XINERAMA 2134 X11->ptrXineramaQueryExtension = 0;
2135 X11->ptrXineramaIsActive = 0;
2136 X11->ptrXineramaQueryScreens = 0;
2139 bool xineramaFound = xineramaLib.
load();
2140 if (!xineramaFound) {
2142 xineramaFound = xineramaLib.
load();
2144 if (xineramaFound) {
2145 X11->ptrXineramaQueryExtension =
2147 X11->ptrXineramaIsActive =
2149 X11->ptrXineramaQueryScreens =
2153 X11->ptrXineramaQueryScreens = XineramaQueryScreens;
2154 X11->ptrXineramaIsActive = XineramaIsActive;
2155 X11->ptrXineramaQueryExtension = XineramaQueryExtension;
2156 #endif // QT_RUNTIME_XINERAMA 2157 #endif // QT_NO_XINERAMA 2159 #ifndef QT_NO_XINPUT 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) {
2173 X11->ptrXSelectExtensionEvent =
XINPUT_LOAD(XSelectExtensionEvent);
2175 #endif // QT_NO_XINPUT 2178 int xkblibMajor = XkbMajorVersion;
2179 int xkblibMinor = XkbMinorVersion;
2180 X11->use_xkb = XkbQueryExtension(
X11->display,
2182 &
X11->xkb_eventbase,
2183 &
X11->xkb_errorbase,
2189 unsigned int state = XkbPCF_GrabsUseXKBStateMask;
2190 (void) XkbSetPerClientControls(
X11->display, state, &state);
2193 XkbSelectEventDetails(
X11->display,
2196 XkbAllStateComponentsMask,
2204 #if !defined(QT_NO_FONTCONFIG) 2208 for (
int s = 0; s < ScreenCount(
X11->display); ++s) {
2213 double fc_scale = 1.;
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);
2223 case SubPixelUnknown:
2224 subpixel = FC_RGBA_UNKNOWN;
2226 case SubPixelHorizontalRGB:
2227 subpixel = FC_RGBA_RGB;
2229 case SubPixelHorizontalBGR:
2230 subpixel = FC_RGBA_BGR;
2232 case SubPixelVerticalRGB:
2233 subpixel = FC_RGBA_VRGB;
2235 case SubPixelVerticalBGR:
2236 subpixel = FC_RGBA_VBGR;
2239 subpixel = FC_RGBA_NONE;
2245 char *rgba = XGetDefault(
X11->display,
"Xft", FC_RGBA);
2248 int v = strtol(rgba, &end, 0);
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;
2265 X11->screens[s].subpixel = subpixel;
2268 #ifdef FC_HINT_STYLE 2269 X11->fc_hint_style = -1;
2278 #endif // QT_NO_XRENDER 2284 #if 0 //disabled for now.. 2295 for (screen = 0; screen <
X11->screenCount; ++screen) {
2297 KeymapStateMask | EnterWindowMask | LeaveWindowMask | PropertyChangeMask);
2299 #ifndef QT_NO_XRANDR 2300 if (
X11->use_xrandr)
2302 #endif // QT_NO_XRANDR 2310 #ifndef QT_NO_XFIXES 2311 if (
X11->ptrXFixesSelectSelectionInput)
2313 XFixesSetSelectionOwnerNotifyMask
2314 | XFixesSelectionWindowDestroyNotifyMask
2315 | XFixesSelectionClientCloseNotifyMask);
2316 #endif // QT_NO_XFIXES 2317 X11->compositingManagerRunning = XGetSelectionOwner(
X11->display,
2320 X11->desktopVersion = 0;
2324 unsigned long length, after;
2335 if (
qgetenv(
"DESKTOP_SESSION") ==
"gnome") {
2347 0, 2, False, XA_STRING, &type, &format, &length,
2349 if (rc ==
Success && length) {
2350 if (!strcmp(reinterpret_cast<char *>(data),
"xfce4")) {
2363 0, 1, False, AnyPropertyType, &type, &format, &length,
2365 if (rc ==
Success && length) {
2373 &type, &format, &length, &after, &data);
2374 if (rc ==
Success && length) {
2381 0, 1024, False, XA_WINDOW, &type,
2382 &format, &length, &after, &data) ==
Success) {
2383 if (type == XA_WINDOW && format == 32) {
2388 if (windowManagerWindow !=
XNone) {
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)
2405 XFree((
char *)data);
2407 #if !defined(QT_NO_STYLE_GTK) 2422 int ptsz = (
X11->use_xrender
2434 #if !defined (QT_NO_TABLET) 2435 if (
X11->use_xinput) {
2441 XDeviceInfo *devices = 0, *devs;
2442 XInputClassInfo *ip;
2448 if (
X11->ptrXListInputDevices) {
2449 devices =
X11->ptrXListInputDevices(
X11->display, &ndev);
2451 qWarning(
"QApplication: Failed to get list of tablet devices");
2456 for (devs = devices, i = 0; i < ndev && devs; i++, devs++) {
2462 #if defined(Q_OS_IRIX) 2472 if (wacomDeviceName()->
isEmpty())
2473 wacomDeviceName()->append(devs->name);
2483 if (gotStylus || gotEraser) {
2484 if (
X11->ptrXOpenDevice)
2485 dev =
X11->ptrXOpenDevice(
X11->display, devs->id);
2493 device_data.
device = dev;
2503 if (dev->num_classes > 0) {
2504 for (ip = dev->classes, j = 0; j < dev->num_classes;
2506 switch (ip->input_class) {
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) 2560 char returnString[SGIDeviceRtrnLen];
2562 if (XSGIMiscQueryExtension(
X11->display, &tmp, &tmp)
2563 && XSGIDeviceQuery(
X11->display, devs->id,
2564 "dimensions", returnString)) {
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();
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;
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;
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;
2599 any = (XAnyClassPtr) ((
char *) any + any->length);
2602 tablet_devices()->append(device_data);
2605 if (
X11->ptrXFreeDeviceList)
2606 X11->ptrXFreeDeviceList(devices);
2608 #endif // QT_NO_TABLET 2610 X11->startupId = getenv(
"DESKTOP_STARTUP_ID");
2611 if (
X11->startupId) {
2612 #ifndef QT_NO_UNSETENV 2613 unsetenv(
"DESKTOP_STARTUP_ID");
2617 putenv(strdup(
"DESKTOP_STARTUP_ID="));
2651 #if !defined (Q_OS_IRIX) && !defined (QT_NO_TABLET) 2691 #if !defined (QT_NO_TABLET) 2693 if (
X11->ptrXCloseDevice)
2694 for (
int i = 0; i < devices->
size(); ++i)
2695 X11->ptrXCloseDevice(
X11->display, (XDevice*)devices->
at(i).device);
2700 #ifndef QT_NO_XRENDER 2701 for (
int i = 0; i <
X11->solid_fill_count; ++i) {
2702 if (
X11->solid_fills[i].picture)
2703 XRenderFreePicture(
X11->display,
X11->solid_fills[i].picture);
2705 for (
int i = 0; i <
X11->pattern_fill_count; ++i) {
2706 if (
X11->pattern_fills[i].picture)
2707 XRenderFreePicture(
X11->display,
X11->pattern_fills[i].picture);
2711 #if !defined(QT_NO_IM) 2718 XSync(
X11->display, False);
2722 if (
X11->argbColormaps) {
2723 for (
int s = 0; s <
X11->screenCount; s++) {
2724 if (
X11->argbColormaps[s])
2725 XFreeColormap(
X11->display,
X11->argbColormaps[s]);
2730 XCloseDisplay(
X11->display);
2733 delete []
X11->screens;
2734 delete []
X11->argbVisuals;
2735 delete []
X11->argbColormaps;
2737 if (
X11->foreignDisplay) {
2745 if (
X11->net_supported_list)
2746 delete []
X11->net_supported_list;
2747 X11->net_supported_list = 0;
2749 if (
X11->net_virtual_root_list)
2750 delete []
X11->net_virtual_root_list;
2751 X11->net_virtual_root_list = 0;
2766 unsigned long length, after;
2772 True, AnyPropertyType, &type, &format,
2773 &length, &after, &data) ==
Success) {
2774 if (type == XA_PIXMAP && format == 32 && length == 1 &&
2775 after == 0 && data) {
2776 XKillClient(
X11->display, *((Pixmap*)data));
2782 PropModeReplace, (
uchar *)&dummy, 1);
2783 XSetCloseDownMode(
X11->display, RetainPermanent);
2787 XFree((
char *)data);
2800 unsigned long length, after;
2803 False, AnyPropertyType, &type, &format,
2804 &length, &after, &data);
2805 bool iconic =
false;
2806 if (r ==
Success && data && format == 32) {
2808 unsigned long *wstate = (
unsigned long *) data;
2809 iconic = (*wstate == IconicState);
2810 XFree((
char *)data);
2827 #if defined(QT_DEBUG) 2840 void QApplication::setMainWidget(
QWidget *mainWidget)
2844 qWarning(
"QApplication::setMainWidget: New main widget (%s/%s) " 2858 static bool beenHereDoneThat =
false;
2859 if (beenHereDoneThat)
2861 beenHereDoneThat =
true;
2867 PropModeReplace, (
unsigned char *)net_wm_name.
data(), net_wm_name.
size());
2880 w = main_widget->
width();
2882 h = main_widget->
height();
2897 #ifndef QT_NO_CURSOR 2905 qApp->d_func()->cursor_list.prepend(cursor);
2913 XFlush(
X11->display);
2918 if (
qApp->d_func()->cursor_list.isEmpty())
2920 qApp->d_func()->cursor_list.removeFirst();
2929 XFlush(
X11->display);
2944 ulong nitems, after;
2946 Window root, parent, target=0, *children=0;
2948 if (XGetWindowProperty(
X11->display, win, property, 0, 0,
false, AnyPropertyType,
2949 &type, &format, &nitems, &after, &data) ==
Success) {
2951 XFree((
char *)data);
2955 if (!XQueryTree(
X11->display,win,&root,&parent,&children,&nchildren)) {
2957 XFree((
char *)children);
2960 for (i=nchildren-1; !target && i >= 0; i--)
2961 target =
X11->findClientWindow(children[i], property, leaf);
2963 XFree((
char *)children);
2973 int screen = QCursor::x11Screen();
2979 if (!XTranslateCoordinates(
X11->display,
2982 x, y, &unused, &unused, &target)) {
2991 X11->ignoreBadwindow();
2993 if (
X11->badwindow())
3000 for (
int i = 0; i < list.
count(); ++i) {
3006 while (ctarget && !w) {
3007 X11->ignoreBadwindow();
3008 if (!XTranslateCoordinates(
X11->display,
3010 ctarget, x, y, &unused, &unused, &ctarget)
3011 ||
X11->badwindow())
3013 if (ctarget == wid) {
3025 return w ? w->
window() : 0;
3032 XSync(
X11->display, False);
3039 XBell(
X11->display, 0);
3056 for (
int i = 0; i < windowsToMark.
size(); ++i) {
3063 connect(timer,
SIGNAL(timeout()),
qApp,
SLOT(_q_alertTimeOut()));
3064 if (
QTimer *oldTimer =
qApp->d_func()->alertTimerHash.value(window)) {
3065 qApp->d_func()->alertTimerHash.remove(window);
3068 qApp->d_func()->alertTimerHash.insert(window, timer);
3077 if (
QTimer *
timer = qobject_cast<QTimer *>(q_func()->sender())) {
3079 while (it != alertTimerHash.end()) {
3083 alertTimerHash.erase(it);
3084 timer->deleteLater();
3096 int root_x, root_y, win_x, win_y;
3098 for (
int i = 0; i < ScreenCount(
X11->display); ++i) {
3100 &root_x, &root_y, &win_x, &win_y, &keybstate))
3101 return X11->translateModifiers(keybstate & 0x00ff);
3119 wPRmapper->
insert((
int)oldwin, w);
3129 while (it != wPRmapper->
constEnd()) {
3133 it = wPRmapper->
erase(it);
3138 if (wPRmapper->
size() == 0) {
3146 return wPRmapper ? (
QETWidget*)wPRmapper->
value((
int)oldwin, 0) : 0;
3154 if (event->xclient.format == 32 && event->xclient.message_type) {
3156 Atom a =
event->xclient.data.l[0];
3158 if (passive_only)
return 0;
3162 if ((
ulong) event->xclient.data.l[1] >
X11->time)
3163 X11->time =
event->xclient.data.l[1];
3164 QWidget *amw = activeModalWidget();
3169 while (p && p != widget)
3171 if (!p || !
X11->net_supported_list)
3175 #ifndef QT_NO_WHATSTHIS 3178 #endif // QT_NO_WHATSTHIS 3182 if (event->xclient.window != root) {
3183 event->xclient.window = root;
3184 XSendEvent(event->xclient.display, event->xclient.window,
3185 False, SubstructureNotifyMask|SubstructureRedirectMask, event);
3189 const ulong timestamp = (
const ulong) event->xclient.data.l[1];
3190 if (timestamp >
X11->time)
3191 X11->time = timestamp;
3192 if (
QTLWExtra *tlw = w->d_func()->maybeTopData()) {
3193 if (timestamp == CurrentTime || timestamp > tlw->syncRequestTimestamp) {
3194 tlw->syncRequestTimestamp = timestamp;
3195 tlw->newCounterValueLo =
event->xclient.data.l[2];
3196 tlw->newCounterValueHi =
event->xclient.data.l[3];
3204 X11->xdndHandlePosition(widget, event, passive_only);
3205 }
else if (event->xclient.message_type ==
ATOM(
XdndEnter)) {
3206 X11->xdndHandleEnter(widget, event, passive_only);
3208 X11->xdndHandleStatus(widget, event, passive_only);
3209 }
else if (event->xclient.message_type ==
ATOM(
XdndLeave)) {
3210 X11->xdndHandleLeave(widget, event, passive_only);
3211 }
else if (event->xclient.message_type ==
ATOM(
XdndDrop)) {
3212 X11->xdndHandleDrop(widget, event, passive_only);
3214 X11->xdndHandleFinished(widget, event, passive_only);
3216 if (passive_only)
return 0;
3220 X11->motifdndHandle(widget, event, passive_only);
3234 switch (event->type) {
3237 X11->userTime =
event->xbutton.time;
3240 X11->time =
event->xbutton.time;
3243 X11->time =
event->xmotion.time;
3246 X11->userTime =
event->xkey.time;
3249 X11->time =
event->xkey.time;
3251 case PropertyNotify:
3252 X11->time =
event->xproperty.time;
3256 X11->time =
event->xcrossing.time;
3258 case SelectionClear:
3259 X11->time =
event->xselectionclear.time;
3264 #ifndef QT_NO_XFIXES 3265 if (
X11->use_xfixes && event->type == (
X11->xfixes_eventbase + XFixesSelectionNotify)) {
3266 XFixesSelectionNotifyEvent *req =
3267 reinterpret_cast<XFixesSelectionNotifyEvent *
>(
event);
3268 X11->time = req->selection_timestamp;
3270 X11->compositingManagerRunning = req->owner;
3278 switch (event->type) {
3298 }
else if (!keywidget) {
3299 if (
d->inPopupMode())
3300 keywidget = (
QETWidget*) (activePopupWidget()->focusWidget() ? activePopupWidget()->focusWidget() : activePopupWidget());
3335 Qt::KeyboardModifiers modifiers;
3341 text, modifiers, code, type,
false);
3346 event->xkey.keycode, keySym, event->xkey.state);
3353 if (XFilterEvent(event,
XNone))
3360 if (event->type == MappingNotify) {
3362 XRefreshKeyboardMapping(&event->xmapping);
3368 else if (
X11->use_xkb && event->type ==
X11->xkb_eventbase) {
3369 XkbAnyEvent *xkbevent = (XkbAnyEvent *) event;
3370 switch (xkbevent->xkb_type) {
3371 case XkbStateNotify:
3373 XkbStateNotifyEvent *xkbstateevent = (XkbStateNotifyEvent *) xkbevent;
3374 if ((xkbstateevent->changed & XkbGroupStateMask) != 0) {
3400 switch (event->type) {
3407 }
while ((popup =
qApp->activePopupWidget()));
3419 if (event->type == ClientMessage && !widget->
x11Event(event))
3420 x11ClientMessage(widget, event,
true);
3427 #if !defined (QT_NO_TABLET) 3430 for (
int i = 0; i < tablets->
size(); ++i) {
3444 #ifndef QT_NO_XRANDR 3445 if (
X11->use_xrandr && event->type == (
X11->xrandr_eventbase + RRScreenChangeNotify)) {
3447 X11->ptrXRRUpdateConfiguration(event);
3450 int scr =
X11->ptrXRRRootToScreen(
X11->display, event->xany.window);
3461 #endif // QT_NO_XRANDR 3463 #ifndef QT_NO_XFIXES 3464 if (
X11->use_xfixes && event->type == (
X11->xfixes_eventbase + XFixesSelectionNotify)) {
3465 XFixesSelectionNotifyEvent *req =
reinterpret_cast<XFixesSelectionNotifyEvent *
>(
event);
3470 xfixes_event.
selection = req->selection;
3481 }
else if (req->selection == XA_PRIMARY) {
3488 #endif // QT_NO_XFIXES 3490 switch (event->type) {
3498 if (event->xbutton.root != RootWindow(
X11->display, widget->
x11Info().
screen())
3500 while (activePopupWidget())
3501 activePopupWidget()->close();
3504 if (event->type == ButtonPress)
3508 #if !defined(QT_NO_TABLET) 3512 QPoint pos(event->xbutton.x, event->xbutton.y);
3513 pos = widget->
d_func()->mapFromWS(pos);
3515 pos = widget->
mapTo(window, pos);
3517 widget =
static_cast<QETWidget *
>(child);
3518 pos = child->mapFrom(window, pos);
3519 event->xbutton.
x = pos.
x();
3520 event->xbutton.y = pos.
y();
3524 #if !defined(QT_NO_TABLET) 3536 if (keywidget && keywidget->
isEnabled()) {
3543 case GraphicsExpose:
3548 case ConfigureNotify:
3549 if (event->xconfigure.event == event->xconfigure.window)
3556 if (
d->inPopupMode())
3560 if (event->xfocus.detail != NotifyAncestor &&
3561 event->xfocus.detail != NotifyInferior &&
3562 event->xfocus.detail != NotifyNonlinear)
3564 setActiveWindow(widget);
3579 if (event->xfocus.mode == NotifyGrab) {
3583 if (event->xfocus.detail != NotifyAncestor &&
3584 event->xfocus.detail != NotifyNonlinearVirtual &&
3585 event->xfocus.detail != NotifyNonlinear)
3589 bool focus_will_change =
false;
3590 if (XCheckTypedEvent(
X11->display,
XFocusIn, &ev)) {
3597 && !
d->inPopupMode()
3599 && (ev.xfocus.detail == NotifyAncestor
3600 || ev.xfocus.detail == NotifyInferior
3601 || ev.xfocus.detail == NotifyNonlinear))
3602 focus_will_change =
true;
3604 XPutBackEvent(
X11->display, &ev);
3606 if (!focus_will_change)
3614 if ((event->xcrossing.mode != NotifyNormal
3615 && event->xcrossing.mode != NotifyUngrab)
3616 ||
event->xcrossing.detail == NotifyVirtual
3617 ||
event->xcrossing.detail == NotifyNonlinearVirtual)
3619 if (event->xcrossing.focus &&
3624 setActiveWindow(widget);
3627 if (qt_button_down && !
d->inPopupMode())
3631 event->xcrossing.y)));
3634 if (qt_last_mouse_receiver && !qt_last_mouse_receiver->
internalWinId())
3635 leave = qt_last_mouse_receiver;
3643 qt_last_mouse_receiver = enter;
3644 if (!
d->inPopupMode() || widget->
window() == activePopupWidget())
3650 if (mouseGrabber && !
d->inPopupMode())
3654 if ((event->xcrossing.mode != NotifyNormal
3655 && event->xcrossing.mode != NotifyUngrab)
3656 ||
event->xcrossing.detail == NotifyInferior)
3664 while (XCheckMaskEvent(
X11->display, EnterWindowMask | LeaveWindowMask , &ev)
3667 if(event_widget && event_widget->
x11Event(&ev))
3669 if (ev.type == LeaveNotify
3670 || (ev.xcrossing.mode != NotifyNormal
3671 && ev.xcrossing.mode != NotifyUngrab)
3672 || ev.xcrossing.detail == NotifyVirtual
3673 || ev.xcrossing.detail == NotifyNonlinearVirtual)
3675 enter = event_widget;
3677 enterPoint = enter->d_func()->mapFromWS(
QPoint(ev.xcrossing.x, ev.xcrossing.y));
3678 if (ev.xcrossing.focus &&
3683 setActiveWindow(enter);
3695 if (qt_button_down && !
d->inPopupMode())
3708 QWidget *activePopupWidget =
qApp->activePopupWidget();
3710 if (mouseGrabber && activePopupWidget && leave == activePopupWidget)
3711 enter = mouseGrabber;
3712 else if (enter != widget && mouseGrabber) {
3714 event->xcrossing.y))))
3719 qt_last_mouse_receiver = enter;
3724 static_cast<QETWidget *
>(nativeEnter)->translateMouseEvent(&ev);
3727 qt_last_mouse_receiver = 0;
3784 return x11ClientMessage(widget,event,False);
3786 case ReparentNotify: {
3789 while (XCheckTypedWindowEvent(
X11->display,
3793 if (ev.xreparent.window != ev.xreparent.event) {
3794 XPutBackEvent(
X11->display, &ev);
3805 widget->data->fstrut_dirty = 1;
3836 case SelectionRequest: {
3837 XSelectionRequestEvent *req = &
event->xselectionrequest;
3842 X11->xdndHandleSelectionRequest(req);
3850 case SelectionClear: {
3851 XSelectionClearEvent *req = &
event->xselectionclear;
3863 case SelectionNotify: {
3864 XSelectionEvent *req = &
event->xselection;
3875 case PropertyNotify:
3910 for (
int i = 0; i < numScreens; ++i)
3913 }
else if (widget) {
3958 if (!qt_modal_stack)
3965 qt_modal_stack->
insert(0, widget);
3968 qt_last_mouse_receiver = 0;
3973 if (qt_modal_stack && qt_modal_stack->
removeAll(widget)) {
3974 if (qt_modal_stack->
isEmpty()) {
3989 qt_last_mouse_receiver = w;
3999 switch (event->type) {
4010 if (event->type == ButtonRelease) {
4012 event->xbutton.y_root)));
4013 if (widget == qt_button_down || (alienWidget && alienWidget == qt_button_down))
4021 switch (event->type) {
4067 GrabModeAsync, GrabModeAsync,
X11->time);
4070 (ButtonPressMask | ButtonReleaseMask | ButtonMotionMask
4071 | EnterWindowMask | LeaveWindowMask | PointerMotionMask),
4078 XUngrabKeyboard(dpy,
X11->time);
4091 q->sendEvent(fw, &e);
4102 if (popup == qt_popup_down) {
4123 XUngrabPointer(dpy,
X11->time);
4129 XUngrabKeyboard(dpy,
X11->time);
4139 q->sendEvent(fw, &e);
4157 GrabModeAsync, GrabModeAsync,
X11->time);
4160 (ButtonPressMask | ButtonReleaseMask | ButtonMotionMask
4161 | EnterWindowMask | LeaveWindowMask | PointerMotionMask),
4168 XUngrabKeyboard(dpy,
X11->time);
4188 Qt::MouseButtons ret = 0;
4189 if (s & Button1Mask)
4191 if (s & Button2Mask)
4193 if (s & Button3Mask)
4200 Qt::KeyboardModifiers ret = 0;
4203 if (s & ControlMask)
4225 Qt::KeyboardModifiers modifiers;
4231 if (event->type == MotionNotify) {
4232 if (event->xmotion.root != RootWindow(
X11->display, x11Info().screen()) &&
4236 XMotionEvent lastMotion =
event->xmotion;
4237 while(XPending(
X11->display)) {
4238 XNextEvent(
X11->display, &nextEvent);
4239 if (nextEvent.type == ConfigureNotify
4240 || nextEvent.type == PropertyNotify
4241 || nextEvent.type == Expose
4242 || nextEvent.type == GraphicsExpose
4243 || nextEvent.type == NoExpose
4244 || nextEvent.type == KeymapNotify
4245 || ((nextEvent.type == EnterNotify || nextEvent.type == LeaveNotify)
4246 && qt_button_down ==
this)
4247 || (nextEvent.type == ClientMessage
4254 qApp->x11ProcessEvent(&nextEvent);
4256 }
else if (nextEvent.type != MotionNotify ||
4257 nextEvent.xmotion.window != event->xmotion.window ||
4258 nextEvent.xmotion.state != event->xmotion.state) {
4259 XPutBackEvent(
X11->display, &nextEvent);
4263 && !x11Event(&nextEvent))
4264 lastMotion = nextEvent.xmotion;
4269 pos.
rx() = lastMotion.x;
4270 pos.
ry() = lastMotion.y;
4271 pos =
d->mapFromWS(pos);
4272 globalPos.
rx() = lastMotion.x_root;
4273 globalPos.
ry() = lastMotion.y_root;
4275 modifiers =
X11->translateModifiers(lastMotion.state);
4276 if (qt_button_down && !buttons)
4278 }
else if (event->type == EnterNotify || event->type == LeaveNotify) {
4282 pos.
rx() = xevent->xcrossing.x;
4283 pos.
ry() = xevent->xcrossing.y;
4284 pos =
d->mapFromWS(pos);
4285 globalPos.
rx() = xevent->xcrossing.x_root;
4286 globalPos.
ry() = xevent->xcrossing.y_root;
4288 modifiers =
X11->translateModifiers(xevent->xcrossing.state);
4289 if (qt_button_down && !buttons)
4294 pos.
rx() =
event->xbutton.x;
4295 pos.
ry() =
event->xbutton.y;
4296 pos =
d->mapFromWS(pos);
4297 globalPos.
rx() =
event->xbutton.x_root;
4298 globalPos.
ry() =
event->xbutton.y_root;
4300 modifiers =
X11->translateModifiers(event->xbutton.state);
4301 switch (event->xbutton.button) {
4312 if (event->type == ButtonPress){
4319 while (XCheckTypedWindowEvent(
X11->display, effectiveWinId(), ButtonPress, &xevent)){
4320 if (xevent.xbutton.button != event->xbutton.button){
4321 XPutBackEvent(
X11->display, &xevent);
4332 int btn =
event->xbutton.button;
4333 delta *= 120 * ((btn == Button4 || btn == 6) ? 1 : -1);
4334 bool hor = (((btn == Button4 || btn == Button5) && (modifiers &
Qt::AltModifier)) ||
4335 (btn == 6 || btn == 7));
4336 translateWheelEvent(globalPos.
x(), globalPos.
y(), delta,
buttons,
4343 if (event->type == ButtonPress) {
4345 #if defined(Q_OS_IRIX) && !defined(QT_NO_TABLET) 4347 for (
int i = 0; i < tablets->
size(); ++i) {
4351 if (translateXinputEvent(&myEv, &tab)) {
4361 if (!qt_button_down) {
4362 qt_button_down = childAt(pos);
4363 if (!qt_button_down)
4364 qt_button_down =
this;
4385 #if defined(Q_OS_IRIX) && !defined(QT_NO_TABLET) 4387 for (
int i = 0; i < tablets->
size(); ++i) {
4391 if (translateXinputEvent(&myEv, &tab)) {
4409 if (
qApp->d_func()->inPopupMode()) {
4410 QWidget *activePopupWidget =
qApp->activePopupWidget();
4412 if (popup !=
this) {
4413 if (event->type == LeaveNotify)
4415 if ((windowType() ==
Qt::Popup) && rect().contains(pos) && 0)
4420 bool releaseAfter =
false;
4423 if (popup != qt_popup_down){
4431 qt_button_down = popupChild;
4432 qt_popup_down = popup;
4435 releaseAfter =
true;
4450 else if (popupChild)
4451 receiver = popupChild;
4452 if (receiver != popup)
4454 QWidget *alien = childAt(mapFromGlobal(globalPos));
4455 QMouseEvent e(type, widgetPos, globalPos, button, buttons, modifiers);
4470 if (
qApp->activePopupWidget() != activePopupWidget
4477 if (buttons == button)
4478 qt_button_down =
this;
4479 QMouseEvent e(type, mapFromGlobal(globalPos), globalPos, button,
4480 buttons, modifiers);
4485 && (openPopupCount == oldOpenPopupCount)) {
4487 globalPos, modifiers);
4495 && (openPopupCount == oldOpenPopupCount)) {
4500 popupEvent = popupChild;
4510 QWidget *alienWidget = childAt(pos);
4512 qt_button_down, alienWidget);
4520 QMouseEvent e(type, pos, globalPos, button, buttons, modifiers);
4522 qt_last_mouse_receiver);
4525 && (openPopupCount == oldOpenPopupCount)) {
4538 Qt::MouseButtons
buttons, Qt::KeyboardModifiers modifiers,
4542 QPoint pos = mapFromGlobal(globalPos);
4543 QWidget *widget = childAt(pos);
4550 qDebug() <<
"QETWidget::translateWheelEvent: receiver:" << widget <<
"pos:" << pos;
4556 if (popup &&
window() != popup)
4558 #ifndef QT_NO_WHEELEVENT 4559 QWheelEvent e(pos, globalPos, delta, buttons, modifiers, orient);
4566 if (widget !=
qApp->focusWidget() && (widget =
qApp->focusWidget())) {
4570 if (popup && widget != popup)
4572 #ifndef QT_NO_WHEELEVENT 4573 QWheelEvent e(pos, globalPos, delta, buttons, modifiers, orient);
4585 #if !defined (QT_NO_TABLET) 4587 #if !defined (Q_OS_IRIX) 4601 serialId = serialInt;
4668 if (event->type == MotionNotify)
4681 const XDeviceMotionEvent *
const motion =
reinterpret_cast<const XDeviceMotionEvent*
>(
event);
4683 const QPoint curr(motion->x, motion->y);
4696 data->
error =
event->type != MotionNotify;
4702 #if defined (Q_OS_IRIX) 4707 XInputClass *iClass;
4722 qreal tangentialPressure = 0;
4726 const XDeviceMotionEvent *motion = 0;
4727 XDeviceButtonEvent *button = 0;
4728 const XProximityNotifyEvent *proximity = 0;
4730 Qt::KeyboardModifiers modifiers = 0;
4731 #if !defined (Q_OS_IRIX) 4736 motion =
reinterpret_cast<const XDeviceMotionEvent*
>(ev);
4738 global =
QPoint(motion->x_root, motion->y_root);
4739 curr =
QPoint(motion->x, motion->y);
4740 #if !defined (Q_OS_IRIX) 4741 device_id = motion->deviceid;
4749 button = (XDeviceButtonEvent*)ev;
4751 global =
QPoint(button->x_root, button->y_root);
4752 curr =
QPoint(button->x, button->y);
4753 #if !defined (Q_OS_IRIX) 4754 device_id = button->deviceid;
4761 proximity = (
const XProximityNotifyEvent*)ev;
4762 #if !defined (Q_OS_IRIX) 4763 device_id = proximity->deviceid;
4768 #if defined (Q_OS_IRIX) 4769 QRect screenArea =
qApp->desktop()->screenGeometry(
this);
4770 s = XQueryDeviceState(
X11->display, static_cast<XDevice *>(tablet->
device));
4774 for (j = 0; j < s->num_classes; j++) {
4775 if (iClass->c_class == ValuatorClass) {
4776 vs =
reinterpret_cast<XValuatorState *
>(iClass);
4778 if (vs->valuators[WAC_TRANSDUCER_I]
4779 & WAC_TRANSDUCER_PROX_MSK) {
4780 switch (vs->valuators[WAC_TRANSDUCER_I]
4781 & WAC_TRANSDUCER_MSK) {
4793 uid = vs->valuators[WAC_TRANSDUCER_I] & WAC_TRANSDUCER_ID_MSK;
4794 uid = (uid << 24) | vs->valuators[WAC_SERIAL_NUM_I];
4795 switch (WAC_TRANSDUCER_I & 0x0F0600) {
4820 xTilt = short(vs->valuators[WAC_XTILT_I]);
4821 yTilt = short(vs->valuators[WAC_YTILT_I]);
4822 pressure = vs->valuators[WAC_PRESSURE_I];
4825 rotation = vs->valuators[WAC_ROTATION_I] / 64.0;
4827 z = vs->valuators[WAC_ZCOORD_I];
4829 tangentialPressure = vs->valuators[WAC_TAN_PRESSURE_I]
4830 /
qreal(tablet->maxTanPressure - tablet->minTanPressure);
4833 hiRes = tablet->scaleCoord(vs->valuators[WAC_XCOORD_I], vs->valuators[WAC_YCOORD_I],
4834 screenArea.
x(), screenArea.
width(),
4835 screenArea.
y(), screenArea.
height());
4839 iClass =
reinterpret_cast<XInputClass*
>(
reinterpret_cast<char*
>(iClass) + iClass->length);
4841 XFreeDeviceState(s);
4848 for (
int i = 0; i < tablet_list->
size(); ++i) {
4850 if (device_id == static_cast<XDevice *>(tab.
device)->device_id) {
4866 QRect screenArea =
qApp->desktop()->rect();
4868 xTilt = (short) motion->axis_data[3];
4869 yTilt = (
short) motion->axis_data[4];
4870 rotation = ((short) motion->axis_data[5]) / 64.0;
4871 pressure = (short) motion->axis_data[2];
4872 modifiers =
X11->translateModifiers(motion->state);
4873 hiRes = tablet->scaleCoord(motion->axis_data[0], motion->axis_data[1],
4874 screenArea.
x(), screenArea.
width(),
4875 screenArea.
y(), screenArea.
height());
4876 }
else if (button) {
4877 xTilt = (short) button->axis_data[3];
4878 yTilt = (
short) button->axis_data[4];
4879 rotation = ((short) button->axis_data[5]) / 64.0;
4880 pressure = (short) button->axis_data[2];
4881 modifiers =
X11->translateModifiers(button->state);
4882 hiRes = tablet->scaleCoord(button->axis_data[0], button->axis_data[1],
4883 screenArea.
x(), screenArea.
width(),
4884 screenArea.
y(), screenArea.
height());
4885 }
else if (proximity) {
4890 tangentialPressure = rotation;
4913 deviceType, pointerType,
4914 qreal(pressure /
qreal(tablet->maxPressure - tablet->minPressure)),
4915 xTilt, yTilt, tangentialPressure, rotation, z, modifiers, uid);
4926 tabletMotionData.
widget = w;
4931 bool reinsertMouseEvent =
false;
4935 tabletMotionData.
error =
false;
4937 reinsertMouseEvent =
true;
4943 tabletMotionData.error =
false;
4950 if (reinsertMouseEvent) {
4951 XPutBackEvent(
X11->display, &mouseMotionEvent);
4962 if (!isWindow())
return true;
4966 unsigned char *
data = 0;
4967 unsigned long nitems, after;
4970 this->data->fstrut_dirty = 1;
4972 if (event->xproperty.state == PropertyNewValue) {
4975 False, XA_CARDINAL, &ret, &format, &nitems, &after, &data);
4977 if (e ==
Success && ret == XA_CARDINAL &&
4978 format == 32 && nitems == 4) {
4979 long *strut = (
long *) data;
4980 d->topData()->frameStrut.setCoords(strut[0], strut[2], strut[1], strut[3]);
4981 this->data->fstrut_dirty = 0;
4987 Qt::WindowStates oldState = Qt::WindowStates(this->data->window_state);
4989 if (event->xproperty.state == PropertyNewValue) {
4993 False, XA_ATOM, &ret, &format, &nitems, &after, &data);
4995 if (e ==
Success && ret == XA_ATOM && format == 32 && nitems > 0) {
5000 for (i = 0; i < nitems; i++) {
5008 if (maximized == 3) {
5015 bool send_event =
false;
5019 if (max && !isMaximized()) {
5022 }
else if (!max && isMaximized()) {
5029 if (full && !isFullScreen()) {
5032 }
else if (!full && isFullScreen()) {
5044 this->data->fstrut_dirty = 1;
5046 if (event->xproperty.state == PropertyDelete) {
5050 d->topData()->parentWinId = 0;
5051 d->topData()->validWMState = 0;
5054 if (
X11->deferred_map.removeAll(
this)) {
5056 }
else if (isVisible()
5071 e = XGetWindowProperty(
X11->display, internalWinId(),
ATOM(
WM_STATE), 0, 2, False,
5072 ATOM(
WM_STATE), &ret, &format, &nitems, &after, &data);
5075 long *state = (
long *) data;
5077 case WithdrawnState:
5085 d->topData()->parentWinId = 0;
5086 d->topData()->validWMState = 0;
5089 if (
X11->deferred_map.removeAll(
this)) {
5091 }
else if (isVisible()
5106 d->topData()->validWMState = 1;
5107 if (!isMinimized()) {
5116 d->topData()->validWMState = 1;
5117 if (isMinimized()) {
5129 if (event->xproperty.state == PropertyNewValue) {
5130 e = XGetWindowProperty(event->xclient.display,
5131 event->xclient.window,
5133 0, 1, False, XA_CARDINAL,
5134 &ret, &format, &nitems, &after, &data);
5136 if (e ==
Success && ret == XA_CARDINAL && format == 32 && nitems == 1
5137 && after == 0 && data) {
5139 d->topData()->opacity =
uint(value >> 24);
5142 d->topData()->opacity = 255;
5162 #if defined(Q_C_CALLBACKS) 5169 if (ev->type == Expose || ev->type == GraphicsExpose
5172 if (ev->xexpose.window == info->
window)
5178 #if defined(Q_C_CALLBACKS) 5189 for (
int i = 0; i <
X11->sip_list.size(); ++i) {
5212 QRect paintRect(event->xexpose.x, event->xexpose.y,
5213 event->xexpose.width, event->xexpose.height);
5216 info.
window = internalWinId();
5218 paintRect =
d->mapFromWS(paintRect);
5220 QRegion paintRegion = paintRect;
5228 if (xevent.type == Expose || xevent.type == GraphicsExpose) {
5229 QRect exposure(xevent.xexpose.x,
5231 xevent.xexpose.width,
5232 xevent.xexpose.height);
5234 exposure =
d->mapFromWS(exposure);
5235 paintRegion |= exposure;
5237 translateScrollDoneEvent(&xevent);
5242 d->syncBackingStore(paintRegion);
5251 long id =
event->xclient.data.l[0];
5254 for (
int i = 0; i <
X11->sip_list.size(); ++i) {
5257 X11->sip_list.removeAt(i);
5279 while (XCheckTypedWindowEvent(
X11->display,internalWinId(), ConfigureNotify,&xevent) &&
5286 const QSize oldSize = size();
5289 QPoint newCPos(geometry().topLeft());
5290 QSize newSize(event->xconfigure.width, event->xconfigure.height);
5292 bool trust = isVisible()
5293 && (
d->topData()->parentWinId ==
XNone ||
5295 bool isCPos =
false;
5297 if (event->xconfigure.send_event || trust) {
5300 newCPos.
rx() =
event->xconfigure.x +
event->xconfigure.border_width;
5301 newCPos.
ry() =
event->xconfigure.y +
event->xconfigure.border_width;
5307 if (
d->extra->compress_events) {
5310 while (XCheckTypedWindowEvent(
X11->display, internalWinId(), ConfigureNotify,
5315 if (x11Event(&otherEvent))
5318 if (otherEvent.xconfigure.event != otherEvent.xconfigure.window)
5321 newSize.
setWidth(otherEvent.xconfigure.width);
5322 newSize.
setHeight(otherEvent.xconfigure.height);
5324 if (otherEvent.xconfigure.send_event || trust) {
5325 newCPos.
rx() = otherEvent.xconfigure.x +
5326 otherEvent.xconfigure.border_width;
5327 newCPos.
ry() = otherEvent.xconfigure.y +
5328 otherEvent.xconfigure.border_width;
5334 sync_event.
window = internalWinId();
5339 #endif // QT_NO_XSYNC 5348 XTranslateCoordinates(
X11->display, internalWinId(),
5350 0, 0, &x, &y, &child);
5355 QRect cr (geometry());
5356 if (newCPos != cr.
topLeft()) {
5357 QPoint oldPos = geometry().topLeft();
5367 if (newSize != cr.
size()) {
5371 uint old_state =
data->window_state;
5378 if (old_state !=
data->window_state) {
5390 while (XCheckTypedWindowEvent(
X11->display,internalWinId(), ConfigureNotify,&xevent) &&
5397 if (isVisible() &&
data->crect.size() != oldSize) {
5405 if (!hasStaticContents)
5406 d->extra->topextra->inTopLevelResize =
true;
5411 const bool waitingForMapNotify =
d->extra->topextra &&
d->extra->topextra->waitingForMapNotify;
5412 if (!waitingForMapNotify) {
5413 if (
d->paintOnScreen()) {
5417 d->syncBackingStore(updateRegion);
5419 d->syncBackingStore();
5423 if (
d->extra &&
d->extra->topextra)
5424 d->extra->topextra->inTopLevelResize =
false;
5427 if (
QTLWExtra *tlwExtra =
d->maybeTopData()) {
5428 if (tlwExtra->newCounterValueLo != 0 || tlwExtra->newCounterValueHi != 0) {
5430 XSyncIntsToValue(&value,
5431 tlwExtra->newCounterValueLo,
5432 tlwExtra->newCounterValueHi);
5434 XSyncSetCounter(
X11->display, tlwExtra->syncUpdateCounter, value);
5435 tlwExtra->newCounterValueHi = 0;
5436 tlwExtra->newCounterValueLo = 0;
5483 #ifndef QT_NO_WHEELEVENT 5555 #ifndef QT_NO_SESSIONMANAGER 5558 #include <X11/SM/SMlib.h> 5583 connect(sn,
SIGNAL(activated(
int)),
this,
SLOT(socketActivated(
int)));
5587 void socketActivated(
int);
5608 int num_vals, SmPropValue* vals);
5610 int saveType, Bool shutdown ,
int interactStyle, Bool fast);
5612 static void sm_dieCallback(SmcConn smcConn, SmPointer clientData) ;
5621 sm_waitingForInteraction =
false;
5622 sm_interactionActive =
false;
5623 sm_interactStyle = SmInteractStyleNone;
5624 sm_smActive =
false;
5626 sm_isshutdown =
false;
5629 sm_in_phase2 =
false;
5636 int num_vals, SmPropValue* vals)
5640 prop.name = (
char*)name;
5641 prop.type = (
char*)type;
5642 prop.num_vals = num_vals;
5647 SmcSetProperties(smcConnection, 1, props);
5651 names[0] = (
char*) name;
5652 SmcDeleteProperties(smcConnection, 1, names);
5667 SmPropValue *prop =
new SmPropValue[value.
count()];
5671 prop[count].
length = (*it).length();
5672 vl.
append((*it).toUtf8());
5673 prop[count].value = (
char*)vl.
last().
data();
5688 int saveType, Bool shutdown ,
int interactStyle, Bool )
5690 if (smcConn != smcConnection)
5694 sm_isshutdown = shutdown;
5695 sm_saveType = saveType;
5696 sm_interactStyle = interactStyle;
5701 ((
QT_smcConn*)smcConn)->save_yourself_in_progress =
true;
5703 ((
QT_smcConn*)smcConn)->shutdown_in_progress =
true;
5719 gettimeofday(&tv, 0);
5728 struct passwd *entryPtr = 0;
5729 #if defined(_POSIX_THREAD_SAFE_FUNCTIONS) && (_POSIX_THREAD_SAFE_FUNCTIONS - 0 > 0) 5731 struct passwd entry;
5732 while (getpwuid_r(geteuid(), &entry, buf.
data(), buf.
size(), &entryPtr) == ERANGE) {
5733 if (buf.
size() >= 32768) {
5735 static char badusername[] =
"";
5737 entry.pw_name = badusername;
5745 entryPtr = getpwuid(geteuid());
5760 switch (sm_saveType) {
5762 qApp->commitData(*sm);
5763 if (sm_isshutdown && sm_cancel)
5767 qApp->saveState(*sm);
5770 qApp->commitData(*sm);
5776 if (sm_phase2 && !sm_in_phase2) {
5784 if (sm_interactionActive) {
5785 SmcInteractDone(smcConnection, sm_isshutdown && sm_cancel);
5786 sm_interactionActive =
false;
5788 else if (sm_cancel && sm_isshutdown) {
5790 SmcInteractDone(smcConnection, True);
5791 sm_interactionActive =
false;
5801 prop.length =
sizeof(int);
5803 prop.value = (SmPointer) &value;
5807 SmcSaveYourselfDone(smcConnection, !sm_cancel);
5813 if (smcConn != smcConnection)
5822 if (smcConn != smcConnection)
5824 if (sm_waitingForInteraction)
5831 if (smcConn != smcConnection)
5838 if (smcConn != smcConnection)
5840 if (sm_waitingForInteraction)
5846 if (smcConn != smcConnection)
5848 sm_in_phase2 =
true;
5855 IceProcessMessages(SmcGetIceConnection(smcConnection), 0, 0);
5861 #include "qapplication_x11.moc" 5868 d->restartHint = RestartIfRunning;
5874 char* prevId = b_id.
data();
5878 cb.save_yourself.client_data = (SmPointer)
d;
5880 cb.die.client_data = (SmPointer)
d;
5882 cb.save_complete.client_data = (SmPointer)
d;
5884 cb.shutdown_cancelled.client_data = (SmPointer)
d;
5890 smcConnection = SmcOpenConnection(0, 0, 1, 0,
5891 SmcSaveYourselfProcMask |
5893 SmcSaveCompleteProcMask |
5894 SmcShutdownCancelledProcMask,
5904 if (!smcConnection) {
5908 sm_receiver =
new QSmSocketReceiver(IceConnectionNumber(SmcGetIceConnection(smcConnection)));
5915 SmcCloseConnection(smcConnection, 0, 0);
5923 return d->sessionId;
5929 return d->sessionKey;
5942 if (sm_interactionActive)
5945 if (sm_waitingForInteraction)
5948 if (sm_interactStyle == SmInteractStyleAny) {
5949 sm_waitingForInteraction = SmcInteractRequest(smcConnection, SmDialogNormal,
5952 if (sm_waitingForInteraction) {
5954 d->eventLoop = &eventLoop;
5955 (void) eventLoop.
exec();
5958 sm_waitingForInteraction =
false;
5960 sm_interactionActive =
true;
5971 if (sm_interactionActive)
5974 if (sm_waitingForInteraction)
5977 if (sm_interactStyle == SmInteractStyleAny || sm_interactStyle == SmInteractStyleErrors) {
5978 sm_waitingForInteraction = SmcInteractRequest(smcConnection, SmDialogError,
5981 if (sm_waitingForInteraction) {
5983 d->eventLoop = &eventLoop;
5984 (void) eventLoop.
exec();
5987 sm_waitingForInteraction =
false;
5989 sm_interactionActive =
true;
5999 if (sm_interactionActive) {
6000 SmcInteractDone(smcConnection, False);
6001 sm_interactionActive =
false;
6002 if (sm_smActive && sm_isshutdown)
6015 d->restartHint = hint;
6021 return d->restartHint;
6027 d->restartCommand = command;
6033 return d->restartCommand;
6039 d->discardCommand = command;
6045 return d->discardCommand;
6068 #endif // QT_NO_SESSIONMANAGER 6070 #if defined(QT_RX71_MULTITOUCH) 6072 static inline int testBit(
const char *array,
int bit)
6074 return (array[bit/8] & (1<<(bit%8)));
6077 static int openRX71Device(
const QByteArray &deviceName)
6086 char eventTypeMask[(EV_MAX +
sizeof(char) - 1) *
sizeof(char) + 1];
6087 memset(eventTypeMask, 0,
sizeof(eventTypeMask));
6088 if (ioctl(fd, EVIOCGBIT(0,
sizeof(eventTypeMask)), eventTypeMask) < 0) {
6092 if (!testBit(eventTypeMask, EV_ABS)) {
6098 char absMask[(ABS_MAX +
sizeof(char) - 1) *
sizeof(char) + 1];
6099 memset(absMask, 0,
sizeof(absMask));
6100 if (ioctl(fd, EVIOCGBIT(EV_ABS,
sizeof(absMask)), absMask) < 0) {
6104 if (!testBit(absMask, ABS_X) || !testBit(absMask, ABS_Y)) {
6117 int currentDeviceNumber = 0;
6120 if (fd == -ENOENT) {
6129 struct input_absinfo abs_x, abs_y, abs_z;
6130 ioctl(fd, EVIOCGABS(ABS_X), &abs_x);
6131 ioctl(fd, EVIOCGABS(ABS_Y), &abs_y);
6132 ioctl(fd, EVIOCGABS(ABS_Z), &abs_z);
6134 int deviceNumber = allRX71TouchPoints.count();
6139 RX71TouchPointState touchPointState = {
6143 abs_x.minimum, abs_x.maximum, q->desktop()->screenGeometry().width(),
6144 abs_y.minimum, abs_y.maximum, q->desktop()->screenGeometry().height(),
6145 abs_z.minimum, abs_z.maximum
6147 allRX71TouchPoints.append(touchPointState);
6150 hasRX71MultiTouch = allRX71TouchPoints.count() > 1;
6151 if (!hasRX71MultiTouch) {
6152 for (
int i = 0; i < allRX71TouchPoints.count(); ++i) {
6153 QSocketNotifier *socketNotifier = allRX71TouchPoints.at(i).socketNotifier;
6154 close(socketNotifier->
socket());
6155 delete socketNotifier;
6157 allRX71TouchPoints.clear();
6163 hasRX71MultiTouch =
false;
6164 for (
int i = 0; i < allRX71TouchPoints.count(); ++i) {
6165 QSocketNotifier *socketNotifier = allRX71TouchPoints.at(i).socketNotifier;
6166 close(socketNotifier->
socket());
6167 delete socketNotifier;
6169 allRX71TouchPoints.clear();
6172 bool QApplicationPrivate::readRX71MultiTouchEvents(
int deviceNumber)
6174 RX71TouchPointState &touchPointState = allRX71TouchPoints[deviceNumber];
6176 int fd = socketNotifier->
socket();
6184 bool changed =
false;
6186 struct input_event inputEvent;
6187 int bytesRead = read(fd, &inputEvent,
sizeof(inputEvent));
6190 if (bytesRead !=
sizeof(inputEvent)) {
6191 qWarning(
"Qt: INTERNAL ERROR: short read in readRX71MultiTouchEvents()");
6195 switch (inputEvent.type) {
6198 switch (touchPoint.
state()) {
6211 qWarning(
"Qt: WARNING: unknown event type %d on multitouch device", inputEvent.type);
6216 switch (inputEvent.code) {
6218 if (!down && inputEvent.value != 0)
6220 else if (down && inputEvent.value == 0)
6223 case ABS_TOOL_WIDTH:
6230 qreal newValue = ((
qreal(inputEvent.value - touchPointState.minX)
6231 /
qreal(touchPointState.maxX - touchPointState.minX))
6232 * touchPointState.scaleX);
6233 screenPos.
rx() = newValue;
6239 qreal newValue = ((
qreal(inputEvent.value - touchPointState.minY)
6240 /
qreal(touchPointState.maxY - touchPointState.minY))
6241 * touchPointState.scaleY);
6242 screenPos.
ry() = newValue;
6249 qreal newValue = (
qreal(inputEvent.value - touchPointState.minZ)
6250 /
qreal(touchPointState.maxZ - touchPointState.minZ));
6255 qWarning(
"Qt: WARNING: unknown event code %d on multitouch device", inputEvent.code);
6266 void QApplicationPrivate::_q_readRX71MultiTouchEvents()
6269 bool changed =
false;
6270 for (
int i = 0; i < allRX71TouchPoints.count(); ++i)
6271 changed = readRX71MultiTouchEvents(i) || changed;
6276 for (
int i = 0; i < allRX71TouchPoints.count(); ++i)
6277 touchPoints.
append(allRX71TouchPoints.at(i).touchPoint);
6282 #else // !QT_RX71_MULTITOUCH 6289 #endif // QT_RX71_MULTITOUCH
static QString number(int, int base=10)
This is an overloaded member function, provided for convenience. It differs from the above function o...
The QVariant class acts like a union for the most common Qt data types.
TabletDevice
This enum defines what type of device is generating the event.
static QTextCodec * codecForLocale()
Returns a pointer to the codec most suitable for this locale.
static int keyboardInputInterval()
void qt_init(QApplicationPrivate *priv, int, Display *display, Qt::HANDLE visual, Qt::HANDLE colormap)
The QColor class provides colors based on RGB, HSV or CMYK values.
void setPointSize(int)
Sets the point size to pointSize.
virtual bool x11EventFilter(XEvent *)
void setSingleShot(bool singleShot)
static PtrWacomConfigInit ptrWacomConfigInit
Bool(* PtrXineramaQueryExtension)(Display *dpy, int *event_base, int *error_base)
Q_GUI_EXPORT bool qt_try_modal(QWidget *, XEvent *)
static QWidget * main_widget
bool allowsErrorInteraction()
Returns true if error interaction is permitted; otherwise returns false.
void setScreenPos(const QPointF &screenPos)
static QWaylandClipboard * clipboard
The QApplication class manages the GUI application's control flow and main settings.
static QColormap instance(int screen=-1)
Q_CORE_EXPORT QByteArray qgetenv(const char *varName)
static QWidgetList topLevelWidgets()
int qt_ximComposingKeycode
static bool checkInstance(const char *method)
void setHeight(int h)
Sets the height of the rectangle to the given height.
static QString fromLocal8Bit(const char *, int size=-1)
Returns a QString initialized with the first size characters of the 8-bit string str.
static void beep()
Sounds the bell, using the default volume and sound.
QVariant value(const QString &key, const QVariant &defaultValue=QVariant()) const
Returns the value for setting key.
static PtrWacomConfigTerm ptrWacomConfigTerm
static bool versionSupported()
The QCursor class provides a mouse cursor with an arbitrary shape.
static mach_timebase_info_data_t info
Q_DECL_CONSTEXPR const T & qMin(const T &a, const T &b)
#define QT_END_NAMESPACE
This macro expands to.
static const char * appClass()
Returns the X11 application class.
ushort hue
Returns the hue color component of this color.
QPointer< QWidget > widget
static const char * appFont
Qt::TouchPointState state() const
Returns the current state of this touch point.
ColorRole
The ColorRole enum defines the different symbolic color roles used in current GUIs.
static void setStyle(QStyle *)
Sets the application's GUI style to style.
char * data()
Returns a pointer to the data stored in the byte array.
static void reset_instance_pointer()
static QWidget * pickMouseReceiver(QWidget *candidate, const QPoint &globalPos, QPoint &pos, QEvent::Type type, Qt::MouseButtons buttons, QWidget *buttonDown, QWidget *alienWidget)
bool(* QX11FilterFunction)(XEvent *event)
const QChar at(int i) const
Returns the character at the given index position in the string.
static SmcConn smcConnection
void qPRCleanup(QWidget *widget)
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 ...
XIMStyle qt_xim_preferred_style
#define it(className, varName)
static void sm_performSaveYourself(QSessionManagerPrivate *)
bool open(OpenMode flags)
Opens the file using OpenMode mode, returning true if successful; otherwise false.
bool fromString(const QString &)
Sets this font to match the description descrip.
QList< QWidget * > QWidgetList
The QWheelEvent class contains parameters that describe a wheel event.
int weight() const
Returns the weight of the matched window system font.
void setUnderline(bool)
If enable is true, sets underline on; otherwise sets underline off.
The QSettings class provides persistent platform-independent application settings.
void endGroup()
Resets the group to what it was before the corresponding beginGroup() call.
static void initializeWidgetPaletteHash()
static QAbstractEventDispatcher * instance(QThread *thread=0)
Returns a pointer to the event dispatcher object for the specified thread.
bool open(OpenMode openMode)
Reimplemented Function
QByteArray toUtf8() const Q_REQUIRED_RESULT
Returns a UTF-8 representation of the string as a QByteArray.
int pixelSize() const
Returns the pixel size of the font if it was set with setPixelSize().
The QByteArray class provides an array of bytes.
static Qt::HANDLE appRootWindow(int screen=-1)
Returns a handle for the applications root window on the given screen.
int length() const
Returns the number of characters in this string.
void qt_updated_rootinfo()
static bool sm_interactionActive
static void setAttribute(Qt::ApplicationAttribute attribute, bool on=true)
Sets the attribute attribute if on is true; otherwise clears the attribute.
The QPointF class defines a point in the plane using floating point precision.
void initializeMultitouch_sys()
static Qt::MouseButtons buttons
static void addLibraryPath(const QString &)
Prepends path to the beginning of the library path list, ensuring that it is searched for libraries f...
void beginGroup(const QString &prefix)
Appends prefix to the current group.
iterator begin()
Returns an STL-style iterator pointing to the first item in the list.
int xinput_button_release
static int wheel_scroll_lines
QString toString() const
Returns the variant as a QString if the variant has type() String , Bool , ByteArray ...
void createEventDispatcher()
static const char * appName
const_iterator constBegin() const
Returns a const STL-style iterator pointing to the first item in the list.
bool getChar(char *c)
Reads one character from the device and stores it in c.
int(* PtrXRRUpdateConfiguration)(XEvent *)
int width() const
Returns the width of the rectangle.
The QList::const_iterator class provides an STL-style const iterator for QList and QQueue...
int & ry()
Returns a reference to the y coordinate of this point.
void insert(int i, const T &t)
Inserts value at index position i in the list.
#define QT_END_INCLUDE_NAMESPACE
This macro is equivalent to QT_BEGIN_NAMESPACE.
Q_GUI_EXPORT void qt_x11_apply_settings_in_all_apps()
static QWidget * active_window
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
bool toBool() const
Returns the variant as a bool if the variant has type() Bool.
static void cleanup()
Internal function that cleans up the font system.
long ASN1_INTEGER_get ASN1_INTEGER * a
int count(const T &t) const
Returns the number of occurrences of value in the list.
static QStyle * style()
Returns the application's style object.
void setRawMode(bool)
If enable is true, turns raw mode on; otherwise turns raw mode off.
uchar qt_mode_switch_mask
T & value() const
Returns a modifiable reference to the current item's value.
void closePopup(QWidget *popup)
void * resolve(const char *symbol)
Returns the address of the exported symbol symbol.
static int cursorFlashTime()
ushort red
Returns the red color component of this color.
QStringList restartCommand() const
Returns the currently set restart command.
The QBuffer class provides a QIODevice interface for a QByteArray.
int height() const
Returns the height of the rectangle.
void socketActivated(int)
static void qt_save_rootinfo()
static void qt_get_net_virtual_roots()
static Window mouseActWindow
Q_CORE_EXPORT int qsnprintf(char *str, size_t n, const char *fmt,...)
The QString class provides a Unicode character string.
bool isLoaded() const
Returns true if the library is loaded; otherwise returns false.
void setHeight(int h)
Sets the height to the given height.
void setItalic(bool b)
Sets the style() of the font to QFont::StyleItalic if enable is true; otherwise the style is set to Q...
QClipboard * qt_clipboard
The QHash class is a template class that provides a hash-table-based dictionary.
void cleanupMultitouch_sys()
static int openPopupCount
void setFileName(const QString &fileName)
Q_DECL_CONSTEXPR T qAbs(const T &t)
The QObject class is the base class of all Qt objects.
static QETWidget * qPRFindWidget(Window oldwin)
static Qt::MouseButtons translateMouseButtons(int s)
static int wheelScrollLines()
WACOMDEVICE *(* PtrWacomConfigOpenDevice)(WACOMCONFIG *, const char *)
static Bool qt_xfixes_scanner(Display *, XEvent *event, XPointer arg)
The QChar class provides a 16-bit Unicode character.
void setDiscardCommand(const QStringList &)
Sets the discard command to the given list.
int *(* PtrWacomConfigGetRawParam)(WACOMDEVICE *, int, int *, int, unsigned *)
static void sm_shutdownCancelledCallback(SmcConn smcConn, SmPointer clientData)
const T value(const Key &key) const
Returns the value associated with the key.
Q_DECL_CONSTEXPR const T & qMax(const T &a, const T &b)
bool isSpace() const
Returns true if the character is a separator character (Separator_* categories); otherwise returns fa...
QPointer< QWidget > widgetToGetPress
iterator Iterator
Qt-style synonym for QList::iterator.
void getHsv(int *h, int *s, int *v, int *a=0) const
Sets the contents pointed to by h, s, v, and a, to the hue, saturation, value, and alpha-channel (tra...
bool qt_sm_blockUserInput
bool isEmpty() const
Returns true if the list contains no items; otherwise returns false.
bool allowsInteraction()
Asks the session manager for permission to interact with the user.
iterator insert(const Key &key, const T &value)
Inserts a new item with the key and a value of value.
void setHsv(int h, int s, int v, int a=255)
Sets a HSV color value; h is the hue, s is the saturation, v is the value and a is the alpha componen...
int(* PtrWacomConfigCloseDevice)(WACOMDEVICE *)
The QSocketNotifier class provides support for monitoring activity on a file descriptor.
static QWidget * focus_widget
static const char * appClass
static QFont font()
Returns the default application font.
QTabletDeviceDataList * qt_tablet_devices()
bool qt_wstate_iconified(WId winid)
int toInt(bool *ok=0) const
Returns the variant as an int if the variant has type() Int , Bool , ByteArray , Char ...
bool italic() const
Returns the italic value of the matched window system font.
void setFamily(const QString &)
Sets the family name of the font.
void setWidth(int w)
Sets the width to the given width.
#define QT_GUI_DOUBLE_CLICK_RADIUS
QSessionManagerPrivate(QSessionManager *mgr, QString &id, QString &key)
void setState(Qt::TouchPointStates state)
void release()
Releases the session manager's interaction semaphore after an interaction phase.
static int keyboard_input_time
Q_CORE_EXPORT void qDebug(const char *,...)
static QWidget * widgetAt(const QPoint &p)
Returns the widget at global screen position point, or 0 if there is no Qt widget there...
static bool sm_isshutdown
QColor darker(int f=200) const
Returns a darker (or lighter) color, but does not change this object.
static Bool isPaintOrScrollDoneEvent(Display *, XEvent *ev, XPointer a)
static void initialize(char **, int)
int width() const
Returns the width.
void setRestartCommand(const QStringList &)
If the session manager is capable of restoring sessions it will execute command in order to restore t...
QStringList toStringList() const
Returns the variant as a QStringList if the variant has type() StringList, String ...
static void qt_set_input_encoding()
void append(const T &t)
Inserts value at the end of the list.
void setRestartHint(RestartHint)
Sets the application's restart hint to hint.
static void setSystemFont(const QFont &font)
The QSessionManager class provides access to the session manager.
static bool allowX11ColorNames()
Returns true if setNamedColor() is allowed to look up colors in the X11 color database.
#define QT_BEGIN_NAMESPACE
This macro expands to.
static const char * appBTNCol
qreal & rx()
Returns a reference to the x coordinate of this point.
ushort value
Returns the value color component of this color.
The QMoveEvent class contains event parameters for move events.
static QGraphicsSystem * create(const QString &)
Q_GUI_EXPORT EGLDisplay display()
QSessionManager(QApplication *app, QString &id, QString &key)
static bool isEmpty(const char *str)
The QEventLoop class provides a means of entering and leaving an event loop.
static PtrWacomConfigCloseDevice ptrWacomConfigCloseDevice
bool qt_use_rtl_extensions
static void qt_check_focus_model()
QString left(int n) const Q_REQUIRED_RESULT
Returns a substring that contains the n leftmost characters of the string.
QString trimmed() const Q_REQUIRED_RESULT
Returns a string that has whitespace removed from the start and the end.
static bool x11_apply_settings()
static bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
Creates a connection of the given type from the signal in the sender object to the method in the rece...
QByteArray & buffer()
Returns a reference to the QBuffer's internal buffer.
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
static short mouseGlobalYPos
bool isEmpty() const
Returns true if the region is empty; otherwise returns false.
static void initialize()
Internal function that initializes the font system.
bool strikeOut() const
Returns the strikeout value of the matched window system font.
void setStrikeOut(bool)
If enable is true, sets strikeout on; otherwise sets strikeout off.
static void sm_interactCallback(SmcConn smcConn, SmPointer clientData)
iterator end()
Returns an STL-style iterator pointing to the imaginary item after the last item in the list...
static QWidgetList * popupWidgets
#define Q_GLOBAL_STATIC(TYPE, NAME)
Declares a global static variable with the given type and name.
static void insertSubstitutions(const QString &, const QStringList &)
Inserts the list of families substituteNames into the substitution list for familyName.
QSize size() const
Returns the size of the rectangle.
const T & at(int i) const
Returns the item at index position i in the list.
static void sm_dieCallback(SmcConn smcConn, SmPointer clientData)
bool underline() const
Returns the underline value of the matched window system font.
The QHideEvent class provides an event which is sent after a widget is hidden.
The QStringList class provides a list of strings.
static QWidgetMapper * wPRmapper
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...
Q_GUI_EXPORT QX11Data * qt_x11Data
static int toInt(const QByteArray &str)
static void clear()
Removes all pixmaps from the cache.
#define QT_PREPEND_NAMESPACE(name)
This macro qualifies identifier with the full namespace.
static bool sendSpontaneousEvent(QObject *receiver, QEvent *event)
static int mouse_double_click_time
The QResizeEvent class contains event parameters for resize events.
Q_CORE_EXPORT void qWarning(const char *,...)
int & rx()
Returns a reference to the x coordinate of this point.
void setSize(const QSize &s)
Sets the size of the rectangle to the given size.
virtual int mibEnum() const =0
Subclasses of QTextCodec must reimplement this function.
static bool getGConfBool(const QString &key, bool fallback=0)
Returns the configuration boolean for key.
static const char * data(const QByteArray &arr)
#define XINPUT_LOAD(symbol)
static void setKeyboardInputInterval(int)
int indexOf(QChar c, int from=0, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
bool qt_xfixes_clipboard_changed(Window clipboardOwner, Time timestamp)
The QLatin1String class provides a thin wrapper around an US-ASCII/Latin-1 encoded string literal...
static QTextCodec * codec(MYSQL *mysql)
static bool animate_combo
static void alert(QWidget *widget, int duration=0)
static QStyle * app_style
static Bool qt_mouseMotion_scanner(Display *, XEvent *event, XPointer arg)
bool translateKeyEvent(QWidget *receiver, const MSG &msg, bool grab)
static bool sendEvent(QObject *receiver, QEvent *event)
Sends event event directly to receiver receiver, using the notify() function.
QBool contains(const QString &str, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Returns true if the list contains the string str; otherwise returns false.
static Time mouseButtonPressTime
QPointF screenPos() const
Returns the screen position of this touch point.
The QRegion class specifies a clip region for a painter.
QString right(int n) const Q_REQUIRED_RESULT
Returns a substring that contains the n rightmost characters of the string.
static QPalette * sys_pal
const T * ptr(const T &t)
int pixelSize() const
Returns the pixel size of the matched window system font.
QByteArray toLatin1() const Q_REQUIRED_RESULT
Returns a Latin-1 representation of the string as a QByteArray.
void clear()
Removes all items from the list.
#define XFIXES_LOAD_V2(symbol)
static void sm_saveYourselfCallback(SmcConn smcConn, SmPointer clientData, int saveType, Bool shutdown, int interactStyle, Bool fast)
unsigned int shutdown_in_progress
const Key & key() const
Returns the current item's key as a const reference.
QStringList childKeys() const
Returns a list of all top-level keys that can be read using the QSettings object. ...
XineramaScreenInfo *(* PtrXineramaQueryScreens)(Display *dpy, int *number)
bool isPhase2() const
Returns true if the session manager is currently performing a second session management phase; otherw...
static QStringList keys()
Returns the list of keys this factory can create input contexts for.
void setStyleHint(StyleHint, StyleStrategy=PreferDefault)
Sets the style hint and strategy to hint and strategy, respectively.
WACOMCONFIG *(* PtrWacomConfigInit)(Display *, WACOMERRORFUNC)
bool isNull() const
Returns true if this byte array is null; otherwise returns false.
The QShowEvent class provides an event that is sent when a widget is shown.
static void setAllowX11ColorNames(bool enabled)
Allow setNamedColor() to look up colors in the X11 color database if enabled.
QByteArray toLocal8Bit() const Q_REQUIRED_RESULT
Returns the local 8-bit representation of the string as a QByteArray.
bool inherits(const char *classname) const
Returns true if this object is an instance of a class that inherits className or a QObject subclass t...
The QFontInfo class provides general information about fonts.
static QWidgetList topLevelWidgets()
Returns a list of the top-level widgets (windows) in the application.
static QString graphics_system_name
static QWidget * topLevelAt(const QPoint &p)
Returns the top-level widget at the given point; returns 0 if there is no such widget.
bool contains(const QPoint &p, bool proper=false) const
Returns true if the given point is inside or on the edge of the rectangle, otherwise returns false...
#define XWACOM_PARAM_TOOLSERIAL
The QTabletEvent class contains parameters that describe a Tablet event.
void moveTopLeft(const QPoint &p)
Moves the rectangle, leaving the top-left corner at the given position.
static Qt::KeyboardModifiers translateModifiers(int s)
static void * qt_load_library_runtime(const char *library, int vernum, int highestVernum, const char *symbol)
Try to resolve a symbol from library with the version specified by vernum.
void setManagerProperty(const QString &name, const QString &value)
Low-level write access to the application's identification and state records are kept in the session ...
static bool startingUp()
Returns true if an application object has not been created yet; otherwise returns false...
static void enterModal_sys(QWidget *)
QStringList discardCommand() const
Returns the currently set discard command.
The QMouseEvent class contains parameters that describe a mouse event.
static PtrWacomConfigGetRawParam ptrWacomConfigGetRawParam
static QIconLoader * instance()
static QDesktopWidget * desktop()
Returns the desktop widget (also called the root window).
bool isSupportedByWM(Atom atom)
int length() const
Same as size().
Bool(* PtrXineramaIsActive)(Display *dpy)
QHash< WId, QWidget * > QWidgetMapper
RestartHint
This enum type defines the circumstances under which this application wants to be restarted by the se...
void fetchWacomToolId(int &deviceType, qint64 &serialId)
int x11ProcessEvent(XEvent *)
This function does the core processing of individual X {event}s, normally by dispatching Qt events to...
int(* PtrXRRRootToScreen)(Display *, Window)
const char * constData() const
Returns a pointer to the data stored in the byte array.
static bool animate_tooltip
bool isNull() const
Returns true if this string is null; otherwise returns false.
QString join(const QString &sep) const
Joins all the string list's strings into a single string with each element separated by the given sep...
static void setColorSpec(int)
Sets the color specification for the application to spec.
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...
void qt_net_update_user_time(QWidget *tlw, unsigned long timestamp)
const_iterator constEnd() const
Returns a const STL-style iterator pointing to the imaginary item after the last item in the hash...
static bool tryModalHelper(QWidget *widget, QWidget **rettop=0)
bool qt_check_selection_sentinel()
QString sessionId() const
Returns the identifier of the current session.
static void qt_set_x11_resources(const char *font=0, const char *fg=0, const char *bg=0, const char *button=0)
static Qt::KeyboardModifiers queryKeyboardModifiers()
Queries and returns the state of the modifier keys on the keyboard.
QString arg(qlonglong a, int fieldwidth=0, int base=10, const QChar &fillChar=QLatin1Char(' ')) const Q_REQUIRED_RESULT
static void setCursorFlashTime(int)
bool qt_check_clipboard_sentinel()
static bool isEffectEnabled(Qt::UIEffect)
Returns true if effect is enabled; otherwise returns false.
static Qt::MouseButtons mouseButtonState
static bool obey_desktop_settings
static QWidget * activePopupWidget()
Returns the active popup widget.
QWidgetList * qt_modal_stack
ushort blue
Returns the blue color component of this color.
bool load()
Loads the library and returns true if the library was loaded successfully; otherwise returns false...
int size() const
Returns the number of items in the hash.
The QWindowStateChangeEvent class provides the window state before a window state change...
QPointer< QWidget > qt_last_mouse_receiver
The QFile class provides an interface for reading from and writing to files.
QString trimmed(QString source)
Type
This enum type defines the valid event types in Qt.
static const char * mwTitle
static QInputContext * inputContext
ushort alpha
Returns the alpha color component of this color.
The QFont class specifies a font used for drawing text.
int y() const
Returns the y-coordinate of the rectangle's top edge.
static void * appVisual(int screen=-1)
Returns the current visual used by the application on the given screen.
QString simplified() const Q_REQUIRED_RESULT
Returns a string that has whitespace removed from the start and the end, and that has each sequence o...
Q_CORE_EXPORT char * qstrdup(const char *)
static void sm_setProperty(const char *name, const char *type, int num_vals, SmPropValue *vals)
QString sessionKey() const
Returns the session key in the current session.
static bool replayPopupMouseEvent
int lastIndexOf(QChar c, int from=-1, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
static QString fromLatin1(const char *, int size=-1)
Returns a QString initialized with the first size characters of the Latin-1 string str...
static void syncX()
Synchronizes with the X server in the X11 implementation.
QFont::StyleHint styleHint() const
Returns the style of the matched window system font.
static void changeKeyboard()
static bool sm_waitingForInteraction
static bool app_save_rootinfo
QTextCodec * qt_input_mapper
int x() const
Returns the x-coordinate of the rectangle's left edge.
static bool animate_toolbox
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 bool allowX11ColorNames
int length() const
This function is identical to count().
const_iterator ConstIterator
Qt-style synonym for QList::const_iterator.
The QPoint class defines a point in the plane using integer precision.
QString toLower() const Q_REQUIRED_RESULT
Returns a lowercase copy of the string.
static void setWheelScrollLines(int)
void setColor(ColorGroup cg, ColorRole cr, const QColor &color)
Sets the color in the specified color group, used for the given color role, to the specified solid co...
long unsigned int eventList[TOTAL_XINPUT_EVENTS]
T & last()
Returns a reference to the last item in the list.
The QHash::iterator class provides an STL-style non-const iterator for QHash and QMultiHash.
static int sm_interactStyle
void qt_desktopwidget_update_workarea()
int size() const
Returns the number of items in the list.
static Bool qt_sync_request_scanner(Display *, XEvent *event, XPointer arg)
Q_GUI_EXPORT void qt_removeX11EventFilter(QX11FilterFunction func)
RestartHint restartHint() const
Returns the application's current restart hint.
static bool desktopSettingsAware()
Returns true if Qt is set to use the system's standard colors, fonts, etc.
void setPressure(qreal pressure)
static int qt_x_errhandler(Display *dpy, XErrorEvent *err)
void setWidth(int w)
Sets the width of the rectangle to the given width.
int qstrncmp(const char *str1, const char *str2, uint len)
static int qt_xio_errhandler(Display *)
void setWeight(int)
Sets the weight the font to weight, which should be a value from the QFont::Weight enumeration...
QString objectName() const
int height() const
Returns the height.
if(void) toggleToolbarShown
The QRect class defines a rectangle in the plane using integer precision.
Q_GUI_EXPORT void qt_installX11EventFilter(QX11FilterFunction func)
#define XWACOM_PARAM_TOOLID
static QGraphicsSystem * graphics_system
static QDateTime currentDateTime()
Returns the current datetime, as reported by the system clock, in the local time zone.
bool isValid() const
Returns true if both the width and height is equal to or greater than 0; otherwise returns false...
static void qt_get_net_supported()
QSmSocketReceiver(int socket)
static short mouseGlobalXPos
iterator begin()
Returns an STL-style iterator pointing to the first item in the hash.
static bool translateBySips(QWidget *that, QRect &paintRect)
static QTextCodec * codecForName(const QByteArray &name)
Searches all installed QTextCodec objects and returns the one which best matches name; the match is c...
QString symLinkTarget() const
Returns the absolute path to the file or directory a symlink (or shortcut on Windows) points to...
static QSmSocketReceiver * sm_receiver
Bool(* PtrXRRQueryExtension)(Display *, int *, int *)
static void dispatchEnterLeave(QWidget *enter, QWidget *leave)
int size() const
Returns the number of bytes in this byte array.
void(* PtrWacomConfigTerm)(WACOMCONFIG *)
qreal & ry()
Returns a reference to the y coordinate of this point.
static void setSystemPalette(const QPalette &pal)
int y() const
Returns the y coordinate of this point.
void setLoadHints(LoadHints hints)
static void applyX11SpecificCommandLineArguments(QWidget *main_widget)
static QString styleOverride
#define QT_BEGIN_INCLUDE_NAMESPACE
This macro is equivalent to QT_END_NAMESPACE.
The TouchPoint class provides information about a touch point in a QTouchEvent.
static const char * x11_atomnames
static void setOverrideCursor(const QCursor &)
Use changeOverrideCursor(cursor) (if replace is true) or setOverrideCursor(cursor) (if replace is fal...
bool rawMode() const
Returns true if the font is a raw mode font; otherwise returns false.
static const char * mwGeometry
#define Q_FOREACH(variable, container)
Same as foreach(variable, container).
QKeyMapperPrivate * qt_keymapper_private()
int pointSize() const
Returns the point size of the font.
The QClipboardEvent class provides the parameters used in a clipboard event.
Q_GUI_EXPORT int qt_xfocusout_grab_counter
void qt_change_net_wm_state(const QWidget *w, bool set, Atom one, Atom two=0)
static QCoreApplication * self
bool isEmpty() const
Returns true if the byte array has size 0; otherwise returns false.
void setRawName(const QString &)
Sets a font by its system specific name.
The QSize class defines the size of a two-dimensional object using integer point precision.
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...
int qstrcmp(const QByteArray &str1, const char *str2)
static int(* original_x_errhandler)(Display *dpy, XErrorEvent *)
static void setDoubleClickInterval(int)
The QDataStream class provides serialization of binary data to a QIODevice.
static Qt::MouseButton mouseButtonPressed
static void getXDefault(const char *group, const char *key, int *val)
static const char * appBGCol
static bool qt_x11EventFilter(XEvent *ev)
int x() const
Returns the x coordinate of this point.
static void resetSmState()
bool isValid() const
Returns true if the color is valid; otherwise returns false.
unsigned int save_yourself_in_progress
The QTimer class provides repetitive and single-shot timers.
virtual bool x11FilterEvent(QWidget *keywidget, XEvent *event)
This function may be overridden only if input method is depending on X11 and you need raw XEvent...
virtual int x11ClientMessage(QWidget *, XEvent *, bool passive_only)
static void restoreOverrideCursor()
Undoes the last setOverrideCursor().
The QInputContext class abstracts the input method dependent data and composing state.
static bool testAttribute(Qt::ApplicationAttribute attribute)
Returns true if attribute attribute is set; otherwise returns false.
bool rawMode() const
Returns true if raw mode is used for font name matching; otherwise returns false. ...
qint64 write(const char *data, qint64 len)
Writes at most maxSize bytes of data from data to the device.
bool qt_xfixes_selection_changed(Window selectionOwner, Time timestamp)
static const char * appFGCol
Q_CORE_EXPORT int qstricmp(const char *, const char *)
double toDouble(bool *ok=0) const
Returns the byte array converted to a double value.
The QTextCodec class provides conversions between text encodings.
QColor lighter(int f=150) const
Returns a lighter (or darker) color, but does not change this object.
static Bool qt_tabletMotion_scanner(Display *, XEvent *event, XPointer arg)
bool endsWith(const QString &s, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Returns true if the string ends with s; otherwise returns false.
bool isSymLink() const
Returns true if this object points to a symbolic link (or to a shortcut on Windows); otherwise return...
The QFileInfo class provides system-independent file information.
static void sm_saveYourselfPhase2Callback(SmcConn smcConn, SmPointer clientData)
static void leaveModal_sys(QWidget *)
void translate(int dx, int dy)
Moves the rectangle dx along the x axis and dy along the y axis, relative to the current position...
static const KeyPair *const end
void requestPhase2()
Requests a second session management phase for the application.
static QWidget * qt_popup_down
static bool sendMouseEvent(QWidget *receiver, QMouseEvent *event, QWidget *alienWidget, QWidget *native, QWidget **buttonDown, QPointer< QWidget > &lastMouseReceiver, bool spontaneous=true)
void start(int msec)
Starts or restarts the timer with a timeout interval of msec milliseconds.
The QEvent class is the base class of all event classes.
#define qPrintable(string)
static int doubleClickInterval()
static int(* original_xio_errhandler)(Display *dpy)
bool runningUnderDebugger()
static QWidget * focusWidget()
Returns the application widget that has the keyboard input focus, or 0 if no widget in this applicati...
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
ushort green
Returns the green color component of this color.
static void qt_x11_create_intern_atoms()
void cancel()
Tells the session manager to cancel the shutdown process.
static QByteArray number(int, int base=10)
Returns a byte array containing the string equivalent of the number n to base base (10 by default)...
void(* PtrXRRSelectInput)(Display *, Window, int)
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...
iterator erase(iterator it)
Removes the (key, value) pair associated with the iterator pos from the hash, and returns an iterator...
The QLatin1Char class provides an 8-bit ASCII/Latin-1 character.
static float pointSize(const QFontDef &fd, int dpi)
bool exactMatch() const
Returns true if a window system font exactly matching the settings of this font is available...
int exec(ProcessEventsFlags flags=AllEvents)
Enters the main event loop and waits until exit() is called.
The QFocusEvent class contains event parameters for widget focus events.
static void setGlobalStrut(const QSize &)
Q_DECL_CONSTEXPR int qRound(qreal d)
void clear()
Clears the contents of the byte array and makes it empty.
static void setCodecForTr(QTextCodec *c)
static void setEffectEnabled(Qt::UIEffect, bool enable=true)
Enables the UI effect effect if enable is true, otherwise the effect will not be used.
Window findClientWindow(Window, Atom, bool)
virtual const QMetaObject * metaObject() const
Returns a pointer to the meta-object of this object.
static Display * display()
Returns the default display for the application.
static void enterWhatsThisMode()
This function switches the user interface into "What's This?" mode.
void openPopup(QWidget *popup)
static Qt::MouseButtons mouse_buttons
static bool isNull(const QVariant::Private *d)
int open(const char *, int,...)
virtual bool filterEvent(const QEvent *event)
This function can be reimplemented in a subclass to filter input events.
static QPoint pos()
Returns the position of the cursor (hot spot) in global screen coordinates.
int screen() const
Returns the number of the screen currently in use.
Cursor(* PtrXcursorLibraryLoadCursor)(Display *, const char *)
The QLibrary class loads shared libraries at runtime.
static void sm_saveCompleteCallback(SmcConn smcConn, SmPointer clientData)
int socket() const
Returns the socket identifier specified to the constructor.
QBool contains(char c) const
Returns true if the byte array contains the character ch; otherwise returns false.
static Window pressed_window
The QList class is a template class that provides lists.
void qPRCreate(const QWidget *widget, Window oldwin)
const_iterator constEnd() const
Returns a const STL-style iterator pointing to the imaginary item after the last item in the list...
static int cursor_flash_time
QPalette resolve(const QPalette &) const
Returns a new QPalette that has attributes copied from other.
QPoint topLeft() const
Returns the position of the rectangle's top-left corner.
QString family() const
Returns the family name of the matched window system font.
int removeAll(const T &t)
Removes all occurrences of value in the list and returns the number of entries removed.
#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...
static PtrWacomConfigOpenDevice ptrWacomConfigOpenDevice
void qt_net_remove_user_time(QWidget *tlw)
The QPalette class contains color groups for each widget state.
static int appDpiY(int screen=-1)
Returns the vertical resolution of the given screen in terms of the number of dots per inch...