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

Side by Side Diff: panels/panel.h

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, 7 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
OLDNEW
1 // Copyright (c) 2010 The Chromium OS Authors. All rights reserved. 1 // Copyright (c) 2010 The Chromium OS 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 #ifndef WINDOW_MANAGER_PANELS_PANEL_H_ 5 #ifndef WINDOW_MANAGER_PANELS_PANEL_H_
6 #define WINDOW_MANAGER_PANELS_PANEL_H_ 6 #define WINDOW_MANAGER_PANELS_PANEL_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 66
67 // The current left edge of the content or titlebar window (that is, its 67 // The current left edge of the content or titlebar window (that is, its
68 // composited position). 68 // composited position).
69 int content_x() const { return content_bounds_.x; } 69 int content_x() const { return content_bounds_.x; }
70 int titlebar_x() const { return titlebar_bounds_.x; } 70 int titlebar_x() const { return titlebar_bounds_.x; }
71 int content_center() const { return content_x() + 0.5 * content_width(); } 71 int content_center() const { return content_x() + 0.5 * content_width(); }
72 72
73 int titlebar_y() const { return titlebar_bounds_.y; } 73 int titlebar_y() const { return titlebar_bounds_.y; }
74 int content_y() const { return content_bounds_.y; } 74 int content_y() const { return content_bounds_.y; }
75 75
76 Size content_size() const { return content_bounds_.size(); }
77 Size titlebar_size() const { return titlebar_bounds_.size(); }
78
76 // TODO: Remove content and titlebar width. 79 // TODO: Remove content and titlebar width.
77 int content_width() const { return content_bounds_.width; } 80 int content_width() const { return content_bounds_.width; }
78 int titlebar_width() const { return titlebar_bounds_.width; } 81 int titlebar_width() const { return titlebar_bounds_.width; }
79 int width() const { return content_bounds_.width; } 82 int width() const { return content_bounds_.width; }
80 83
81 int content_height() const { return content_bounds_.height; } 84 int content_height() const { return content_bounds_.height; }
82 int titlebar_height() const { return titlebar_bounds_.height; } 85 int titlebar_height() const { return titlebar_bounds_.height; }
83 int total_height() const { return content_height() + titlebar_height(); } 86 int total_height() const { return content_height() + titlebar_height(); }
84 87
85 bool is_focused() const { return content_win_->IsFocused(); } 88 bool is_focused() const { return content_win_->IsFocused(); }
86 89
87 // Is the user currently dragging one of the resize handles? 90 // Is the user currently dragging one of the resize handles?
88 bool is_being_resized_by_user() const { return resize_drag_xid_ != 0; } 91 bool is_being_resized_by_user() const { return resize_drag_xid_ != 0; }
89 92
90 // Fill the passed-in vector with all of the panel's input windows (in an 93 // Fill the passed-in vector with all of the panel's input windows (in an
91 // arbitrary order). 94 // arbitrary order).
92 void GetInputWindows(std::vector<XWindow>* windows_out); 95 void GetInputWindows(std::vector<XWindow>* windows_out);
93 96
94 // Handle events occurring in one of our input windows. 97 // Handle events occurring in one of our input windows.
98 // Positions are relative to the window's origin.
95 void HandleInputWindowButtonPress( 99 void HandleInputWindowButtonPress(
96 XWindow xid, int x, int y, int button, XTime timestamp); 100 XWindow xid, const Point& relative_pos, int button, XTime timestamp);
97 void HandleInputWindowButtonRelease( 101 void HandleInputWindowButtonRelease(
98 XWindow xid, int x, int y, int button, XTime timestamp); 102 XWindow xid, const Point& relative_pos, int button, XTime timestamp);
99 void HandleInputWindowPointerMotion(XWindow xid, int x, int y); 103 void HandleInputWindowPointerMotion(XWindow xid, const Point& relative_pos);
100 104
101 // Move the panel. |right| is given in terms of one pixel beyond 105 // Move the panel. The X coordinate is given in terms of one pixel beyond the
102 // the panel's right edge (since content and titlebar windows share a 106 // panel's right edge (since content and titlebar windows share a common right
103 // common right edge), while |y| is the top of the titlebar window. 107 // edge), while the Y coordinate is the top of the titlebar window. For
104 // For example, to place the left column of a 10-pixel-wide panel at 108 // example, to place the left column of a 10-pixel-wide panel at X coordinate
105 // X-coordinate 0 and the right column at 9, pass 10 for |right|. 109 // 0 and the right column at 9, pass 10 for for the X coordinate.
106 // 110 //
107 // Note: Move() must be called initially to configure the windows (see 111 // Note: Move() must be called initially to configure the windows (see
108 // the constructor's comment). 112 // the constructor's comment).
109 void Move(int right, int y, int anim_ms); 113 void Move(const Point& top_right_origin, int anim_ms);
110 void MoveX(int right, int anim_ms); 114 void MoveX(int right, int anim_ms);
111 void MoveY(int y, int anim_ms); 115 void MoveY(int y, int anim_ms);
112 116
113 // Set the titlebar window's width (while keeping it right-aligned with 117 // Set the titlebar window's width (while keeping it right-aligned with
114 // the content window). 118 // the content window).
115 void SetTitlebarWidth(int width); 119 void SetTitlebarWidth(int width);
116 120
117 // Set the opacity of the titlebar and content windows' drop shadows. 121 // Set the opacity of the titlebar and content windows' drop shadows.
118 void SetShadowOpacity(double opacity, int anim_ms); 122 void SetShadowOpacity(double opacity, int anim_ms);
119 123
(...skipping 10 matching lines...) Expand all
130 // still updates the local variable). 134 // still updates the local variable).
131 bool SetExpandedState(bool expanded); 135 bool SetExpandedState(bool expanded);
132 136
133 // Give the focus to the content window. 137 // Give the focus to the content window.
134 void TakeFocus(XTime timestamp); 138 void TakeFocus(XTime timestamp);
135 139
136 // Resize the content window to the passed-in dimensions. The titlebar 140 // Resize the content window to the passed-in dimensions. The titlebar
137 // window is moved above the content window if necessary and resized to 141 // window is moved above the content window if necessary and resized to
138 // match the content window's width. The input windows are optionally 142 // match the content window's width. The input windows are optionally
139 // configured. 143 // configured.
140 void ResizeContent(int width, int height, 144 void ResizeContent(const Size& size,
141 Gravity gravity, 145 Gravity gravity,
142 bool configure_input_windows); 146 bool configure_input_windows);
143 147
144 // Make the panel be fullscreen or not fullscreen. When entering 148 // Make the panel be fullscreen or not fullscreen. When entering
145 // fullscreen mode, we restack the content window and configure it to 149 // fullscreen mode, we restack the content window and configure it to
146 // cover the whole screen. Any changes to the panel's position or 150 // cover the whole screen. Any changes to the panel's position or
147 // stacking while it's fullscreened are saved to |content_bounds_|, 151 // stacking while it's fullscreened are saved to |content_bounds_|,
148 // |titlebar_bounds_|, and |stacking_layer_|, but are otherwise deferred 152 // |titlebar_bounds_|, and |stacking_layer_|, but are otherwise deferred
149 // until the panel gets unfullscreened. 153 // until the panel gets unfullscreened.
150 void SetFullscreenState(bool fullscreen); 154 void SetFullscreenState(bool fullscreen);
(...skipping 18 matching lines...) Expand all
169 void HandleDragEnd(); 173 void HandleDragEnd();
170 174
171 // Handle events referring to one of this panel's transient windows. 175 // Handle events referring to one of this panel's transient windows.
172 void HandleTransientWindowMap(Window* win); 176 void HandleTransientWindowMap(Window* win);
173 void HandleTransientWindowUnmap(Window* win); 177 void HandleTransientWindowUnmap(Window* win);
174 void HandleTransientWindowButtonPress( 178 void HandleTransientWindowButtonPress(
175 Window* win, int button, XTime timestamp); 179 Window* win, int button, XTime timestamp);
176 void HandleTransientWindowClientMessage( 180 void HandleTransientWindowClientMessage(
177 Window* win, XAtom message_type, const long data[5]); 181 Window* win, XAtom message_type, const long data[5]);
178 void HandleTransientWindowConfigureRequest( 182 void HandleTransientWindowConfigureRequest(
179 Window* win, int req_x, int req_y, int req_width, int req_height); 183 Window* win, const Rect& requested_bounds);
180 184
181 private: 185 private:
182 FRIEND_TEST(PanelBarTest, PackPanelsAfterPanelResize); 186 FRIEND_TEST(PanelBarTest, PackPanelsAfterPanelResize);
183 FRIEND_TEST(PanelBarTest, FloatingPanelPositionAfterResize); 187 FRIEND_TEST(PanelBarTest, FloatingPanelPositionAfterResize);
184 FRIEND_TEST(PanelManagerTest, ChromeInitiatedPanelResize); 188 FRIEND_TEST(PanelManagerTest, ChromeInitiatedPanelResize);
185 FRIEND_TEST(PanelTest, InputWindows); 189 FRIEND_TEST(PanelTest, InputWindows);
186 FRIEND_TEST(PanelTest, Resize); 190 FRIEND_TEST(PanelTest, Resize);
187 FRIEND_TEST(PanelTest, SizeLimits); 191 FRIEND_TEST(PanelTest, SizeLimits);
188 FRIEND_TEST(PanelTest, ResizeParameter); 192 FRIEND_TEST(PanelTest, ResizeParameter);
189 FRIEND_TEST(PanelTest, SeparatorShadow); 193 FRIEND_TEST(PanelTest, SeparatorShadow);
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
305 309
306 // XID of the input window currently being dragged to resize the panel, 310 // XID of the input window currently being dragged to resize the panel,
307 // or 0 if no drag is in progress. 311 // or 0 if no drag is in progress.
308 XWindow resize_drag_xid_; 312 XWindow resize_drag_xid_;
309 313
310 // Gravity holding a corner in place as the panel is being resized (e.g. 314 // Gravity holding a corner in place as the panel is being resized (e.g.
311 // GRAVITY_SOUTHEAST if |top_left_input_xid_| is being dragged). 315 // GRAVITY_SOUTHEAST if |top_left_input_xid_| is being dragged).
312 Gravity resize_drag_gravity_; 316 Gravity resize_drag_gravity_;
313 317
314 // Pointer coordinates where the resize drag started. 318 // Pointer coordinates where the resize drag started.
315 int resize_drag_start_x_; 319 Point resize_drag_start_pos_;
316 int resize_drag_start_y_;
317 320
318 // Initial content window size at the start of the resize. 321 // Initial content window size at the start of the resize.
319 int resize_drag_orig_width_; 322 Size resize_drag_orig_size_;
320 int resize_drag_orig_height_;
321 323
322 // Most-recent content window size during a resize. 324 // Most-recent content window size during a resize.
323 int resize_drag_last_width_; 325 Size resize_drag_last_size_;
324 int resize_drag_last_height_;
325 326
326 // PanelManager event registrations related to this panel's windows. 327 // PanelManager event registrations related to this panel's windows.
327 scoped_ptr<EventConsumerRegistrar> event_consumer_registrar_; 328 scoped_ptr<EventConsumerRegistrar> event_consumer_registrar_;
328 329
329 // Transient windows owned by this panel. 330 // Transient windows owned by this panel.
330 scoped_ptr<TransientWindowCollection> transients_; 331 scoped_ptr<TransientWindowCollection> transients_;
331 332
332 // Shadow that we draw directly on top of the content window, aligned 333 // Shadow that we draw directly on top of the content window, aligned
333 // with its top edge, to simulate the titlebar casting a shadow on it. 334 // with its top edge, to simulate the titlebar casting a shadow on it.
334 scoped_ptr<Shadow> separator_shadow_; 335 scoped_ptr<Shadow> separator_shadow_;
335 336
336 DISALLOW_COPY_AND_ASSIGN(Panel); 337 DISALLOW_COPY_AND_ASSIGN(Panel);
337 }; 338 };
338 339
339 } // namespace window_manager 340 } // namespace window_manager
340 341
341 #endif // WINDOW_MANAGER_PANELS_PANEL_H_ 342 #endif // WINDOW_MANAGER_PANELS_PANEL_H_
OLDNEW
« no previous file with comments | « motion_event_coalescer_test.cc ('k') | panels/panel.cc » ('j') | window.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698