mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
b=381494; add optional splashscreen for our slower targets; r=bsmedberg
This commit is contained in:
parent
e7c111742e
commit
24659ba959
@ -658,4 +658,6 @@ MOZ_EMBEDDING_LEVEL_MINIMAL = @MOZ_EMBEDDING_LEVEL_MINIMAL@
|
||||
HAVE_ARM_SIMD = @HAVE_ARM_SIMD@
|
||||
HAVE_ARM_NEON = @HAVE_ARM_NEON@
|
||||
|
||||
MOZ_SPLASHSCREEN = @MOZ_SPLASHSCREEN@
|
||||
|
||||
MOZ_THEME_FASTSTRIPE = @MOZ_THEME_FASTSTRIPE@
|
||||
|
13
configure.in
13
configure.in
@ -4566,6 +4566,7 @@ MOZ_REFLOW_PERF=
|
||||
MOZ_SAFE_BROWSING=
|
||||
MOZ_HELP_VIEWER=
|
||||
MOZ_SPELLCHECK=1
|
||||
MOZ_SPLASHSCREEN=
|
||||
MOZ_STATIC_MAIL_BUILD=
|
||||
MOZ_STORAGE=1
|
||||
MOZ_SVG=1
|
||||
@ -5595,6 +5596,18 @@ linux*)
|
||||
fi
|
||||
fi
|
||||
|
||||
dnl ========================================================
|
||||
dnl Splashscreen
|
||||
dnl ========================================================
|
||||
AC_ARG_ENABLE(splashscreen,
|
||||
[ --enable-splashscreen display splashscreen while loading (default=no)],
|
||||
[enable_splash="yes"],[enable_splash=""])
|
||||
if test "x$enable_splash" = "xyes"; then
|
||||
MOZ_SPLASHSCREEN=1
|
||||
AC_DEFINE(MOZ_SPLASHSCREEN)
|
||||
fi
|
||||
AC_SUBST(MOZ_SPLASHSCREEN)
|
||||
|
||||
dnl ========================================================
|
||||
dnl Permissions System
|
||||
dnl ========================================================
|
||||
|
@ -108,6 +108,14 @@ CPPSRCS = \
|
||||
nsAppData.cpp \
|
||||
$(NULL)
|
||||
|
||||
ifdef MOZ_SPLASHSCREEN
|
||||
ifeq ($(OS_ARCH),WINCE)
|
||||
CPPSRCS += nsSplashScreenWin.cpp
|
||||
else
|
||||
CPPSRCS += nsSplashScreenDummy.cpp
|
||||
endif
|
||||
endif
|
||||
|
||||
DEFINES += -DIMPL_XREAPI
|
||||
|
||||
ifndef BUILD_STATIC_LIBS
|
||||
|
@ -137,6 +137,10 @@
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#if defined(MOZ_SPLASHSCREEN)
|
||||
#include "nsSplashScreen.h"
|
||||
#endif
|
||||
|
||||
#ifdef XP_UNIX
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
@ -2555,9 +2559,22 @@ static void MOZ_gdk_display_close(GdkDisplay *display)
|
||||
*/
|
||||
PRBool nspr_use_zone_allocator = PR_FALSE;
|
||||
|
||||
#ifdef MOZ_SPLASHSCREEN
|
||||
#define MOZ_SPLASHSCREEN_UPDATE(_i) do { if (splashScreen) splashScreen->Update(_i); } while(0)
|
||||
#else
|
||||
#define MOZ_SPLASHSCREEN_UPDATE(_i) do { } while(0)
|
||||
#endif
|
||||
|
||||
int
|
||||
XRE_main(int argc, char* argv[], const nsXREAppData* aAppData)
|
||||
{
|
||||
#ifdef MOZ_SPLASHSCREEN
|
||||
nsSplashScreen *splashScreen =
|
||||
nsSplashScreen::GetOrCreate();
|
||||
if (splashScreen)
|
||||
splashScreen->Open();
|
||||
#endif
|
||||
|
||||
nsresult rv;
|
||||
ArgResult ar;
|
||||
NS_TIMELINE_MARK("enter main");
|
||||
@ -2662,6 +2679,8 @@ XRE_main(int argc, char* argv[], const nsXREAppData* aAppData)
|
||||
}
|
||||
}
|
||||
|
||||
MOZ_SPLASHSCREEN_UPDATE(10);
|
||||
|
||||
ScopedAppData appData(aAppData);
|
||||
gAppData = &appData;
|
||||
|
||||
@ -2897,6 +2916,8 @@ XRE_main(int argc, char* argv[], const nsXREAppData* aAppData)
|
||||
gArgc = argc = NS_TraceMallocStartupArgs(gArgc, gArgv);
|
||||
#endif
|
||||
|
||||
MOZ_SPLASHSCREEN_UPDATE(20);
|
||||
|
||||
{
|
||||
nsXREDirProvider dirProvider;
|
||||
rv = dirProvider.Initialize(gAppData->directory, gAppData->xreDirectory);
|
||||
@ -3144,6 +3165,8 @@ XRE_main(int argc, char* argv[], const nsXREAppData* aAppData)
|
||||
PRBool needsRestart = PR_FALSE;
|
||||
PRBool appInitiatedRestart = PR_FALSE;
|
||||
|
||||
MOZ_SPLASHSCREEN_UPDATE(30);
|
||||
|
||||
// Allows the user to forcefully bypass the restart process at their
|
||||
// own risk. Useful for debugging or for tinderboxes where child
|
||||
// processes can be problematic.
|
||||
@ -3244,6 +3267,8 @@ XRE_main(int argc, char* argv[], const nsXREAppData* aAppData)
|
||||
NS_TIMELINE_LEAVE("appStartup->CreateHiddenWindow");
|
||||
NS_ENSURE_SUCCESS(rv, 1);
|
||||
|
||||
MOZ_SPLASHSCREEN_UPDATE(50);
|
||||
|
||||
// Extension Compatibility Checking and Startup
|
||||
if (gAppData->flags & NS_XRE_ENABLE_EXTENSION_MANAGER) {
|
||||
nsCOMPtr<nsIExtensionManager> em(do_GetService("@mozilla.org/extensions/manager;1"));
|
||||
@ -3304,6 +3329,8 @@ XRE_main(int argc, char* argv[], const nsXREAppData* aAppData)
|
||||
SetupMacApplicationDelegate();
|
||||
#endif
|
||||
|
||||
MOZ_SPLASHSCREEN_UPDATE(70);
|
||||
|
||||
nsCOMPtr<nsIObserverService> obsService
|
||||
(do_GetService("@mozilla.org/observer-service;1"));
|
||||
if (obsService)
|
||||
@ -3336,6 +3363,8 @@ XRE_main(int argc, char* argv[], const nsXREAppData* aAppData)
|
||||
nativeApp->Enable();
|
||||
}
|
||||
|
||||
MOZ_SPLASHSCREEN_UPDATE(90);
|
||||
|
||||
NS_TIMELINE_ENTER("appStartup->Run");
|
||||
rv = appStartup->Run();
|
||||
NS_TIMELINE_LEAVE("appStartup->Run");
|
||||
@ -3389,6 +3418,8 @@ XRE_main(int argc, char* argv[], const nsXREAppData* aAppData)
|
||||
|
||||
// Restart the app after XPCOM has been shut down cleanly.
|
||||
if (needsRestart) {
|
||||
MOZ_SPLASHSCREEN_UPDATE(90);
|
||||
|
||||
if (appInitiatedRestart) {
|
||||
RestoreStateForAppInitiatedRestart();
|
||||
}
|
||||
|
77
toolkit/xre/nsSplashScreen.h
Normal file
77
toolkit/xre/nsSplashScreen.h
Normal file
@ -0,0 +1,77 @@
|
||||
/* -*- Mode: C++; tab-width: 40; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Mozilla code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* mozilla.org
|
||||
* Portions created by the Initial Developer are Copyright (C) 2009
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Vladimir Vukicevic <vladimir@pobox.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef NS_SPLASHSCREEN_H_
|
||||
#define NS_SPLASHSCREEN_H_
|
||||
|
||||
#include "prtypes.h"
|
||||
|
||||
/* Note: This is not XPCOM! This class is used before any Gecko/XPCOM
|
||||
* support has been initialized, so any implementations should take care
|
||||
* to use platform-native methods as much as possible.
|
||||
*/
|
||||
|
||||
class nsSplashScreen {
|
||||
public:
|
||||
// An implementation needs to provide these, to either get
|
||||
// an existing splash screen, or create a new one if GetOrCreate is
|
||||
// used.
|
||||
static nsSplashScreen* GetOrCreate();
|
||||
static nsSplashScreen* Get();
|
||||
public:
|
||||
// Display the splash screen if it's not already displayed.
|
||||
// Also resets progress to 0 and the message to empty.
|
||||
virtual void Open() = 0;
|
||||
virtual void Close() = 0;
|
||||
|
||||
/* Update the splash screen to the given progress value (0..100) */
|
||||
virtual void Update(PRInt32 progress) = 0;
|
||||
|
||||
PRBool IsOpen() { return mIsOpen; }
|
||||
|
||||
protected:
|
||||
nsSplashScreen() : mIsOpen(PR_FALSE) { }
|
||||
PRBool mIsOpen;
|
||||
};
|
||||
|
||||
extern "C" {
|
||||
nsSplashScreen *NS_GetSplashScreen(PRBool create);
|
||||
typedef nsSplashScreen* (*NS_GetSplashScreenPtr) (PRBool);
|
||||
}
|
||||
|
||||
#endif /* NS_SPLASHSCREEN_H_ */
|
51
toolkit/xre/nsSplashScreenDummy.cpp
Normal file
51
toolkit/xre/nsSplashScreenDummy.cpp
Normal file
@ -0,0 +1,51 @@
|
||||
/* -*- Mode: C++; tab-width: 40; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Mozilla code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* mozilla.org
|
||||
* Portions created by the Initial Developer are Copyright (C) 2009
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Vladimir Vukicevic <vladimir@pobox.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsSplashScreen.h"
|
||||
|
||||
nsSplashScreen*
|
||||
nsSplashScreen::Get()
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
nsSplashScreen*
|
||||
nsSplashScreen::GetOrCreate()
|
||||
{
|
||||
return NULL;
|
||||
}
|
310
toolkit/xre/nsSplashScreenWin.cpp
Normal file
310
toolkit/xre/nsSplashScreenWin.cpp
Normal file
@ -0,0 +1,310 @@
|
||||
/* -*- Mode: C++; tab-width: 40; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Mozilla code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* mozilla.org
|
||||
* Portions created by the Initial Developer are Copyright (C) 2009
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Vladimir Vukicevic <vladimir@pobox.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsSplashScreen.h"
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
static ATOM gSplashScreenClass = 0;
|
||||
|
||||
class nsSplashScreenWin;
|
||||
|
||||
static nsSplashScreenWin *gSplashScreen = NULL;
|
||||
|
||||
class nsSplashScreenWin :
|
||||
public nsSplashScreen
|
||||
{
|
||||
public:
|
||||
nsSplashScreenWin();
|
||||
|
||||
virtual void Open();
|
||||
virtual void Close();
|
||||
virtual void Update(PRInt32 progress);
|
||||
|
||||
protected:
|
||||
HWND mDialog;
|
||||
HBITMAP mSplashBitmap, mOldBitmap;
|
||||
HDC mSplashBitmapDC;
|
||||
int mWidth, mHeight;
|
||||
|
||||
static DWORD WINAPI ThreadProc(LPVOID splashScreen);
|
||||
|
||||
static LRESULT CALLBACK DialogProc (HWND hWnd,
|
||||
UINT uMsg,
|
||||
WPARAM wParam,
|
||||
LPARAM lParam);
|
||||
|
||||
void OnPaint(HDC dc, const PAINTSTRUCT *ps);
|
||||
|
||||
PRInt32 mProgress;
|
||||
};
|
||||
|
||||
nsSplashScreen *
|
||||
nsSplashScreen::GetOrCreate()
|
||||
{
|
||||
if (!gSplashScreen)
|
||||
gSplashScreen = new nsSplashScreenWin();
|
||||
|
||||
return gSplashScreen;
|
||||
}
|
||||
|
||||
nsSplashScreen *
|
||||
nsSplashScreen::Get()
|
||||
{
|
||||
return gSplashScreen;
|
||||
}
|
||||
|
||||
nsSplashScreenWin::nsSplashScreenWin()
|
||||
: mDialog(NULL), mSplashBitmap(NULL), mOldBitmap(NULL),
|
||||
mSplashBitmapDC(NULL),
|
||||
mWidth(200), mHeight(100),
|
||||
mProgress(-1)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
nsSplashScreenWin::Open()
|
||||
{
|
||||
if (mIsOpen || mDialog)
|
||||
return;
|
||||
|
||||
mIsOpen = PR_TRUE;
|
||||
|
||||
if (gSplashScreenClass == 0) {
|
||||
WNDCLASS wc;
|
||||
memset(&wc, 0, sizeof(WNDCLASS));
|
||||
|
||||
wc.style = CS_NOCLOSE;
|
||||
wc.lpfnWndProc = (WNDPROC) DialogProc;
|
||||
wc.hInstance = GetModuleHandle(0);
|
||||
wc.hIcon = NULL;
|
||||
wc.hCursor = NULL;
|
||||
wc.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
|
||||
wc.lpszMenuName = NULL;
|
||||
wc.lpszClassName = TEXT("MozillaSplashScreen");
|
||||
|
||||
gSplashScreenClass = RegisterClass(&wc);
|
||||
}
|
||||
|
||||
if (mSplashBitmap == NULL) {
|
||||
wchar_t path[_MAX_PATH];
|
||||
if (::GetModuleFileNameW(0, path, _MAX_PATH)) {
|
||||
wchar_t *slash = wcsrchr(path, '\\');
|
||||
if (slash != NULL)
|
||||
slash[1] = 0;
|
||||
|
||||
wcscat(path, L"splash.bmp");
|
||||
|
||||
#ifdef WINCE
|
||||
mSplashBitmap = ::SHLoadDIBitmap(path);
|
||||
#else
|
||||
#warning splashscreen needs some code to load bitmaps on non-WinCE
|
||||
mSplashBitmap = nsnull;
|
||||
#endif
|
||||
|
||||
if (mSplashBitmap) {
|
||||
BITMAP bmo;
|
||||
if (GetObject(mSplashBitmap, sizeof(BITMAP), &bmo) > 0) {
|
||||
mWidth = bmo.bmWidth;
|
||||
mHeight = bmo.bmHeight;
|
||||
|
||||
mSplashBitmapDC = CreateCompatibleDC(NULL);
|
||||
mOldBitmap = (HBITMAP) SelectObject(mSplashBitmapDC, mSplashBitmap);
|
||||
} else {
|
||||
DeleteObject(mSplashBitmap);
|
||||
mSplashBitmap = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
DWORD threadID = 0;
|
||||
CreateThread(0, 0, (LPTHREAD_START_ROUTINE)ThreadProc, this, 0, &threadID);
|
||||
}
|
||||
|
||||
DWORD WINAPI
|
||||
nsSplashScreenWin::ThreadProc(LPVOID splashScreen)
|
||||
{
|
||||
nsSplashScreenWin *sp = (nsSplashScreenWin*) splashScreen;
|
||||
|
||||
int screenWidth = GetSystemMetrics(SM_CXSCREEN);
|
||||
int screenHeight = GetSystemMetrics(SM_CYSCREEN);
|
||||
|
||||
HWND dlg = CreateWindowEx
|
||||
(WS_EX_NOACTIVATE /* | WS_EX_TOPMOST | WS_EX_TOOLWINDOW*/,
|
||||
TEXT("MozillaSplashScreen"),
|
||||
TEXT("Starting up..."),
|
||||
WS_POPUP | WS_BORDER,
|
||||
(screenWidth - sp->mWidth) / 2,
|
||||
(screenHeight - sp->mHeight) / 2,
|
||||
sp->mWidth, sp->mHeight,
|
||||
HWND_DESKTOP,
|
||||
NULL,
|
||||
GetModuleHandle(0),
|
||||
NULL);
|
||||
|
||||
sp->mDialog = dlg;
|
||||
|
||||
ShowWindow(dlg, SW_SHOW);
|
||||
SetForegroundWindow(dlg);
|
||||
|
||||
MSG msg;
|
||||
while (::GetMessage(&msg, NULL, 0, 0)) {
|
||||
DispatchMessage(&msg);
|
||||
}
|
||||
|
||||
// window was destroyed, nothing to do
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
nsSplashScreenWin::Close()
|
||||
{
|
||||
if (mDialog) {
|
||||
ShowWindow(mDialog, SW_HIDE);
|
||||
PostMessage(mDialog, WM_QUIT, 0, 0);
|
||||
mDialog = NULL;
|
||||
}
|
||||
|
||||
if (mSplashBitmap) {
|
||||
SelectObject(mSplashBitmapDC, mOldBitmap);
|
||||
DeleteObject(mSplashBitmapDC);
|
||||
DeleteObject(mSplashBitmap);
|
||||
mOldBitmap = NULL;
|
||||
mSplashBitmapDC = NULL;
|
||||
mSplashBitmap = NULL;
|
||||
}
|
||||
|
||||
mIsOpen = PR_FALSE;
|
||||
}
|
||||
|
||||
void
|
||||
nsSplashScreenWin::Update(PRInt32 progress)
|
||||
{
|
||||
if (progress >= 0)
|
||||
mProgress = progress > 100 ? 100 : progress;
|
||||
|
||||
InvalidateRect(mDialog, NULL, FALSE);
|
||||
}
|
||||
|
||||
void
|
||||
nsSplashScreenWin::OnPaint(HDC dc, const PAINTSTRUCT *ps)
|
||||
{
|
||||
if (mSplashBitmapDC) {
|
||||
BitBlt(dc,
|
||||
0, 0, gSplashScreen->mWidth, gSplashScreen->mHeight,
|
||||
gSplashScreen->mSplashBitmapDC,
|
||||
0, 0,
|
||||
SRCCOPY);
|
||||
} else {
|
||||
HBRUSH bkgr = CreateSolidBrush(RGB(200,200,200));
|
||||
RECT r = { 0, 0, mWidth, mHeight };
|
||||
FillRect(dc, &r, bkgr);
|
||||
DeleteObject(bkgr);
|
||||
}
|
||||
|
||||
#define BOTTOM_OFFSET 10
|
||||
#define PROGRESS_HEIGHT 11
|
||||
|
||||
if (mProgress != -1) {
|
||||
HBRUSH border = CreateSolidBrush(RGB(0x33,0x33,0x99));
|
||||
HBRUSH fill = CreateSolidBrush(RGB(0x33,0x66,0xFF));
|
||||
|
||||
// the progress bar goes 15 pixels above the bottom of the window,
|
||||
// and is 2/3 of the width. The outer border is 11 px in height,
|
||||
// which will be inset by 2 to draw the fill.
|
||||
int leftBorder = (mWidth * 2 / 3) / 2;
|
||||
|
||||
// left, top, right, bottom
|
||||
RECT outerRect = { leftBorder, mHeight - BOTTOM_OFFSET - PROGRESS_HEIGHT,
|
||||
mWidth - leftBorder, mHeight - BOTTOM_OFFSET };
|
||||
|
||||
|
||||
HBRUSH oldBrush = (HBRUSH)SelectObject(dc, border);
|
||||
MoveToEx(dc, outerRect.left, outerRect.top, (LPPOINT) NULL);
|
||||
LineTo(dc, outerRect.right, outerRect.top);
|
||||
LineTo(dc, outerRect.right, outerRect.bottom);
|
||||
LineTo(dc, outerRect.left, outerRect.bottom);
|
||||
LineTo(dc, outerRect.left, outerRect.top);
|
||||
SelectObject(dc, oldBrush);
|
||||
|
||||
outerRect.top += 2;
|
||||
outerRect.left += 2;
|
||||
outerRect.right -= 2;
|
||||
outerRect.bottom -= 1;
|
||||
|
||||
outerRect.right = outerRect.left + (outerRect.right - outerRect.left) * mProgress / 100;
|
||||
FillRect(dc, &outerRect, fill);
|
||||
|
||||
DeleteObject(border);
|
||||
DeleteObject(fill);
|
||||
}
|
||||
}
|
||||
|
||||
LRESULT CALLBACK
|
||||
nsSplashScreenWin::DialogProc (HWND hWnd,
|
||||
UINT uMsg,
|
||||
WPARAM wParam,
|
||||
LPARAM lParam)
|
||||
{
|
||||
switch (uMsg) {
|
||||
case WM_PAINT: {
|
||||
PAINTSTRUCT ps;
|
||||
HDC dc = BeginPaint(hWnd, &ps);
|
||||
|
||||
if (gSplashScreen)
|
||||
gSplashScreen->OnPaint(dc, &ps);
|
||||
|
||||
EndPaint(hWnd, &ps);
|
||||
return TRUE;
|
||||
}
|
||||
break;
|
||||
|
||||
case WM_DESTROY:
|
||||
return TRUE;
|
||||
|
||||
case WM_QUIT:
|
||||
DestroyWindow(hWnd);
|
||||
return TRUE;
|
||||
|
||||
default:
|
||||
return DefWindowProc(hWnd, uMsg, wParam, lParam);
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
@ -132,6 +132,7 @@ LOCAL_INCLUDES = \
|
||||
-I. \
|
||||
-I$(srcdir)/../xpwidgets \
|
||||
-I$(srcdir) \
|
||||
-I$(topsrcdir)/toolkit/xre \
|
||||
$(NULL)
|
||||
|
||||
FORCE_STATIC_LIB = 1
|
||||
|
@ -86,6 +86,10 @@
|
||||
// the DirectDraw surface or not.
|
||||
#include "cairo-features.h"
|
||||
|
||||
#if defined(MOZ_SPLASHSCREEN)
|
||||
#include "nsSplashScreen.h"
|
||||
#endif
|
||||
|
||||
#ifdef WINCE
|
||||
|
||||
#include "aygshell.h"
|
||||
@ -1643,6 +1647,19 @@ PRBool nsWindow::CanTakeFocus()
|
||||
|
||||
NS_METHOD nsWindow::Show(PRBool bState)
|
||||
{
|
||||
#if defined(MOZ_SPLASHSCREEN)
|
||||
// we're about to show the first toplevel window,
|
||||
// so kill off any splash screen if we had one
|
||||
nsSplashScreen *splash = nsSplashScreen::Get();
|
||||
if (splash && splash->IsOpen() && mWnd && bState &&
|
||||
(mWindowType == eWindowType_toplevel ||
|
||||
mWindowType == eWindowType_dialog ||
|
||||
mWindowType == eWindowType_popup))
|
||||
{
|
||||
splash->Close();
|
||||
}
|
||||
#endif
|
||||
|
||||
PRBool wasVisible = mIsVisible;
|
||||
// Set the status now so that anyone asking during ShowWindow or
|
||||
// SetWindowPos would get the correct answer.
|
||||
|
Loading…
Reference in New Issue
Block a user