more keyboard/keysym changes

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@972 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Lars Gullik Bjønnes 2000-08-15 09:41:24 +00:00
parent 2b81c65b78
commit a69e7a4578
7 changed files with 45 additions and 21 deletions

View File

@ -1,3 +1,10 @@
2000-08-15 Lars Gullik Bjønnes <larsbj@lyx.org>
* src/WorkArea.C (work_area_handler): more work to get te
FL_KEYBOARD to work with xforms 0.88 too, please test.
* src/BufferView_pimpl.C (workAreaKeyPress): add XForms 0.88 guard.
2000-08-15 Dekel Tsur <dekel@math.tau.ac.il>
* src/frontends/ButtonPolicies.C: make gcc happy when compiling with

View File

@ -516,7 +516,9 @@ int BufferView::Pimpl::scrollDown(long time)
void BufferView::Pimpl::workAreaKeyPress(KeySym keysym, unsigned int state)
{
#if FL_REVISION > 88
bv_->owner()->getLyXFunc()->processKeySym(keysym, state);
#endif
}

View File

@ -211,7 +211,8 @@ int LyXView::atCloseMainFormCB(FL_FORM *, void *)
// Wrapper for the above
extern "C" int C_LyXView_atCloseMainFormCB(FL_FORM * form, void * p)
extern "C"
int C_LyXView_atCloseMainFormCB(FL_FORM * form, void * p)
{
return LyXView::atCloseMainFormCB(form, p);
}
@ -319,7 +320,7 @@ void LyXView::create_form_form_main(int width, int height)
}
#if FL_REVISION < 89
#if 0
extern "C"
int C_LyXView_KeyPressMask_raw_callback(FL_FORM * fl, void * xev);
#endif
@ -341,7 +342,7 @@ void LyXView::init()
autosave_timeout.start();
}
#if FL_REVISION < 89
#if 0
// Install the raw callback for keyboard events
fl_register_raw_callback(form_,
KeyPressMask,
@ -400,7 +401,7 @@ void LyXView::UpdateDocumentClassChoice()
}
#if FL_REVISION < 89
#if 0
// This is necessary, since FL_FREE-Objects doesn't get all keypress events
// as FL_KEYBOARD events :-( Matthias 280596
int LyXView::KeyPressMask_raw_callback(FL_FORM * fl, void * xev)

View File

@ -21,6 +21,7 @@
#include "BufferView.h"
#include "LyXView.h"
#include "lyxfunc.h"
#include "lyxlookup.h"
using std::endl;
@ -319,15 +320,17 @@ int WorkArea::work_area_handler(FL_OBJECT * ob, int event,
case FL_KEYBOARD:
{
lyxerr[Debug::KEY] << "Workarea event: KEYBOARD";
if (static_cast<XEvent*>(ev)->type == KeyPress)
lyxerr << "KeyPress" << endl;
else
lyxerr << "KeyRelease" << endl;
KeySym keysym = 0;
char s_r[10];
char dummy[1];
XKeyEvent * xke = reinterpret_cast<XKeyEvent *>(ev);
XLookupString(xke, s_r, 10, &keysym, 0);
#if FL_REVISION < 89
// XForms < 0.89 does not have compose support
// so we are using our own compose support
LyXLookupString(ev, dummy, 1, &keysym);
#else
XLookupString(xke, dummy, 1, &keysym, 0);
#endif
if (lyxerr.debugging(Debug::KEY)) {
char const * tmp = XKeysymToString(key);
char const * tmp2 = XKeysymToString(keysym);
@ -340,20 +343,35 @@ int WorkArea::work_area_handler(FL_OBJECT * ob, int event,
<< keysym << "]" << endl;
}
#if FL_REVISION < 89
if (keysym == NoSymbol) {
lyxerr[Debug::KEY]
<< "Empty kdb action (probably composing)"
<< endl;
break;
}
KeySym ret_key = keysym;
#else
if (!key) break;
KeySym ret_key = (keysym ? keysym : key);
#endif
unsigned int ret_state = xke->state;
static Time last_time_pressed = 0;
static unsigned int last_key_pressed = 0;
static unsigned int last_state_pressed = 0;
if (xke->time - last_time_pressed < 50 // should perhaps be tunable
//lyxerr << "Workarea Diff: " << xke->time - last_time_pressed
// << endl;
if (xke->time - last_time_pressed < 40 // should perhaps be tunable
&& xke->state == last_state_pressed
&& xke->keycode == last_key_pressed) {
lyxerr[Debug::KEY]
<< "Workarea: Purging X events." << endl;
XSync(fl_get_display(), 1);
//lyxerr << "Workarea Events: "
// << XEventsQueued(fl_get_display(), QueuedAlready)
// << endl;
if (XEventsQueued(fl_get_display(), QueuedAlready) > 0)
XSync(fl_get_display(), 1);
// This purge make f.ex. scrolling stop immidiatly when
// releasing the PageDown button. The question is if
// this purging of XEvents can cause any harm...

View File

@ -316,7 +316,7 @@ int LyXFunc::processKeySym(KeySym keysym, unsigned int state)
}
#if FL_REVISION < 89
#if 0
int LyXFunc::processKeyEvent(XEvent * ev)
{
char s_r[10];

View File

@ -49,13 +49,13 @@ public:
/// Same again but for xtl buffers. Still looking for better idea.
bool Dispatch(int action, auto_mem_buffer &);
#if FL_REVISION < 89
#if 0
/// A keyboard event is processed to execute a lyx action.
int processKeyEvent(XEvent * ev);
#else
#else
///
int processKeySym(KeySym k, unsigned int state);
#endif
#endif
///
func_status getStatus(int ac) const;

View File

@ -13,10 +13,6 @@
different input methods for different frames, but for now we can
keep it as it is. */
#ifdef __GNUG__
#pragma interface
#endif
#include <X11/Xlib.h>
/// Initialize the compose key handling