macOS: Use same naming for QPA event forwarding functions

Expose events and others will follow.

Change-Id: I8e11a133381a678517b54ad1872fe302515d4104
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
This commit is contained in:
Tor Arne Vestbø 2017-07-05 14:12:42 +02:00
parent 0e0034d93a
commit 920ba35397
2 changed files with 26 additions and 22 deletions

View File

@ -149,8 +149,6 @@ public:
bool windowShouldClose(); bool windowShouldClose();
bool windowIsPopupType(Qt::WindowType type = Qt::Widget) const; bool windowIsPopupType(Qt::WindowType type = Qt::Widget) const;
void reportCurrentWindowState(bool unconditionally = false);
NSInteger windowLevel(Qt::WindowFlags flags); NSInteger windowLevel(Qt::WindowFlags flags);
NSUInteger windowStyleMask(Qt::WindowFlags flags); NSUInteger windowStyleMask(Qt::WindowFlags flags);
void setWindowZoomButton(Qt::WindowFlags flags); void setWindowZoomButton(Qt::WindowFlags flags);
@ -226,7 +224,13 @@ public: // for QNSView
bool alwaysShowToolWindow() const; bool alwaysShowToolWindow() const;
void removeMonitor(); void removeMonitor();
enum HandleFlags {
NoHandleFlags = 0,
HandleUnconditionally = 1
};
void handleGeometryChange(); void handleGeometryChange();
void handleWindowStateChanged(HandleFlags flags = NoHandleFlags);
NSView *m_view; NSView *m_view;
QCocoaNSWindow *m_nsWindow; QCocoaNSWindow *m_nsWindow;

View File

@ -840,7 +840,7 @@ void QCocoaWindow::windowDidMove()
handleGeometryChange(); handleGeometryChange();
// Moving a window might bring it out of maximized state // Moving a window might bring it out of maximized state
reportCurrentWindowState(); handleWindowStateChanged();
} }
void QCocoaWindow::windowDidResize() void QCocoaWindow::windowDidResize()
@ -851,7 +851,7 @@ void QCocoaWindow::windowDidResize()
handleGeometryChange(); handleGeometryChange();
if (!m_view.inLiveResize) if (!m_view.inLiveResize)
reportCurrentWindowState(); handleWindowStateChanged();
} }
void QCocoaWindow::viewDidChangeFrame() void QCocoaWindow::viewDidChangeFrame()
@ -873,7 +873,7 @@ void QCocoaWindow::viewDidChangeGlobalFrame()
void QCocoaWindow::windowDidEndLiveResize() void QCocoaWindow::windowDidEndLiveResize()
{ {
reportCurrentWindowState(); handleWindowStateChanged();
} }
void QCocoaWindow::windowDidBecomeKey() void QCocoaWindow::windowDidBecomeKey()
@ -910,12 +910,12 @@ void QCocoaWindow::windowDidResignKey()
void QCocoaWindow::windowDidMiniaturize() void QCocoaWindow::windowDidMiniaturize()
{ {
reportCurrentWindowState(); handleWindowStateChanged();
} }
void QCocoaWindow::windowDidDeminiaturize() void QCocoaWindow::windowDidDeminiaturize()
{ {
reportCurrentWindowState(); handleWindowStateChanged();
} }
void QCocoaWindow::windowWillEnterFullScreen() void QCocoaWindow::windowWillEnterFullScreen()
@ -934,7 +934,7 @@ void QCocoaWindow::windowDidEnterFullScreen()
// Reset to original styleMask // Reset to original styleMask
setWindowFlags(m_windowFlags); setWindowFlags(m_windowFlags);
reportCurrentWindowState(); handleWindowStateChanged();
} }
void QCocoaWindow::windowWillExitFullScreen() void QCocoaWindow::windowWillExitFullScreen()
@ -955,7 +955,7 @@ void QCocoaWindow::windowDidExitFullScreen()
Qt::WindowState requestedState = window()->windowState(); Qt::WindowState requestedState = window()->windowState();
// Deliver update of QWindow state // Deliver update of QWindow state
reportCurrentWindowState(); handleWindowStateChanged();
if (requestedState != windowState() && requestedState != Qt::WindowFullScreen) { if (requestedState != windowState() && requestedState != Qt::WindowFullScreen) {
// We were only going out of full screen as an intermediate step before // We were only going out of full screen as an intermediate step before
@ -1071,6 +1071,17 @@ void QCocoaWindow::handleGeometryChange()
[qnsview_cast(m_view) clearBackingStore]; [qnsview_cast(m_view) clearBackingStore];
} }
void QCocoaWindow::handleWindowStateChanged(HandleFlags flags)
{
Qt::WindowState currentState = windowState();
if (!(flags & HandleUnconditionally) && currentState == m_lastReportedWindowState)
return;
QWindowSystemInterface::handleWindowStateChanged<QWindowSystemInterface::SynchronousDelivery>(
window(), currentState, m_lastReportedWindowState);
m_lastReportedWindowState = currentState;
}
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
bool QCocoaWindow::windowIsPopupType(Qt::WindowType type) const bool QCocoaWindow::windowIsPopupType(Qt::WindowType type) const
@ -1344,7 +1355,7 @@ void QCocoaWindow::applyWindowState(Qt::WindowStates requestedState)
// If content view width or height is 0 then the window animations will crash so // If content view width or height is 0 then the window animations will crash so
// do nothing. We report the current state back to reflect the failed operation. // do nothing. We report the current state back to reflect the failed operation.
qWarning("invalid window content view size, check your window geometry"); qWarning("invalid window content view size, check your window geometry");
reportCurrentWindowState(true); handleWindowStateChanged(HandleUnconditionally);
return; return;
} }
@ -1353,7 +1364,7 @@ void QCocoaWindow::applyWindowState(Qt::WindowStates requestedState)
if (nsWindow.styleMask & NSUtilityWindowMask if (nsWindow.styleMask & NSUtilityWindowMask
&& newState & (Qt::WindowMinimized | Qt::WindowFullScreen)) { && newState & (Qt::WindowMinimized | Qt::WindowFullScreen)) {
qWarning() << window()->type() << "windows can not be made" << newState; qWarning() << window()->type() << "windows can not be made" << newState;
reportCurrentWindowState(true); handleWindowStateChanged(HandleUnconditionally);
return; return;
} }
@ -1453,17 +1464,6 @@ Qt::WindowState QCocoaWindow::windowState() const
return Qt::WindowNoState; return Qt::WindowNoState;
} }
void QCocoaWindow::reportCurrentWindowState(bool unconditionally)
{
Qt::WindowState currentState = windowState();
if (!unconditionally && currentState == m_lastReportedWindowState)
return;
QWindowSystemInterface::handleWindowStateChanged<QWindowSystemInterface::SynchronousDelivery>(
window(), currentState, m_lastReportedWindowState);
m_lastReportedWindowState = currentState;
}
bool QCocoaWindow::setWindowModified(bool modified) bool QCocoaWindow::setWindowModified(bool modified)
{ {
if (!isContentView()) if (!isContentView())