Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(12)

Side by Side Diff: chrome/browser/renderer_host/render_widget_host_view_gtk.cc

Issue 165293: Supports Gtk keyboard themes.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 11 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/renderer_host/render_widget_host_view_gtk.h ('k') | chrome/chrome.gyp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"
(...skipping 10 matching lines...) Expand all
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/native_web_keyboard_event.h" 27 #include "chrome/common/native_web_keyboard_event.h"
28 #include "chrome/common/x11_util.h" 28 #include "chrome/common/x11_util.h"
29 #include "chrome/browser/renderer_host/backing_store.h" 29 #include "chrome/browser/renderer_host/backing_store.h"
30 #include "chrome/browser/renderer_host/gtk_im_context_wrapper.h" 30 #include "chrome/browser/renderer_host/gtk_im_context_wrapper.h"
31 #include "chrome/browser/renderer_host/gtk_key_bindings_handler.h"
31 #include "chrome/browser/renderer_host/render_widget_host.h" 32 #include "chrome/browser/renderer_host/render_widget_host.h"
32 #include "webkit/api/public/gtk/WebInputEventFactory.h" 33 #include "webkit/api/public/gtk/WebInputEventFactory.h"
33 #include "webkit/glue/webcursor_gtk_data.h" 34 #include "webkit/glue/webcursor_gtk_data.h"
34 35
35 static const int kMaxWindowWidth = 4000; 36 static const int kMaxWindowWidth = 4000;
36 static const int kMaxWindowHeight = 4000; 37 static const int kMaxWindowHeight = 4000;
37 38
38 using WebKit::WebInputEventFactory; 39 using WebKit::WebInputEventFactory;
39 40
40 // This class is a simple convenience wrapper for Gtk functions. It has only 41 // This class is a simple convenience wrapper for Gtk functions. It has only
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
292 } 293 }
293 294
294 RenderWidgetHostViewGtk::~RenderWidgetHostViewGtk() { 295 RenderWidgetHostViewGtk::~RenderWidgetHostViewGtk() {
295 view_.Destroy(); 296 view_.Destroy();
296 } 297 }
297 298
298 void RenderWidgetHostViewGtk::InitAsChild() { 299 void RenderWidgetHostViewGtk::InitAsChild() {
299 view_.Own(RenderWidgetHostViewGtkWidget::CreateNewWidget(this)); 300 view_.Own(RenderWidgetHostViewGtkWidget::CreateNewWidget(this));
300 // |im_context_| must be created after creating |view_| widget. 301 // |im_context_| must be created after creating |view_| widget.
301 im_context_.reset(new GtkIMContextWrapper(this)); 302 im_context_.reset(new GtkIMContextWrapper(this));
303 // |key_bindings_handler_| must be created after creating |view_| widget.
304 key_bindings_handler_.reset(new GtkKeyBindingsHandler(view_.get()));
302 plugin_container_manager_.set_host_widget(view_.get()); 305 plugin_container_manager_.set_host_widget(view_.get());
303 gtk_widget_show(view_.get()); 306 gtk_widget_show(view_.get());
304 } 307 }
305 308
306 void RenderWidgetHostViewGtk::InitAsPopup( 309 void RenderWidgetHostViewGtk::InitAsPopup(
307 RenderWidgetHostView* parent_host_view, const gfx::Rect& pos) { 310 RenderWidgetHostView* parent_host_view, const gfx::Rect& pos) {
308 parent_host_view_ = parent_host_view; 311 parent_host_view_ = parent_host_view;
309 parent_ = parent_host_view->GetNativeView(); 312 parent_ = parent_host_view->GetNativeView();
310 GtkWidget* popup = gtk_window_new(GTK_WINDOW_POPUP); 313 GtkWidget* popup = gtk_window_new(GTK_WINDOW_POPUP);
311 view_.Own(RenderWidgetHostViewGtkWidget::CreateNewWidget(this)); 314 view_.Own(RenderWidgetHostViewGtkWidget::CreateNewWidget(this));
312 // |im_context_| must be created after creating |view_| widget. 315 // |im_context_| must be created after creating |view_| widget.
313 im_context_.reset(new GtkIMContextWrapper(this)); 316 im_context_.reset(new GtkIMContextWrapper(this));
317 // |key_bindings_handler_| must be created after creating |view_| widget.
318 key_bindings_handler_.reset(new GtkKeyBindingsHandler(view_.get()));
314 plugin_container_manager_.set_host_widget(view_.get()); 319 plugin_container_manager_.set_host_widget(view_.get());
315 gtk_container_add(GTK_CONTAINER(popup), view_.get()); 320 gtk_container_add(GTK_CONTAINER(popup), view_.get());
316 321
317 // If we are not activatable, we don't want to grab keyboard input, 322 // If we are not activatable, we don't want to grab keyboard input,
318 // and webkit will manage our destruction. 323 // and webkit will manage our destruction.
319 if (activatable()) { 324 if (activatable()) {
320 // Grab all input for the app. If a click lands outside the bounds of the 325 // Grab all input for the app. If a click lands outside the bounds of the
321 // popup, WebKit will notice and destroy us. Before doing this we need 326 // popup, WebKit will notice and destroy us. Before doing this we need
322 // to ensure that the the popup is added to the browser's window group, 327 // to ensure that the the popup is added to the browser's window group,
323 // to allow for the grabs to work correctly. 328 // to allow for the grabs to work correctly.
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
455 void RenderWidgetHostViewGtk::SetIsLoading(bool is_loading) { 460 void RenderWidgetHostViewGtk::SetIsLoading(bool is_loading) {
456 is_loading_ = is_loading; 461 is_loading_ = is_loading;
457 // Only call ShowCurrentCursor() when it will actually change the cursor. 462 // Only call ShowCurrentCursor() when it will actually change the cursor.
458 if (current_cursor_.GetCursorType() == GDK_LAST_CURSOR) 463 if (current_cursor_.GetCursorType() == GDK_LAST_CURSOR)
459 ShowCurrentCursor(); 464 ShowCurrentCursor();
460 } 465 }
461 466
462 void RenderWidgetHostViewGtk::IMEUpdateStatus(int control, 467 void RenderWidgetHostViewGtk::IMEUpdateStatus(int control,
463 const gfx::Rect& caret_rect) { 468 const gfx::Rect& caret_rect) {
464 im_context_->UpdateStatus(control, caret_rect); 469 im_context_->UpdateStatus(control, caret_rect);
470 key_bindings_handler_->set_enabled(control != IME_DISABLE);
465 } 471 }
466 472
467 void RenderWidgetHostViewGtk::DidPaintRect(const gfx::Rect& rect) { 473 void RenderWidgetHostViewGtk::DidPaintRect(const gfx::Rect& rect) {
468 if (is_hidden_) 474 if (is_hidden_)
469 return; 475 return;
470 476
471 if (about_to_validate_and_paint_) 477 if (about_to_validate_and_paint_)
472 invalid_rect_ = invalid_rect_.Union(rect); 478 invalid_rect_ = invalid_rect_.Union(rect);
473 else 479 else
474 Paint(rect); 480 Paint(rect);
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
611 617
612 void RenderWidgetHostViewGtk::CreatePluginContainer( 618 void RenderWidgetHostViewGtk::CreatePluginContainer(
613 gfx::PluginWindowHandle id) { 619 gfx::PluginWindowHandle id) {
614 plugin_container_manager_.CreatePluginContainer(id); 620 plugin_container_manager_.CreatePluginContainer(id);
615 } 621 }
616 622
617 void RenderWidgetHostViewGtk::DestroyPluginContainer( 623 void RenderWidgetHostViewGtk::DestroyPluginContainer(
618 gfx::PluginWindowHandle id) { 624 gfx::PluginWindowHandle id) {
619 plugin_container_manager_.DestroyPluginContainer(id); 625 plugin_container_manager_.DestroyPluginContainer(id);
620 } 626 }
627
628 void RenderWidgetHostViewGtk::ForwardKeyboardEvent(
629 const NativeWebKeyboardEvent& event) {
630 EditCommands edit_commands;
631 if (key_bindings_handler_->Match(event, &edit_commands)) {
632 host_->ForwardEditCommandsForNextKeyEvent(edit_commands);
633 }
634 host_->ForwardKeyboardEvent(event);
635 }
OLDNEW
« no previous file with comments | « chrome/browser/renderer_host/render_widget_host_view_gtk.h ('k') | chrome/chrome.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698