diff options
author | sky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-05-26 19:06:36 +0000 |
---|---|---|
committer | sky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-05-26 19:06:36 +0000 |
commit | 4978bacf0e1b64f470eaaf828702bdbd84859d9f (patch) | |
tree | 481c167b79eb3fa537a87e39abf5576f8195a078 /chrome/browser/dock_info_gtk.cc | |
parent | 5b1a0e2e761921587a6a5844fa138c0f2055d739 (diff) | |
download | chromium_src-4978bacf0e1b64f470eaaf828702bdbd84859d9f.zip chromium_src-4978bacf0e1b64f470eaaf828702bdbd84859d9f.tar.gz chromium_src-4978bacf0e1b64f470eaaf828702bdbd84859d9f.tar.bz2 |
Makes DockInfo usable on Linux. It doesn't implement
GetDockInfoAtPoint, but that's not important for now.
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/115776
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@16881 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/dock_info_gtk.cc')
-rw-r--r-- | chrome/browser/dock_info_gtk.cc | 35 |
1 files changed, 32 insertions, 3 deletions
diff --git a/chrome/browser/dock_info_gtk.cc b/chrome/browser/dock_info_gtk.cc index 674387c..801b7c1 100644 --- a/chrome/browser/dock_info_gtk.cc +++ b/chrome/browser/dock_info_gtk.cc @@ -4,12 +4,18 @@ #include "chrome/browser/dock_info.h" +#include <gtk/gtk.h> + #include "base/gfx/native_widget_types.h" #include "base/logging.h" +#include "chrome/browser/browser_list.h" // static DockInfo DockInfo::GetDockInfoAtPoint(const gfx::Point& screen_point, const std::set<GtkWidget*>& ignore) { + if (factory_) + return factory_->GetDockInfoAtPoint(screen_point, ignore); + NOTIMPLEMENTED(); return DockInfo(); } @@ -17,17 +23,40 @@ DockInfo DockInfo::GetDockInfoAtPoint(const gfx::Point& screen_point, GtkWindow* DockInfo::GetLocalProcessWindowAtPoint( const gfx::Point& screen_point, const std::set<GtkWidget*>& ignore) { - NOTIMPLEMENTED(); if (factory_) return factory_->GetLocalProcessWindowAtPoint(screen_point, ignore); + + // Iterate over the browserlist to find the window at the specified point. + // This is technically not correct as it doesn't take into account other + // windows that may be on top of a browser window at the same point, but is + // good enough for now. + for (BrowserList::const_iterator i = BrowserList::begin(); + i != BrowserList::end(); ++i) { + Browser* browser = *i; + GtkWindow* window = browser->window()->GetNativeHandle(); + if (ignore.count(GTK_WIDGET(window)) == 0) { + int x, y, w, h; + gtk_window_get_position(window, &x, &y); + gtk_window_get_size(window, &w, &h); + if (gfx::Rect(x, y, w, h).Contains(screen_point)) + return window; + } + } return NULL; } bool DockInfo::GetWindowBounds(gfx::Rect* bounds) const { - NOTIMPLEMENTED(); + if (!window()) + return false; + + int x, y, w, h; + gtk_window_get_position(window(), &x, &y); + gtk_window_get_size(window(), &w, &h); + bounds->SetRect(x, y, w, h); return true; } void DockInfo::SizeOtherWindowTo(const gfx::Rect& bounds) const { - NOTIMPLEMENTED(); + gtk_window_move(window(), bounds.x(), bounds.y()); + gtk_window_resize(window(), bounds.width(), bounds.height()); } |