Plasma5Support
7#include "cursornotificationhandler.h"
9#include <private/qtx11extras_p.h>
11#include <X11/extensions/Xfixes.h>
19CursorNotificationHandler::CursorNotificationHandler()
23 Display *dpy = QX11Info::display();
28 if (XFixesQueryExtension(dpy, &fixesEventBase, &errorBase)) {
30 XFixesQueryVersion(dpy, &major, &minor);
33 XFixesSelectCursorInput(dpy, winId(), XFixesDisplayCursorNotifyMask);
39CursorNotificationHandler::~CursorNotificationHandler()
43QString CursorNotificationHandler::cursorName()
51 XFixesCursorImage *image = XFixesGetCursorImage(QX11Info::display());
52 currentName = image->atom;
56 return cursorName(currentName);
59QString CursorNotificationHandler::cursorName(Atom cursor)
66 if (names.contains(
cursor))
69 char *data = XGetAtomName(QX11Info::display(),
cursor);
73 names.insert(
cursor, name);
79bool CursorNotificationHandler::x11Event(XEvent *event)
81 if (
event->type != fixesEventBase + XFixesCursorNotify)
84 XFixesCursorNotifyEvent *xfe =
reinterpret_cast<XFixesCursorNotifyEvent *
>(
event);
85 currentName = xfe->cursor_name;
87 Q_EMIT cursorNameChanged(cursorName(currentName));
QString name(StandardAction id)
virtual bool event(QEvent *e)
QString fromUtf8(QByteArrayView str)
This file is part of the KDE documentation.
Documentation copyright © 1996-2025 The KDE developers.
Generated on Fri Jan 24 2025 11:47:07 by
doxygen 1.13.2 written
by
Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.