6#include <QtCore/QByteArray>
7#include <QtCore/QtEndian>
85 const auto property_value_length = xcb_get_property_value_length(
reply.get());
86 settings.append(
static_cast<const char *
>(xcb_get_property_value(
reply.get())), property_value_length);
87 offset += property_value_length;
88 more =
reply->bytes_after != 0;
99 int remainder =
value % 4;
102 return value + 4 - remainder;
107 if (xSettings.
size() < 12)
109 char byteOrder = xSettings.
at(0);
110 if (byteOrder != XCB_IMAGE_ORDER_LSB_FIRST && byteOrder != XCB_IMAGE_ORDER_MSB_FIRST) {
111 qWarning(
"ByteOrder byte %d not 0 or 1", byteOrder);
115#define ADJUST_BO(b, t, x) \
116 ((b == XCB_IMAGE_ORDER_LSB_FIRST) ? \
117 qFromLittleEndian<t>(x) : \
118 qFromBigEndian<t>(x))
119#define VALIDATE_LENGTH(x) \
120 if ((size_t)xSettings.length() < (offset + local_offset + 12 + x)) { \
121 qWarning("Length %d runs past end of data", x); \
128 for (
uint i = 0;
i < number_of_settings;
i++) {
129 int local_offset = 0;
154 value.setValue(value_string);
160 value.setValue(value_length);
172 value.setValue(color_value);
190 QByteArray settings_atom_for_screen(
"_XSETTINGS_S");
195 settings_atom_for_screen.
size(),
200 xcb_atom_t selection_owner_atom = atom_reply->atom;
202 xcb_window_t owner =
screen->connection()->selectionOwner(selection_owner_atom);
203 if (owner == XCB_NONE)
211 const uint32_t
event = XCB_CW_EVENT_MASK;
212 const uint32_t event_mask[] = { XCB_EVENT_MASK_STRUCTURE_NOTIFY|XCB_EVENT_MASK_PROPERTY_CHANGE };
228 return d->initialized;
234 if (
event->window !=
d->x_settings_window)
237 d->populateSettings(
d->getSettings());
254 isCallbackForHandle),
262 it !=
d->settings.cend(); ++
it) {
270 return d->settings.value(
property).value;
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.
char at(qsizetype i) const
Returns the byte at index position i in the byte array.
static QByteArray number(int, int base=10)
Returns a byte-array representing the whole number n as text.
QByteArray & append(char c)
This is an overloaded member function, provided for convenience. It differs from the above function o...
QByteArray mid(qsizetype index, qsizetype len=-1) const
Returns a byte array containing len bytes from this byte array, starting at position pos.
The QColor class provides colors based on RGB, HSV or CMYK values.
QPlatformScreen * handle() const
Get the platform screen handle.
@ Atom_XSETTINGS_SETTINGS
xcb_atom_t atom(QXcbAtom::Atom qatom) const
QXcbConnection * connection() const
xcb_connection_t * xcb_connection() const
QMap< QByteArray, QXcbXSettingsPropertyValue > settings
void populateSettings(const QByteArray &xSettings)
QXcbVirtualDesktop * screen
QXcbXSettingsPrivate(QXcbVirtualDesktop *screen)
xcb_window_t x_settings_window
static int round_to_nearest_multiple_of_4(int value)
QXcbXSettingsPropertyValue()
std::vector< QXcbXSettingsCallback > callback_links
void updateValue(QXcbVirtualDesktop *screen, const QByteArray &name, const QVariant &value, int last_change_serial)
void addCallback(QXcbXSettings::PropertyChangeFunc func, void *handle)
QXcbXSettings(QXcbVirtualDesktop *screen)
void removeCallbackForHandle(const QByteArray &property, void *handle)
void registerCallbackForProperty(const QByteArray &property, PropertyChangeFunc func, void *handle)
QVariant setting(const QByteArray &property) const
void(* PropertyChangeFunc)(QXcbVirtualDesktop *screen, const QByteArray &name, const QVariant &property, void *handle)
void handlePropertyNotifyEvent(const xcb_property_notify_event_t *event) override
QSet< QString >::iterator it
Combined button and popup list for selecting options.
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
GLuint64 GLenum void * handle
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
GLenum GLuint GLintptr offset
GLfloat GLfloat GLfloat alpha
SSL_CTX int(* cb)(SSL *ssl, unsigned char **out, unsigned char *outlen, const unsigned char *in, unsigned int inlen, void *arg)
PromiseCallbacks callbacks
#define Q_XCB_REPLY(call,...)
#define Q_XCB_REPLY_UNCHECKED(call,...)
#define VALIDATE_LENGTH(x)
#define ADJUST_BO(b, t, x)
QXcbXSettings::PropertyChangeFunc func