Changeset View
Changeset View
Standalone View
Standalone View
src/platforms/xcb/kxmessages.cpp
Show First 20 Lines • Show All 173 Lines • ▼ Show 20 Line(s) | 141 | // A faster comparison than eventType != "xcb_generic_event_t" | |||
---|---|---|---|---|---|
174 | if (strlen(buf) < 20) { // last message fragment | 174 | if (strlen(buf) < 20) { // last message fragment | ||
175 | emit q->gotMessage(QString::fromUtf8(incoming_messages[cm_event->window].constData())); | 175 | emit q->gotMessage(QString::fromUtf8(incoming_messages[cm_event->window].constData())); | ||
176 | incoming_messages.remove(cm_event->window); | 176 | incoming_messages.remove(cm_event->window); | ||
177 | } | 177 | } | ||
178 | return false; // lets other KXMessages instances get the event too | 178 | return false; // lets other KXMessages instances get the event too | ||
179 | } | 179 | } | ||
180 | }; | 180 | }; | ||
181 | 181 | | |||
182 | #ifndef KWINDOWSYSTEM_NO_DEPRECATED | 182 | #if KWINDOWSYSTEM_BUILD_DEPRECATED_SINCE(5, 18) | ||
183 | static void send_message_internal(WId w_P, const QString &msg_P, long mask_P, | 183 | static void send_message_internal(WId w_P, const QString &msg_P, long mask_P, | ||
184 | Display *disp, Atom atom1_P, Atom atom2_P, Window handle_P); | 184 | Display *disp, Atom atom1_P, Atom atom2_P, Window handle_P); | ||
185 | // for broadcasting | 185 | // for broadcasting | ||
186 | static const long BROADCAST_MASK = PropertyChangeMask; | 186 | static const long BROADCAST_MASK = PropertyChangeMask; | ||
187 | // CHECKME | 187 | // CHECKME | ||
188 | #endif | 188 | #endif | ||
189 | static void send_message_internal(xcb_window_t w, const QString &msg, xcb_connection_t *c, | 189 | static void send_message_internal(xcb_window_t w, const QString &msg, xcb_connection_t *c, | ||
190 | xcb_atom_t leadingMessage, xcb_atom_t followingMessage, xcb_window_t handle); | 190 | xcb_atom_t leadingMessage, xcb_atom_t followingMessage, xcb_window_t handle); | ||
Show All 37 Lines | 223 | { | |||
228 | const QByteArray msg(msg_type_P); | 228 | const QByteArray msg(msg_type_P); | ||
229 | XcbAtom a2(d->connection, msg); | 229 | XcbAtom a2(d->connection, msg); | ||
230 | XcbAtom a1(d->connection, msg + QByteArrayLiteral("_BEGIN")); | 230 | XcbAtom a1(d->connection, msg + QByteArrayLiteral("_BEGIN")); | ||
231 | xcb_window_t root = screen_P == -1 ? d->rootWindow : defaultScreen(d->connection, screen_P)->root; | 231 | xcb_window_t root = screen_P == -1 ? d->rootWindow : defaultScreen(d->connection, screen_P)->root; | ||
232 | send_message_internal(root, message_P, d->connection, | 232 | send_message_internal(root, message_P, d->connection, | ||
233 | a1, a2, d->handle->winId()); | 233 | a1, a2, d->handle->winId()); | ||
234 | } | 234 | } | ||
235 | 235 | | |||
236 | #ifndef KWINDOWSYSTEM_NO_DEPRECATED | 236 | #if KWINDOWSYSTEM_BUILD_DEPRECATED_SINCE(5, 18) | ||
237 | bool KXMessages::broadcastMessageX(Display *disp, const char *msg_type_P, | 237 | bool KXMessages::broadcastMessageX(Display *disp, const char *msg_type_P, | ||
238 | const QString &message_P, int screen_P) | 238 | const QString &message_P, int screen_P) | ||
239 | { | 239 | { | ||
240 | if (disp == nullptr) { | 240 | if (disp == nullptr) { | ||
241 | return false; | 241 | return false; | ||
242 | } | 242 | } | ||
243 | Atom a2 = XInternAtom(disp, msg_type_P, false); | 243 | Atom a2 = XInternAtom(disp, msg_type_P, false); | ||
244 | Atom a1 = XInternAtom(disp, QByteArray(QByteArray(msg_type_P) + "_BEGIN").constData(), false); | 244 | Atom a1 = XInternAtom(disp, QByteArray(QByteArray(msg_type_P) + "_BEGIN").constData(), false); | ||
▲ Show 20 Lines • Show All 49 Lines • ▼ Show 20 Line(s) | 293 | Window win = XCreateSimpleWindow(disp, DefaultRootWindow(disp), 0, 0, 1, 1, | |||
294 | 0, BlackPixelOfScreen(DefaultScreenOfDisplay(disp)), | 294 | 0, BlackPixelOfScreen(DefaultScreenOfDisplay(disp)), | ||
295 | BlackPixelOfScreen(DefaultScreenOfDisplay(disp))); | 295 | BlackPixelOfScreen(DefaultScreenOfDisplay(disp))); | ||
296 | send_message_internal(w_P, message_P, 0, disp, a1, a2, win); | 296 | send_message_internal(w_P, message_P, 0, disp, a1, a2, win); | ||
297 | XDestroyWindow(disp, win); | 297 | XDestroyWindow(disp, win); | ||
298 | return true; | 298 | return true; | ||
299 | } | 299 | } | ||
300 | #endif | 300 | #endif | ||
301 | 301 | | |||
302 | #ifndef KWINDOWSYSTEM_NO_DEPRECATED | 302 | #if KWINDOWSYSTEM_BUILD_DEPRECATED_SINCE(5, 18) | ||
303 | static void send_message_internal(WId w_P, const QString &msg_P, long mask_P, | 303 | static void send_message_internal(WId w_P, const QString &msg_P, long mask_P, | ||
304 | Display *disp, Atom atom1_P, Atom atom2_P, Window handle_P) | 304 | Display *disp, Atom atom1_P, Atom atom2_P, Window handle_P) | ||
305 | { | 305 | { | ||
306 | //qDebug() << "send_message_internal" << w_P << msg_P << mask_P << atom1_P << atom2_P << handle_P; | 306 | //qDebug() << "send_message_internal" << w_P << msg_P << mask_P << atom1_P << atom2_P << handle_P; | ||
307 | unsigned int pos = 0; | 307 | unsigned int pos = 0; | ||
308 | QByteArray msg = msg_P.toUtf8(); | 308 | QByteArray msg = msg_P.toUtf8(); | ||
309 | unsigned int len = strlen(msg.constData()); | 309 | unsigned int len = strlen(msg.constData()); | ||
310 | XEvent e; | 310 | XEvent e; | ||
▲ Show 20 Lines • Show All 53 Lines • Show Last 20 Lines |