* @brief Manual-mode press logic: hit-tests the topmost window at pos, raises it, * and starts a resize or drag. Returns true when the press is consumed. */
| 1879 | * and starts a resize or drag. Returns true when the press is consumed. |
| 1880 | */ |
| 1881 | bool UI::WindowManager::startManualPress(const QPointF& pos, Qt::MouseButton button) |
| 1882 | { |
| 1883 | if (autoLayoutEnabled()) |
| 1884 | return false; |
| 1885 | |
| 1886 | m_dragWindow = nullptr; |
| 1887 | m_targetWindow = nullptr; |
| 1888 | m_resizeWindow = nullptr; |
| 1889 | m_focusedWindow = nullptr; |
| 1890 | m_resizeEdge = ResizeEdge::None; |
| 1891 | m_initialMousePos = pos.toPoint(); |
| 1892 | |
| 1893 | m_focusedWindow = manualResizeTargetAt(m_initialMousePos); |
| 1894 | if (!m_focusedWindow) |
| 1895 | m_focusedWindow = topmostWindowAt(m_initialMousePos); |
| 1896 | |
| 1897 | if (!m_focusedWindow) |
| 1898 | return false; |
| 1899 | |
| 1900 | const bool wasFocused = m_taskbar && m_taskbar->activeWindow() == m_focusedWindow; |
| 1901 | |
| 1902 | if (m_taskbar) |
| 1903 | m_taskbar->setActiveWindow(m_focusedWindow); |
| 1904 | |
| 1905 | bringToFront(m_focusedWindow); |
| 1906 | |
| 1907 | if (button != Qt::LeftButton || m_focusedWindow->state() != "normal") |
| 1908 | return false; |
| 1909 | |
| 1910 | m_resizeEdge = detectResizeEdge(m_focusedWindow, m_initialMousePos); |
| 1911 | if (m_resizeEdge != ResizeEdge::None) { |
| 1912 | m_resizeWindow = m_focusedWindow; |
| 1913 | m_initialGeometry = extractGeometry(m_focusedWindow); |
| 1914 | grabMouse(); |
| 1915 | return true; |
| 1916 | } |
| 1917 | |
| 1918 | const auto local = m_focusedWindow->mapFromItem(this, m_initialMousePos); |
| 1919 | const int captionH = m_focusedWindow->property("captionHeight").toInt(); |
| 1920 | const int externcW = m_focusedWindow->property("externControlWidth").toInt(); |
| 1921 | const int buttonsW = m_focusedWindow->property("windowControlsWidth").toInt(); |
| 1922 | const bool onCaption = local.y() <= captionH && local.x() > externcW |
| 1923 | && local.x() <= m_focusedWindow->width() - buttonsW; |
| 1924 | const bool onControls = local.y() <= captionH && !onCaption; |
| 1925 | if (onControls) |
| 1926 | return false; |
| 1927 | |
| 1928 | if (wasFocused && local.y() > captionH) |
| 1929 | return false; |
| 1930 | |
| 1931 | m_dragWindow = m_focusedWindow; |
| 1932 | m_initialGeometry = extractGeometry(m_focusedWindow); |
| 1933 | if (m_snapIndicatorVisible) { |
| 1934 | m_snapIndicatorVisible = false; |
| 1935 | Q_EMIT snapIndicatorChanged(); |
| 1936 | } |
| 1937 | |
| 1938 | grabMouse(); |
nothing calls this directly
no test coverage detected