| 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 // If this gets included after the gtk headers, then a bunch of compiler | 7 // If this gets included after the gtk headers, then a bunch of compiler |
| 8 // errors happen because of a "#define Status int" in Xlib.h, which interacts | 8 // errors happen because of a "#define Status int" in Xlib.h, which interacts |
| 9 // badly with URLRequestStatus::Status. | 9 // badly with URLRequestStatus::Status. |
| 10 #include "chrome/common/render_messages.h" | 10 #include "chrome/common/render_messages.h" |
| 11 | 11 |
| 12 #include <gtk/gtk.h> | 12 #include <gtk/gtk.h> |
| 13 #include <gdk/gdk.h> | 13 #include <gdk/gdk.h> |
| 14 #include <gdk/gdkkeysyms.h> | 14 #include <gdk/gdkkeysyms.h> |
| 15 #include <gdk/gdkx.h> | 15 #include <gdk/gdkx.h> |
| 16 #include <cairo/cairo.h> | 16 #include <cairo/cairo.h> |
| 17 | 17 |
| 18 #include <algorithm> | 18 #include <algorithm> |
| 19 #include <string> | 19 #include <string> |
| 20 | 20 |
| 21 #include "base/gfx/gtk_util.h" | 21 #include "base/gfx/gtk_util.h" |
| 22 #include "base/logging.h" | 22 #include "base/logging.h" |
| 23 #include "base/message_loop.h" | 23 #include "base/message_loop.h" |
| 24 #include "base/string_util.h" | 24 #include "base/string_util.h" |
| 25 #include "base/task.h" | 25 #include "base/task.h" |
| 26 #include "base/time.h" | 26 #include "base/time.h" |
| 27 #include "chrome/common/gtk_util.h" |
| 27 #include "chrome/common/native_web_keyboard_event.h" | 28 #include "chrome/common/native_web_keyboard_event.h" |
| 28 #include "chrome/common/x11_util.h" | 29 #include "chrome/common/x11_util.h" |
| 29 #include "chrome/browser/renderer_host/backing_store.h" | 30 #include "chrome/browser/renderer_host/backing_store.h" |
| 30 #include "chrome/browser/renderer_host/gtk_im_context_wrapper.h" | 31 #include "chrome/browser/renderer_host/gtk_im_context_wrapper.h" |
| 31 #include "chrome/browser/renderer_host/gtk_key_bindings_handler.h" | 32 #include "chrome/browser/renderer_host/gtk_key_bindings_handler.h" |
| 32 #include "chrome/browser/renderer_host/render_widget_host.h" | 33 #include "chrome/browser/renderer_host/render_widget_host.h" |
| 33 #include "webkit/api/public/gtk/WebInputEventFactory.h" | 34 #include "webkit/api/public/gtk/WebInputEventFactory.h" |
| 34 #include "webkit/glue/webcursor_gtk_data.h" | 35 #include "webkit/glue/webcursor_gtk_data.h" |
| 35 | 36 |
| 36 static const int kMaxWindowWidth = 4000; | 37 static const int kMaxWindowWidth = 4000; |
| (...skipping 563 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 600 gdk_bitmap_create_from_data(NULL, moz_spinning_mask_bits, 32, 32); | 601 gdk_bitmap_create_from_data(NULL, moz_spinning_mask_bits, 32, 32); |
| 601 gdk_cursor = gdk_cursor_new_from_pixmap(source, mask, &fg, &bg, 2, 2); | 602 gdk_cursor = gdk_cursor_new_from_pixmap(source, mask, &fg, &bg, 2, 2); |
| 602 g_object_unref(source); | 603 g_object_unref(source); |
| 603 g_object_unref(mask); | 604 g_object_unref(mask); |
| 604 } else { | 605 } else { |
| 605 gdk_cursor = NULL; | 606 gdk_cursor = NULL; |
| 606 } | 607 } |
| 607 break; | 608 break; |
| 608 | 609 |
| 609 default: | 610 default: |
| 610 gdk_cursor = gdk_cursor_new(current_cursor_.GetCursorType()); | 611 gdk_cursor = gtk_util::GetCursor(current_cursor_.GetCursorType()); |
| 611 } | 612 } |
| 612 gdk_window_set_cursor(view_.get()->window, gdk_cursor); | 613 gdk_window_set_cursor(view_.get()->window, gdk_cursor); |
| 613 // The window now owns the cursor. | 614 // The window now owns the cursor. |
| 614 if (gdk_cursor) | 615 if (gdk_cursor) |
| 615 gdk_cursor_unref(gdk_cursor); | 616 gdk_cursor_unref(gdk_cursor); |
| 616 } | 617 } |
| 617 | 618 |
| 618 void RenderWidgetHostViewGtk::CreatePluginContainer( | 619 void RenderWidgetHostViewGtk::CreatePluginContainer( |
| 619 gfx::PluginWindowHandle id) { | 620 gfx::PluginWindowHandle id) { |
| 620 plugin_container_manager_.CreatePluginContainer(id); | 621 plugin_container_manager_.CreatePluginContainer(id); |
| 621 } | 622 } |
| 622 | 623 |
| 623 void RenderWidgetHostViewGtk::DestroyPluginContainer( | 624 void RenderWidgetHostViewGtk::DestroyPluginContainer( |
| 624 gfx::PluginWindowHandle id) { | 625 gfx::PluginWindowHandle id) { |
| 625 plugin_container_manager_.DestroyPluginContainer(id); | 626 plugin_container_manager_.DestroyPluginContainer(id); |
| 626 } | 627 } |
| 627 | 628 |
| 628 void RenderWidgetHostViewGtk::ForwardKeyboardEvent( | 629 void RenderWidgetHostViewGtk::ForwardKeyboardEvent( |
| 629 const NativeWebKeyboardEvent& event) { | 630 const NativeWebKeyboardEvent& event) { |
| 630 EditCommands edit_commands; | 631 EditCommands edit_commands; |
| 631 if (key_bindings_handler_->Match(event, &edit_commands)) { | 632 if (key_bindings_handler_->Match(event, &edit_commands)) { |
| 632 host_->ForwardEditCommandsForNextKeyEvent(edit_commands); | 633 host_->ForwardEditCommandsForNextKeyEvent(edit_commands); |
| 633 } | 634 } |
| 634 host_->ForwardKeyboardEvent(event); | 635 host_->ForwardKeyboardEvent(event); |
| 635 } | 636 } |
| OLD | NEW |