/*!
Requests setting the window state of this surface
- to \a type. Returns the actual state set.
+ to \a type.
Qt::WindowActive can be ignored.
*/
-Qt::WindowState QPlatformWindow::setWindowState(Qt::WindowState)
+void QPlatformWindow::setWindowState(Qt::WindowState)
{
- return Qt::WindowNoState;
}
/*!
virtual void setVisible(bool visible);
virtual void setWindowFlags(Qt::WindowFlags flags);
- virtual Qt::WindowState setWindowState(Qt::WindowState state);
+ virtual void setWindowState(Qt::WindowState state);
virtual WId winId() const;
virtual void setParent(const QPlatformWindow *window);
Q_D(QWindow);
if (d->platformWindow)
- d->windowState = d->platformWindow->setWindowState(state);
- else
- d->windowState = state;
+ d->platformWindow->setWindowState(state);
+ d->windowState = state;
}
/*!
void setCocoaGeometry(const QRect &rect);
void setVisible(bool visible);
void setWindowFlags(Qt::WindowFlags flags);
- Qt::WindowState setWindowState(Qt::WindowState state);
+ void setWindowState(Qt::WindowState state);
void setWindowTitle(const QString &title);
void setWindowFilePath(const QString &filePath);
void setWindowIcon(const QIcon &icon);
m_windowFlags = flags;
}
-Qt::WindowState QCocoaWindow::setWindowState(Qt::WindowState state)
+void QCocoaWindow::setWindowState(Qt::WindowState state)
{
if ([m_nsWindow isVisible])
syncWindowState(state); // Window state set for hidden windows take effect when show() is called.
-
- return state;
}
void QCocoaWindow::setWindowTitle(const QString &title)
QPlatformWindow::setGeometry(rect);
}
-Qt::WindowState QEglFSWindow::setWindowState(Qt::WindowState)
+void QEglFSWindow::setWindowState(Qt::WindowState)
{
setGeometry(QRect());
- return Qt::WindowFullScreen;
}
WId QEglFSWindow::winId() const
~QEglFSWindow();
void setGeometry(const QRect &);
- Qt::WindowState setWindowState(Qt::WindowState state);
+ void setWindowState(Qt::WindowState state);
WId winId() const;
EGLSurface surface() const { return m_surface; }
}
-Qt::WindowState QQnxWindow::setWindowState(Qt::WindowState state)
+void QQnxWindow::setWindowState(Qt::WindowState state)
{
qWindowDebug() << Q_FUNC_INFO << "state =" << state;
// Prevent two calls with Qt::WindowFullScreen from changing m_unmaximizedGeometry
if (m_windowState == state)
- return state;
+ return;
switch (state) {
// WindowActive is not an accepted parameter according to the docs
case Qt::WindowMinimized:
case Qt::WindowActive:
- return m_windowState;
+ return;
case Qt::WindowMaximized:
case Qt::WindowFullScreen:
}
m_windowState = state;
- return state;
}
void QQnxWindow::gainedFocus()
void raise();
void lower();
void requestActivateWindow();
- Qt::WindowState setWindowState(Qt::WindowState state);
+ void setWindowState(Qt::WindowState state);
void gainedFocus();
QWindowSystemInterface::handleWindowStateChanged(window(), state);
}
-Qt::WindowState QWindowsWindow::setWindowState(Qt::WindowState state)
+void QWindowsWindow::setWindowState(Qt::WindowState state)
{
if (m_data.hwnd) {
setWindowState_sys(state);
m_windowState = state;
}
- return state;
}
bool QWindowsWindow::isFullScreen_sys() const
virtual QPoint mapFromGlobal(const QPoint &pos) const;
virtual void setWindowFlags(Qt::WindowFlags flags);
- virtual Qt::WindowState setWindowState(Qt::WindowState state);
+ virtual void setWindowState(Qt::WindowState state);
HWND handle() const { return m_data.hwnd; }
Q_XCB_CALL(xcb_send_event(xcb_connection(), 0, m_screen->root(), XCB_EVENT_MASK_STRUCTURE_NOTIFY | XCB_EVENT_MASK_SUBSTRUCTURE_REDIRECT, (const char *)&event));
}
-Qt::WindowState QXcbWindow::setWindowState(Qt::WindowState state)
+void QXcbWindow::setWindowState(Qt::WindowState state)
{
if (state == m_windowState)
- return state;
+ return;
// unset old state
switch (m_windowState) {
connection()->sync();
m_windowState = state;
- return m_windowState;
}
void QXcbWindow::setNetWmWindowFlags(Qt::WindowFlags flags)
void setVisible(bool visible);
void setWindowFlags(Qt::WindowFlags flags);
- Qt::WindowState setWindowState(Qt::WindowState state);
+ void setWindowState(Qt::WindowState state);
WId winId() const;
void setParent(const QPlatformWindow *window);
static bool qt_widget_rgn(QWidget *, short, RgnHandle, bool);
void registerTouchWindow(bool enable = true);
#endif
- void setMaxWindowState_helper();
- void setFullScreenSize_helper();
bool stealKeyboardGrab(bool grab);
bool stealMouseGrab(bool grab);
};
window->setVisible(false);
}
-void QWidgetPrivate::setMaxWindowState_helper()
-{
- Q_Q(QWidget);
-
- const uint old_state = data.in_set_window_state;
- data.in_set_window_state = 1;
-
- const QRect desktop = qApp->desktop()->availableGeometry(qApp->desktop()->screenNumber(q));
- q->setGeometry(desktop);
-
- data.in_set_window_state = old_state;
-}
-
-void QWidgetPrivate::setFullScreenSize_helper()
-{
- Q_Q(QWidget);
-
- const uint old_state = data.in_set_window_state;
- data.in_set_window_state = 1;
-
- const QRect screen = qApp->desktop()->screenGeometry(qApp->desktop()->screenNumber(q));
- q->move(screen.topLeft());
- q->resize(screen.size());
-
- data.in_set_window_state = old_state;
-}
-
Qt::WindowState effectiveState(Qt::WindowStates state)
{
if (state & Qt::WindowMinimized)
data->window_state = newstate;
data->in_set_window_state = 1;
- bool needShow = false;
Qt::WindowState newEffectiveState = effectiveState(newstate);
Qt::WindowState oldEffectiveState = effectiveState(oldstate);
if (isWindow() && newEffectiveState != oldEffectiveState) {
Q_ASSERT(windowHandle());
windowHandle()->setWindowState(newEffectiveState);
- bool supported = windowHandle()->windowState() == newEffectiveState;
-
- if (!supported) {
- const bool wasResized = testAttribute(Qt::WA_Resized);
- const bool wasMoved = testAttribute(Qt::WA_Moved);
-
- // undo the effects of the old emulated state
- if (oldEffectiveState == Qt::WindowFullScreen) {
- setParent(0, d->topData()->savedFlags);
- needShow = true;
- } else if (oldEffectiveState == Qt::WindowMinimized) {
- needShow = true;
- }
-
- // emulate the new window state
- if (newEffectiveState == Qt::WindowMinimized) {
- //### not ideal...
- hide();
- needShow = false;
- } else if (newEffectiveState == Qt::WindowFullScreen) {
- d->topData()->savedFlags = windowFlags();
- setParent(0, Qt::FramelessWindowHint | (windowFlags() & Qt::WindowStaysOnTopHint));
- d->setFullScreenSize_helper();
- raise();
- needShow = true;
- } else if (newEffectiveState == Qt::WindowMaximized) {
- createWinId();
- d->setMaxWindowState_helper();
- } else if (newEffectiveState == Qt::WindowNoState) {
- // reset old geometry
- QRect r = d->topData()->normalGeometry;
- if (r.width() >= 0) {
- d->topData()->normalGeometry = QRect(0,0,-1,-1);
- setGeometry(r);
- }
- }
-
- // setWindowState() is not an explicit move/resize, same as the supported == true
- // case
- setAttribute(Qt::WA_Resized, wasResized);
- setAttribute(Qt::WA_Moved, wasMoved);
- }
}
data->in_set_window_state = 0;
- if (needShow)
- setVisible(true);
-
if (newstate & Qt::WindowActive)
activateWindow();