diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2015-05-08 19:12:52 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2015-05-08 19:12:52 +0000 |
commit | e854e762edf092d7bd76ad58286e116bb628c94c (patch) | |
tree | 77083524d896b91f0410c80214e85861b30cbfd9 | |
parent | 0eb59063ae8e2b39906e021027e1c0657f3949e3 (diff) |
Add a new `don't read back' flag for variables, to prevent reading their value
after modifying them. Give this flag to `display.focus', since screen
switching is asynchronous, and reading back will return the screen we are
switching from if the switch has not completed yet.
Also, disallow -= and += syntax for display.focus, as it doesn't make any sense.
-rw-r--r-- | sbin/wsconsctl/display.c | 4 | ||||
-rw-r--r-- | sbin/wsconsctl/wsconsctl.c | 8 | ||||
-rw-r--r-- | sbin/wsconsctl/wsconsctl.h | 3 |
3 files changed, 9 insertions, 6 deletions
diff --git a/sbin/wsconsctl/display.c b/sbin/wsconsctl/display.c index 87505a82c18..6f789291142 100644 --- a/sbin/wsconsctl/display.c +++ b/sbin/wsconsctl/display.c @@ -1,4 +1,4 @@ -/* $OpenBSD: display.c,v 1.19 2013/10/20 22:07:57 miod Exp $ */ +/* $OpenBSD: display.c,v 1.20 2015/05/08 19:12:51 miod Exp $ */ /* $NetBSD: display.c,v 1.1 1998/12/28 14:01:16 hannken Exp $ */ /*- @@ -56,7 +56,7 @@ struct field display_field_tab[] = { { "depth", &depth, FMT_UINT, FLG_RDONLY }, { "emulations", &emuls, FMT_EMUL, FLG_RDONLY }, { "screentypes", &screens, FMT_SCREEN, FLG_RDONLY }, - { "focus", &focus, FMT_INT, FLG_MODIFY }, + { "focus", &focus, FMT_INT, FLG_NORDBACK }, { "brightness", &brightness, FMT_PC, FLG_MODIFY|FLG_INIT }, { "contrast", &contrast, FMT_PC, FLG_MODIFY|FLG_INIT }, { "backlight", &backlight, FMT_PC, FLG_MODIFY|FLG_INIT }, diff --git a/sbin/wsconsctl/wsconsctl.c b/sbin/wsconsctl/wsconsctl.c index 4d0878bf27f..38b13bdf78e 100644 --- a/sbin/wsconsctl/wsconsctl.c +++ b/sbin/wsconsctl/wsconsctl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: wsconsctl.c,v 1.28 2012/07/14 08:28:47 shadchin Exp $ */ +/* $OpenBSD: wsconsctl.c,v 1.29 2015/05/08 19:12:51 miod Exp $ */ /* $NetBSD: wsconsctl.c,v 1.2 1998/12/29 22:40:20 hannken Exp $ */ /*- @@ -264,8 +264,10 @@ main(int argc, char *argv[]) if (f->flags & FLG_WRONLY) { pr_field(devname, f, setsep); } else { - f->flags |= FLG_GET; - (*sw->getval)(devfd); + if (!(f->flags & FLG_NORDBACK)) { + f->flags |= FLG_GET; + (*sw->getval)(devfd); + } if (f->flags & FLG_DEAD) continue; pr_field(devname, f, setsep); diff --git a/sbin/wsconsctl/wsconsctl.h b/sbin/wsconsctl/wsconsctl.h index 655c8cb794e..7ee37706d95 100644 --- a/sbin/wsconsctl/wsconsctl.h +++ b/sbin/wsconsctl/wsconsctl.h @@ -1,4 +1,4 @@ -/* $OpenBSD: wsconsctl.h,v 1.14 2013/10/20 22:07:57 miod Exp $ */ +/* $OpenBSD: wsconsctl.h,v 1.15 2015/05/08 19:12:51 miod Exp $ */ /* $NetBSD: wsconsctl.h 1.1 1998/12/28 14:01:17 hannken Exp $ */ /*- @@ -53,6 +53,7 @@ struct field { #define FLG_WRONLY 0x0002 /* variable cannot be displayed */ #define FLG_NOAUTO 0x0004 /* skip variable on -a flag */ #define FLG_MODIFY 0x0008 /* variable may be modified with += */ +#define FLG_NORDBACK 0x0010 /* do not read back variable after write */ #define FLG_GET 0x0100 /* read this variable from driver */ #define FLG_SET 0x0200 /* write this variable to driver */ #define FLG_INIT 0x0400 /* init (read) before write */ |