[prev in list] [next in list] [prev in thread] [next in thread] 

List:       jedit-cvs
Subject:    [ jEdit-commits ] SF.net SVN: jedit:[24092] jEdit/trunk
From:       ezust () users ! sourceforge ! net
Date:       2015-09-24 2:36:15
Message-ID: E1ZewOR-0006bY-1a () sfs-ml-2 ! v29 ! ch3 ! sourceforge ! com
[Download RAW message or body]

Revision: 24092
          http://sourceforge.net/p/jedit/svn/24092
Author:   ezust
Date:     2015-09-24 02:36:15 +0000 (Thu, 24 Sep 2015)
Log Message:
-----------
Handling of NUMPAD keys cleanup (Patch #567 - Makarius)

Modified Paths:
--------------
    jEdit/trunk/doc/CHANGES.txt
    jEdit/trunk/org/gjt/sp/jedit/gui/DefaultInputHandler.java
    jEdit/trunk/org/gjt/sp/jedit/gui/KeyEventWorkaround.java
    jEdit/trunk/org/gjt/sp/jedit/input/TextAreaInputHandler.java

Modified: jEdit/trunk/doc/CHANGES.txt
===================================================================
--- jEdit/trunk/doc/CHANGES.txt	2015-09-24 02:34:08 UTC (rev 24091)
+++ jEdit/trunk/doc/CHANGES.txt	2015-09-24 02:36:15 UTC (rev 24092)
@@ -46,6 +46,8 @@
 }}}
 {{{ UI Improvements
 
+- Handling of NUMPAD keys cleanup (Patch #567 - Makarius)
+
 - Scalable GUI for tip-of-the-day (Makarius)
 
 - Scalable ColorWell icon according to UI font (Makarius)

Modified: jEdit/trunk/org/gjt/sp/jedit/gui/DefaultInputHandler.java
===================================================================
--- jEdit/trunk/org/gjt/sp/jedit/gui/DefaultInputHandler.java	2015-09-24 02:34:08 UTC \
                (rev 24091)
+++ jEdit/trunk/org/gjt/sp/jedit/gui/DefaultInputHandler.java	2015-09-24 02:36:15 UTC \
(rev 24092) @@ -167,13 +167,6 @@
 						userInput(input);
 					}
 				}
-				else
-				{
-					// this is retarded. excuse me while I drool
-					// and make stupid noises
-					if(KeyEventWorkaround.isNumericKeypad(keyStroke.key))
-						KeyEventWorkaround.numericKeypadKey();
-				}
 				sendShortcutPrefixOff();
 			}
 		}

Modified: jEdit/trunk/org/gjt/sp/jedit/gui/KeyEventWorkaround.java
===================================================================
--- jEdit/trunk/org/gjt/sp/jedit/gui/KeyEventWorkaround.java	2015-09-24 02:34:08 UTC \
                (rev 24091)
+++ jEdit/trunk/org/gjt/sp/jedit/gui/KeyEventWorkaround.java	2015-09-24 02:36:15 UTC \
(rev 24092) @@ -129,7 +129,7 @@
 		case KeyEvent.VK_OPEN_BRACKET :
 		case KeyEvent.VK_BACK_SLASH   :
 		case KeyEvent.VK_CLOSE_BRACKET:
-	/*	case KeyEvent.VK_NUMPAD0 :
+		case KeyEvent.VK_NUMPAD0 :
 		case KeyEvent.VK_NUMPAD1 :
 		case KeyEvent.VK_NUMPAD2 :
 		case KeyEvent.VK_NUMPAD3 :
@@ -144,7 +144,7 @@
 		case KeyEvent.VK_SEPARATOR:
 		case KeyEvent.VK_SUBTRACT   :
 		case KeyEvent.VK_DECIMAL    :
-		case KeyEvent.VK_DIVIDE     :*/
+		case KeyEvent.VK_DIVIDE     :
 		case KeyEvent.VK_BACK_QUOTE:
 		case KeyEvent.VK_QUOTE:
 		case KeyEvent.VK_DEAD_GRAVE:
@@ -188,33 +188,6 @@
 		}
 	} //}}}
 
-	//{{{ isNumericKeypad() method
-	public static boolean isNumericKeypad(int keyCode)
-	{
-		switch(keyCode)
-		{
-		case KeyEvent.VK_NUMPAD0:
-		case KeyEvent.VK_NUMPAD1:
-		case KeyEvent.VK_NUMPAD2:
-		case KeyEvent.VK_NUMPAD3:
-		case KeyEvent.VK_NUMPAD4:
-		case KeyEvent.VK_NUMPAD5:
-		case KeyEvent.VK_NUMPAD6:
-		case KeyEvent.VK_NUMPAD7:
-		case KeyEvent.VK_NUMPAD8:
-		case KeyEvent.VK_NUMPAD9:
-		case KeyEvent.VK_MULTIPLY:
-		case KeyEvent.VK_ADD:
-		/* case KeyEvent.VK_SEPARATOR: */
-		case KeyEvent.VK_SUBTRACT:
-		case KeyEvent.VK_DECIMAL:
-		case KeyEvent.VK_DIVIDE:
-			return true;
-		default:
-			return false;
-		}
-	} //}}}
-
 	//{{{ processKeyEvent() method
 	public static KeyEvent processKeyEvent(KeyEvent evt)
 	{
@@ -258,10 +231,7 @@
 						return null;
 				}
 
-				if(isNumericKeypad(keyCode))
-					last = LAST_NUMKEYPAD;
-				else
-					last = LAST_NOTHING;
+				last = LAST_NOTHING;
 
 				break;
 			}
@@ -293,20 +263,8 @@
 				return null;
 			}
 
-			// if the last key was a numeric keypad key
-			// and NumLock is off, filter it out
-			if(last == LAST_NUMKEYPAD)
-			{
-				last = LAST_NOTHING;
-				if((ch >= '0' && ch <= '9') || ch == '.'
-					|| ch == '/' || ch == '*'
-					|| ch == '-' || ch == '+')
-				{
-					return null;
-				}
-			}
 			// Windows JDK workaround
-			else if(last == LAST_ALT)
+			if(last == LAST_ALT)
 			{
 				last = LAST_NOTHING;
 				switch(ch)
@@ -363,20 +321,9 @@
 		return evt;
 	} //}}}
 
-	//{{{ numericKeypadKey() method
-	/**
-	 * A workaround for non-working NumLock status in some Java versions.
-	 * @since jEdit 4.0pre8
-	 */
-	public static void numericKeypadKey()
-	{
-		last = LAST_NOTHING;
-	} //}}}
-
 	//{{{ Private members
 	private static int last;
 	private static final int LAST_NOTHING = 0;
-	private static final int LAST_NUMKEYPAD = 1;
-	private static final int LAST_ALT = 2;
+	private static final int LAST_ALT = 1;
 	//}}}
 }

Modified: jEdit/trunk/org/gjt/sp/jedit/input/TextAreaInputHandler.java
===================================================================
--- jEdit/trunk/org/gjt/sp/jedit/input/TextAreaInputHandler.java	2015-09-24 02:34:08 \
                UTC (rev 24091)
+++ jEdit/trunk/org/gjt/sp/jedit/input/TextAreaInputHandler.java	2015-09-24 02:36:15 \
UTC (rev 24092) @@ -292,13 +292,6 @@
 						userInput(input);
 					}
 				}
-				else
-				{
-					// this is retarded. excuse me while I drool
-					// and make stupid noises
-					if(KeyEventWorkaround.isNumericKeypad(keyStroke.key))
-						KeyEventWorkaround.numericKeypadKey();
-				}
 				sendShortcutPrefixOff();
 			}
 		}

This was sent by the SourceForge.net collaborative development platform, the world's \
largest Open Source development site.


------------------------------------------------------------------------------
Monitor Your Dynamic Infrastructure at Any Scale With Datadog!
Get real-time metrics from all of your servers, apps and tools
in one place.
SourceForge users - Click here to start your Free Trial of Datadog now!
http://pubads.g.doubleclick.net/gampad/clk?id=241902991&iu=/4140
_______________________________________________
jEdit-CVS mailing list
jEdit-CVS@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jedit-cvs


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic