Alfredo Braunstein wrote:
> Angus Leeming wrote:
>
>>> 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?
>
> I think so. (It seems the only reasonable way to implement the
> desired behaviour)
>
> Alfredo
JOOOOOOOOOOHHHHHHHHNNNNNNNNNNNNNN!
Anybody out there?
John, you know the Qt stuff better than anyone else. Does my proposal
seem reasonable to you? To recap:
xforms generates 'pseudo' XEvents in its main interation loop. See
below for a refresher ;-)
That is great when we are selecting regions of text. (Mouse button
depressed, mouse below window: just keep on scrolling.)
Qt doesn't do this. One real event, one signal emitted. What I am
proposing is to start a timer in QContentPane::mousePressEvent and
thereafter call QContentPane::mouseMoveEvent each time the timer
finishes until QContentPane::mouseReleaseEvent is called. (Maybe
create a new member function mouseStillDepressed (mouseNeedsValium?
Ok, bad joke) to receive the timer signal.
It seems like a clean solution to me. Moreover, we could use
timer.running() as a flag to discard QMouseEvents if we receive too
many of them in mouseMoveEvent(QMouseEvent * e) in too short a space
of time. Current behaviour with selection is well-nigh uncontrollable.
Seems doublely clean to me, but I'd value your thoughts.
Angus
static XEvent st_xev;
static void
do_interaction_step(int wait_io)
{
FL_FORM *evform = 0;
int has_event = get_next_event(wait_io, &evform, &st_xev);
if (!has_event)
{
/* we are idling */
st_xev.type = TIMER3;
/* lots of other gubbins to generate a fake XEvent */
...
}
switch (st_xev.type) {
case TIMER3:
if (button_down(fl_keymask) || fl_pushobj || !lasttimer) {
fl_handle_form(mouseform, FL_MOUSE,
xmask2key(fl_keymask), &st_xev);
lasttimer = 1;
}
return;
case MappingNotify:
XRefreshKeyboardMapping((XMappingEvent *) & st_xev);
return;
case FocusIn:
...
etc
}