GithubHelp home page GithubHelp logo

CEFDemo outdated about cef.swift HOT 21 CLOSED

lvsti avatar lvsti commented on June 3, 2024
CEFDemo outdated

from cef.swift.

Comments (21)

infrom-software avatar infrom-software commented on June 3, 2024

Though, in this particular example, it doesn't matter.

from cef.swift.

lvsti avatar lvsti commented on June 3, 2024

thanks for spotting it, fixed it for branch 3202

from cef.swift.

infrom-software avatar infrom-software commented on June 3, 2024

In CEFDemo, in createApplication(), Nib stuff creates an unnecessary extra-window. Nib not needed here since top-level window is created by CEF.

from cef.swift.

infrom-software avatar infrom-software commented on June 3, 2024

Is that cef_application_mac_capi.h file really needed? I mean, can be moved into CEF.swift?

from cef.swift.

lvsti avatar lvsti commented on June 3, 2024

well so far I have been trying to keep the codebase free from AppKit (using Foundation only), but since the CEF framework already links against pretty much all the application frameworks (AppKit included), I guess I could move that file as well into the swift package

from cef.swift.

infrom-software avatar infrom-software commented on June 3, 2024

What about creating CEFDemo Helper in swift (as a dependency target for CEFDemo target)?

from cef.swift.

lvsti avatar lvsti commented on June 3, 2024

Makes sense, I've made some progress on it but got stuck with some module import issues. ETA probably this weekend.

from cef.swift.

lvsti avatar lvsti commented on June 3, 2024

Check out the 3202 branch which now has a CEFApplication class that wraps the common required functionality for event dispatch, and also a CEFDemo Helper (Swift) target in the sample project which makes it unnecessary to build the sample helpers in the CEF binary distribution. There is one caveat: if you implement the helper app in Swift, it gets packaged with the Swift standard libraries which means an additional 11 MB in the binary size. If you don’t do anything special in the render process, I recommend using the CEFDemo Helper (C) target which does the exact same thing, just in 10 KB. :)

from cef.swift.

infrom-software avatar infrom-software commented on June 3, 2024

Elegant!

from cef.swift.

infrom-software avatar infrom-software commented on June 3, 2024

Things from cef_application_mac_capi.h can be absorbed in CEFApplication.swift, can't they? I mean @objc protocol ...

from cef.swift.

infrom-software avatar infrom-software commented on June 3, 2024

Agree, CEFDemo Helper (Swift) is currently worthless (and keeping it alongside (C) target is rather confusing ). Maybe Swift runtime will not be copied anymore in the future.

from cef.swift.

infrom-software avatar infrom-software commented on June 3, 2024

I use 10.13, why not ?

from cef.swift.

lvsti avatar lvsti commented on June 3, 2024

ok so can we close this issue now?

from cef.swift.

infrom-software avatar infrom-software commented on June 3, 2024

Few lines of code in CEFApplication.swift and cef_application_mac_capi.h not needed at all. CEFDemo.xcodeproj needs some tweaks.
It's up to you.

from cef.swift.

lvsti avatar lvsti commented on June 3, 2024
  1. You use 10.13 but others might not. There is no harm in having 10.9 as the deployment target
  2. Which lines do you think are not needed in cef_application_mac_capi.h? CefAppProtocol conformance is a must for any NSApplication subclass to work properly with CEF

from cef.swift.

infrom-software avatar infrom-software commented on June 3, 2024
  1. Ok.
  2. My mistake: Put few lines of code in CEFApplication.swift and then cef_application_mac_capi.h file won't be needed at all.

May be these...

@objc protocol CrAppProtocol {
    func isHandlingSendEvent() -> Bool
}

@objc protocol CrAppControlProtocol: CrAppProtocol {
    func setHandlingSendEvent( handlingSendEvent: Bool)
}

protocol CefAppProtocol: CrAppControlProtocol {
}

P.S.
UnderlayOpenGLHostingWindow is kind of bogus.

from cef.swift.

lvsti avatar lvsti commented on June 3, 2024

I didn't think of that but it actually makes sense for the protocols. As for UnderlayOpenGLHostingWindow, Swift doesn't support forward declarations but I can sneak it into the framework header so I can eventually skip the cef_application_mac_capi.h hack. Thanks for the suggestion.

from cef.swift.

lvsti avatar lvsti commented on June 3, 2024

btw I have a PR for CEF (https://bitbucket.org/chromiumembedded/cef/pull-requests/129) that will make it possible to include the cef_application_mac.h in the module, which will make the above workaround unnecessary.

from cef.swift.

infrom-software avatar infrom-software commented on June 3, 2024

Even better.

p.s. only to complete the workaround:
UnderlayOpenGLHostingWindow's implementation does nothing but checks in init that window's contentRect it's not zero width or height. (It seems it did more in the past.) And it's not exposed elsewhere. Presuming it won't change, it can be easily reimplemented in CEFApplication.swift or... simply neglected (It's more of convenience: keep in mind to use UnderlayOpenGLHostingWindow vs. be aware to check not zero.) So, no need to touch the framework header.

from cef.swift.

infrom-software avatar infrom-software commented on June 3, 2024

I think CEFDemo looks better now; can we close this issue?
(apart from some small tweaks in CEFDemo.xcodeproj)

from cef.swift.

lvsti avatar lvsti commented on June 3, 2024

How UnderlayOpenGLHostingWindow works and what it does is an implementation detail that CEF.swift should not know/care about. If the framework states that browser windows should inherit from it, CEF.swift should make that possible, even if the class is just an empty subclass. So I'm leaving it there for now.

from cef.swift.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.