Problem with tab/enter keys in OSR mode

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.

Re: Problem with tab/enter keys in OSR mode

Postby AndrewH » Tue Sep 09, 2014 8:54 pm

Ok I fixed this. It may be something that you can use.

The problem was that I wasn't making use of the WM_CHAR message, only the Keyup and Keydown messages.

I think it stemmed from the example code I was using. I don't even really recall where this came from, except that I found it when first looking at offscreen. I'll list it here in case anyone else is using it.

This really isn't correct.

Code: Select all
        if (keyPressed)
        {
            event.windows_key_code = vkey;
            event.type = KEYEVENT_RAWKEYDOWN;
            cef_browser->GetHost()->SendKeyEvent(event);
            event.type = KEYEVENT_CHAR;
            cef_browser->GetHost()->SendKeyEvent(event);
        }
        else
        {
            event.windows_key_code = vkey;
            // bits 30 and 31 should be always 1 for WM_KEYUP
            event.native_key_code |= 0xC0000000;
            event.type = KEYEVENT_KEYUP;
            cef_browser->GetHost()->SendKeyEvent(event);
        }


The KEYEVENT_CHAR needs to be sent from the WM_CHAR message, as in the cefclient example. The above is absolutely incorrect. You can't construct it properly based only on WM_KEYDOWN event. At least I couldn't.

I'm guessing that this probably seems obvious to those who know. But I got waylaid by this sample code which (unfortunately) kind of worked enough that I didn't question it.

Thanks again for your response.

Regards
Andrew
AndrewH
Techie
 
Posts: 10
Joined: Sun Aug 17, 2014 10:33 pm

Re: Problem with tab/enter keys in OSR mode

Postby AndrewH » Tue Sep 09, 2014 8:57 pm

ahh yes, just checking the source that you posted first up. You're doing the same that I was.

I'm guessing that this will apply.

Regards
Andrew
AndrewH
Techie
 
Posts: 10
Joined: Sun Aug 17, 2014 10:33 pm

Re: Problem with tab/enter keys in OSR mode

Postby amitkanfer » Tue Sep 16, 2014 8:57 am

Hi Czarek,
Saved my day.
Many thanks.
Amit
amitkanfer
Techie
 
Posts: 31
Joined: Mon Jul 21, 2014 4:10 am

Previous

Return to Support Forum

Who is online

Users browsing this forum: Google [Bot], ndesktop and 36 guests