chromiumembedded / java-cef

Java Chromium Embedded Framework (JCEF). A simple framework for embedding Chromium-based browsers in other applications using the Java programming language.
https://bitbucket.org/chromiumembedded/java-cef
Other
648 stars 142 forks source link

No visible cursor on text fields in OSR mode #24

Closed magreenblatt closed 9 years ago

magreenblatt commented 10 years ago

Original report by Anonymous.


Original issue 24 created by arnaud.brochard on 2014-01-06T12:56:37.000Z:

What steps will reproduce the problem?

Download and run latest distribution

What is the expected output? What do you see instead?

Expected behavior is a visible and blinking cursor on text fields. But no cursor is visible at all.

What version of the product are you using? On what operating system?

jcef_binary_3.1650.1501.9_windows64_preview
Windows 7 x64
JDK7u45 x64

Also tried with win32, same behavior

Please provide any additional information below.

In debug mode, the onCursorChange method of the MainFrame class is often called, but no cursor is visible

magreenblatt commented 10 years ago

Original comment by Anonymous.


Comment 1. originally posted by leichtenfels on 2014-01-13T09:03:47.000Z:

I am having the same issue.

I just built JCEF according to the instructions (Windows 7 x64, JDK 7u45 x64). Had to add NULL as value for the windows_sandbox_info parameter of function calls to CefInitialize and CefExecuteProcess to get it compiled.

Caret behaviour is indeed very strange. Navigation with cursor keys has no effect, also, Shift + cursor key doesn't select text as usual. Home and End keys don't work, either. Mouse selection does work, however.

I suspect it's not just an issue with the caret not being displayed, but some deeper problem. Looks to me as if caret events are not passed to the underlying control.

I'm just evaluating JCEF for a project and, unfortunately, this issue is a showstopper for me. I tried to build the cefclient2010 project to investigate whether this might be a Windows issue but I'm getting a build error I can't resolve (MSB6006: cmd.exe exited with code 4; no helpful information on Google found on this).

If I can be of any assistance in resolving this problem please don't hesitate to contact me. I can also offer some development resources for JCEF in exchange for being able to use it (I'm a fairly competent Java developer with JNI experience and some experience in C and C++).

Thanks, Leo

magreenblatt commented 10 years ago

Comment 2. originally posted by magreenblatt on 2014-01-13T15:05:48.000Z:

@ commentcomment 1.: JCEF is currently demo/prerelease quality, so there will likely be a lot of showstopper issues :). In this particular case we may not be setting the focus correctly after creating the off-screen browser.

All of the source code for JCEF is available. Feel free to submit issues and/or patches for any problems that you run into. You can also ask questions at http://magpcss.org/ceforum.

magreenblatt commented 10 years ago

Original comment by Anonymous.


Comment 4. originally posted by arnaud.brochard on 2014-01-13T16:58:47.000Z:

I also suspect there's a collection of small issues :

magreenblatt commented 10 years ago

Comment 5. originally posted by magreenblatt on 2014-04-11T16:27:05.000Z:

You can avoid this issue by using the windowed rendering mode supported by newer JCEF revisions.

magreenblatt commented 10 years ago

Comment 6. originally posted by magreenblatt on 2014-06-17T18:16:46.000Z:

magreenblatt commented 10 years ago

Original comment by Anonymous.


Comment 7. originally posted by arnaud.brochard on 2014-06-19T08:23:15.000Z:

Just rebuilt and tested latest revision (r90 along up-to-date CEF), confirmed the cursor issue is fixed in window rendering mode (but not in OSR mode, as indicated)

magreenblatt commented 9 years ago

Comment 8. originally posted by magreenblatt on 2014-11-20T20:11:28.000Z:

This can probably be fixed for off-screen rendering by calling CefBrowserHost::SendFocusEvent when the Java canvas receives focus.

magreenblatt commented 9 years ago

Original comment by Anonymous.


Comment 9. originally posted by philippe.defert on 2014-12-15T09:06:12.000Z:

I found a workaround

browser_ = client_.createBrowser(startURL, useOSR, isTransparent);
browerUI_ = browser_.getUIComponent();
browerUI_.addFocusListener(new FocusListener() {

        @ Override  
        public void focusLost(FocusEvent e) {  
            browser\_.setFocus(false);  
        }  

        @ Override  
        public void focusGained(FocusEvent e) {  
            browser\_.setFocus(true);  
        }  
    });   
}  

You can put in org.cef.browser.CefBrowserOsr.java in createGLCanvas()

magreenblatt commented 9 years ago

Original comment by Rupert Smith (Bitbucket: rupertlssmith, GitHub: rupertlssmith).


Comment 10. originally posted by rupertlssmith on 2014-12-15T10:19:59.000Z:

To confirm, I just tried the .setFocus workaround in OSR mode on Linux, and it works perfectly. Thanks for that.

magreenblatt commented 9 years ago

Original comment by Anonymous.


Comment 11. originally posted by philip142au on 2015-01-17T04:02:38.000Z:

Hi, so I came across the same issue. Maybe the code has changed since your last comment, so I had to add in MainFrame.java around line 224:

browser\_ = client\_.createBrowser("http://www.google.com",  
                                 osrEnabled,  
                                 false,  
                                 requestContext);  
browser\_.getUIComponent().addFocusListener(new FocusListener() {  

  @ Override  
  public void focusLost(FocusEvent e) {  
    browser\_.setFocus(false);  
  }  

  @ Override  
  public void focusGained(FocusEvent e) {  
    browser\_.setFocus(true);  
  }  
}); 
magreenblatt commented 9 years ago

Duplicate of #180.

magreenblatt commented 10 years ago
magreenblatt commented 9 years ago