issue-#105 background task processing while mouse tracking
- Josef Templ
- Posts: 2047
- Joined: Tue Sep 17, 2013 6:50 am
issue-#105 background task processing while mouse tracking
This issue (http://redmine.blackboxframework.org/issues/105) is about improving
the responsiveness of BlackBox when used as a server.
It is proposed that background tasks are called even while tracking the mouse.
Technically, this is simple because all mouse tracking loops eventually call HostPorts.Rider.Input
where the background tasks can be activated.
here are the changes: http://redmine.blackboxframework.org/pr ... 115335d51f.
HOWEVER, this issue seems to have a long history.
There is a change line entry in HostPorts (BB1.6!) right at the beginning of the changes list:
- 20060325, mc, Rider.Input changed for the benefit of background task response.
(mc is Marco Ciot, I guess.)
This line says that the change has been done in 2006.
Since it is not in BB 1.6 it must have been removed later.
The import list still contains 'Services' which also indicates that background task execution
has been available once but removed later.
Why has it been removed?
There is another related change comment line in CPC 1.7 HostPorts. This line
is about the reinvention of this feature.
- 20080524, Alexander Iljin, Rider.Input updated to allow Services.Actions call it.
@Helmut: do you know any details about this issue and its history?
Does anybody know mc? Can we contact him?
When I saw this issue the first time I thought, wow, this is a dangerous feature.
A background task could in some way have side effects that interacts with the mouse tracking loop.
However, in practice it seems to work well. There may be exceptions, though, and may be these were the
reason for removing this feature again.
- Josef
the responsiveness of BlackBox when used as a server.
It is proposed that background tasks are called even while tracking the mouse.
Technically, this is simple because all mouse tracking loops eventually call HostPorts.Rider.Input
where the background tasks can be activated.
here are the changes: http://redmine.blackboxframework.org/pr ... 115335d51f.
HOWEVER, this issue seems to have a long history.
There is a change line entry in HostPorts (BB1.6!) right at the beginning of the changes list:
- 20060325, mc, Rider.Input changed for the benefit of background task response.
(mc is Marco Ciot, I guess.)
This line says that the change has been done in 2006.
Since it is not in BB 1.6 it must have been removed later.
The import list still contains 'Services' which also indicates that background task execution
has been available once but removed later.
Why has it been removed?
There is another related change comment line in CPC 1.7 HostPorts. This line
is about the reinvention of this feature.
- 20080524, Alexander Iljin, Rider.Input updated to allow Services.Actions call it.
@Helmut: do you know any details about this issue and its history?
Does anybody know mc? Can we contact him?
When I saw this issue the first time I thought, wow, this is a dangerous feature.
A background task could in some way have side effects that interacts with the mouse tracking loop.
However, in practice it seems to work well. There may be exceptions, though, and may be these were the
reason for removing this feature again.
- Josef
-
- Posts: 1700
- Joined: Tue Sep 17, 2013 12:21 am
- Location: Russia
Re: issue-#105 background task processing while mouse tracki
I found that this code not solving the problem with ObxCube... If you open the ObxCube and then try to drag and drop some text anyway the cube will freeze.
Re: issue-#105 background task processing while mouse tracki
HostWindows.Idle
Code: Select all
...
Services.actionHook.Step;
Windows.dir.Update(NIL);(*20080122*)
END Idle;
- Josef Templ
- Posts: 2047
- Joined: Tue Sep 17, 2013 6:50 am
Re: issue-#105 background task processing while mouse tracki
The action is called but the Restore is delayed.Ivan Denisov wrote:I found that this code not solving the problem with ObxCube... If you open the ObxCube and then try to drag and drop some text anyway the cube will freeze.
- Josef
-
- Posts: 1700
- Joined: Tue Sep 17, 2013 12:21 am
- Location: Russia
Re: issue-#105 background task processing while mouse tracki
So the problem is not with Input procedure.
I found the analogy with regular and realtime linux kernels. The realtime kernel gives priority to input handling. The regular kernel is balanced to handle idle tasks. Now the Input is demonstrating realtime kernel behavior. However the software engineer can easily balance it. I will demonstrate this bellow.
Usually Input is used in the case of:
If the developer want to handle idle tasks.
Or there is can be balancing using probabilistic model.
So I think is good to keep this freedom. However we need to concentrate attention on the places where the framework is not optimized. Like in the example with text drag and drop.
I found the analogy with regular and realtime linux kernels. The realtime kernel gives priority to input handling. The regular kernel is balanced to handle idle tasks. Now the Input is demonstrating realtime kernel behavior. However the software engineer can easily balance it. I will demonstrate this bellow.
Usually Input is used in the case of:
Code: Select all
REPEAT
f.Input(x, y, modifiers, isDown)
...
UNTIL ~ isDown;
Code: Select all
REPEAT
f.Input(x,y,modifiers, isDown)
...
Services.actionHook.Step;
UNTIL ~ isDown;
Code: Select all
REPEAT
f.Input(x,y,modifiers, isDown)
...
IF ObxRandom.Uniform() > 0.8 THEN
Services.actionHook.Step;
END
UNTIL ~ isDown;
-
- Posts: 1700
- Joined: Tue Sep 17, 2013 12:21 am
- Location: Russia
Re: issue-#105 background task processing while mouse tracki
Thanks Luowy! The only question is that this procedure is called Idle... maybe it should be idled ?luowy wrote:HostWindows.IdleCode: Select all
... Services.actionHook.Step; Windows.dir.Update(NIL);(*20080122*) END Idle;
Re: issue-#105 background task processing while mouse tracki
I not noticed it,maybe. it copyed from my own version,which some name were changed slightly.Ivan Denisov wrote:.. maybe it should be idled ?
about HostPorts.Input:
the Sleep(1) procedure should move to the end of the Inupt instead of the beginning.to avoid the delay of responding. can be understand when you moving a selected control on a form window.
Code: Select all
...
WinApi.Sleep(1);
END Input;
-
- Posts: 1700
- Joined: Tue Sep 17, 2013 12:21 am
- Location: Russia
Re: issue-#105 background task processing while mouse tracki
I mean that it's name is talking about the expected realization...luowy wrote:I not noticed it,maybe. it copyed from my own version,which some name were changed slightly.Ivan Denisov wrote:.. maybe it should be idled ?
to idle — "(of an engine) run slowly while disconnected from a load or out of gear"
so I think that maybe Idle realization does not expected heavy calculation as Windows.dir.Update(NIL);
It is only my guess. I am just thinking aloud.
- Josef Templ
- Posts: 2047
- Joined: Tue Sep 17, 2013 6:50 am
Re: issue-#105 background task processing while mouse tracki
I cannot see any delay when moving a control on a form.luowy wrote:I not noticed it,maybe. it copyed from my own version,which some name were changed slightly.Ivan Denisov wrote:.. maybe it should be idled ?
about HostPorts.Input:
the Sleep(1) procedure should move to the end of the Inupt instead of the beginning.to avoid the delay of responding. can be understand when you moving a selected control on a form window.Code: Select all
... WinApi.Sleep(1); END Input;
The sleep is very short and it would be surprising if it can be observed
no matter if it is at the top or at the bottom.
In addition, handling the input is after Input and not within Input, as far as I see.
- Josef
- Josef Templ
- Posts: 2047
- Joined: Tue Sep 17, 2013 6:50 am
Re: issue-#105 background task processing while mouse tracki
We must find out why the change has been removed.- 20060325, mc, Rider.Input changed for the benefit of background task response.
Otherwise we may reintroduce a bug.
Who is mc?
Can we contact him?
- Josef