summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorAlexandr Shadchin <shadchin@cvs.openbsd.org>2011-04-14 19:25:55 +0000
committerAlexandr Shadchin <shadchin@cvs.openbsd.org>2011-04-14 19:25:55 +0000
commita106282532b06ecd29c8d9ac4583c2387c5f448b (patch)
tree3ad988f50d7df0e14aa55ad7e227f49e3e68f77e /sys/dev
parentb50b051aa511f9d9f328262ad0730960b7cfc10c (diff)
Reducing number of call update_leds().
Updating state LED only when necessary. ok krw@
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/wscons/wskbd.c17
1 files changed, 7 insertions, 10 deletions
diff --git a/sys/dev/wscons/wskbd.c b/sys/dev/wscons/wskbd.c
index 6ae214fae02..62aed6bd3b4 100644
--- a/sys/dev/wscons/wskbd.c
+++ b/sys/dev/wscons/wskbd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: wskbd.c,v 1.65 2011/04/13 18:16:33 shadchin Exp $ */
+/* $OpenBSD: wskbd.c,v 1.66 2011/04/14 19:25:54 shadchin Exp $ */
/* $NetBSD: wskbd.c,v 1.80 2005/05/04 01:52:16 augustss Exp $ */
/*
@@ -196,6 +196,8 @@ struct wskbd_softc {
#define MOD_ANYSHIFT (MOD_SHIFT_L | MOD_SHIFT_R | MOD_SHIFTLOCK)
#define MOD_ANYCONTROL (MOD_CONTROL_L | MOD_CONTROL_R)
#define MOD_ANYMETA (MOD_META_L | MOD_META_R)
+#define MOD_ANYLED (MOD_SHIFTLOCK | MOD_CAPSLOCK | MOD_NUMLOCK | \
+ MOD_COMPOSE | MOD_HOLDSCREEN)
#define MOD_ONESET(id, mask) (((id)->t_modifiers & (mask)) != 0)
#define MOD_ALLSET(id, mask) (((id)->t_modifiers & (mask)) == (mask))
@@ -1319,6 +1321,8 @@ update_modifier(struct wskbd_internal *id, u_int type, int toggle, int mask)
else
id->t_modifiers &= ~mask;
}
+ if (mask & MOD_ANYLED)
+ update_leds(id);
}
#if NWSDISPLAY > 0
@@ -1496,7 +1500,6 @@ wskbd_translate(struct wskbd_internal *id, u_int type, int value)
MOD_META_L | MOD_META_R |
MOD_MODESHIFT | MOD_MODELOCK |
MOD_COMMAND | MOD_COMMAND1 | MOD_COMMAND2);
- update_leds(id);
return (0);
}
@@ -1595,10 +1598,8 @@ wskbd_translate(struct wskbd_internal *id, u_int type, int value)
#endif
/* If this is a key release or we are in command mode, we are done */
- if (type != WSCONS_EVENT_KEY_DOWN || iscommand) {
- update_leds(id);
+ if (type != WSCONS_EVENT_KEY_DOWN || iscommand)
return (0);
- }
/* Get the keysym */
if (id->t_modifiers & (MOD_MODESHIFT|MOD_MODELOCK) &&
@@ -1672,10 +1673,8 @@ wskbd_translate(struct wskbd_internal *id, u_int type, int value)
break;
}
- if (res == KS_voidSymbol) {
- update_leds(id);
+ if (res == KS_voidSymbol)
return (0);
- }
if (id->t_composelen > 0) {
/*
@@ -1699,8 +1698,6 @@ wskbd_translate(struct wskbd_internal *id, u_int type, int value)
}
}
- update_leds(id);
-
/* We are done, return the symbol */
if (KS_GROUP(res) == KS_GROUP_Ascii) {
if (MOD_ONESET(id, MOD_ANYCONTROL)) {