9#include <QtCore/QFileInfo>
11#include <QtGui/QRegion>
12#include <QtGui/private/qhighdpiscaling_p.h>
17#if QT_CONFIG(draganddrop)
27#include <qpa/qplatformintegration.h>
28#include <qpa/qplatformcursor.h>
32#include <xcb/xcb_icccm.h>
33#include <xcb/xfixes.h>
35#include <xcb/xinput.h>
37#include <private/qguiapplication_p.h>
38#include <private/qwindow_p.h>
40#include <qpa/qplatformbackingstore.h>
41#include <qpa/qwindowsysteminterface.h>
45#if QT_CONFIG(xcb_xlib)
52#define XCOORD_MAX 32767
132 qWarning(
"Using RGB32 fallback, if this works your X11 server is reporting a bad screen format.");
136 qWarning(
"Using RGB16 fallback, if this works your X11 server is reporting a bad screen format.");
144#if QT_CONFIG(xcb_xlib)
145static inline XTextProperty* qstringToXTP(
Display *dpy,
const QString&
s)
147 #include <X11/Xatom.h>
149 static XTextProperty tp = {
nullptr, 0, 0, 0 };
150 static bool free_prop =
true;
164 errCode = XmbTextListToTextProperty(dpy, tl, 1, XStdICCTextStyle, &tp);
166 qCDebug(lcQpaXcb,
"XmbTextListToTextProperty result code %d", errCode);
171 tp.value = (
uchar*)qcs.data();
172 tp.encoding = XA_STRING;
174 tp.nitems = qcs.size();
185 if (
obj->isWindowType()) {
187 if (childWin->isVisible()) {
193 if (!
win->isTopLevel()
212 = XCB_EVENT_MASK_EXPOSURE | XCB_EVENT_MASK_STRUCTURE_NOTIFY
213 | XCB_EVENT_MASK_PROPERTY_CHANGE | XCB_EVENT_MASK_FOCUS_CHANGE,
216 | XCB_EVENT_MASK_KEY_PRESS | XCB_EVENT_MASK_KEY_RELEASE
217 | XCB_EVENT_MASK_BUTTON_PRESS | XCB_EVENT_MASK_BUTTON_RELEASE
218 | XCB_EVENT_MASK_BUTTON_MOTION | XCB_EVENT_MASK_ENTER_WINDOW | XCB_EVENT_MASK_LEAVE_WINDOW
219 | XCB_EVENT_MASK_POINTER_MOTION,
222 | XCB_EVENT_MASK_VISIBILITY_CHANGE
223 | XCB_EVENT_MASK_SUBSTRUCTURE_REDIRECT
224 | XCB_EVENT_MASK_COLOR_MAP_CHANGE | XCB_EVENT_MASK_OWNER_GRAB_BUTTON
229 xcb_window_t old_m_window =
m_window;
247 const xcb_visualtype_t *visual =
nullptr;
253 qWarning(
"Could not use default visual id. Falling back to root_visual for screen.");
263 if (
rect.width() > 0 ||
rect.height() > 0) {
266 }
else if (minimumSize.
width() > 0 || minimumSize.
height() > 0) {
267 rect.setSize(minimumSize);
275 if (platformScreen != currentScreen)
278 xcb_window_t xcb_parent_id = platformScreen->
root();
285 window()->setFormat(parentFormat);
291 const xcb_visualtype_t *visual =
nullptr;
295 }
else if (
connection()->hasDefaultVisualId()) {
298 qWarning() <<
"Failed to use requested visual id.";
318 qWarning() <<
"Falling back to using screens root_visual.";
329 | XCB_CW_BORDER_PIXEL
331 | XCB_CW_OVERRIDE_REDIRECT
337 XCB_BACK_PIXMAP_NONE,
338 platformScreen->
screen()->black_pixel,
339 XCB_GRAVITY_NORTH_WEST,
356 XCB_WINDOW_CLASS_INPUT_OUTPUT,
366 int propertyCount = 0;
378 XCB_PROP_MODE_REPLACE,
402 if (domainName.isEmpty()) {
403 desktopFileName = fi.baseName();
405 for (
int i = 0;
i < domainName.size(); ++
i)
407 desktopFileName.
append(fi.baseName());
410 if (!desktopFileName.
isEmpty()) {
425 XCB_PROP_MODE_REPLACE,
441 if (!clientMachine.isEmpty()) {
444 clientMachine.size(), clientMachine.constData());
449 xcb_icccm_wm_hints_t hints;
450 memset(&hints, 0,
sizeof(hints));
451 hints.flags = XCB_ICCCM_WM_HINT_WINDOW_GROUP;
465 32, 2, (
void *)
data);
477#if QT_CONFIG(draganddrop)
487 if (
window()->isTopLevel())
502 for (
auto transientChild : transientChildren) {
504 transientChild->updateWmTransientFor();
588 if (newScreen != currentScreen)
592 const quint32 mask = XCB_CONFIG_WINDOW_WIDTH | XCB_CONFIG_WINDOW_HEIGHT;
599 const quint32 mask = XCB_CONFIG_WINDOW_X | XCB_CONFIG_WINDOW_Y | XCB_CONFIG_WINDOW_WIDTH | XCB_CONFIG_WINDOW_HEIGHT;
627 if (
reply &&
reply->type == XCB_ATOM_CARDINAL &&
reply->format == 32 &&
reply->value_len == 4) {
641 bool foundRoot =
false;
643 const QList<xcb_window_t> &virtualRoots =
681 int top =
offset.y() + geom->border_width;
704 xcb_window_t transientXcbParent = XCB_NONE;
707 if (tp && tp->handle()) {
709 transientXcbParent = tp->handle()->
winId();
710 if (transientXcbParent) {
711 handle->registerWmTransientForChild(
this);
712 qCDebug(lcQpaXcbWindow) << Q_FUNC_INFO << static_cast<QPlatformWindow *>(
handle)
713 <<
" registerWmTransientForChild " <<
static_cast<QPlatformWindow *
>(
this);
718 if (!transientXcbParent)
720 if (transientXcbParent) {
722 XCB_ATOM_WM_TRANSIENT_FOR, XCB_ATOM_WINDOW, 32,
723 1, &transientXcbParent);
724 qCDebug(lcQpaXcbWindow,
"0x%x added XCB_ATOM_WM_TRANSIENT_FOR 0x%x",
m_window, transientXcbParent);
727 if (!transientXcbParent)
742 if (
window()->isTopLevel()) {
760 const auto showWithoutActivating =
window()->
property(
"_q_showWithoutActivating");
761 if (showWithoutActivating.isValid() && showWithoutActivating.toBool())
784 q_padded_xcb_event<xcb_unmap_notify_event_t>
event = {};
785 event.response_type = XCB_UNMAP_NOTIFY;
788 event.from_configure =
false;
790 XCB_EVENT_MASK_SUBSTRUCTURE_NOTIFY | XCB_EVENT_MASK_SUBSTRUCTURE_REDIRECT, (
const char *)&
event);
811 if (
window()->isModal()) {
818 QWindow *enterWindow =
nullptr;
828 if (enterWindow && enterWindow !=
window()) {
831 enterWindow = childWindow;
832 const QPoint localPos = enterWindow->mapFromGlobal(cursorPos);
844 while (
w &&
w->parent())
847 QWindow *modalWindow =
nullptr;
849 if (blocked && modalWindow !=
w) {
850 modalWindow->requestActivate();
908 XCB_ATOM_ATOM, 0, 1024);
911 const xcb_atom_t *
states =
static_cast<const xcb_atom_t *
>(xcb_get_property_value(
reply.get()));
912 const xcb_atom_t *statesEnd =
states +
reply->length;
953 const quint32 mask = XCB_CW_OVERRIDE_REDIRECT | XCB_CW_EVENT_MASK;
982 memset(&mwmhints, 0,
sizeof(mwmhints));
990 if (!(
flags & defaultFlags))
991 flags |= defaultFlags;
1019 if (mwmhints.functions != 0) {
1037 mwmhints.decorations = 0;
1040 if (mwmhints.flags) {
1042 XCB_PROP_MODE_REPLACE,
1056 xcb_client_message_event_t
event;
1058 event.response_type = XCB_CLIENT_MESSAGE;
1063 event.data.data32[0] =
set ? 1 : 0;
1064 event.data.data32[1] = one;
1065 event.data.data32[2] = two;
1066 event.data.data32[3] = 0;
1067 event.data.data32[4] = 0;
1070 XCB_EVENT_MASK_STRUCTURE_NOTIFY | XCB_EVENT_MASK_SUBSTRUCTURE_REDIRECT,
1071 (
const char *)&
event);
1097 qCDebug(lcQpaXcb()) <<
"internal info: " <<
Q_FUNC_INFO <<
"called on mapped window";
1130 QList<xcb_atom_t> atoms;
1133 XCB_ATOM_ATOM, 0, 1024);
1135 const xcb_atom_t *
data =
static_cast<const xcb_atom_t *
>(xcb_get_property_value(
reply.get()));
1136 atoms.resize(
reply->value_len);
1137 memcpy((
void *)&atoms.first(), (
void *)
data,
reply->value_len *
sizeof(xcb_atom_t));
1159 if (atoms.isEmpty()) {
1164 atoms.size(), atoms.constData());
1190 xcb_client_message_event_t
event;
1192 event.response_type = XCB_CLIENT_MESSAGE;
1197 event.data.data32[0] = XCB_ICCCM_WM_STATE_ICONIC;
1198 event.data.data32[1] = 0;
1199 event.data.data32[2] = 0;
1200 event.data.data32[3] = 0;
1201 event.data.data32[4] = 0;
1204 XCB_EVENT_MASK_STRUCTURE_NOTIFY | XCB_EVENT_MASK_SUBSTRUCTURE_REDIRECT,
1205 (
const char *)&
event);
1214 xcb_icccm_wm_hints_t hints;
1215 if (xcb_icccm_get_wm_hints_reply(
xcb_connection(), cookie, &hints,
nullptr)) {
1217 xcb_icccm_wm_hints_set_iconic(&hints);
1219 xcb_icccm_wm_hints_set_normal(&hints);
1241 XCB_COPY_FROM_PARENT,
1246 XCB_WINDOW_CLASS_INPUT_OUTPUT,
1258 }
else if (!isSupportedByWM) {
1269 XCB_ATOM_CARDINAL, 32, 1, ×tamp);
1277 xcb_rectangle_t rectangle;
1279 xcb_rectangle_t *
rect =
nullptr;
1285 rectangle.width =
geometry().width();
1286 rectangle.height =
geometry().height();
1293 xcb_xfixes_set_window_shape_region_checked(
xcb_connection(),
m_window, XCB_SHAPE_SK_INPUT, 0, 0, region);
1303 xcb_icccm_wm_hints_t hints;
1304 if (!xcb_icccm_get_wm_hints_reply(
xcb_connection(), cookie, &hints,
nullptr))
1307 xcb_icccm_wm_hints_set_input(&hints, !doesNotAcceptFocus);
1320 xcb_window_t xcb_parent_id;
1341 XCB_PROP_MODE_REPLACE,
1352 QList<quint32> icon_data;
1355 if (availableSizes.isEmpty()) {
1357 availableSizes.push_back(
QSize(16,16));
1358 availableSizes.push_back(
QSize(32,32));
1359 availableSizes.push_back(
QSize(64,64));
1360 availableSizes.push_back(
QSize(128,128));
1362 for (
int i = 0;
i < availableSizes.size(); ++
i) {
1367 int pos = icon_data.size();
1376 if (!icon_data.isEmpty()) {
1379 qWarning() <<
"Ignoring window icon" << icon_data.size()
1380 <<
"exceeds maximum xcb request length"
1385 XCB_PROP_MODE_REPLACE,
1391 (
unsigned char *) icon_data.data());
1401 const quint32 mask = XCB_CONFIG_WINDOW_STACK_MODE;
1408 const quint32 mask = XCB_CONFIG_WINDOW_STACK_MODE;
1416 xcb_size_hints_t hints;
1417 memset(&hints, 0,
sizeof(hints));
1422 if (!
win->positionAutomatic)
1423 xcb_icccm_size_hints_set_position(&hints,
true,
rect.x(),
rect.y());
1425 xcb_icccm_size_hints_set_size(&hints,
true,
rect.width(),
rect.height());
1432 ? XCB_GRAVITY_NORTH_WEST : XCB_GRAVITY_STATIC;
1434 xcb_icccm_size_hints_set_win_gravity(&hints, gravity);
1441 if (minimumSize.
width() > 0 || minimumSize.
height() > 0)
1442 xcb_icccm_size_hints_set_min_size(&hints,
1447 xcb_icccm_size_hints_set_max_size(&hints,
1451 if (sizeIncrement.
width() > 0 || sizeIncrement.
height() > 0) {
1453 xcb_icccm_size_hints_set_base_size(&hints, baseSize.
width(), baseSize.
height());
1454 xcb_icccm_size_hints_set_resize_inc(&hints, sizeIncrement.
width(), sizeIncrement.
height());
1482 xcb_window_t current = XCB_NONE;
1485 current = pw->winId();
1488 if (
window()->isTopLevel()
1492 xcb_client_message_event_t
event;
1494 event.response_type = XCB_CLIENT_MESSAGE;
1499 event.data.data32[0] = 1;
1501 event.data.data32[2] = current;
1502 event.data.data32[3] = 0;
1503 event.data.data32[4] = 0;
1506 XCB_EVENT_MASK_STRUCTURE_NOTIFY | XCB_EVENT_MASK_SUBSTRUCTURE_REDIRECT,
1507 (
const char *)&
event);
1526 XCB_ATOM_ATOM, 0, 1024);
1528 const xcb_atom_t *
types =
static_cast<const xcb_atom_t *
>(xcb_get_property_value(
reply.get()));
1529 const xcb_atom_t *types_end =
types +
reply->length;
1534 result |= WindowType::Normal;
1537 result |= WindowType::Desktop;
1540 result |= WindowType::Dock;
1543 result |= WindowType::Toolbar;
1546 result |= WindowType::Menu;
1549 result |= WindowType::Utility;
1552 result |= WindowType::Splash;
1555 result |= WindowType::Dialog;
1558 result |= WindowType::DropDownMenu;
1561 result |= WindowType::PopupMenu;
1564 result |= WindowType::Tooltip;
1567 result |= WindowType::Notification;
1570 result |= WindowType::Combo;
1573 result |= WindowType::Dnd;
1576 result |= WindowType::KdeOverride;
1588 QList<xcb_atom_t> atoms;
1591 if (
types & WindowType::Normal)
1593 if (
types & WindowType::Desktop)
1595 if (
types & WindowType::Dock)
1597 if (
types & WindowType::Notification)
1601 if (
types & WindowType::Utility)
1603 if (
types & WindowType::Splash)
1605 if (
types & WindowType::Dialog)
1607 if (
types & WindowType::Tooltip)
1609 if (
types & WindowType::KdeOverride)
1615 if (
types & WindowType::Menu)
1617 if (
types & WindowType::DropDownMenu)
1619 if (
types & WindowType::PopupMenu)
1621 if (
types & WindowType::Toolbar)
1623 if (
types & WindowType::Combo)
1625 if (
types & WindowType::Dnd)
1633 if (!(
types & WindowType::Dialog))
1638 if (!(
types & WindowType::Utility))
1642 if (!(
types & WindowType::Tooltip))
1646 if (!(
types & WindowType::Splash))
1663 if (atoms.isEmpty()) {
1668 atoms.size(), atoms.constData());
1684 const quint32 values[] = { XCB_BACK_PIXMAP_PARENT_RELATIVE };
1712 if (
type != XCB_EXPOSE)
1714 auto expose =
reinterpret_cast<xcb_expose_event_t *
>(
event);
1717 if (expose->count == 0)
1733 if (
event->format != 32)
1737 xcb_atom_t protocolAtom =
event->data.data32[0];
1750 reply.response_type = XCB_CLIENT_MESSAGE;
1754 XCB_EVENT_MASK_STRUCTURE_NOTIFY | XCB_EVENT_MASK_SUBSTRUCTURE_REDIRECT,
1755 (
const char *)&
reply);
1763#ifndef QT_NO_WHATSTHIS
1765 QWindowSystemInterface::handleEnterWhatsThisEvent();
1768 qCWarning(lcQpaXcb,
"Unhandled WM_PROTOCOLS (%s)",
1769 connection()->atomName(protocolAtom).constData());
1771#if QT_CONFIG(draganddrop)
1896 if (deferredActivation)
1914 int detail, Qt::KeyboardModifiers
modifiers, xcb_timestamp_t timestamp,
1923 w->requestActivate();
1937 QPoint local(event_x, event_y);
1944 angleDelta.
setY(120);
1946 angleDelta.
setY(-120);
1948 angleDelta.
setX(120);
1950 angleDelta.
setX(-120);
1964 int detail, Qt::KeyboardModifiers
modifiers, xcb_timestamp_t timestamp,
1967 QPoint local(event_x, event_y);
1993 return mouseButtonsPressed || conn->
hasXInput2();
2001 &&
mode == XCB_NOTIFY_MODE_GRAB &&
detail == XCB_NOTIFY_DETAIL_ANCESTOR)
2002 || (
mode == XCB_NOTIFY_MODE_UNGRAB &&
detail == XCB_NOTIFY_DETAIL_INFERIOR)
2003 ||
detail == XCB_NOTIFY_DETAIL_VIRTUAL
2004 ||
detail == XCB_NOTIFY_DETAIL_NONLINEAR_VIRTUAL);
2010 &&
mode == XCB_NOTIFY_MODE_UNGRAB &&
detail == XCB_NOTIFY_DETAIL_ANCESTOR)
2011 || (
mode != XCB_NOTIFY_MODE_NORMAL &&
mode != XCB_NOTIFY_MODE_UNGRAB)
2012 ||
detail == XCB_NOTIFY_DETAIL_VIRTUAL
2013 ||
detail == XCB_NOTIFY_DETAIL_NONLINEAR_VIRTUAL);
2033 const QPoint local(event_x, event_y);
2050 if (
type != XCB_ENTER_NOTIFY)
2052 auto enter =
reinterpret_cast<xcb_enter_notify_event_t *
>(
event);
2055 auto enter =
reinterpret_cast<xcb_enter_notify_event_t *
>(
event);
2059 QPoint local(enter->event_x, enter->event_y);
2072 Qt::KeyboardModifiers
modifiers, xcb_timestamp_t timestamp,
2075 QPoint local(event_x, event_y);
2082 if (isMouseButtonPressed && !hasMousePressWindow)
2084 else if (hasMousePressWindow && !isMouseButtonPressed)
2116#define qt_xcb_mask_is_set(ptr, event) (((unsigned char*)(ptr))[(event)>>3] & (1 << ((event) & 7)))
2121 auto *ev =
reinterpret_cast<xcb_input_button_press_event_t *
>(
event);
2123 if (ev->buttons_len > 0) {
2124 unsigned char *buttonMask = (
unsigned char *) &ev[1];
2130 if (
Q_UNLIKELY(lcQpaXInputEvents().isDebugEnabled()))
2131 qCDebug(lcQpaXInput,
"XI2 mouse event from touch device %d was ignored", ev->sourceid);
2134 for (
int i = 1;
i <= 15; ++
i)
2148 const char *sourceName =
nullptr;
2149 if (
Q_UNLIKELY(lcQpaXInputEvents().isDebugEnabled())) {
2155 switch (ev->event_type) {
2156 case XCB_INPUT_BUTTON_PRESS:
2157 if (
Q_UNLIKELY(lcQpaXInputEvents().isDebugEnabled()))
2158 qCDebug(lcQpaXInputEvents,
"XI2 mouse press, button %d, time %d, source %s",
button, ev->time, sourceName);
2162 case XCB_INPUT_BUTTON_RELEASE:
2163 if (
Q_UNLIKELY(lcQpaXInputEvents().isDebugEnabled()))
2164 qCDebug(lcQpaXInputEvents,
"XI2 mouse release, button %d, time %d, source %s",
button, ev->time, sourceName);
2168 case XCB_INPUT_MOTION:
2169 if (
Q_UNLIKELY(lcQpaXInputEvents().isDebugEnabled()))
2170 qCDebug(lcQpaXInputEvents,
"XI2 mouse motion %d,%d, time %d, source %s", event_x, event_y, ev->time, sourceName);
2174 qWarning() <<
"Unrecognized XI2 mouse event" << ev->event_type;
2181 auto *ev =
reinterpret_cast<xcb_input_enter_event_t *
>(
event);
2186 if (mouseGrabber && mouseGrabber !=
this
2194 switch (ev->event_type) {
2195 case XCB_INPUT_ENTER: {
2198 qCDebug(lcQpaXInputEvents,
"XI2 mouse enter %d,%d, mode %d, detail %d, time %d",
2199 event_x, event_y, ev->mode, ev->detail, ev->time);
2203 case XCB_INPUT_LEAVE:
2204 qCDebug(lcQpaXInputEvents,
"XI2 mouse leave, mode %d, detail %d, time %d",
2205 ev->mode, ev->detail, ev->time);
2240 const bool propertyDeleted =
event->state == XCB_PROPERTY_DELETE;
2243 if (propertyDeleted)
2251 XCB_ATOM_ANY, 0, 1024);
2254 if (
reply->length != 0)
2291 if (
event->detail == XCB_NOTIFY_DETAIL_POINTER)
2303 if (
event->detail == XCB_NOTIFY_DETAIL_POINTER)
2342 XCB_GRAB_MODE_ASYNC, XCB_GRAB_MODE_ASYNC);
2343 return reply &&
reply->status == XCB_GRAB_STATUS_SUCCESS;
2348 if (!grab &&
connection()->mouseGrabber() ==
this)
2368 (XCB_EVENT_MASK_BUTTON_PRESS | XCB_EVENT_MASK_BUTTON_RELEASE
2369 | XCB_EVENT_MASK_BUTTON_MOTION | XCB_EVENT_MASK_ENTER_WINDOW
2370 | XCB_EVENT_MASK_LEAVE_WINDOW | XCB_EVENT_MASK_POINTER_MOTION),
2371 XCB_GRAB_MODE_ASYNC, XCB_GRAB_MODE_ASYNC,
2372 XCB_WINDOW_NONE, XCB_CURSOR_NONE,
2373 XCB_TIME_CURRENT_TIME);
2382 switch (
event->type()) {
2386 switch (focusEvent->
reason()) {
2422 if (!
connection()->wmSupport()->isSupportedByWM(moveResize))
2427 if (startedByTouch) {
2429 if (wmname !=
"kwin"_L1 && wmname !=
"openbox"_L1) {
2430 qCDebug(lcQpaXInputDevices) <<
"only KDE and OpenBox support startSystemMove/Resize which is triggered from touch events: XDG_CURRENT_DESKTOP="
2431 <<
qgetenv(
"XDG_CURRENT_DESKTOP");
2462 qWarning() <<
"Cannot convert " << edges <<
"to _NET_WM_MOVERESIZE direction.";
2468 qCDebug(lcQpaXInputDevices) <<
"triggered system move or resize via sending _NET_WM_MOVERESIZE client message";
2470 xcb_client_message_event_t xev;
2471 xev.response_type = XCB_CLIENT_MESSAGE;
2472 xev.type = moveResize;
2476 xev.data.data32[0] = globalPos.
x();
2477 xev.data.data32[1] = globalPos.
y();
2479 xev.data.data32[2] = 8;
2482 xev.data.data32[3] = XCB_BUTTON_INDEX_1;
2483 xev.data.data32[4] = 0;
2486 XCB_EVENT_MASK_SUBSTRUCTURE_REDIRECT | XCB_EVENT_MASK_SUBSTRUCTURE_NOTIFY,
2487 (
const char *)&xev);
2496 xcb_client_message_event_t
event;
2498 event.response_type = XCB_CLIENT_MESSAGE;
2504 event.data.data32[1] =
message;
2505 event.data.data32[2] =
detail;
2506 event.data.data32[3] = data1;
2507 event.data.data32[4] = data2;
2525 switch (
event->data.data32[1]) {
2536 switch (
event->data.data32[2]) {
2579 XCB_PROP_MODE_REPLACE,
2590 QList<xcb_rectangle_t> rects;
2592 for (
const QRect &
r : region)
2603 XCB_SHAPE_SK_BOUNDING,
xcb_window(), 0, 0, XCB_NONE);
2607 XCB_SHAPE_SK_BOUNDING, XCB_CLIP_ORDERING_UNSORTED,
2608 xcb_window(), 0, 0, rects.size(), &rects[0]);
2651 XCB_PROP_MODE_REPLACE,
2659#if QT_CONFIG(xcb_xlib)
2660 Display *dpy =
static_cast<Display *
>(conn->xlib_display());
2661 XTextProperty *
text = qstringToXTP(dpy,
title);
2675 const char *
name =
reinterpret_cast<const char *
>(xcb_get_property_value(
reply.get()));
2681 XCB_ATOM_STRING, 0, 1024);
2683 const char *
name =
reinterpret_cast<const char *
>(xcb_get_property_value(
reply.get()));
qsizetype size() const noexcept
Returns the number of bytes in this byte array.
const char * constData() const noexcept
Returns a pointer to the const data stored in the byte array.
bool isEmpty() const noexcept
Returns true if the byte array has size 0; otherwise returns false.
static QCoreApplication * instance() noexcept
Returns a pointer to the application's QCoreApplication (or QGuiApplication/QApplication) instance.
static void postEvent(QObject *receiver, QEvent *event, int priority=Qt::NormalEventPriority)
Type
This enum type defines the valid event types in Qt.
The QFocusEvent class contains event parameters for widget focus events.
Qt::FocusReason reason() const
Returns the reason for this focus event.
static QGuiApplicationPrivate * instance()
static QWindow * currentMouseWindow
static QWindow * modalWindow()
Returns the most recently shown modal window.
static QWindow * focusWindow()
Returns the QWindow that receives events tied to focus, such as key events.
QString desktopFileName
the base name of the desktop entry for this application
static qreal factor(C *context)
The QIcon class provides scalable icons in different modes and states.
bool isNull() const
Returns true if the icon is empty; otherwise returns false.
QList< QSize > availableSizes(Mode mode=Normal, State state=Off) const
QPixmap pixmap(const QSize &size, Mode mode=Normal, State state=Off) const
Returns a pixmap with the requested size, mode, and state, generating one if necessary.
bool isEmpty() const noexcept
void append(parameter_type t)
void unlock() noexcept
Unlocks the mutex.
void lock() noexcept
Locks the mutex.
static QObjectPrivate * get(QObject *o)
const QObjectList & children() const
Returns a list of child objects.
QObject * parent() const
Returns a pointer to the parent object.
QList< QByteArray > dynamicPropertyNames() const
QVariant property(const char *name) const
Returns the value of the object's name property.
Returns a copy of the pixmap that is transformed using the given transformation transform and transfo...
\inmodule QtCore\reentrant
constexpr QPoint transposed() const noexcept
constexpr int x() const noexcept
Returns the x coordinate of this point.
constexpr void setY(int y) noexcept
Sets the y coordinate of this point to the given y coordinate.
constexpr int y() const noexcept
Returns the y coordinate of this point.
constexpr void setX(int x) noexcept
Sets the x coordinate of this point to the given x coordinate.
\inmodule QtCore\reentrant
bool contains(const QRect &r, bool proper=false) const noexcept
This is an overloaded member function, provided for convenience. It differs from the above function o...
The QRegion class specifies a clip region for a painter.
int rectCount() const noexcept
bool isEmpty() const
Returns true if the region is empty; otherwise returns false.
The QScreen class is used to query screen properties. \inmodule QtGui.
constexpr int height() const noexcept
Returns the height.
constexpr int width() const noexcept
Returns the width.
constexpr bool isNull() const noexcept
Returns true if both the width and height is 0; otherwise returns false.
constexpr bool isEmpty() const noexcept
Returns true if either of the width and height is less than or equal to 0; otherwise returns false.
constexpr bool isValid() const noexcept
Returns true if both the width and height is equal to or greater than 0; otherwise returns false.
\macro QT_RESTRICTED_CAST_FROM_ASCII
QByteArray toLatin1() const &
static QString fromLatin1(QByteArrayView ba)
This is an overloaded member function, provided for convenience. It differs from the above function o...
bool isEmpty() const noexcept
Returns true if the string has no characters; otherwise returns false.
static QString fromUtf8(QByteArrayView utf8)
This is an overloaded member function, provided for convenience. It differs from the above function o...
QString & append(QChar c)
QByteArray toUtf8() const &
QString & prepend(QChar c)
static QString machineHostName()
void start(int msec)
Starts or restarts the timer with a timeout interval of msec milliseconds.
void stop()
Stops the timer.
QByteArray toByteArray() const
Returns the variant as a QByteArray if the variant has userType() \l QMetaType::QByteArray or \l QMet...
QPointer< QWindow > focused
static WindowSystemEvent * peekWindowSystemEvent(EventType t)
static bool handleNativeEvent(QWindow *window, const QByteArray &eventType, void *message, qintptr *result)
Passes a native event identified by eventType to the window.
static void handleWindowScreenChanged(QWindow *window, QScreen *newScreen)
static void handleLeaveEvent(QWindow *window)
static void handleFocusWindowChanged(QWindow *window, Qt::FocusReason r=Qt::OtherFocusReason)
static bool handleMouseEvent(QWindow *window, const QPointF &local, const QPointF &global, Qt::MouseButtons state, Qt::MouseButton button, QEvent::Type type, Qt::KeyboardModifiers mods=Qt::NoModifier, Qt::MouseEventSource source=Qt::MouseEventNotSynthesized)
static bool handleCloseEvent(QWindow *window)
static void handleGeometryChange(QWindow *window, const QRect &newRect)
static void handleEnterLeaveEvent(QWindow *enter, QWindow *leave, const QPointF &local=QPointF(), const QPointF &global=QPointF())
This method can be used to ensure leave and enter events are both in queue when moving from one QWind...
static bool handleExposeEvent(QWindow *window, const QRegion ®ion)
static void handleEnterEvent(QWindow *window, const QPointF &local=QPointF(), const QPointF &global=QPointF())
static bool handleWheelEvent(QWindow *window, const QPointF &local, const QPointF &global, QPoint pixelDelta, QPoint angleDelta, Qt::KeyboardModifiers mods=Qt::NoModifier, Qt::ScrollPhase phase=Qt::NoScrollPhase, Qt::MouseEventSource source=Qt::MouseEventNotSynthesized)
static void handleWindowStateChanged(QWindow *window, Qt::WindowStates newState, int oldState=-1)
Qt::WindowFlags flags
the window flags of the window
@ Atom_NET_WM_STATE_MAXIMIZED_HORZ
@ Atom_NET_WM_WINDOW_TYPE_DROPDOWN_MENU
@ Atom_NET_WM_WINDOW_TYPE_COMBO
@ Atom_COMPIZ_DECOR_DELETE_PIXMAP
@ Atom_NET_WM_WINDOW_TYPE_MENU
@ Atom_KDE_NET_WM_DESKTOP_FILE
@ Atom_NET_WM_WINDOW_TYPE
@ Atom_COMPIZ_DECOR_PENDING
@ Atom_NET_WM_WINDOW_TYPE_DOCK
@ Atom_GTK_LOAD_ICONTHEMES
@ Atom_NET_WM_WINDOW_TYPE_POPUP_MENU
@ Atom_NET_WM_STATE_HIDDEN
@ Atom_GTK_APPLICATION_ID
@ Atom_NET_WM_WINDOW_TYPE_UTILITY
@ Atom_NET_WM_WINDOW_TYPE_DND
@ Atom_NET_WM_STATE_BELOW
@ Atom_NET_WM_WINDOW_TYPE_DIALOG
@ Atom_NET_WM_STATE_MAXIMIZED_VERT
@ Atom_KDE_NET_WM_WINDOW_TYPE_OVERRIDE
@ Atom_NET_WM_SYNC_REQUEST
@ Atom_NET_WM_STATE_MODAL
@ Atom_NET_WM_SYNC_REQUEST_COUNTER
@ Atom_NET_WM_WINDOW_OPACITY
@ Atom_NET_WM_STATE_STAYS_ON_TOP
@ Atom_NET_WM_WINDOW_TYPE_TOOLBAR
@ Atom_NET_WM_STATE_ABOVE
@ Atom_COMPIZ_DECOR_REQUEST
@ Atom_NET_WM_WINDOW_TYPE_TOOLTIP
@ Atom_NET_WM_WINDOW_TYPE_SPLASH
@ Atom_NET_WM_STATE_FULLSCREEN
@ Atom_NET_WM_STATE_DEMANDS_ATTENTION
@ Atom_NET_WM_WINDOW_TYPE_NORMAL
@ Atom_NET_WM_CONTEXT_HELP
@ Atom_NET_WM_USER_TIME_WINDOW
@ Atom_COMPIZ_TOOLKIT_ACTION
@ Atom_NET_WM_WINDOW_TYPE_DESKTOP
@ Atom_NET_WM_WINDOW_TYPE_NOTIFICATION
QXcbAtom::Atom qatom(xcb_atom_t atom) const
QByteArray atomName(xcb_atom_t atom)
xcb_connection_t * xcb_connection() const
xcb_atom_t atom(QXcbAtom::Atom qatom) const
void setMousePressWindow(QXcbWindow *)
Qt::MouseButton translateMouseButton(xcb_button_t s)
QXcbKeyboard * keyboard() const
QXcbWindow * mouseGrabber() const
QXcbWindow * mousePressWindow() const
Qt::MouseButtons buttonState() const
void setMouseGrabber(QXcbWindow *)
void setTime(xcb_timestamp_t t)
void setButtonState(Qt::MouseButton button, bool down)
QString windowManagerName() const
xcb_visualid_t defaultVisualId() const
bool isTouchScreen(int id)
void setNetWmUserTime(xcb_timestamp_t t)
void xi2UpdateScrollingDevices()
xcb_timestamp_t time() const
bool startSystemMoveResizeForTouch(xcb_window_t window, int edges)
QXcbWMSupport * wmSupport() const
void setFocusWindow(QWindow *)
void abortSystemMoveResize(xcb_window_t window)
QXcbEventQueue * eventQueue() const
xcb_window_t clientLeader()
void setDuringSystemMoveResize(bool during)
void xi2SelectDeviceEvents(xcb_window_t window)
Qt::MouseButton xiToQtMouseButton(uint32_t b)
Qt::MouseButton button() const
QXcbNativeInterface * nativeInterface() const
QXcbWindow * platformWindowFromId(xcb_window_t id)
bool xi2SetMouseGrabEnabled(xcb_window_t w, bool grab)
void addWindowEventListener(xcb_window_t id, QXcbWindowEventListener *eventListener)
QXcbSystemTrayTracker * systemTrayTracker() const
void removeWindowEventListener(xcb_window_t id)
@ PeekConsumeMatchAndContinue
xcb_generic_event_t * peek(Peeker &&peeker)
QXcbForeignWindow(QWindow *window, WId nativeHandle)
static QXcbIntegration * instance()
Qt::KeyboardModifiers translateModifiers(int s) const
void updateXKBStateFromXI(void *modInfo, void *groupInfo)
const QByteArray & nativeEventType() const
QXcbConnection * connection() const
xcb_connection_t * xcb_connection() const
xcb_atom_t atom(QXcbAtom::Atom atom) const
void setConnection(QXcbConnection *connection)
const xcb_visualtype_t * visualForFormat(const QSurfaceFormat &format) const
QSurfaceFormat surfaceFormatFor(const QSurfaceFormat &format) const
xcb_screen_t * screen() const
xcb_window_t root() const
quint8 depthOfVisual(xcb_visualid_t visualid) const
const xcb_visualtype_t * visualForId(xcb_visualid_t visualid) const
QList< QPlatformScreen * > virtualSiblings() const override
Returns a list of all the platform screens that are part of the same virtual desktop.
QPlatformCursor * cursor() const override
Reimplement this function in subclass to return the cursor of the screen.
void windowShown(QXcbWindow *window)
xcb_colormap_t colormapForVisual(xcb_visualid_t visualid) const
void requestSystemTrayWindowDock(xcb_window_t window) const
const QList< xcb_window_t > & virtualRoots() const
bool isSupportedByWM(xcb_atom_t atom) const
xcb_window_t xcb_window() const
@ NetWmStateMaximizedHorz
@ NetWmStateMaximizedVert
@ NetWmStateDemandsAttention
QXcbWindow * toWindow() override
Qt::WindowStates m_windowState
void handleEnterNotifyEvent(const xcb_enter_notify_event_t *event) override
void handleClientMessageEvent(const xcb_client_message_event_t *event) override
void setMask(const QRegion ®ion) override
Reimplement to be able to let Qt set the mask of a window.
void updateSyncRequestCounter()
void updateWmTransientFor()
QSurfaceFormat format() const override
Returns the actual surface format of the window.
QXcbScreen * initialScreen() const
void setOpacity(qreal level) override
Reimplement to be able to let Qt set the opacity level of a window.
WindowTypes wmWindowTypes() const
bool requestSystemTrayWindowDock()
virtual const xcb_visualtype_t * createVisual()
void setTransparentForMouseEvents(bool transparent)
void lower() override
Reimplement to be able to let Qt lower windows to the bottom of the desktop.
void setGeometry(const QRect &rect) override
This function is called by Qt whenever a window is moved or resized using the QWindow API.
bool startSystemResize(Qt::Edges edges) override
Reimplement this method to start a system resize operation if the system supports it and return true ...
void setWmWindowType(WindowTypes types, Qt::WindowFlags flags)
@ SyncAndConfigureReceived
bool setKeyboardGrabEnabled(bool grab) override
void handleButtonReleaseEvent(const xcb_button_release_event_t *event) override
bool handleNativeEvent(xcb_generic_event_t *event) override
void handleExposeEvent(const xcb_expose_event_t *event) override
void handleXIEnterLeave(xcb_ge_event_t *) override
xcb_sync_int64_t m_syncValue
void setAlertState(bool enabled) override
Reimplement this method to set whether the window demands attention (for example, by flashing the tas...
void setParent(const QPlatformWindow *window) override
This function is called to enable native child window in QPA.
QXcbScreen * xcbScreen() const
bool m_deferredActivation
void handleXEmbedMessage(const xcb_client_message_event_t *event)
QList< QPointer< QXcbWindow > > m_wmTransientForChildren
uint visualId() const override
void propagateSizeHints() override
Reimplement to propagate the size hints of the QWindow.
void setWindowState(Qt::WindowStates state) override
Requests setting the window state of this surface to type.
void updateNetWmUserTime(xcb_timestamp_t timestamp)
QXcbWindow(QWindow *window)
void setNetWmState(bool set, xcb_atom_t one, xcb_atom_t two=0)
QPoint m_lastPointerPosition
void handleMapNotifyEvent(const xcb_map_notify_event_t *event) override
QPoint m_lastPointerGlobalPosition
void setMotifWmHints(Qt::WindowFlags flags)
void setWindowIconText(const QString &title) override
void setImageFormatForVisual(const xcb_visualtype_t *visual)
void sendXEmbedMessage(xcb_window_t window, quint32 message, quint32 detail=0, quint32 data1=0, quint32 data2=0)
static bool isTrayIconWindow(QWindow *window)
void setWindowIcon(const QIcon &icon) override
Reimplement to set the window icon to icon.
void handleUnmapNotifyEvent(const xcb_unmap_notify_event_t *event) override
bool relayFocusToModalWindow() const
void setWindowRole(const QString &role) override
void registerWmTransientForChild(QXcbWindow *)
void postSyncWindowRequest()
QMargins frameMargins() const override
xcb_visualid_t m_visualId
void handleMotionNotifyEvent(const xcb_motion_notify_event_t *event) override
qreal m_sizeHintsScaleFactor
void setVisible(bool visible) override
Reimplemented in subclasses to show the surface if visible is true, and hide it if visible is false.
void requestActivateWindow() override
Reimplement to let Qt be able to request activation/focus for a window.
void updateDoesNotAcceptFocus(bool doesNotAcceptFocus)
xcb_sync_counter_t m_syncCounter
bool isExposed() const override
Returns if this window is exposed in the windowing system.
bool m_ignorePressedWindowOnMouseLeave
void setWindowTitle(const QString &title) override
Reimplement to set the window title to title.
NetWmStates netWmStates()
void handlePropertyNotifyEvent(const xcb_property_notify_event_t *event) override
bool windowEvent(QEvent *event) override
Reimplement this method to be able to do any platform specific event handling.
void handleXIMouseEvent(xcb_ge_event_t *, Qt::MouseEventSource source=Qt::MouseEventNotSynthesized) override
bool isEmbedded() const override
Returns true if the window is a child of a non-Qt window.
QPoint mapFromGlobal(const QPoint &pos) const override
Translates the global screen coordinate pos to window coordinates using native methods.
void setWindowFlags(Qt::WindowFlags flags) override
Requests setting the window flags of this surface to flags.
static QString windowTitle(const QXcbConnection *conn, xcb_window_t window)
QXcbSyncWindowRequest * m_pendingSyncRequest
void raise() override
Reimplement to be able to let Qt raise windows to the top of the desktop.
QImage::Format m_imageFormat
void handleConfigureNotifyEvent(const xcb_configure_notify_event_t *event) override
void handleButtonPressEvent(const xcb_button_press_event_t *event) override
Qt::WindowStates m_lastWindowStateEvent
void handleFocusOutEvent(const xcb_focus_out_event_t *event) override
RecreationReasons m_recreationReasons
QPoint mapToGlobal(const QPoint &pos) const override
Translates the window coordinate pos to global screen coordinates using native methods.
WId winId() const override
Reimplement in subclasses to return a handle to the native window.
virtual void resolveFormat(const QSurfaceFormat &format)
bool startSystemMoveResize(const QPoint &pos, int edges)
void handleFocusInEvent(const xcb_focus_in_event_t *event) override
@ WindowStaysOnBottomHintChanged
@ WindowStaysOnTopHintChanged
void handleMouseEvent(xcb_timestamp_t time, const QPoint &local, const QPoint &global, Qt::KeyboardModifiers modifiers, QEvent::Type type, Qt::MouseEventSource source)
bool setMouseGrabEnabled(bool grab) override
void handleLeaveNotifyEvent(const xcb_leave_notify_event_t *event) override
bool startSystemMove() override
Reimplement this method to start a system move operation if the system supports it and return true to...
void doStartSystemMoveResize(const QPoint &globalPos, int edges)
void setParentRelativeBackPixmap()
xcb_window_t m_netWmUserTimeWindow
QXcbScreen * parentScreen()
void setNetWmStateOnUnmappedWindow()
EGLImageKHR int int EGLuint64KHR * modifiers
void newState(QList< State > &states, const char *token, const char *lexem, bool pre)
T toNativePixels(const T &value, const C *context)
T toNativeLocalPosition(const T &value, const C *context)
T fromNativePixels(const T &value, const C *context)
QRegion toNativeLocalRegion(const QRegion &pointRegion, const QWindow *window)
Combined button and popup list for selecting options.
QFuture< QtPrivate::MapResultType< Sequence, MapFunctor > > mapped(QThreadPool *pool, Sequence &&sequence, MapFunctor &&map)
@ BypassWindowManagerHint
@ WindowDoesNotAcceptFocus
@ WindowContextHelpButtonHint
@ WindowStaysOnBottomHint
@ WindowMaximizeButtonHint
@ WindowMinimizeButtonHint
@ WindowMinMaxButtonsHint
@ WindowTransparentForInput
@ X11BypassWindowManagerHint
@ ActiveWindowFocusReason
static const QCssKnownValue properties[NumProperties - 1]
DBusConnection const char DBusError DBusBusType DBusError return DBusConnection DBusHandleMessageFunction void DBusFreeFunction return DBusConnection return DBusConnection return const char DBusError return DBusConnection DBusMessage dbus_uint32_t return DBusConnection dbus_bool_t DBusConnection DBusAddWatchFunction DBusRemoveWatchFunction DBusWatchToggledFunction void DBusFreeFunction return DBusConnection DBusDispatchStatusFunction void DBusFreeFunction DBusTimeout return DBusTimeout return DBusWatch return DBusWatch unsigned int return DBusError const DBusError return const DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessageIter int const void return DBusMessageIter DBusMessageIter return DBusMessageIter void DBusMessageIter void int return DBusMessage DBusMessageIter return DBusMessageIter return DBusMessageIter DBusMessageIter const char const char const char const char return DBusMessage return DBusMessage const char return DBusMessage dbus_bool_t return DBusMessage dbus_uint32_t return DBusMessage return DBusPendingCall * pending
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
bool qFuzzyCompare(qfloat16 p1, qfloat16 p2) noexcept
qint64 qRound64(qfloat16 d) noexcept
#define Q_LOGGING_CATEGORY(name,...)
#define qCWarning(category,...)
#define qCDebug(category,...)
constexpr const T & qMin(const T &a, const T &b)
constexpr const T & qBound(const T &min, const T &val, const T &max)
constexpr const T & qMax(const T &a, const T &b)
static bool contains(const QJsonArray &haystack, unsigned needle)
GLenum GLsizei GLsizei GLint * values
[15]
GLuint64 GLenum void * handle
GLenum GLuint GLint level
GLfloat GLfloat GLfloat w
[0]
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLsizei GLenum GLenum * types
GLdouble GLdouble GLdouble GLdouble top
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
GLenum GLenum GLsizei const GLuint GLboolean enabled
GLuint GLsizei const GLchar * message
GLenum GLuint GLintptr offset
GLint GLint GLint GLint GLint GLint GLint GLbitfield mask
GLsizei GLsizei GLchar * source
#define QStringLiteral(str)
Q_CORE_EXPORT QByteArray qgetenv(const char *varName)
#define Q_DECLARE_TYPEINFO(TYPE, FLAGS)
unsigned long long quint64
Q_GUI_EXPORT QWindowPrivate * qt_window_private(QWindow *window)
static Qt::MouseButtons queryMouseButtons()
#define Q_XCB_REPLY(call,...)
#define Q_XCB_REPLY_UNCHECKED(call,...)
QT_BEGIN_NAMESPACE bool qt_xcb_imageFormatForVisual(QXcbConnection *connection, uint8_t depth, const xcb_visualtype_t *visual, QImage::Format *imageFormat, bool *needsRgbSwap)
static bool fromSendEvent(const void *event)
static QXcbSystemTrayTracker * systemTrayTracker(const QScreen *s)
static uint qtEdgesToXcbMoveResizeDirection(Qt::Edges edges)
static bool doCheckUnGrabAncestor(QXcbConnection *conn)
static const char * wm_window_type_property_id
static bool isTransient(const QWindow *w)
#define qt_xcb_mask_is_set(ptr, event)
static bool ignoreEnterEvent(quint8 mode, quint8 detail, QXcbConnection *conn=nullptr)
static const char * wm_window_role_property_id
@ transparentForInputEventMask
QList< xcb_rectangle_t > qRegionToXcbRectangleList(const QRegion ®ion)
static bool focusWindowChangeQueued(const QWindow *window)
static xcb_rectangle_t qRectToXCBRectangle(const QRect &r)
const quint32 XEMBED_VERSION
static int fixed1616ToInt(xcb_input_fp1616_t val)
static bool ignoreLeaveEvent(quint8 mode, quint8 detail, QXcbConnection *conn)
@ XEMBED_UNREGISTER_ACCELERATOR
@ XEMBED_WINDOW_DEACTIVATE
@ XEMBED_REGISTER_ACCELERATOR
@ XEMBED_ACTIVATE_ACCELERATOR
static QWindow * childWindowAt(QWindow *win, const QPoint &p)
QList< xcb_rectangle_t > qRegionToXcbRectangleList(const QRegion ®ion)
QFuture< QSet< QChar > > set
[10]
std::array< QModelRoleData, 3 > roleData
[13]
obj metaObject() -> className()
\inmodule QtCore \reentrant
bool contains(const AT &t) const noexcept