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

Side by Side Diff: views/window/window_gtk.cc

Issue 6756043: Consolidate Widget Event code, other cleanup. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Consolidate Widget Event code, other cleanup. Created 9 years, 8 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 "views/window/window_gtk.h" 5 #include "views/window/window_gtk.h"
6 6
7 #include "base/i18n/rtl.h" 7 #include "base/i18n/rtl.h"
8 #include "base/utf_string_conversions.h" 8 #include "base/utf_string_conversions.h"
9 #include "ui/gfx/gtk_util.h" 9 #include "ui/gfx/gtk_util.h"
10 #include "ui/gfx/path.h" 10 #include "ui/gfx/path.h"
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 117
118 gboolean WindowGtk::OnButtonPress(GtkWidget* widget, GdkEventButton* event) { 118 gboolean WindowGtk::OnButtonPress(GtkWidget* widget, GdkEventButton* event) {
119 int x = 0, y = 0; 119 int x = 0, y = 0;
120 GetContainedWidgetEventCoordinates(event, &x, &y); 120 GetContainedWidgetEventCoordinates(event, &x, &y);
121 121
122 int hittest_code = 122 int hittest_code =
123 GetWindow()->non_client_view()->NonClientHitTest(gfx::Point(x, y)); 123 GetWindow()->non_client_view()->NonClientHitTest(gfx::Point(x, y));
124 switch (hittest_code) { 124 switch (hittest_code) {
125 case HTCAPTION: { 125 case HTCAPTION: {
126 MouseEvent mouse_pressed(ui::ET_MOUSE_PRESSED, event->x, event->y, 126 MouseEvent mouse_pressed(ui::ET_MOUSE_PRESSED, event->x, event->y,
127 WidgetGtk::GetFlagsForEventButton(*event)); 127 Event::GetFlagsFromGdkEvent(reinterpret_cast<GdkEvent*>(event)));
128 // Start dragging if the mouse event is a single click and *not* a right 128 // Start dragging if the mouse event is a single click and *not* a right
129 // click. If it is a right click, then pass it through to 129 // click. If it is a right click, then pass it through to
130 // WidgetGtk::OnButtonPress so that View class can show ContextMenu upon a 130 // WidgetGtk::OnButtonPress so that View class can show ContextMenu upon a
131 // mouse release event. We only start drag on single clicks as we get a 131 // mouse release event. We only start drag on single clicks as we get a
132 // crash in Gtk on double/triple clicks. 132 // crash in Gtk on double/triple clicks.
133 if (event->type == GDK_BUTTON_PRESS && 133 if (event->type == GDK_BUTTON_PRESS &&
134 !mouse_pressed.IsOnlyRightMouseButton()) { 134 !mouse_pressed.IsOnlyRightMouseButton()) {
135 gfx::Point screen_point(event->x, event->y); 135 gfx::Point screen_point(event->x, event->y);
136 View::ConvertPointToScreen(GetRootView(), &screen_point); 136 View::ConvertPointToScreen(GetRootView(), &screen_point);
137 gtk_window_begin_move_drag(GetNativeWindow(), event->button, 137 gtk_window_begin_move_drag(GetNativeWindow(), event->button,
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after
462 GetWindow()->window_delegate()->SaveWindowPlacement(GetBounds(), maximized); 462 GetWindow()->window_delegate()->SaveWindowPlacement(GetBounds(), maximized);
463 } 463 }
464 464
465 void WindowGtk::OnDestroy(GtkWidget* widget) { 465 void WindowGtk::OnDestroy(GtkWidget* widget) {
466 delegate_->OnNativeWindowDestroying(); 466 delegate_->OnNativeWindowDestroying();
467 WidgetGtk::OnDestroy(widget); 467 WidgetGtk::OnDestroy(widget);
468 delegate_->OnNativeWindowDestroyed(); 468 delegate_->OnNativeWindowDestroyed();
469 } 469 }
470 470
471 } // namespace views 471 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698