Introduction
Introduction Statistics Contact Development Disclaimer Help
adding dead spacing between keys to prevent misclicks and adapting keyboard lay…
git clone git://git.suckless.org/svkbd
Log
Files
Refs
README
LICENSE
---
commit 2a84ae50f91099ef2575e5c328fba774af26001f
parent 2306b8eb408ad8ea7bcb73f8bff90272e7b4b952
Author: Maarten van Gompel <[email protected]>
Date: Sun, 13 Jun 2021 22:27:59 +0200
adding dead spacing between keys to prevent misclicks and adapting keyboard lay…
Diffstat:
M config.def.h | 2 ++
M layout.mobile-intl.h | 18 ++++++++++--------
M svkbd.c | 16 ++++++++++++----
3 files changed, 24 insertions(+), 12 deletions(-)
---
diff --git a/config.def.h b/config.def.h
@@ -4,6 +4,8 @@ static double overlay_delay = 1.0; //in seconds
static double repeat_delay = 0.75; //in seconds, will not work on keys with ov…
static int scan_rate = 50; //scan rate in microseconds, affects key repetition…
static int heightfactor = 14; //one row of keys takes up 1/x of the screen hei…
+static int xspacing = 3;
+static int yspacing = 3;
static const char *defaultfonts[] = {
"DejaVu Sans:bold:size=22"
};
diff --git a/layout.mobile-intl.h b/layout.mobile-intl.h
@@ -1,4 +1,4 @@
-#define KEYS 55
+#define KEYS 57
static Key keys_en[KEYS] = {
{ "Esc", "", XK_Escape, 1 },
@@ -12,9 +12,11 @@ static Key keys_en[KEYS] = {
{ "8", "*", XK_8, 1 },
{ "9", "(", XK_9, 1 },
{ "0", ")", XK_0, 1 },
+ { "-", "_", XK_minus, 1 },
{ 0 }, /* New row */
+ { "↹", 0, XK_Tab, 0.5 },
{ 0, 0, XK_q, 1 },
{ 0, 0, XK_w, 1 },
{ 0, 0, XK_e, 1 },
@@ -25,10 +27,11 @@ static Key keys_en[KEYS] = {
{ 0, 0, XK_i, 1 },
{ 0, 0, XK_o, 1 },
{ 0, 0, XK_p, 1 },
- { "'", "\"", XK_apostrophe, 1 },
+ { "/", "?", XK_slash, 1 },
{ 0 }, /* New row */
+ { "^", 0, XK_Control_L, 1 },
{ 0, 0, XK_a, 1 },
{ 0, 0, XK_s, 1 },
{ 0, 0, XK_d, 1 },
@@ -38,11 +41,12 @@ static Key keys_en[KEYS] = {
{ 0, 0, XK_j, 1 },
{ 0, 0, XK_k, 1 },
{ 0, 0, XK_l, 1 },
- { "/", "?", XK_slash, 1 },
- { "Tab", 0, XK_Tab, 1 },
+ { ";", ":", XK_colon, 1 },
+ { "'", "\"", XK_apostrophe, 1 },
{ 0 }, /* New row */
+ { "⇧", 0, XK_Shift_L, 1.5 },
{ 0, 0, XK_z, 1 },
{ 0, 0, XK_x, 1 },
{ 0, 0, XK_c, 1 },
@@ -52,14 +56,12 @@ static Key keys_en[KEYS] = {
{ 0, 0, XK_m, 1 },
{ ",", "<", XK_comma, 1 },
{ ".", ">", XK_period, 1 },
- { "⌫Bksp", 0, XK_BackSpace, 2 },
+ { "⌫", 0, XK_BackSpace, 1 },
{ 0 }, /* New row */
{ "↺", 0, XK_Cancel, 1},
- { "Shift", 0, XK_Shift_L, 2 },
- { "Ctrl", 0, XK_Control_L, 1 },
{ "Alt", 0, XK_Alt_L, 1 },
- { "", 0, XK_space, 2 },
+ { "", 0, XK_space, 4 },
{ "↓", 0, XK_Down, 1 },
{ "↑", 0, XK_Up, 1 },
{ "↲ Enter", 0, XK_Return, 2 },
diff --git a/svkbd.c b/svkbd.c
@@ -47,7 +47,7 @@ typedef struct {
char *label;
char *label2;
KeySym keysym;
- unsigned int width;
+ double width;
KeySym modifier;
int x, y, w, h;
Bool pressed;
@@ -307,11 +307,16 @@ void
drawkeyboard(void)
{
int i;
+ int row = 0;
+ drw_setscheme(drw, scheme[SchemeNorm]);
+ drw_rect(drw, 0, 0, ww, wh, 1, 1);
+ drw_map(drw, win, 0, 0, ww, wh);
for (i = 0; i < numkeys; i++) {
if (keys[i].keysym != 0)
drawkey(&keys[i]);
}
+ drw_map(drw, win, 0, 0, ww, wh);
}
void
@@ -946,18 +951,21 @@ void
updatekeys(void)
{
int i, j;
- int x = 0, y = 0, h, base, r = rows;
+ double base;
+ int x = 0, y = 0, h, r = rows;
h = (wh - 1) / rows;
for (i = 0; i < numkeys; i++, r--) {
for (j = i, base = 0; j < numkeys && keys[j].keysym != 0; j++)
base += keys[j].width;
for (x = 0; i < numkeys && keys[i].keysym != 0; i++) {
- keys[i].x = x;
- keys[i].y = y;
+ keys[i].x = x + xspacing;
+ keys[i].y = y + yspacing;
keys[i].w = keys[i].width * ww / base;
keys[i].h = r == 1 ? wh - y - 1 : h;
x += keys[i].w;
+ keys[i].w = keys[i].w - (xspacing * 2);
+ keys[i].h = keys[i].h - (yspacing * 2);
}
if (base != 0)
keys[i - 1].w = ww - 1 - keys[i - 1].x;
You are viewing proxied material from suckless.org. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.