chromelyapps / Chromely

Build Cross Platform HTML Desktop Apps on .NET using native GUI, HTML5, JavaScript, CSS, Owin, AspNetCore (MVC, RazorPages, Blazor)
MIT License
2.99k stars 279 forks source link

The content of Main window is not responsive after custom CefLifeSpanHandler #364

Closed hungle9320 closed 2 years ago

hungle9320 commented 2 years ago

I need to display popup then I have create a custom public class CustomCefLifeSpanHandler : CefLifeSpanHandler { }

services.AddSingleton<CefLifeSpanHandler, CustomCefLifeSpanHandler>();

After this, the pop up can populate at expected size and responsive but the main window content is now fixed at default 1200x900, It cannot responsive when I resize the browser. And the popup cannot request to the cef-controller.

Are there any fix for this?

Thanks

mattkol commented 2 years ago

@hungle9320 could this be because the popup is shown as a dialog? It will be difficult to understand without some code. Do you have like a skeletal code to attach?

wyattcdavis commented 1 year ago

@mattkol I'm seeing the same issue. It can be easily replicated by modifying the CrossPlatDemo. Just register a custom handler in the DemoApp class. It doesn't have to do anything. Afterwards if you resize the chromely app the content inside does not resize correctly anymore.

public class DemoApp : ChromelyBasicApp { public override void ConfigureServices(IServiceCollection services) { base.ConfigureServices(services); services.AddLogging(configure => configure.AddConsole()); services.AddLogging(configure => configure.AddFile("Logs/serilog-{Date}.txt"));

        services.AddSingleton<CefLifeSpanHandler, CustomHandler>();

        RegisterControllerAssembly(services, typeof(DemoApp).Assembly);
    }

    public class CustomHandler : CefLifeSpanHandler
    {
        protected override bool OnBeforePopup(CefBrowser browser, CefFrame frame, string targetUrl, string targetFrameName,
            CefWindowOpenDisposition targetDisposition, bool userGesture, CefPopupFeatures popupFeatures,
            CefWindowInfo windowInfo, ref CefClient client, CefBrowserSettings settings, ref CefDictionaryValue extraInfo,
            ref bool noJavascriptAccess)
        {
            return base.OnBeforePopup(browser, frame, targetUrl, targetFrameName, targetDisposition, userGesture, popupFeatures, windowInfo, ref client, settings, ref extraInfo, ref noJavascriptAccess);
        }
    }
}

Capture