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.
|
|
|
|
*/
|
|
|
|
|
2016-04-09 09:15:31 +03:00
|
|
|
#include "mozilla/widget/WinMessages.h"
|
2009-06-29 23:36:16 +04:00
|
|
|
#include "nsBaseWidget.h"
|
|
|
|
#include "nsdefs.h"
|
|
|
|
#include "resource.h"
|
|
|
|
|
|
|
|
/**************************************************************
|
|
|
|
*
|
|
|
|
* SECTION: defines
|
|
|
|
*
|
|
|
|
**************************************************************/
|
|
|
|
|
|
|
|
// 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
|
|
|
// 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
|
|
|
|
|
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
|
2016-09-01 11:12:15 +03:00
|
|
|
#define TABLET_INK_ID_MASK 0x0000007F
|
2012-01-04 14:21:44 +04:00
|
|
|
#define MOUSE_INPUT_SOURCE() WinUtils::GetMouseInputSource()
|
2016-09-01 11:12:15 +03:00
|
|
|
#define MOUSE_POINTERID() WinUtils::GetMousePointerID()
|
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;
|
2015-07-09 01:00:33 +03:00
|
|
|
const wchar_t kClassNameHidden[] = L"MozillaHiddenWindowClass";
|
|
|
|
const wchar_t kClassNameGeneral[] = L"MozillaWindowClass";
|
|
|
|
const wchar_t kClassNameDialog[] = L"MozillaDialogClass";
|
|
|
|
const wchar_t kClassNameDropShadow[] = L"MozillaDropShadowWindowClass";
|
|
|
|
const wchar_t kClassNameTemp[] = L"MozillaTempWindowClass";
|
2015-07-13 13:44:36 +03:00
|
|
|
const wchar_t kClassNameTransition[] = L"MozillaTransitionWindowClass";
|
2009-06-29 23:36:16 +04:00
|
|
|
|
|
|
|
/**************************************************************
|
|
|
|
*
|
|
|
|
* SECTION: structs
|
|
|
|
*
|
|
|
|
**************************************************************/
|
|
|
|
|
|
|
|
// Used for synthesizing events
|
Bug 1300937 part.2 Automated tests which synthesize native key events on Windows should specify scan code value explicitly r=smaug
On Windows, some keys are called "extended key". Their scan code include 0xE000. For example, Enter key in standard position is 0x001C but Numpad's Enter key is 0xE01C. Unfortunately, both of them cause same virtual keycode value, VK_RETURN. Therefore, currently, nsIDOMWindowUtils.sendNativeKey() can synthesize only one native key event of them (only non-extended key's event). Additionally, MapVirtualKeyEx() API with MAPVK_VK_TO_VSC (even with MAPVK_VK_TO_VSC_EX) don't return extended scancode value as expected.
For solving these issues, we should include scan code value to the virtual keycode value at calling sendNativeKey().
Fortunately, virtual keycode value on Windows is 0 ~ 255 (0x00 ~ 0xFF) but aNativeKeyCode of sendNativeKey() is int32_t. So, we can use upper 16 bit for specifying scan code.
This patch explicitly specifies scan code value at defining WIN_VK_* in NativeKeyCodes.js. Additionally, this patch duplicates native virtual keycode definition for Home, End, Insert, Delete, PageUp, PageDown, ArrowUp, ArrowLeft, ArrowDown, ArrowRight and Enter as WIN_VK_* and WIN_VK_NUMPAD_*. This makes automated tests can specify both positions' keys explicitly.
Finally, this patch adds some tests to test_keycodes.xul for testing KeyboardEvent.code value of those keys in both positions.
MozReview-Commit-ID: 8n1rQ71dilg
--HG--
extra : rebase_source : 8215e56ba1ed9fc54c04eb7ca037b12c3ced5c1b
2016-09-13 13:38:23 +03:00
|
|
|
struct KeyPair
|
|
|
|
{
|
2012-08-22 19:56:38 +04:00
|
|
|
uint8_t mGeneral;
|
|
|
|
uint8_t mSpecific;
|
Bug 1300937 part.2 Automated tests which synthesize native key events on Windows should specify scan code value explicitly r=smaug
On Windows, some keys are called "extended key". Their scan code include 0xE000. For example, Enter key in standard position is 0x001C but Numpad's Enter key is 0xE01C. Unfortunately, both of them cause same virtual keycode value, VK_RETURN. Therefore, currently, nsIDOMWindowUtils.sendNativeKey() can synthesize only one native key event of them (only non-extended key's event). Additionally, MapVirtualKeyEx() API with MAPVK_VK_TO_VSC (even with MAPVK_VK_TO_VSC_EX) don't return extended scancode value as expected.
For solving these issues, we should include scan code value to the virtual keycode value at calling sendNativeKey().
Fortunately, virtual keycode value on Windows is 0 ~ 255 (0x00 ~ 0xFF) but aNativeKeyCode of sendNativeKey() is int32_t. So, we can use upper 16 bit for specifying scan code.
This patch explicitly specifies scan code value at defining WIN_VK_* in NativeKeyCodes.js. Additionally, this patch duplicates native virtual keycode definition for Home, End, Insert, Delete, PageUp, PageDown, ArrowUp, ArrowLeft, ArrowDown, ArrowRight and Enter as WIN_VK_* and WIN_VK_NUMPAD_*. This makes automated tests can specify both positions' keys explicitly.
Finally, this patch adds some tests to test_keycodes.xul for testing KeyboardEvent.code value of those keys in both positions.
MozReview-Commit-ID: 8n1rQ71dilg
--HG--
extra : rebase_source : 8215e56ba1ed9fc54c04eb7ca037b12c3ced5c1b
2016-09-13 13:38:23 +03:00
|
|
|
uint16_t mScanCode;
|
2012-08-22 19:56:38 +04:00
|
|
|
KeyPair(uint32_t aGeneral, uint32_t aSpecific)
|
Bug 1300937 part.2 Automated tests which synthesize native key events on Windows should specify scan code value explicitly r=smaug
On Windows, some keys are called "extended key". Their scan code include 0xE000. For example, Enter key in standard position is 0x001C but Numpad's Enter key is 0xE01C. Unfortunately, both of them cause same virtual keycode value, VK_RETURN. Therefore, currently, nsIDOMWindowUtils.sendNativeKey() can synthesize only one native key event of them (only non-extended key's event). Additionally, MapVirtualKeyEx() API with MAPVK_VK_TO_VSC (even with MAPVK_VK_TO_VSC_EX) don't return extended scancode value as expected.
For solving these issues, we should include scan code value to the virtual keycode value at calling sendNativeKey().
Fortunately, virtual keycode value on Windows is 0 ~ 255 (0x00 ~ 0xFF) but aNativeKeyCode of sendNativeKey() is int32_t. So, we can use upper 16 bit for specifying scan code.
This patch explicitly specifies scan code value at defining WIN_VK_* in NativeKeyCodes.js. Additionally, this patch duplicates native virtual keycode definition for Home, End, Insert, Delete, PageUp, PageDown, ArrowUp, ArrowLeft, ArrowDown, ArrowRight and Enter as WIN_VK_* and WIN_VK_NUMPAD_*. This makes automated tests can specify both positions' keys explicitly.
Finally, this patch adds some tests to test_keycodes.xul for testing KeyboardEvent.code value of those keys in both positions.
MozReview-Commit-ID: 8n1rQ71dilg
--HG--
extra : rebase_source : 8215e56ba1ed9fc54c04eb7ca037b12c3ced5c1b
2016-09-13 13:38:23 +03:00
|
|
|
: mGeneral(aGeneral & 0xFF)
|
|
|
|
, mSpecific(aSpecific & 0xFF)
|
|
|
|
, mScanCode((aGeneral & 0xFFFF0000) >> 16)
|
|
|
|
{
|
|
|
|
}
|
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
|
|
|
|
|
2013-07-18 12:12:31 +04:00
|
|
|
namespace mozilla {
|
|
|
|
namespace widget {
|
|
|
|
|
|
|
|
struct MSGResult
|
|
|
|
{
|
|
|
|
// Result for the message.
|
|
|
|
LRESULT& mResult;
|
|
|
|
// If mConsumed is true, the caller shouldn't call next wndproc.
|
|
|
|
bool mConsumed;
|
|
|
|
|
2016-12-16 11:00:43 +03:00
|
|
|
explicit MSGResult(LRESULT* aResult = nullptr) :
|
2013-07-18 12:12:31 +04:00
|
|
|
mResult(aResult ? *aResult : mDefaultResult), mConsumed(false)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
LRESULT mDefaultResult;
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace widget
|
|
|
|
} // namespace mozilla
|
|
|
|
|
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__ */
|