new default 'GSModifiersAreKeys', if set XGServerEvent will always interpret the same key as the same keysym/modifier; also, fix typo in xlib/XGBitmap error message

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/back/trunk@20297 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
arobert 2004-11-05 04:31:26 +00:00
parent 4f6e790477
commit 1c703fe4eb
4 changed files with 56 additions and 11 deletions

View file

@ -1,3 +1,13 @@
2004-09-24 Adrian Robert <arobert@cogsci.ucsd.edu>
* Source/x11/XGServerEvent.m (process_key_event): Modifier detection:
If default "GSModifiersAreKeys" is YES, ignore 'shift' and/or other
state and just map keypress to first modifier for they key.
* Documentation/Back/DefaultsSummary.gsdoc: Document new default
"GSModifiersAreKeys".
* Source/xlib/XGBitmap.m (_bitmap_combine_alpha()): corrected typo
in error message.
2004-10-30 Fred Kiefer <FredKiefer@gmx.de>
* Source/xlib/XGContext.m (+initializeBackend): Use anti-aliaesd

View file

@ -169,9 +169,36 @@
<item>NoSymbol</item>
</list>
<p>
This is described more completely in the GUI documentation.
These strings correspond to "keysyms" on X11 systems. On X11,
physical keys on the keyboard are equivalent to <em>keycodes</em>.
A single keysym may be associated to more than one keycode, and
can even be associated to a shifted key.
</p>
<p>
This is described more completely in the <uref
url="../../../User/Gui/KeyboardSetup.html">GUI documentation on
keyboard setup</uref>.
</p>
</desc>
<term>GSModifiersAreKeys</term>
<desc>
<p>
On some keyboards, the default X11 mapping includes keycodes that
are mapped to one or another modifier keysym depending on whether
'shift' (or in some cases, another key) is pressed. This is the
case on some Apple USB keyboards for example: one key to the left
of the spacebar maps to "Option" without shift pressed, and "Alt"
with shift pressed. Such keyboard mappings are often useful in
non-English contexts to access accents or non-Roman characters.
However if such a key is used as a modifier in GNUstep problems can
occur when trying to use the modifier in conjunction with a shifted
character. In particular, you will need to hit and release the
modifier and the shift key in a particular order, or else things
will not work as expected, and the modifier may become "stuck". If
you experience such a problem, set <code>GSModifiersAreKeys</code>
to <code>YES</code>.
</p>
</desc>
<term>UseWindowMakerIcons</term>
<desc>
<p>

View file

@ -84,6 +84,7 @@ static KeySym _command_keysyms[2];
static KeySym _alt_keysyms[2];
static BOOL _is_keyboard_initialized = NO;
static BOOL _mod_ignore_shift = NO;
void __objc_xgcontextevent_linking (void)
{
@ -1456,6 +1457,7 @@ initialize_keyboard (void)
set_up_num_lock ();
_mod_ignore_shift = [defaults boolForKey: @"GSModifiersAreKeys"];
_is_keyboard_initialized = YES;
}
@ -1536,6 +1538,7 @@ process_key_event (XEvent* xEvent, XGServer* context, NSEventType eventType)
int control_key = 0;
int command_key = 0;
int alt_key = 0;
KeySym modKeysym; // process modifier independently of shift, etc.
if (_is_keyboard_initialized == NO)
initialize_keyboard ();
@ -1562,31 +1565,36 @@ process_key_event (XEvent* xEvent, XGServer* context, NSEventType eventType)
//ximKeyCode = XKeysymToKeycode([XGServer currentXDisplay],keysym);
/* Process NSFlagsChanged events. We can't use a switch because we
are not comparing to constants. Make sure keyCode is not 0 since
XIM events can potentially return 0 keyCodes. */
if (keysym != NoSymbol)
are not comparing to constants. Make sure keySym is not NoSymbol since
XIM events can potentially return this. */
/* Possibly ignore shift/other modifier state in determining KeySym to
work around correct but undesired behavior with shifted modifiers.
See Back defaults documentation for "GSModifiersAreKeys". */
modKeysym = (_mod_ignore_shift == YES) ?
XLookupKeysym((XKeyEvent *)xEvent, 0) : keysym;
if (modKeysym != NoSymbol)
{
if (keysym == _control_keysyms[0])
if (modKeysym == _control_keysyms[0])
{
control_key = 1;
}
else if (keysym == _control_keysyms[1])
else if (modKeysym == _control_keysyms[1])
{
control_key = 2;
}
else if (keysym == _command_keysyms[0])
else if (modKeysym == _command_keysyms[0])
{
command_key = 1;
}
else if (keysym == _command_keysyms[1])
else if (modKeysym == _command_keysyms[1])
{
command_key = 2;
}
else if (keysym == _alt_keysyms[0])
else if (modKeysym == _alt_keysyms[0])
{
alt_key = 1;
}
else if (keysym == _alt_keysyms[1])
else if (modKeysym == _alt_keysyms[1])
{
alt_key = 2;
}

View file

@ -723,7 +723,7 @@ _bitmap_combine_alpha(RContext *context,
case rgb_colorspace:
if(num_of_colours != 3)
{
NSLog(@"Bad number of colour planes - d", num_of_colours);
NSLog(@"Bad number of colour planes - %d", num_of_colours);
NSLog(@"RGB colourspace requires three planes excluding alpha");
return -1;
}