Bug 1931425 - Limit how often moz-label's #setStyles runs r=reusable-components-revie...
[gecko.git] / widget / windows / nsWindowDefs.h
blob57bc3005a45b5516dd2d6fc204c9f358dffe94d3
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 // Don't put more than this many rects in the dirty region, just fluff
28 // out to the bounding-box if there are more
29 #define MAX_RECTS_IN_REGION 100
31 // Tablet PC Mouse Input Source
32 #define TABLET_INK_SIGNATURE 0xFFFFFF00
33 #define TABLET_INK_CHECK 0xFF515700
34 #define TABLET_INK_TOUCH 0x00000080
35 #define TABLET_INK_ID_MASK 0x0000007F
36 #define MOUSE_INPUT_SOURCE() WinUtils::GetMouseInputSource()
37 #define MOUSE_POINTERID() WinUtils::GetMousePointerID()
39 /**************************************************************
41 * SECTION: constants
43 **************************************************************/
46 * Native windows class names
48 * ::: IMPORTANT :::
50 * External apps and drivers depend on window class names.
51 * For example, changing the window classes could break
52 * touchpad scrolling or screen readers.
54 * See bug 1776498.
56 const wchar_t kClassNameHidden[] = L"MozillaHiddenWindowClass";
57 const wchar_t kClassNameGeneral[] = L"MozillaWindowClass";
58 const wchar_t kClassNameDialog[] = L"MozillaDialogClass";
59 const wchar_t kClassNameDropShadow[] = L"MozillaDropShadowWindowClass";
60 const wchar_t kClassNameTransition[] = L"MozillaTransitionWindowClass";
62 /**************************************************************
64 * SECTION: structs
66 **************************************************************/
68 // Used for synthesizing events
69 struct KeyPair {
70 uint8_t mGeneral;
71 uint8_t mSpecific;
72 uint16_t mScanCode;
73 KeyPair(uint32_t aGeneral, uint32_t aSpecific)
74 : mGeneral(aGeneral & 0xFF),
75 mSpecific(aSpecific & 0xFF),
76 mScanCode((aGeneral & 0xFFFF0000) >> 16) {}
77 KeyPair(uint8_t aGeneral, uint8_t aSpecific, uint16_t aScanCode)
78 : mGeneral(aGeneral), mSpecific(aSpecific), mScanCode(aScanCode) {}
81 namespace mozilla {
82 namespace widget {
84 struct MSGResult {
85 // Result for the message.
86 LRESULT& mResult;
87 // If mConsumed is true, the caller shouldn't call next wndproc.
88 bool mConsumed;
90 explicit MSGResult(LRESULT* aResult = nullptr)
91 : mResult(aResult ? *aResult : mDefaultResult), mConsumed(false) {}
93 private:
94 LRESULT mDefaultResult;
97 } // namespace widget
98 } // namespace mozilla
100 /**************************************************************
102 * SECTION: macros
104 **************************************************************/
106 #define NSRGB_2_COLOREF(color) \
107 RGB(NS_GET_R(color), NS_GET_G(color), NS_GET_B(color))
108 #define COLOREF_2_NSRGB(color) \
109 NS_RGB(GetRValue(color), GetGValue(color), GetBValue(color))
111 #define VERIFY_WINDOW_STYLE(s) \
112 NS_ASSERTION(((s) & (WS_CHILD | WS_POPUP)) != (WS_CHILD | WS_POPUP), \
113 "WS_POPUP and WS_CHILD are mutually exclusive")
115 #endif /* WindowDefs_h__ */