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) | 192 | case XCB_BUTTON_RELEASE: | |||
---|---|---|---|---|---|
193 | handleButtonPress(reinterpret_cast<xcb_button_press_event_t*>(e)); | 193 | handleButtonPress(reinterpret_cast<xcb_button_press_event_t*>(e)); | ||
194 | break; | 194 | break; | ||
195 | case XCB_MOTION_NOTIFY: { | 195 | case XCB_MOTION_NOTIFY: { | ||
196 | auto event = reinterpret_cast<xcb_motion_notify_event_t*>(e); | 196 | auto event = reinterpret_cast<xcb_motion_notify_event_t*>(e); | ||
197 | auto it = std::find_if(m_windows.constBegin(), m_windows.constEnd(), [event] (const Output &o) { return o.window == event->event; }); | 197 | auto it = std::find_if(m_windows.constBegin(), m_windows.constEnd(), [event] (const Output &o) { return o.window == event->event; }); | ||
198 | if (it == m_windows.constEnd()) { | 198 | if (it == m_windows.constEnd()) { | ||
199 | break; | 199 | break; | ||
200 | } | 200 | } | ||
201 | //generally we don't need to normalise input to the output scale; however because we're getting input | ||||
202 | //from a host window that doesn't understand scaling, we need to apply it ourselves so the cursor matches | ||||
201 | pointerMotion(QPointF(event->root_x - (*it).xPosition.x() + (*it).internalPosition.x(), | 203 | pointerMotion(QPointF(event->root_x - (*it).xPosition.x() + (*it).internalPosition.x(), | ||
202 | event->root_y - (*it).xPosition.y() + (*it).internalPosition.y()), | 204 | event->root_y - (*it).xPosition.y() + (*it).internalPosition.y()) / it->scale, | ||
203 | event->time); | 205 | event->time); | ||
204 | } | 206 | } | ||
205 | break; | 207 | break; | ||
206 | case XCB_KEY_PRESS: | 208 | case XCB_KEY_PRESS: | ||
207 | case XCB_KEY_RELEASE: { | 209 | case XCB_KEY_RELEASE: { | ||
208 | auto event = reinterpret_cast<xcb_key_press_event_t*>(e); | 210 | auto event = reinterpret_cast<xcb_key_press_event_t*>(e); | ||
209 | if (eventType == XCB_KEY_PRESS) { | 211 | if (eventType == XCB_KEY_PRESS) { | ||
210 | if (!m_keySymbols) { | 212 | if (!m_keySymbols) { | ||
Show All 14 Lines | 225 | case XCB_CONFIGURE_NOTIFY: | |||
225 | break; | 227 | break; | ||
226 | case XCB_ENTER_NOTIFY: { | 228 | case XCB_ENTER_NOTIFY: { | ||
227 | auto event = reinterpret_cast<xcb_enter_notify_event_t*>(e); | 229 | auto event = reinterpret_cast<xcb_enter_notify_event_t*>(e); | ||
228 | auto it = std::find_if(m_windows.constBegin(), m_windows.constEnd(), [event] (const Output &o) { return o.window == event->event; }); | 230 | auto it = std::find_if(m_windows.constBegin(), m_windows.constEnd(), [event] (const Output &o) { return o.window == event->event; }); | ||
229 | if (it == m_windows.constEnd()) { | 231 | if (it == m_windows.constEnd()) { | ||
230 | break; | 232 | break; | ||
231 | } | 233 | } | ||
232 | pointerMotion(QPointF(event->root_x - (*it).xPosition.x() + (*it).internalPosition.x(), | 234 | pointerMotion(QPointF(event->root_x - (*it).xPosition.x() + (*it).internalPosition.x(), | ||
233 | event->root_y - (*it).xPosition.y() + (*it).internalPosition.y()), | 235 | event->root_y - (*it).xPosition.y() + (*it).internalPosition.y()) / it->scale, | ||
234 | event->time); | 236 | event->time); | ||
235 | } | 237 | } | ||
236 | break; | 238 | break; | ||
237 | case XCB_CLIENT_MESSAGE: | 239 | case XCB_CLIENT_MESSAGE: | ||
238 | handleClientMessage(reinterpret_cast<xcb_client_message_event_t*>(e)); | 240 | handleClientMessage(reinterpret_cast<xcb_client_message_event_t*>(e)); | ||
239 | break; | 241 | break; | ||
240 | case XCB_EXPOSE: | 242 | case XCB_EXPOSE: | ||
241 | handleExpose(reinterpret_cast<xcb_expose_event_t*>(e)); | 243 | handleExpose(reinterpret_cast<xcb_expose_event_t*>(e)); | ||
▲ Show 20 Lines • Show All 117 Lines • ▼ Show 20 Line(s) | 359 | case XCB_BUTTON_INDEX_2: | |||
359 | break; | 361 | break; | ||
360 | case XCB_BUTTON_INDEX_3: | 362 | case XCB_BUTTON_INDEX_3: | ||
361 | button = BTN_RIGHT; | 363 | button = BTN_RIGHT; | ||
362 | break; | 364 | break; | ||
363 | default: | 365 | default: | ||
364 | button = event->detail + BTN_LEFT - 1; | 366 | button = event->detail + BTN_LEFT - 1; | ||
365 | return; | 367 | return; | ||
366 | } | 368 | } | ||
369 | | ||||
367 | pointerMotion(QPointF(event->root_x - (*it).xPosition.x() + (*it).internalPosition.x(), | 370 | pointerMotion(QPointF(event->root_x - (*it).xPosition.x() + (*it).internalPosition.x(), | ||
368 | event->root_y - (*it).xPosition.y() + (*it).internalPosition.y()), | 371 | event->root_y - (*it).xPosition.y() + (*it).internalPosition.y()) / it->scale, | ||
369 | event->time); | 372 | event->time); | ||
370 | if (pressed) { | 373 | if (pressed) { | ||
371 | pointerButtonPressed(button, event->time); | 374 | pointerButtonPressed(button, event->time); | ||
372 | } else { | 375 | } else { | ||
373 | pointerButtonReleased(button, event->time); | 376 | pointerButtonReleased(button, event->time); | ||
374 | } | 377 | } | ||
375 | } | 378 | } | ||
376 | 379 | | |||
▲ Show 20 Lines • Show All 94 Lines • ▼ Show 20 Line(s) | 473 | for (auto it = m_windows.constBegin(); it != m_windows.constEnd(); ++it) { | |||
471 | ret << QRect((*it).internalPosition, (*it).size); | 474 | ret << QRect((*it).internalPosition, (*it).size); | ||
472 | } | 475 | } | ||
473 | return ret; | 476 | return ret; | ||
474 | } | 477 | } | ||
475 | 478 | | |||
476 | QVector<qreal> X11WindowedBackend::screenScales() const | 479 | QVector<qreal> X11WindowedBackend::screenScales() const | ||
477 | { | 480 | { | ||
478 | QVector<qreal> ret; | 481 | QVector<qreal> ret; | ||
479 | ret.fill(initialOutputScale(), m_windows.count()); | 482 | for (auto it = m_windows.constBegin(); it != m_windows.constEnd(); ++it) { | ||
480 | return ret; | 483 | ret << (*it).scale; | ||
484 | } return ret; | ||||
graesslin: coding style | |||||
481 | } | 485 | } | ||
482 | 486 | | |||
483 | } | 487 | } |
coding style