A patch for src/solaris/classes/sun/awt/X11/XKeysym.java

Kurt Miller kurt at intricatesoftware.com
Wed Jan 21 11:05:30 PST 2009


Ahh ok that wont help you. This may be the correct fix but I worry about
unintended side effects since I don't know this code very well. If the
below patch works for you, could you check with the awt devs at Sun to
see if it is correct and file a bug report for getting into the main
tree?

I didn't find any obvious side effects on OpenBSD - Alt still worked
as expected.

diff -r d9b944d764ab src/solaris/classes/sun/awt/X11/XKeysym.java
--- a/src/solaris/classes/sun/awt/X11/XKeysym.java      Tue Jan 20
19:19:27 2009 -0500
+++ b/src/solaris/classes/sun/awt/X11/XKeysym.java      Wed Jan 21
14:03:27 2009 -0500
@@ -70,7 +70,8 @@
         /* First check for Latin-1 characters (1:1 mapping) */
         if ((ks >= 0x0020 && ks <= 0x007e) ||
             (ks >= 0x00a0 && ks <= 0x00ff)) {
-            if( (state & XConstants.ControlMask) != 0 ) {
+            if( (state & XConstants.ControlMask) != 0 ||
+                (state & XToolkit.metaMask) != 0) {
                 if ((ks >= 'A' && ks <= ']') || (ks == '_') ||
                     (ks >= 'a' && ks <='z')) {
                     ks &= 0x1F;

Max (Weijun) Wang wrote:
>> to resolve the issues. One work-around can be found here though:
>>
>> http://extrabright.com/blog/2007/02/03/better-keyboard-shortcut-for-mac-x11-apps/
>>
> 
> This workaround maps both Meta keys to Ctrl, which might be good for
> OpenOffice (the X11 version) where only Ctrl-X keyboard shortcuts are
> defined. In NetBeans, both Meta-X and Ctrl-X keys are defined, and you
> lost the function of Meta+X after this match. For example, both Ctrl-G
> and Meta-G are now "Go to Line".
> 
> Thanks
> Max
> 
> On Jan 21, 2009, at 11:49 AM, Kurt Miller wrote:
> 
>> Hi Max,
>>
>> I too am not an X11/awt expert. I looked over the patch and some
>> of the related code. 16 == XConstants.Mod2Mask, but looking at
>>
>> src/solaris/classes/sun/awt/X11/XToolkit.java
>>
>> makes me believe hard-coding it here is not correct. On my system
>> mod2 is NumLock but on OS X it is Command (use xmodmap -p to check).
>> To further complicate things XK_Meta_L is Alt normally but on OS X
>> it is the Command key.  I'm not sure of the correct solution to use
>> to resolve the issues. One work-around can be found here though:
>>
>> http://extrabright.com/blog/2007/02/03/better-keyboard-shortcut-for-mac-x11-apps/
>>
>>
>> Regards,
>> -Kurt
>>
>> Max (Weijun) Wang wrote:
>>> Hi, BSD Hackers
>>>
>>> I'm using the bsd-port openjdk to run NetBeans on my MacBook. There's
>>> a problem that when you press Command+X in the editor, besides the
>>> keyboard shortcut being executed, the letter "X" itself goes into the
>>> edited file.
>>>
>>> I've coined the following patch and at least NetBeans works fine now.
>>>
>>> diff --git a/src/solaris/classes/sun/awt/X11/XKeysym.java b/src/
>>> solaris/classes/sun/awt/X11/XKeysym.java
>>> --- a/src/solaris/classes/sun/awt/X11/XKeysym.java
>>> +++ b/src/solaris/classes/sun/awt/X11/XKeysym.java
>>> @@ -70,7 +70,7 @@
>>>          /* First check for Latin-1 characters (1:1 mapping) */
>>>          if ((ks >= 0x0020 && ks <= 0x007e) ||
>>>              (ks >= 0x00a0 && ks <= 0x00ff)) {
>>> -            if( (state & XConstants.ControlMask) != 0 ) {
>>> +            if( (state & XConstants.ControlMask) != 0 || (state &
>>> 16) != 0 ) {
>>>                  if ((ks >= 'A' && ks <= ']') || (ks == '_') ||
>>>                      (ks >= 'a' && ks <='z')) {
>>>                      ks &= 0x1F;
>>>
>>> I'm neither a BSD nor an X11/awt expert, so I'm completely not sure if
>>> this really fixes the problem or has broken other things.
>>>
>>> Thanks
>>> Max
>>>
>>>
>>
> 





More information about the bsd-port-dev mailing list