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

Issue 159586: This CL fixes issue 11480: Support GTK keyboard themes (emacs keybindings).... (Closed)

Created:
11 years, 4 months ago by james.su
Modified:
9 years, 7 months ago
CC:
chromium-reviews_googlegroups.com, darin (slow to review), brettw, jam, Ben Goodger (Google)
Visibility:
Public.

Description

This CL fixes issue 11480: Support GTK keyboard themes (emacs keybindings). A new virtual method UnhandledKeyboardEvent() has been added to RenderWidgetHostView interface, to give RenderWidgetHostView implementation a chance to handle key events which are not handled by renderer. This method will be called by RenderWidgetHost::OnMsgInputEventAck() for all unhandled keyboard events before calling RenderWidgetHost::UnhandledKeyboardEvent(). Mac and Windows implementations may also override RenderWidgetHostView::UnhandledKeyboardEvent() to support system defined key bindings. This CL still has a problem, see following comment copied from the code: // TODO(james.su@gmail.com): Check if current event flow is appropriate, which // sends a key event to renderer(webkit) first, then calls this key bindings // handler if the key event is not handled by renderer. So key bindings // defined in our webkit glue have higher priority. // However, some key bindings defined in our webkit glue may conflict with the // key bindings defined in gtk keyboard theme, for example ctrl-a is // bound to "SelectAll" in our webkit glue. But in gtk Emacs keyboard theme, // it's bound to "MoveToBeginningOfParagraph". // In such case, an Emacs user would prefer Emacs key bindings over our // built-in key bindings. // But it may also cause problem if we call this key bindings handler before // sending key events to renderer, because there is no way to prevent webkit // from interpreting it as a key binding. Then unexpected behavior may occur, // if a key event matches a key binding defined in gtk keyboard theme as well as // a (different) key binding defined in webkit glue. We might need to change webkit glue implementation to let webkit work with system defined key bindings seamlessly. BUG=11480 : Support GTK keyboard themes (emacs keybindings) TEST=Switch to Emacs keyboard theme by changing the value of gconf key "/desktop/gnome/interface/gtk_key_theme" to "Emacs", then starts chrome and opens a webpage with a text input box. Input something into the text box, then press any of the Emacs key bindings defined in /usr/share/themes/Emacs/gtk-2.0-key/gtkrc, to see if it works as expected. For example, ctrl-p should move the cursor up one line, and ctrl-k should delete to the end of paragraph.

Patch Set 1 #

Patch Set 2 : '' #

Total comments: 4
Unified diffs Side-by-side diffs Delta from patch set Stats (+379 lines, -4 lines) Patch
M chrome/browser/renderer_host/render_widget_host.cc View 1 1 chunk +4 lines, -1 line 0 comments Download
M chrome/browser/renderer_host/render_widget_host_view.h View 1 2 chunks +10 lines, -0 lines 0 comments Download
M chrome/browser/renderer_host/render_widget_host_view_gtk.h View 1 3 chunks +10 lines, -2 lines 0 comments Download
M chrome/browser/renderer_host/render_widget_host_view_gtk.cc View 1 5 chunks +355 lines, -1 line 4 comments Download

Messages

Total messages: 13 (0 generated)
james.su_gmail.com
Hi, It's a CL to fix issue 11480, please help review it. Regards James Su
11 years, 4 months ago (2009-07-29 13:11:12 UTC) #1
Evan Martin
11 years, 4 months ago (2009-07-29 17:08:43 UTC) #2
Evan Stade
I think the keyboard theme needs to have higher priority. Your ctrl-a example is a ...
11 years, 4 months ago (2009-07-30 01:14:55 UTC) #3
Evan Stade
also, would be nice to hear Evan's take on what I just said
11 years, 4 months ago (2009-07-30 01:15:15 UTC) #4
james.su_gmail.com
Changing keyboard event message would be a feasible solution. The only issue is: one key ...
11 years, 4 months ago (2009-07-30 06:24:10 UTC) #5
james.su_gmail.com
I'm setting up my chromium account. Will send this CL again with my new account ...
11 years, 4 months ago (2009-07-30 06:26:01 UTC) #6
James Su
Hi, I just went through the code path of keyboard event handling. When a key ...
11 years, 4 months ago (2009-07-30 10:54:58 UTC) #7
Evan Stade
I could be mistaken but I don't think it would require all that. In our ...
11 years, 4 months ago (2009-07-30 19:05:33 UTC) #8
Evan Stade
oh, and for the names of the files, you can just use the name of ...
11 years, 4 months ago (2009-07-30 19:15:54 UTC) #9
tony
This all seems really tricky. Can't we sent a message to renderers about which mode ...
11 years, 4 months ago (2009-07-30 20:08:08 UTC) #10
Hironori Bono
+1 for tony. It is better to design a customization scheme that sends an IPC ...
11 years, 4 months ago (2009-07-31 03:37:33 UTC) #11
James Su
On 2009/07/30 19:05:33, Evan Stade wrote: > I could be mistaken but I don't think ...
11 years, 4 months ago (2009-07-31 03:38:37 UTC) #12
James Su
11 years, 4 months ago (2009-07-31 04:31:16 UTC) #13
On 2009/07/31 03:37:33, hbono wrote:
> +1 for tony.
> It is better to design a customization scheme that sends an IPC message about
> the shortcut keys so that our EditorClientImpl class can use them. Customizing
> keyboard shortcuts of our EditorClientImpl class is a long-lasting issue since
> last October (Issue 896) and it is better for us to provide a
> platform-independent solution to users and extension APIs for extension
> programmers, respectively. :)
> 
> Regards,
> 
> Hironori Bono

I'm not sure if EditorClientImpl is the correct place to do it. We might not be
able to retrieve system pre-defined key bindings statically, taking this gtk
implementation as an example. In such case, we must send key binding matching
result down to webkit for each key event.

And IMHO, customizing key bindings is a feature belonging to browser, just same
as extension. So I think it would be more reasonable to move key binding
handling up to browser. And we may provide a mechanism to manage all
customizable key bindings in an unified way, not only the editor key bindings,
but also accelerator keys of browser window.

Regards
James Su

Powered by Google App Engine
This is Rietveld 408576698