Right Click Context Menu Mouse Input not being processed.

Having problems with building or using CEF's C/C++ APIs? This forum is here to help. Please do not post bug reports or feature requests here.

Right Click Context Menu Mouse Input not being processed.

Postby igjpalmer » Tue Jun 26, 2018 3:57 pm

Hey Everyone,

I'm encountering an issue with input processing for right click context menus.

I am using version 3.3325.1758.g9aea513 of CEF.

Running with OSR, GPU Disabled. Also, Touchpad and Wheel Scroll Latching, Async Wheel Events, and Threaded Scrolling Disabled.

The issue occurs when I right click the browser, the context menu appears. It's a custom menu (all options but "Back" removed, and Back is disabled because there is nowhere to go).

Clicking outside of the context menu does nothing. I would expect the context menu to close if I click outside of it.

If I click the context menu and then click outside of it, the menu then closes.

I'm not sure what the issue is here. I read another post that seemed to suggest that because the main window was created on the main thread and the context menu created on another thread the input isn't being process correctly.

If that's true, I am not sure how to remedy this.

I would appreciate any help with this.

Thanks,

Joe
igjpalmer
Techie
 
Posts: 16
Joined: Tue Jun 26, 2018 3:48 pm

Re: Right Click Context Menu Mouse Input not being processed

Postby amaitland » Wed Jun 27, 2018 2:18 am

Are you using Windows with multi threaded message loop enabled?
Maintainer of the CefSharp project.
amaitland
Virtuoso
 
Posts: 1292
Joined: Wed Jan 14, 2015 2:35 am

Re: Right Click Context Menu Mouse Input not being processed

Postby igjpalmer » Wed Jun 27, 2018 9:50 am

Yes, I am. Is that an issue?

CefRunMessageLoop is called on another thread, so that the browser does not block the game that it's integrated into.

So far everything as has worked fine, except the context menu input.

If I am running the browser on another thread does that mean I need to not use Multi-Threaded-Message-Loop and instead use the External-Message-Loop?

I'm not sure what Windows Message Loop adjustments need to be made when CEF is going to be run on thread that isn't an applications main thread.
igjpalmer
Techie
 
Posts: 16
Joined: Tue Jun 26, 2018 3:48 pm

Re: Right Click Context Menu Mouse Input not being processed

Postby magreenblatt » Thu Jun 28, 2018 2:13 pm

Running with OSR, GPU Disabled. Also, Touchpad and Wheel Scroll Latching, Async Wheel Events, and Threaded Scrolling Disabled.
CefRunMessageLoop is called on another thread, so that the browser does not block the game that it's integrated into.

You have a lot going on here so it's hard to say exactly what your problem is. What HWND are you passing as the parent to CefWindowInfo::SetAsWindowless? What thread are you creating that HWND on?
magreenblatt
Site Admin
 
Posts: 12409
Joined: Fri May 29, 2009 6:57 pm

Re: Right Click Context Menu Mouse Input not being processed

Postby magreenblatt » Thu Jun 28, 2018 2:17 pm

Likely unrelated to your problem but you shouldn't call CefRunMessageLoop if you're using CefSettings.multi_threaded_message_loop.
magreenblatt
Site Admin
 
Posts: 12409
Joined: Fri May 29, 2009 6:57 pm

Re: Right Click Context Menu Mouse Input not being processed

Postby igjpalmer » Thu Jun 28, 2018 2:48 pm

I was passing NULL into SetAsWindowless, but I have also tried passing the Main Application Window handle which is created on the main thread. That didn't seem to make a difference.

Regarding CefRunMessageLoop, should I only call that if I'm not using multi-threaded-message-loop = true.

If I'm using multi-threaded-message-loop=true, does that mean I should follow example from Cef Client that creates a Message-Only window and processes messages there instead of calling CefRunMessageLoop?
igjpalmer
Techie
 
Posts: 16
Joined: Tue Jun 26, 2018 3:48 pm

Re: Right Click Context Menu Mouse Input not being processed

Postby igjpalmer » Thu Jun 28, 2018 3:09 pm

Also, just for reference. I tried disabling a bunch of the command line switches I was using (all except no-sandbox) and the issue still persists. So I'm not sure it's related to my command line switches.

I also verified that the parent window handle is being passed into SetAsWindowless

Also, while this occurs with my OSR rendered browser window, any popups that open in new windows are not experiencing the issue.
Last edited by igjpalmer on Thu Jun 28, 2018 3:18 pm, edited 1 time in total.
igjpalmer
Techie
 
Posts: 16
Joined: Tue Jun 26, 2018 3:48 pm

Re: Right Click Context Menu Mouse Input not being processed

Postby magreenblatt » Thu Jun 28, 2018 3:13 pm

igjpalmer wrote:Regarding CefRunMessageLoop, should I only call that if I'm not using multi-threaded-message-loop = true.

Correct. With multi-threaded-message-loop = true CEF will internally create a thread and run the UI message loop on that thread.

igjpalmer wrote:If I'm using multi-threaded-message-loop=true, does that mean I should follow example from Cef Client that creates a Message-Only window and processes messages there instead of calling CefRunMessageLoop?

Only if you don't already have a message loop in your application.
magreenblatt
Site Admin
 
Posts: 12409
Joined: Fri May 29, 2009 6:57 pm

Re: Right Click Context Menu Mouse Input not being processed

Postby magreenblatt » Thu Jun 28, 2018 3:16 pm

The native context menu implementation uses Windows APIs and messages. If your HWND is not created on the same thread that runs the context menu (which is the case unless you create your HWND on the CEF UI thread) then message handling sometimes has issues. I would suggest you instead use JavaScript context menus to sidestep the problem completely.
magreenblatt
Site Admin
 
Posts: 12409
Joined: Fri May 29, 2009 6:57 pm

Re: Right Click Context Menu Mouse Input not being processed

Postby igjpalmer » Thu Jun 28, 2018 3:20 pm

Is there a reference for using Javascript context menu's?
igjpalmer
Techie
 
Posts: 16
Joined: Tue Jun 26, 2018 3:48 pm

Next

Return to Support Forum

Who is online

Users browsing this forum: Google [Bot] and 51 guests