| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/renderer_host/render_widget_host_view_gtk.h" | 5 #include "chrome/browser/renderer_host/render_widget_host_view_gtk.h" |
| 6 | 6 |
| 7 #include <gtk/gtk.h> | 7 #include <gtk/gtk.h> |
| 8 #include <gdk/gdk.h> | 8 #include <gdk/gdk.h> |
| 9 #include <cairo/cairo.h> | 9 #include <cairo/cairo.h> |
| 10 | 10 |
| (...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 281 } else { | 281 } else { |
| 282 gtk_widget_set_tooltip_text(view_, WideToUTF8(tooltip_text).c_str()); | 282 gtk_widget_set_tooltip_text(view_, WideToUTF8(tooltip_text).c_str()); |
| 283 } | 283 } |
| 284 } | 284 } |
| 285 | 285 |
| 286 BackingStore* RenderWidgetHostViewGtk::AllocBackingStore( | 286 BackingStore* RenderWidgetHostViewGtk::AllocBackingStore( |
| 287 const gfx::Size& size) { | 287 const gfx::Size& size) { |
| 288 Display* display = x11_util::GetXDisplay(); | 288 Display* display = x11_util::GetXDisplay(); |
| 289 void* visual = x11_util::GetVisualFromGtkWidget(view_); | 289 void* visual = x11_util::GetVisualFromGtkWidget(view_); |
| 290 XID root_window = x11_util::GetX11RootWindow(); | 290 XID root_window = x11_util::GetX11RootWindow(); |
| 291 bool use_render = x11_util::QueryRenderSupport(display); |
| 291 bool use_shared_memory = x11_util::QuerySharedMemorySupport(display); | 292 bool use_shared_memory = x11_util::QuerySharedMemorySupport(display); |
| 292 int depth = gtk_widget_get_visual(view_)->depth; | 293 int depth = gtk_widget_get_visual(view_)->depth; |
| 293 | 294 |
| 294 return new BackingStore(size, display, depth, visual, root_window, | 295 return new BackingStore(size, display, depth, visual, root_window, |
| 295 use_shared_memory); | 296 use_render, use_shared_memory); |
| 296 } | 297 } |
| 297 | 298 |
| 298 void RenderWidgetHostViewGtk::Paint(const gfx::Rect& damage_rect) { | 299 void RenderWidgetHostViewGtk::Paint(const gfx::Rect& damage_rect) { |
| 299 BackingStore* backing_store = host_->GetBackingStore(); | 300 BackingStore* backing_store = host_->GetBackingStore(); |
| 300 | 301 |
| 301 if (backing_store) { | 302 if (backing_store) { |
| 302 // Only render the widget if it is attached to a window; there's a short | 303 // Only render the widget if it is attached to a window; there's a short |
| 303 // period where this object isn't attached to a window but hasn't been | 304 // period where this object isn't attached to a window but hasn't been |
| 304 // Destroy()ed yet and it receives paint messages... | 305 // Destroy()ed yet and it receives paint messages... |
| 305 GdkWindow* window = view_->window; | 306 GdkWindow* window = view_->window; |
| 306 if (window) { | 307 if (window) { |
| 307 backing_store->ShowRect( | 308 backing_store->ShowRect( |
| 308 damage_rect, x11_util::GetX11WindowFromGtkWidget(view_)); | 309 damage_rect, x11_util::GetX11WindowFromGtkWidget(view_)); |
| 309 } | 310 } |
| 310 } else { | 311 } else { |
| 311 NOTIMPLEMENTED(); | 312 NOTIMPLEMENTED(); |
| 312 } | 313 } |
| 313 } | 314 } |
| 314 | 315 |
| OLD | NEW |