OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/gtk/tabs/tab_gtk.h" | 5 #include "chrome/browser/gtk/tabs/tab_gtk.h" |
6 | 6 |
7 #include "app/gfx/path.h" | 7 #include "app/gfx/path.h" |
8 #include "app/l10n_util.h" | 8 #include "app/l10n_util.h" |
9 #include "app/resource_bundle.h" | 9 #include "app/resource_bundle.h" |
10 #include "chrome/browser/gtk/gtk_dnd_util.h" | 10 #include "chrome/browser/gtk/gtk_dnd_util.h" |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 } else if (event->button == 3) { | 168 } else if (event->button == 3) { |
169 tab->ShowContextMenu(); | 169 tab->ShowContextMenu(); |
170 } | 170 } |
171 | 171 |
172 return TRUE; | 172 return TRUE; |
173 } | 173 } |
174 | 174 |
175 // static | 175 // static |
176 gboolean TabGtk::OnMouseRelease(GtkWidget* widget, GdkEventButton* event, | 176 gboolean TabGtk::OnMouseRelease(GtkWidget* widget, GdkEventButton* event, |
177 TabGtk* tab) { | 177 TabGtk* tab) { |
178 if (event->button == 2) { | 178 // Middle mouse up means close the tab, but only if the mouse is over it |
| 179 // (like a button). |
| 180 if (event->button == 2 && |
| 181 event->x >= 0 && event->y >= 0 && |
| 182 event->x < widget->allocation.width && |
| 183 event->y < widget.allocation.height) { |
179 tab->delegate_->CloseTab(tab); | 184 tab->delegate_->CloseTab(tab); |
180 } | 185 } |
181 | 186 |
182 return TRUE; | 187 return TRUE; |
183 } | 188 } |
184 | 189 |
185 // static | 190 // static |
186 gboolean TabGtk::OnEnterNotify(GtkWidget* widget, GdkEventCrossing* event, | 191 gboolean TabGtk::OnEnterNotify(GtkWidget* widget, GdkEventCrossing* event, |
187 TabGtk* tab) { | 192 TabGtk* tab) { |
188 tab->OnMouseEntered(); | 193 tab->OnMouseEntered(); |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
295 if (!menu_controller_.get()) | 300 if (!menu_controller_.get()) |
296 menu_controller_.reset(new ContextMenuController(this)); | 301 menu_controller_.reset(new ContextMenuController(this)); |
297 | 302 |
298 menu_controller_->RunMenu(); | 303 menu_controller_->RunMenu(); |
299 } | 304 } |
300 | 305 |
301 void TabGtk::ContextMenuClosed() { | 306 void TabGtk::ContextMenuClosed() { |
302 delegate()->StopAllHighlighting(); | 307 delegate()->StopAllHighlighting(); |
303 menu_controller_.reset(); | 308 menu_controller_.reset(); |
304 } | 309 } |
OLD | NEW |