Angus Leeming wrote: > On Thursday 30 October 2003 2:00 pm, Ronald Florence wrote: >> Angus Leeming <[EMAIL PROTECTED]> writes: >> > The fix is trivial (for Qt too) and requires that >> > LyX responds only to a subset of mouse events from the underlying >> > X11, MacOS or Win32 graphics libraries. In the xforms frontend we >> > use a timer, so: >> > // The timer runs for 200ms >> > static Timer timer(200); >> > if (timer.running()) >> > return; >> > timer.start(); >> > dispatch(mouse_event_to_the_lyx_core); >> > >> > This could go in, almost as is, to the mouseEventHandler in >> > QContentPane.C. Feel free to try ;-) >> >> Is this fix going into LyX-1.3.4? > > In order for any fix to go in, I'd need to know the Qt equivalent of > XEvent::xmotion.[x,y].
Well, I had a go. See below. Unfortunately, it doesn't work as I'd like. Qt emits a mouseMoveEvent signal only when --- you've guessed it --- the mouse is moved. No signal is emitted when the mouse is just pressed but otherwise doing nothing. This differs from xforms that emits event calls when this happens (using a timer to artificially generate events). So, shold we do what xforms does and start a timer on a mouse press event so that we can generate 'pseudo' mouse events every 'interval' msecs? Angus void QContentPane::mouseMoveEvent(QMouseEvent * e) { // Check if the mouse is above or below the workarea if (e->y() <= y() || e->y() >= y() + height()) { // The mouse button is depressed and we are outside the // workarea. That means we are simultaneously selecting // text and scrolling the view. // Use a Timeout to react to a drag events only every // 200ms. All intervening events are discarded, // allowing the user to control position easily. static int const discard_interval = 200; static Timeout timeout(discard_interval); if (timeout.running()) return; // The timeout is not running, so process the // event, first starting the timeout to discard future // events. timeout.start(); } FuncRequest cmd(LFUN_MOUSE_MOTION, e->x(), e->y(), q_motion_state(e->state())); wa_->dispatch(cmd); }