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

Side by Side Diff: chrome/browser/gtk/tabs/dragged_tab_controller_gtk.cc

Issue 159436: gtk: Use the requested window bounds when determining the location of the sou... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 4 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 | « no previous file | chrome/browser/gtk/tabs/tab_renderer_gtk.h » ('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) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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/dragged_tab_controller_gtk.h" 5 #include "chrome/browser/gtk/tabs/dragged_tab_controller_gtk.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "chrome/browser/browser.h" 9 #include "chrome/browser/browser.h"
10 #include "chrome/browser/gtk/browser_window_gtk.h" 10 #include "chrome/browser/gtk/browser_window_gtk.h"
(...skipping 810 matching lines...) Expand 10 before | Expand all | Expand 10 after
821 gdk_display_get_pointer(display, NULL, &x, &y, NULL); 821 gdk_display_get_pointer(display, NULL, &x, &y, NULL);
822 822
823 return gfx::Point(x, y); 823 return gfx::Point(x, y);
824 } 824 }
825 825
826 // static 826 // static
827 gfx::Rect DraggedTabControllerGtk::GetTabScreenBounds(TabGtk* tab) { 827 gfx::Rect DraggedTabControllerGtk::GetTabScreenBounds(TabGtk* tab) {
828 // A hidden widget moved with gtk_fixed_move in a GtkFixed container doesn't 828 // A hidden widget moved with gtk_fixed_move in a GtkFixed container doesn't
829 // update its allocation until after the widget is shown, so we have to use 829 // update its allocation until after the widget is shown, so we have to use
830 // the tab bounds we keep track of. 830 // the tab bounds we keep track of.
831 int x, y; 831 //
832 x = tab->bounds().x(); 832 // We use the requested bounds instead of the allocation because the
833 y = tab->bounds().y(); 833 // allocation is relative to the first windowed widget ancestor of the tab.
834 834 // Because of this, we can't use the tabs allocation to get the screen bounds.
835 gfx::Rect bounds = tab->GetRequisition();
835 GtkWidget* widget = tab->widget(); 836 GtkWidget* widget = tab->widget();
836 GtkWidget* parent = gtk_widget_get_parent(widget); 837 GtkWidget* parent = gtk_widget_get_parent(widget);
837 gfx::Point point = gtk_util::GetWidgetScreenPosition(parent); 838 gfx::Point point = gtk_util::GetWidgetScreenPosition(parent);
838 x += point.x(); 839 bounds.Offset(point);
839 y += point.y();
840 840
841 return gfx::Rect(x, y, widget->allocation.width, widget->allocation.height); 841 return gfx::Rect(bounds.x(), bounds.y(), bounds.width(), bounds.height());
842 } 842 }
843 843
844 void DraggedTabControllerGtk::HideFrame() { 844 void DraggedTabControllerGtk::HideFrame() {
845 GtkWidget* tabstrip = source_tabstrip_->widget(); 845 GtkWidget* tabstrip = source_tabstrip_->widget();
846 GtkWindow* window = platform_util::GetTopLevel(tabstrip); 846 GtkWindow* window = platform_util::GetTopLevel(tabstrip);
847 gtk_widget_hide(GTK_WIDGET(window)); 847 gtk_widget_hide(GTK_WIDGET(window));
848 } 848 }
849 849
850 void DraggedTabControllerGtk::CleanUpHiddenFrame() { 850 void DraggedTabControllerGtk::CleanUpHiddenFrame() {
851 // If the model we started dragging from is now empty, we must ask the 851 // If the model we started dragging from is now empty, we must ask the
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
890 gfx::NativeView dragged_tab = dragged_tab_->widget(); 890 gfx::NativeView dragged_tab = dragged_tab_->widget();
891 dock_windows_.insert(dragged_tab); 891 dock_windows_.insert(dragged_tab);
892 window = DockInfo::GetLocalProcessWindowAtPoint(GetCursorScreenPoint(), 892 window = DockInfo::GetLocalProcessWindowAtPoint(GetCursorScreenPoint(),
893 dock_windows_); 893 dock_windows_);
894 dock_windows_.erase(dragged_tab); 894 dock_windows_.erase(dragged_tab);
895 } 895 }
896 896
897 if (window) 897 if (window)
898 gtk_window_present(GTK_WINDOW(window)); 898 gtk_window_present(GTK_WINDOW(window));
899 } 899 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/gtk/tabs/tab_renderer_gtk.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698