Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(8)

Side by Side Diff: ui/views/widget/desktop_aura/desktop_root_window_host_x11.cc

Issue 115453004: Moves management of transients out of Window (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix MRUWindowTracker and MultiProfileMultiBrowserShelfLayoutChromeLauncherControllerTest Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/views/widget/desktop_aura/desktop_root_window_host_x11.h" 5 #include "ui/views/widget/desktop_aura/desktop_root_window_host_x11.h"
6 6
7 #include <X11/extensions/shape.h> 7 #include <X11/extensions/shape.h>
8 #include <X11/extensions/XInput2.h> 8 #include <X11/extensions/XInput2.h>
9 #include <X11/Xatom.h> 9 #include <X11/Xatom.h>
10 #include <X11/Xregion.h> 10 #include <X11/Xregion.h>
(...skipping 19 matching lines...) Expand all
30 #include "ui/events/x/touch_factory_x11.h" 30 #include "ui/events/x/touch_factory_x11.h"
31 #include "ui/gfx/image/image_skia.h" 31 #include "ui/gfx/image/image_skia.h"
32 #include "ui/gfx/image/image_skia_rep.h" 32 #include "ui/gfx/image/image_skia_rep.h"
33 #include "ui/gfx/insets.h" 33 #include "ui/gfx/insets.h"
34 #include "ui/gfx/path.h" 34 #include "ui/gfx/path.h"
35 #include "ui/gfx/path_x11.h" 35 #include "ui/gfx/path_x11.h"
36 #include "ui/native_theme/native_theme.h" 36 #include "ui/native_theme/native_theme.h"
37 #include "ui/views/corewm/compound_event_filter.h" 37 #include "ui/views/corewm/compound_event_filter.h"
38 #include "ui/views/corewm/corewm_switches.h" 38 #include "ui/views/corewm/corewm_switches.h"
39 #include "ui/views/corewm/tooltip_aura.h" 39 #include "ui/views/corewm/tooltip_aura.h"
40 #include "ui/views/corewm/transient_window_manager.h"
40 #include "ui/views/ime/input_method.h" 41 #include "ui/views/ime/input_method.h"
41 #include "ui/views/linux_ui/linux_ui.h" 42 #include "ui/views/linux_ui/linux_ui.h"
42 #include "ui/views/views_delegate.h" 43 #include "ui/views/views_delegate.h"
43 #include "ui/views/widget/desktop_aura/desktop_dispatcher_client.h" 44 #include "ui/views/widget/desktop_aura/desktop_dispatcher_client.h"
44 #include "ui/views/widget/desktop_aura/desktop_drag_drop_client_aurax11.h" 45 #include "ui/views/widget/desktop_aura/desktop_drag_drop_client_aurax11.h"
45 #include "ui/views/widget/desktop_aura/desktop_native_cursor_manager.h" 46 #include "ui/views/widget/desktop_aura/desktop_native_cursor_manager.h"
46 #include "ui/views/widget/desktop_aura/desktop_native_widget_aura.h" 47 #include "ui/views/widget/desktop_aura/desktop_native_widget_aura.h"
47 #include "ui/views/widget/desktop_aura/desktop_root_window_host_observer_x11.h" 48 #include "ui/views/widget/desktop_aura/desktop_root_window_host_observer_x11.h"
48 #include "ui/views/widget/desktop_aura/x11_desktop_handler.h" 49 #include "ui/views/widget/desktop_aura/x11_desktop_handler.h"
49 #include "ui/views/widget/desktop_aura/x11_desktop_window_move_client.h" 50 #include "ui/views/widget/desktop_aura/x11_desktop_window_move_client.h"
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 root_window_ = root; 234 root_window_ = root;
234 235
235 root_window_->window()->SetProperty(kViewsWindowForRootWindow, 236 root_window_->window()->SetProperty(kViewsWindowForRootWindow,
236 content_window_); 237 content_window_);
237 root_window_->window()->SetProperty(kHostForRootWindow, this); 238 root_window_->window()->SetProperty(kHostForRootWindow, this);
238 delegate_ = root_window_; 239 delegate_ = root_window_;
239 240
240 // If we're given a parent, we need to mark ourselves as transient to another 241 // If we're given a parent, we need to mark ourselves as transient to another
241 // window. Otherwise activation gets screwy. 242 // window. Otherwise activation gets screwy.
242 gfx::NativeView parent = params.parent; 243 gfx::NativeView parent = params.parent;
243 if (!params.child && params.parent) 244 if (!params.child && params.parent) {
244 parent->AddTransientChild(content_window_); 245 corewm::AddTransientChild(parent, content_window_);
246 }
245 247
246 // Ensure that the X11DesktopHandler exists so that it dispatches activation 248 // Ensure that the X11DesktopHandler exists so that it dispatches activation
247 // messages to us. 249 // messages to us.
248 X11DesktopHandler::get(); 250 X11DesktopHandler::get();
249 251
250 // TODO(erg): Unify this code once the other consumer goes away. 252 // TODO(erg): Unify this code once the other consumer goes away.
251 x11_window_event_filter_.reset(new X11WindowEventFilter(root_window_, this)); 253 x11_window_event_filter_.reset(new X11WindowEventFilter(root_window_, this));
252 x11_window_event_filter_->SetUseHostWindowBorders(false); 254 x11_window_event_filter_->SetUseHostWindowBorders(false);
253 desktop_native_widget_aura_->root_window_event_filter()->AddHandler( 255 desktop_native_widget_aura_->root_window_event_filter()->AddHandler(
254 x11_window_event_filter_.get()); 256 x11_window_event_filter_.get());
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
357 359
358 void DesktopRootWindowHostX11::StackAtTop() { 360 void DesktopRootWindowHostX11::StackAtTop() {
359 XRaiseWindow(xdisplay_, xwindow_); 361 XRaiseWindow(xdisplay_, xwindow_);
360 } 362 }
361 363
362 void DesktopRootWindowHostX11::CenterWindow(const gfx::Size& size) { 364 void DesktopRootWindowHostX11::CenterWindow(const gfx::Size& size) {
363 gfx::Rect parent_bounds = GetWorkAreaBoundsInScreen(); 365 gfx::Rect parent_bounds = GetWorkAreaBoundsInScreen();
364 366
365 // If |window_|'s transient parent bounds are big enough to contain |size|, 367 // If |window_|'s transient parent bounds are big enough to contain |size|,
366 // use them instead. 368 // use them instead.
367 if (content_window_->transient_parent()) { 369 if (corewm::GetTransientParent(content_window_)) {
368 gfx::Rect transient_parent_rect = 370 gfx::Rect transient_parent_rect =
369 content_window_->transient_parent()->GetBoundsInScreen(); 371 corewm::GetTransientParent(content_window_)->GetBoundsInScreen();
370 if (transient_parent_rect.height() >= size.height() && 372 if (transient_parent_rect.height() >= size.height() &&
371 transient_parent_rect.width() >= size.width()) { 373 transient_parent_rect.width() >= size.width()) {
372 parent_bounds = transient_parent_rect; 374 parent_bounds = transient_parent_rect;
373 } 375 }
374 } 376 }
375 377
376 gfx::Rect window_bounds( 378 gfx::Rect window_bounds(
377 parent_bounds.x() + (parent_bounds.width() - size.width()) / 2, 379 parent_bounds.x() + (parent_bounds.width() - size.width()) / 2,
378 parent_bounds.y() + (parent_bounds.height() - size.height()) / 2, 380 parent_bounds.y() + (parent_bounds.height() - size.height()) / 2,
379 size.width(), 381 size.width(),
(...skipping 1155 matching lines...) Expand 10 before | Expand all | Expand 10 after
1535 if (linux_ui) { 1537 if (linux_ui) {
1536 ui::NativeTheme* native_theme = linux_ui->GetNativeTheme(); 1538 ui::NativeTheme* native_theme = linux_ui->GetNativeTheme();
1537 if (native_theme) 1539 if (native_theme)
1538 return native_theme; 1540 return native_theme;
1539 } 1541 }
1540 1542
1541 return ui::NativeTheme::instance(); 1543 return ui::NativeTheme::instance();
1542 } 1544 }
1543 1545
1544 } // namespace views 1546 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698