1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
|
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef UI_VIEWS_WIN_HWND_MESSAGE_HANDLER_H_
#define UI_VIEWS_WIN_HWND_MESSAGE_HANDLER_H_
#include <windows.h>
#include <set>
#include <vector>
#include "base/basictypes.h"
#include "base/compiler_specific.h"
#include "base/memory/scoped_ptr.h"
#include "base/memory/weak_ptr.h"
#include "base/strings/string16.h"
#include "base/win/scoped_gdi_object.h"
#include "base/win/win_util.h"
#include "ui/accessibility/ax_enums.h"
#include "ui/base/ui_base_types.h"
#include "ui/base/win/window_event_target.h"
#include "ui/events/event.h"
#include "ui/gfx/rect.h"
#include "ui/gfx/sequential_id_generator.h"
#include "ui/gfx/win/window_impl.h"
#include "ui/views/ime/input_method_delegate.h"
#include "ui/views/views_export.h"
namespace gfx {
class Canvas;
class ImageSkia;
class Insets;
}
namespace ui {
class ViewProp;
}
namespace views {
class FullscreenHandler;
class HWNDMessageHandlerDelegate;
class InputMethod;
// These two messages aren't defined in winuser.h, but they are sent to windows
// with captions. They appear to paint the window caption and frame.
// Unfortunately if you override the standard non-client rendering as we do
// with CustomFrameWindow, sometimes Windows (not deterministically
// reproducibly but definitely frequently) will send these messages to the
// window and paint the standard caption/title over the top of the custom one.
// So we need to handle these messages in CustomFrameWindow to prevent this
// from happening.
const int WM_NCUAHDRAWCAPTION = 0xAE;
const int WM_NCUAHDRAWFRAME = 0xAF;
// IsMsgHandled() and BEGIN_SAFE_MSG_MAP_EX are a modified version of
// BEGIN_MSG_MAP_EX. The main difference is it adds a WeakPtrFactory member
// (|weak_factory_|) that is used in _ProcessWindowMessage() and changing
// IsMsgHandled() from a member function to a define that checks if the weak
// factory is still valid in addition to the member. Together these allow for
// |this| to be deleted during dispatch.
#define IsMsgHandled() !ref.get() || msg_handled_
#define BEGIN_SAFE_MSG_MAP_EX(the_class) \
private: \
base::WeakPtrFactory<the_class> weak_factory_; \
BOOL msg_handled_; \
\
public: \
/* "handled" management for cracked handlers */ \
void SetMsgHandled(BOOL handled) { \
msg_handled_ = handled; \
} \
BOOL ProcessWindowMessage(HWND hwnd, \
UINT msg, \
WPARAM w_param, \
LPARAM l_param, \
LRESULT& l_result, \
DWORD msg_map_id = 0) { \
base::WeakPtr<HWNDMessageHandler> ref(weak_factory_.GetWeakPtr()); \
BOOL old_msg_handled = msg_handled_; \
BOOL ret = _ProcessWindowMessage(hwnd, msg, w_param, l_param, l_result, \
msg_map_id); \
if (ref.get()) \
msg_handled_ = old_msg_handled; \
return ret; \
} \
BOOL _ProcessWindowMessage(HWND hWnd, \
UINT uMsg, \
WPARAM wParam, \
LPARAM lParam, \
LRESULT& lResult, \
DWORD dwMsgMapID) { \
base::WeakPtr<HWNDMessageHandler> ref(weak_factory_.GetWeakPtr()); \
BOOL bHandled = TRUE; \
hWnd; \
uMsg; \
wParam; \
lParam; \
lResult; \
bHandled; \
switch(dwMsgMapID) { \
case 0:
// An object that handles messages for a HWND that implements the views
// "Custom Frame" look. The purpose of this class is to isolate the windows-
// specific message handling from the code that wraps it. It is intended to be
// used by both a views::NativeWidget and an aura::WindowTreeHost
// implementation.
// TODO(beng): This object should eventually *become* the WindowImpl.
class VIEWS_EXPORT HWNDMessageHandler :
public gfx::WindowImpl,
public internal::InputMethodDelegate,
public ui::WindowEventTarget {
public:
explicit HWNDMessageHandler(HWNDMessageHandlerDelegate* delegate);
~HWNDMessageHandler();
void Init(HWND parent, const gfx::Rect& bounds);
void InitModalType(ui::ModalType modal_type);
void Close();
void CloseNow();
gfx::Rect GetWindowBoundsInScreen() const;
gfx::Rect GetClientAreaBoundsInScreen() const;
gfx::Rect GetRestoredBounds() const;
// This accounts for the case where the widget size is the client size.
gfx::Rect GetClientAreaBounds() const;
void GetWindowPlacement(gfx::Rect* bounds,
ui::WindowShowState* show_state) const;
// Sets the bounds of the HWND to |bounds_in_pixels|. If the HWND size is not
// changed, |force_size_changed| determines if we should pretend it is.
void SetBounds(const gfx::Rect& bounds_in_pixels, bool force_size_changed);
void SetSize(const gfx::Size& size);
void CenterWindow(const gfx::Size& size);
void SetRegion(HRGN rgn);
void StackAbove(HWND other_hwnd);
void StackAtTop();
void Show();
void ShowWindowWithState(ui::WindowShowState show_state);
void ShowMaximizedWithBounds(const gfx::Rect& bounds);
void Hide();
void Maximize();
void Minimize();
void Restore();
void Activate();
void Deactivate();
void SetAlwaysOnTop(bool on_top);
bool IsVisible() const;
bool IsActive() const;
bool IsMinimized() const;
bool IsMaximized() const;
bool IsAlwaysOnTop() const;
bool RunMoveLoop(const gfx::Vector2d& drag_offset, bool hide_on_escape);
void EndMoveLoop();
// Tells the HWND its client area has changed.
void SendFrameChanged();
void FlashFrame(bool flash);
void ClearNativeFocus();
void SetCapture();
void ReleaseCapture();
bool HasCapture() const;
FullscreenHandler* fullscreen_handler() { return fullscreen_handler_.get(); }
void SetVisibilityChangedAnimationsEnabled(bool enabled);
// Returns true if the title changed.
bool SetTitle(const base::string16& title);
void SetCursor(HCURSOR cursor);
void FrameTypeChanged();
void SchedulePaintInRect(const gfx::Rect& rect);
void SetOpacity(BYTE opacity);
void SetWindowIcons(const gfx::ImageSkia& window_icon,
const gfx::ImageSkia& app_icon);
void set_remove_standard_frame(bool remove_standard_frame) {
remove_standard_frame_ = remove_standard_frame;
}
void set_use_system_default_icon(bool use_system_default_icon) {
use_system_default_icon_ = use_system_default_icon;
}
void SetFullscreen(bool fullscreen);
// Updates the window style to reflect whether it can be resized or maximized.
void SizeConstraintsChanged();
private:
typedef std::set<DWORD> TouchIDs;
// Overridden from internal::InputMethodDelegate:
virtual void DispatchKeyEventPostIME(const ui::KeyEvent& key) OVERRIDE;
// Overridden from WindowImpl:
virtual HICON GetDefaultWindowIcon() const OVERRIDE;
virtual LRESULT OnWndProc(UINT message,
WPARAM w_param,
LPARAM l_param) OVERRIDE;
// Overridden from WindowEventTarget
virtual LRESULT HandleMouseMessage(unsigned int message,
WPARAM w_param,
LPARAM l_param,
bool* handled) OVERRIDE;
virtual LRESULT HandleKeyboardMessage(unsigned int message,
WPARAM w_param,
LPARAM l_param,
bool* handled) OVERRIDE;
virtual LRESULT HandleTouchMessage(unsigned int message,
WPARAM w_param,
LPARAM l_param,
bool* handled) OVERRIDE;
virtual LRESULT HandleScrollMessage(unsigned int message,
WPARAM w_param,
LPARAM l_param,
bool* handled) OVERRIDE;
virtual LRESULT HandleNcHitTestMessage(unsigned int message,
WPARAM w_param,
LPARAM l_param,
bool* handled) OVERRIDE;
// Returns the auto-hide edges of the appbar. See
// ViewsDelegate::GetAppbarAutohideEdges() for details. If the edges change,
// OnAppbarAutohideEdgesChanged() is called.
int GetAppbarAutohideEdges(HMONITOR monitor);
// Callback if the autohide edges have changed. See
// ViewsDelegate::GetAppbarAutohideEdges() for details.
void OnAppbarAutohideEdgesChanged();
// Can be called after the delegate has had the opportunity to set focus and
// did not do so.
void SetInitialFocus();
// Called after the WM_ACTIVATE message has been processed by the default
// windows procedure.
void PostProcessActivateMessage(int activation_state, bool minimized);
// Enables disabled owner windows that may have been disabled due to this
// window's modality.
void RestoreEnabledIfNecessary();
// Executes the specified SC_command.
void ExecuteSystemMenuCommand(int command);
// Start tracking all mouse events so that this window gets sent mouse leave
// messages too.
void TrackMouseEvents(DWORD mouse_tracking_flags);
// Responds to the client area changing size, either at window creation time
// or subsequently.
void ClientAreaSizeChanged();
// Returns the insets of the client area relative to the non-client area of
// the window.
bool GetClientAreaInsets(gfx::Insets* insets) const;
// Resets the window region for the current widget bounds if necessary.
// If |force| is true, the window region is reset to NULL even for native
// frame windows.
void ResetWindowRegion(bool force, bool redraw);
// Enables or disables rendering of the non-client (glass) area by DWM,
// under Vista and above, depending on whether the caller has requested a
// custom frame.
void UpdateDwmNcRenderingPolicy();
// Calls DefWindowProc, safely wrapping the call in a ScopedRedrawLock to
// prevent frame flicker. DefWindowProc handling can otherwise render the
// classic-look window title bar directly.
LRESULT DefWindowProcWithRedrawLock(UINT message,
WPARAM w_param,
LPARAM l_param);
// Lock or unlock the window from being able to redraw itself in response to
// updates to its invalid region.
class ScopedRedrawLock;
void LockUpdates(bool force);
void UnlockUpdates(bool force);
// Stops ignoring SetWindowPos() requests (see below).
void StopIgnoringPosChanges() { ignore_window_pos_changes_ = false; }
// Synchronously updates the invalid contents of the Widget. Valid for
// layered windows only.
void RedrawLayeredWindowContents();
// Attempts to force the window to be redrawn, ensuring that it gets
// onscreen.
void ForceRedrawWindow(int attempts);
// Message Handlers ----------------------------------------------------------
BEGIN_SAFE_MSG_MAP_EX(HWNDMessageHandler)
// Range handlers must go first!
CR_MESSAGE_RANGE_HANDLER_EX(WM_MOUSEFIRST, WM_MOUSELAST, OnMouseRange)
CR_MESSAGE_RANGE_HANDLER_EX(WM_NCMOUSEMOVE,
WM_NCXBUTTONDBLCLK,
OnMouseRange)
// CustomFrameWindow hacks
CR_MESSAGE_HANDLER_EX(WM_NCUAHDRAWCAPTION, OnNCUAHDrawCaption)
CR_MESSAGE_HANDLER_EX(WM_NCUAHDRAWFRAME, OnNCUAHDrawFrame)
// Vista and newer
CR_MESSAGE_HANDLER_EX(WM_DWMCOMPOSITIONCHANGED, OnDwmCompositionChanged)
// Non-atlcrack.h handlers
CR_MESSAGE_HANDLER_EX(WM_GETOBJECT, OnGetObject)
// Mouse events.
CR_MESSAGE_HANDLER_EX(WM_MOUSEACTIVATE, OnMouseActivate)
CR_MESSAGE_HANDLER_EX(WM_MOUSELEAVE, OnMouseRange)
CR_MESSAGE_HANDLER_EX(WM_NCMOUSELEAVE, OnMouseRange)
CR_MESSAGE_HANDLER_EX(WM_SETCURSOR, OnSetCursor);
// Key events.
CR_MESSAGE_HANDLER_EX(WM_KEYDOWN, OnKeyEvent)
CR_MESSAGE_HANDLER_EX(WM_KEYUP, OnKeyEvent)
CR_MESSAGE_HANDLER_EX(WM_SYSKEYDOWN, OnKeyEvent)
CR_MESSAGE_HANDLER_EX(WM_SYSKEYUP, OnKeyEvent)
// IME Events.
CR_MESSAGE_HANDLER_EX(WM_IME_SETCONTEXT, OnImeMessages)
CR_MESSAGE_HANDLER_EX(WM_IME_STARTCOMPOSITION, OnImeMessages)
CR_MESSAGE_HANDLER_EX(WM_IME_COMPOSITION, OnImeMessages)
CR_MESSAGE_HANDLER_EX(WM_IME_ENDCOMPOSITION, OnImeMessages)
CR_MESSAGE_HANDLER_EX(WM_IME_REQUEST, OnImeMessages)
CR_MESSAGE_HANDLER_EX(WM_IME_NOTIFY, OnImeMessages)
CR_MESSAGE_HANDLER_EX(WM_CHAR, OnImeMessages)
CR_MESSAGE_HANDLER_EX(WM_SYSCHAR, OnImeMessages)
// Scroll events
CR_MESSAGE_HANDLER_EX(WM_VSCROLL, OnScrollMessage)
CR_MESSAGE_HANDLER_EX(WM_HSCROLL, OnScrollMessage)
// Touch Events.
CR_MESSAGE_HANDLER_EX(WM_TOUCH, OnTouchEvent)
// Uses the general handler macro since the specific handler macro
// MSG_WM_NCACTIVATE would convert WPARAM type to BOOL type. The high
// word of WPARAM could be set when the window is minimized or restored.
CR_MESSAGE_HANDLER_EX(WM_NCACTIVATE, OnNCActivate)
// This list is in _ALPHABETICAL_ order! OR I WILL HURT YOU.
CR_MSG_WM_ACTIVATEAPP(OnActivateApp)
CR_MSG_WM_APPCOMMAND(OnAppCommand)
CR_MSG_WM_CANCELMODE(OnCancelMode)
CR_MSG_WM_CAPTURECHANGED(OnCaptureChanged)
CR_MSG_WM_CLOSE(OnClose)
CR_MSG_WM_COMMAND(OnCommand)
CR_MSG_WM_CREATE(OnCreate)
CR_MSG_WM_DESTROY(OnDestroy)
CR_MSG_WM_DISPLAYCHANGE(OnDisplayChange)
CR_MSG_WM_ENTERMENULOOP(OnEnterMenuLoop)
CR_MSG_WM_EXITMENULOOP(OnExitMenuLoop)
CR_MSG_WM_ENTERSIZEMOVE(OnEnterSizeMove)
CR_MSG_WM_ERASEBKGND(OnEraseBkgnd)
CR_MSG_WM_EXITSIZEMOVE(OnExitSizeMove)
CR_MSG_WM_GETMINMAXINFO(OnGetMinMaxInfo)
CR_MSG_WM_INITMENU(OnInitMenu)
CR_MSG_WM_INPUTLANGCHANGE(OnInputLangChange)
CR_MSG_WM_KILLFOCUS(OnKillFocus)
CR_MSG_WM_MOVE(OnMove)
CR_MSG_WM_MOVING(OnMoving)
CR_MSG_WM_NCCALCSIZE(OnNCCalcSize)
CR_MSG_WM_NCHITTEST(OnNCHitTest)
CR_MSG_WM_NCPAINT(OnNCPaint)
CR_MSG_WM_NOTIFY(OnNotify)
CR_MSG_WM_PAINT(OnPaint)
CR_MSG_WM_SETFOCUS(OnSetFocus)
CR_MSG_WM_SETICON(OnSetIcon)
CR_MSG_WM_SETTEXT(OnSetText)
CR_MSG_WM_SETTINGCHANGE(OnSettingChange)
CR_MSG_WM_SIZE(OnSize)
CR_MSG_WM_SYSCOMMAND(OnSysCommand)
CR_MSG_WM_THEMECHANGED(OnThemeChanged)
CR_MSG_WM_WINDOWPOSCHANGED(OnWindowPosChanged)
CR_MSG_WM_WINDOWPOSCHANGING(OnWindowPosChanging)
CR_MSG_WM_WTSSESSION_CHANGE(OnSessionChange)
CR_END_MSG_MAP()
// Message Handlers.
// This list is in _ALPHABETICAL_ order!
// TODO(beng): Once this object becomes the WindowImpl, these methods can
// be made private.
void OnActivateApp(BOOL active, DWORD thread_id);
// TODO(beng): return BOOL is temporary until this object becomes a
// WindowImpl.
BOOL OnAppCommand(HWND window, short command, WORD device, int keystate);
void OnCancelMode();
void OnCaptureChanged(HWND window);
void OnClose();
void OnCommand(UINT notification_code, int command, HWND window);
LRESULT OnCreate(CREATESTRUCT* create_struct);
void OnDestroy();
void OnDisplayChange(UINT bits_per_pixel, const gfx::Size& screen_size);
LRESULT OnDwmCompositionChanged(UINT msg, WPARAM w_param, LPARAM l_param);
void OnEnterMenuLoop(BOOL from_track_popup_menu);
void OnEnterSizeMove();
LRESULT OnEraseBkgnd(HDC dc);
void OnExitMenuLoop(BOOL is_shortcut_menu);
void OnExitSizeMove();
void OnGetMinMaxInfo(MINMAXINFO* minmax_info);
LRESULT OnGetObject(UINT message, WPARAM w_param, LPARAM l_param);
LRESULT OnImeMessages(UINT message, WPARAM w_param, LPARAM l_param);
void OnInitMenu(HMENU menu);
void OnInputLangChange(DWORD character_set, HKL input_language_id);
LRESULT OnKeyEvent(UINT message, WPARAM w_param, LPARAM l_param);
void OnKillFocus(HWND focused_window);
LRESULT OnMouseActivate(UINT message, WPARAM w_param, LPARAM l_param);
LRESULT OnMouseRange(UINT message, WPARAM w_param, LPARAM l_param);
void OnMove(const gfx::Point& point);
void OnMoving(UINT param, const RECT* new_bounds);
LRESULT OnNCActivate(UINT message, WPARAM w_param, LPARAM l_param);
LRESULT OnNCCalcSize(BOOL mode, LPARAM l_param);
LRESULT OnNCHitTest(const gfx::Point& point);
void OnNCPaint(HRGN rgn);
LRESULT OnNCUAHDrawCaption(UINT message, WPARAM w_param, LPARAM l_param);
LRESULT OnNCUAHDrawFrame(UINT message, WPARAM w_param, LPARAM l_param);
LRESULT OnNotify(int w_param, NMHDR* l_param);
void OnPaint(HDC dc);
LRESULT OnReflectedMessage(UINT message, WPARAM w_param, LPARAM l_param);
LRESULT OnScrollMessage(UINT message, WPARAM w_param, LPARAM l_param);
void OnSessionChange(WPARAM status_code, PWTSSESSION_NOTIFICATION session_id);
LRESULT OnSetCursor(UINT message, WPARAM w_param, LPARAM l_param);
void OnSetFocus(HWND last_focused_window);
LRESULT OnSetIcon(UINT size_type, HICON new_icon);
LRESULT OnSetText(const wchar_t* text);
void OnSettingChange(UINT flags, const wchar_t* section);
void OnSize(UINT param, const gfx::Size& size);
void OnSysCommand(UINT notification_code, const gfx::Point& point);
void OnThemeChanged();
LRESULT OnTouchEvent(UINT message, WPARAM w_param, LPARAM l_param);
void OnWindowPosChanging(WINDOWPOS* window_pos);
void OnWindowPosChanged(WINDOWPOS* window_pos);
typedef std::vector<ui::TouchEvent> TouchEvents;
// Helper to handle the list of touch events passed in. We need this because
// touch events on windows don't fire if we enter a modal loop in the context
// of a touch event.
void HandleTouchEvents(const TouchEvents& touch_events);
// Resets the flag which indicates that we are in the context of a touch down
// event.
void ResetTouchDownContext();
// Helper to handle mouse events.
// The |message|, |w_param|, |l_param| parameters identify the Windows mouse
// message and its parameters respectively.
// The |track_mouse| parameter indicates if we should track the mouse.
LRESULT HandleMouseEventInternal(UINT message,
WPARAM w_param,
LPARAM l_param,
bool track_mouse);
// Returns true if the mouse message passed in is an OS synthesized mouse
// message.
// |message| identifies the mouse message.
// |message_time| is the time when the message occurred.
// |l_param| indicates the location of the mouse message.
bool IsSynthesizedMouseMessage(unsigned int message,
int message_time,
LPARAM l_param);
// Provides functionality to transition a frame to DWM.
void PerformDwmTransition();
HWNDMessageHandlerDelegate* delegate_;
scoped_ptr<FullscreenHandler> fullscreen_handler_;
// Set to true in Close() and false is CloseNow().
bool waiting_for_close_now_;
bool remove_standard_frame_;
bool use_system_default_icon_;
// Whether all ancestors have been enabled. This is only used if is_modal_ is
// true.
bool restored_enabled_;
// The current cursor.
HCURSOR current_cursor_;
// The last cursor that was active before the current one was selected. Saved
// so that we can restore it.
HCURSOR previous_cursor_;
// Event handling ------------------------------------------------------------
// The flags currently being used with TrackMouseEvent to track mouse
// messages. 0 if there is no active tracking. The value of this member is
// used when tracking is canceled.
DWORD active_mouse_tracking_flags_;
// Set to true when the user presses the right mouse button on the caption
// area. We need this so we can correctly show the context menu on mouse-up.
bool is_right_mouse_pressed_on_caption_;
// The set of touch devices currently down.
TouchIDs touch_ids_;
// ScopedRedrawLock ----------------------------------------------------------
// Represents the number of ScopedRedrawLocks active against this widget.
// If this is greater than zero, the widget should be locked against updates.
int lock_updates_count_;
// Window resizing -----------------------------------------------------------
// When true, this flag makes us discard incoming SetWindowPos() requests that
// only change our position/size. (We still allow changes to Z-order,
// activation, etc.)
bool ignore_window_pos_changes_;
// The last-seen monitor containing us, and its rect and work area. These are
// used to catch updates to the rect and work area and react accordingly.
HMONITOR last_monitor_;
gfx::Rect last_monitor_rect_, last_work_area_;
// Layered windows -----------------------------------------------------------
// Should we keep an off-screen buffer? This is false by default, set to true
// when WS_EX_LAYERED is specified before the native window is created.
//
// NOTE: this is intended to be used with a layered window (a window with an
// extended window style of WS_EX_LAYERED). If you are using a layered window
// and NOT changing the layered alpha or anything else, then leave this value
// alone. OTOH if you are invoking SetLayeredWindowAttributes then you'll
// most likely want to set this to false, or after changing the alpha toggle
// the extended style bit to false than back to true. See MSDN for more
// details.
bool use_layered_buffer_;
// The default alpha to be applied to the layered window.
BYTE layered_alpha_;
// A canvas that contains the window contents in the case of a layered
// window.
scoped_ptr<gfx::Canvas> layered_window_contents_;
// We must track the invalid rect ourselves, for two reasons:
// For layered windows, Windows will not do this properly with
// InvalidateRect()/GetUpdateRect(). (In fact, it'll return misleading
// information from GetUpdateRect()).
// We also need to keep track of the invalid rectangle for the RootView should
// we need to paint the non-client area. The data supplied to WM_NCPAINT seems
// to be insufficient.
gfx::Rect invalid_rect_;
// Set to true when waiting for RedrawLayeredWindowContents().
bool waiting_for_redraw_layered_window_contents_;
// True the first time nccalc is called on a sizable widget
bool is_first_nccalc_;
// Copy of custom window region specified via SetRegion(), if any.
base::win::ScopedRegion custom_window_region_;
// If > 0 indicates a menu is running (we're showing a native menu).
int menu_depth_;
// A factory used to lookup appbar autohide edges.
base::WeakPtrFactory<HWNDMessageHandler> autohide_factory_;
// Generates touch-ids for touch-events.
ui::SequentialIDGenerator id_generator_;
// Indicates if the window needs the WS_VSCROLL and WS_HSCROLL styles.
bool needs_scroll_styles_;
// Set to true if we are in the context of a sizing operation.
bool in_size_loop_;
// Stores a pointer to the WindowEventTarget interface implemented by this
// class. Allows callers to retrieve the interface pointer.
scoped_ptr<ui::ViewProp> prop_window_target_;
// Number of active touch down contexts. This is incremented on touch down
// events and decremented later using a delayed task.
// We need this to ignore WM_MOUSEACTIVATE messages generated in response to
// touch input. This is fine because activation still works correctly via
// native SetFocus calls invoked in the views code.
int touch_down_contexts_;
// Time the last touch message was received. Used to flag mouse messages
// synthesized by Windows for touch which are not flagged by the OS as
// synthesized mouse messages. For more information please refer to
// the IsMouseEventFromTouch function.
static long last_touch_message_time_;
// Time the last WM_MOUSEHWHEEL message is received. Please refer to the
// HandleMouseEventInternal function as to why this is needed.
long last_mouse_hwheel_time_;
// On Windows Vista and beyond, if we are transitioning from custom frame
// to Aero(glass) we delay setting the DWM related properties in full
// screen mode as DWM is not supported in full screen windows. We perform
// the DWM related operations when the window comes out of fullscreen mode.
// This member variable is set to true if the window is transitioning to
// glass. Defaults to false.
bool dwm_transition_desired_;
DISALLOW_COPY_AND_ASSIGN(HWNDMessageHandler);
};
} // namespace views
#endif // UI_VIEWS_WIN_HWND_MESSAGE_HANDLER_H_
|