diff options
author | Eamon Walsh <ewalsh@tycho.nsa.gov> | 2011-08-01 17:34:13 -0400 |
---|---|---|
committer | Eamon Walsh <ewalsh@tycho.nsa.gov> | 2011-08-01 17:34:13 -0400 |
commit | 05e55e6d36b6f4eba1377389da98cfc2f35b6105 (patch) | |
tree | 351bc02a81b96f585cf012d7054edfa607a7431a | |
parent | a3fd6e88dba7f05dcb201560385acd95cef395b8 (diff) |
Add event control to the local socket debugging interface.
-rw-r--r-- | src/debug.c | 5 | ||||
-rw-r--r-- | src/local.c | 22 | ||||
-rw-r--r-- | src/local.h | 1 |
3 files changed, 27 insertions, 1 deletions
diff --git a/src/debug.c b/src/debug.c index 2781d85..435a3a5 100644 --- a/src/debug.c +++ b/src/debug.c @@ -40,7 +40,8 @@ usage(void) bail("Usage: linpicker-cli <code> [param...]\n\t" "0 - Dump views\n\t" "1 <domid> <sak> - Register SAK\n\t" - "2 <domid|-1|-2> - Switch displays"); + "2 <domid|-1|-2> - Switch displays\n\t" + "3 <domid> <event> <set> - Set event"); } int @@ -57,6 +58,8 @@ main(int argc, char **argv) msg.param1 = atoi(argv[2]); if (argc > 3) msg.param2 = atoi(argv[3]); + if (argc > 4) + msg.param3 = atoi(argv[4]); sd = socket(AF_UNIX, SOCK_DGRAM, 0); if (sd < 0) diff --git a/src/local.c b/src/local.c index c3b24f0..017614f 100644 --- a/src/local.c +++ b/src/local.c @@ -36,6 +36,8 @@ #include "fd.h" #include "view.h" #include "sak.h" +#include "display.h" +#include "icon.h" #ifdef LOCALSOCK @@ -81,6 +83,23 @@ local_switch(struct local_message *msg) } static void +local_event(struct local_message *msg) +{ + struct buffer *b; + struct display *d; + + b = buffer_lookup(msg->param1, 0); + d = b ? b->bg_view->display : NULL; + + if (d && msg->param2 < LINPICKER_CLIENT_EVENTS) + icon_set(d, msg->param2, msg->param3); + else + icon_server_set(d, msg->param2, msg->param3); + + display_update_seclabel(active_display); +} + +static void local_process(void *closure) { struct local_message msg; @@ -105,6 +124,9 @@ local_process(void *closure) case LINPICKER_LOCAL_SWITCH: local_switch(&msg); break; + case LINPICKER_LOCAL_EVENT: + local_event(&msg); + break; default: break; } diff --git a/src/local.h b/src/local.h index dfcce59..2c48880 100644 --- a/src/local.h +++ b/src/local.h @@ -22,6 +22,7 @@ #define LINPICKER_LOCAL_DUMP_VIEWS 0 #define LINPICKER_LOCAL_SET_SAK 1 #define LINPICKER_LOCAL_SWITCH 2 +#define LINPICKER_LOCAL_EVENT 3 struct local_message { uint32_t type; |