chromiumembedded / cef

Chromium Embedded Framework (CEF). A simple framework for embedding Chromium-based browsers in other applications.
https://bitbucket.org/chromiumembedded/cef/
Other
3.36k stars 467 forks source link

linux versions above 102 (including 102) can't respond to window size changes #3418

Closed magreenblatt closed 1 year ago

magreenblatt commented 2 years ago

Original report by Guofeng Zhang (Bitbucket: Guofeng Zhang).


Steps to reproduce on Ubuntu 22.04:

Testing the new version of cef Linux, we found that: after running for a period of time, versions above 102 (including 102) can't respond to window size changes. Versions before 101 have no such problem. So far, 107 still has this problem.

we use follow codes to resize browser window,it works fine before 102

                 XMoveResizeWindow(m_xDisplay, xwindow, 0, 0, changes.width, changes.height );
                   XFlush(m_xDisplay);

magreenblatt commented 2 years ago

Where and how are you executing XMoveResizeWindow in cefsimple?

magreenblatt commented 2 years ago

Original comment by Guofeng Zhang (Bitbucket: Guofeng Zhang).


I didn't use this interface in cefsimple. I first used a parent class window in my project, and then set the cef window as Child. When the size of the parent class window changes, I change the cef window. Before version 102, I used the XMoveResizeWindow interface, which is very useful. However, after the 102 version, the cef will run for a while and have problems. Later, I tried to use cefsimple. I found that cefsimple has the same problem. I'm not sure if cefsimple uses the same interface to change its size. I think it should be caused by the implementation change of x11. Please take a look. Thank you very much!!

magreenblatt commented 2 years ago

There are some known issues related to dialogs. See #3316/use-chrome-js-dialogs-on-all-platforms-and#comment-63743043

magreenblatt commented 2 years ago

Original comment by Robert Calkins (Bitbucket: Robert Calkins).


I had the same issue and found a fix. This post shows that the child of the browser window stopped responding to changes made with XID: https://magpcss.org/ceforum/viewtopic.php?f=6&t=19264
Something to do with an ozone layer? Not sure why that name no longer appears as the direct child of our browser window.

The fix we implemented is looping through the browsers children also resizing them accordingly. We cache the children xid so we don't have to find them every time we resize.

magreenblatt commented 2 years ago

Original comment by Guofeng Zhang (Bitbucket: Guofeng Zhang).


hi,Robert Calkins,Thank you very much for your comments. My problem phenomenon is the same as yours, but I added print in browser ->GetHost() ->GetWindowHandle(), and found that this value has never changed. Do you mean that your value will change? Can you give me some more detailed solutions?

magreenblatt commented 2 years ago

Original comment by Robert Calkins (Bitbucket: Robert Calkins).


Sure, so the result of browser->GetHost()->GetWindowHandle() will give the XID of your browser window (this won't change). That browser window has two children. You can see the tree with xwininfo -tree -int -id . If you use xdotool to resize the browser window you’ll notice it doesn't work, but resizing the first child of the CEF window it will. So my solution was to simply find all the children XIDs of the CEF browser window given by GetWindowHandle(). You can find all the children with XQueryTree, loop through the results setting the size of the CEF browser and its children accordingly.

magreenblatt commented 2 years ago

Original comment by Guofeng Zhang (Bitbucket: Guofeng Zhang).


great,Robert Calkins,i will try,thanks again!

magreenblatt commented 1 year ago

Original comment by Guofeng Zhang (Bitbucket: Guofeng Zhang).


alreay worked by resize all cef window child's size

magreenblatt commented 2 years ago

Original changes by Guofeng Zhang (Bitbucket: Guofeng Zhang).


magreenblatt commented 1 year ago

Original changes by Guofeng Zhang (Bitbucket: Guofeng Zhang).