Clicking on context menu item sometime has no response in OSR mode

tad.chen
Posts: 58
Joined: Fri Jan 04, 2019 1:39 am

Clicking on context menu item sometime has no response in OSR mode

Post by tad.chen »

Hi,

Clicking on context menu item sometime has no response in OSR mode. You have to click it for several times, then it works.

The context menu item is added by myself. I don't know the reason. It seems that the context menu in OSR mode is not stable.

Thank you!
User avatar
salvadordf
Posts: 2966
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: Clicking on context menu item sometime has no response in OSR mode

Post by salvadordf »

Perhaps there's another control getting the focus while CEF shows the context menu.

Can you reproduce this issue with a demo? If so, please provide step by step instructions to reproduce it.
tad.chen
Posts: 58
Joined: Fri Jan 04, 2019 1:39 am

Re: Clicking on context menu item sometime has no response in OSR mode

Post by tad.chen »

I have tested for several times.

It seems that when many webpages are opened, the CPU usage and memory usage are very high, this issue will be found. Especially when run out of memory nearly.
User avatar
salvadordf
Posts: 2966
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: Clicking on context menu item sometime has no response in OSR mode

Post by salvadordf »

If CPU usage is too high then it's not rare to see that some applications have dificulties giving a fast response to user actions.

Try setting GlobalCEFApp.EnableGPU to True before the GlobalCEFApp.StartMainProcess call in the DPR file. This property will enable hardware acceleration using the graphics card.

Also try calling TChromium.WasHidden(True) to all the browsers that are not visible and then call TChromium.WasHidden(False) when they become visible. This will stop the TChromium.OnPaint event for that browser while it's hidden. There's a known CEF issue with this trick and you will have to resize the browser by 1 pixel after the TChromium.WasHidden(False) call to receive TChromium.OnPaint events again.
tad.chen
Posts: 58
Joined: Fri Jan 04, 2019 1:39 am

Re: Clicking on context menu item sometime has no response in OSR mode

Post by tad.chen »

Thank you for your advice. I'll try it.
Student
Posts: 51
Joined: Tue Aug 07, 2018 9:20 am

Re: Clicking on context menu item sometime has no response in OSR mode

Post by Student »

I also often encounter this bug, if you simply move the cursor over the pop-up menu or even open it, the screen sometimes turns black.
Image
User avatar
salvadordf
Posts: 2966
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: Clicking on context menu item sometime has no response in OSR mode

Post by salvadordf »

Thanks for reporting this issue!

I'll try to replicate it in my computer.
Student
Posts: 51
Joined: Tue Aug 07, 2018 9:20 am

Re: Clicking on context menu item sometime has no response in OSR mode

Post by Student »

Problem in unit uCEFBufferPanel

Code: Select all

procedure TBufferPanel.BufferDraw(const aBitmap : TBitmap; const aSrcRect, aDstRect : TRect);
begin
  if (FBuffer <> nil) then
  FBuffer.Canvas.CopyRect(aDstRect, aBitmap.Canvas, aSrcRect);
end; 
The fix

Code: Select all

procedure TBufferPanel.BufferDraw(const aBitmap : TBitmap; const aSrcRect, aDstRect : TRect);
begin
  if (FBuffer <> nil) then
  begin
  FBuffer.Canvas.Lock;
  aBitmap.Canvas.Lock;
  FBuffer.Canvas.CopyRect(aDstRect, aBitmap.Canvas, aSrcRect);
  aBitmap.Canvas.UnLock;
  FBuffer.Canvas.Unlock;
  end;
end;
User avatar
salvadordf
Posts: 2966
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: Clicking on context menu item sometime has no response in OSR mode

Post by salvadordf »

Thank you very much for the fix! :D
User avatar
salvadordf
Posts: 2966
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: Clicking on context menu item sometime has no response in OSR mode

Post by salvadordf »

I just uploaded your fix.
Thanks again! :D
Post Reply