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

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: remove unneeded parens Created 6 years, 11 months 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
« no previous file with comments | « ui/views/views.gyp ('k') | ui/views/widget/native_widget_aura.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/window_util.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 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 root_window_ = root; 235 root_window_ = root;
235 236
236 root_window_->window()->SetProperty(kViewsWindowForRootWindow, 237 root_window_->window()->SetProperty(kViewsWindowForRootWindow,
237 content_window_); 238 content_window_);
238 root_window_->window()->SetProperty(kHostForRootWindow, this); 239 root_window_->window()->SetProperty(kHostForRootWindow, this);
239 delegate_ = root_window_; 240 delegate_ = root_window_;
240 241
241 // If we're given a parent, we need to mark ourselves as transient to another 242 // If we're given a parent, we need to mark ourselves as transient to another
242 // window. Otherwise activation gets screwy. 243 // window. Otherwise activation gets screwy.
243 gfx::NativeView parent = params.parent; 244 gfx::NativeView parent = params.parent;
244 if (!params.child && params.parent) 245 if (!params.child && params.parent) {
245 parent->AddTransientChild(content_window_); 246 corewm::AddTransientChild(parent, content_window_);
247 }
246 248
247 // Ensure that the X11DesktopHandler exists so that it dispatches activation 249 // Ensure that the X11DesktopHandler exists so that it dispatches activation
248 // messages to us. 250 // messages to us.
249 X11DesktopHandler::get(); 251 X11DesktopHandler::get();
250 252
251 // TODO(erg): Unify this code once the other consumer goes away. 253 // TODO(erg): Unify this code once the other consumer goes away.
252 x11_window_event_filter_.reset(new X11WindowEventFilter(root_window_, this)); 254 x11_window_event_filter_.reset(new X11WindowEventFilter(root_window_, this));
253 x11_window_event_filter_->SetUseHostWindowBorders(false); 255 x11_window_event_filter_->SetUseHostWindowBorders(false);
254 desktop_native_widget_aura_->root_window_event_filter()->AddHandler( 256 desktop_native_widget_aura_->root_window_event_filter()->AddHandler(
255 x11_window_event_filter_.get()); 257 x11_window_event_filter_.get());
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
359 361
360 void DesktopRootWindowHostX11::StackAtTop() { 362 void DesktopRootWindowHostX11::StackAtTop() {
361 XRaiseWindow(xdisplay_, xwindow_); 363 XRaiseWindow(xdisplay_, xwindow_);
362 } 364 }
363 365
364 void DesktopRootWindowHostX11::CenterWindow(const gfx::Size& size) { 366 void DesktopRootWindowHostX11::CenterWindow(const gfx::Size& size) {
365 gfx::Rect parent_bounds = GetWorkAreaBoundsInScreen(); 367 gfx::Rect parent_bounds = GetWorkAreaBoundsInScreen();
366 368
367 // If |window_|'s transient parent bounds are big enough to contain |size|, 369 // If |window_|'s transient parent bounds are big enough to contain |size|,
368 // use them instead. 370 // use them instead.
369 if (content_window_->transient_parent()) { 371 if (corewm::GetTransientParent(content_window_)) {
370 gfx::Rect transient_parent_rect = 372 gfx::Rect transient_parent_rect =
371 content_window_->transient_parent()->GetBoundsInScreen(); 373 corewm::GetTransientParent(content_window_)->GetBoundsInScreen();
372 if (transient_parent_rect.height() >= size.height() && 374 if (transient_parent_rect.height() >= size.height() &&
373 transient_parent_rect.width() >= size.width()) { 375 transient_parent_rect.width() >= size.width()) {
374 parent_bounds = transient_parent_rect; 376 parent_bounds = transient_parent_rect;
375 } 377 }
376 } 378 }
377 379
378 gfx::Rect window_bounds( 380 gfx::Rect window_bounds(
379 parent_bounds.x() + (parent_bounds.width() - size.width()) / 2, 381 parent_bounds.x() + (parent_bounds.width() - size.width()) / 2,
380 parent_bounds.y() + (parent_bounds.height() - size.height()) / 2, 382 parent_bounds.y() + (parent_bounds.height() - size.height()) / 2,
381 size.width(), 383 size.width(),
(...skipping 1158 matching lines...) Expand 10 before | Expand all | Expand 10 after
1540 if (linux_ui) { 1542 if (linux_ui) {
1541 ui::NativeTheme* native_theme = linux_ui->GetNativeTheme(); 1543 ui::NativeTheme* native_theme = linux_ui->GetNativeTheme();
1542 if (native_theme) 1544 if (native_theme)
1543 return native_theme; 1545 return native_theme;
1544 } 1546 }
1545 1547
1546 return ui::NativeTheme::instance(); 1548 return ui::NativeTheme::instance();
1547 } 1549 }
1548 1550
1549 } // namespace views 1551 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/views.gyp ('k') | ui/views/widget/native_widget_aura.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698