Changeset View
Changeset View
Standalone View
Standalone View
internal_client.cpp
Show First 20 Lines • Show All 291 Lines • ▼ Show 20 Line(s) | 288 | { | |||
---|---|---|---|---|---|
292 | const QRect windowRect = QRect(geom.topLeft() + QPoint(borderLeft(), borderTop()), | 292 | const QRect windowRect = QRect(geom.topLeft() + QPoint(borderLeft(), borderTop()), | ||
293 | geom.size() - QSize(borderLeft() + borderRight(), borderTop() + borderBottom())); | 293 | geom.size() - QSize(borderLeft() + borderRight(), borderTop() + borderBottom())); | ||
294 | if (m_internalWindow->geometry() != windowRect) { | 294 | if (m_internalWindow->geometry() != windowRect) { | ||
295 | // delay to end of cycle to prevent freeze, see BUG 384441 | 295 | // delay to end of cycle to prevent freeze, see BUG 384441 | ||
296 | QTimer::singleShot(0, m_internalWindow, std::bind(static_cast<void (QWindow::*)(const QRect&)>(&QWindow::setGeometry), m_internalWindow, windowRect)); | 296 | QTimer::singleShot(0, m_internalWindow, std::bind(static_cast<void (QWindow::*)(const QRect&)>(&QWindow::setGeometry), m_internalWindow, windowRect)); | ||
297 | } | 297 | } | ||
298 | } | 298 | } | ||
299 | 299 | | |||
300 | void InternalClient::resizeWithChecks(int w, int h, ForceGeometry_t force) | 300 | void InternalClient::resizeWithChecks(const QSize &size, ForceGeometry_t force) | ||
301 | { | 301 | { | ||
302 | Q_UNUSED(force) | 302 | Q_UNUSED(force) | ||
303 | | ||||
303 | if (!m_internalWindow) { | 304 | if (!m_internalWindow) { | ||
304 | return; | 305 | return; | ||
305 | } | 306 | } | ||
306 | QRect area = workspace()->clientArea(WorkArea, this); | 307 | | ||
307 | // don't allow growing larger than workarea | 308 | // Resize to fit the work area if needed. | ||
308 | if (w > area.width()) { | 309 | const QRect workArea = workspace()->clientArea(WorkArea, this); | ||
309 | w = area.width(); | 310 | const QSize clampedSize = size.boundedTo(workArea.size()); | ||
310 | } | 311 | | ||
311 | if (h > area.height()) { | 312 | m_internalWindow->setGeometry(QRect(pos(), clampedSize) - frameMargins()); | ||
312 | h = area.height(); | | |||
313 | } | | |||
314 | m_internalWindow->setGeometry(QRect(pos() + QPoint(borderLeft(), borderTop()), QSize(w, h) - QSize(borderLeft() + borderRight(), borderTop() + borderBottom()))); | | |||
315 | } | 313 | } | ||
316 | 314 | | |||
317 | void InternalClient::doResizeSync() | 315 | void InternalClient::doResizeSync() | ||
318 | { | 316 | { | ||
319 | if (!m_internalWindow) { | 317 | if (!m_internalWindow) { | ||
320 | return; | 318 | return; | ||
321 | } | 319 | } | ||
322 | const auto rect = moveResizeGeometry(); | 320 | const auto rect = moveResizeGeometry(); | ||
Show All 14 Lines |