Handling dropdowns in OSR mode

Do not post support requests, bug reports or feature requests. Discuss CEF here. Non-CEF related discussion goes in General Discussion!

Handling dropdowns in OSR mode

Postby simonpearce » Mon Apr 03, 2017 7:06 pm

CEF 3.2987.1591.gd3e47f5 Win32

I'm trying to add support for dropdown menus in an OSR based Win32 application.

I think I need to manage 2 buffers - 1 for when the |type| passed into my version of CefRenderHandler::onPaint() is PET_VIEW and one when it is PET_POPUP. When I eventually render my page, I merge the two.

Getting close to a working solution but I notice that when I first mouse down on a dropdown, I would expect an onPaint call to be triggered with |type| set to PET_POPUP since that click should cause the dropdown to appear. Instead though, it's called with |type| set to PET_VIEW. This breaks my logic.

Is that expected and if so, what should I be doing when that first mouse down arrives?
simonpearce
Techie
 
Posts: 36
Joined: Tue Oct 27, 2015 2:32 pm

Re: Handling dropdowns in OSR mode

Postby magreenblatt » Mon Apr 03, 2017 7:09 pm

Both the view and popup buffers may be changing at the same time. Your logic needs to account for that and always render the popup on top.
magreenblatt
Site Admin
 
Posts: 12382
Joined: Fri May 29, 2009 6:57 pm

Re: Handling dropdowns in OSR mode

Postby simonpearce » Mon Apr 03, 2017 7:22 pm

Yep understood. I copy in the popup buffer over the view buffer.

Nevertheless, when the dropdown is clicked, I would expect to see a PET_POPUP so I can grab the dropdown window but all I see is a PET_VIEW (which of course, doesn't have the popup) - *until* I start moving the mouse and then I start to see PET_POPUPs arrive.

How do I capture the initial "Show" when the dropdown is first created?
simonpearce
Techie
 
Posts: 36
Joined: Tue Oct 27, 2015 2:32 pm

Re: Handling dropdowns in OSR mode

Postby simonpearce » Mon Apr 03, 2017 7:29 pm

I wondered about adding browser->GetHost()->Invalidate(PET_POPUP); in my overridden CefRenderHandler::OnPopupShow() function when |show| is true.

That seemed to help but I see that in the CefClient code so I imagine that's not the right way to do things.
simonpearce
Techie
 
Posts: 36
Joined: Tue Oct 27, 2015 2:32 pm

Re: Handling dropdowns in OSR mode

Postby simonpearce » Tue Apr 04, 2017 8:53 pm

A colleague helped me to figure it out - he pointed out that when a |type| of PET_VIEW comes in and there is an active popup, you need to call browser->GetHost()->Invalidate(PET_POPUP);

That did the trick and everything is working now.
simonpearce
Techie
 
Posts: 36
Joined: Tue Oct 27, 2015 2:32 pm


Return to CEF Discussion

Who is online

Users browsing this forum: No registered users and 16 guests