Cosmetics (key->keysym).
This commit is contained in:
parent
9d9fa0edf5
commit
1d3c4bb49c
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* Copyright (C) 2000-2007 Carsten Haitzler, Geoff Harrison and various contributors
|
||||
* Copyright (C) 2007-2010 Kim Woelders
|
||||
* Copyright (C) 2007-2014 Kim Woelders
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
|
@ -446,7 +446,7 @@ main(int argc, char **argv)
|
|||
|
||||
for (;;)
|
||||
{
|
||||
KeySym key;
|
||||
KeySym keysym;
|
||||
XEvent ev;
|
||||
|
||||
prev_pagenum = pagenum;
|
||||
|
@ -455,8 +455,8 @@ main(int argc, char **argv)
|
|||
switch (ev.type)
|
||||
{
|
||||
case KeyPress:
|
||||
key = XLookupKeysym(&ev.xkey, 0);
|
||||
switch (key)
|
||||
keysym = XLookupKeysym(&ev.xkey, 0);
|
||||
switch (keysym)
|
||||
{
|
||||
case XK_Escape:
|
||||
exit(0);
|
||||
|
|
12
src/glwin.c
12
src/glwin.c
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2007-2012 Kim Woelders
|
||||
* Copyright (C) 2007-2014 Kim Woelders
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
|
@ -474,9 +474,9 @@ GlwinRun(EObj * eobj __UNUSED__, int remaining __UNUSED__,
|
|||
}
|
||||
|
||||
static int
|
||||
GlwinKeyPress(GLWindow * gw, KeySym key)
|
||||
GlwinKeyPress(GLWindow * gw, KeySym keysym)
|
||||
{
|
||||
switch (key)
|
||||
switch (keysym)
|
||||
{
|
||||
case XK_q:
|
||||
case XK_Escape:
|
||||
|
@ -576,7 +576,7 @@ static void
|
|||
GlwinEvent(Win win __UNUSED__, XEvent * ev, void *prm)
|
||||
{
|
||||
GLWindow *gw = (GLWindow *) prm;
|
||||
KeySym key;
|
||||
KeySym keysym;
|
||||
int done = 0;
|
||||
|
||||
switch (ev->type)
|
||||
|
@ -594,8 +594,8 @@ GlwinEvent(Win win __UNUSED__, XEvent * ev, void *prm)
|
|||
default:
|
||||
break;
|
||||
case KeyPress:
|
||||
key = XLookupKeysym(&ev->xkey, ev->xkey.state);
|
||||
done = GlwinKeyPress(gw, key);
|
||||
keysym = XLookupKeysym(&ev->xkey, ev->xkey.state);
|
||||
done = GlwinKeyPress(gw, keysym);
|
||||
break;
|
||||
#if 0
|
||||
case EnterNotify:
|
||||
|
|
12
src/magwin.c
12
src/magwin.c
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2007-2013 Kim Woelders
|
||||
* Copyright (C) 2007-2014 Kim Woelders
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
|
@ -240,9 +240,9 @@ _MagwinGrabRelease(MagWindow * mw)
|
|||
}
|
||||
|
||||
static int
|
||||
MagwinKeyPress(MagWindow * mw, KeySym key)
|
||||
MagwinKeyPress(MagWindow * mw, KeySym keysym)
|
||||
{
|
||||
switch (key)
|
||||
switch (keysym)
|
||||
{
|
||||
case XK_q: /* Quit */
|
||||
case XK_Escape:
|
||||
|
@ -312,7 +312,7 @@ static void
|
|||
MagwinEvent(Win win __UNUSED__, XEvent * ev, void *prm)
|
||||
{
|
||||
MagWindow *mw = (MagWindow *) prm;
|
||||
KeySym key;
|
||||
KeySym keysym;
|
||||
int done = 0;
|
||||
|
||||
switch (ev->type)
|
||||
|
@ -321,8 +321,8 @@ MagwinEvent(Win win __UNUSED__, XEvent * ev, void *prm)
|
|||
break;
|
||||
|
||||
case KeyPress:
|
||||
key = XLookupKeysym(&ev->xkey, 0);
|
||||
done = MagwinKeyPress(mw, key);
|
||||
keysym = XLookupKeysym(&ev->xkey, 0);
|
||||
done = MagwinKeyPress(mw, keysym);
|
||||
mw->update = 1;
|
||||
break;
|
||||
|
||||
|
|
22
src/menus.c
22
src/menus.c
|
@ -1198,30 +1198,30 @@ MenuFindNextItem(Menu * m, MenuItem * mi, int inc)
|
|||
}
|
||||
|
||||
static KeySym
|
||||
MenuKeyPressConversion(KeySym key)
|
||||
MenuKeyPressConversion(KeySym keysym)
|
||||
{
|
||||
if (key == Conf.menus.key.left)
|
||||
if (keysym == Conf.menus.key.left)
|
||||
return XK_Left;
|
||||
if (key == Conf.menus.key.right)
|
||||
if (keysym == Conf.menus.key.right)
|
||||
return XK_Right;
|
||||
if (key == Conf.menus.key.up)
|
||||
if (keysym == Conf.menus.key.up)
|
||||
return XK_Up;
|
||||
if (key == Conf.menus.key.down)
|
||||
if (keysym == Conf.menus.key.down)
|
||||
return XK_Down;
|
||||
if (key == Conf.menus.key.escape)
|
||||
if (keysym == Conf.menus.key.escape)
|
||||
return XK_Escape;
|
||||
if (key == Conf.menus.key.ret)
|
||||
if (keysym == Conf.menus.key.ret)
|
||||
return XK_Return;
|
||||
|
||||
/* The key does not correspond to any set, use the default behavior
|
||||
* associated to the key */
|
||||
return key;
|
||||
return keysym;
|
||||
}
|
||||
|
||||
static void
|
||||
MenuEventKeyPress(Menu * m, XEvent * ev)
|
||||
{
|
||||
KeySym key;
|
||||
KeySym keysym;
|
||||
MenuItem *mi;
|
||||
EWin *ewin;
|
||||
|
||||
|
@ -1234,8 +1234,8 @@ MenuEventKeyPress(Menu * m, XEvent * ev)
|
|||
|
||||
/* NB! m != NULL */
|
||||
|
||||
key = XLookupKeysym(&ev->xkey, 0);
|
||||
switch (MenuKeyPressConversion(key))
|
||||
keysym = XLookupKeysym(&ev->xkey, 0);
|
||||
switch (MenuKeyPressConversion(keysym))
|
||||
{
|
||||
case XK_Escape:
|
||||
MenusHide();
|
||||
|
|
16
src/warp.c
16
src/warp.c
|
@ -443,7 +443,7 @@ static void
|
|||
WarpFocusHandleEvent(Win win __UNUSED__, XEvent * ev, void *prm __UNUSED__)
|
||||
{
|
||||
WarpFocusWin *fw = warpFocusWindow;
|
||||
KeySym key;
|
||||
KeySym keysym;
|
||||
unsigned int mask;
|
||||
|
||||
if (!EoIsShown(fw))
|
||||
|
@ -456,13 +456,13 @@ WarpFocusHandleEvent(Win win __UNUSED__, XEvent * ev, void *prm __UNUSED__)
|
|||
{
|
||||
if (((ev->xkey.state ^ warpFocusState) &
|
||||
Mode.masks.mod_key_mask) == 0)
|
||||
key = 0x80000000;
|
||||
keysym = 0x80000000;
|
||||
else
|
||||
key = 0x80000001;
|
||||
keysym = 0x80000001;
|
||||
}
|
||||
else
|
||||
key = XLookupKeysym(&ev->xkey, 0);
|
||||
switch (key)
|
||||
keysym = XLookupKeysym(&ev->xkey, 0);
|
||||
switch (keysym)
|
||||
{
|
||||
default:
|
||||
break;
|
||||
|
@ -486,10 +486,10 @@ WarpFocusHandleEvent(Win win __UNUSED__, XEvent * ev, void *prm __UNUSED__)
|
|||
break;
|
||||
}
|
||||
if (ev->xkey.keycode == warpFocusKey)
|
||||
key = 0x80000000;
|
||||
keysym = 0x80000000;
|
||||
else
|
||||
key = XLookupKeysym(&ev->xkey, 0);
|
||||
switch (key)
|
||||
keysym = XLookupKeysym(&ev->xkey, 0);
|
||||
switch (keysym)
|
||||
{
|
||||
case XK_Escape:
|
||||
WarpFocusHide();
|
||||
|
|
Loading…
Reference in New Issue