/[classpath]/classpath/java/awt/DefaultKeyboardFocusManager.java
ViewVC logotype

Diff of /classpath/java/awt/DefaultKeyboardFocusManager.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.3 by mark, Thu Jul 22 19:45:38 2004 UTC revision 1.4 by mark, Sat Jul 31 16:31:35 2004 UTC
# Line 284  public class DefaultKeyboardFocusManager Line 284  public class DefaultKeyboardFocusManager
284    {    {
285      // Check if this event represents a menu shortcut.      // Check if this event represents a menu shortcut.
286    
287      // MenuShortcuts are activated by Ctrl- KeyEvents.      // MenuShortcuts are activated by Ctrl- KeyEvents, only on KEY_PRESSED.
288      int modifiers = e.getModifiers ();      int modifiers = e.getModifiers ();
289      if ((modifiers & KeyEvent.CTRL_MASK) != 0      if (e.getID() == KeyEvent.KEY_PRESSED
290          || (modifiers & KeyEvent.CTRL_DOWN_MASK) != 0)          && ((modifiers & KeyEvent.CTRL_MASK) != 0
291                || (modifiers & KeyEvent.CTRL_DOWN_MASK) != 0))
292        {        {
293          Window focusedWindow = getGlobalFocusedWindow ();          Window focusedWindow = getGlobalFocusedWindow ();
294          if (focusedWindow instanceof Frame)          if (focusedWindow instanceof Frame)
# Line 313  public class DefaultKeyboardFocusManager Line 314  public class DefaultKeyboardFocusManager
314    
315                          if (shortcut != null)                          if (shortcut != null)
316                            {                            {
317                              // Dispatch a new ActionEvent if this is a                              // Dispatch a new ActionEvent if:
318                              // Shift- KeyEvent and the shortcut requires                              //
319                              // the Shift modifier, or if the shortcut                              //     a) this is a Shift- KeyEvent, and the
320                              // doesn't require the Shift modifier.                              //        shortcut requires the Shift modifier
321                              if ((shortcut.usesShiftModifier ()                              //
322                                   && ((modifiers & KeyEvent.SHIFT_MASK) != 0                              // or, b) this is not a Shift- KeyEvent, and the
323                                       || (modifiers & KeyEvent.SHIFT_DOWN_MASK) != 0)                              //        shortcut does not require the Shift
324                                   || !shortcut.usesShiftModifier ())                              //        modifier.
325                                  && shortcut.getKey () == e.getKeyCode ())                              if (shortcut.getKey () == e.getKeyCode ()
326                                    && ((shortcut.usesShiftModifier ()
327                                         && ((modifiers & KeyEvent.SHIFT_MASK) != 0
328                                             || (modifiers & KeyEvent.SHIFT_DOWN_MASK) != 0))
329                                        || (! shortcut.usesShiftModifier ()
330                                            && (modifiers & KeyEvent.SHIFT_MASK) == 0
331                                            && (modifiers & KeyEvent.SHIFT_DOWN_MASK) == 0)))
332                                {                                {
333                                  item.dispatchEvent (new ActionEvent (item,                                  item.dispatchEvent (new ActionEvent (item,
334                                                                       ActionEvent.ACTION_PERFORMED,                                                                       ActionEvent.ACTION_PERFORMED,

Legend:
Removed from v.1.3  
changed lines
  Added in v.1.4

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26