]> git.lyx.org Git - lyx.git/blobdiff - src/lyxlookup.C
More fixes to insettabular/text (and some missing features added).
[lyx.git] / src / lyxlookup.C
index 2a9c0778a1933b8c3a4572e131c38ff24896422d..16007c65522ce87cd8da2a757916408ec42ffc58 100644 (file)
@@ -8,12 +8,15 @@
  *
  * ====================================================== */
 
+#ifdef __GNUG__
+#pragma implementation
+#endif
+
 #include <config.h>
 
 #ifdef HAVE_XOPENIM
 // This part is the full blown Input Method manager for X11R5 and up.
 // For the plain-and-old-X11R4 version, see later.
-
 #include <X11/Xlib.h>
 #include <X11/Xutil.h>
 #include <X11/keysym.h>
@@ -22,6 +25,7 @@
 #endif
 #include <clocale>
 
+#include "lyxlookup.h"
 #include "debug.h"
 #include "lyxrc.h"
 
@@ -35,7 +39,11 @@ XComposeStatus compose_status= {0, 0};
 void InitLyXLookup(Display * display, Window window) 
 {
        xic = 0;
-       
+
+       lyxerr[Debug::KEY]
+                       << "InitLyXLookup: creating an input context."
+                       << endl;
+
        // This part could be done before opening display
        setlocale(LC_CTYPE, "");
                if (!XSupportsLocale()) {
@@ -159,11 +167,13 @@ int LyXLookupString(XEvent * event,
                                << "LyXLookupString: found DeadEvent" << endl;
                        return 0;
                }
+#if 1
                if (XFilterEvent (event, None)) {
-                       //lyxerr <<"XFilterEvent");
+                       lyxerr[Debug::KEY] <<"XFilterEvent" << endl;
                        *keysym_return = NoSymbol;
                         return 0;
                }
+#endif
                if (event->type != KeyPress)
                        lyxerr << "LyXLookupString: wrong event type" 
                               <<  event->type << endl;
@@ -172,23 +182,35 @@ int LyXLookupString(XEvent * event,
                result =  XmbLookupString(xic, &event->xkey, buffer_return,
                                       bytes_buffer, keysym_return,
                                       &status_return);
-               switch(status_return) {
+               switch (status_return) {
+               case XBufferOverflow:
+                       lyxerr[Debug::KEY] << "XBufferOverflow" << endl;
+                       break;
                case XLookupBoth:
-                       //lyxerr <<"XLookupBoth");
+                       lyxerr[Debug::KEY] << "XLookupBoth "
+                                          << string(buffer_return, result)
+                                          << endl;
                        break;
                case XLookupChars:
-                       //lyxerr <<"XLookupChars");
+                       lyxerr[Debug::KEY] << "XLookupChars "
+                                          << string(buffer_return, result)
+                                          << endl;
+                       
                        *keysym_return = NoSymbol;
                        break;
                case XLookupKeySym:
-                       //lyxerr <<"XLookupKeySym");
+                       lyxerr[Debug::KEY] << "XLookupKeySym" << endl;
                        result = 0;
                        break;
-               default:
-                       //lyxerr <<"default");
+               case XLookupNone:
+                       lyxerr[Debug::KEY] << "XLookupNone" << endl;
                        *keysym_return = NoSymbol;
                        result = 0;
                        break;
+               default:
+                       lyxerr << "Unknown status_return from"
+                               " XmbLookupString" << endl;
+                       break;
                }
        } else {
                result = XLookupString(&event->xkey, buffer_return,
@@ -198,6 +220,7 @@ int LyXLookupString(XEvent * event,
        return result;
 }
 
+
 // This is called after the main window has been destroyed
 void CloseLyXLookup() 
 {
@@ -242,3 +265,4 @@ void CloseLyXLookup()
 }
 
 #endif // HAVE_XOPENIM
+