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

Side by Side Diff: chrome/browser/chromeos/frame/panel_controller.cc

Issue 7850026: Aura under Linux (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: White spaces Created 9 years, 3 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/chromeos/frame/panel_controller.h" 5 #include "chrome/browser/chromeos/frame/panel_controller.h"
6 6
7 #if defined(TOUCH_UI) 7 #if defined(TOUCH_UI)
8 #include <X11/Xlib.h> 8 #include <X11/Xlib.h>
9 #include <X11/extensions/XInput2.h> 9 #include <X11/extensions/XInput2.h>
10 #endif 10 #endif
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 dragging_(false), 172 dragging_(false),
173 client_event_handler_id_(0), 173 client_event_handler_id_(0),
174 focused_(false), 174 focused_(false),
175 urgent_(false) { 175 urgent_(false) {
176 } 176 }
177 177
178 void PanelController::Init(bool initial_focus, 178 void PanelController::Init(bool initial_focus,
179 const gfx::Rect& window_bounds, 179 const gfx::Rect& window_bounds,
180 XID creator_xid, 180 XID creator_xid,
181 WmIpcPanelUserResizeType resize_type) { 181 WmIpcPanelUserResizeType resize_type) {
182 #if defined(USE_AURA)
183 // TODO(saintlou): Need PureView for panels.
oshima 2011/09/19 15:52:39 You can just skip gtk/WM stuff for now. The result
Emmanuel Saint-loubert-Bié 2011/09/19 20:15:36 Done.
184 #else
182 gfx::Rect title_bounds(0, 0, window_bounds.width(), kTitleHeight); 185 gfx::Rect title_bounds(0, 0, window_bounds.width(), kTitleHeight);
183 186
184 title_window_ = new views::Widget; 187 title_window_ = new views::Widget;
185 views::Widget::InitParams params( 188 views::Widget::InitParams params(
186 views::Widget::InitParams::TYPE_WINDOW_FRAMELESS); 189 views::Widget::InitParams::TYPE_WINDOW_FRAMELESS);
187 params.transparent = true; 190 params.transparent = true;
188 params.bounds = title_bounds; 191 params.bounds = title_bounds;
189 title_window_->Init(params); 192 title_window_->Init(params);
190 gtk_widget_set_size_request(title_window_->GetNativeView(), 193 gtk_widget_set_size_request(title_window_->GetNativeView(),
191 title_bounds.width(), title_bounds.height()); 194 title_bounds.width(), title_bounds.height());
(...skipping 15 matching lines...) Expand all
207 WM_IPC_WINDOW_CHROME_PANEL_CONTENT, 210 WM_IPC_WINDOW_CHROME_PANEL_CONTENT,
208 &type_params); 211 &type_params);
209 212
210 client_event_handler_id_ = g_signal_connect( 213 client_event_handler_id_ = g_signal_connect(
211 panel_, "client-event", G_CALLBACK(OnPanelClientEvent), this); 214 panel_, "client-event", G_CALLBACK(OnPanelClientEvent), this);
212 215
213 title_content_ = new TitleContentView(this); 216 title_content_ = new TitleContentView(this);
214 title_window_->SetContentsView(title_content_); 217 title_window_->SetContentsView(title_content_);
215 UpdateTitleBar(); 218 UpdateTitleBar();
216 title_window_->Show(); 219 title_window_->Show();
220 #endif
217 } 221 }
218 222
219 void PanelController::UpdateTitleBar() { 223 void PanelController::UpdateTitleBar() {
220 if (!delegate_ || !title_window_) 224 if (!delegate_ || !title_window_)
221 return; 225 return;
222 title_content_->title_label()->SetText( 226 title_content_->title_label()->SetText(
223 UTF16ToWideHack(delegate_->GetPanelTitle())); 227 UTF16ToWideHack(delegate_->GetPanelTitle()));
224 title_content_->title_icon()->SetImage(delegate_->GetPanelIcon()); 228 title_content_->title_icon()->SetImage(delegate_->GetPanelIcon());
225 } 229 }
226 230
(...skipping 30 matching lines...) Expand all
257 // titlebar window. See WM_IPC_MESSAGE_WM_NOTIFY_PANEL_DRAGGED's declaration 261 // titlebar window. See WM_IPC_MESSAGE_WM_NOTIFY_PANEL_DRAGGED's declaration
258 // for details. 262 // for details.
259 gint title_width = 1; 263 gint title_width = 1;
260 gtk_window_get_size(GTK_WINDOW(title_), &title_width, NULL); 264 gtk_window_get_size(GTK_WINDOW(title_), &title_width, NULL);
261 265
262 mouse_down_ = true; 266 mouse_down_ = true;
263 mouse_down_offset_x_ = event.x() - title_width; 267 mouse_down_offset_x_ = event.x() - title_width;
264 mouse_down_offset_y_ = event.y(); 268 mouse_down_offset_y_ = event.y();
265 dragging_ = false; 269 dragging_ = false;
266 270
267 #if !defined(TOUCH_UI) 271 #if !defined(TOUCH_UI) && !defined(USE_AURA)
268 const GdkEvent* gdk_event = event.native_event(); 272 const GdkEvent* gdk_event = event.native_event();
269 GdkEventButton last_button_event = gdk_event->button; 273 GdkEventButton last_button_event = gdk_event->button;
270 mouse_down_abs_x_ = last_button_event.x_root; 274 mouse_down_abs_x_ = last_button_event.x_root;
271 mouse_down_abs_y_ = last_button_event.y_root; 275 mouse_down_abs_y_ = last_button_event.y_root;
272 #else 276 #else
273 const XEvent* xev = event.native_event_2(); 277 const XEvent* xev = event.native_event_2();
274 gfx::Point abs_location = RootLocationFromXEvent(xev); 278 gfx::Point abs_location = RootLocationFromXEvent(xev);
275 mouse_down_abs_x_ = abs_location.x(); 279 mouse_down_abs_x_ = abs_location.x();
276 mouse_down_abs_y_ = abs_location.y(); 280 mouse_down_abs_y_ = abs_location.y();
277 #endif 281 #endif
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
509 views::Button* sender, const views::Event& event) { 513 views::Button* sender, const views::Event& event) {
510 if (panel_controller_ && sender == close_button_) 514 if (panel_controller_ && sender == close_button_)
511 panel_controller_->OnCloseButtonPressed(); 515 panel_controller_->OnCloseButtonPressed();
512 } 516 }
513 517
514 PanelController::TitleContentView::~TitleContentView() { 518 PanelController::TitleContentView::~TitleContentView() {
515 VLOG(1) << "panel: delete " << this; 519 VLOG(1) << "panel: delete " << this;
516 } 520 }
517 521
518 } // namespace chromeos 522 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698