pacificIT / chromiumembedded

Automatically exported from code.google.com/p/chromiumembedded
0 stars 1 forks source link

With a TChromium component embedded in a Delphi application mousedown and mouse events get handled the wrong way around #568

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
In our Delphi applications we try to embed a browser view. Because of the speed 
and the great support of browser features I would like to use the Delphi 
Chromium Embedded component. However, when embedded in our main form in one of 
the tab sheets the mouse events (down and up) get mixed up and accelerator keys 
do not work anymore.

What steps will reproduce the problem?
1. Add a TChromium component to a Delphi form on a TPanel
2. Add a TButton somewhere else on the form and log OnMouseDown and OnMouseUp 
events on the button component
3. Click the button a few times and within a few clicks you will notice that 
the mouse-up event is triggered before the mouse-down causing the application 
to think it is dragging something and button clicks not to work.

Unfortunately currently at my work the  TortoiseSVN functionality is not 
working due to some network trouble so I don't know the exact version I have, 
but I downloaded the main version on November 2 2011.

I debugged the problem using mouse-hooks ("SetWindowsHookEx(WH_MOUSE...)") and 
noticed that events there were always in the right order. Tracking what happens 
to the mouse messages led me to code in cefvcl.pas where, using 
ApplicationEvents, both the "OnIdle" and "OnMessage" are implemented. When you 
click the mouse, the mouse-down event is the one to trigger 
"TCefApplicationEvents.doMessage" which will trigger the 
"CefDoMessageLoopWork". This takes some time and this is long enough for the 
mouse-up event to catch up and overtake the mouse down event.

Please find two attachments:
- one with my simple test project
- one with the adjustment to cefvcl.pas I propose as a solution which doesn't 
directly call "CefDoMessageLoopWork" but does this async allowing for messages 
to get handled right away.

We've been able to reproduce the issue on Windows 7, Vista and XP. We are using 
Embarcadero Delphi 2010 to develop our apps.

I hope you can help me out and confirm the issue or provide me with an 
alternative solution.

Best regards,
 Jeroen

Original issue reported on code.google.com by jjsmi...@gmail.com on 4 Apr 2012 at 12:12

Attachments:

GoogleCodeExporter commented 9 years ago
The Delphi wrapper is a separate project. Please file Delphi-related bugs with 
them.

Original comment by magreenb...@gmail.com on 4 Apr 2012 at 5:43