2009-06-29 23:36:16 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2012-05-21 15:12:37 +04:00
|
|
|
/* 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/. */
|
2009-06-29 23:36:16 +04:00
|
|
|
|
|
|
|
#ifndef WindowDefs_h__
|
|
|
|
#define WindowDefs_h__
|
|
|
|
|
2009-06-30 10:00:16 +04:00
|
|
|
/*
|
|
|
|
* nsWindowDefs - nsWindow related definitions, consts, and macros.
|
|
|
|
*/
|
|
|
|
|
2009-06-29 23:36:16 +04:00
|
|
|
#include "nsBaseWidget.h"
|
|
|
|
#include "nsdefs.h"
|
|
|
|
#include "resource.h"
|
|
|
|
|
|
|
|
/**************************************************************
|
|
|
|
*
|
|
|
|
* SECTION: defines
|
|
|
|
*
|
|
|
|
**************************************************************/
|
|
|
|
|
2010-01-27 00:40:15 +03:00
|
|
|
// A magic APP message that can be sent to quit, sort of like a QUERYENDSESSION/ENDSESSION,
|
|
|
|
// but without the query.
|
|
|
|
#define MOZ_WM_APP_QUIT (WM_APP+0x0300)
|
2011-03-03 19:20:02 +03:00
|
|
|
// Used as a "tracer" event to probe event loop latency.
|
|
|
|
#define MOZ_WM_TRACE (WM_APP+0x0301)
|
2011-08-02 07:03:15 +04:00
|
|
|
// Our internal message for WM_MOUSEWHEEL, WM_MOUSEHWHEEL, WM_VSCROLL and
|
|
|
|
// WM_HSCROLL
|
|
|
|
#define MOZ_WM_MOUSEVWHEEL (WM_APP+0x0310)
|
|
|
|
#define MOZ_WM_MOUSEHWHEEL (WM_APP+0x0311)
|
|
|
|
#define MOZ_WM_VSCROLL (WM_APP+0x0312)
|
|
|
|
#define MOZ_WM_HSCROLL (WM_APP+0x0313)
|
2012-03-22 04:59:12 +04:00
|
|
|
#define MOZ_WM_MOUSEWHEEL_FIRST MOZ_WM_MOUSEVWHEEL
|
|
|
|
#define MOZ_WM_MOUSEWHEEL_LAST MOZ_WM_HSCROLL
|
|
|
|
|
2011-09-01 18:01:45 +04:00
|
|
|
// Internal message for ensuring the file picker is visible on multi monitor
|
|
|
|
// systems, and when the screen resolution changes.
|
|
|
|
#define MOZ_WM_ENSUREVISIBLE (WM_APP + 14159)
|
2010-01-27 00:40:15 +03:00
|
|
|
|
2012-08-20 23:11:31 +04:00
|
|
|
#ifndef SM_CXPADDEDBORDER
|
|
|
|
#define SM_CXPADDEDBORDER 92
|
|
|
|
#endif
|
|
|
|
|
2010-11-29 19:19:17 +03:00
|
|
|
#ifndef WM_THEMECHANGED
|
|
|
|
#define WM_THEMECHANGED 0x031A
|
|
|
|
#endif
|
2009-06-29 23:36:16 +04:00
|
|
|
|
|
|
|
#ifndef WM_GETOBJECT
|
|
|
|
#define WM_GETOBJECT 0x03d
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef PBT_APMRESUMEAUTOMATIC
|
|
|
|
#define PBT_APMRESUMEAUTOMATIC 0x0012
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef WM_MOUSEHWHEEL
|
|
|
|
#define WM_MOUSEHWHEEL 0x020E
|
|
|
|
#endif
|
|
|
|
|
2010-01-14 04:46:44 +03:00
|
|
|
#ifndef WM_MOUSELEAVE
|
|
|
|
#define WM_MOUSELEAVE 0x02A3
|
|
|
|
#endif
|
|
|
|
|
2009-06-29 23:36:16 +04:00
|
|
|
#ifndef SPI_GETWHEELSCROLLCHARS
|
|
|
|
#define SPI_GETWHEELSCROLLCHARS 0x006C
|
|
|
|
#endif
|
|
|
|
|
2011-05-17 04:23:23 +04:00
|
|
|
#ifndef SPI_SETWHEELSCROLLCHARS
|
|
|
|
#define SPI_SETWHEELSCROLLCHARS 0x006D
|
|
|
|
#endif
|
|
|
|
|
2009-06-29 23:36:16 +04:00
|
|
|
#ifndef MAPVK_VSC_TO_VK
|
|
|
|
#define MAPVK_VK_TO_VSC 0
|
|
|
|
#define MAPVK_VSC_TO_VK 1
|
|
|
|
#define MAPVK_VK_TO_CHAR 2
|
2012-05-03 12:35:02 +04:00
|
|
|
#define MAPVK_VSC_TO_VK_EX 3
|
|
|
|
#define MAPVK_VK_TO_VSC_EX 4
|
2009-06-29 23:36:16 +04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
// ConstrainPosition window positioning slop value
|
|
|
|
#define kWindowPositionSlop 20
|
|
|
|
|
2010-10-23 02:38:18 +04:00
|
|
|
// Origin of the system context menu when displayed in full screen mode
|
|
|
|
#define MOZ_SYSCONTEXT_X_POS 20
|
|
|
|
#define MOZ_SYSCONTEXT_Y_POS 20
|
|
|
|
|
2009-06-29 23:36:16 +04:00
|
|
|
// Drop shadow window style
|
|
|
|
#define CS_XP_DROPSHADOW 0x00020000
|
|
|
|
|
|
|
|
// Don't put more than this many rects in the dirty region, just fluff
|
|
|
|
// out to the bounding-box if there are more
|
|
|
|
#define MAX_RECTS_IN_REGION 100
|
|
|
|
|
|
|
|
// App Command messages for IntelliMouse and Natural Keyboard Pro
|
|
|
|
// These messages are not included in Visual C++ 6.0, but are in 7.0+
|
|
|
|
#ifndef WM_APPCOMMAND
|
|
|
|
#define WM_APPCOMMAND 0x0319
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#define FAPPCOMMAND_MASK 0xF000
|
|
|
|
|
2010-08-10 05:49:35 +04:00
|
|
|
#ifndef WM_GETTITLEBARINFOEX
|
|
|
|
#define WM_GETTITLEBARINFOEX 0x033F
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef CCHILDREN_TITLEBAR
|
|
|
|
#define CCHILDREN_TITLEBAR 5
|
|
|
|
#endif
|
|
|
|
|
2009-06-29 23:36:16 +04:00
|
|
|
#ifndef APPCOMMAND_BROWSER_BACKWARD
|
|
|
|
#define APPCOMMAND_BROWSER_BACKWARD 1
|
|
|
|
#define APPCOMMAND_BROWSER_FORWARD 2
|
|
|
|
#define APPCOMMAND_BROWSER_REFRESH 3
|
|
|
|
#define APPCOMMAND_BROWSER_STOP 4
|
|
|
|
#define APPCOMMAND_BROWSER_SEARCH 5
|
|
|
|
#define APPCOMMAND_BROWSER_FAVORITES 6
|
|
|
|
#define APPCOMMAND_BROWSER_HOME 7
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Additional commands currently not in use.
|
|
|
|
*
|
|
|
|
*#define APPCOMMAND_VOLUME_MUTE 8
|
|
|
|
*#define APPCOMMAND_VOLUME_DOWN 9
|
|
|
|
*#define APPCOMMAND_VOLUME_UP 10
|
|
|
|
*#define APPCOMMAND_MEDIA_NEXTTRACK 11
|
|
|
|
*#define APPCOMMAND_MEDIA_PREVIOUSTRACK 12
|
|
|
|
*#define APPCOMMAND_MEDIA_STOP 13
|
|
|
|
*#define APPCOMMAND_MEDIA_PLAY_PAUSE 14
|
|
|
|
*#define APPCOMMAND_LAUNCH_MAIL 15
|
|
|
|
*#define APPCOMMAND_LAUNCH_MEDIA_SELECT 16
|
|
|
|
*#define APPCOMMAND_LAUNCH_APP1 17
|
|
|
|
*#define APPCOMMAND_LAUNCH_APP2 18
|
|
|
|
*#define APPCOMMAND_BASS_DOWN 19
|
|
|
|
*#define APPCOMMAND_BASS_BOOST 20
|
|
|
|
*#define APPCOMMAND_BASS_UP 21
|
|
|
|
*#define APPCOMMAND_TREBLE_DOWN 22
|
|
|
|
*#define APPCOMMAND_TREBLE_UP 23
|
|
|
|
*#define FAPPCOMMAND_MOUSE 0x8000
|
|
|
|
*#define FAPPCOMMAND_KEY 0
|
|
|
|
*#define FAPPCOMMAND_OEM 0x1000
|
|
|
|
*/
|
|
|
|
|
|
|
|
#define GET_APPCOMMAND_LPARAM(lParam) ((short)(HIWORD(lParam) & ~FAPPCOMMAND_MASK))
|
|
|
|
|
|
|
|
/*
|
|
|
|
*#define GET_DEVICE_LPARAM(lParam) ((WORD)(HIWORD(lParam) & FAPPCOMMAND_MASK))
|
|
|
|
*#define GET_MOUSEORKEY_LPARAM GET_DEVICE_LPARAM
|
|
|
|
*#define GET_FLAGS_LPARAM(lParam) (LOWORD(lParam))
|
|
|
|
*#define GET_KEYSTATE_LPARAM(lParam) GET_FLAGS_LPARAM(lParam)
|
|
|
|
*/
|
|
|
|
#endif // #ifndef APPCOMMAND_BROWSER_BACKWARD
|
|
|
|
|
2010-04-06 16:59:24 +04:00
|
|
|
//Tablet PC Mouse Input Source
|
|
|
|
#define TABLET_INK_SIGNATURE 0xFFFFFF00
|
|
|
|
#define TABLET_INK_CHECK 0xFF515700
|
|
|
|
#define TABLET_INK_TOUCH 0x00000080
|
2012-01-04 14:21:44 +04:00
|
|
|
#define MOUSE_INPUT_SOURCE() WinUtils::GetMouseInputSource()
|
2010-04-06 16:59:24 +04:00
|
|
|
|
2009-06-29 23:36:16 +04:00
|
|
|
/**************************************************************
|
|
|
|
*
|
|
|
|
* SECTION: enums
|
|
|
|
*
|
|
|
|
**************************************************************/
|
|
|
|
|
|
|
|
// nsWindow::sCanQuit
|
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
TRI_UNKNOWN = -1,
|
|
|
|
TRI_FALSE = 0,
|
|
|
|
TRI_TRUE = 1
|
|
|
|
} TriStateBool;
|
|
|
|
|
|
|
|
/**************************************************************
|
|
|
|
*
|
|
|
|
* SECTION: constants
|
|
|
|
*
|
|
|
|
**************************************************************/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Native windows class names
|
|
|
|
*
|
|
|
|
* ::: IMPORTANT :::
|
|
|
|
*
|
|
|
|
* External apps and drivers depend on window class names.
|
|
|
|
* For example, changing the window classes could break
|
|
|
|
* touchpad scrolling or screen readers.
|
|
|
|
*/
|
2012-08-22 19:56:38 +04:00
|
|
|
const uint32_t kMaxClassNameLength = 40;
|
2010-11-08 12:06:13 +03:00
|
|
|
const char kClassNameHidden[] = "MozillaHiddenWindowClass";
|
|
|
|
const char kClassNameGeneral[] = "MozillaWindowClass";
|
|
|
|
const char kClassNameDialog[] = "MozillaDialogClass";
|
|
|
|
const char kClassNameDropShadow[] = "MozillaDropShadowWindowClass";
|
|
|
|
const char kClassNameTemp[] = "MozillaTempWindowClass";
|
2009-06-29 23:36:16 +04:00
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
static const uint32_t sModifierKeyMap[][3] = {
|
2009-06-29 23:36:16 +04:00
|
|
|
{ nsIWidget::CAPS_LOCK, VK_CAPITAL, 0 },
|
|
|
|
{ nsIWidget::NUM_LOCK, VK_NUMLOCK, 0 },
|
|
|
|
{ nsIWidget::SHIFT_L, VK_SHIFT, VK_LSHIFT },
|
|
|
|
{ nsIWidget::SHIFT_R, VK_SHIFT, VK_RSHIFT },
|
|
|
|
{ nsIWidget::CTRL_L, VK_CONTROL, VK_LCONTROL },
|
|
|
|
{ nsIWidget::CTRL_R, VK_CONTROL, VK_RCONTROL },
|
|
|
|
{ nsIWidget::ALT_L, VK_MENU, VK_LMENU },
|
|
|
|
{ nsIWidget::ALT_R, VK_MENU, VK_RMENU }
|
|
|
|
};
|
|
|
|
|
|
|
|
/**************************************************************
|
|
|
|
*
|
|
|
|
* SECTION: structs
|
|
|
|
*
|
|
|
|
**************************************************************/
|
|
|
|
|
|
|
|
// Used in OnKeyDown
|
|
|
|
struct nsAlternativeCharCode; // defined in nsGUIEvent.h
|
|
|
|
struct nsFakeCharMessage {
|
|
|
|
UINT mCharCode;
|
|
|
|
UINT mScanCode;
|
2012-06-15 13:52:51 +04:00
|
|
|
bool mIsDeadKey;
|
2011-04-21 03:54:43 +04:00
|
|
|
|
|
|
|
MSG GetCharMessage(HWND aWnd)
|
|
|
|
{
|
|
|
|
MSG msg;
|
|
|
|
msg.hwnd = aWnd;
|
2012-06-15 13:52:51 +04:00
|
|
|
msg.message = mIsDeadKey ? WM_DEADCHAR : WM_CHAR;
|
2011-04-21 03:54:43 +04:00
|
|
|
msg.wParam = static_cast<WPARAM>(mCharCode);
|
|
|
|
msg.lParam = static_cast<LPARAM>(mScanCode);
|
|
|
|
msg.time = 0;
|
|
|
|
msg.pt.x = msg.pt.y = 0;
|
|
|
|
return msg;
|
|
|
|
}
|
2009-06-29 23:36:16 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
// Used for synthesizing events
|
|
|
|
struct KeyPair {
|
2012-08-22 19:56:38 +04:00
|
|
|
uint8_t mGeneral;
|
|
|
|
uint8_t mSpecific;
|
|
|
|
KeyPair(uint32_t aGeneral, uint32_t aSpecific)
|
|
|
|
: mGeneral(uint8_t(aGeneral)), mSpecific(uint8_t(aSpecific)) {}
|
2009-06-29 23:36:16 +04:00
|
|
|
};
|
|
|
|
|
2012-03-22 18:18:49 +04:00
|
|
|
#if (WINVER < 0x0600)
|
2010-08-10 05:49:35 +04:00
|
|
|
struct TITLEBARINFOEX
|
|
|
|
{
|
|
|
|
DWORD cbSize;
|
|
|
|
RECT rcTitleBar;
|
|
|
|
DWORD rgstate[CCHILDREN_TITLEBAR + 1];
|
|
|
|
RECT rgrect[CCHILDREN_TITLEBAR + 1];
|
|
|
|
};
|
|
|
|
#endif
|
|
|
|
|
2009-06-29 23:36:16 +04:00
|
|
|
/**************************************************************
|
|
|
|
*
|
|
|
|
* SECTION: macros
|
|
|
|
*
|
|
|
|
**************************************************************/
|
|
|
|
|
|
|
|
#define NSRGB_2_COLOREF(color) \
|
|
|
|
RGB(NS_GET_R(color),NS_GET_G(color),NS_GET_B(color))
|
|
|
|
#define COLOREF_2_NSRGB(color) \
|
|
|
|
NS_RGB(GetRValue(color), GetGValue(color), GetBValue(color))
|
|
|
|
|
|
|
|
#define VERIFY_WINDOW_STYLE(s) \
|
|
|
|
NS_ASSERTION(((s) & (WS_CHILD | WS_POPUP)) != (WS_CHILD | WS_POPUP), \
|
|
|
|
"WS_POPUP and WS_CHILD are mutually exclusive")
|
|
|
|
|
2009-07-09 03:34:02 +04:00
|
|
|
#endif /* WindowDefs_h__ */
|