Changeset View
Changeset View
Standalone View
Standalone View
geometry.cpp
Show First 20 Lines • Show All 1730 Lines • ▼ Show 20 Line(s) | 1705 | if (value_mask & (CWX | CWY)) { | |||
---|---|---|---|---|---|
1731 | if (newScreen != rules()->checkScreen(newScreen)) | 1731 | if (newScreen != rules()->checkScreen(newScreen)) | ||
1732 | return; // not allowed by rule | 1732 | return; // not allowed by rule | ||
1733 | 1733 | | |||
1734 | QRect origClientGeometry(pos() + clientPos(), clientSize()); | 1734 | QRect origClientGeometry(pos() + clientPos(), clientSize()); | ||
1735 | GeometryUpdatesBlocker blocker(this); | 1735 | GeometryUpdatesBlocker blocker(this); | ||
1736 | move(new_pos); | 1736 | move(new_pos); | ||
1737 | plainResize(ns); | 1737 | plainResize(ns); | ||
1738 | setGeometry(QRect(calculateGravitation(false, gravity), size())); | 1738 | setGeometry(QRect(calculateGravitation(false, gravity), size())); | ||
1739 | updateFullScreenHack(QRect(new_pos, QSize(nw, nh))); | | |||
1740 | QRect area = workspace()->clientArea(WorkArea, this); | 1739 | QRect area = workspace()->clientArea(WorkArea, this); | ||
1741 | if (!from_tool && (!isSpecialWindow() || isToolbar()) && !isFullScreen() | 1740 | if (!from_tool && (!isSpecialWindow() || isToolbar()) && !isFullScreen() | ||
1742 | && area.contains(origClientGeometry)) | 1741 | && area.contains(origClientGeometry)) | ||
1743 | keepInArea(area); | 1742 | keepInArea(area); | ||
1744 | 1743 | | |||
1745 | // this is part of the kicker-xinerama-hack... it should be | 1744 | // this is part of the kicker-xinerama-hack... it should be | ||
1746 | // safe to remove when kicker gets proper ExtendedStrut support; | 1745 | // safe to remove when kicker gets proper ExtendedStrut support; | ||
1747 | // see Workspace::updateClientArea() and | 1746 | // see Workspace::updateClientArea() and | ||
Show All 11 Lines | 1752 | if (value_mask & (CWWidth | CWHeight) | |||
1759 | if (value_mask & CWHeight) | 1758 | if (value_mask & CWHeight) | ||
1760 | nh = rh; | 1759 | nh = rh; | ||
1761 | QSize ns = sizeForClientSize(QSize(nw, nh)); | 1760 | QSize ns = sizeForClientSize(QSize(nw, nh)); | ||
1762 | 1761 | | |||
1763 | if (ns != size()) { // don't restore if some app sets its own size again | 1762 | if (ns != size()) { // don't restore if some app sets its own size again | ||
1764 | QRect origClientGeometry(pos() + clientPos(), clientSize()); | 1763 | QRect origClientGeometry(pos() + clientPos(), clientSize()); | ||
1765 | GeometryUpdatesBlocker blocker(this); | 1764 | GeometryUpdatesBlocker blocker(this); | ||
1766 | resizeWithChecks(ns, xcb_gravity_t(gravity)); | 1765 | resizeWithChecks(ns, xcb_gravity_t(gravity)); | ||
1767 | updateFullScreenHack(QRect(calculateGravitation(true, m_geometryHints.windowGravity()), QSize(nw, nh))); | | |||
1768 | if (!from_tool && (!isSpecialWindow() || isToolbar()) && !isFullScreen()) { | 1766 | if (!from_tool && (!isSpecialWindow() || isToolbar()) && !isFullScreen()) { | ||
1769 | // try to keep the window in its xinerama screen if possible, | 1767 | // try to keep the window in its xinerama screen if possible, | ||
1770 | // if that fails at least keep it visible somewhere | 1768 | // if that fails at least keep it visible somewhere | ||
1771 | QRect area = workspace()->clientArea(MovementArea, this); | 1769 | QRect area = workspace()->clientArea(MovementArea, this); | ||
1772 | if (area.contains(origClientGeometry)) | 1770 | if (area.contains(origClientGeometry)) | ||
1773 | keepInArea(area); | 1771 | keepInArea(area); | ||
1774 | area = workspace()->clientArea(WorkArea, this); | 1772 | area = workspace()->clientArea(WorkArea, this); | ||
1775 | if (area.contains(origClientGeometry)) | 1773 | if (area.contains(origClientGeometry)) | ||
▲ Show 20 Lines • Show All 667 Lines • ▼ Show 20 Line(s) | 2192 | { | |||
2443 | 2441 | | |||
2444 | updateAllowedActions(); | 2442 | updateAllowedActions(); | ||
2445 | updateWindowRules(Rules::MaximizeVert|Rules::MaximizeHoriz|Rules::Position|Rules::Size); | 2443 | updateWindowRules(Rules::MaximizeVert|Rules::MaximizeHoriz|Rules::Position|Rules::Size); | ||
2446 | emit quickTileModeChanged(); | 2444 | emit quickTileModeChanged(); | ||
2447 | } | 2445 | } | ||
2448 | 2446 | | |||
2449 | bool Client::userCanSetFullScreen() const | 2447 | bool Client::userCanSetFullScreen() const | ||
2450 | { | 2448 | { | ||
2451 | if (m_fullscreenMode == FullScreenHack) { | 2449 | if (!isFullScreenable()) { | ||
2452 | return false; | | |||
2453 | } | | |||
2454 | if (!isFullScreenable(false)) { | | |||
2455 | return false; | 2450 | return false; | ||
2456 | } | 2451 | } | ||
2457 | return isNormalWindow() || isDialog(); | 2452 | return isNormalWindow() || isDialog(); | ||
2458 | } | 2453 | } | ||
2459 | 2454 | | |||
2460 | void Client::setFullScreen(bool set, bool user) | 2455 | void Client::setFullScreen(bool set, bool user) | ||
2461 | { | 2456 | { | ||
2462 | const bool wasFullscreen = isFullScreen(); | 2457 | const bool wasFullscreen = isFullScreen(); | ||
2463 | if (!wasFullscreen && !set) { | 2458 | if (!wasFullscreen && !set) { | ||
2464 | return; | 2459 | return; | ||
2465 | } | 2460 | } | ||
2466 | if (m_fullscreenMode == FullScreenHack) { | | |||
2467 | return; | | |||
2468 | } | | |||
2469 | if (user && !userCanSetFullScreen()) { | 2461 | if (user && !userCanSetFullScreen()) { | ||
2470 | return; | 2462 | return; | ||
2471 | } | 2463 | } | ||
2472 | 2464 | | |||
2473 | set = rules()->checkFullScreen(set && !isSpecialWindow()); | 2465 | set = rules()->checkFullScreen(set && !isSpecialWindow()); | ||
2474 | setShade(ShadeNone); | 2466 | setShade(ShadeNone); | ||
2475 | 2467 | | |||
2476 | if (wasFullscreen) { | 2468 | if (wasFullscreen) { | ||
▲ Show 20 Lines • Show All 83 Lines • ▼ Show 20 Line(s) | 2545 | { | |||
2560 | total = top.united(bottom.united(left.united(right))); | 2552 | total = top.united(bottom.united(left.united(right))); | ||
2561 | 2553 | | |||
2562 | // qDebug() << "top: " << top << " bottom: " << bottom | 2554 | // qDebug() << "top: " << top << " bottom: " << bottom | ||
2563 | // << " left: " << left << " right: " << right; | 2555 | // << " left: " << left << " right: " << right; | ||
2564 | // qDebug() << "returning rect: " << total; | 2556 | // qDebug() << "returning rect: " << total; | ||
2565 | return total; | 2557 | return total; | ||
2566 | } | 2558 | } | ||
2567 | 2559 | | |||
2568 | | ||||
2569 | int Client::checkFullScreenHack(const QRect& geom) const | | |||
2570 | { | | |||
2571 | if (!options->isLegacyFullscreenSupport()) | | |||
2572 | return 0; | | |||
2573 | // if it's noborder window, and has size of one screen or the whole desktop geometry, it's fullscreen hack | | |||
2574 | if (noBorder() && app_noborder && isFullScreenable(true)) { | | |||
2575 | if (geom.size() == workspace()->clientArea(FullArea, geom.center(), desktop()).size()) | | |||
2576 | return 2; // full area fullscreen hack | | |||
2577 | if (geom.size() == workspace()->clientArea(ScreenArea, geom.center(), desktop()).size()) | | |||
2578 | return 1; // xinerama-aware fullscreen hack | | |||
2579 | } | | |||
2580 | return 0; | | |||
2581 | } | | |||
2582 | | ||||
2583 | void Client::updateFullScreenHack(const QRect& geom) | | |||
2584 | { | | |||
2585 | int type = checkFullScreenHack(geom); | | |||
2586 | if (m_fullscreenMode == FullScreenNone && type != 0) { | | |||
2587 | m_fullscreenMode = FullScreenHack; | | |||
2588 | updateDecoration(false, false); | | |||
2589 | QRect geom; | | |||
2590 | if (rules()->checkStrictGeometry(false)) { | | |||
2591 | geom = type == 2 // 1 - it's xinerama-aware fullscreen hack, 2 - it's full area | | |||
2592 | ? workspace()->clientArea(FullArea, geom.center(), desktop()) | | |||
2593 | : workspace()->clientArea(ScreenArea, geom.center(), desktop()); | | |||
2594 | } else | | |||
2595 | geom = workspace()->clientArea(FullScreenArea, geom.center(), desktop()); | | |||
2596 | setGeometry(geom); | | |||
2597 | emit fullScreenChanged(); | | |||
2598 | } else if (m_fullscreenMode == FullScreenHack && type == 0) { | | |||
2599 | m_fullscreenMode = FullScreenNone; | | |||
2600 | updateDecoration(false, false); | | |||
2601 | // whoever called this must setup correct geometry | | |||
2602 | emit fullScreenChanged(); | | |||
2603 | } | | |||
2604 | StackingUpdatesBlocker blocker(workspace()); | | |||
2605 | workspace()->updateClientLayer(this); // active fullscreens get different layer | | |||
2606 | } | | |||
2607 | | ||||
2608 | static GeometryTip* geometryTip = 0; | 2560 | static GeometryTip* geometryTip = 0; | ||
2609 | 2561 | | |||
2610 | void Client::positionGeometryTip() | 2562 | void Client::positionGeometryTip() | ||
2611 | { | 2563 | { | ||
2612 | assert(isMove() || isResize()); | 2564 | assert(isMove() || isResize()); | ||
2613 | // Position and Size display | 2565 | // Position and Size display | ||
2614 | if (effects && static_cast<EffectsHandlerImpl*>(effects)->provides(Effect::GeometryTip)) | 2566 | if (effects && static_cast<EffectsHandlerImpl*>(effects)->provides(Effect::GeometryTip)) | ||
2615 | return; // some effect paints this for us | 2567 | return; // some effect paints this for us | ||
▲ Show 20 Lines • Show All 881 Lines • Show Last 20 Lines |