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

Unified Diff: ui/views/widget/desktop_aura/x11_desktop_window_move_client.cc

Issue 56053005: linux_aura: Improve window drag performance. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase to ToT Created 7 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/views/widget/desktop_aura/x11_desktop_window_move_client.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/widget/desktop_aura/x11_desktop_window_move_client.cc
diff --git a/ui/views/widget/desktop_aura/x11_desktop_window_move_client.cc b/ui/views/widget/desktop_aura/x11_desktop_window_move_client.cc
index 41573fece9a0b662decba46fc548292e769ddb34..651d6fa738e5c9b05536c8f3952c7578170a714f 100644
--- a/ui/views/widget/desktop_aura/x11_desktop_window_move_client.cc
+++ b/ui/views/widget/desktop_aura/x11_desktop_window_move_client.cc
@@ -18,6 +18,26 @@
#include "ui/events/event.h"
#include "ui/gfx/screen.h"
+namespace {
+
+// Delay moving the window.
+//
+// When we receive a mouse move event, we have to have it processed in a
+// different run through the message pump because moving the window will
+// otherwise prevent tasks from running.
+//
+// This constant was derived with playing with builds of chrome; it has no
+// theoretical justification.
+//
+// TODO(erg): This helps with the performance of dragging windows, but it
+// doesn't really solve the hard problems, which is that various calls to X11,
+// such as XQueryPointer, ui::IsWindowVisible() and ui::WindowContainsPoint()
+// take a while to get replies and block in the process. I've seen all of the
+// above take as long as 20ms to respond.
+const int kMoveDelay = 3;
+
+} // namespace
+
namespace views {
X11DesktopWindowMoveClient::X11DesktopWindowMoveClient()
@@ -30,8 +50,15 @@ X11DesktopWindowMoveClient::~X11DesktopWindowMoveClient() {}
void X11DesktopWindowMoveClient::OnMouseMovement(XMotionEvent* event) {
gfx::Point cursor_point(event->x_root, event->y_root);
gfx::Point system_loc = cursor_point - window_offset_;
- root_window_->SetHostBounds(gfx::Rect(
- system_loc, root_window_->GetHostSize()));
+
+ gfx::Rect target_rect(system_loc, root_window_->GetHostSize());
+
+ window_move_timer_.Start(
+ FROM_HERE,
+ base::TimeDelta::FromMilliseconds(kMoveDelay),
+ base::Bind(&X11DesktopWindowMoveClient::SetHostBounds,
+ base::Unretained(this),
+ target_rect));
}
void X11DesktopWindowMoveClient::OnMouseReleased() {
@@ -57,7 +84,15 @@ aura::client::WindowMoveResult X11DesktopWindowMoveClient::RunMoveLoop(
}
void X11DesktopWindowMoveClient::EndMoveLoop() {
+ window_move_timer_.Stop();
move_loop_.EndMoveLoop();
}
+////////////////////////////////////////////////////////////////////////////////
+// DesktopRootWindowHostLinux, private:
+
+void X11DesktopWindowMoveClient::SetHostBounds(const gfx::Rect& rect) {
+ root_window_->SetHostBounds(rect);
+}
+
} // namespace views
« no previous file with comments | « ui/views/widget/desktop_aura/x11_desktop_window_move_client.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698