Bug 471471 - Narrow window class name is no longer used; r+sr=roc

This commit is contained in:
Masatoshi Kimura 2008-12-30 06:39:24 +01:00
Родитель fca22cd8c7
Коммит a5a2d26fdd
5 изменённых файлов: 41 добавлений и 212 удалений

Просмотреть файл

@ -46,7 +46,6 @@
#include "nsIServiceManager.h"
#include "nsComponentManagerUtils.h"
#include "nsWidgetAtoms.h"
#include "nsWindowAPI.h"
#include "nsUXThemeData.h"
#include <objbase.h>
#include <initguid.h>

Просмотреть файл

@ -42,12 +42,19 @@
#include "nsdefs.h"
#include "nsIToolkit.h"
#include "nsWindowAPI.h"
#include "nsITimer.h"
#include "nsCOMPtr.h"
#include <imm.h>
// Avoid including windowsx.h to prevent macro pollution
#ifndef GET_X_LPARAM
#define GET_X_LPARAM(pt) (short(LOWORD(pt)))
#endif
#ifndef GET_Y_LPARAM
#define GET_Y_LPARAM(pt) (short(HIWORD(pt)))
#endif
struct MethodInfo;
class nsIEventQueue;
class MouseTrailer;
@ -160,42 +167,6 @@ private:
};
//-------------------------------------------------------------------------
//
// related WM_IME_REQUEST definition.
// VC++5.0 header doesn't have reconversion structure and message.
//
//-------------------------------------------------------------------------
#ifndef WM_IME_REQUEST
#define WM_IME_REQUEST 0x0288
#endif // #ifndef WM_IME_REQUEST
#ifndef IMR_RECONVERTSTRING
#define IMR_RECONVERTSTRING 0x0004
typedef struct tagRECONVERTSTRING {
DWORD dwSize;
DWORD dwVersion;
DWORD dwStrLen;
DWORD dwStrOffset;
DWORD dwCompStrLen;
DWORD dwCompStrOffset;
DWORD dwTargetStrLen;
DWORD dwTargetStrOffset;
} RECONVERTSTRING, FAR * LPRECONVERTSTRING;
#endif // #ifndef IMR_RECONVERTSTRING
#ifndef IMR_QUERYCHARPOSITION
#define IMR_QUERYCHARPOSITION 0x0006
typedef struct tagIMECHARPOSITION {
DWORD dwSize;
DWORD dwCharPos;
POINT pt;
UINT cLineHeight;
RECT rcDocument;
} IMECHARPOSITION, *PIMECHARPOSITION;
#endif // #ifndef IMR_QUERYCHARPOSITION
//-------------------------------------------------------------------------
//
// from http://msdn.microsoft.com/library/en-us/dnime/html/msime.asp

Просмотреть файл

@ -163,10 +163,6 @@ static const PRUnichar kMozHeapDumpMessageString[] = L"MOZ_HeapDump";
#define kWindowPositionSlop 20
#ifndef SPI_GETWHEELSCROLLLINES
#define SPI_GETWHEELSCROLLLINES 104
#endif
#ifndef WM_MOUSEHWHEEL
#define WM_MOUSEHWHEEL 0x020E
#endif
@ -269,17 +265,6 @@ PRInt32 GetWindowsVersion()
static NS_DEFINE_CID(kCClipboardCID, NS_CLIPBOARD_CID);
static NS_DEFINE_IID(kRenderingContextCID, NS_RENDERING_CONTEXT_CID);
// When we build we are currently (11/27/01) setting the WINVER to 0x0400
// Which means we do not compile in the system resource for the HAND cursor
// this enables us still define the resource and if it isn't there then we will
// get our own hand cursor.
// 32649 is the resource number as defined by WINUSER.H for this cursor
// if the resource is defined by the build env. then it will find it when asked
// if not, then we get our own cursor.
#ifndef IDC_HAND
#define IDC_HAND MAKEINTRESOURCE(32649)
#endif
static const char *sScreenManagerContractID = "@mozilla.org/gfx/screenmanager;1";
////////////////////////////////////////////////////
@ -1277,7 +1262,7 @@ nsWindow::StandardWindowCreate(nsIWidget *aParent,
mWnd = ::CreateWindowExW(extendedStyle,
aInitData && aInitData->mDropShadow ?
WindowPopupClassW() : WindowClassW(),
WindowPopupClass() : WindowClass(),
L"",
style,
aRect.x,
@ -4772,11 +4757,11 @@ PRBool nsWindow::ProcessMessage(UINT msg, WPARAM wParam, LPARAM lParam, LRESULT
#endif
WCHAR className[kMaxClassNameLength];
::GetClassNameW((HWND)wParam, className, kMaxClassNameLength);
if (wcscmp(className, kWClassNameUI) &&
wcscmp(className, kWClassNameContent) &&
wcscmp(className, kWClassNameContentFrame) &&
wcscmp(className, kWClassNameDialog) &&
wcscmp(className, kWClassNameGeneral)) {
if (wcscmp(className, kClassNameUI) &&
wcscmp(className, kClassNameContent) &&
wcscmp(className, kClassNameContentFrame) &&
wcscmp(className, kClassNameDialog) &&
wcscmp(className, kClassNameGeneral)) {
isMozWindowTakingFocus = PR_FALSE;
}
if (gJustGotDeactivate) {
@ -4887,11 +4872,11 @@ PRBool nsWindow::ProcessMessage(UINT msg, WPARAM wParam, LPARAM lParam, LRESULT
// Deactivate
WCHAR className[kMaxClassNameLength];
::GetClassNameW((HWND)wParam, className, kMaxClassNameLength);
if (wcscmp(className, kWClassNameUI) &&
wcscmp(className, kWClassNameContent) &&
wcscmp(className, kWClassNameContentFrame) &&
wcscmp(className, kWClassNameDialog) &&
wcscmp(className, kWClassNameGeneral)) {
if (wcscmp(className, kClassNameUI) &&
wcscmp(className, kClassNameContent) &&
wcscmp(className, kClassNameContentFrame) &&
wcscmp(className, kClassNameDialog) &&
wcscmp(className, kClassNameGeneral)) {
isMozWindowTakingFocus = PR_FALSE;
}
gJustGotDeactivate = PR_FALSE;
@ -5498,7 +5483,7 @@ PRBool nsWindow::DispatchPluginEvent(const MSG &aMsg)
#define CS_XP_DROPSHADOW 0x00020000
LPCWSTR nsWindow::WindowClassW()
LPCWSTR nsWindow::WindowClass()
{
if (!nsWindow::sIsRegistered) {
WNDCLASSW wc;
@ -5513,33 +5498,33 @@ LPCWSTR nsWindow::WindowClassW()
wc.hCursor = NULL;
wc.hbrBackground = mBrush;
wc.lpszMenuName = NULL;
wc.lpszClassName = kWClassNameHidden;
wc.lpszClassName = kClassNameHidden;
BOOL succeeded = ::RegisterClassW(&wc) != 0;
nsWindow::sIsRegistered = succeeded;
wc.lpszClassName = kWClassNameContentFrame;
wc.lpszClassName = kClassNameContentFrame;
if (!::RegisterClassW(&wc)) {
nsWindow::sIsRegistered = FALSE;
}
wc.lpszClassName = kWClassNameContent;
wc.lpszClassName = kClassNameContent;
if (!::RegisterClassW(&wc)) {
nsWindow::sIsRegistered = FALSE;
}
wc.lpszClassName = kWClassNameUI;
wc.lpszClassName = kClassNameUI;
if (!::RegisterClassW(&wc)) {
nsWindow::sIsRegistered = FALSE;
}
wc.lpszClassName = kWClassNameGeneral;
wc.lpszClassName = kClassNameGeneral;
ATOM generalClassAtom = ::RegisterClassW(&wc);
if (!generalClassAtom) {
nsWindow::sIsRegistered = FALSE;
}
wc.lpszClassName = kWClassNameDialog;
wc.lpszClassName = kClassNameDialog;
wc.hIcon = 0;
if (!::RegisterClassW(&wc)) {
nsWindow::sIsRegistered = FALSE;
@ -5547,24 +5532,24 @@ LPCWSTR nsWindow::WindowClassW()
}
if (mWindowType == eWindowType_invisible) {
return kWClassNameHidden;
return kClassNameHidden;
}
if (mWindowType == eWindowType_dialog) {
return kWClassNameDialog;
return kClassNameDialog;
}
if (mContentType == eContentTypeContent) {
return kWClassNameContent;
return kClassNameContent;
}
if (mContentType == eContentTypeContentFrame) {
return kWClassNameContentFrame;
return kClassNameContentFrame;
}
if (mContentType == eContentTypeUI) {
return kWClassNameUI;
return kClassNameUI;
}
return kWClassNameGeneral;
return kClassNameGeneral;
}
LPCWSTR nsWindow::WindowPopupClassW()
LPCWSTR nsWindow::WindowPopupClass()
{
const LPCWSTR className = L"MozillaDropShadowWindowClass";
@ -5594,50 +5579,6 @@ LPCWSTR nsWindow::WindowPopupClassW()
return className;
}
LPCTSTR nsWindow::WindowClass()
{
// Call into the wide version to make sure things get
// registered properly.
LPCWSTR classNameW = WindowClassW();
// XXX: The class name used here must be kept in sync with
// the classname used in WindowClassW();
#ifdef UNICODE
return classNameW;
#else
if (classNameW == kWClassNameHidden) {
return kClassNameHidden;
}
if (classNameW == kWClassNameDialog) {
return kClassNameDialog;
}
if (classNameW == kWClassNameUI) {
return kClassNameUI;
}
if (classNameW == kWClassNameContent) {
return kClassNameContent;
}
if (classNameW == kWClassNameContentFrame) {
return kClassNameContentFrame;
}
return kClassNameGeneral;
#endif
}
LPCTSTR nsWindow::WindowPopupClass()
{
// Call into the wide version to make sure things get
// registered properly.
#ifdef UNICODE
return WindowPopupClassW();
#else
// XXX: The class name used here must be kept in sync with
// the classname used in WindowPopupClassW();
return "MozillaDropShadowWindowClass";
#endif
}
//-------------------------------------------------------------------------
//
// return nsWindow styles

Просмотреть файл

@ -94,18 +94,12 @@ PRInt32 GetWindowsVersion();
* could break touchpad scrolling or screen readers.
*/
const PRUint32 kMaxClassNameLength = 40;
const LPCWSTR kWClassNameHidden = L"MozillaHiddenWindowClass";
const LPCWSTR kWClassNameUI = L"MozillaUIWindowClass";
const LPCWSTR kWClassNameContent = L"MozillaContentWindowClass";
const LPCWSTR kWClassNameContentFrame = L"MozillaContentFrameWindowClass";
const LPCWSTR kWClassNameGeneral = L"MozillaWindowClass";
const LPCWSTR kWClassNameDialog = L"MozillaDialogClass";
const LPCSTR kClassNameHidden = "MozillaHiddenWindowClass";
const LPCSTR kClassNameUI = "MozillaUIWindowClass";
const LPCSTR kClassNameContent = "MozillaContentWindowClass";
const LPCSTR kClassNameContentFrame = "MozillaContentFrameWindowClass";
const LPCSTR kClassNameGeneral = "MozillaWindowClass";
const LPCSTR kClassNameDialog = "MozillaDialogClass";
const LPCWSTR kClassNameHidden = L"MozillaHiddenWindowClass";
const LPCWSTR kClassNameUI = L"MozillaUIWindowClass";
const LPCWSTR kClassNameContent = L"MozillaContentWindowClass";
const LPCWSTR kClassNameContentFrame = L"MozillaContentFrameWindowClass";
const LPCWSTR kClassNameGeneral = L"MozillaWindowClass";
const LPCWSTR kClassNameDialog = L"MozillaDialogClass";
typedef enum
{
@ -317,10 +311,8 @@ protected:
// Allow Derived classes to modify the height that is passed
// when the window is created or resized.
virtual PRInt32 GetHeight(PRInt32 aProposedHeight);
virtual LPCWSTR WindowClassW();
virtual LPCWSTR WindowPopupClassW();
virtual LPCTSTR WindowClass();
virtual LPCTSTR WindowPopupClass();
virtual LPCWSTR WindowClass();
virtual LPCWSTR WindowPopupClass();
virtual DWORD WindowStyle();
virtual DWORD WindowExStyle();

Просмотреть файл

@ -1,74 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** 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.org code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Roy Yokoyama <yokoyama@netscape.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 WindowAPI_h__
#define WindowAPI_h__
#include <windows.h>
#include <commdlg.h>
#include <shlobj.h>
typedef LRESULT (WINAPI *NS_DefWindowProc) (HWND, UINT, WPARAM, LPARAM);
typedef LRESULT (WINAPI *NS_CallWindowProc) (WNDPROC, HWND, UINT, WPARAM, LPARAM);
typedef LONG (WINAPI *NS_SetWindowLong) (HWND, int, LONG);
typedef LONG (WINAPI *NS_GetWindowLong) (HWND, int);
typedef LRESULT (WINAPI *NS_SendMessage) (HWND, UINT, WPARAM, LPARAM ) ;
typedef LONG (WINAPI *NS_DispatchMessage) (CONST MSG *);
typedef BOOL (WINAPI *NS_GetMessage) (LPMSG, HWND, UINT, UINT);
typedef BOOL (WINAPI *NS_PeekMessage) (LPMSG, HWND, UINT, UINT, UINT);
typedef BOOL (WINAPI *NS_GetOpenFileName) (LPOPENFILENAMEW);
typedef BOOL (WINAPI *NS_GetSaveFileName) (LPOPENFILENAMEW);
typedef int (WINAPI *NS_GetClassName) (HWND, LPWSTR, int);
typedef HWND (WINAPI *NS_CreateWindowEx)
(DWORD, LPCWSTR, LPCWSTR, DWORD, int, int, int, int, HWND, HMENU, HINSTANCE, LPVOID);
typedef ATOM (WINAPI *NS_RegisterClass) (CONST WNDCLASSW *);
typedef BOOL (WINAPI *NS_UnregisterClass) (LPCWSTR, HINSTANCE);
typedef BOOL (WINAPI *NS_SHGetPathFromIDList) (LPCITEMIDLIST, LPWSTR);
#ifndef WINCE
typedef LPITEMIDLIST (WINAPI *NS_SHBrowseForFolder) (LPBROWSEINFOW);
#endif
// Avoid including windowsx.h to prevent macro pollution
#ifndef GET_X_LPARAM
#define GET_X_LPARAM(pt) (short(LOWORD(pt)))
#endif
#ifndef GET_Y_LPARAM
#define GET_Y_LPARAM(pt) (short(HIWORD(pt)))
#endif
#endif /* WindowAPI_h__ */