Page 1 of 2

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

Posted: Thu Dec 17, 2020 10:28 am
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!

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

Posted: Thu Dec 17, 2020 3:51 pm
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.

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

Posted: Fri Dec 18, 2020 4:19 am
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.

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

Posted: Fri Dec 18, 2020 1:23 pm
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.

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

Posted: Sat Dec 19, 2020 5:19 am
by tad.chen
Thank you for your advice. I'll try it.

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

Posted: Wed Dec 30, 2020 4:17 pm
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

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

Posted: Fri Jan 01, 2021 5:10 pm
by salvadordf
Thanks for reporting this issue!

I'll try to replicate it in my computer.

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

Posted: Thu Jan 21, 2021 4:56 pm
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;

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

Posted: Thu Jan 21, 2021 5:17 pm
by salvadordf
Thank you very much for the fix! :D

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

Posted: Thu Jan 21, 2021 6:34 pm
by salvadordf
I just uploaded your fix.
Thanks again! :D