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

Side by Side Diff: chrome/browser/ui/gtk/gtk_util.cc

Issue 11269022: Add Vector2d classes that represent offsets, instead of using Point. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: RenderText fixup Created 8 years, 1 month 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) 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/gtk/gtk_util.h" 5 #include "chrome/browser/ui/gtk/gtk_util.h"
6 6
7 #include <cairo/cairo.h> 7 #include <cairo/cairo.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <cstdarg> 10 #include <cstdarg>
(...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after
477 gfx::Size GetWidgetSize(GtkWidget* widget) { 477 gfx::Size GetWidgetSize(GtkWidget* widget) {
478 GtkRequisition size; 478 GtkRequisition size;
479 gtk_widget_size_request(widget, &size); 479 gtk_widget_size_request(widget, &size);
480 return gfx::Size(size.width, size.height); 480 return gfx::Size(size.width, size.height);
481 } 481 }
482 482
483 void ConvertWidgetPointToScreen(GtkWidget* widget, gfx::Point* p) { 483 void ConvertWidgetPointToScreen(GtkWidget* widget, gfx::Point* p) {
484 DCHECK(widget); 484 DCHECK(widget);
485 DCHECK(p); 485 DCHECK(p);
486 486
487 gfx::Point position = ui::GetWidgetScreenPosition(widget); 487 *p = p->Add(ui::GetWidgetScreenOffset(widget));
488 p->SetPoint(p->x() + position.x(), p->y() + position.y());
489 } 488 }
490 489
491 GtkWidget* CenterWidgetInHBox(GtkWidget* hbox, GtkWidget* widget, 490 GtkWidget* CenterWidgetInHBox(GtkWidget* hbox, GtkWidget* widget,
492 bool pack_at_end, int padding) { 491 bool pack_at_end, int padding) {
493 GtkWidget* centering_vbox = gtk_vbox_new(FALSE, 0); 492 GtkWidget* centering_vbox = gtk_vbox_new(FALSE, 0);
494 gtk_box_pack_start(GTK_BOX(centering_vbox), widget, TRUE, FALSE, 0); 493 gtk_box_pack_start(GTK_BOX(centering_vbox), widget, TRUE, FALSE, 0);
495 if (pack_at_end) 494 if (pack_at_end)
496 gtk_box_pack_end(GTK_BOX(hbox), centering_vbox, FALSE, FALSE, padding); 495 gtk_box_pack_end(GTK_BOX(hbox), centering_vbox, FALSE, FALSE, padding);
497 else 496 else
498 gtk_box_pack_start(GTK_BOX(hbox), centering_vbox, FALSE, FALSE, padding); 497 gtk_box_pack_start(GTK_BOX(hbox), centering_vbox, FALSE, FALSE, padding);
(...skipping 487 matching lines...) Expand 10 before | Expand all | Expand 10 after
986 if (gtk_window_get_modal(GTK_WINDOW(dialog))) { 985 if (gtk_window_get_modal(GTK_WINDOW(dialog))) {
987 // Work around a KDE 3 window manager bug. 986 // Work around a KDE 3 window manager bug.
988 scoped_ptr<base::Environment> env(base::Environment::Create()); 987 scoped_ptr<base::Environment> env(base::Environment::Create());
989 if (base::nix::DESKTOP_ENVIRONMENT_KDE3 == 988 if (base::nix::DESKTOP_ENVIRONMENT_KDE3 ==
990 base::nix::GetDesktopEnvironment(env.get())) 989 base::nix::GetDesktopEnvironment(env.get()))
991 gtk_window_set_skip_taskbar_hint(GTK_WINDOW(dialog), FALSE); 990 gtk_window_set_skip_taskbar_hint(GTK_WINDOW(dialog), FALSE);
992 } 991 }
993 } 992 }
994 993
995 } // namespace gtk_util 994 } // namespace gtk_util
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698