Changeset View
Changeset View
Standalone View
Standalone View
events.cpp
Show All 33 Lines | |||||
34 | #ifdef KWIN_BUILD_TABBOX | 34 | #ifdef KWIN_BUILD_TABBOX | ||
35 | #include "tabbox.h" | 35 | #include "tabbox.h" | ||
36 | #endif | 36 | #endif | ||
37 | #include "group.h" | 37 | #include "group.h" | ||
38 | #include "rules.h" | 38 | #include "rules.h" | ||
39 | #include "unmanaged.h" | 39 | #include "unmanaged.h" | ||
40 | #include "useractions.h" | 40 | #include "useractions.h" | ||
41 | #include "effects.h" | 41 | #include "effects.h" | ||
42 | #include "screenedge.h" | | |||
43 | #include "screens.h" | 42 | #include "screens.h" | ||
44 | #include "xcbutils.h" | 43 | #include "xcbutils.h" | ||
45 | 44 | | |||
46 | #include <KDecoration2/Decoration> | 45 | #include <KDecoration2/Decoration> | ||
47 | 46 | | |||
48 | #include <QApplication> | 47 | #include <QApplication> | ||
49 | #include <QDebug> | 48 | #include <QDebug> | ||
50 | #include <QHoverEvent> | 49 | #include <QHoverEvent> | ||
▲ Show 20 Lines • Show All 221 Lines • ▼ Show 20 Line(s) | 266 | case XCB_BUTTON_RELEASE: { | |||
272 | break; | 271 | break; | ||
273 | } | 272 | } | ||
274 | case XCB_MOTION_NOTIFY: { | 273 | case XCB_MOTION_NOTIFY: { | ||
275 | if (kwinApp()->operationMode() != Application::OperationModeX11) { | 274 | if (kwinApp()->operationMode() != Application::OperationModeX11) { | ||
276 | // ignore X11 pointer events generated on X windows if we are not on X | 275 | // ignore X11 pointer events generated on X windows if we are not on X | ||
277 | return true; | 276 | return true; | ||
278 | } | 277 | } | ||
279 | auto *mouseEvent = reinterpret_cast<xcb_motion_notify_event_t*>(e); | 278 | auto *mouseEvent = reinterpret_cast<xcb_motion_notify_event_t*>(e); | ||
280 | const QPoint rootPos(mouseEvent->root_x, mouseEvent->root_y); | | |||
281 | if (effects && static_cast<EffectsHandlerImpl*>(effects)->checkInputWindowEvent(mouseEvent)) { | 279 | if (effects && static_cast<EffectsHandlerImpl*>(effects)->checkInputWindowEvent(mouseEvent)) { | ||
282 | return true; | 280 | return true; | ||
283 | } | 281 | } | ||
284 | if (QWidget::mouseGrabber()) { | | |||
285 | ScreenEdges::self()->check(rootPos, QDateTime::fromMSecsSinceEpoch(xTime()), true); | | |||
286 | } else { | | |||
287 | ScreenEdges::self()->check(rootPos, QDateTime::fromMSecsSinceEpoch(mouseEvent->time)); | | |||
288 | } | | |||
289 | break; | 282 | break; | ||
290 | } | 283 | } | ||
291 | case XCB_CONFIGURE_NOTIFY: | 284 | case XCB_CONFIGURE_NOTIFY: | ||
292 | if (reinterpret_cast<xcb_configure_notify_event_t*>(e)->event == rootWindow()) | 285 | if (reinterpret_cast<xcb_configure_notify_event_t*>(e)->event == rootWindow()) | ||
293 | markXStackingOrderAsDirty(); | 286 | markXStackingOrderAsDirty(); | ||
294 | break; | 287 | break; | ||
295 | }; | 288 | }; | ||
296 | 289 | | |||
▲ Show 20 Lines • Show All 88 Lines • ▼ Show 20 Line(s) | |||||
385 | } | 378 | } | ||
386 | 379 | | |||
387 | case XCB_ENTER_NOTIFY: { | 380 | case XCB_ENTER_NOTIFY: { | ||
388 | if (QWhatsThis::inWhatsThisMode()) { | 381 | if (QWhatsThis::inWhatsThisMode()) { | ||
389 | QWidget* w = QWidget::find(reinterpret_cast<xcb_enter_notify_event_t*>(e)->event); | 382 | QWidget* w = QWidget::find(reinterpret_cast<xcb_enter_notify_event_t*>(e)->event); | ||
390 | if (w) | 383 | if (w) | ||
391 | QWhatsThis::leaveWhatsThisMode(); | 384 | QWhatsThis::leaveWhatsThisMode(); | ||
392 | } | 385 | } | ||
393 | if (ScreenEdges::self()->isEntered(reinterpret_cast<xcb_enter_notify_event_t*>(e))) | | |||
394 | return true; | | |||
395 | break; | 386 | break; | ||
396 | } | 387 | } | ||
397 | case XCB_LEAVE_NOTIFY: { | 388 | case XCB_LEAVE_NOTIFY: { | ||
398 | if (!QWhatsThis::inWhatsThisMode()) | 389 | if (!QWhatsThis::inWhatsThisMode()) | ||
399 | break; | 390 | break; | ||
400 | // TODO is this cliente ever found, given that client events are searched above? | 391 | // TODO is this cliente ever found, given that client events are searched above? | ||
401 | const auto *event = reinterpret_cast<xcb_leave_notify_event_t*>(e); | 392 | const auto *event = reinterpret_cast<xcb_leave_notify_event_t*>(e); | ||
402 | Client* c = findClient(Predicate::FrameIdMatch, event->event); | 393 | Client* c = findClient(Predicate::FrameIdMatch, event->event); | ||
▲ Show 20 Lines • Show All 47 Lines • ▼ Show 20 Line(s) | 434 | if (!currentInput.isNull() && (currentInput->focus == XCB_WINDOW_NONE || currentInput->focus == XCB_INPUT_FOCUS_POINTER_ROOT || lostFocusPointerToRoot)) { | |||
450 | else | 441 | else | ||
451 | focusToNull(); | 442 | focusToNull(); | ||
452 | } | 443 | } | ||
453 | } | 444 | } | ||
454 | } | 445 | } | ||
455 | // fall through | 446 | // fall through | ||
456 | case XCB_FOCUS_OUT: | 447 | case XCB_FOCUS_OUT: | ||
457 | return true; // always eat these, they would tell Qt that KWin is the active app | 448 | return true; // always eat these, they would tell Qt that KWin is the active app | ||
458 | case XCB_CLIENT_MESSAGE: | | |||
459 | if (ScreenEdges::self()->isEntered(reinterpret_cast<xcb_client_message_event_t*>(e))) | | |||
460 | return true; | | |||
461 | break; | | |||
462 | default: | 449 | default: | ||
463 | if (eventType == Xcb::Extensions::self()->randrNotifyEvent() && Xcb::Extensions::self()->isRandrAvailable()) { | 450 | if (eventType == Xcb::Extensions::self()->randrNotifyEvent() && Xcb::Extensions::self()->isRandrAvailable()) { | ||
464 | auto *event = reinterpret_cast<xcb_randr_screen_change_notify_event_t*>(e); | 451 | auto *event = reinterpret_cast<xcb_randr_screen_change_notify_event_t*>(e); | ||
465 | xcb_screen_t *screen = defaultScreen(); | 452 | xcb_screen_t *screen = defaultScreen(); | ||
466 | if (event->rotation & (XCB_RANDR_ROTATION_ROTATE_90 | XCB_RANDR_ROTATION_ROTATE_270)) { | 453 | if (event->rotation & (XCB_RANDR_ROTATION_ROTATE_90 | XCB_RANDR_ROTATION_ROTATE_270)) { | ||
467 | screen->width_in_pixels = event->height; | 454 | screen->width_in_pixels = event->height; | ||
468 | screen->height_in_pixels = event->width; | 455 | screen->height_in_pixels = event->width; | ||
469 | screen->width_in_millimeters = event->mheight; | 456 | screen->width_in_millimeters = event->mheight; | ||
▲ Show 20 Lines • Show All 998 Lines • Show Last 20 Lines |