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

Unified Diff: pointer_position_watcher.cc

Issue 6902072: wm: Update a lot of code to use structs from geometry.h. (Closed) Base URL: ssh://gitrw.chromium.org:9222/window_manager.git@master
Patch Set: move override-redirect stacking and visibility into Window Created 9 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: pointer_position_watcher.cc
diff --git a/pointer_position_watcher.cc b/pointer_position_watcher.cc
index 5e6fcefe2ac106fd24e470e5906dd8a12dc1dead..fb94eda0c4b1e7564825ea47fecc1ba1967e6dfb 100644
--- a/pointer_position_watcher.cc
+++ b/pointer_position_watcher.cc
@@ -17,15 +17,12 @@ PointerPositionWatcher::PointerPositionWatcher(
XConnection* xconn,
Closure* cb,
bool watch_for_entering_target,
- int target_x, int target_y, int target_width, int target_height)
+ const Rect& target_bounds)
: event_loop_(event_loop),
xconn_(xconn),
cb_(cb),
watch_for_entering_target_(watch_for_entering_target),
- target_x_(target_x),
- target_y_(target_y),
- target_width_(target_width),
- target_height_(target_height),
+ target_bounds_(target_bounds),
timeout_id_(-1) {
DCHECK(event_loop);
DCHECK(xconn);
@@ -57,10 +54,7 @@ void PointerPositionWatcher::HandleTimeout() {
return;
// Bail out if we're not in the desired state yet.
- bool in_target = pointer_pos.x >= target_x_ &&
- pointer_pos.x < target_x_ + target_width_ &&
- pointer_pos.y >= target_y_ &&
- pointer_pos.y < target_y_ + target_height_;
+ const bool in_target = target_bounds_.contains_point(pointer_pos);
if ((watch_for_entering_target_ && !in_target) ||
(!watch_for_entering_target_ && in_target))
return;
« no previous file with comments | « pointer_position_watcher.h ('k') | pointer_position_watcher_test.cc » ('j') | window.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698