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

Side by Side Diff: chrome/browser/dock_info_gtk.cc

Issue 141061: Revert to enumerating all X windows if the Window Manager doesn't support _NE... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 6 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/common/gtk_util.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/dock_info.h" 5 #include "chrome/browser/dock_info.h"
6 6
7 #include <gtk/gtk.h> 7 #include <gtk/gtk.h>
8 8
9 #include "base/gfx/native_widget_types.h" 9 #include "base/gfx/native_widget_types.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
11 #include "base/task.h" 11 #include "base/task.h"
12 #include "chrome/browser/browser_list.h" 12 #include "chrome/browser/browser_list.h"
13 #include "chrome/browser/browser_window.h" 13 #include "chrome/browser/browser_window.h"
14 #include "chrome/browser/gtk/browser_window_gtk.h" 14 #include "chrome/browser/gtk/browser_window_gtk.h"
15 #include "chrome/common/gtk_util.h" 15 #include "chrome/common/gtk_util.h"
16 16
17 //////////////////////////////////////////////////////////////////////////////// 17 ////////////////////////////////////////////////////////////////////////////////
18 // BaseWindowFinder 18 // BaseWindowFinder
19 // 19 //
20 // Base class used to locate a window. A subclass need only override 20 // Base class used to locate a window. A subclass need only override
21 // ShouldStopIterating to determine when iteration should stop. 21 // ShouldStopIterating to determine when iteration should stop.
22 class BaseWindowFinder : public gtk_util::EnumerateWindowsDelegate { 22 class BaseWindowFinder : public x11_util::EnumerateWindowsDelegate {
23 public: 23 public:
24 explicit BaseWindowFinder(const std::set<GtkWidget*>& ignore) { 24 explicit BaseWindowFinder(const std::set<GtkWidget*>& ignore) {
25 std::set<GtkWidget*>::iterator iter; 25 std::set<GtkWidget*>::iterator iter;
26 for (iter = ignore.begin(); iter != ignore.end(); iter++) { 26 for (iter = ignore.begin(); iter != ignore.end(); iter++) {
27 XID xid = x11_util::GetX11WindowFromGtkWidget(*iter); 27 XID xid = x11_util::GetX11WindowFromGtkWidget(*iter);
28 ignore_.insert(xid); 28 ignore_.insert(xid);
29 } 29 }
30 } 30 }
31 31
32 virtual ~BaseWindowFinder() {} 32 virtual ~BaseWindowFinder() {}
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 } 93 }
94 94
95 private: 95 private:
96 TopMostFinder(XID window, 96 TopMostFinder(XID window,
97 const gfx::Point& screen_loc, 97 const gfx::Point& screen_loc,
98 const std::set<GtkWidget*>& ignore) 98 const std::set<GtkWidget*>& ignore)
99 : BaseWindowFinder(ignore), 99 : BaseWindowFinder(ignore),
100 target_(window), 100 target_(window),
101 screen_loc_(screen_loc), 101 screen_loc_(screen_loc),
102 is_top_most_(false) { 102 is_top_most_(false) {
103 gtk_util::EnumerateChildWindows(this); 103 gtk_util::EnumerateTopLevelWindows(this);
104 } 104 }
105 105
106 // The window we're looking for. 106 // The window we're looking for.
107 XID target_; 107 XID target_;
108 108
109 // Location of window to find. 109 // Location of window to find.
110 gfx::Point screen_loc_; 110 gfx::Point screen_loc_;
111 111
112 // Is target_ the top most window? This is initially false but set to true 112 // Is target_ the top most window? This is initially false but set to true
113 // in ShouldStopIterating if target_ is passed in. 113 // in ShouldStopIterating if target_ is passed in.
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 156
157 return false; 157 return false;
158 } 158 }
159 159
160 private: 160 private:
161 LocalProcessWindowFinder(const gfx::Point& screen_loc, 161 LocalProcessWindowFinder(const gfx::Point& screen_loc,
162 const std::set<GtkWidget*>& ignore) 162 const std::set<GtkWidget*>& ignore)
163 : BaseWindowFinder(ignore), 163 : BaseWindowFinder(ignore),
164 screen_loc_(screen_loc), 164 screen_loc_(screen_loc),
165 result_(0) { 165 result_(0) {
166 gtk_util::EnumerateChildWindows(this); 166 gtk_util::EnumerateTopLevelWindows(this);
167 } 167 }
168 168
169 // Position of the mouse. 169 // Position of the mouse.
170 gfx::Point screen_loc_; 170 gfx::Point screen_loc_;
171 171
172 // The resulting window. This is initially null but set to true in 172 // The resulting window. This is initially null but set to true in
173 // ShouldStopIterating if an appropriate window is found. 173 // ShouldStopIterating if an appropriate window is found.
174 XID result_; 174 XID result_;
175 175
176 DISALLOW_COPY_AND_ASSIGN(LocalProcessWindowFinder); 176 DISALLOW_COPY_AND_ASSIGN(LocalProcessWindowFinder);
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 gtk_window_get_position(window(), &x, &y); 210 gtk_window_get_position(window(), &x, &y);
211 gtk_window_get_size(window(), &w, &h); 211 gtk_window_get_size(window(), &w, &h);
212 bounds->SetRect(x, y, w, h); 212 bounds->SetRect(x, y, w, h);
213 return true; 213 return true;
214 } 214 }
215 215
216 void DockInfo::SizeOtherWindowTo(const gfx::Rect& bounds) const { 216 void DockInfo::SizeOtherWindowTo(const gfx::Rect& bounds) const {
217 gtk_window_move(window(), bounds.x(), bounds.y()); 217 gtk_window_move(window(), bounds.x(), bounds.y());
218 gtk_window_resize(window(), bounds.width(), bounds.height()); 218 gtk_window_resize(window(), bounds.width(), bounds.height());
219 } 219 }
OLDNEW
« no previous file with comments | « no previous file | chrome/common/gtk_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698