Changeset View
Changeset View
Standalone View
Standalone View
plugins/platforms/x11/windowed/x11windowed_backend.cpp
Show First 20 Lines • Show All 192 Lines • ▼ Show 20 Line(s) | 191 | case XCB_BUTTON_RELEASE: | |||
---|---|---|---|---|---|
193 | break; | 193 | break; | ||
194 | case XCB_MOTION_NOTIFY: { | 194 | case XCB_MOTION_NOTIFY: { | ||
195 | auto event = reinterpret_cast<xcb_motion_notify_event_t*>(e); | 195 | auto event = reinterpret_cast<xcb_motion_notify_event_t*>(e); | ||
196 | auto it = std::find_if(m_windows.constBegin(), m_windows.constEnd(), [event] (const Output &o) { return o.window == event->event; }); | 196 | auto it = std::find_if(m_windows.constBegin(), m_windows.constEnd(), [event] (const Output &o) { return o.window == event->event; }); | ||
197 | if (it == m_windows.constEnd()) { | 197 | if (it == m_windows.constEnd()) { | ||
198 | break; | 198 | break; | ||
199 | } | 199 | } | ||
200 | pointerMotion(QPointF(event->root_x - (*it).xPosition.x() + (*it).internalPosition.x(), | 200 | pointerMotion(QPointF(event->root_x - (*it).xPosition.x() + (*it).internalPosition.x(), | ||
201 | event->root_y - (*it).xPosition.y() + (*it).internalPosition.y()), | 201 | event->root_y - (*it).xPosition.y() + (*it).internalPosition.y()), | ||
202 | event->time); | 202 | event->time); | ||
graesslin: QPointF supports operator/, so that should be possible to simplify a bit. | |||||
203 | } | 203 | } | ||
204 | break; | 204 | break; | ||
205 | case XCB_KEY_PRESS: | 205 | case XCB_KEY_PRESS: | ||
206 | case XCB_KEY_RELEASE: { | 206 | case XCB_KEY_RELEASE: { | ||
207 | auto event = reinterpret_cast<xcb_key_press_event_t*>(e); | 207 | auto event = reinterpret_cast<xcb_key_press_event_t*>(e); | ||
208 | if (eventType == XCB_KEY_PRESS) { | 208 | if (eventType == XCB_KEY_PRESS) { | ||
209 | if (!m_keySymbols) { | 209 | if (!m_keySymbols) { | ||
210 | m_keySymbols = xcb_key_symbols_alloc(m_connection); | 210 | m_keySymbols = xcb_key_symbols_alloc(m_connection); | ||
Show All 13 Lines | 222 | case XCB_CONFIGURE_NOTIFY: | |||
224 | break; | 224 | break; | ||
225 | case XCB_ENTER_NOTIFY: { | 225 | case XCB_ENTER_NOTIFY: { | ||
226 | auto event = reinterpret_cast<xcb_enter_notify_event_t*>(e); | 226 | auto event = reinterpret_cast<xcb_enter_notify_event_t*>(e); | ||
227 | auto it = std::find_if(m_windows.constBegin(), m_windows.constEnd(), [event] (const Output &o) { return o.window == event->event; }); | 227 | auto it = std::find_if(m_windows.constBegin(), m_windows.constEnd(), [event] (const Output &o) { return o.window == event->event; }); | ||
228 | if (it == m_windows.constEnd()) { | 228 | if (it == m_windows.constEnd()) { | ||
229 | break; | 229 | break; | ||
230 | } | 230 | } | ||
231 | pointerMotion(QPointF(event->root_x - (*it).xPosition.x() + (*it).internalPosition.x(), | 231 | pointerMotion(QPointF(event->root_x - (*it).xPosition.x() + (*it).internalPosition.x(), | ||
232 | event->root_y - (*it).xPosition.y() + (*it).internalPosition.y()), | 232 | event->root_y - (*it).xPosition.y() + (*it).internalPosition.y()), | ||
233 | event->time); | 233 | event->time); | ||
graesslin: same here | |||||
234 | } | 234 | } | ||
235 | break; | 235 | break; | ||
236 | case XCB_CLIENT_MESSAGE: | 236 | case XCB_CLIENT_MESSAGE: | ||
237 | handleClientMessage(reinterpret_cast<xcb_client_message_event_t*>(e)); | 237 | handleClientMessage(reinterpret_cast<xcb_client_message_event_t*>(e)); | ||
238 | break; | 238 | break; | ||
239 | case XCB_EXPOSE: | 239 | case XCB_EXPOSE: | ||
240 | handleExpose(reinterpret_cast<xcb_expose_event_t*>(e)); | 240 | handleExpose(reinterpret_cast<xcb_expose_event_t*>(e)); | ||
241 | break; | 241 | break; | ||
▲ Show 20 Lines • Show All 118 Lines • ▼ Show 20 Line(s) | 359 | case XCB_BUTTON_INDEX_3: | |||
360 | button = BTN_RIGHT; | 360 | button = BTN_RIGHT; | ||
361 | break; | 361 | break; | ||
362 | default: | 362 | default: | ||
363 | button = event->detail + BTN_LEFT - 1; | 363 | button = event->detail + BTN_LEFT - 1; | ||
364 | return; | 364 | return; | ||
365 | } | 365 | } | ||
366 | pointerMotion(QPointF(event->root_x - (*it).xPosition.x() + (*it).internalPosition.x(), | 366 | pointerMotion(QPointF(event->root_x - (*it).xPosition.x() + (*it).internalPosition.x(), | ||
367 | event->root_y - (*it).xPosition.y() + (*it).internalPosition.y()), | 367 | event->root_y - (*it).xPosition.y() + (*it).internalPosition.y()), | ||
368 | event->time); | 368 | event->time); | ||
369 | if (pressed) { | 369 | if (pressed) { | ||
graesslin: and here | |||||
370 | pointerButtonPressed(button, event->time); | 370 | pointerButtonPressed(button, event->time); | ||
371 | } else { | 371 | } else { | ||
372 | pointerButtonReleased(button, event->time); | 372 | pointerButtonReleased(button, event->time); | ||
373 | } | 373 | } | ||
374 | } | 374 | } | ||
375 | 375 | | |||
376 | void X11WindowedBackend::handleExpose(xcb_expose_event_t *event) | 376 | void X11WindowedBackend::handleExpose(xcb_expose_event_t *event) | ||
377 | { | 377 | { | ||
▲ Show 20 Lines • Show All 89 Lines • ▼ Show 20 Line(s) | |||||
467 | { | 467 | { | ||
468 | QVector<QRect> ret; | 468 | QVector<QRect> ret; | ||
469 | for (auto it = m_windows.constBegin(); it != m_windows.constEnd(); ++it) { | 469 | for (auto it = m_windows.constBegin(); it != m_windows.constEnd(); ++it) { | ||
470 | ret << QRect((*it).internalPosition, (*it).size); | 470 | ret << QRect((*it).internalPosition, (*it).size); | ||
471 | } | 471 | } | ||
472 | return ret; | 472 | return ret; | ||
473 | } | 473 | } | ||
474 | 474 | | |||
475 | QVector<qreal> X11WindowedBackend::screenScales() const | ||||
476 | { | ||||
477 | QVector<qreal> ret; | ||||
478 | ret.fill(initialOutputScale(), m_windows.count()); | ||||
479 | return ret; | ||||
480 | } | ||||
QVector<T> &QVector::fill(const T &value, int size = -1) Assigns value to all items in the vector. If size is different from -1 (the default), the vector is resized to size size beforehand. broulik: QVector<T> &QVector::fill(const T &value, int size = -1)
Assigns value to all items in the… | |||||
481 | | ||||
475 | } | 482 | } |
QPointF supports operator/, so that should be possible to simplify a bit.