[MPlayer-cvslog] r25530 - in trunk: input/input.c input/input.h libmenu/menu.c libmenu/menu.h libmenu/menu_console.c libmenu/menu_filesel.c libmenu/menu_pt.c libmenu/vf_menu.c

ulion subversion at mplayerhq.hu
Wed Dec 26 14:13:48 CET 2007


Author: ulion
Date: Wed Dec 26 14:13:48 2007
New Revision: 25530

Log:
libmenu does not steal all input keys from input modules.


Modified:
   trunk/input/input.c
   trunk/input/input.h
   trunk/libmenu/menu.c
   trunk/libmenu/menu.h
   trunk/libmenu/menu_console.c
   trunk/libmenu/menu_filesel.c
   trunk/libmenu/menu_pt.c
   trunk/libmenu/vf_menu.c

Modified: trunk/input/input.c
==============================================================================
--- trunk/input/input.c	(original)
+++ trunk/input/input.c	Wed Dec 26 14:13:48 2007
@@ -537,7 +537,7 @@ static mp_cmd_bind_t* cmd_binds_default 
 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;
   }
 

Modified: trunk/input/input.h
==============================================================================
--- trunk/input/input.h	(original)
+++ trunk/input/input.h	Wed Dec 26 14:13:48 2007
@@ -207,7 +207,7 @@ typedef int (*mp_cmd_func_t)(int fd,char
 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);
 

Modified: trunk/libmenu/menu.c
==============================================================================
--- trunk/libmenu/menu.c	(original)
+++ trunk/libmenu/menu.c	Wed Dec 26 14:13:48 2007
@@ -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 ////////////////////////////////////

Modified: trunk/libmenu/menu.h
==============================================================================
--- trunk/libmenu/menu.h	(original)
+++ trunk/libmenu/menu.h	Wed Dec 26 14:13:48 2007
@@ -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);

Modified: trunk/libmenu/menu_console.c
==============================================================================
--- trunk/libmenu/menu_console.c	(original)
+++ trunk/libmenu/menu_console.c	Wed Dec 26 14:13:48 2007
@@ -419,20 +419,20 @@ static void read_cmd(menu_t* menu,int cm
   }
 }
 
-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;
 }
 
 

Modified: trunk/libmenu/menu_filesel.c
==============================================================================
--- trunk/libmenu/menu_filesel.c	(original)
+++ trunk/libmenu/menu_filesel.c	Wed Dec 26 14:13:48 2007
@@ -377,17 +377,17 @@ static void read_cmd(menu_t* menu,int cm
   }
 }
 
-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) {

Modified: trunk/libmenu/menu_pt.c
==============================================================================
--- trunk/libmenu/menu_pt.c	(original)
+++ trunk/libmenu/menu_pt.c	Wed Dec 26 14:13:48 2007
@@ -95,10 +95,10 @@ static void read_cmd(menu_t* menu,int cm
   }
 }
 
-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) {

Modified: trunk/libmenu/vf_menu.c
==============================================================================
--- trunk/libmenu/vf_menu.c	(original)
+++ trunk/libmenu/vf_menu.c	Wed Dec 26 14:13:48 2007
@@ -120,8 +120,8 @@ static void get_image(struct vf_instance
   }
 }
   
-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){



More information about the MPlayer-cvslog mailing list