Changeset View
Changeset View
Standalone View
Standalone View
events.cpp
Show First 20 Lines • Show All 185 Lines • ▼ Show 20 Line(s) | |||||
186 | { | 186 | { | ||
187 | if (filter->isGenericEvent()) | 187 | if (filter->isGenericEvent()) | ||
188 | m_genericEventFilters.removeOne(filter); | 188 | m_genericEventFilters.removeOne(filter); | ||
189 | else | 189 | else | ||
190 | m_eventFilters.removeOne(filter); | 190 | m_eventFilters.removeOne(filter); | ||
191 | } | 191 | } | ||
192 | 192 | | |||
193 | 193 | | |||
194 | /*! | 194 | /** | ||
195 | Handles workspace specific XCB event | 195 | * Handles workspace specific XCB event | ||
196 | */ | 196 | **/ | ||
197 | bool Workspace::workspaceEvent(xcb_generic_event_t *e) | 197 | bool Workspace::workspaceEvent(xcb_generic_event_t *e) | ||
198 | { | 198 | { | ||
199 | const uint8_t eventType = e->response_type & ~0x80; | 199 | const uint8_t eventType = e->response_type & ~0x80; | ||
200 | if (!eventType) { | 200 | if (!eventType) { | ||
201 | // let's check whether it's an error from one of the extensions KWin uses | 201 | // let's check whether it's an error from one of the extensions KWin uses | ||
202 | xcb_generic_error_t *error = reinterpret_cast<xcb_generic_error_t*>(e); | 202 | xcb_generic_error_t *error = reinterpret_cast<xcb_generic_error_t*>(e); | ||
203 | const QVector<Xcb::ExtensionData> extensions = Xcb::Extensions::self()->extensions(); | 203 | const QVector<Xcb::ExtensionData> extensions = Xcb::Extensions::self()->extensions(); | ||
204 | for (const auto &extension : extensions) { | 204 | for (const auto &extension : extensions) { | ||
▲ Show 20 Lines • Show All 198 Lines • ▼ Show 20 Line(s) | 398 | { | |||
403 | } | 403 | } | ||
404 | return false; | 404 | return false; | ||
405 | } | 405 | } | ||
406 | 406 | | |||
407 | // **************************************** | 407 | // **************************************** | ||
408 | // Client | 408 | // Client | ||
409 | // **************************************** | 409 | // **************************************** | ||
410 | 410 | | |||
411 | /*! | 411 | /** | ||
412 | General handler for XEvents concerning the client window | 412 | * General handler for XEvents concerning the client window | ||
413 | */ | 413 | **/ | ||
414 | bool Client::windowEvent(xcb_generic_event_t *e) | 414 | bool Client::windowEvent(xcb_generic_event_t *e) | ||
415 | { | 415 | { | ||
416 | if (findEventWindow(e) == window()) { // avoid doing stuff on frame or wrapper | 416 | if (findEventWindow(e) == window()) { // avoid doing stuff on frame or wrapper | ||
417 | NET::Properties dirtyProperties; | 417 | NET::Properties dirtyProperties; | ||
418 | NET::Properties2 dirtyProperties2; | 418 | NET::Properties2 dirtyProperties2; | ||
419 | double old_opacity = opacity(); | 419 | double old_opacity = opacity(); | ||
420 | info->event(e, &dirtyProperties, &dirtyProperties2); // pass through the NET stuff | 420 | info->event(e, &dirtyProperties, &dirtyProperties2); // pass through the NET stuff | ||
421 | 421 | | |||
▲ Show 20 Lines • Show All 149 Lines • ▼ Show 20 Line(s) | 567 | default: | |||
571 | } | 571 | } | ||
572 | if (eventType == Xcb::Extensions::self()->damageNotifyEvent() && reinterpret_cast<xcb_damage_notify_event_t*>(e)->drawable == frameId()) | 572 | if (eventType == Xcb::Extensions::self()->damageNotifyEvent() && reinterpret_cast<xcb_damage_notify_event_t*>(e)->drawable == frameId()) | ||
573 | damageNotifyEvent(); | 573 | damageNotifyEvent(); | ||
574 | break; | 574 | break; | ||
575 | } | 575 | } | ||
576 | return true; // eat all events | 576 | return true; // eat all events | ||
577 | } | 577 | } | ||
578 | 578 | | |||
579 | /*! | 579 | /** | ||
580 | Handles map requests of the client window | 580 | * Handles map requests of the client window | ||
581 | */ | 581 | **/ | ||
582 | bool Client::mapRequestEvent(xcb_map_request_event_t *e) | 582 | bool Client::mapRequestEvent(xcb_map_request_event_t *e) | ||
583 | { | 583 | { | ||
584 | if (e->window != window()) { | 584 | if (e->window != window()) { | ||
585 | // Special support for the save-set feature, which is a bit broken. | 585 | // Special support for the save-set feature, which is a bit broken. | ||
586 | // If there's a window from one client embedded in another one, | 586 | // If there's a window from one client embedded in another one, | ||
587 | // e.g. using XEMBED, and the embedder suddenly loses its X connection, | 587 | // e.g. using XEMBED, and the embedder suddenly loses its X connection, | ||
588 | // save-set will reparent the embedded window to its closest ancestor | 588 | // save-set will reparent the embedded window to its closest ancestor | ||
589 | // that will remains. Unfortunately, with reparenting window managers, | 589 | // that will remains. Unfortunately, with reparenting window managers, | ||
Show All 17 Lines | 606 | if (!isOnCurrentDesktop()) { | |||
607 | if (workspace()->allowClientActivation(this)) | 607 | if (workspace()->allowClientActivation(this)) | ||
608 | workspace()->activateClient(this); | 608 | workspace()->activateClient(this); | ||
609 | else | 609 | else | ||
610 | demandAttention(); | 610 | demandAttention(); | ||
611 | } | 611 | } | ||
612 | return true; | 612 | return true; | ||
613 | } | 613 | } | ||
614 | 614 | | |||
615 | /*! | 615 | /** | ||
616 | Handles unmap notify events of the client window | 616 | * Handles unmap notify events of the client window | ||
617 | */ | 617 | **/ | ||
618 | void Client::unmapNotifyEvent(xcb_unmap_notify_event_t *e) | 618 | void Client::unmapNotifyEvent(xcb_unmap_notify_event_t *e) | ||
619 | { | 619 | { | ||
620 | if (e->window != window()) | 620 | if (e->window != window()) | ||
621 | return; | 621 | return; | ||
622 | if (e->event != wrapperId()) { | 622 | if (e->event != wrapperId()) { | ||
623 | // most probably event from root window when initially reparenting | 623 | // most probably event from root window when initially reparenting | ||
624 | bool ignore = true; | 624 | bool ignore = true; | ||
625 | if (e->event == rootWindow() && (e->response_type & 0x80)) | 625 | if (e->event == rootWindow() && (e->response_type & 0x80)) | ||
Show All 17 Lines | |||||
643 | void Client::destroyNotifyEvent(xcb_destroy_notify_event_t *e) | 643 | void Client::destroyNotifyEvent(xcb_destroy_notify_event_t *e) | ||
644 | { | 644 | { | ||
645 | if (e->window != window()) | 645 | if (e->window != window()) | ||
646 | return; | 646 | return; | ||
647 | destroyClient(); | 647 | destroyClient(); | ||
648 | } | 648 | } | ||
649 | 649 | | |||
650 | 650 | | |||
651 | /*! | 651 | /** | ||
652 | Handles client messages for the client window | 652 | * Handles client messages for the client window | ||
653 | */ | 653 | **/ | ||
654 | void Client::clientMessageEvent(xcb_client_message_event_t *e) | 654 | void Client::clientMessageEvent(xcb_client_message_event_t *e) | ||
655 | { | 655 | { | ||
656 | Toplevel::clientMessageEvent(e); | 656 | Toplevel::clientMessageEvent(e); | ||
657 | if (e->window != window()) | 657 | if (e->window != window()) | ||
658 | return; // ignore frame/wrapper | 658 | return; // ignore frame/wrapper | ||
659 | // WM_STATE | 659 | // WM_STATE | ||
660 | if (e->type == atoms->wm_change_state) { | 660 | if (e->type == atoms->wm_change_state) { | ||
661 | if (e->data.data32[0] == XCB_ICCCM_WM_STATE_ICONIC) | 661 | if (e->data.data32[0] == XCB_ICCCM_WM_STATE_ICONIC) | ||
662 | minimize(); | 662 | minimize(); | ||
663 | return; | 663 | return; | ||
664 | } | 664 | } | ||
665 | } | 665 | } | ||
666 | 666 | | |||
667 | 667 | | |||
668 | /*! | 668 | /** | ||
669 | Handles configure requests of the client window | 669 | * Handles configure requests of the client window | ||
670 | */ | 670 | **/ | ||
671 | void Client::configureRequestEvent(xcb_configure_request_event_t *e) | 671 | void Client::configureRequestEvent(xcb_configure_request_event_t *e) | ||
672 | { | 672 | { | ||
673 | if (e->window != window()) | 673 | if (e->window != window()) | ||
674 | return; // ignore frame/wrapper | 674 | return; // ignore frame/wrapper | ||
675 | if (isResize() || isMove()) | 675 | if (isResize() || isMove()) | ||
676 | return; // we have better things to do right now | 676 | return; // we have better things to do right now | ||
677 | 677 | | |||
678 | if (fullscreen_mode == FullScreenNormal) { // refuse resizing of fullscreen windows | 678 | if (fullscreen_mode == FullScreenNormal) { // refuse resizing of fullscreen windows | ||
Show All 24 Lines | |||||
703 | // the it should be optimized though (see also Client::setGeometry()/plainResize()/move()). | 703 | // the it should be optimized though (see also Client::setGeometry()/plainResize()/move()). | ||
704 | sendSyntheticConfigureNotify(); | 704 | sendSyntheticConfigureNotify(); | ||
705 | 705 | | |||
706 | // SELI TODO accept configure requests for isDesktop windows (because kdesktop | 706 | // SELI TODO accept configure requests for isDesktop windows (because kdesktop | ||
707 | // may get XRANDR resize event before kwin), but check it's still at the bottom? | 707 | // may get XRANDR resize event before kwin), but check it's still at the bottom? | ||
708 | } | 708 | } | ||
709 | 709 | | |||
710 | 710 | | |||
711 | /*! | 711 | /** | ||
712 | Handles property changes of the client window | 712 | * Handles property changes of the client window | ||
713 | */ | 713 | **/ | ||
714 | void Client::propertyNotifyEvent(xcb_property_notify_event_t *e) | 714 | void Client::propertyNotifyEvent(xcb_property_notify_event_t *e) | ||
715 | { | 715 | { | ||
716 | Toplevel::propertyNotifyEvent(e); | 716 | Toplevel::propertyNotifyEvent(e); | ||
717 | if (e->window != window()) | 717 | if (e->window != window()) | ||
718 | return; // ignore frame/wrapper | 718 | return; // ignore frame/wrapper | ||
719 | switch(e->atom) { | 719 | switch(e->atom) { | ||
720 | case XCB_ATOM_WM_NORMAL_HINTS: | 720 | case XCB_ATOM_WM_NORMAL_HINTS: | ||
721 | getWmNormalHints(); | 721 | getWmNormalHints(); | ||
▲ Show 20 Lines • Show All 132 Lines • ▼ Show 20 Line(s) | 853 | for (int i = 0; | |||
854 | i < 8; | 854 | i < 8; | ||
855 | ++i) | 855 | ++i) | ||
856 | m_wrapper.ungrabButton(modifier | mods[ i ]); | 856 | m_wrapper.ungrabButton(modifier | mods[ i ]); | ||
857 | } | 857 | } | ||
858 | #undef XCapL | 858 | #undef XCapL | ||
859 | #undef XNumL | 859 | #undef XNumL | ||
860 | #undef XScrL | 860 | #undef XScrL | ||
861 | 861 | | |||
862 | /* | 862 | /** | ||
863 | Releases the passive grab for some modifier combinations when a | 863 | * Releases the passive grab for some modifier combinations when a | ||
864 | window becomes active. This helps broken X programs that | 864 | * window becomes active. This helps broken X programs that | ||
865 | missinterpret LeaveNotify events in grab mode to work properly | 865 | * missinterpret LeaveNotify events in grab mode to work properly | ||
866 | (Motif, AWT, Tk, ...) | 866 | * (Motif, AWT, Tk, ...) | ||
867 | */ | 867 | **/ | ||
868 | void Client::updateMouseGrab() | 868 | void Client::updateMouseGrab() | ||
869 | { | 869 | { | ||
870 | if (workspace()->globalShortcutsDisabled()) { | 870 | if (workspace()->globalShortcutsDisabled()) { | ||
871 | m_wrapper.ungrabButton(); | 871 | m_wrapper.ungrabButton(); | ||
872 | // keep grab for the simple click without modifiers if needed (see below) | 872 | // keep grab for the simple click without modifiers if needed (see below) | ||
873 | bool not_obscured = workspace()->topClientOnDesktop(VirtualDesktopManager::self()->current(), -1, true, false) == this; | 873 | bool not_obscured = workspace()->topClientOnDesktop(VirtualDesktopManager::self()->current(), -1, true, false) == this; | ||
874 | if (!(!options->isClickRaise() || not_obscured)) | 874 | if (!(!options->isClickRaise() || not_obscured)) | ||
875 | grabButton(XCB_NONE); | 875 | grabButton(XCB_NONE); | ||
▲ Show 20 Lines • Show All 470 Lines • Show Last 20 Lines |