[MPlayer-cvslog] CVS: main/input input.c, 1.130, 1.131 input.h, 1.59, 1.60

Alban Bedel CVS syncmail at mplayerhq.hu
Sat Mar 18 19:13:25 CET 2006


CVS change done by Alban Bedel CVS

Update of /cvsroot/mplayer/main/input
In directory mail:/var2/tmp/cvs-serv14782/input

Modified Files:
	input.c input.h 
Log Message:
Enable gui key bindings only when running the gui. Fix enter and esc
not working with a GUI enabled build running w/o GUI.


Index: input.c
===================================================================
RCS file: /cvsroot/mplayer/main/input/input.c,v
retrieving revision 1.130
retrieving revision 1.131
diff -u -r1.130 -r1.131
--- input.c	12 Mar 2006 21:47:15 -0000	1.130
+++ input.c	18 Mar 2006 18:13:22 -0000	1.131
@@ -311,19 +311,15 @@
   { { KEY_BACKSPACE, 0 }, "speed_set 1.0" },
   { { 'q', 0 }, "quit" },
   { { 'Q', 0 }, "quit" },
-#ifndef HAVE_NEW_GUI
   { { KEY_ESC, 0 }, "quit" },
   { { 'p', 0 }, "pause" },
   { { 'P', 0 }, "pause" },
-#endif
   { { ' ', 0 }, "pause" },
   { { '.', 0 }, "frame_step" },
   { { KEY_HOME, 0 }, "pt_up_step 1" },
   { { KEY_END, 0 }, "pt_up_step -1" },
   { { '>', 0 }, "pt_step 1" },
-#ifndef HAVE_NEW_GUI
   { { KEY_ENTER, 0 }, "pt_step 1 1" },
-#endif
   { { '<', 0 }, "pt_step -1" },
   { { KEY_INS, 0 }, "alt_src_step 1" },
   { { KEY_DEL, 0 }, "alt_src_step -1" },
@@ -365,15 +361,6 @@
   { { 'n', 0 }, "tv_step_norm" },
   { { 'u', 0 }, "tv_step_chanlist" },
 #endif
-#ifdef HAVE_NEW_GUI
-  { { 'l', 0 }, "gui_loadfile" },
-  { { 't', 0 }, "gui_loadsubtitle" },
-  { { KEY_ENTER, 0 }, "gui_play" },
-  { { KEY_ESC, 0 }, "gui_stop" },
-  { { 'p', 0 }, "gui_playlist" },
-  { { 'r', 0 }, "gui_preferences" },
-  { { 'c', 0 }, "gui_skinbrowser" },
-#endif
 #ifdef HAVE_JOYSTICK
   { { JOY_AXIS0_PLUS, 0 }, "seek 10" },
   { { JOY_AXIS0_MINUS, 0 }, "seek -10" },
@@ -409,6 +396,22 @@
   { { 0 }, NULL }
 };
 
+
+#ifdef HAVE_NEW_GUI
+static mp_cmd_bind_t gui_def_cmd_binds[] = {
+
+  { { 'l', 0 }, "gui_loadfile" },
+  { { 't', 0 }, "gui_loadsubtitle" },
+  { { KEY_ENTER, 0 }, "gui_play" },
+  { { KEY_ESC, 0 }, "gui_stop" },
+  { { 'p', 0 }, "gui_playlist" },
+  { { 'r', 0 }, "gui_preferences" },
+  { { 'c', 0 }, "gui_skinbrowser" },
+
+  { { 0 }, NULL }
+};
+#endif
+
 #ifndef MP_MAX_KEY_FD
 #define MP_MAX_KEY_FD 10
 #endif
@@ -1378,6 +1381,12 @@
   memcpy(bind->input,keys,(MP_MAX_KEY_DOWN+1)*sizeof(int));
 }
 
+void
+mp_input_add_binds(mp_cmd_bind_t* list) {
+  int i;
+  for(i = 0 ; list[i].cmd ; i++)
+    mp_input_bind_keys(list[i].input,list[i].cmd);
+}
 
 static void
 mp_input_free_binds(mp_cmd_bind_t* binds) {
@@ -1552,9 +1561,14 @@
 extern char *get_path(char *filename);
 
 void
-mp_input_init(void) {
+mp_input_init(int use_gui) {
   char* file;
 
+#ifdef HAVE_NEW_GUI  
+  if(use_gui)
+    mp_input_add_binds(gui_def_cmd_binds);
+#endif
+  
   file = config_file[0] != '/' ? get_path(config_file) : config_file;
   if(!file)
     return;

Index: input.h
===================================================================
RCS file: /cvsroot/mplayer/main/input/input.h,v
retrieving revision 1.59
retrieving revision 1.60
diff -u -r1.59 -r1.60
--- input.h	10 Nov 2005 22:25:54 -0000	1.59
+++ input.h	18 Mar 2006 18:13:22 -0000	1.60
@@ -230,7 +230,7 @@
 
 // When you create a new driver you should add it in these 2 functions.
 void
-mp_input_init(void);
+mp_input_init(int use_gui);
 
 void
 mp_input_uninit(void);




More information about the MPlayer-cvslog mailing list