Adding close button.

This commit is contained in:
Christoph Lohmann 2011-04-04 22:43:12 +02:00
parent fb55e57fc1
commit 6e23a19d2f
4 changed files with 10 additions and 0 deletions

View File

@ -5,6 +5,7 @@ static Key keys[] = {
{ "", XK_Up, 1 }, { "", XK_Up, 1 },
{ "", XK_Right, 1}, { "", XK_Right, 1},
{ "Alt", XK_Alt_L, 2 }, { "Alt", XK_Alt_L, 2 },
{ "[X]", XK_Cancel, 1 },
}; };
Buttonmod buttonmods[] = { Buttonmod buttonmods[] = {

View File

@ -64,6 +64,7 @@ static Key keys[] = {
{ "Alt Gr", XK_ISO_Level3_Shift, 2 }, { "Alt Gr", XK_ISO_Level3_Shift, 2 },
{ "Menu", XK_Menu, 2 }, { "Menu", XK_Menu, 2 },
{ "Ctrl", XK_Control_R, 2 }, { "Ctrl", XK_Control_R, 2 },
{ "[X]", XK_Cancel, 1},
}; };
Buttonmod buttonmods[] = { Buttonmod buttonmods[] = {

View File

@ -60,6 +60,7 @@ static Key keys[] = {
{ "", XK_space, 5 }, { "", XK_space, 5 },
{ "Alt", XK_Alt_R, 2 }, { "Alt", XK_Alt_R, 2 },
{ "Ctrl", XK_Control_R, 2 }, { "Ctrl", XK_Control_R, 2 },
{ "[X]", XK_Cancel, 1},
}; };
Buttonmod buttonmods[] = { Buttonmod buttonmods[] = {

View File

@ -297,6 +297,13 @@ press(Key *k, KeySym mod) {
int i; int i;
k->pressed = !k->pressed; k->pressed = !k->pressed;
switch(k->keysym) {
case XK_Cancel:
exit(0);
default:
break;
}
if(!IsModifierKey(k->keysym)) { if(!IsModifierKey(k->keysym)) {
for(i = 0; i < LENGTH(keys); i++) for(i = 0; i < LENGTH(keys); i++)
if(keys[i].pressed && IsModifierKey(keys[i].keysym)) if(keys[i].pressed && IsModifierKey(keys[i].keysym))