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

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

Issue 7942004: Consolidate/cleanup event cracking code; single out GdkEvents. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge removal of compact nav. Created 9 years, 2 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 | « chrome/browser/chrome_browser_main.cc ('k') | chrome/browser/ui/views/dropdown_bar_host_gtk.cc » ('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) 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 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
261 // for details. 261 // for details.
262 gint title_width = 1; 262 gint title_width = 1;
263 gtk_window_get_size(GTK_WINDOW(title_), &title_width, NULL); 263 gtk_window_get_size(GTK_WINDOW(title_), &title_width, NULL);
264 264
265 mouse_down_ = true; 265 mouse_down_ = true;
266 mouse_down_offset_x_ = event.x() - title_width; 266 mouse_down_offset_x_ = event.x() - title_width;
267 mouse_down_offset_y_ = event.y(); 267 mouse_down_offset_y_ = event.y();
268 dragging_ = false; 268 dragging_ = false;
269 269
270 #if !defined(TOUCH_UI) && !defined(USE_AURA) 270 #if !defined(TOUCH_UI) && !defined(USE_AURA)
271 const GdkEvent* gdk_event = event.native_event(); 271 const GdkEvent* gdk_event = event.gdk_event();
272 GdkEventButton last_button_event = gdk_event->button; 272 GdkEventButton last_button_event = gdk_event->button;
273 mouse_down_abs_x_ = last_button_event.x_root; 273 mouse_down_abs_x_ = last_button_event.x_root;
274 mouse_down_abs_y_ = last_button_event.y_root; 274 mouse_down_abs_y_ = last_button_event.y_root;
275 #else 275 #else
276 const XEvent* xev = event.native_event_2(); 276 const XEvent* xev = event.native_event();
277 gfx::Point abs_location = RootLocationFromXEvent(xev); 277 gfx::Point abs_location = RootLocationFromXEvent(xev);
278 mouse_down_abs_x_ = abs_location.x(); 278 mouse_down_abs_x_ = abs_location.x();
279 mouse_down_abs_y_ = abs_location.y(); 279 mouse_down_abs_y_ = abs_location.y();
280 #endif 280 #endif
281 return true; 281 return true;
282 } 282 }
283 283
284 void PanelController::TitleMouseReleased(const views::MouseEvent& event) { 284 void PanelController::TitleMouseReleased(const views::MouseEvent& event) {
285 if (event.IsLeftMouseButton()) 285 if (event.IsLeftMouseButton())
286 TitleMouseCaptureLost(); 286 TitleMouseCaptureLost();
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
325 bool PanelController::TitleMouseDragged(const views::MouseEvent& event) { 325 bool PanelController::TitleMouseDragged(const views::MouseEvent& event) {
326 if (!mouse_down_) 326 if (!mouse_down_)
327 return false; 327 return false;
328 if (event.type() != ui::ET_MOUSE_MOVED && 328 if (event.type() != ui::ET_MOUSE_MOVED &&
329 event.type() != ui::ET_MOUSE_DRAGGED) { 329 event.type() != ui::ET_MOUSE_DRAGGED) {
330 NOTREACHED(); 330 NOTREACHED();
331 return false; 331 return false;
332 } 332 }
333 333
334 #if !defined(TOUCH_UI) 334 #if !defined(TOUCH_UI)
335 const GdkEvent* gdk_event = event.native_event(); 335 const GdkEvent* gdk_event = event.gdk_event();
336 GdkEventMotion last_motion_event = gdk_event->motion; 336 GdkEventMotion last_motion_event = gdk_event->motion;
337 int x_root = last_motion_event.x_root; 337 int x_root = last_motion_event.x_root;
338 int y_root = last_motion_event.y_root; 338 int y_root = last_motion_event.y_root;
339 #else 339 #else
340 const XEvent* xev = event.native_event_2(); 340 const XEvent* xev = event.native_event();
341 gfx::Point abs_location = RootLocationFromXEvent(xev); 341 gfx::Point abs_location = RootLocationFromXEvent(xev);
342 int x_root = abs_location.x(); 342 int x_root = abs_location.x();
343 int y_root = abs_location.y(); 343 int y_root = abs_location.y();
344 #endif 344 #endif
345 345
346 if (!dragging_) { 346 if (!dragging_) {
347 if (views::View::ExceededDragThreshold(x_root - mouse_down_abs_x_, 347 if (views::View::ExceededDragThreshold(x_root - mouse_down_abs_x_,
348 y_root - mouse_down_abs_y_)) { 348 y_root - mouse_down_abs_y_)) {
349 dragging_ = true; 349 dragging_ = true;
350 } 350 }
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
512 views::Button* sender, const views::Event& event) { 512 views::Button* sender, const views::Event& event) {
513 if (panel_controller_ && sender == close_button_) 513 if (panel_controller_ && sender == close_button_)
514 panel_controller_->OnCloseButtonPressed(); 514 panel_controller_->OnCloseButtonPressed();
515 } 515 }
516 516
517 PanelController::TitleContentView::~TitleContentView() { 517 PanelController::TitleContentView::~TitleContentView() {
518 VLOG(1) << "panel: delete " << this; 518 VLOG(1) << "panel: delete " << this;
519 } 519 }
520 520
521 } // namespace chromeos 521 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chrome_browser_main.cc ('k') | chrome/browser/ui/views/dropdown_bar_host_gtk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698