Bug 1161802 part 1 - Add FullscreenChanged callback in WidgetListener. r=roc

--HG--
extra : source : dcfb961149d8c8e56ff787fa812dc781a491ee53
This commit is contained in:
Xidorn Quan 2015-06-10 23:13:12 +12:00
parent 76eb787ad4
commit 7699870266
6 changed files with 28 additions and 2 deletions

View File

@ -1279,6 +1279,9 @@ void nsCocoaWindow::EnteredFullScreen(bool aFullScreen, bool aNativeMode)
mInNativeFullScreenMode = aFullScreen;
}
DispatchSizeModeEvent();
if (mWidgetListener) {
mWidgetListener->FullscreenChanged(aFullScreen);
}
}
inline bool nsCocoaWindow::ShouldToggleNativeFullscreen(bool aFullScreen)

View File

@ -605,6 +605,10 @@ nsWindow::MakeFullScreen(bool aFullScreen, nsIScreen*)
virtualBounds.width, virtualBounds.height,
/*repaint*/true);
}
if (nsIWidgetListener* listener = GetWidgetListener()) {
listener->FullscreenChanged(aFullScreen);
}
return NS_OK;
}

View File

@ -3256,6 +3256,7 @@ nsWindow::OnWindowStateEvent(GtkWidget *aWidget, GdkEventWindowState *aEvent)
return;
}
bool wasInFullscreen = mSizeState == nsSizeMode_Fullscreen;
if (aEvent->new_window_state & GDK_WINDOW_STATE_ICONIFIED) {
LOG(("\tIconified\n"));
mSizeState = nsSizeMode_Minimized;
@ -3282,8 +3283,14 @@ nsWindow::OnWindowStateEvent(GtkWidget *aWidget, GdkEventWindowState *aEvent)
#endif //ACCESSIBILITY
}
if (mWidgetListener)
if (mWidgetListener) {
mWidgetListener->SizeModeChanged(mSizeState);
bool isInFullscreen = mSizeState == nsSizeMode_Fullscreen;
if (isInFullscreen != wasInFullscreen) {
mWidgetListener->FullscreenChanged(isInFullscreen);
}
}
}
void

View File

@ -54,6 +54,11 @@ nsIWidgetListener::SizeModeChanged(nsSizeMode aSizeMode)
{
}
void
nsIWidgetListener::FullscreenChanged(bool aInFullscreen)
{
}
bool
nsIWidgetListener::ZLevelChanged(bool aImmediate,
nsWindowZ* aPlacement,

View File

@ -86,6 +86,11 @@ public:
nsIWidget* aRequestBelow,
nsIWidget** aActualBelow);
/**
* Called when the window entered or left the fullscreen state.
*/
virtual void FullscreenChanged(bool aInFullscreen);
/**
* Called when the window is activated and focused.
*/

View File

@ -2897,8 +2897,10 @@ nsWindow::MakeFullScreen(bool aFullScreen, nsIScreen* aTargetScreen)
taskbarInfo->PrepareFullScreenHWND(mWnd, FALSE);
}
if (mWidgetListener)
if (mWidgetListener) {
mWidgetListener->SizeModeChanged(mSizeMode);
mWidgetListener->FullscreenChanged(aFullScreen);
}
return rv;
}