discuss-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: SHIFT keys on X11


From: Stéphane Goujet
Subject: Re: SHIFT keys on X11
Date: Mon, 08 May 2006 16:34:08 +0300
User-agent: Mozilla Thunderbird 1.0.6 (Windows/20050716)

Fred Kiefer a écrit :

most of what you write makes sense to me, but what do you need this
static variable shiftPressed for? My impression is that this will get
you into trouble. If the shift key gets pressed or released while
another application has the focus, your counter will get out of step.

  I will check that. I did not think of it before.

Why cann't you make the decision, if the eventflags should include
NSShiftKeyMask, just in the state of the keyboard and on the fact, if
the shift key was pressed in this event?
Could you please try if this code wors for you, or if you experiance
any problems with it.

Your code is what I tried first, but the problem is that there are 2 SHIFT keys on a keyboard.
1) Press SHIFT_L -> NSShiftKeyMask is set, OK
2) Press SHIFT_R -> NSShiftKeyMask is set, OK
3) Release SHIFT_R -> NSShiftKeyMask is cleared, BOUM

I am suggesting something similar to:
  if (keysym_is_X_modifier (keysym))
    {
    switch (keysym)
      {
      case XK_Shift_L:
      case XK_Shift_R:
        if(xEvent->xkey.type==KeyPress)
          {
            eventFlags|= NSShiftKeyMask;
          }
        else
          {
            // KeyRelease
            eventFlags&= ~NSShiftKeyMask;
          }
      default:
        break;
      }
      eventType = NSFlagsChanged;
    }

(With the correct GNUstep indentation of course)

  :-) Sorry, it is weird for me :-) But I shall try if I post more code.

Goodbye,
         Stéphane.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]