CefClient for Linux Drag and Drop issues Post Aura

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 for Linux Drag and Drop issues Post Aura

Postby Mayhew » Fri Oct 17, 2014 5:23 pm

Okay, I may be able to limit my search to windows that define _NET_WM_PID. That seems to work for both CefClient and CefSimple. Though, admittedly that seems to be a bit of a hack.
Mayhew
Expert
 
Posts: 303
Joined: Mon Apr 18, 2011 8:02 pm

Re: CefClient for Linux Drag and Drop issues Post Aura

Postby Mayhew » Fri Oct 17, 2014 6:41 pm

Okay, I have a helper, albeit hacky with the _NET_WM_PID check. This fixes the issue of setting the incorrect dnd proxy.

I also can fix the coordinates being off when the CefWindowX11 host is a child. That was done by changing CefWindowX11::DispatchEvent where it calls
window_tree_host->set_screen_bounds(bounds);
to
window_tree_host->set_screen_bounds(CefWindowX11::GetBoundsInScreen());
That makes the HTML drag/drop test page function fully in CefClient, except for the last issue below.

The last issue is that when CefWindowX11 is a child window, ConfigureNotify is only called on a main window resize. Moving the apps main window doesn't trigger that event so the coordinates will get out of whack if you simply move the window. This may require changing the client to call XConfigureWindow on a window move, from a configure-event signal handler. Working on that now. If that works I should have a patch on Monday.
Mayhew
Expert
 
Posts: 303
Joined: Mon Apr 18, 2011 8:02 pm

Re: CefClient for Linux Drag and Drop issues Post Aura

Postby Mayhew » Fri Oct 17, 2014 7:46 pm

Okay implementing a configure-event signal handler in cefclient_gtk.cc like the following

Code: Select all
gboolean WindowConfigure(GtkWidget* widget,
                         GdkEventConfigure* event,
                         gpointer user_data) {
  if (g_handler) {
    CefRefPtr<CefBrowser> browser = g_handler->GetBrowser();
    if (browser && !browser->GetHost()->IsWindowRenderingDisabled()) {
      ::Display* xdisplay = cef_get_xdisplay();
      ::Window xwindow = browser->GetHost()->GetWindowHandle();
      XWindowChanges changes = {0};
      changes.x = 0;
      changes.y = g_toolbar_height + g_menubar_height;
      changes.width = event->width;
      changes.height = event->height -
                       (g_toolbar_height + g_menubar_height);
      XConfigureWindow(xdisplay, xwindow, CWX | CWY | CWHeight | CWWidth,
                       &changes);
    }
  }
  return FALSE;
}


fixes an unrelated issue where the main browser is not positioned or sized correctly when launched on Ubuntu 14. This fixes that by causing an initial ConfigureNotify event in the CefWindowX11.

Unfortunately, when moving the main CefClient window around the screen, it seems that XLib is smart enough to notice that the subsequent calls to this method which call XConfigureWindow() aren't really changing the CefWindowX11's size or position so CefWindowX11 never gets the ConfigureNotify. I'm sorta stuck here.

Any thoughts on how to solve this one?
Mayhew
Expert
 
Posts: 303
Joined: Mon Apr 18, 2011 8:02 pm

Re: CefClient for Linux Drag and Drop issues Post Aura

Postby Mayhew » Mon Oct 20, 2014 4:03 pm

One solution seems to be to update the screen bounds of Window Tree Host in the CefWindowX11's FocusIn handler. This event is sent at the end of every resize and every window move. Since this set_screen_bounds() only sets the screen bounds member I don't think this would be a bad solution.
Mayhew
Expert
 
Posts: 303
Joined: Mon Apr 18, 2011 8:02 pm

Re: CefClient for Linux Drag and Drop issues Post Aura

Postby magreenblatt » Mon Oct 20, 2014 4:20 pm

Mayhew wrote:The last issue is that when CefWindowX11 is a child window, ConfigureNotify is only called on a main window resize. Moving the apps main window doesn't trigger that event so the coordinates will get out of whack if you simply move the window. This may require changing the client to call XConfigureWindow on a window move, from a configure-event signal handler. Working on that now. If that works I should have a patch on Monday.

Based on this it seems like there should be a ConfigureNotify when the window is moved, not just when it's resized (but maybe it's only sent to the parent window?). There's also this notification when the window is reparented.
magreenblatt
Site Admin
 
Posts: 12382
Joined: Fri May 29, 2009 6:57 pm

Re: CefClient for Linux Drag and Drop issues Post Aura

Postby Mayhew » Mon Oct 20, 2014 4:25 pm

In the CefSimple case, a window move does result in a ConfigureNotify to the CefWindowX11 so no problem there.

In the CefClient example, a window move of the GTK window does not result in the CefWindowX11 getting a ConfigureNotify. If we force a XConfigureWindow call in a configure-event handler in our GTK main window, this doesn't result in a ConfigureNotify event in CefWindowX11. My theory is that XLib is smart enough to notice that the orgin and bounds of the actual CefWindowX11's window haven't changed so it doesn't send the event.

I tried handling a reparent event in CefWindowX11 and it never got hit in either the CefSimple or CefClient use cases. My theory here is that this window is never actually reparented. In the CefClient case it is created with a parent while CefSimple is created with no parent. Those windows are never given a new parent after creation so hence, no reparent event will ever be sent.
Mayhew
Expert
 
Posts: 303
Joined: Mon Apr 18, 2011 8:02 pm

Re: CefClient for Linux Drag and Drop issues Post Aura

Postby magreenblatt » Mon Oct 20, 2014 4:37 pm

Mayhew wrote:One solution seems to be to update the screen bounds of Window Tree Host in the CefWindowX11's FocusIn handler. This event is sent at the end of every resize and every window move. Since this set_screen_bounds() only sets the screen bounds member I don't think this would be a bad solution.

Are you sure FocusIn will always be sent on resize and window move? For example, what if there's some other control like a text area that has and keeps the focus? If the CEF window receives FocusIn even when the URL text field has focus that might be a bug in the GTK integration and not intended behavior.
magreenblatt
Site Admin
 
Posts: 12382
Joined: Fri May 29, 2009 6:57 pm

Re: CefClient for Linux Drag and Drop issues Post Aura

Postby Mayhew » Mon Oct 20, 2014 5:00 pm

I did some testing with focus on content inside the browser and didn't see any issues. It is possible that the focus_pending_ checking in the FocusIn and FocusOut handlers is there to mitigate problems with this.
Mayhew
Expert
 
Posts: 303
Joined: Mon Apr 18, 2011 8:02 pm

Re: CefClient for Linux Drag and Drop issues Post Aura

Postby magreenblatt » Wed Oct 29, 2014 1:20 pm

magreenblatt wrote:
Mayhew wrote:One solution seems to be to update the screen bounds of Window Tree Host in the CefWindowX11's FocusIn handler. This event is sent at the end of every resize and every window move. Since this set_screen_bounds() only sets the screen bounds member I don't think this would be a bad solution.

Are you sure FocusIn will always be sent on resize and window move? For example, what if there's some other control like a text area that has and keeps the focus? If the CEF window receives FocusIn even when the URL text field has focus that might be a bug in the GTK integration and not intended behavior.

This workaround is no longer necessary with the introduction of CefBrowserHost::NotifyMoveOrResizeStarted() in https://code.google.com/p/chromiumembed ... d=1208#c25.
magreenblatt
Site Admin
 
Posts: 12382
Joined: Fri May 29, 2009 6:57 pm

Re: CefClient for Linux Drag and Drop issues Post Aura

Postby Mayhew » Mon Apr 27, 2015 12:54 pm

Drag and drop of files is still not functional in the CEF trunks cefclient. I don't see any current open issues on that. Is this known and should I enter a new issue for it?
Mayhew
Expert
 
Posts: 303
Joined: Mon Apr 18, 2011 8:02 pm

PreviousNext

Return to Support Forum

Who is online

Users browsing this forum: No registered users and 35 guests

cron