| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/ui/panels/panel_browser_window_gtk.h" | 5 #include "chrome/browser/ui/panels/panel_browser_window_gtk.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "chrome/browser/ui/browser.h" | 8 #include "chrome/browser/ui/browser.h" |
| 9 #include "chrome/browser/ui/browser_list.h" | 9 #include "chrome/browser/ui/browser_list.h" |
| 10 #include "chrome/browser/ui/browser_window.h" | 10 #include "chrome/browser/ui/browser_window.h" |
| (...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 253 void PanelBrowserWindowGtk::EnsureDragHelperCreated() { | 253 void PanelBrowserWindowGtk::EnsureDragHelperCreated() { |
| 254 if (drag_helper_.get()) | 254 if (drag_helper_.get()) |
| 255 return; | 255 return; |
| 256 | 256 |
| 257 drag_helper_.reset(new PanelDragGtk(panel_.get())); | 257 drag_helper_.reset(new PanelDragGtk(panel_.get())); |
| 258 gtk_box_pack_end(GTK_BOX(window_vbox_), drag_helper_->widget(), | 258 gtk_box_pack_end(GTK_BOX(window_vbox_), drag_helper_->widget(), |
| 259 FALSE, FALSE, 0); | 259 FALSE, FALSE, 0); |
| 260 } | 260 } |
| 261 | 261 |
| 262 bool PanelBrowserWindowGtk::HandleTitleBarLeftMousePress( | 262 bool PanelBrowserWindowGtk::HandleTitleBarLeftMousePress( |
| 263 GdkEventButton* event, | 263 GdkEventButton* event) { |
| 264 guint32 last_click_time, | |
| 265 gfx::Point last_click_position) { | |
| 266 DCHECK_EQ(1U, event->button); | 264 DCHECK_EQ(1U, event->button); |
| 267 DCHECK_EQ(GDK_BUTTON_PRESS, event->type); | 265 DCHECK_EQ(GDK_BUTTON_PRESS, event->type); |
| 268 | 266 |
| 269 EnsureDragHelperCreated(); | 267 EnsureDragHelperCreated(); |
| 270 drag_helper_->InitialTitlebarMousePress(event, titlebar_widget()); | 268 drag_helper_->InitialTitlebarMousePress(event, titlebar_widget()); |
| 271 return TRUE; | 269 return TRUE; |
| 272 } | 270 } |
| 273 | 271 |
| 274 bool PanelBrowserWindowGtk::HandleWindowEdgeLeftMousePress( | 272 bool PanelBrowserWindowGtk::HandleWindowEdgeLeftMousePress( |
| 275 GtkWindow* window, | 273 GtkWindow* window, |
| (...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 666 while (panel_browser_window_gtk_->IsAnimatingBounds()) | 664 while (panel_browser_window_gtk_->IsAnimatingBounds()) |
| 667 MessageLoopForUI::current()->RunAllPending(); | 665 MessageLoopForUI::current()->RunAllPending(); |
| 668 | 666 |
| 669 GdkEvent* event = gdk_event_new(GDK_BUTTON_PRESS); | 667 GdkEvent* event = gdk_event_new(GDK_BUTTON_PRESS); |
| 670 event->button.button = 1; | 668 event->button.button = 1; |
| 671 event->button.x_root = mouse_location.x(); | 669 event->button.x_root = mouse_location.x(); |
| 672 event->button.y_root = mouse_location.y(); | 670 event->button.y_root = mouse_location.y(); |
| 673 if (modifier == panel::APPLY_TO_ALL) | 671 if (modifier == panel::APPLY_TO_ALL) |
| 674 event->button.state |= GDK_CONTROL_MASK; | 672 event->button.state |= GDK_CONTROL_MASK; |
| 675 panel_browser_window_gtk_->HandleTitleBarLeftMousePress( | 673 panel_browser_window_gtk_->HandleTitleBarLeftMousePress( |
| 676 reinterpret_cast<GdkEventButton*>(event), | 674 reinterpret_cast<GdkEventButton*>(event)); |
| 677 GDK_CURRENT_TIME, gfx::Point()); | |
| 678 gdk_event_free(event); | 675 gdk_event_free(event); |
| 679 MessageLoopForUI::current()->RunAllPending(); | 676 MessageLoopForUI::current()->RunAllPending(); |
| 680 } | 677 } |
| 681 | 678 |
| 682 void NativePanelTestingGtk::ReleaseMouseButtonTitlebar( | 679 void NativePanelTestingGtk::ReleaseMouseButtonTitlebar( |
| 683 panel::ClickModifier modifier) { | 680 panel::ClickModifier modifier) { |
| 684 GdkEvent* event = gdk_event_new(GDK_BUTTON_RELEASE); | 681 GdkEvent* event = gdk_event_new(GDK_BUTTON_RELEASE); |
| 685 event->button.button = 1; | 682 event->button.button = 1; |
| 686 if (modifier == panel::APPLY_TO_ALL) | 683 if (modifier == panel::APPLY_TO_ALL) |
| 687 event->button.state |= GDK_CONTROL_MASK; | 684 event->button.state |= GDK_CONTROL_MASK; |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 759 break; | 756 break; |
| 760 case panel::RESTORE_BUTTON: | 757 case panel::RESTORE_BUTTON: |
| 761 button = titlebar->restore_button(); | 758 button = titlebar->restore_button(); |
| 762 break; | 759 break; |
| 763 default: | 760 default: |
| 764 NOTREACHED(); | 761 NOTREACHED(); |
| 765 return false; | 762 return false; |
| 766 } | 763 } |
| 767 return gtk_widget_get_visible(button->widget()); | 764 return gtk_widget_get_visible(button->widget()); |
| 768 } | 765 } |
| OLD | NEW |