Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
michael@0 | 1 | /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
michael@0 | 2 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 3 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 4 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 5 | |
michael@0 | 6 | #ifndef WindowDefs_h__ |
michael@0 | 7 | #define WindowDefs_h__ |
michael@0 | 8 | |
michael@0 | 9 | /* |
michael@0 | 10 | * nsWindowDefs - nsWindow related definitions, consts, and macros. |
michael@0 | 11 | */ |
michael@0 | 12 | |
michael@0 | 13 | #include "nsBaseWidget.h" |
michael@0 | 14 | #include "nsdefs.h" |
michael@0 | 15 | #include "resource.h" |
michael@0 | 16 | |
michael@0 | 17 | /************************************************************** |
michael@0 | 18 | * |
michael@0 | 19 | * SECTION: defines |
michael@0 | 20 | * |
michael@0 | 21 | **************************************************************/ |
michael@0 | 22 | |
michael@0 | 23 | // A magic APP message that can be sent to quit, sort of like a QUERYENDSESSION/ENDSESSION, |
michael@0 | 24 | // but without the query. |
michael@0 | 25 | #define MOZ_WM_APP_QUIT (WM_APP+0x0300) |
michael@0 | 26 | // Used as a "tracer" event to probe event loop latency. |
michael@0 | 27 | #define MOZ_WM_TRACE (WM_APP+0x0301) |
michael@0 | 28 | // Our internal message for WM_MOUSEWHEEL, WM_MOUSEHWHEEL, WM_VSCROLL and |
michael@0 | 29 | // WM_HSCROLL |
michael@0 | 30 | #define MOZ_WM_MOUSEVWHEEL (WM_APP+0x0310) |
michael@0 | 31 | #define MOZ_WM_MOUSEHWHEEL (WM_APP+0x0311) |
michael@0 | 32 | #define MOZ_WM_VSCROLL (WM_APP+0x0312) |
michael@0 | 33 | #define MOZ_WM_HSCROLL (WM_APP+0x0313) |
michael@0 | 34 | #define MOZ_WM_MOUSEWHEEL_FIRST MOZ_WM_MOUSEVWHEEL |
michael@0 | 35 | #define MOZ_WM_MOUSEWHEEL_LAST MOZ_WM_HSCROLL |
michael@0 | 36 | // If a popup window is being activated, we try to reactivate the previous |
michael@0 | 37 | // window with this message. |
michael@0 | 38 | #define MOZ_WM_REACTIVATE (WM_APP+0x0314) |
michael@0 | 39 | |
michael@0 | 40 | // Internal message for ensuring the file picker is visible on multi monitor |
michael@0 | 41 | // systems, and when the screen resolution changes. |
michael@0 | 42 | #define MOZ_WM_ENSUREVISIBLE (WM_APP+0x374F) |
michael@0 | 43 | |
michael@0 | 44 | #ifndef SM_CXPADDEDBORDER |
michael@0 | 45 | #define SM_CXPADDEDBORDER 92 |
michael@0 | 46 | #endif |
michael@0 | 47 | |
michael@0 | 48 | #ifndef WM_THEMECHANGED |
michael@0 | 49 | #define WM_THEMECHANGED 0x031A |
michael@0 | 50 | #endif |
michael@0 | 51 | |
michael@0 | 52 | #ifndef WM_GETOBJECT |
michael@0 | 53 | #define WM_GETOBJECT 0x03d |
michael@0 | 54 | #endif |
michael@0 | 55 | |
michael@0 | 56 | #ifndef PBT_APMRESUMEAUTOMATIC |
michael@0 | 57 | #define PBT_APMRESUMEAUTOMATIC 0x0012 |
michael@0 | 58 | #endif |
michael@0 | 59 | |
michael@0 | 60 | #ifndef WM_MOUSEHWHEEL |
michael@0 | 61 | #define WM_MOUSEHWHEEL 0x020E |
michael@0 | 62 | #endif |
michael@0 | 63 | |
michael@0 | 64 | #ifndef MOUSEEVENTF_HWHEEL |
michael@0 | 65 | #define MOUSEEVENTF_HWHEEL 0x01000 |
michael@0 | 66 | #endif |
michael@0 | 67 | |
michael@0 | 68 | #ifndef WM_MOUSELEAVE |
michael@0 | 69 | #define WM_MOUSELEAVE 0x02A3 |
michael@0 | 70 | #endif |
michael@0 | 71 | |
michael@0 | 72 | #ifndef SPI_GETWHEELSCROLLCHARS |
michael@0 | 73 | #define SPI_GETWHEELSCROLLCHARS 0x006C |
michael@0 | 74 | #endif |
michael@0 | 75 | |
michael@0 | 76 | #ifndef SPI_SETWHEELSCROLLCHARS |
michael@0 | 77 | #define SPI_SETWHEELSCROLLCHARS 0x006D |
michael@0 | 78 | #endif |
michael@0 | 79 | |
michael@0 | 80 | #ifndef MAPVK_VSC_TO_VK |
michael@0 | 81 | #define MAPVK_VK_TO_VSC 0 |
michael@0 | 82 | #define MAPVK_VSC_TO_VK 1 |
michael@0 | 83 | #define MAPVK_VK_TO_CHAR 2 |
michael@0 | 84 | #define MAPVK_VSC_TO_VK_EX 3 |
michael@0 | 85 | #define MAPVK_VK_TO_VSC_EX 4 |
michael@0 | 86 | #endif |
michael@0 | 87 | |
michael@0 | 88 | // ConstrainPosition window positioning slop value |
michael@0 | 89 | #define kWindowPositionSlop 20 |
michael@0 | 90 | |
michael@0 | 91 | // Origin of the system context menu when displayed in full screen mode |
michael@0 | 92 | #define MOZ_SYSCONTEXT_X_POS 20 |
michael@0 | 93 | #define MOZ_SYSCONTEXT_Y_POS 20 |
michael@0 | 94 | |
michael@0 | 95 | // Drop shadow window style |
michael@0 | 96 | #define CS_XP_DROPSHADOW 0x00020000 |
michael@0 | 97 | |
michael@0 | 98 | // Don't put more than this many rects in the dirty region, just fluff |
michael@0 | 99 | // out to the bounding-box if there are more |
michael@0 | 100 | #define MAX_RECTS_IN_REGION 100 |
michael@0 | 101 | |
michael@0 | 102 | // App Command messages for IntelliMouse and Natural Keyboard Pro |
michael@0 | 103 | // These messages are not included in Visual C++ 6.0, but are in 7.0+ |
michael@0 | 104 | #ifndef WM_APPCOMMAND |
michael@0 | 105 | #define WM_APPCOMMAND 0x0319 |
michael@0 | 106 | #endif |
michael@0 | 107 | |
michael@0 | 108 | #define FAPPCOMMAND_MASK 0xF000 |
michael@0 | 109 | |
michael@0 | 110 | #ifndef WM_GETTITLEBARINFOEX |
michael@0 | 111 | #define WM_GETTITLEBARINFOEX 0x033F |
michael@0 | 112 | #endif |
michael@0 | 113 | |
michael@0 | 114 | #ifndef CCHILDREN_TITLEBAR |
michael@0 | 115 | #define CCHILDREN_TITLEBAR 5 |
michael@0 | 116 | #endif |
michael@0 | 117 | |
michael@0 | 118 | #ifndef APPCOMMAND_BROWSER_BACKWARD |
michael@0 | 119 | #define APPCOMMAND_BROWSER_BACKWARD 1 |
michael@0 | 120 | #define APPCOMMAND_BROWSER_FORWARD 2 |
michael@0 | 121 | #define APPCOMMAND_BROWSER_REFRESH 3 |
michael@0 | 122 | #define APPCOMMAND_BROWSER_STOP 4 |
michael@0 | 123 | #define APPCOMMAND_BROWSER_SEARCH 5 |
michael@0 | 124 | #define APPCOMMAND_BROWSER_FAVORITES 6 |
michael@0 | 125 | #define APPCOMMAND_BROWSER_HOME 7 |
michael@0 | 126 | |
michael@0 | 127 | /* |
michael@0 | 128 | * Additional commands currently not in use. |
michael@0 | 129 | * |
michael@0 | 130 | *#define APPCOMMAND_VOLUME_MUTE 8 |
michael@0 | 131 | *#define APPCOMMAND_VOLUME_DOWN 9 |
michael@0 | 132 | *#define APPCOMMAND_VOLUME_UP 10 |
michael@0 | 133 | *#define APPCOMMAND_MEDIA_NEXTTRACK 11 |
michael@0 | 134 | *#define APPCOMMAND_MEDIA_PREVIOUSTRACK 12 |
michael@0 | 135 | *#define APPCOMMAND_MEDIA_STOP 13 |
michael@0 | 136 | *#define APPCOMMAND_MEDIA_PLAY_PAUSE 14 |
michael@0 | 137 | *#define APPCOMMAND_LAUNCH_MAIL 15 |
michael@0 | 138 | *#define APPCOMMAND_LAUNCH_MEDIA_SELECT 16 |
michael@0 | 139 | *#define APPCOMMAND_LAUNCH_APP1 17 |
michael@0 | 140 | *#define APPCOMMAND_LAUNCH_APP2 18 |
michael@0 | 141 | *#define APPCOMMAND_BASS_DOWN 19 |
michael@0 | 142 | *#define APPCOMMAND_BASS_BOOST 20 |
michael@0 | 143 | *#define APPCOMMAND_BASS_UP 21 |
michael@0 | 144 | *#define APPCOMMAND_TREBLE_DOWN 22 |
michael@0 | 145 | *#define APPCOMMAND_TREBLE_UP 23 |
michael@0 | 146 | *#define FAPPCOMMAND_MOUSE 0x8000 |
michael@0 | 147 | *#define FAPPCOMMAND_KEY 0 |
michael@0 | 148 | *#define FAPPCOMMAND_OEM 0x1000 |
michael@0 | 149 | */ |
michael@0 | 150 | |
michael@0 | 151 | #define GET_APPCOMMAND_LPARAM(lParam) ((short)(HIWORD(lParam) & ~FAPPCOMMAND_MASK)) |
michael@0 | 152 | |
michael@0 | 153 | /* |
michael@0 | 154 | *#define GET_DEVICE_LPARAM(lParam) ((WORD)(HIWORD(lParam) & FAPPCOMMAND_MASK)) |
michael@0 | 155 | *#define GET_MOUSEORKEY_LPARAM GET_DEVICE_LPARAM |
michael@0 | 156 | *#define GET_FLAGS_LPARAM(lParam) (LOWORD(lParam)) |
michael@0 | 157 | *#define GET_KEYSTATE_LPARAM(lParam) GET_FLAGS_LPARAM(lParam) |
michael@0 | 158 | */ |
michael@0 | 159 | #endif // #ifndef APPCOMMAND_BROWSER_BACKWARD |
michael@0 | 160 | |
michael@0 | 161 | //Tablet PC Mouse Input Source |
michael@0 | 162 | #define TABLET_INK_SIGNATURE 0xFFFFFF00 |
michael@0 | 163 | #define TABLET_INK_CHECK 0xFF515700 |
michael@0 | 164 | #define TABLET_INK_TOUCH 0x00000080 |
michael@0 | 165 | #define MOUSE_INPUT_SOURCE() WinUtils::GetMouseInputSource() |
michael@0 | 166 | |
michael@0 | 167 | /************************************************************** |
michael@0 | 168 | * |
michael@0 | 169 | * SECTION: enums |
michael@0 | 170 | * |
michael@0 | 171 | **************************************************************/ |
michael@0 | 172 | |
michael@0 | 173 | // nsWindow::sCanQuit |
michael@0 | 174 | typedef enum |
michael@0 | 175 | { |
michael@0 | 176 | TRI_UNKNOWN = -1, |
michael@0 | 177 | TRI_FALSE = 0, |
michael@0 | 178 | TRI_TRUE = 1 |
michael@0 | 179 | } TriStateBool; |
michael@0 | 180 | |
michael@0 | 181 | /************************************************************** |
michael@0 | 182 | * |
michael@0 | 183 | * SECTION: constants |
michael@0 | 184 | * |
michael@0 | 185 | **************************************************************/ |
michael@0 | 186 | |
michael@0 | 187 | /* |
michael@0 | 188 | * Native windows class names |
michael@0 | 189 | * |
michael@0 | 190 | * ::: IMPORTANT ::: |
michael@0 | 191 | * |
michael@0 | 192 | * External apps and drivers depend on window class names. |
michael@0 | 193 | * For example, changing the window classes could break |
michael@0 | 194 | * touchpad scrolling or screen readers. |
michael@0 | 195 | */ |
michael@0 | 196 | const uint32_t kMaxClassNameLength = 40; |
michael@0 | 197 | const char kClassNameHidden[] = "MozillaHiddenWindowClass"; |
michael@0 | 198 | const char kClassNameGeneral[] = "MozillaWindowClass"; |
michael@0 | 199 | const char kClassNameDialog[] = "MozillaDialogClass"; |
michael@0 | 200 | const char kClassNameDropShadow[] = "MozillaDropShadowWindowClass"; |
michael@0 | 201 | const char kClassNameTemp[] = "MozillaTempWindowClass"; |
michael@0 | 202 | |
michael@0 | 203 | /************************************************************** |
michael@0 | 204 | * |
michael@0 | 205 | * SECTION: structs |
michael@0 | 206 | * |
michael@0 | 207 | **************************************************************/ |
michael@0 | 208 | |
michael@0 | 209 | // Used for synthesizing events |
michael@0 | 210 | struct KeyPair { |
michael@0 | 211 | uint8_t mGeneral; |
michael@0 | 212 | uint8_t mSpecific; |
michael@0 | 213 | KeyPair(uint32_t aGeneral, uint32_t aSpecific) |
michael@0 | 214 | : mGeneral(uint8_t(aGeneral)), mSpecific(uint8_t(aSpecific)) {} |
michael@0 | 215 | }; |
michael@0 | 216 | |
michael@0 | 217 | #if (WINVER < 0x0600) |
michael@0 | 218 | struct TITLEBARINFOEX |
michael@0 | 219 | { |
michael@0 | 220 | DWORD cbSize; |
michael@0 | 221 | RECT rcTitleBar; |
michael@0 | 222 | DWORD rgstate[CCHILDREN_TITLEBAR + 1]; |
michael@0 | 223 | RECT rgrect[CCHILDREN_TITLEBAR + 1]; |
michael@0 | 224 | }; |
michael@0 | 225 | #endif |
michael@0 | 226 | |
michael@0 | 227 | namespace mozilla { |
michael@0 | 228 | namespace widget { |
michael@0 | 229 | |
michael@0 | 230 | struct MSGResult |
michael@0 | 231 | { |
michael@0 | 232 | // Result for the message. |
michael@0 | 233 | LRESULT& mResult; |
michael@0 | 234 | // If mConsumed is true, the caller shouldn't call next wndproc. |
michael@0 | 235 | bool mConsumed; |
michael@0 | 236 | |
michael@0 | 237 | MSGResult(LRESULT* aResult = nullptr) : |
michael@0 | 238 | mResult(aResult ? *aResult : mDefaultResult), mConsumed(false) |
michael@0 | 239 | { |
michael@0 | 240 | } |
michael@0 | 241 | |
michael@0 | 242 | private: |
michael@0 | 243 | LRESULT mDefaultResult; |
michael@0 | 244 | }; |
michael@0 | 245 | |
michael@0 | 246 | } // namespace widget |
michael@0 | 247 | } // namespace mozilla |
michael@0 | 248 | |
michael@0 | 249 | /************************************************************** |
michael@0 | 250 | * |
michael@0 | 251 | * SECTION: macros |
michael@0 | 252 | * |
michael@0 | 253 | **************************************************************/ |
michael@0 | 254 | |
michael@0 | 255 | #define NSRGB_2_COLOREF(color) \ |
michael@0 | 256 | RGB(NS_GET_R(color),NS_GET_G(color),NS_GET_B(color)) |
michael@0 | 257 | #define COLOREF_2_NSRGB(color) \ |
michael@0 | 258 | NS_RGB(GetRValue(color), GetGValue(color), GetBValue(color)) |
michael@0 | 259 | |
michael@0 | 260 | #define VERIFY_WINDOW_STYLE(s) \ |
michael@0 | 261 | NS_ASSERTION(((s) & (WS_CHILD | WS_POPUP)) != (WS_CHILD | WS_POPUP), \ |
michael@0 | 262 | "WS_POPUP and WS_CHILD are mutually exclusive") |
michael@0 | 263 | |
michael@0 | 264 | #endif /* WindowDefs_h__ */ |