Skip to content
This repository has been archived by the owner on Mar 30, 2020. It is now read-only.

DES-16866 - Handle mouse middle button click #157

Closed
wants to merge 1 commit into from

Conversation

rbarros-daitan
Copy link
Collaborator

@rbarros-daitan rbarros-daitan commented Jun 1, 2018

Implement OnOpenUrlFromTab to handle mouse middle button click.
Jira ticket: DES-16866

@@ -71,7 +71,7 @@
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PostBuildEvent>call "$(VS120COMNTOOLS)\vsvars32.bat"
<PostBuildEvent>call "$(VS140COMNTOOLS)\vsvars32.bat"
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change to VS2015.

bool ICefWebBrowserInternal.OnOpenUrlFromTab(CefBrowser browser, CefFrame frame, string targetUrl, CefWindowOpenDisposition targetDisposition, bool userGesture)
{
CefUrlParts parts;
if (CefRuntime.ParseUrl(targetUrl, out parts))
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Validate URL before launch it.

return clean;
}

public static string GetDefaultBrowserPath()
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Process.Start("url") has problem when dealing with some Browsers like Firefox for instance.
In order to prevent this error, a get default browser method is needed. Source is: http://www.seirer.net/blog/2014/6/10/solved-how-to-open-a-url-in-the-default-browser-in-csharp

@lneir
Copy link
Collaborator

lneir commented Jun 1, 2018

a click should eventually call this code and paragon already has code 'OpenUrl' to cause opening in default browser... https://github.com/SymphonyOSF/SFE-Client-App/blob/dev/src/js/extensions/appBridge.js#L236

above code in appBridge should be hit when doing left click.

please check why it is not getting hit in JS code when middle click is performed.

i don't have a three button mouse here so can't check.

@rbarros-daitan
Copy link
Collaborator Author

@lneir , openUrl is not call when doing middle click, which is understood as open in new tab.
I checked on Chrome & Electron as well, none of them processes the middle click as openUrl on appbridge.

@lneir
Copy link
Collaborator

lneir commented Jun 1, 2018

why is that? this is just an on 'click' event and should work - please investigate.

@rbarros-daitan
Copy link
Collaborator Author

@lneir , it seems that since CEF v55, the "click" event is fired only for left click on mouse.
There is a new event called "auxclick" that is fired when clicking with other buttons.
I´ve found this reference that explains it:
https://developers.google.com/web/updates/2016/10/auxclick
In your opinion, should we implement the auxclick handler as we have the handleClickEntity which is fired by the click event?

@lneir
Copy link
Collaborator

lneir commented Jun 2, 2018

so is this a CEF bug? what happens in the browser?

@rbarros-daitan
Copy link
Collaborator Author

Well, it is a new feature. Our implementation, though, only include listener for the "click" event. Chrome, for instance, implements it like here as a common listener.
Maybe we can change the fix to be an event handler for auxclick on JS side and set it on DefaultEntitiesView.

Anyway, the current proposed solution works because the default behavior for mouse middle button is Open in New Tab.

@rbarros-daitan
Copy link
Collaborator Author

@lneir , I was looking to handle auxclick on our app but then I faced this:
It seems that auxclick is currently not supported on react. Check this:
facebook/react#11571
facebook/react#8529

So, maybe we can go ahead with current solution on Paragon code to capture open on new tab requests that is the default action for mouse middle button click.

@lneir
Copy link
Collaborator

lneir commented Jun 3, 2018

the code that needs this fix is actually jquery and should work there. other issue i see is the onclick is not always getting called in DefaultEntitiesView rather it is being handle by some nexus renderer code (also jquery there). believe this is happening because some messages are messageML and others are legacy markdown format.

@rbarros-daitan rbarros-daitan changed the title Handle mouse middle button click DES-16866 - Handle mouse middle button click Jun 4, 2018
@lneir
Copy link
Collaborator

lneir commented Jun 4, 2018

so 'auxclick' in the two places should works. i checked with glenn and one is indeed for legacy markdown renderering and other is for markdown rendering.

@lneir
Copy link
Collaborator

lneir commented Jun 5, 2018

closing PR in favor of handing in core JS code.

@lneir lneir closed this Jun 5, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants