1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "ui/aura/window_tree_host_x11.h"
8 #include <X11/cursorfont.h>
9 #include <X11/extensions/XInput2.h>
10 #include <X11/extensions/Xrandr.h>
11 #include <X11/Xatom.h>
12 #include <X11/Xcursor/Xcursor.h>
19 #include "base/basictypes.h"
20 #include "base/command_line.h"
21 #include "base/stl_util.h"
22 #include "base/strings/string_number_conversions.h"
23 #include "base/strings/string_split.h"
24 #include "base/strings/string_util.h"
25 #include "base/strings/stringprintf.h"
26 #include "base/sys_info.h"
27 #include "base/trace_event/trace_event.h"
28 #include "ui/aura/client/cursor_client.h"
29 #include "ui/aura/env.h"
30 #include "ui/aura/window.h"
31 #include "ui/aura/window_event_dispatcher.h"
32 #include "ui/base/cursor/cursor.h"
33 #include "ui/base/ui_base_switches.h"
34 #include "ui/base/view_prop.h"
35 #include "ui/base/x/x11_util.h"
36 #include "ui/compositor/compositor.h"
37 #include "ui/compositor/dip_util.h"
38 #include "ui/compositor/layer.h"
39 #include "ui/events/devices/x11/device_data_manager_x11.h"
40 #include "ui/events/devices/x11/device_list_cache_x11.h"
41 #include "ui/events/devices/x11/touch_factory_x11.h"
42 #include "ui/events/event.h"
43 #include "ui/events/event_switches.h"
44 #include "ui/events/event_utils.h"
45 #include "ui/events/keycodes/keyboard_codes.h"
46 #include "ui/events/platform/platform_event_observer.h"
47 #include "ui/events/platform/x11/x11_event_source.h"
48 #include "ui/gfx/screen.h"
57 const char* kAtomsToCache
[] = {
64 ::Window
FindEventTarget(const base::NativeEvent
& xev
) {
65 ::Window target
= xev
->xany
.window
;
66 if (xev
->type
== GenericEvent
)
67 target
= static_cast<XIDeviceEvent
*>(xev
->xcookie
.data
)->event
;
71 void SelectXInput2EventsForRootWindow(XDisplay
* display
, ::Window root_window
) {
72 CHECK(ui::IsXInput2Available());
73 unsigned char mask
[XIMaskLen(XI_LASTEVENT
)] = {};
74 memset(mask
, 0, sizeof(mask
));
76 XISetMask(mask
, XI_HierarchyChanged
);
79 evmask
.deviceid
= XIAllDevices
;
80 evmask
.mask_len
= sizeof(mask
);
82 XISelectEvents(display
, root_window
, &evmask
, 1);
84 #if defined(OS_CHROMEOS)
85 if (base::SysInfo::IsRunningOnChromeOS()) {
86 // It is necessary to listen for touch events on the root window for proper
87 // touch event calibration on Chrome OS, but this is not currently necessary
88 // on the desktop. This seems to fail in some cases (e.g. when logging
89 // in incognito). So select for non-touch events first, and then select for
90 // touch-events (but keep the other events in the mask, i.e. do not memset
92 // TODO(sad): Figure out why this happens. http://crbug.com/153976
93 XISetMask(mask
, XI_TouchBegin
);
94 XISetMask(mask
, XI_TouchUpdate
);
95 XISetMask(mask
, XI_TouchEnd
);
96 XISelectEvents(display
, root_window
, &evmask
, 1);
101 bool default_override_redirect
= false;
107 // TODO(miletus) : Move this into DeviceDataManager.
108 // Accomplishes 2 tasks concerning touch event calibration:
109 // 1. Being a message-pump observer,
110 // routes all the touch events to the X root window,
111 // where they can be calibrated later.
112 // 2. Has the Calibrate method that does the actual bezel calibration,
113 // when invoked from X root window's event dispatcher.
114 class TouchEventCalibrate
: public ui::PlatformEventObserver
{
116 TouchEventCalibrate() : left_(0), right_(0), top_(0), bottom_(0) {
117 if (ui::PlatformEventSource::GetInstance())
118 ui::PlatformEventSource::GetInstance()->AddPlatformEventObserver(this);
119 std::vector
<std::string
> parts
= base::SplitString(
120 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
121 switches::kTouchCalibration
),
122 ",", base::KEEP_WHITESPACE
, base::SPLIT_WANT_NONEMPTY
);
123 if (parts
.size() >= 4) {
124 if (!base::StringToInt(parts
[0], &left_
))
125 DLOG(ERROR
) << "Incorrect left border calibration value passed.";
126 if (!base::StringToInt(parts
[1], &right_
))
127 DLOG(ERROR
) << "Incorrect right border calibration value passed.";
128 if (!base::StringToInt(parts
[2], &top_
))
129 DLOG(ERROR
) << "Incorrect top border calibration value passed.";
130 if (!base::StringToInt(parts
[3], &bottom_
))
131 DLOG(ERROR
) << "Incorrect bottom border calibration value passed.";
135 ~TouchEventCalibrate() override
{
136 if (ui::PlatformEventSource::GetInstance())
137 ui::PlatformEventSource::GetInstance()->RemovePlatformEventObserver(this);
140 // Modify the location of the |event|,
141 // expanding it from |bounds| to (|bounds| + bezels).
142 // Required when touchscreen is bigger than screen (i.e. has bezels),
143 // because we receive events in touchscreen coordinates,
144 // which need to be expanded when converting to screen coordinates,
145 // so that location on bezels will be outside of screen area.
146 void Calibrate(ui::TouchEvent
* event
, const gfx::Rect
& bounds
) {
150 if (!left_
&& !right_
&& !top_
&& !bottom_
)
153 const int resolution_x
= bounds
.width();
154 const int resolution_y
= bounds
.height();
155 if (left_
|| right_
) {
156 // Offset the x position to the real
158 // Scale the screen area back to the full resolution of the screen.
159 x
= (x
* resolution_x
) / (resolution_x
- (right_
+ left_
));
161 if (top_
|| bottom_
) {
162 // When there is a top bezel we add our border,
164 // Scale the screen area back to the full resolution of the screen.
165 y
= (y
* resolution_y
) / (resolution_y
- (bottom_
+ top_
));
168 // Set the modified coordinate back to the event.
169 if (event
->root_location() == event
->location()) {
170 // Usually those will be equal,
171 // if not, I am not sure what the correct value should be.
172 event
->set_root_location(gfx::Point(x
, y
));
174 event
->set_location(gfx::Point(x
, y
));
178 // ui::PlatformEventObserver:
179 void WillProcessEvent(const ui::PlatformEvent
& event
) override
{
180 if (event
->type
== GenericEvent
&&
181 (event
->xgeneric
.evtype
== XI_TouchBegin
||
182 event
->xgeneric
.evtype
== XI_TouchUpdate
||
183 event
->xgeneric
.evtype
== XI_TouchEnd
)) {
184 XIDeviceEvent
* xievent
= static_cast<XIDeviceEvent
*>(event
->xcookie
.data
);
185 xievent
->event
= xievent
->root
;
186 xievent
->event_x
= xievent
->root_x
;
187 xievent
->event_y
= xievent
->root_y
;
191 void DidProcessEvent(const ui::PlatformEvent
& event
) override
{}
193 // The difference in screen's native resolution pixels between
194 // the border of the touchscreen and the border of the screen,
201 DISALLOW_COPY_AND_ASSIGN(TouchEventCalibrate
);
204 } // namespace internal
206 ////////////////////////////////////////////////////////////////////////////////
209 WindowTreeHostX11::WindowTreeHostX11(const gfx::Rect
& bounds
)
210 : xdisplay_(gfx::GetXDisplay()),
212 x_root_window_(DefaultRootWindow(xdisplay_
)),
213 current_cursor_(ui::kCursorNull
),
214 window_mapped_(false),
216 touch_calibrate_(new internal::TouchEventCalibrate
),
217 atom_cache_(xdisplay_
, kAtomsToCache
) {
218 XSetWindowAttributes swa
;
219 memset(&swa
, 0, sizeof(swa
));
220 swa
.background_pixmap
= None
;
221 swa
.override_redirect
= default_override_redirect
;
222 xwindow_
= XCreateWindow(
223 xdisplay_
, x_root_window_
,
224 bounds
.x(), bounds
.y(), bounds
.width(), bounds
.height(),
226 CopyFromParent
, // depth
228 CopyFromParent
, // visual
229 CWBackPixmap
| CWOverrideRedirect
,
231 if (ui::PlatformEventSource::GetInstance())
232 ui::PlatformEventSource::GetInstance()->AddPlatformEventDispatcher(this);
234 long event_mask
= ButtonPressMask
| ButtonReleaseMask
| FocusChangeMask
|
235 KeyPressMask
| KeyReleaseMask
|
236 EnterWindowMask
| LeaveWindowMask
|
237 ExposureMask
| VisibilityChangeMask
|
238 StructureNotifyMask
| PropertyChangeMask
|
240 XSelectInput(xdisplay_
, xwindow_
, event_mask
);
243 if (ui::IsXInput2Available()) {
244 ui::TouchFactory::GetInstance()->SetupXI2ForXWindow(xwindow_
);
245 SelectXInput2EventsForRootWindow(xdisplay_
, x_root_window_
);
248 // TODO(erg): We currently only request window deletion events. We also
249 // should listen for activation events and anything else that GTK+ listens
250 // for, and do something useful.
252 protocols
[0] = atom_cache_
.GetAtom("WM_DELETE_WINDOW");
253 protocols
[1] = atom_cache_
.GetAtom("_NET_WM_PING");
254 XSetWMProtocols(xdisplay_
, xwindow_
, protocols
, 2);
256 // We need a WM_CLIENT_MACHINE and WM_LOCALE_NAME value so we integrate with
257 // the desktop environment.
258 XSetWMProperties(xdisplay_
, xwindow_
, NULL
, NULL
, NULL
, 0, NULL
, NULL
, NULL
);
260 // Likewise, the X server needs to know this window's pid so it knows which
261 // program to kill if the window hangs.
262 // XChangeProperty() expects "pid" to be long.
263 static_assert(sizeof(long) >= sizeof(pid_t
),
264 "pid_t should not be larger than long");
266 XChangeProperty(xdisplay_
,
268 atom_cache_
.GetAtom("_NET_WM_PID"),
272 reinterpret_cast<unsigned char*>(&pid
), 1);
274 // Allow subclasses to create and cache additional atoms.
275 atom_cache_
.allow_uncached_atoms();
277 XRRSelectInput(xdisplay_
, x_root_window_
,
278 RRScreenChangeNotifyMask
| RROutputChangeNotifyMask
);
279 CreateCompositor(GetAcceleratedWidget());
282 WindowTreeHostX11::~WindowTreeHostX11() {
283 if (ui::PlatformEventSource::GetInstance())
284 ui::PlatformEventSource::GetInstance()->RemovePlatformEventDispatcher(this);
288 XDestroyWindow(xdisplay_
, xwindow_
);
291 bool WindowTreeHostX11::CanDispatchEvent(const ui::PlatformEvent
& event
) {
292 ::Window target
= FindEventTarget(event
);
293 return target
== xwindow_
|| target
== x_root_window_
;
296 uint32_t WindowTreeHostX11::DispatchEvent(const ui::PlatformEvent
& event
) {
298 if (FindEventTarget(xev
) == x_root_window_
) {
299 if (xev
->type
== GenericEvent
)
300 DispatchXI2Event(xev
);
301 return ui::POST_DISPATCH_NONE
;
304 if (xev
->type
== MotionNotify
) {
305 // Discard all but the most recent motion event that targets the same
306 // window with unchanged state.
308 while (XPending(xev
->xany
.display
)) {
310 XPeekEvent(xev
->xany
.display
, &next_event
);
311 if (next_event
.type
== MotionNotify
&&
312 next_event
.xmotion
.window
== xev
->xmotion
.window
&&
313 next_event
.xmotion
.subwindow
== xev
->xmotion
.subwindow
&&
314 next_event
.xmotion
.state
== xev
->xmotion
.state
) {
315 XNextEvent(xev
->xany
.display
, &last_event
);
323 if ((xev
->type
== EnterNotify
|| xev
->type
== LeaveNotify
) &&
324 xev
->xcrossing
.detail
== NotifyInferior
) {
325 // Ignore EventNotify and LeaveNotify events from children of |xwindow_|.
326 // NativeViewGLSurfaceGLX adds a child to |xwindow_|.
327 // TODO(pkotwicz|tdanderson): Figure out whether the suppression is
328 // necessary. crbug.com/385716
329 return ui::POST_DISPATCH_STOP_PROPAGATION
;
332 if (xev
->type
== EnterNotify
||
333 xev
->type
== LeaveNotify
||
334 xev
->type
== KeyPress
||
335 xev
->type
== KeyRelease
||
336 xev
->type
== ButtonPress
||
337 xev
->type
== ButtonRelease
||
338 xev
->type
== MotionNotify
) {
339 switch (ui::EventTypeFromNative(xev
)) {
340 case ui::ET_KEY_PRESSED
:
341 case ui::ET_KEY_RELEASED
: {
342 ui::KeyEvent
keydown_event(xev
);
343 SendEventToProcessor(&keydown_event
);
346 case ui::ET_MOUSE_MOVED
:
347 case ui::ET_MOUSE_DRAGGED
:
348 case ui::ET_MOUSE_ENTERED
:
349 case ui::ET_MOUSE_EXITED
:
350 case ui::ET_MOUSE_PRESSED
:
351 case ui::ET_MOUSE_RELEASED
: {
352 ui::MouseEvent
mouse_event(xev
);
353 if (xev
->type
== EnterNotify
) {
354 aura::Window
* root_window
= window();
355 client::CursorClient
* cursor_client
=
356 client::GetCursorClient(root_window
);
358 const gfx::Display display
= gfx::Screen::GetScreenFor(
359 root_window
)->GetDisplayNearestWindow(root_window
);
360 cursor_client
->SetDisplay(display
);
362 // EnterNotify creates ET_MOUSE_MOVE. Mark as synthesized as this is
363 // not a real mouse move event.
364 mouse_event
.set_flags(mouse_event
.flags() | ui::EF_IS_SYNTHESIZED
);
367 TranslateAndDispatchLocatedEvent(&mouse_event
);
370 case ui::ET_MOUSEWHEEL
: {
371 ui::MouseWheelEvent
mouseev(xev
);
372 TranslateAndDispatchLocatedEvent(&mouseev
);
376 // No event is created for X11-release events for mouse-wheel buttons.
381 return ui::POST_DISPATCH_STOP_PROPAGATION
;
386 gfx::Rect
damage_rect(xev
->xexpose
.x
, xev
->xexpose
.y
,
387 xev
->xexpose
.width
, xev
->xexpose
.height
);
388 compositor()->ScheduleRedrawRect(damage_rect
);
392 if (xev
->xfocus
.mode
!= NotifyGrab
)
393 OnHostLostWindowCapture();
395 case ConfigureNotify
: {
396 DCHECK_EQ(xwindow_
, xev
->xconfigure
.event
);
397 DCHECK_EQ(xwindow_
, xev
->xconfigure
.window
);
398 // It's possible that the X window may be resized by some other means
399 // than from within aura (e.g. the X window manager can change the
400 // size). Make sure the root window size is maintained properly.
401 gfx::Rect
bounds(xev
->xconfigure
.x
, xev
->xconfigure
.y
,
402 xev
->xconfigure
.width
, xev
->xconfigure
.height
);
403 bool size_changed
= bounds_
.size() != bounds
.size();
404 bool origin_changed
= bounds_
.origin() != bounds
.origin();
408 OnHostResized(bounds
.size());
410 OnHostMoved(bounds_
.origin());
414 DispatchXI2Event(xev
);
416 case ClientMessage
: {
417 Atom message_type
= static_cast<Atom
>(xev
->xclient
.data
.l
[0]);
418 if (message_type
== atom_cache_
.GetAtom("WM_DELETE_WINDOW")) {
419 // We have received a close message from the window manager.
420 OnHostCloseRequested();
421 } else if (message_type
== atom_cache_
.GetAtom("_NET_WM_PING")) {
422 XEvent reply_event
= *xev
;
423 reply_event
.xclient
.window
= x_root_window_
;
425 XSendEvent(xdisplay_
,
426 reply_event
.xclient
.window
,
428 SubstructureRedirectMask
| SubstructureNotifyMask
,
434 case MappingNotify
: {
435 switch (xev
->xmapping
.request
) {
436 case MappingModifier
:
437 case MappingKeyboard
:
438 XRefreshKeyboardMapping(&xev
->xmapping
);
441 ui::DeviceDataManagerX11::GetInstance()->UpdateButtonMap();
444 NOTIMPLEMENTED() << " Unknown request: " << xev
->xmapping
.request
;
450 return ui::POST_DISPATCH_STOP_PROPAGATION
;
453 ui::EventSource
* WindowTreeHostX11::GetEventSource() {
457 gfx::AcceleratedWidget
WindowTreeHostX11::GetAcceleratedWidget() {
461 void WindowTreeHostX11::ShowImpl() {
462 if (!window_mapped_
) {
463 // Before we map the window, set size hints. Otherwise, some window managers
464 // will ignore toplevel XMoveWindow commands.
465 XSizeHints size_hints
;
466 size_hints
.flags
= PPosition
| PWinGravity
;
467 size_hints
.x
= bounds_
.x();
468 size_hints
.y
= bounds_
.y();
469 // Set StaticGravity so that the window position is not affected by the
470 // frame width when running with window manager.
471 size_hints
.win_gravity
= StaticGravity
;
472 XSetWMNormalHints(xdisplay_
, xwindow_
, &size_hints
);
474 XMapWindow(xdisplay_
, xwindow_
);
476 // We now block until our window is mapped. Some X11 APIs will crash and
477 // burn if passed |xwindow_| before the window is mapped, and XMapWindow is
479 if (ui::X11EventSource::GetInstance())
480 ui::X11EventSource::GetInstance()->BlockUntilWindowMapped(xwindow_
);
481 window_mapped_
= true;
485 void WindowTreeHostX11::HideImpl() {
486 if (window_mapped_
) {
487 XWithdrawWindow(xdisplay_
, xwindow_
, 0);
488 window_mapped_
= false;
492 gfx::Rect
WindowTreeHostX11::GetBounds() const {
496 void WindowTreeHostX11::SetBounds(const gfx::Rect
& bounds
) {
497 // Even if the host window's size doesn't change, aura's root window
498 // size, which is in DIP, changes when the scale changes.
499 float current_scale
= compositor()->device_scale_factor();
500 float new_scale
= gfx::Screen::GetScreenFor(window())->
501 GetDisplayNearestWindow(window()).device_scale_factor();
502 bool origin_changed
= bounds_
.origin() != bounds
.origin();
503 bool size_changed
= bounds_
.size() != bounds
.size();
504 XWindowChanges changes
= {0};
505 unsigned value_mask
= 0;
508 changes
.width
= bounds
.width();
509 changes
.height
= bounds
.height();
510 value_mask
= CWHeight
| CWWidth
;
513 if (origin_changed
) {
514 changes
.x
= bounds
.x();
515 changes
.y
= bounds
.y();
516 value_mask
|= CWX
| CWY
;
519 XConfigureWindow(xdisplay_
, xwindow_
, value_mask
, &changes
);
521 // Assume that the resize will go through as requested, which should be the
522 // case if we're running without a window manager. If there's a window
523 // manager, it can modify or ignore the request, but (per ICCCM) we'll get a
524 // (possibly synthetic) ConfigureNotify about the actual size and correct
528 OnHostMoved(bounds
.origin());
529 if (size_changed
|| current_scale
!= new_scale
) {
530 OnHostResized(bounds
.size());
532 window()->SchedulePaintInRect(window()->bounds());
536 gfx::Point
WindowTreeHostX11::GetLocationOnNativeScreen() const {
537 return bounds_
.origin();
540 void WindowTreeHostX11::SetCapture() {
541 // Do not grab X11 input. Grabbing X11 input is asynchronous and this method
542 // is expected to be synchronous. Grabbing X11 input is unnecessary on
543 // ChromeOS because ChromeOS manages all of the X windows. When running
544 // ChromeOS on the desktop for the sake of debugging:
545 // - Implicit pointer grab as a result of pressing a mouse button
546 // - Releasing capture as a result of losing activation (FocusOut)
550 void WindowTreeHostX11::ReleaseCapture() {
553 void WindowTreeHostX11::SetCursorNative(gfx::NativeCursor cursor
) {
554 if (cursor
== current_cursor_
)
556 current_cursor_
= cursor
;
557 SetCursorInternal(cursor
);
560 void WindowTreeHostX11::MoveCursorToNative(const gfx::Point
& location
) {
561 XWarpPointer(xdisplay_
, None
, x_root_window_
, 0, 0, 0, 0,
562 bounds_
.x() + location
.x(),
563 bounds_
.y() + location
.y());
566 void WindowTreeHostX11::OnCursorVisibilityChangedNative(bool show
) {
569 void WindowTreeHostX11::DispatchXI2Event(const base::NativeEvent
& event
) {
570 ui::TouchFactory
* factory
= ui::TouchFactory::GetInstance();
572 XIDeviceEvent
* xiev
= static_cast<XIDeviceEvent
*>(xev
->xcookie
.data
);
573 if (!factory
->ShouldProcessXI2Event(xev
))
576 TRACE_EVENT1("input", "WindowTreeHostX11::DispatchXI2Event",
578 (ui::EventTimeForNow() - ui::EventTimeFromNative(event
)).
581 int num_coalesced
= 0;
583 if (xev
->xgeneric
.evtype
== XI_Motion
) {
584 // If this is a motion event, we want to coalesce all pending motion
585 // events that are at the top of the queue. Note, we don't coalesce
586 // touch update events here.
587 num_coalesced
= ui::CoalescePendingMotionEvents(xev
, &last_event
);
588 if (num_coalesced
> 0)
591 ui::EventType type
= ui::EventTypeFromNative(xev
);
594 case ui::ET_TOUCH_MOVED
:
595 case ui::ET_TOUCH_PRESSED
:
596 case ui::ET_TOUCH_CANCELLED
:
597 case ui::ET_TOUCH_RELEASED
: {
598 ui::TouchEvent
touchev(xev
);
599 if (ui::DeviceDataManagerX11::GetInstance()->TouchEventNeedsCalibrate(
601 touch_calibrate_
->Calibrate(&touchev
, bounds_
);
603 TranslateAndDispatchLocatedEvent(&touchev
);
606 case ui::ET_MOUSE_MOVED
:
607 case ui::ET_MOUSE_DRAGGED
:
608 case ui::ET_MOUSE_PRESSED
:
609 case ui::ET_MOUSE_RELEASED
:
610 case ui::ET_MOUSE_ENTERED
:
611 case ui::ET_MOUSE_EXITED
: {
612 ui::MouseEvent
mouseev(xev
);
613 TranslateAndDispatchLocatedEvent(&mouseev
);
616 case ui::ET_MOUSEWHEEL
: {
617 ui::MouseWheelEvent
mouseev(xev
);
618 TranslateAndDispatchLocatedEvent(&mouseev
);
621 case ui::ET_SCROLL_FLING_START
:
622 case ui::ET_SCROLL_FLING_CANCEL
:
623 case ui::ET_SCROLL
: {
624 ui::ScrollEvent
scrollev(xev
);
625 SendEventToProcessor(&scrollev
);
628 case ui::ET_KEY_PRESSED
:
629 case ui::ET_KEY_RELEASED
: {
630 ui::KeyEvent
key_event(xev
);
631 SendEventToProcessor(&key_event
);
634 case ui::ET_UMA_DATA
:
642 // If we coalesced an event we need to free its cookie.
643 if (num_coalesced
> 0)
644 XFreeEventData(xev
->xgeneric
.display
, &last_event
.xcookie
);
647 void WindowTreeHostX11::SetCursorInternal(gfx::NativeCursor cursor
) {
648 XDefineCursor(xdisplay_
, xwindow_
, cursor
.platform());
651 void WindowTreeHostX11::OnConfigureNotify() {}
653 void WindowTreeHostX11::TranslateAndDispatchLocatedEvent(
654 ui::LocatedEvent
* event
) {
655 SendEventToProcessor(event
);
659 WindowTreeHost
* WindowTreeHost::Create(const gfx::Rect
& bounds
) {
660 return new WindowTreeHostX11(bounds
);
664 gfx::Size
WindowTreeHost::GetNativeScreenSize() {
665 ::XDisplay
* xdisplay
= gfx::GetXDisplay();
666 return gfx::Size(DisplayWidth(xdisplay
, 0), DisplayHeight(xdisplay
, 0));
671 void SetUseOverrideRedirectWindowByDefault(bool override_redirect
) {
672 default_override_redirect
= override_redirect
;