diff options
author | erg@chromium.org <erg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-08-17 22:43:46 +0000 |
---|---|---|
committer | erg@chromium.org <erg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-08-17 22:43:46 +0000 |
commit | e46617f1a3089f5e9482b5228e5af56cd87f1bd0 (patch) | |
tree | ef43f67e22002866cea6f5a997653a5379ae9809 /ui/aura/root_window_host_linux.cc | |
parent | 70d7ca92922439fb62b6c7e5c71ed6ea04ff6d32 (diff) | |
download | chromium_src-e46617f1a3089f5e9482b5228e5af56cd87f1bd0.zip chromium_src-e46617f1a3089f5e9482b5228e5af56cd87f1bd0.tar.gz chromium_src-e46617f1a3089f5e9482b5228e5af56cd87f1bd0.tar.bz2 |
Desktop Aura: Allow tab drags out of window.
You can now drag tabs in and out of windows in linux_aura builds. This patch has a lot of moving parts and caveats though.
Moving parts in the patch:
- Added system location to aura::Events.
- Forwarding move events from RootWindowHostLinux to the TabDragController through an observer.
- MessagePumpAuraX11 now can block waiting for a window to be mapped. If we don't do this, we can't perform a grab on the new window.
- The drag offset is threaded from TabDragController through the WindowMoveController interface. (There's no other non-racey way of getting this data locally from X.)
- RootWindowHostLinux now has working Show()/Hide().
TODOs:
- After releasing a new window, the window looks focused, but isn't. You have to click on it for it to receive input focus.
BUG=133059
TEST=none
Review URL: https://chromiumcodereview.appspot.com/10828133
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@152180 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/aura/root_window_host_linux.cc')
-rw-r--r-- | ui/aura/root_window_host_linux.cc | 35 |
1 files changed, 27 insertions, 8 deletions
diff --git a/ui/aura/root_window_host_linux.cc b/ui/aura/root_window_host_linux.cc index 4dd801e..c7d4281 100644 --- a/ui/aura/root_window_host_linux.cc +++ b/ui/aura/root_window_host_linux.cc @@ -473,6 +473,7 @@ RootWindowHostLinux::RootWindowHostLinux(RootWindowHostDelegate* delegate, xwindow_(0), x_root_window_(DefaultRootWindow(xdisplay_)), current_cursor_(ui::kCursorNull), + window_mapped_(false), cursor_shown_(true), bounds_(bounds), focus_when_shown_(false), @@ -619,6 +620,7 @@ bool RootWindowHostLinux::Dispatch(const base::NativeEvent& event) { gfx::Rect bounds(xev->xconfigure.x, xev->xconfigure.y, xev->xconfigure.width, xev->xconfigure.height); bool size_changed = bounds_.size() != bounds.size(); + bool origin_changed = bounds_.origin() != bounds.origin(); bounds_ = bounds; // Update barrier and mouse location when the root window has // moved/resized. @@ -630,6 +632,8 @@ bool RootWindowHostLinux::Dispatch(const base::NativeEvent& event) { } if (size_changed) delegate_->OnHostResized(bounds.size()); + if (origin_changed) + delegate_->OnHostMoved(bounds_.origin()); break; } case GenericEvent: { @@ -781,15 +785,30 @@ void RootWindowHostLinux::Show() { // The device scale factor is now accessible, so load cursors now. image_cursors_->Reload(delegate_->GetDeviceScaleFactor()); - // Before we map the window, set size hints. Otherwise, some window managers - // will ignore toplevel XMoveWindow commands. - XSizeHints size_hints; - size_hints.flags = PPosition; - size_hints.x = bounds_.x(); - size_hints.y = bounds_.y(); - XSetWMNormalHints(xdisplay_, xwindow_, &size_hints); + if (!window_mapped_) { + // Before we map the window, set size hints. Otherwise, some window managers + // will ignore toplevel XMoveWindow commands. + XSizeHints size_hints; + size_hints.flags = PPosition; + size_hints.x = bounds_.x(); + size_hints.y = bounds_.y(); + XSetWMNormalHints(xdisplay_, xwindow_, &size_hints); + + XMapWindow(xdisplay_, xwindow_); + + // We now block until our window is mapped. Some X11 APIs will crash and + // burn if passed |xwindow_| before the window is mapped, and XMapWindow is + // asynchronous. + base::MessagePumpAuraX11::Current()->BlockUntilWindowMapped(xwindow_); + window_mapped_ = true; + } +} - XMapWindow(xdisplay_, xwindow_); +void RootWindowHostLinux::Hide() { + if (window_mapped_) { + XWithdrawWindow(xdisplay_, xwindow_, 0); + window_mapped_ = false; + } } void RootWindowHostLinux::ToggleFullScreen() { |