aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar ulion <ulion@b3059339-0415-0410-9bf9-f77b7e298cf2>2007-12-26 13:13:48 +0000
committerGravatar ulion <ulion@b3059339-0415-0410-9bf9-f77b7e298cf2>2007-12-26 13:13:48 +0000
commitb6870cc5ba1c9b43307af26f47ed5bc0c2d5c7de (patch)
treead3f2ccc5feb5f6dcff877f6e3e8ab0e1e5d8ffb
parent2b517dc714c02f654d032e9d68815281a613cafa (diff)
From now on, libmenu does not steal all input keys from input modules.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@25530 b3059339-0415-0410-9bf9-f77b7e298cf2
-rw-r--r--input/input.c4
-rw-r--r--input/input.h2
-rw-r--r--libmenu/menu.c6
-rw-r--r--libmenu/menu.h4
-rw-r--r--libmenu/menu_console.c11
-rw-r--r--libmenu/menu_filesel.c8
-rw-r--r--libmenu/menu_pt.c6
-rw-r--r--libmenu/vf_menu.c4
8 files changed, 23 insertions, 22 deletions
diff --git a/input/input.c b/input/input.c
index fc3d45cd9e..8e2d30a4dc 100644
--- a/input/input.c
+++ b/input/input.c
@@ -537,7 +537,7 @@ static mp_cmd_bind_t* cmd_binds_default = NULL;
static mp_cmd_filter_t* cmd_filters = NULL;
// Callback to allow the menu filter to grab the incoming keys
-void (*mp_input_key_cb)(int code) = NULL;
+int (*mp_input_key_cb)(int code) = NULL;
static mp_input_fd_t key_fds[MP_MAX_KEY_FD];
static unsigned int num_key_fd = 0;
@@ -1070,7 +1070,7 @@ interpret_key(int code, int paused)
if (code & MP_KEY_DOWN)
return NULL;
code &= ~(MP_KEY_DOWN|MP_NO_REPEAT_KEY);
- mp_input_key_cb(code);
+ if (mp_input_key_cb(code))
return NULL;
}
diff --git a/input/input.h b/input/input.h
index 780a5d1d88..f07d9142ea 100644
--- a/input/input.h
+++ b/input/input.h
@@ -207,7 +207,7 @@ typedef int (*mp_cmd_func_t)(int fd,char* dest,int size);
typedef void (*mp_close_func_t)(int fd);
// Set this to grab all incoming key codes
-extern void (*mp_input_key_cb)(int code);
+extern int (*mp_input_key_cb)(int code);
// Should return 1 if the command was processed
typedef int (*mp_input_cmd_filter)(mp_cmd_t* cmd, int paused, void* ctx);
diff --git a/libmenu/menu.c b/libmenu/menu.c
index 879e977510..dd9d6d8ec9 100644
--- a/libmenu/menu.c
+++ b/libmenu/menu.c
@@ -347,11 +347,11 @@ void menu_close(menu_t* menu) {
free(menu);
}
-void menu_read_key(menu_t* menu,int cmd) {
+int menu_read_key(menu_t* menu,int cmd) {
if(menu->read_key)
- menu->read_key(menu,cmd);
+ return menu->read_key(menu,cmd);
else
- menu_dflt_read_key(menu,cmd);
+ return menu_dflt_read_key(menu,cmd);
}
///////////////////////////// Helpers ////////////////////////////////////
diff --git a/libmenu/menu.h b/libmenu/menu.h
index d05749f440..7d4defaacf 100644
--- a/libmenu/menu.h
+++ b/libmenu/menu.h
@@ -10,7 +10,7 @@ struct menu_s {
struct MPContext *ctx;
void (*draw)(menu_t* menu,mp_image_t* mpi);
void (*read_cmd)(menu_t* menu,int cmd);
- void (*read_key)(menu_t* menu,int cmd);
+ int (*read_key)(menu_t* menu,int cmd);
void (*close)(menu_t* menu);
struct m_struct_st* priv_st;
struct menu_priv_s* priv;
@@ -56,7 +56,7 @@ menu_t* menu_open(char *name);
void menu_draw(menu_t* menu,mp_image_t* mpi);
void menu_read_cmd(menu_t* menu,int cmd);
void menu_close(menu_t* menu);
-void menu_read_key(menu_t* menu,int cmd);
+int menu_read_key(menu_t* menu,int cmd);
//// Default implementation
int menu_dflt_read_key(menu_t* menu,int cmd);
diff --git a/libmenu/menu_console.c b/libmenu/menu_console.c
index d54611e241..abc941cdca 100644
--- a/libmenu/menu_console.c
+++ b/libmenu/menu_console.c
@@ -419,20 +419,20 @@ static void read_cmd(menu_t* menu,int cmd) {
}
}
-static void read_key(menu_t* menu,int c) {
+static int read_key(menu_t* menu,int c) {
if(mpriv->child && mpriv->raw_child) {
write(mpriv->child_fd[0],&c,sizeof(int));
- return;
+ return 1;
}
if (c == KEY_DELETE || c == KEY_BS) {
unsigned int i = strlen(mpriv->cur_history->buffer);
if(i > 0)
mpriv->cur_history->buffer[i-1] = '\0';
- return;
+ return 1;
}
if (menu_dflt_read_key(menu, c))
- return;
+ return 1;
if(isascii(c)) {
int l = strlen(mpriv->cur_history->buffer);
@@ -442,8 +442,9 @@ static void read_key(menu_t* menu,int c) {
}
mpriv->cur_history->buffer[l] = (char)c;
mpriv->cur_history->buffer[l+1] = '\0';
+ return 1;
}
- return;
+ return 0;
}
diff --git a/libmenu/menu_filesel.c b/libmenu/menu_filesel.c
index 906ff436fd..93cfa6c806 100644
--- a/libmenu/menu_filesel.c
+++ b/libmenu/menu_filesel.c
@@ -377,17 +377,17 @@ static void read_cmd(menu_t* menu,int cmd) {
}
}
-static void read_key(menu_t* menu,int c){
+static int read_key(menu_t* menu,int c){
char **str;
for (str=mpriv->actions; str && *str; str++)
if (c == (*str)[0]) {
action = &(*str)[2];
read_cmd(menu,MENU_CMD_ACTION);
- return;
+ return 1;
}
if (menu_dflt_read_key(menu, c))
- return;
- menu_list_jump_to_key(menu, c);
+ return 1;
+ return menu_list_jump_to_key(menu, c);
}
static void clos(menu_t* menu) {
diff --git a/libmenu/menu_pt.c b/libmenu/menu_pt.c
index 8c92181d18..27ce5ae0e3 100644
--- a/libmenu/menu_pt.c
+++ b/libmenu/menu_pt.c
@@ -95,10 +95,10 @@ static void read_cmd(menu_t* menu,int cmd) {
}
}
-static void read_key(menu_t* menu,int c){
+static int read_key(menu_t* menu,int c){
if (menu_dflt_read_key(menu, c))
- return;
- menu_list_jump_to_key(menu, c);
+ return 1;
+ return menu_list_jump_to_key(menu, c);
}
static void close_menu(menu_t* menu) {
diff --git a/libmenu/vf_menu.c b/libmenu/vf_menu.c
index d5c83609cb..bf11507d89 100644
--- a/libmenu/vf_menu.c
+++ b/libmenu/vf_menu.c
@@ -120,8 +120,8 @@ static void get_image(struct vf_instance_s* vf, mp_image_t *mpi){
}
}
-static void key_cb(int code) {
- menu_read_key(st_priv->current,code);
+static int key_cb(int code) {
+ return menu_read_key(st_priv->current,code);
}
static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){