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 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
333 damage_rect, x11_util::GetX11WindowFromGtkWidget(view_.get())); | 333 damage_rect, x11_util::GetX11WindowFromGtkWidget(view_.get())); |
334 } | 334 } |
335 } else { | 335 } else { |
336 if (window) | 336 if (window) |
337 gdk_window_clear(window); | 337 gdk_window_clear(window); |
338 NOTIMPLEMENTED(); | 338 NOTIMPLEMENTED(); |
339 } | 339 } |
340 } | 340 } |
341 | 341 |
342 void RenderWidgetHostViewGtk::ShowCurrentCursor() { | 342 void RenderWidgetHostViewGtk::ShowCurrentCursor() { |
| 343 // The widget may not have a window. If that's the case, abort mission. This |
| 344 // is the same issue as that explained above in Paint(). |
| 345 if (!view_.get()->window) |
| 346 return; |
| 347 |
343 GdkCursor* gdk_cursor; | 348 GdkCursor* gdk_cursor; |
344 switch(current_cursor_.GetCursorType()) { | 349 switch(current_cursor_.GetCursorType()) { |
345 case GDK_CURSOR_IS_PIXMAP: | 350 case GDK_CURSOR_IS_PIXMAP: |
346 // TODO(port): WebKit bug https://bugs.webkit.org/show_bug.cgi?id=16388 is | 351 // TODO(port): WebKit bug https://bugs.webkit.org/show_bug.cgi?id=16388 is |
347 // that calling gdk_window_set_cursor repeatedly is expensive. We should | 352 // that calling gdk_window_set_cursor repeatedly is expensive. We should |
348 // avoid it here where possible. | 353 // avoid it here where possible. |
349 gdk_cursor = current_cursor_.GetCustomCursor(); | 354 gdk_cursor = current_cursor_.GetCustomCursor(); |
350 break; | 355 break; |
351 | 356 |
352 case GDK_LAST_CURSOR: | 357 case GDK_LAST_CURSOR: |
(...skipping 15 matching lines...) Expand all Loading... |
368 break; | 373 break; |
369 | 374 |
370 default: | 375 default: |
371 gdk_cursor = gdk_cursor_new(current_cursor_.GetCursorType()); | 376 gdk_cursor = gdk_cursor_new(current_cursor_.GetCursorType()); |
372 } | 377 } |
373 gdk_window_set_cursor(view_.get()->window, gdk_cursor); | 378 gdk_window_set_cursor(view_.get()->window, gdk_cursor); |
374 // The window now owns the cursor. | 379 // The window now owns the cursor. |
375 if (gdk_cursor) | 380 if (gdk_cursor) |
376 gdk_cursor_unref(gdk_cursor); | 381 gdk_cursor_unref(gdk_cursor); |
377 } | 382 } |
OLD | NEW |