Chromium Code Reviews| 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/gtk/gtk_window_util.h" | 5 #include "chrome/browser/ui/gtk/gtk_window_util.h" |
| 6 | 6 |
| 7 #include <dlfcn.h> | 7 #include <dlfcn.h> |
| 8 #include "chrome/browser/ui/base_window.h" | |
| 8 #include "content/public/browser/render_view_host.h" | 9 #include "content/public/browser/render_view_host.h" |
| 9 #include "content/public/browser/web_contents.h" | 10 #include "content/public/browser/web_contents.h" |
| 10 | 11 |
| 11 using content::RenderWidgetHost; | 12 using content::RenderWidgetHost; |
| 12 using content::WebContents; | 13 using content::WebContents; |
| 13 | 14 |
| 14 namespace gtk_window_util { | 15 namespace gtk_window_util { |
| 15 | 16 |
| 16 // Keep track of the last click time and the last click position so we can | 17 // Keep track of the last click time and the last click position so we can |
| 17 // filter out extra GDK_BUTTON_PRESS events when a double click happens. | 18 // filter out extra GDK_BUTTON_PRESS events when a double click happens. |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 176 void SetWindowCustomClass(GtkWindow* window, const std::string& wmclass) { | 177 void SetWindowCustomClass(GtkWindow* window, const std::string& wmclass) { |
| 177 gtk_window_set_wmclass(window, | 178 gtk_window_set_wmclass(window, |
| 178 wmclass.c_str(), | 179 wmclass.c_str(), |
| 179 gdk_get_program_class()); | 180 gdk_get_program_class()); |
| 180 | 181 |
| 181 // Set WM_WINDOW_ROLE for session management purposes. | 182 // Set WM_WINDOW_ROLE for session management purposes. |
| 182 // See http://tronche.com/gui/x/icccm/sec-5.html . | 183 // See http://tronche.com/gui/x/icccm/sec-5.html . |
| 183 gtk_window_set_role(window, wmclass.c_str()); | 184 gtk_window_set_role(window, wmclass.c_str()); |
| 184 } | 185 } |
| 185 | 186 |
| 187 void UpdateWindowPosition(BaseWindow* window, gfx::Rect* bounds, | |
|
Evan Stade
2012/08/30 23:55:38
one param per line
| |
| 188 gfx::Rect* restored_bounds) { | |
| 189 gint x, y; | |
| 190 gtk_window_get_position(window->GetNativeWindow(), &x, &y); | |
| 191 (*bounds).set_origin(gfx::Point(x, y)); | |
| 192 if (!window->IsFullscreen() && !window->IsMaximized()) | |
| 193 (*restored_bounds) = *bounds; | |
|
Evan Stade
2012/08/30 23:55:38
no parens
| |
| 194 } | |
| 195 | |
| 186 } // namespace gtk_window_util | 196 } // namespace gtk_window_util |
| OLD | NEW |