summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/xcb/qxcbwindow.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/platforms/xcb/qxcbwindow.cpp')
-rw-r--r--src/plugins/platforms/xcb/qxcbwindow.cpp52
1 files changed, 16 insertions, 36 deletions
diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp
index 97da420798..66030b9ad4 100644
--- a/src/plugins/platforms/xcb/qxcbwindow.cpp
+++ b/src/plugins/platforms/xcb/qxcbwindow.cpp
@@ -67,9 +67,7 @@
#include <xcb/xcb_icccm.h>
#include <xcb/xfixes.h>
#include <xcb/shape.h>
-#if QT_CONFIG(xcb_xinput)
#include <xcb/xinput.h>
-#endif
#include <private/qguiapplication_p.h>
#include <private/qwindow_p.h>
@@ -176,13 +174,13 @@ static inline XTextProperty* qstringToXTP(Display *dpy, const QString& s)
{
#include <X11/Xatom.h>
- static XTextProperty tp = { 0, 0, 0, 0 };
+ static XTextProperty tp = { nullptr, 0, 0, 0 };
static bool free_prop = true; // we can't free tp.value in case it references
// the data of the static QByteArray below.
if (tp.value) {
if (free_prop)
XFree(tp.value);
- tp.value = 0;
+ tp.value = nullptr;
free_prop = true;
}
@@ -193,7 +191,7 @@ static inline XTextProperty* qstringToXTP(Display *dpy, const QString& s)
QByteArray mapped = mapper->fromUnicode(s);
char* tl[2];
tl[0] = mapped.data();
- tl[1] = 0;
+ tl[1] = nullptr;
errCode = XmbTextListToTextProperty(dpy, tl, 1, XStdICCTextStyle, &tp);
if (errCode < 0)
qCDebug(lcQpaXcb, "XmbTextListToTextProperty result code %d", errCode);
@@ -282,7 +280,7 @@ void QXcbWindow::create()
m_window = platformScreen->root();
m_depth = platformScreen->screen()->root_depth;
m_visualId = platformScreen->screen()->root_visual;
- const xcb_visualtype_t *visual = 0;
+ const xcb_visualtype_t *visual = nullptr;
if (connection()->hasDefaultVisualId()) {
visual = platformScreen->visualForId(connection()->defaultVisualId());
if (visual)
@@ -492,14 +490,12 @@ void QXcbWindow::create()
atom(QXcbAtom::_XEMBED_INFO),
32, 2, (void *)data);
-#if QT_CONFIG(xcb_xinput)
if (connection()->hasXInput2()) {
if (connection()->xi2MouseEventsDisabled())
connection()->xi2SelectDeviceEventsCompatibility(m_window);
else
connection()->xi2SelectDeviceEvents(m_window);
}
-#endif
setWindowState(window()->windowStates());
setWindowFlags(window()->flags());
@@ -823,7 +819,7 @@ bool QXcbWindow::relayFocusToModalWindow() const
while (w && w->parent())
w = w->parent();
- QWindow *modalWindow = 0;
+ QWindow *modalWindow = nullptr;
const bool blocked = QGuiApplicationPrivate::instance()->isWindowBlocked(w, &modalWindow);
if (blocked && modalWindow != w) {
modalWindow->requestActivate();
@@ -880,7 +876,7 @@ enum {
QXcbWindow::NetWmStates QXcbWindow::netWmStates()
{
- NetWmStates result(0);
+ NetWmStates result;
auto reply = Q_XCB_REPLY_UNCHECKED(xcb_get_property, xcb_connection(),
0, m_window, atom(QXcbAtom::_NET_WM_STATE),
@@ -931,7 +927,7 @@ void QXcbWindow::setWindowFlags(Qt::WindowFlags flags)
xcb_change_window_attributes(xcb_connection(), xcb_window(), mask, values);
- QXcbWindowFunctions::WmWindowTypes wmWindowTypes = 0;
+ QXcbWindowFunctions::WmWindowTypes wmWindowTypes;
if (window()->dynamicPropertyNames().contains(wm_window_type_property_id)) {
wmWindowTypes = static_cast<QXcbWindowFunctions::WmWindowTypes>(
window()->property(wm_window_type_property_id).value<int>());
@@ -1067,7 +1063,7 @@ void QXcbWindow::setNetWmStateOnUnmappedWindow()
if (Q_UNLIKELY(m_mapped))
qCWarning(lcQpaXcb()) << "internal error: " << Q_FUNC_INFO << "called on mapped window";
- NetWmStates states(0);
+ NetWmStates states;
const Qt::WindowFlags flags = window()->flags();
if (flags & Qt::WindowStaysOnTopHint) {
states |= NetWmStateAbove;
@@ -1197,7 +1193,7 @@ void QXcbWindow::updateNetWmUserTime(xcb_timestamp_t timestamp)
XCB_WINDOW_CLASS_INPUT_OUTPUT, // window class
m_visualId, // visual
0, // value mask
- 0); // value list
+ nullptr); // value list
wid = m_netWmUserTimeWindow;
xcb_change_property(xcb_connection(), XCB_PROP_MODE_REPLACE, m_window, atom(QXcbAtom::_NET_WM_USER_TIME_WINDOW),
XCB_ATOM_WINDOW, 32, 1, &m_netWmUserTimeWindow);
@@ -1227,7 +1223,7 @@ void QXcbWindow::setTransparentForMouseEvents(bool transparent)
xcb_rectangle_t rectangle;
- xcb_rectangle_t *rect = 0;
+ xcb_rectangle_t *rect = nullptr;
int nrect = 0;
if (!transparent) {
@@ -1481,7 +1477,7 @@ uint QXcbWindow::visualIdStatic(QWindow *window)
QXcbWindowFunctions::WmWindowTypes QXcbWindow::wmWindowTypes() const
{
- QXcbWindowFunctions::WmWindowTypes result(0);
+ QXcbWindowFunctions::WmWindowTypes result;
auto reply = Q_XCB_REPLY_UNCHECKED(xcb_get_property, xcb_connection(),
0, m_window, atom(QXcbAtom::_NET_WM_WINDOW_TYPE),
@@ -1886,7 +1882,7 @@ void QXcbWindow::handleButtonPressEvent(int event_x, int event_y, int root_x, in
if (m_embedded && !m_trayIconWindow) {
if (window() != QGuiApplication::focusWindow()) {
const QXcbWindow *container = static_cast<const QXcbWindow *>(parent());
- Q_ASSERT(container != 0);
+ Q_ASSERT(container != nullptr);
sendXEmbedMessage(container->xcb_window(), XEMBED_REQUEST_FOCUS);
}
@@ -1895,9 +1891,7 @@ void QXcbWindow::handleButtonPressEvent(int event_x, int event_y, int root_x, in
QPoint global(root_x, root_y);
if (isWheel) {
-#if QT_CONFIG(xcb_xinput)
if (!connection()->isAtLeastXI21()) {
-#endif
QPoint angleDelta;
if (detail == 4)
angleDelta.setY(120);
@@ -1910,9 +1904,7 @@ void QXcbWindow::handleButtonPressEvent(int event_x, int event_y, int root_x, in
if (modifiers & Qt::AltModifier)
angleDelta = angleDelta.transposed();
QWindowSystemInterface::handleWheelEvent(window(), timestamp, local, global, QPoint(), angleDelta, modifiers);
-#if QT_CONFIG(xcb_xinput)
}
-#endif
return;
}
@@ -1948,13 +1940,8 @@ static inline bool doCheckUnGrabAncestor(QXcbConnection *conn)
* not pressed, otherwise (e.g. on Alt+Tab) it can igonre important enter/leave events.
*/
if (conn) {
-
const bool mouseButtonsPressed = (conn->buttonState() != Qt::NoButton);
-#if QT_CONFIG(xcb_xinput)
return mouseButtonsPressed || (conn->hasXInput2() && !conn->xi2MouseEventsDisabled());
-#else
- return mouseButtonsPressed;
-#endif
}
return true;
}
@@ -1986,10 +1973,9 @@ void QXcbWindow::handleEnterNotifyEvent(int event_x, int event_y, int root_x, in
if (ignoreEnterEvent(mode, detail, connection()) || connection()->mousePressWindow())
return;
-#if QT_CONFIG(xcb_xinput)
+
// Updates scroll valuators, as user might have done some scrolling outside our X client.
connection()->xi2UpdateScrollingDevices();
-#endif
const QPoint local(event_x, event_y);
QWindowSystemInterface::handleEnterEvent(window(), local, global);
@@ -2064,7 +2050,6 @@ void QXcbWindow::handleMotionNotifyEvent(const xcb_motion_notify_event_t *event)
event->time, QEvent::MouseMove);
}
-#if QT_CONFIG(xcb_xinput)
static inline int fixed1616ToInt(xcb_input_fp1616_t val)
{
return int(qreal(val) / 0x10000);
@@ -2102,7 +2087,7 @@ void QXcbWindow::handleXIMouseEvent(xcb_ge_event_t *event, Qt::MouseEventSource
const Qt::MouseButton button = conn->xiToQtMouseButton(ev->detail);
- const char *sourceName = 0;
+ const char *sourceName = nullptr;
if (Q_UNLIKELY(lcQpaXInputEvents().isDebugEnabled())) {
const QMetaObject *metaObject = qt_getEnumMetaObject(source);
const QMetaEnum me = metaObject->enumerator(metaObject->indexOfEnumerator(qt_getEnumName(source)));
@@ -2165,7 +2150,6 @@ void QXcbWindow::handleXIEnterLeave(xcb_ge_event_t *event)
break;
}
}
-#endif
QXcbWindow *QXcbWindow::toWindow() { return this; }
@@ -2301,14 +2285,12 @@ bool QXcbWindow::setMouseGrabEnabled(bool grab)
if (grab && !connection()->canGrab())
return false;
-#if QT_CONFIG(xcb_xinput)
if (connection()->hasXInput2() && !connection()->xi2MouseEventsDisabled()) {
bool result = connection()->xi2SetMouseGrabEnabled(m_window, grab);
if (grab && result)
connection()->setMouseGrabber(this);
return result;
}
-#endif
if (!grab) {
xcb_ungrab_pointer(xcb_connection(), XCB_TIME_CURRENT_TIME);
@@ -2376,7 +2358,7 @@ bool QXcbWindow::startSystemMoveResize(const QPoint &pos, int corner)
return false;
const QPoint globalPos = QHighDpi::toNativePixels(window()->mapToGlobal(pos), window()->screen());
-#if QT_CONFIG(xcb_xinput)
+
// ### FIXME QTBUG-53389
bool startedByTouch = connection()->startSystemMoveResizeForTouchBegin(m_window, globalPos, corner);
if (startedByTouch) {
@@ -2386,9 +2368,7 @@ bool QXcbWindow::startSystemMoveResize(const QPoint &pos, int corner)
return false;
}
// KWin, Openbox, AwesomeWM have been tested to work with _NET_WM_MOVERESIZE.
- } else
-#endif
- { // Started by mouse press.
+ } else { // Started by mouse press.
if (connection()->isUnity())
return false; // _NET_WM_MOVERESIZE on this WM is bouncy (WM bug?).