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/browser_window_gtk.h" | 5 #include "chrome/browser/ui/gtk/browser_window_gtk.h" |
6 | 6 |
7 #include <dlfcn.h> | 7 #include <dlfcn.h> |
8 #include <gdk/gdkkeysyms.h> | 8 #include <gdk/gdkkeysyms.h> |
9 | 9 |
10 #include <algorithm> | 10 #include <algorithm> |
(...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
415 // Set the initial background color of widgets. | 415 // Set the initial background color of widgets. |
416 SetBackgroundColor(); | 416 SetBackgroundColor(); |
417 HideUnsupportedWindowFeatures(); | 417 HideUnsupportedWindowFeatures(); |
418 } | 418 } |
419 | 419 |
420 gboolean BrowserWindowGtk::OnCustomFrameExpose(GtkWidget* widget, | 420 gboolean BrowserWindowGtk::OnCustomFrameExpose(GtkWidget* widget, |
421 GdkEventExpose* event) { | 421 GdkEventExpose* event) { |
422 TRACE_EVENT0("ui::gtk", "BrowserWindowGtk::OnCustomFrameExpose"); | 422 TRACE_EVENT0("ui::gtk", "BrowserWindowGtk::OnCustomFrameExpose"); |
423 | 423 |
424 // Draw the default background. | 424 // Draw the default background. |
425 cairo_t* cr = gdk_cairo_create(GDK_DRAWABLE(widget->window)); | 425 cairo_t* cr = gdk_cairo_create(gtk_widget_get_window(widget)); |
426 gdk_cairo_rectangle(cr, &event->area); | 426 gdk_cairo_rectangle(cr, &event->area); |
427 cairo_clip(cr); | 427 cairo_clip(cr); |
428 | 428 |
429 if (UsingCustomPopupFrame()) { | 429 if (UsingCustomPopupFrame()) { |
430 DrawPopupFrame(cr, widget, event); | 430 DrawPopupFrame(cr, widget, event); |
431 } else { | 431 } else { |
432 DrawCustomFrame(cr, widget, event); | 432 DrawCustomFrame(cr, widget, event); |
433 } | 433 } |
434 | 434 |
435 DrawContentShadow(cr); | 435 DrawContentShadow(cr); |
(...skipping 1563 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1999 GtkAllocation render_area_floating_container_allocation; | 1999 GtkAllocation render_area_floating_container_allocation; |
2000 gtk_widget_get_allocation(render_area_floating_container_, | 2000 gtk_widget_get_allocation(render_area_floating_container_, |
2001 &render_area_floating_container_allocation); | 2001 &render_area_floating_container_allocation); |
2002 return gfx::Size(window_container_allocation.width - | 2002 return gfx::Size(window_container_allocation.width - |
2003 render_area_floating_container_allocation.width, | 2003 render_area_floating_container_allocation.width, |
2004 window_container_allocation.height - | 2004 window_container_allocation.height - |
2005 render_area_floating_container_allocation.height); | 2005 render_area_floating_container_allocation.height); |
2006 } | 2006 } |
2007 | 2007 |
2008 void BrowserWindowGtk::InvalidateWindow() { | 2008 void BrowserWindowGtk::InvalidateWindow() { |
| 2009 GtkAllocation allocation; |
| 2010 gtk_widget_get_allocation(GTK_WIDGET(window_), &allocation); |
2009 gdk_window_invalidate_rect(gtk_widget_get_window(GTK_WIDGET(window_)), | 2011 gdk_window_invalidate_rect(gtk_widget_get_window(GTK_WIDGET(window_)), |
2010 >K_WIDGET(window_)->allocation, TRUE); | 2012 &allocation, TRUE); |
2011 } | 2013 } |
2012 | 2014 |
2013 void BrowserWindowGtk::SaveWindowPosition() { | 2015 void BrowserWindowGtk::SaveWindowPosition() { |
2014 // Browser::SaveWindowPlacement is used for session restore. | 2016 // Browser::SaveWindowPlacement is used for session restore. |
2015 ui::WindowShowState show_state = ui::SHOW_STATE_NORMAL; | 2017 ui::WindowShowState show_state = ui::SHOW_STATE_NORMAL; |
2016 if (IsMaximized()) | 2018 if (IsMaximized()) |
2017 show_state = ui::SHOW_STATE_MAXIMIZED; | 2019 show_state = ui::SHOW_STATE_MAXIMIZED; |
2018 else if (IsMinimized()) | 2020 else if (IsMinimized()) |
2019 show_state = ui::SHOW_STATE_MINIMIZED; | 2021 show_state = ui::SHOW_STATE_MINIMIZED; |
2020 | 2022 |
(...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2520 wm_type == ui::WM_OPENBOX || | 2522 wm_type == ui::WM_OPENBOX || |
2521 wm_type == ui::WM_XFWM4); | 2523 wm_type == ui::WM_XFWM4); |
2522 } | 2524 } |
2523 | 2525 |
2524 // static | 2526 // static |
2525 BrowserWindow* BrowserWindow::CreateBrowserWindow(Browser* browser) { | 2527 BrowserWindow* BrowserWindow::CreateBrowserWindow(Browser* browser) { |
2526 BrowserWindowGtk* browser_window_gtk = new BrowserWindowGtk(browser); | 2528 BrowserWindowGtk* browser_window_gtk = new BrowserWindowGtk(browser); |
2527 browser_window_gtk->Init(); | 2529 browser_window_gtk->Init(); |
2528 return browser_window_gtk; | 2530 return browser_window_gtk; |
2529 } | 2531 } |
OLD | NEW |