From 86dac6fca9a65d4661ecfcf678bd6702011b5d34 Mon Sep 17 00:00:00 2001 From: Doug Turner Date: Fri, 14 Aug 2009 12:56:56 -0700 Subject: [PATCH] Bug 510546 - support for sizemode=fullscreen on gtk2. r=stuart. --- widget/src/gtk2/nsWindow.cpp | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/widget/src/gtk2/nsWindow.cpp b/widget/src/gtk2/nsWindow.cpp index 5dd84d3a749..caeb6d4b037 100644 --- a/widget/src/gtk2/nsWindow.cpp +++ b/widget/src/gtk2/nsWindow.cpp @@ -1018,6 +1018,12 @@ nsWindow::Show(PRBool aState) // If someone is showing this window and it needs a resize then // resize the widget. if (aState) { + + // Sizemode can be set before the window is created. If it is, + // we want to force fullscreen, if needed. + if (mSizeMode == nsSizeMode_Fullscreen) + MakeFullScreen(PR_TRUE); + if (mNeedsMove) { LOG(("\tresizing\n")); NativeResize(mBounds.x, mBounds.y, mBounds.width, mBounds.height, @@ -1280,6 +1286,10 @@ nsWindow::SetSizeMode(PRInt32 aMode) case nsSizeMode_Minimized: gtk_window_iconify(GTK_WINDOW(mShell)); break; + case nsSizeMode_Fullscreen: + MakeFullScreen(PR_TRUE); + break; + default: // nsSizeMode_Normal, really. if (mSizeState == nsSizeMode_Minimized) @@ -3370,6 +3380,11 @@ nsWindow::OnWindowStateEvent(GtkWidget *aWidget, GdkEventWindowState *aEvent) event.mSizeMode = nsSizeMode_Maximized; mSizeState = nsSizeMode_Maximized; } + else if (aEvent->new_window_state & GDK_WINDOW_STATE_FULLSCREEN) { + LOG(("\tFullscreen\n")); + event.mSizeMode = nsSizeMode_Fullscreen; + mSizeState = nsSizeMode_Fullscreen; + } else { LOG(("\tNormal\n")); event.mSizeMode = nsSizeMode_Normal; @@ -4981,9 +4996,14 @@ nsWindow::ConvertBorderStyles(nsBorderStyle aStyle) NS_IMETHODIMP nsWindow::MakeFullScreen(PRBool aFullScreen) { + LOG(("nsWindow::MakeFullScreen [%p] aFullScreen %d\n", + (void *)this, aFullScreen)); + #if GTK_CHECK_VERSION(2,2,0) - if (aFullScreen) + if (aFullScreen) { + mSizeMode = nsSizeMode_Fullscreen; gdk_window_fullscreen (mShell->window); + } else gdk_window_unfullscreen (mShell->window); return NS_OK;