CefClient + tab support

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: CefClient + tab support

Postby Peter » Thu Mar 26, 2020 10:44 am

Hmm, I wonder if it is possible to use JavaScript to restore the navigation entries, using something like "pushState"?
Peter
Techie
 
Posts: 38
Joined: Thu Mar 05, 2020 9:41 am

Re: CefClient + tab support

Postby magreenblatt » Thu Mar 26, 2020 10:48 am

Peter wrote:Hmm, I wonder if it is possible to use JavaScript to restore the navigation entries, using something like "pushState"?

Yes, possibly.
magreenblatt
Site Admin
 
Posts: 12409
Joined: Fri May 29, 2009 6:57 pm

Re: CefClient + tab support

Postby Peter » Sat Apr 25, 2020 1:49 pm

No luck with navigation, but perhaps you could help me with another tab-related problem I'm having.

I added a GTK notebook to the CEFClient example for tabs, and I show/hide the CEF browsers using X(Un)MapWindow (this I had to add because otherwise they did not hide) - but apparently I have a problem with input focus not focusing properly on browser windows.

I am calling GetHost()->SetFocus(), but somehow it does not always work, and as a result context menu stops showing up - and only if I click outside the window and inside again makes it work reliably.
This might be related to my (lack of) understanding of GTK, but maybe you could give me an advice on where to look for what's causing it...
Peter
Techie
 
Posts: 38
Joined: Thu Mar 05, 2020 9:41 am

Re: CefClient + tab support

Postby Peter » Wed Apr 29, 2020 10:19 am

Or rather, the question is:
Can I safely replace`SetXWindowVisible()` from browser_window_std_gtk.cc that looks like this:
Code: Select all
void SetXWindowVisible(::Window xwindow, bool visible) {
  ::Display* xdisplay = cef_get_xdisplay();

  // Retrieve the atoms required by the below XChangeProperty call.
  const char* kAtoms[] = {"_NET_WM_STATE", "ATOM", "_NET_WM_STATE_HIDDEN"};
  Atom atoms[3];
  int result =
      XInternAtoms(xdisplay, const_cast<char**>(kAtoms), 3, false, atoms);
  if (!result)
    NOTREACHED();

  if (!visible) {
    // Set the hidden property state value.
    scoped_ptr<Atom[]> data(new Atom[1]);
    data[0] = atoms[2];

    XChangeProperty(xdisplay, xwindow,
                    atoms[0],  // name
                    atoms[1],  // type
                    32,        // size in bits of items in 'value'
                    PropModeReplace,
                    reinterpret_cast<const unsigned char*>(data.get()),
                    1);  // num items
  } else {
    // Set an empty array of property state values.
    XChangeProperty(xdisplay, xwindow,
                    atoms[0],  // name
                    atoms[1],  // type
                    32,        // size in bits of items in 'value'
                    PropModeReplace, NULL,
                    0);  // num items
  }
}

with this:
Code: Select all
void SetXWindowVisible(::Window xwindow, bool visible) {
  ::Display* xdisplay = cef_get_xdisplay();

  if (!visible)
    XUnmapWindow(xdisplay, xwindow);
  else
    XMapWindow(xdisplay, xwindow);
}
Peter
Techie
 
Posts: 38
Joined: Thu Mar 05, 2020 9:41 am

Re: CefClient + tab support

Postby magreenblatt » Wed Apr 29, 2020 11:11 am

Peter wrote:Or rather, the question is:
Can I safely replace`SetXWindowVisible()` from browser_window_std_gtk.cc that looks like this:

Sorry, I don't know. I suspect there was some reason we didn't use XUnmapWindow originally, but I don't remember the details.
magreenblatt
Site Admin
 
Posts: 12409
Joined: Fri May 29, 2009 6:57 pm

Previous

Return to Support Forum

Who is online

Users browsing this forum: Google [Bot], Majestic-12 [Bot] and 60 guests