Backed out 15 changesets (bug 1852806) for causing mda failures on test_video_low_pow...
[gecko.git] / widget / windows / nsWindowDefs.h
blobdfe79299561859fe7cd7620e2d17463ae8ba06bc
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 kClassNameTemp[] = L"MozillaTempWindowClass";
65 const wchar_t kClassNameTransition[] = L"MozillaTransitionWindowClass";
67 /**************************************************************
69 * SECTION: structs
71 **************************************************************/
73 // Used for synthesizing events
74 struct KeyPair {
75 uint8_t mGeneral;
76 uint8_t mSpecific;
77 uint16_t mScanCode;
78 KeyPair(uint32_t aGeneral, uint32_t aSpecific)
79 : mGeneral(aGeneral & 0xFF),
80 mSpecific(aSpecific & 0xFF),
81 mScanCode((aGeneral & 0xFFFF0000) >> 16) {}
82 KeyPair(uint8_t aGeneral, uint8_t aSpecific, uint16_t aScanCode)
83 : mGeneral(aGeneral), mSpecific(aSpecific), mScanCode(aScanCode) {}
86 #if (WINVER < 0x0600)
87 struct TITLEBARINFOEX {
88 DWORD cbSize;
89 RECT rcTitleBar;
90 DWORD rgstate[CCHILDREN_TITLEBAR + 1];
91 RECT rgrect[CCHILDREN_TITLEBAR + 1];
93 #endif
95 namespace mozilla {
96 namespace widget {
98 struct MSGResult {
99 // Result for the message.
100 LRESULT& mResult;
101 // If mConsumed is true, the caller shouldn't call next wndproc.
102 bool mConsumed;
104 explicit MSGResult(LRESULT* aResult = nullptr)
105 : mResult(aResult ? *aResult : mDefaultResult), mConsumed(false) {}
107 private:
108 LRESULT mDefaultResult;
111 } // namespace widget
112 } // namespace mozilla
114 /**************************************************************
116 * SECTION: macros
118 **************************************************************/
120 #define NSRGB_2_COLOREF(color) \
121 RGB(NS_GET_R(color), NS_GET_G(color), NS_GET_B(color))
122 #define COLOREF_2_NSRGB(color) \
123 NS_RGB(GetRValue(color), GetGValue(color), GetBValue(color))
125 #define VERIFY_WINDOW_STYLE(s) \
126 NS_ASSERTION(((s) & (WS_CHILD | WS_POPUP)) != (WS_CHILD | WS_POPUP), \
127 "WS_POPUP and WS_CHILD are mutually exclusive")
129 #endif /* WindowDefs_h__ */