[haiku-webkit-commits] r583 - webkit/trunk/WebKit/haiku/API

  • From: noreply@xxxxxxxxxxxx
  • To: haiku-webkit-commits@xxxxxxxxxxxxx
  • Date: Sun, 10 Jul 2011 22:37:24 +0200 (CEST)

Author: leavengood
Date: Sun Jul 10 22:37:23 2011
New Revision: 583
URL: http://webpositive.haiku-os.org/changeset/583

Log:
Boy was this annoying to debug.

If you call BWindow::AddShortcut() with a message parameter but not a target,
the target becomes the window. In this case WebWindow does not handle B_UNDO or
B_REDO.  Adding the NULL parameter as the target in AddShortcut forces the
shortcut handling to find the window's current focus and send the message
there. This is how all the other text editing shortcuts (B_SELECT_ALL, B_CUT,
etc) are set up in BWindow which is why they worked but Undo/Redo didn't.

Given all the other code related to undo/redo works I'm surprised this was
broken. Maybe Stephan didn't test after the change which introduced these here.

Long story short, undo/redo now work when editing in Web+.

Fixes at least #6224.

Modified:
   webkit/trunk/WebKit/haiku/API/WebWindow.cpp

Modified: webkit/trunk/WebKit/haiku/API/WebWindow.cpp
==============================================================================
--- webkit/trunk/WebKit/haiku/API/WebWindow.cpp Thu Jun  2 07:43:00 2011        
(r582)
+++ webkit/trunk/WebKit/haiku/API/WebWindow.cpp Sun Jul 10 22:37:23 2011        
(r583)
@@ -59,10 +59,10 @@
     SetLayout(new BGroupLayout(B_HORIZONTAL));
 
     // NOTE: Do NOT change these because you think Redo should be on Cmd-Y!
-    AddShortcut('Z', B_COMMAND_KEY, new BMessage(B_UNDO));
-    AddShortcut('Y', B_COMMAND_KEY, new BMessage(B_UNDO));
-    AddShortcut('Z', B_COMMAND_KEY | B_SHIFT_KEY, new BMessage(B_REDO));
-    AddShortcut('Y', B_COMMAND_KEY | B_SHIFT_KEY, new BMessage(B_REDO));
+    AddShortcut('Z', B_COMMAND_KEY, new BMessage(B_UNDO), NULL);
+    AddShortcut('Y', B_COMMAND_KEY, new BMessage(B_UNDO), NULL);
+    AddShortcut('Z', B_COMMAND_KEY | B_SHIFT_KEY, new BMessage(B_REDO), NULL);
+    AddShortcut('Y', B_COMMAND_KEY | B_SHIFT_KEY, new BMessage(B_REDO), NULL);
 }
 
 BWebWindow::~BWebWindow()

Other related posts: