Changeset View
Changeset View
Standalone View
Standalone View
geometry.cpp
Show First 20 Lines • Show All 888 Lines • ▼ Show 20 Line(s) | 888 | else | |||
---|---|---|---|---|---|
889 | --block_focus; | 889 | --block_focus; | ||
890 | } | 890 | } | ||
891 | 891 | | |||
892 | // When kwin crashes, windows will not be gravitated back to their original position | 892 | // When kwin crashes, windows will not be gravitated back to their original position | ||
893 | // and will remain offset by the size of the decoration. So when restarting, fix this | 893 | // and will remain offset by the size of the decoration. So when restarting, fix this | ||
894 | // (the property with the size of the frame remains on the window after the crash). | 894 | // (the property with the size of the frame remains on the window after the crash). | ||
895 | void Workspace::fixPositionAfterCrash(xcb_window_t w, const xcb_get_geometry_reply_t *geometry) | 895 | void Workspace::fixPositionAfterCrash(xcb_window_t w, const xcb_get_geometry_reply_t *geometry) | ||
896 | { | 896 | { | ||
897 | NETWinInfo i(connection(), w, rootWindow(), NET::WMFrameExtents, 0); | 897 | NETWinInfo i(connection(), w, rootWindow(), NET::WMFrameExtents, NET::Properties2()); | ||
898 | NETStrut frame = i.frameExtents(); | 898 | NETStrut frame = i.frameExtents(); | ||
899 | 899 | | |||
900 | if (frame.left != 0 || frame.top != 0) { | 900 | if (frame.left != 0 || frame.top != 0) { | ||
901 | // left and top needed due to narrowing conversations restrictions in C++11 | 901 | // left and top needed due to narrowing conversations restrictions in C++11 | ||
902 | const uint32_t left = frame.left; | 902 | const uint32_t left = frame.left; | ||
903 | const uint32_t top = frame.top; | 903 | const uint32_t top = frame.top; | ||
904 | const uint32_t values[] = { geometry->x - left, geometry->y - top }; | 904 | const uint32_t values[] = { geometry->x - left, geometry->y - top }; | ||
905 | xcb_configure_window(connection(), w, XCB_CONFIG_WINDOW_X | XCB_CONFIG_WINDOW_Y, values); | 905 | xcb_configure_window(connection(), w, XCB_CONFIG_WINDOW_X | XCB_CONFIG_WINDOW_Y, values); | ||
▲ Show 20 Lines • Show All 1600 Lines • ▼ Show 20 Line(s) | 2499 | { | |||
2506 | total = top.united(bottom.united(left.united(right))); | 2506 | total = top.united(bottom.united(left.united(right))); | ||
2507 | 2507 | | |||
2508 | // qDebug() << "top: " << top << " bottom: " << bottom | 2508 | // qDebug() << "top: " << top << " bottom: " << bottom | ||
2509 | // << " left: " << left << " right: " << right; | 2509 | // << " left: " << left << " right: " << right; | ||
2510 | // qDebug() << "returning rect: " << total; | 2510 | // qDebug() << "returning rect: " << total; | ||
2511 | return total; | 2511 | return total; | ||
2512 | } | 2512 | } | ||
2513 | 2513 | | |||
2514 | static GeometryTip* geometryTip = 0; | 2514 | static GeometryTip* geometryTip = nullptr; | ||
2515 | 2515 | | |||
2516 | void Client::positionGeometryTip() | 2516 | void Client::positionGeometryTip() | ||
2517 | { | 2517 | { | ||
2518 | Q_ASSERT(isMove() || isResize()); | 2518 | Q_ASSERT(isMove() || isResize()); | ||
2519 | // Position and Size display | 2519 | // Position and Size display | ||
2520 | if (effects && static_cast<EffectsHandlerImpl*>(effects)->provides(Effect::GeometryTip)) | 2520 | if (effects && static_cast<EffectsHandlerImpl*>(effects)->provides(Effect::GeometryTip)) | ||
2521 | return; // some effect paints this for us | 2521 | return; // some effect paints this for us | ||
2522 | if (options->showGeometryTip()) { | 2522 | if (options->showGeometryTip()) { | ||
Show All 10 Lines | 2532 | if (!geometryTip->isVisible()) | |||
2533 | geometryTip->show(); | 2533 | geometryTip->show(); | ||
2534 | geometryTip->raise(); | 2534 | geometryTip->raise(); | ||
2535 | } | 2535 | } | ||
2536 | } | 2536 | } | ||
2537 | 2537 | | |||
2538 | bool AbstractClient::startMoveResize() | 2538 | bool AbstractClient::startMoveResize() | ||
2539 | { | 2539 | { | ||
2540 | Q_ASSERT(!isMoveResize()); | 2540 | Q_ASSERT(!isMoveResize()); | ||
2541 | Q_ASSERT(QWidget::keyboardGrabber() == NULL); | 2541 | Q_ASSERT(QWidget::keyboardGrabber() == nullptr); | ||
2542 | Q_ASSERT(QWidget::mouseGrabber() == NULL); | 2542 | Q_ASSERT(QWidget::mouseGrabber() == nullptr); | ||
2543 | stopDelayedMoveResize(); | 2543 | stopDelayedMoveResize(); | ||
2544 | if (QApplication::activePopupWidget() != NULL) | 2544 | if (QApplication::activePopupWidget() != nullptr) | ||
2545 | return false; // popups have grab | 2545 | return false; // popups have grab | ||
2546 | if (isFullScreen() && (screens()->count() < 2 || !isMovableAcrossScreens())) | 2546 | if (isFullScreen() && (screens()->count() < 2 || !isMovableAcrossScreens())) | ||
2547 | return false; | 2547 | return false; | ||
2548 | if (!doStartMoveResize()) { | 2548 | if (!doStartMoveResize()) { | ||
2549 | return false; | 2549 | return false; | ||
2550 | } | 2550 | } | ||
2551 | 2551 | | |||
2552 | invalidateDecorationDoubleClickTimer(); | 2552 | invalidateDecorationDoubleClickTimer(); | ||
Show All 27 Lines | |||||
2580 | 2580 | | |||
2581 | bool Client::doStartMoveResize() | 2581 | bool Client::doStartMoveResize() | ||
2582 | { | 2582 | { | ||
2583 | bool has_grab = false; | 2583 | bool has_grab = false; | ||
2584 | // This reportedly improves smoothness of the moveresize operation, | 2584 | // This reportedly improves smoothness of the moveresize operation, | ||
2585 | // something with Enter/LeaveNotify events, looks like XFree performance problem or something *shrug* | 2585 | // something with Enter/LeaveNotify events, looks like XFree performance problem or something *shrug* | ||
2586 | // (https://lists.kde.org/?t=107302193400001&r=1&w=2) | 2586 | // (https://lists.kde.org/?t=107302193400001&r=1&w=2) | ||
2587 | QRect r = workspace()->clientArea(FullArea, this); | 2587 | QRect r = workspace()->clientArea(FullArea, this); | ||
2588 | m_moveResizeGrabWindow.create(r, XCB_WINDOW_CLASS_INPUT_ONLY, 0, NULL, rootWindow()); | 2588 | m_moveResizeGrabWindow.create(r, XCB_WINDOW_CLASS_INPUT_ONLY, 0, nullptr, rootWindow()); | ||
2589 | m_moveResizeGrabWindow.map(); | 2589 | m_moveResizeGrabWindow.map(); | ||
2590 | m_moveResizeGrabWindow.raise(); | 2590 | m_moveResizeGrabWindow.raise(); | ||
2591 | updateXTime(); | 2591 | updateXTime(); | ||
2592 | const xcb_grab_pointer_cookie_t cookie = xcb_grab_pointer_unchecked(connection(), false, m_moveResizeGrabWindow, | 2592 | const xcb_grab_pointer_cookie_t cookie = xcb_grab_pointer_unchecked(connection(), false, m_moveResizeGrabWindow, | ||
2593 | XCB_EVENT_MASK_BUTTON_PRESS | XCB_EVENT_MASK_BUTTON_RELEASE | XCB_EVENT_MASK_POINTER_MOTION | | 2593 | XCB_EVENT_MASK_BUTTON_PRESS | XCB_EVENT_MASK_BUTTON_RELEASE | XCB_EVENT_MASK_POINTER_MOTION | | ||
2594 | XCB_EVENT_MASK_ENTER_WINDOW | XCB_EVENT_MASK_LEAVE_WINDOW, | 2594 | XCB_EVENT_MASK_ENTER_WINDOW | XCB_EVENT_MASK_LEAVE_WINDOW, | ||
2595 | XCB_GRAB_MODE_ASYNC, XCB_GRAB_MODE_ASYNC, m_moveResizeGrabWindow, Cursor::x11Cursor(cursor()), xTime()); | 2595 | XCB_GRAB_MODE_ASYNC, XCB_GRAB_MODE_ASYNC, m_moveResizeGrabWindow, Cursor::x11Cursor(cursor()), xTime()); | ||
2596 | ScopedCPointer<xcb_grab_pointer_reply_t> pointerGrab(xcb_grab_pointer_reply(connection(), cookie, NULL)); | 2596 | ScopedCPointer<xcb_grab_pointer_reply_t> pointerGrab(xcb_grab_pointer_reply(connection(), cookie, nullptr)); | ||
2597 | if (!pointerGrab.isNull() && pointerGrab->status == XCB_GRAB_STATUS_SUCCESS) { | 2597 | if (!pointerGrab.isNull() && pointerGrab->status == XCB_GRAB_STATUS_SUCCESS) { | ||
2598 | has_grab = true; | 2598 | has_grab = true; | ||
2599 | } | 2599 | } | ||
2600 | if (!has_grab && grabXKeyboard(frameId())) | 2600 | if (!has_grab && grabXKeyboard(frameId())) | ||
2601 | has_grab = move_resize_has_keyboard_grab = true; | 2601 | has_grab = move_resize_has_keyboard_grab = true; | ||
2602 | if (!has_grab) { // at least one grab is necessary in order to be able to finish move/resize | 2602 | if (!has_grab) { // at least one grab is necessary in order to be able to finish move/resize | ||
2603 | m_moveResizeGrabWindow.reset(); | 2603 | m_moveResizeGrabWindow.reset(); | ||
2604 | return false; | 2604 | return false; | ||
▲ Show 20 Lines • Show All 56 Lines • ▼ Show 20 Line(s) | 2659 | if (needsXWindowMove) { | |||
2661 | m_frame.move(geom.topLeft()); | 2661 | m_frame.move(geom.topLeft()); | ||
2662 | needsXWindowMove = false; | 2662 | needsXWindowMove = false; | ||
2663 | } | 2663 | } | ||
2664 | if (!isResize()) | 2664 | if (!isResize()) | ||
2665 | sendSyntheticConfigureNotify(); // tell the client about it's new final position | 2665 | sendSyntheticConfigureNotify(); // tell the client about it's new final position | ||
2666 | if (geometryTip) { | 2666 | if (geometryTip) { | ||
2667 | geometryTip->hide(); | 2667 | geometryTip->hide(); | ||
2668 | delete geometryTip; | 2668 | delete geometryTip; | ||
2669 | geometryTip = NULL; | 2669 | geometryTip = nullptr; | ||
2670 | } | 2670 | } | ||
2671 | if (move_resize_has_keyboard_grab) | 2671 | if (move_resize_has_keyboard_grab) | ||
2672 | ungrabXKeyboard(); | 2672 | ungrabXKeyboard(); | ||
2673 | move_resize_has_keyboard_grab = false; | 2673 | move_resize_has_keyboard_grab = false; | ||
2674 | xcb_ungrab_pointer(connection(), xTime()); | 2674 | xcb_ungrab_pointer(connection(), xTime()); | ||
2675 | m_moveResizeGrabWindow.reset(); | 2675 | m_moveResizeGrabWindow.reset(); | ||
2676 | if (syncRequest.counter == XCB_NONE) // don't forget to sanitize since the timeout will no more fire | 2676 | if (syncRequest.counter == XCB_NONE) // don't forget to sanitize since the timeout will no more fire | ||
2677 | syncRequest.isPending = false; | 2677 | syncRequest.isPending = false; | ||
2678 | delete syncRequest.timeout; | 2678 | delete syncRequest.timeout; | ||
2679 | syncRequest.timeout = NULL; | 2679 | syncRequest.timeout = nullptr; | ||
2680 | AbstractClient::leaveMoveResize(); | 2680 | AbstractClient::leaveMoveResize(); | ||
2681 | } | 2681 | } | ||
2682 | 2682 | | |||
2683 | // This function checks if it actually makes sense to perform a restricted move/resize. | 2683 | // This function checks if it actually makes sense to perform a restricted move/resize. | ||
2684 | // If e.g. the titlebar is already outside of the workarea, there's no point in performing | 2684 | // If e.g. the titlebar is already outside of the workarea, there's no point in performing | ||
2685 | // a restricted move resize, because then e.g. resize would also move the window (#74555). | 2685 | // a restricted move resize, because then e.g. resize would also move the window (#74555). | ||
2686 | // NOTE: Most of it is duplicated from handleMoveResize(). | 2686 | // NOTE: Most of it is duplicated from handleMoveResize(). | ||
2687 | void AbstractClient::checkUnrestrictedMoveResize() | 2687 | void AbstractClient::checkUnrestrictedMoveResize() | ||
▲ Show 20 Lines • Show All 709 Lines • Show Last 20 Lines |