Backed out changeset 2450366cf7ca (bug 1891629) for causing win msix mochitest failures
[gecko.git] / widget / windows / nsWindowDefs.h
blob320d6ef07b078299a13c3598956903efa63088d6
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #ifndef WindowDefs_h__
7 #define WindowDefs_h__
9 /*
10 * nsWindowDefs - nsWindow related definitions, consts, and macros.
13 #include "mozilla/widget/WinMessages.h"
14 #include "nsBaseWidget.h"
15 #include "nsdefs.h"
16 #include "resource.h"
18 /**************************************************************
20 * SECTION: defines
22 **************************************************************/
24 // ConstrainPosition window positioning slop value
25 #define kWindowPositionSlop 20
27 // Origin of the system context menu when displayed in full screen mode
28 #define MOZ_SYSCONTEXT_X_POS 20
29 #define MOZ_SYSCONTEXT_Y_POS 20
31 // Don't put more than this many rects in the dirty region, just fluff
32 // out to the bounding-box if there are more
33 #define MAX_RECTS_IN_REGION 100
35 // Tablet PC Mouse Input Source
36 #define TABLET_INK_SIGNATURE 0xFFFFFF00
37 #define TABLET_INK_CHECK 0xFF515700
38 #define TABLET_INK_TOUCH 0x00000080
39 #define TABLET_INK_ID_MASK 0x0000007F
40 #define MOUSE_INPUT_SOURCE() WinUtils::GetMouseInputSource()
41 #define MOUSE_POINTERID() WinUtils::GetMousePointerID()
43 /**************************************************************
45 * SECTION: constants
47 **************************************************************/
50 * Native windows class names
52 * ::: IMPORTANT :::
54 * External apps and drivers depend on window class names.
55 * For example, changing the window classes could break
56 * touchpad scrolling or screen readers.
58 * See bug 1776498.
60 const wchar_t kClassNameHidden[] = L"MozillaHiddenWindowClass";
61 const wchar_t kClassNameGeneral[] = L"MozillaWindowClass";
62 const wchar_t kClassNameDialog[] = L"MozillaDialogClass";
63 const wchar_t kClassNameDropShadow[] = L"MozillaDropShadowWindowClass";
64 const wchar_t kClassNameTransition[] = L"MozillaTransitionWindowClass";
66 /**************************************************************
68 * SECTION: structs
70 **************************************************************/
72 // Used for synthesizing events
73 struct KeyPair {
74 uint8_t mGeneral;
75 uint8_t mSpecific;
76 uint16_t mScanCode;
77 KeyPair(uint32_t aGeneral, uint32_t aSpecific)
78 : mGeneral(aGeneral & 0xFF),
79 mSpecific(aSpecific & 0xFF),
80 mScanCode((aGeneral & 0xFFFF0000) >> 16) {}
81 KeyPair(uint8_t aGeneral, uint8_t aSpecific, uint16_t aScanCode)
82 : mGeneral(aGeneral), mSpecific(aSpecific), mScanCode(aScanCode) {}
85 namespace mozilla {
86 namespace widget {
88 struct MSGResult {
89 // Result for the message.
90 LRESULT& mResult;
91 // If mConsumed is true, the caller shouldn't call next wndproc.
92 bool mConsumed;
94 explicit MSGResult(LRESULT* aResult = nullptr)
95 : mResult(aResult ? *aResult : mDefaultResult), mConsumed(false) {}
97 private:
98 LRESULT mDefaultResult;
101 } // namespace widget
102 } // namespace mozilla
104 /**************************************************************
106 * SECTION: macros
108 **************************************************************/
110 #define NSRGB_2_COLOREF(color) \
111 RGB(NS_GET_R(color), NS_GET_G(color), NS_GET_B(color))
112 #define COLOREF_2_NSRGB(color) \
113 NS_RGB(GetRValue(color), GetGValue(color), GetBValue(color))
115 #define VERIFY_WINDOW_STYLE(s) \
116 NS_ASSERTION(((s) & (WS_CHILD | WS_POPUP)) != (WS_CHILD | WS_POPUP), \
117 "WS_POPUP and WS_CHILD are mutually exclusive")
119 #endif /* WindowDefs_h__ */