changeset 758:402b0e288433

Enable "meta" key
author Mikael Berthe <mikael@lilotux.net>
date Fri, 17 Mar 2006 17:12:04 +0100
parents ae23c8826efb
children a681dc477c7f
files mcabber/src/screen.c
diffstat 1 files changed, 26 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/mcabber/src/screen.c	Tue Mar 14 12:43:23 2006 +0100
+++ b/mcabber/src/screen.c	Fri Mar 17 17:12:04 2006 +0100
@@ -1824,16 +1824,38 @@
 
 int scr_Getch(void)
 {
-  int ch;
-  ch = wgetch(inputWnd);
-  return ch;
+  return wgetch(inputWnd);
 }
 
 //  process_key(key)
 // Handle the pressed key, in the command line (bottom).
 int process_key(int key)
 {
-  switch(key) {
+  if (key == 27) {
+    key = scr_Getch();
+    if (key == -1 || key == 27) {
+      // This is a "real" escape...
+      scr_CheckAutoAway(TRUE);
+      currentWindow = NULL;
+      chatmode = FALSE;
+      if (current_buddy)
+        buddy_setflags(BUDDATA(current_buddy), ROSTER_FLAG_LOCK, FALSE);
+      scr_RosterVisibility(1);
+      scr_UpdateChatStatus(FALSE);
+      top_panel(chatPanel);
+      top_panel(inputPanel);
+      update_panels();
+    } else { // Meta
+      switch (key) {
+        default:
+            scr_LogPrint(LPRINT_NORMAL, "Unknown key=M%d", key);
+      }
+    }
+    key = -1;
+  }
+  switch (key) {
+    case -1:
+        break;
     case 8:     // Ctrl-h
     case 127:   // Backspace too
     case KEY_BACKSPACE:
@@ -1952,18 +1974,6 @@
     case 23:    // Ctrl-w
         readline_backward_kill_word();
         break;
-    case 27:    // ESC
-        scr_CheckAutoAway(TRUE);
-        currentWindow = NULL;
-        chatmode = FALSE;
-        if (current_buddy)
-          buddy_setflags(BUDDATA(current_buddy), ROSTER_FLAG_LOCK, FALSE);
-        scr_RosterVisibility(1);
-        scr_UpdateChatStatus(FALSE);
-        top_panel(chatPanel);
-        top_panel(inputPanel);
-        update_panels();
-        break;
     case 12:    // Ctrl-l
         scr_CheckAutoAway(TRUE);
         scr_Resize();