]> git.lyx.org Git - lyx.git/blobdiff - src/combox.C
small changes to ButtonController usage
[lyx.git] / src / combox.C
index 50241832e5e32e6dea9643f5b28bf9bc25bd66cc..400e3da44d6051e719d3e2cc95e65515358185d9 100644 (file)
@@ -4,7 +4,7 @@
  *          encapsulated to get a combobox-like object. All XForms 
  *          functions are hidden.         
  * 
- *  GNU Copyleft (C) 1996 Alejandro Aguilar Sierra <asierra@servidor.unam.mx>
+ *  GNU Copyleft 1996 Alejandro Aguilar Sierra <asierra@servidor.unam.mx>
  *                        and the LyX Team.
  * 
  *  Dependencies:  Only XForms, but created to be used with LyX.
@@ -40,6 +40,8 @@
 
 #include "debug.h"
 
+using std::endl;
+
 // These are C wrappers around static members of Combox, used as
 // callbacks for xforms.
 extern "C" void C_Combox_input_cb(FL_OBJECT *ob, long);
@@ -368,26 +370,20 @@ int Combox::peek_event(FL_FORM * form, void * xev)
        FL_OBJECT * ob = static_cast<FL_OBJECT *>(form->u_vdata);
        Combox * combo = static_cast<Combox*>(ob->u_vdata);
        
-#if FL_REVISION < 86
-       if(((XEvent *)xev)->type == ButtonPress && !ob->belowmouse)
-#endif
-#if FL_REVISION > 85
-// I don't know why belowmouse does not work, but it doesn't. (Asger)
-               // Are we sure?
-               if (static_cast<XEvent *>(xev)->type == ButtonPress && (
-                       static_cast<XEvent *>(xev)->xbutton.x - ob->x < 0 ||
-                       static_cast<XEvent *>(xev)->xbutton.x - ob->x > ob->w ||
-                       static_cast<XEvent *>(xev)->xbutton.y - ob->y < 0 ||
-                       static_cast<XEvent *>(xev)->xbutton.y - ob->y > ob->h))
-#endif
-       {
+       // I don't know why belowmouse does not work, but it doesn't. (Asger)
+       // Are we sure? Please verify. (Lgb)
+       if (static_cast<XEvent *>(xev)->type == ButtonPress && (
+               static_cast<XEvent *>(xev)->xbutton.x - ob->x < 0 ||
+               static_cast<XEvent *>(xev)->xbutton.x - ob->x > ob->w ||
+               static_cast<XEvent *>(xev)->xbutton.y - ob->y < 0 ||
+               static_cast<XEvent *>(xev)->xbutton.y - ob->y > ob->h)) {
                combo->Hide(1); 
                return 1;
        }
                
        if (static_cast<XEvent*>(xev)->type != KeyPress) return 0;
        
-       char s_r[10];
+       char s_r[10]; s_r[9] = '\0';
        static int num_bytes;
        KeySym keysym_return;
        num_bytes = XLookupString(&static_cast<XEvent*>(xev)->xkey, s_r, 10,