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

Unified Diff: chrome/browser/ui/views/tabs/dragged_tab_controller.cc

Issue 6380007: Don't allow new windows to be created outside the monitor's work area.... (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: '' Created 9 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/views/tabs/dragged_tab_controller.cc
===================================================================
--- chrome/browser/ui/views/tabs/dragged_tab_controller.cc (revision 72590)
+++ chrome/browser/ui/views/tabs/dragged_tab_controller.cc (working copy)
@@ -34,6 +34,7 @@
#include "ui/base/animation/slide_animation.h"
#include "ui/base/resource/resource_bundle.h"
#include "views/event.h"
+#include "views/screen.h"
#include "views/widget/root_view.h"
#include "views/widget/widget.h"
#include "views/window/window.h"
@@ -537,6 +538,18 @@
// otherwise we may attempt to maximize on the wrong monitor.
return cursor_point;
}
+ // If the cursor is outside the monitor area, move it inside. For example,
+ // dropping a tab onto the task bar on Windows produces this situation.
+ gfx::Rect work_area = views::Screen::GetMonitorWorkAreaNearestPoint(
+ cursor_point);
sky 2011/01/27 00:22:07 You should only do all this if work_area is not em
+ if (cursor_point.x() < work_area.x())
+ cursor_point.set_x(work_area.x());
+ else if (cursor_point.x() > work_area.right())
+ cursor_point.set_x(work_area.right());
+ if (cursor_point.y() < work_area.y())
+ cursor_point.set_y(work_area.y());
+ else if (cursor_point.y() > work_area.bottom())
+ cursor_point.set_y(work_area.bottom());
return gfx::Point(cursor_point.x() - window_create_point_.x(),
cursor_point.y() - window_create_point_.y());
}
« no previous file with comments | « chrome/browser/ui/tabs/dock_info_win.cc ('k') | views/screen.h » ('j') | views/screen_win.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698