Example #1
0
        public static Window CreateWindow(string title)
        {
            Window window = new Window(title);

            window.SetIconFromFile(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "icon.ico"));
            InteropLinux.SetDefaultWindowVisual(window.Handle);
            return(window);
        }
Example #2
0
        public void Show(int x, int y)
        {
            if (!isShown)
            {
                initialX = x;
                initialY = y;
                window.ShowAll();
                return;
            }

            var xid        = InteropLinux.gdk_x11_window_get_xid(InteropLinux.gtk_widget_get_window(window.Handle));
            var windowInfo = CefWindowInfo.Create();

            windowInfo.SetAsChild(xid, new CefRectangle(0, 0, window.AllocatedWidth, window.AllocatedHeight));
            host.ShowDevTools(windowInfo, new DummyClient(), new CefBrowserSettings(), new CefPoint(x, y));
            window.Present();
        }
Example #3
0
        private static void Main(string[] args)
        {
            using var runtime = new Runtime(new CefSettings
            {
                MultiThreadedMessageLoop = false,
                LogSeverity                = CefLogSeverity.Fatal,
                LogFile                    = string.Format("logs_{0:yyyyMMdd}.log", DateTime.Now),
                RemoteDebuggingPort        = 20480,
                LocalesDirPath             = Path.Combine(Environment.CurrentDirectory, "locales"),
                BrowserSubprocessPath      = Path.Combine(Environment.CurrentDirectory, "cefsimple"),
                ResourcesDirPath           = Path.Combine(Environment.CurrentDirectory),
                NoSandbox                  = true,
                BackgroundColor            = new CefColor(0, 0, 0, 0),
                WindowlessRenderingEnabled = true,
                ExternalMessagePump        = false,
                Locale = "en-US",
                CommandLineArgsDisabled = false,
            }, new[]
            {
                "--headless",
                "--disable-gpu"
            });
            runtime.Initialize();

            Application.Init();

            using var window = new Window("Lunixo Example")
                  {
                      WidthRequest  = 1200,
                      HeightRequest = 800
                  };

            window.Destroyed += (sender, args) => runtime.QuitMessageLoop();
            InteropLinux.SetDefaultWindowVisual(window.Handle);

            using var webView = new WebView();
            webView.LoadUrl("https://dotnet.microsoft.com/");
            webView.Browser.TitleChanged        += (sender, eventArgs) => { Console.WriteLine("TitleChanged: " + eventArgs.Title); };
            webView.Browser.LoadingStateChanged += (sender, eventArgs) => { Console.WriteLine("Loading: " + eventArgs.Loading); };

            window.Add(webView);
            window.ShowAll();

            runtime.RunMessageLoop();
        }
Example #4
0
        static void Main()
        {
            using var runtime = new Runtime();
            runtime.Initialize();
            Gtk.Application.Init();

            using var window = new Gtk.Window("ChromiumGTK Demo")
                  {
                      WidthRequest  = 1200,
                      HeightRequest = 800
                  };

            window.Destroyed += (sender, args) => runtime.QuitMessageLoop();
            InteropLinux.SetDefaultWindowVisual(window.Handle);

            using var webView = new WebView();
            webView.LoadUrl("https://dotnet.microsoft.com/");

            window.Add(webView);
            window.ShowAll();

            runtime.RunMessageLoop();
        }