mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 750901 - Elm to mc migration work - metro related changes to Windows widget src to support building metro winrt bits (nsWidgetFactory, nsWindowGfx, nsToolkit, WinUtils). Also landing nsIWinMetroUtils.idl. r=bbondy
This commit is contained in:
parent
b3f2128c0c
commit
d85ffc372c
@ -141,6 +141,10 @@ XPIDLSRCS += nsIPrintSettingsWin.idl \
|
||||
$(NULL)
|
||||
endif
|
||||
|
||||
ifdef MOZ_METRO
|
||||
XPIDLSRCS += nsIWinMetroUtils.idl
|
||||
endif
|
||||
|
||||
ifeq ($(MOZ_WIDGET_TOOLKIT),cocoa)
|
||||
XPIDLSRCS += nsIMacDockSupport.idl \
|
||||
nsIStandaloneNativeMenu.idl \
|
||||
|
122
widget/nsIWinMetroUtils.idl
Normal file
122
widget/nsIWinMetroUtils.idl
Normal file
@ -0,0 +1,122 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
/**
|
||||
* Integration with the "Metro"/"Modern" UI environment in Windows 8.
|
||||
*
|
||||
* Note: browser/metro/base/content/browser-scripts.js contains a stub
|
||||
* implementation of this interface for non-Windows systems, for testing and
|
||||
* development purposes only.
|
||||
*/
|
||||
[scriptable, uuid(45656788-B111-4317-B054-FFE881A0737E)]
|
||||
interface nsIWinMetroUtils : nsISupports
|
||||
{
|
||||
/* Fullscreen landscape orientation */
|
||||
const long fullScreenLandscape = 0;
|
||||
/* Larger snapped state */
|
||||
const long filled = 1;
|
||||
/* Smaller snapped state */
|
||||
const long snapped = 2;
|
||||
/* Fullscreen portrait orientation */
|
||||
const long fullScreenPortrait = 3;
|
||||
|
||||
/* return constants for the handPreference property */
|
||||
const long handPreferenceLeft = 0;
|
||||
const long handPreferenceRight = 1;
|
||||
|
||||
/**
|
||||
* Determines the current snapped state.
|
||||
*/
|
||||
readonly attribute long snappedState;
|
||||
|
||||
/**
|
||||
* Determine if the current browser is running in the metro immersive
|
||||
* environment.
|
||||
*/
|
||||
readonly attribute boolean immersive;
|
||||
|
||||
/**
|
||||
* Determine if the user prefers left handed or right handed input.
|
||||
*/
|
||||
readonly attribute long handPreference;
|
||||
|
||||
/**
|
||||
* Attempts to unsnap the application from snapped state to filled state
|
||||
*/
|
||||
void unsnap();
|
||||
|
||||
/**
|
||||
* Launches the specified application with the specified arguments and
|
||||
* switches to Desktop mode if in metro mode.
|
||||
*/
|
||||
void launchInDesktop(in AString aPath, in AString aArguments);
|
||||
|
||||
/**
|
||||
* Secondary tiles are a Windows 8 specific feature for pinning new tiles
|
||||
* to the start screen. Tiles can later be activated whether the browser is
|
||||
* already opened or not.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Pins a new tile to the Windows 8 start screen.
|
||||
*
|
||||
* @param aTileID An ID which can later be used to remove the tile
|
||||
* @param aShortName A short name for the tile
|
||||
* @param aDiplayName The name that will be displayed on the tile
|
||||
* @param aActivationArgs The arguments to pass to the browser upon
|
||||
* activation of the tile
|
||||
* @param aTileImage An image for the normal tile view
|
||||
* @param aSmallTileImage An image for the small tile view
|
||||
*/
|
||||
void pinTileAsync(in AString aTileID,
|
||||
in AString aShortName,
|
||||
in AString aDisplayName,
|
||||
in AString aActivationArgs,
|
||||
in AString aTileImage,
|
||||
in AString aSmallTileImage);
|
||||
|
||||
/**
|
||||
* Unpins a tile from the Windows 8 start screen.
|
||||
*
|
||||
* @param aTileID An existing ID which was previously pinned
|
||||
*/
|
||||
void unpinTileAsync(in AString aTileID);
|
||||
|
||||
/**
|
||||
* Determines if a tile is pinned to the Windows 8 start screen.
|
||||
*
|
||||
* @param aTileID An ID which may have been pinned with pinTileAsync
|
||||
* @return true if the tile is pinned
|
||||
*/
|
||||
bool isTilePinned(in AString aTileID);
|
||||
|
||||
/**
|
||||
* Soft keyboard attributes. Used in unison with shown/hidden observer
|
||||
* events sent via FrameworkView.
|
||||
*
|
||||
* keyboardVisible - returns true if the soft keyboard is currently
|
||||
* displayed, false otherwise.
|
||||
* keyboardX, keyboardY, keyboardWidth, keyboardHeight - occlude rect
|
||||
* of the keyboard when displayed in device independent pixels.
|
||||
*/
|
||||
readonly attribute boolean keyboardVisible;
|
||||
readonly attribute unsigned long keyboardX;
|
||||
readonly attribute unsigned long keyboardY;
|
||||
readonly attribute unsigned long keyboardWidth;
|
||||
readonly attribute unsigned long keyboardHeight;
|
||||
|
||||
/**
|
||||
* Settings panel links. addSettingsPanelEntry adds an entry to
|
||||
* the settings flyout panel that the user can invoke.
|
||||
*
|
||||
* @param aChromePanelId panel id invoked via nsIBrowserDOMWindow's
|
||||
* ShowPanel api. Example: 'prefs-container'
|
||||
* @param aLabel Localized string label displayed in the settings
|
||||
* flyout panel for this option.
|
||||
*/
|
||||
void addSettingsPanelEntry(in AString aChromePanelId, in AString aLabel);
|
||||
};
|
@ -113,6 +113,10 @@
|
||||
#define NS_WIN_JUMPLISTBUILDER_CID \
|
||||
{ 0x73a5946f, 0x608d, 0x454f, { 0x9d, 0x33, 0xb, 0x8f, 0x8c, 0x72, 0x94, 0xb6 } }
|
||||
|
||||
// {DE95B8C9-F0E8-4AD5-95A2-06C12F53EC2E}
|
||||
#define NS_WIN_METROUTILS_CID \
|
||||
{ 0xde95b8c9, 0xf0e8, 0x4ad5, { 0x95, 0xa2, 0x06, 0xc1, 0x2f, 0x53, 0xec, 0x2e }}
|
||||
|
||||
// {2B9A1F2C-27CE-45b6-8D4E-755D0E34F8DB}
|
||||
#define NS_WIN_JUMPLISTITEM_CID \
|
||||
{ 0x2b9a1f2c, 0x27ce, 0x45b6, { 0x8d, 0x4e, 0x75, 0x5d, 0x0e, 0x34, 0xf8, 0xdb } }
|
||||
|
@ -4,6 +4,9 @@
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "nsAutoPtr.h"
|
||||
#include "nsString.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace widget {
|
||||
|
||||
|
@ -18,6 +18,10 @@ RESFILE = widget.res
|
||||
MODULE_NAME = nsWidgetWinModule
|
||||
LIBXUL_LIBRARY = 1
|
||||
|
||||
ifdef MOZ_METRO
|
||||
DIRS = winrt
|
||||
endif
|
||||
|
||||
CPPSRCS = \
|
||||
nsWindow.cpp \
|
||||
nsWindowGfx.cpp \
|
||||
|
@ -240,6 +240,11 @@ WinTaskbar::~WinTaskbar() {
|
||||
// static
|
||||
bool
|
||||
WinTaskbar::GetAppUserModelID(nsAString & aDefaultGroupId) {
|
||||
// For win8 metro builds, we can't set this. The value is static
|
||||
// for the app.
|
||||
if (XRE_GetWindowsEnvironment() == WindowsEnvironmentType_Metro) {
|
||||
return false;
|
||||
}
|
||||
// If marked as such in prefs, use a hash of the profile path for the id
|
||||
// instead of the install path hash setup by the installer.
|
||||
bool useProfile =
|
||||
|
@ -900,5 +900,44 @@ WinUtils::GetShellItemPath(IShellItem* aItem,
|
||||
return !aResultString.IsEmpty();
|
||||
}
|
||||
|
||||
/* static */
|
||||
nsIntRegion
|
||||
WinUtils::ConvertHRGNToRegion(HRGN aRgn)
|
||||
{
|
||||
NS_ASSERTION(aRgn, "Don't pass NULL region here");
|
||||
|
||||
nsIntRegion rgn;
|
||||
|
||||
DWORD size = ::GetRegionData(aRgn, 0, NULL);
|
||||
nsAutoTArray<PRUint8,100> buffer;
|
||||
if (!buffer.SetLength(size))
|
||||
return rgn;
|
||||
|
||||
RGNDATA* data = reinterpret_cast<RGNDATA*>(buffer.Elements());
|
||||
if (!::GetRegionData(aRgn, size, data))
|
||||
return rgn;
|
||||
|
||||
if (data->rdh.nCount > MAX_RECTS_IN_REGION) {
|
||||
rgn = ToIntRect(data->rdh.rcBound);
|
||||
return rgn;
|
||||
}
|
||||
|
||||
RECT* rects = reinterpret_cast<RECT*>(data->Buffer);
|
||||
for (PRUint32 i = 0; i < data->rdh.nCount; ++i) {
|
||||
RECT* r = rects + i;
|
||||
rgn.Or(rgn, ToIntRect(*r));
|
||||
}
|
||||
|
||||
return rgn;
|
||||
}
|
||||
|
||||
nsIntRect
|
||||
WinUtils::ToIntRect(const RECT& aRect)
|
||||
{
|
||||
return nsIntRect(aRect.left, aRect.top,
|
||||
aRect.right - aRect.left,
|
||||
aRect.bottom - aRect.top);
|
||||
}
|
||||
|
||||
} // namespace widget
|
||||
} // namespace mozilla
|
||||
|
@ -11,6 +11,8 @@
|
||||
#include <shobjidl.h>
|
||||
#include "nsAutoPtr.h"
|
||||
#include "nsString.h"
|
||||
#include "nsRegion.h"
|
||||
#include "nsRect.h"
|
||||
|
||||
#include "nsThreadUtils.h"
|
||||
#include "nsICryptoHash.h"
|
||||
@ -202,6 +204,22 @@ public:
|
||||
static bool GetShellItemPath(IShellItem* aItem,
|
||||
nsString& aResultString);
|
||||
|
||||
/**
|
||||
* ConvertHRGNToRegion converts a Windows HRGN to an nsIntRegion.
|
||||
*
|
||||
* aRgn the HRGN to convert.
|
||||
* returns the nsIntRegion.
|
||||
*/
|
||||
static nsIntRegion ConvertHRGNToRegion(HRGN aRgn);
|
||||
|
||||
/**
|
||||
* ToIntRect converts a Windows RECT to a nsIntRect.
|
||||
*
|
||||
* aRect the RECT to convert.
|
||||
* returns the nsIntRect.
|
||||
*/
|
||||
static nsIntRect ToIntRect(const RECT& aRect);
|
||||
|
||||
private:
|
||||
typedef HRESULT (WINAPI * SHCreateItemFromParsingNamePtr)(PCWSTR pszPath,
|
||||
IBindCtx *pbc,
|
||||
|
@ -22,12 +22,9 @@
|
||||
const PRUnichar* kAppShellEventId = L"nsAppShell:EventID";
|
||||
const PRUnichar* kTaskbarButtonEventId = L"TaskbarButtonCreated";
|
||||
|
||||
// The maximum time we allow before forcing a native event callback
|
||||
#define NATIVE_EVENT_STARVATION_LIMIT mozilla::TimeDuration::FromSeconds(1)
|
||||
|
||||
static UINT sMsgId;
|
||||
|
||||
static UINT sTaskbarButtonCreatedMsg;
|
||||
UINT sTaskbarButtonCreatedMsg;
|
||||
|
||||
/* static */
|
||||
UINT nsAppShell::GetTaskbarButtonCreatedMessage() {
|
||||
@ -241,6 +238,12 @@ nsAppShell::Run(void)
|
||||
|
||||
#endif
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAppShell::Exit(void)
|
||||
{
|
||||
return nsBaseAppShell::Exit();
|
||||
}
|
||||
|
||||
void
|
||||
nsAppShell::DoProcessMoreGeckoEvents()
|
||||
{
|
||||
|
@ -10,6 +10,9 @@
|
||||
#include <windows.h>
|
||||
#include "mozilla/TimeStamp.h"
|
||||
|
||||
// The maximum time we allow before forcing a native event callback
|
||||
#define NATIVE_EVENT_STARVATION_LIMIT mozilla::TimeDuration::FromSeconds(1)
|
||||
|
||||
/**
|
||||
* Native Win32 Application shell wrapper
|
||||
*/
|
||||
@ -31,6 +34,7 @@ protected:
|
||||
#if defined(_MSC_VER) && defined(_M_IX86)
|
||||
NS_IMETHOD Run();
|
||||
#endif
|
||||
NS_IMETHOD Exit();
|
||||
virtual void ScheduleNativeEventCallback();
|
||||
virtual bool ProcessNextNativeEvent(bool mayWait);
|
||||
virtual ~nsAppShell();
|
||||
|
@ -272,8 +272,10 @@ nsresult nsClipboard::GetGlobalData(HGLOBAL aHGBL, void ** aData, uint32_t * aLe
|
||||
|
||||
result = NS_OK;
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
#ifdef MOZ_METRO
|
||||
return result;
|
||||
#endif
|
||||
// We really shouldn't ever get here
|
||||
// but just in case
|
||||
*aData = nullptr;
|
||||
@ -301,12 +303,12 @@ nsresult nsClipboard::GetGlobalData(HGLOBAL aHGBL, void ** aData, uint32_t * aLe
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
nsresult nsClipboard::GetNativeDataOffClipboard(nsIWidget * aWindow, UINT /*aIndex*/, UINT aFormat, void ** aData, uint32_t * aLen)
|
||||
nsresult nsClipboard::GetNativeDataOffClipboard(nsIWidget * aWidget, UINT /*aIndex*/, UINT aFormat, void ** aData, uint32_t * aLen)
|
||||
{
|
||||
HGLOBAL hglb;
|
||||
nsresult result = NS_ERROR_FAILURE;
|
||||
|
||||
HWND nativeWin = nullptr;//(HWND)aWindow->GetNativeData(NS_NATIVE_WINDOW);
|
||||
HWND nativeWin = (HWND)aWidget->GetNativeData(NS_NATIVE_WINDOW);
|
||||
if (::OpenClipboard(nativeWin)) {
|
||||
hglb = ::GetClipboardData(aFormat);
|
||||
result = GetGlobalData(hglb, aData, aLen);
|
||||
|
@ -6,7 +6,6 @@
|
||||
#include "nsLookAndFeel.h"
|
||||
#include <windows.h>
|
||||
#include <shellapi.h>
|
||||
#include "nsWindow.h"
|
||||
#include "nsStyleConsts.h"
|
||||
#include "nsUXThemeData.h"
|
||||
#include "nsUXThemeConstants.h"
|
||||
|
@ -104,6 +104,3 @@ protected:
|
||||
|
||||
bool IsMenuActive(nsIFrame* aFrame, uint8_t aWidgetType);
|
||||
};
|
||||
|
||||
// Creator function
|
||||
extern NS_METHOD NS_NewNativeThemeWin(nsISupports *aOuter, REFNSIID aIID, void **aResult);
|
||||
|
@ -27,7 +27,9 @@ static const unsigned long kD3DUsageDelay = 5000;
|
||||
static void
|
||||
StartAllowingD3D9(nsITimer *aTimer, void *aClosure)
|
||||
{
|
||||
nsWindow::StartAllowingD3D9(true);
|
||||
if (XRE_GetWindowsEnvironment() == WindowsEnvironmentType_Desktop) {
|
||||
nsWindow::StartAllowingD3D9(true);
|
||||
}
|
||||
}
|
||||
|
||||
MouseTrailer* nsToolkit::gMouseTrailer;
|
||||
@ -47,11 +49,13 @@ nsToolkit::nsToolkit()
|
||||
|
||||
gMouseTrailer = &mMouseTrailer;
|
||||
|
||||
mD3D9Timer = do_CreateInstance("@mozilla.org/timer;1");
|
||||
mD3D9Timer->InitWithFuncCallback(::StartAllowingD3D9,
|
||||
NULL,
|
||||
kD3DUsageDelay,
|
||||
nsITimer::TYPE_ONE_SHOT);
|
||||
if (XRE_GetWindowsEnvironment() == WindowsEnvironmentType_Desktop) {
|
||||
mD3D9Timer = do_CreateInstance("@mozilla.org/timer;1");
|
||||
mD3D9Timer->InitWithFuncCallback(::StartAllowingD3D9,
|
||||
NULL,
|
||||
kD3DUsageDelay,
|
||||
nsITimer::TYPE_ONE_SHOT);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -83,8 +87,10 @@ nsToolkit::Shutdown()
|
||||
void
|
||||
nsToolkit::StartAllowingD3D9()
|
||||
{
|
||||
nsToolkit::GetToolkit()->mD3D9Timer->Cancel();
|
||||
nsWindow::StartAllowingD3D9(false);
|
||||
if (XRE_GetWindowsEnvironment() == WindowsEnvironmentType_Desktop) {
|
||||
nsToolkit::GetToolkit()->mD3D9Timer->Cancel();
|
||||
nsWindow::StartAllowingD3D9(false);
|
||||
}
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
|
@ -8,35 +8,46 @@
|
||||
#include "nsISupports.h"
|
||||
#include "nsdefs.h"
|
||||
#include "nsWidgetsCID.h"
|
||||
|
||||
#include "nsAppShell.h"
|
||||
#include "nsAppShellSingleton.h"
|
||||
#include "nsFilePicker.h"
|
||||
#include "mozilla/ModuleUtils.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsIdleServiceWin.h"
|
||||
#include "nsLookAndFeel.h"
|
||||
#include "nsNativeThemeWin.h"
|
||||
#include "nsScreenManagerWin.h"
|
||||
#include "nsSound.h"
|
||||
#include "nsWindow.h"
|
||||
#include "WinMouseScrollHandler.h"
|
||||
#include "WinTaskbar.h"
|
||||
#include "JumpListBuilder.h"
|
||||
#include "JumpListItem.h"
|
||||
#include "GfxInfo.h"
|
||||
#include "nsToolkit.h"
|
||||
|
||||
// Modules that switch out based on the environment
|
||||
#include "nsXULAppAPI.h"
|
||||
// Desktop
|
||||
#include "nsFilePicker.h" // needs to be included before other shobjidl.h includes
|
||||
#include "nsNativeThemeWin.h"
|
||||
#include "nsWindow.h"
|
||||
// Content processes
|
||||
#include "nsFilePickerProxy.h"
|
||||
// Metro
|
||||
#ifdef MOZ_METRO
|
||||
#include "winrt/MetroAppShell.h"
|
||||
#include "winrt/MetroWidget.h"
|
||||
#include "winrt/nsMetroFilePicker.h"
|
||||
#include "winrt/nsWinMetroUtils.h"
|
||||
#endif
|
||||
|
||||
// Drag & Drop, Clipboard
|
||||
|
||||
#include "nsClipboardHelper.h"
|
||||
|
||||
#include "nsClipboard.h"
|
||||
#include "nsBidiKeyboard.h"
|
||||
#include "nsDragService.h"
|
||||
#include "nsTransferable.h"
|
||||
#include "nsHTMLFormatConverter.h"
|
||||
|
||||
#include "WinTaskbar.h"
|
||||
#include "JumpListBuilder.h"
|
||||
#include "JumpListItem.h"
|
||||
|
||||
#ifdef NS_PRINTING
|
||||
#include "nsDeviceContextSpecWin.h"
|
||||
#include "nsPrintOptionsWin.h"
|
||||
@ -45,21 +56,98 @@
|
||||
|
||||
using namespace mozilla::widget;
|
||||
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsWindow)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(ChildWindow)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsFilePicker)
|
||||
static nsresult
|
||||
WindowConstructor(nsISupports *aOuter, REFNSIID aIID,
|
||||
void **aResult)
|
||||
{
|
||||
*aResult = nullptr;
|
||||
if (aOuter != nullptr) {
|
||||
return NS_ERROR_NO_AGGREGATION;
|
||||
}
|
||||
nsCOMPtr<nsIWidget> widget;
|
||||
|
||||
if (XRE_GetWindowsEnvironment() == WindowsEnvironmentType_Metro) {
|
||||
#ifdef MOZ_METRO
|
||||
widget = new MetroWidget;
|
||||
#else
|
||||
NS_RUNTIMEABORT("build does not support metro.");
|
||||
#endif
|
||||
} else {
|
||||
widget = new nsWindow;
|
||||
}
|
||||
|
||||
return widget->QueryInterface(aIID, aResult);
|
||||
}
|
||||
|
||||
static nsresult
|
||||
ChildWindowConstructor(nsISupports *aOuter, REFNSIID aIID,
|
||||
void **aResult)
|
||||
{
|
||||
*aResult = nullptr;
|
||||
if (aOuter != nullptr) {
|
||||
return NS_ERROR_NO_AGGREGATION;
|
||||
}
|
||||
nsCOMPtr<nsIWidget> widget;
|
||||
|
||||
if (XRE_GetWindowsEnvironment() == WindowsEnvironmentType_Metro) {
|
||||
return NS_NOINTERFACE;
|
||||
} else {
|
||||
widget = new ChildWindow;
|
||||
}
|
||||
|
||||
return widget->QueryInterface(aIID, aResult);
|
||||
}
|
||||
|
||||
static nsresult
|
||||
FilePickerConstructor(nsISupports *aOuter, REFNSIID aIID,
|
||||
void **aResult)
|
||||
{
|
||||
*aResult = nullptr;
|
||||
if (aOuter != nullptr) {
|
||||
return NS_ERROR_NO_AGGREGATION;
|
||||
}
|
||||
nsCOMPtr<nsIFilePicker> picker;
|
||||
|
||||
if (XRE_GetProcessType() == GeckoProcessType_Content) {
|
||||
picker = new nsFilePickerProxy();
|
||||
} else {
|
||||
if (XRE_GetWindowsEnvironment() == WindowsEnvironmentType_Metro) {
|
||||
#ifdef MOZ_METRO
|
||||
picker = new nsMetroFilePicker;
|
||||
#else
|
||||
NS_RUNTIMEABORT("build does not support metro.");
|
||||
#endif
|
||||
} else {
|
||||
picker = new nsFilePicker;
|
||||
}
|
||||
}
|
||||
return picker->QueryInterface(aIID, aResult);
|
||||
}
|
||||
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsScreenManagerWin)
|
||||
NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsIdleServiceWin, nsIdleServiceWin::GetInstance)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsClipboard)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsClipboardHelper)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsSound)
|
||||
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(WinTaskbar)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(JumpListBuilder)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(JumpListItem)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(JumpListSeparator)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(JumpListLink)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(JumpListShortcut)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsTransferable)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsHTMLFormatConverter)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsDragService)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsBidiKeyboard)
|
||||
#ifdef MOZ_METRO
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsWinMetroUtils)
|
||||
#endif
|
||||
#ifdef NS_PRINTING
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsPrintOptionsWin, Init)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsPrinterEnumeratorWin)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsPrintSession, Init)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsDeviceContextSpecWin)
|
||||
#endif
|
||||
|
||||
namespace mozilla {
|
||||
namespace widget {
|
||||
@ -68,18 +156,6 @@ NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(GfxInfo, Init);
|
||||
}
|
||||
}
|
||||
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsTransferable)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsHTMLFormatConverter)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsDragService)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsBidiKeyboard)
|
||||
|
||||
#ifdef NS_PRINTING
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsPrintOptionsWin, Init)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsPrinterEnumeratorWin)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsPrintSession, Init)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsDeviceContextSpecWin)
|
||||
#endif
|
||||
|
||||
NS_DEFINE_NAMED_CID(NS_WINDOW_CID);
|
||||
NS_DEFINE_NAMED_CID(NS_CHILD_CID);
|
||||
NS_DEFINE_NAMED_CID(NS_FILEPICKER_CID);
|
||||
@ -93,17 +169,17 @@ NS_DEFINE_NAMED_CID(NS_CLIPBOARDHELPER_CID);
|
||||
NS_DEFINE_NAMED_CID(NS_SOUND_CID);
|
||||
NS_DEFINE_NAMED_CID(NS_TRANSFERABLE_CID);
|
||||
NS_DEFINE_NAMED_CID(NS_HTMLFORMATCONVERTER_CID);
|
||||
|
||||
NS_DEFINE_NAMED_CID(NS_WIN_TASKBAR_CID);
|
||||
NS_DEFINE_NAMED_CID(NS_WIN_JUMPLISTBUILDER_CID);
|
||||
NS_DEFINE_NAMED_CID(NS_WIN_JUMPLISTITEM_CID);
|
||||
NS_DEFINE_NAMED_CID(NS_WIN_JUMPLISTSEPARATOR_CID);
|
||||
NS_DEFINE_NAMED_CID(NS_WIN_JUMPLISTLINK_CID);
|
||||
NS_DEFINE_NAMED_CID(NS_WIN_JUMPLISTSHORTCUT_CID);
|
||||
|
||||
#ifdef MOZ_METRO
|
||||
NS_DEFINE_NAMED_CID(NS_WIN_METROUTILS_CID);
|
||||
#endif
|
||||
NS_DEFINE_NAMED_CID(NS_DRAGSERVICE_CID);
|
||||
NS_DEFINE_NAMED_CID(NS_BIDIKEYBOARD_CID);
|
||||
|
||||
#ifdef NS_PRINTING
|
||||
NS_DEFINE_NAMED_CID(NS_PRINTSETTINGSSERVICE_CID);
|
||||
NS_DEFINE_NAMED_CID(NS_PRINTER_ENUMERATOR_CID);
|
||||
@ -113,9 +189,9 @@ NS_DEFINE_NAMED_CID(NS_DEVICE_CONTEXT_SPEC_CID);
|
||||
|
||||
|
||||
static const mozilla::Module::CIDEntry kWidgetCIDs[] = {
|
||||
{ &kNS_WINDOW_CID, false, NULL, nsWindowConstructor },
|
||||
{ &kNS_WINDOW_CID, false, NULL, WindowConstructor },
|
||||
{ &kNS_CHILD_CID, false, NULL, ChildWindowConstructor },
|
||||
{ &kNS_FILEPICKER_CID, false, NULL, nsFilePickerConstructor },
|
||||
{ &kNS_FILEPICKER_CID, false, NULL, FilePickerConstructor },
|
||||
{ &kNS_APPSHELL_CID, false, NULL, nsAppShellConstructor },
|
||||
{ &kNS_SCREENMANAGER_CID, false, NULL, nsScreenManagerWinConstructor },
|
||||
{ &kNS_GFXINFO_CID, false, NULL, GfxInfoConstructor },
|
||||
@ -134,6 +210,9 @@ static const mozilla::Module::CIDEntry kWidgetCIDs[] = {
|
||||
{ &kNS_WIN_JUMPLISTSHORTCUT_CID, false, NULL, JumpListShortcutConstructor },
|
||||
{ &kNS_DRAGSERVICE_CID, false, NULL, nsDragServiceConstructor },
|
||||
{ &kNS_BIDIKEYBOARD_CID, false, NULL, nsBidiKeyboardConstructor },
|
||||
#ifdef MOZ_METRO
|
||||
{ &kNS_WIN_METROUTILS_CID, false, NULL, nsWinMetroUtilsConstructor },
|
||||
#endif
|
||||
#ifdef NS_PRINTING
|
||||
{ &kNS_PRINTSETTINGSSERVICE_CID, false, NULL, nsPrintOptionsWinConstructor },
|
||||
{ &kNS_PRINTER_ENUMERATOR_CID, false, NULL, nsPrinterEnumeratorWinConstructor },
|
||||
@ -165,6 +244,9 @@ static const mozilla::Module::ContractIDEntry kWidgetContracts[] = {
|
||||
{ "@mozilla.org/windows-jumplistshortcut;1", &kNS_WIN_JUMPLISTSHORTCUT_CID },
|
||||
{ "@mozilla.org/widget/dragservice;1", &kNS_DRAGSERVICE_CID },
|
||||
{ "@mozilla.org/widget/bidikeyboard;1", &kNS_BIDIKEYBOARD_CID },
|
||||
#ifdef MOZ_METRO
|
||||
{ "@mozilla.org/windows-metroutils;1", &kNS_WIN_METROUTILS_CID },
|
||||
#endif
|
||||
#ifdef NS_PRINTING
|
||||
{ "@mozilla.org/gfx/printsettings-service;1", &kNS_PRINTSETTINGSSERVICE_CID },
|
||||
{ "@mozilla.org/gfx/printerenumerator;1", &kNS_PRINTER_ENUMERATOR_CID },
|
||||
|
@ -1953,7 +1953,7 @@ nsWindow::ResetLayout()
|
||||
// Send a gecko size event to trigger reflow.
|
||||
RECT clientRc = {0};
|
||||
GetClientRect(mWnd, &clientRc);
|
||||
nsIntRect evRect(nsWindowGfx::ToIntRect(clientRc));
|
||||
nsIntRect evRect(WinUtils::ToIntRect(clientRc));
|
||||
OnResize(evRect);
|
||||
|
||||
// Invalidate and update
|
||||
|
@ -105,36 +105,6 @@ IsRenderMode(gfxWindowsPlatform::RenderMode rmode)
|
||||
return gfxWindowsPlatform::GetPlatform()->GetRenderMode() == rmode;
|
||||
}
|
||||
|
||||
nsIntRegion
|
||||
nsWindowGfx::ConvertHRGNToRegion(HRGN aRgn)
|
||||
{
|
||||
NS_ASSERTION(aRgn, "Don't pass NULL region here");
|
||||
|
||||
nsIntRegion rgn;
|
||||
|
||||
DWORD size = ::GetRegionData(aRgn, 0, NULL);
|
||||
nsAutoTArray<uint8_t,100> buffer;
|
||||
if (!buffer.SetLength(size))
|
||||
return rgn;
|
||||
|
||||
RGNDATA* data = reinterpret_cast<RGNDATA*>(buffer.Elements());
|
||||
if (!::GetRegionData(aRgn, size, data))
|
||||
return rgn;
|
||||
|
||||
if (data->rdh.nCount > MAX_RECTS_IN_REGION) {
|
||||
rgn = ToIntRect(data->rdh.rcBound);
|
||||
return rgn;
|
||||
}
|
||||
|
||||
RECT* rects = reinterpret_cast<RECT*>(data->Buffer);
|
||||
for (uint32_t i = 0; i < data->rdh.nCount; ++i) {
|
||||
RECT* r = rects + i;
|
||||
rgn.Or(rgn, ToIntRect(*r));
|
||||
}
|
||||
|
||||
return rgn;
|
||||
}
|
||||
|
||||
/**************************************************************
|
||||
**************************************************************
|
||||
**
|
||||
@ -152,7 +122,7 @@ nsIntRegion nsWindow::GetRegionToPaint(bool aForceFullRepaint,
|
||||
if (aForceFullRepaint) {
|
||||
RECT paintRect;
|
||||
::GetClientRect(mWnd, &paintRect);
|
||||
return nsIntRegion(nsWindowGfx::ToIntRect(paintRect));
|
||||
return nsIntRegion(WinUtils::ToIntRect(paintRect));
|
||||
}
|
||||
|
||||
HRGN paintRgn = ::CreateRectRgn(0, 0, 0, 0);
|
||||
@ -163,11 +133,11 @@ nsIntRegion nsWindow::GetRegionToPaint(bool aForceFullRepaint,
|
||||
::MapWindowPoints(NULL, mWnd, &pt, 1);
|
||||
::OffsetRgn(paintRgn, pt.x, pt.y);
|
||||
}
|
||||
nsIntRegion rgn(nsWindowGfx::ConvertHRGNToRegion(paintRgn));
|
||||
nsIntRegion rgn(WinUtils::ConvertHRGNToRegion(paintRgn));
|
||||
::DeleteObject(paintRgn);
|
||||
return rgn;
|
||||
}
|
||||
return nsIntRegion(nsWindowGfx::ToIntRect(ps.rcPaint));
|
||||
return nsIntRegion(WinUtils::ToIntRect(ps.rcPaint));
|
||||
}
|
||||
|
||||
#define WORDSSIZE(x) ((x).width * (x).height)
|
||||
|
@ -20,14 +20,6 @@
|
||||
|
||||
class nsWindowGfx {
|
||||
public:
|
||||
static nsIntRect ToIntRect(const RECT& aRect)
|
||||
{
|
||||
return nsIntRect(aRect.left, aRect.top,
|
||||
aRect.right - aRect.left, aRect.bottom - aRect.top);
|
||||
}
|
||||
|
||||
static nsIntRegion ConvertHRGNToRegion(HRGN aRgn);
|
||||
|
||||
enum IconSizeType {
|
||||
kSmallIcon,
|
||||
kRegularIcon
|
||||
|
@ -27,19 +27,41 @@
|
||||
* method for the nsAppShell class.
|
||||
*/
|
||||
|
||||
static nsAppShell *sAppShell;
|
||||
#include "nsXULAppAPI.h"
|
||||
#if defined(MOZ_METRO) && defined(XP_WIN)
|
||||
#include "winrt/MetroAppShell.h"
|
||||
#endif
|
||||
|
||||
static nsIAppShell *sAppShell;
|
||||
|
||||
static nsresult
|
||||
nsAppShellInit()
|
||||
{
|
||||
NS_ASSERTION(!sAppShell, "already initialized");
|
||||
|
||||
#if !defined(MOZ_METRO) || !defined(XP_WIN)
|
||||
sAppShell = new nsAppShell();
|
||||
#else
|
||||
if (XRE_GetWindowsEnvironment() == WindowsEnvironmentType_Metro) {
|
||||
sAppShell = new MetroAppShell();
|
||||
} else {
|
||||
sAppShell = new nsAppShell();
|
||||
}
|
||||
#endif
|
||||
if (!sAppShell)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
NS_ADDREF(sAppShell);
|
||||
|
||||
nsresult rv = sAppShell->Init();
|
||||
nsresult rv;
|
||||
#if !defined(MOZ_METRO) || !defined(XP_WIN)
|
||||
rv = static_cast<nsAppShell*>(sAppShell)->Init();
|
||||
#else
|
||||
if (XRE_GetWindowsEnvironment() == WindowsEnvironmentType_Metro) {
|
||||
rv = static_cast<MetroAppShell*>(sAppShell)->Init();
|
||||
} else {
|
||||
rv = static_cast<nsAppShell*>(sAppShell)->Init();
|
||||
}
|
||||
#endif
|
||||
if (NS_FAILED(rv)) {
|
||||
NS_RELEASE(sAppShell);
|
||||
return rv;
|
||||
|
Loading…
Reference in New Issue
Block a user