From 6e23a19d2f80b46924e31ea5d9b46d95ce709e66 Mon Sep 17 00:00:00 2001 From: Christoph Lohmann <20h@r-36.net> Date: Mon, 4 Apr 2011 22:43:12 +0200 Subject: [PATCH] Adding close button. --- layout.arrows.h | 1 + layout.de.h | 1 + layout.en.h | 1 + svkbd.c | 7 +++++++ 4 files changed, 10 insertions(+) diff --git a/layout.arrows.h b/layout.arrows.h index e6169fd..f356518 100644 --- a/layout.arrows.h +++ b/layout.arrows.h @@ -5,6 +5,7 @@ static Key keys[] = { { "↑", XK_Up, 1 }, { "→", XK_Right, 1}, { "Alt", XK_Alt_L, 2 }, + { "[X]", XK_Cancel, 1 }, }; Buttonmod buttonmods[] = { diff --git a/layout.de.h b/layout.de.h index 93de798..a9d02c7 100644 --- a/layout.de.h +++ b/layout.de.h @@ -64,6 +64,7 @@ static Key keys[] = { { "Alt Gr", XK_ISO_Level3_Shift, 2 }, { "Menu", XK_Menu, 2 }, { "Ctrl", XK_Control_R, 2 }, + { "[X]", XK_Cancel, 1}, }; Buttonmod buttonmods[] = { diff --git a/layout.en.h b/layout.en.h index 6795d7f..b7291b5 100644 --- a/layout.en.h +++ b/layout.en.h @@ -60,6 +60,7 @@ static Key keys[] = { { "", XK_space, 5 }, { "Alt", XK_Alt_R, 2 }, { "Ctrl", XK_Control_R, 2 }, + { "[X]", XK_Cancel, 1}, }; Buttonmod buttonmods[] = { diff --git a/svkbd.c b/svkbd.c index d1e7782..d71d42f 100644 --- a/svkbd.c +++ b/svkbd.c @@ -297,6 +297,13 @@ press(Key *k, KeySym mod) { int i; k->pressed = !k->pressed; + switch(k->keysym) { + case XK_Cancel: + exit(0); + default: + break; + } + if(!IsModifierKey(k->keysym)) { for(i = 0; i < LENGTH(keys); i++) if(keys[i].pressed && IsModifierKey(keys[i].keysym))