예제 #1
0
 /// <summary>
 /// The platform quit message loop.
 /// </summary>
 protected override void QuitMessageLoop()
 {
     if (CefRuntime.Platform == CefRuntimePlatform.Windows)
     {
         GtkNativeMethods.Quit();
     }
     else
     {
         CefRuntime.QuitMessageLoop();
     }
 }
예제 #2
0
        /// <summary>
        /// The get size.
        /// </summary>
        /// <param name="width">
        /// The width.
        /// </param>
        /// <param name="height">
        /// The height.
        /// </param>
        protected virtual void GetSize(out int width, out int height)
        {
            width  = 0;
            height = 0;

            if (mMainWindow == IntPtr.Zero)
            {
                return;
            }

            GtkNativeMethods.GetWindowSize(Host, out width, out height);
        }
예제 #3
0
 /// <summary>
 /// The platform run message loop.
 /// </summary>
 protected override void RunMessageLoop()
 {
     if (CefRuntime.Platform == CefRuntimePlatform.Windows)
     {
         /* run the GTK+ main loop */
         GtkNativeMethods.Run();
     }
     else
     {
         CefRuntime.RunMessageLoop();
     }
 }
예제 #4
0
        /// <summary>
        /// The on browser created.
        /// </summary>
        /// <param name="sender">
        /// The sender.
        /// </param>
        /// <param name="e">
        /// The e.
        /// </param>
        private void OnBrowserCreated(object sender, EventArgs e)
        {
            mBrowserWindowHandle = mBrowser.CefBrowser.GetHost().GetWindowHandle();
            if (CefRuntime.Platform == CefRuntimePlatform.Windows)
            {
                if (mBrowserWindowHandle != IntPtr.Zero)
                {
                    // ReSharper disable once InlineOutVariableDeclaration
                    int width;
                    // ReSharper disable once InlineOutVariableDeclaration
                    int height;
                    GetSize(out width, out height);

                    GtkNativeMethods.SetWindowPos(mBrowserWindowHandle, IntPtr.Zero, 0, 0, width, height);
                }
            }
        }
예제 #5
0
        /// <summary>
        /// The on resize.
        /// </summary>
        /// <param name="sender">
        /// The sender.
        /// </param>
        /// <param name="e">
        /// The e.
        /// </param>
        protected override void OnResize(object sender, EventArgs e)
        {
            if (CefRuntime.Platform == CefRuntimePlatform.Windows)
            {
                if (mBrowserWindowHandle != IntPtr.Zero)
                {
                    // ReSharper disable once InlineOutVariableDeclaration
                    int width;
                    // ReSharper disable once InlineOutVariableDeclaration
                    int height;
                    GetSize(out width, out height);

                    GtkNativeMethods.SetWindowPos(mBrowserWindowHandle, IntPtr.Zero, 0, 0, width, height);
                }
            }
            else
            {
                base.OnResize(sender, e);
            }
        }
예제 #6
0
        /// <summary>
        /// The create window.
        /// </summary>
        private void CreateWindow()
        {
            var wndType = mHostConfig.HostFrameless
                ? GtkNativeMethods.GtkWindowType.GtkWindowPopup
                : GtkNativeMethods.GtkWindowType.GtkWindowToplevel;

            mMainWindow = GtkNativeMethods.NewWindow(wndType);
            GtkNativeMethods.SetTitle(mMainWindow, mHostConfig.HostTitle);

            GtkNativeMethods.SetIconFromFile(mMainWindow, mHostConfig.HostIconFile);

            GtkNativeMethods.SetSizeRequest(mMainWindow, mHostConfig.HostWidth, mHostConfig.HostHeight);

            if (mHostConfig.HostCenterScreen)
            {
                GtkNativeMethods.SetWindowPosition(mMainWindow, GtkNativeMethods.GtkWindowPosition.GtkWinPosCenter);
            }

            switch (mHostConfig.HostState)
            {
            case WindowState.Normal:
                break;

            case WindowState.Maximize:
                GtkNativeMethods.SetWindowMaximize(mMainWindow);
                break;

            case WindowState.Fullscreen:
                GtkNativeMethods.SetFullscreen(mMainWindow);
                break;
            }

            GtkNativeMethods.AddConfigureEvent(mMainWindow);

            Realized += OnRealized;
            Resized  += OnResize;
            Exited   += OnExit;

            GtkNativeMethods.ShowAll(mMainWindow);
        }
예제 #7
0
 /// <summary>
 /// The platform initialize.
 /// </summary>
 protected override void Initialize()
 {
     GtkNativeMethods.InitWindow(0, null);
 }
예제 #8
0
 /// <summary>
 /// The on exit.
 /// </summary>
 /// <param name="sender">
 /// The sender.
 /// </param>
 /// <param name="e">
 /// The e.
 /// </param>
 protected virtual void OnExit(object sender, EventArgs e)
 {
     GtkNativeMethods.Quit();
 }
예제 #9
0
 /// <summary>
 /// The on resize.
 /// </summary>
 /// <param name="sender">
 /// The sender.
 /// </param>
 /// <param name="e">
 /// The e.
 /// </param>
 protected virtual void OnResize(object sender, EventArgs e)
 {
     GetSize(out var width, out var height);
     GtkNativeMethods.SetWindowSize(Host, width, height);
 }
예제 #10
0
 /// <summary>
 /// The resize host.
 /// </summary>
 /// <param name="host">
 /// The host.
 /// </param>
 /// <param name="width">
 /// The width.
 /// </param>
 /// <param name="height">
 /// The height.
 /// </param>
 public virtual void ResizeHost(IntPtr host, int width, int height)
 {
     GtkNativeMethods.SetWindowSize(host, width, height);
 }