Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update supported CEF version, and a bunch of other changes #22

Open
wants to merge 35 commits into
base: master
Choose a base branch
from

Conversation

em-tg
Copy link

@em-tg em-tg commented Apr 1, 2024

I tried using this repo as a jumping-off point for a project a few years ago, and am thankful it exists. It was a little difficult to get started with it, though, since it didn't work with the latest version of CEF, and had a number of other issues. Since it doesn't seem to have received any updates since then, I thought I'd submit a PR so others don't have to struggle as much as I did.

This PR updates to the latest CEF version, fixes a number of issues, implements "true" reference counting, and "cleans" the C a bit. Some of the changes are just random things I thought would be a good idea, so feel free to edit and strip out the bits you don't want (or tell me to do so).

List of changes:

  • Update both the Linux and Windows builds to support CEF 123.0.7
  • Make extraction of CEF an automated part of the build process
  • drop support for gtk2
    • I couldn't get it working locally, but I didn't spend much time on it and there may have been something I was missing
  • remove custom gtk window creation code
    • I think this was working around a bug in CEF that's no longer in the latest version
  • Fix handling of reference counted objects so the program no longer crashes on exit
    • This includes removing a bunch of the stub handlers from cef_client.h and cef_app.h, since I didn't want to go through adding release calls all over the place in functions that weren't being used
  • Implement "real" reference counting in addition to the "dummy" one
    • The reference counting implementation is fully generic (using the preprocessor), but I think it's helpful to demonstrate that reference counting isn't technically necessary for most handler implementations, so I just implemented a reference-counting example for one of them, and left the others to continue using the "fake" reference counting.
  • Smaller changes:
    • Handle the error returns from cef_initialize and cef_browser_host_create_browser
    • Create cef_strings directly from UTF-16 string literals rather than using ASCII literals and converting
    • Avoid using pointer casts when they are not necessary
    • Eliminate the global client_handler_t and use container_of to extract it from cef_client
    • Use C99 designated initializers in more places
    • Prefer sizeof val to sizeof(type)
    • Add an implementation of cef_load_handler to demonstrate reference counting
  • On Windows:
    • Most of the above
      • NOTE: Extracting cef*.tar.bz2 using the build scripts requires 7zip. Windows has tar but it can't handle .bz2 :P
    • Add support for MSVC (Tested on a computer with VS 2022, although it should work with any recent version)

@em-tg em-tg changed the title Update CEF, and a bunch of other changes Update supported CEF version, and a bunch of other changes Apr 1, 2024
emy and others added 5 commits September 29, 2024 11:49
The GPU process crashes on windows for some reason when we
compile with MSVC but not when we compile with MinGW (maybe stdlib-related?).  Happens
in libcef in a call to CreateWindowsOnThread, which is
being used by chrome for something directx-related.

The debugger says CreateWindowEx returns NULL but that GetLastError() is ERROR_SUCCESS,
suggesting something wrong with the WndProc.

https://chromium.googlesource.com/chromium/src/+/refs/heads/main/ui/gl/child_window_win.cc#108
chromiumembedded/cef#3765
@em-tg
Copy link
Author

em-tg commented Sep 30, 2024

cefcapi appears to be affected by chromiumembedded/cef#3765

@em-tg
Copy link
Author

em-tg commented Oct 1, 2024

Should be good to go, now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant