summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEamon Walsh <ewalsh@tycho.nsa.gov>2011-07-29 16:37:25 -0400
committerEamon Walsh <ewalsh@tycho.nsa.gov>2011-07-29 16:48:39 -0400
commit6fa3b61fdfeb3cbbe89808cb76bb96f5f1279a3d (patch)
treeb76aa15161b28438d3151543ec34354914b2ec78
parent1dabf5f303b0cf12199790915551ecd2f90a329b (diff)
Expose dynamic SAK registration in the track protocol.
A new SAK_REQUEST message type is added to the track protocol. The view field carries the SAK code which the guest wishes to register. A SAK_SUCCESS or SAK_FAILURE message will be returned to the guest to indicate the success or failure of the request. A SAK_PRESSED message is returned to the guest on a SAK press. TODO: Communicate which SAK was pressed (requires protocol revision).
-rw-r--r--src/comm.c11
-rw-r--r--src/display.c8
-rw-r--r--src/sak.c2
-rw-r--r--src/track.h5
4 files changed, 23 insertions, 3 deletions
diff --git a/src/comm.c b/src/comm.c
index 64ba0b8..b1f411a 100644
--- a/src/comm.c
+++ b/src/comm.c
@@ -27,6 +27,7 @@
#include "buffer.h"
#include "client.h"
#include "display.h"
+#include "sak.h"
static void
comm_do_update(struct client *c, struct buffer *b, struct view *v,
@@ -162,6 +163,13 @@ top:
goto top;
}
+static void
+comm_sak(struct client *c, struct buffer *b, struct lin_message *m)
+{
+ int rc = sak_register(m->view, b->bg_view->display);
+ client_send_message(c, rc ? LINPICKER_SAK_FAILURE : LINPICKER_SAK_SUCCESS);
+}
+
void
comm_process(struct client *c, struct buffer *b, struct lin_message *m)
{
@@ -181,6 +189,9 @@ comm_process(struct client *c, struct buffer *b, struct lin_message *m)
case LINPICKER_NAME:
comm_name(c, b, m);
break;
+ case LINPICKER_SAK_REQUEST:
+ comm_sak(c, b, m);
+ break;
default:
break;
}
diff --git a/src/display.c b/src/display.c
index a327689..e155b7b 100644
--- a/src/display.c
+++ b/src/display.c
@@ -49,6 +49,7 @@
#include <directfb.h>
#include "common.h"
+#include "track.h"
#include "view.h"
#include "client.h"
#include "display.h"
@@ -286,8 +287,11 @@ display_secure_enter(int keycode)
view_toggle_labeling();
break;
default:
- if (sak_check_keycode(keycode))
- display_switch(sak_get_display(keycode));
+ if (sak_check_keycode(keycode)) {
+ struct display *d = sak_get_display(keycode);
+ display_switch(d);
+ client_send_message(d->client, LINPICKER_SAK_PRESSED);
+ }
break;
}
}
diff --git a/src/sak.c b/src/sak.c
index 942468f..e0e9252 100644
--- a/src/sak.c
+++ b/src/sak.c
@@ -62,7 +62,7 @@ sak_unregister(struct display *d)
for (i = 0; i < NUM_SAKS; i++)
if (sak_displays[i] == d)
- sak_displays[i] == NULL;
+ sak_displays[i] = NULL;
}
struct display *
diff --git a/src/track.h b/src/track.h
index aa93a05..94a07b6 100644
--- a/src/track.h
+++ b/src/track.h
@@ -29,6 +29,9 @@
/* Messages sent by server */
#define LINPICKER_REQUEST_UPDATE 0
+#define LINPICKER_SAK_SUCCESS 1
+#define LINPICKER_SAK_FAILURE 2
+#define LINPICKER_SAK_PRESSED 3
/* Messages sent by client */
#define LINPICKER_RESET 0
@@ -36,7 +39,9 @@
#define LINPICKER_UPDATE 2
#define LINPICKER_DESTROY 3
#define LINPICKER_NAME 4
+#define LINPICKER_SAK_REQUEST 5
+/* Flags for create/update messages */
#define LINPICKER_FLAG_POSITION 1
#define LINPICKER_FLAG_TOPMOST 2
#define LINPICKER_FLAG_BOTMOST 4