Exemplo n.º 1
0
        public static void PopModal(this Window dialog)
        {
            if (windows.Count == 0)
            {
                return;
            }

            // Prevent double pop
            if (!ReferenceEquals(windows.Peek(), dialog))
            {
                return;
            }

            windows.Pop();
            dialog.FocusInEvent -= dialog_FocusInEvent;

            if (windows.Count == 0)
            {
                return;
            }

            Window parentWindow = windows.Peek();

            // Don't present intentially hidden windows (like the main form)
            if (!parentWindow.Visible)
            {
                return;
            }

            parentWindow.Sensitive = true;
            parentWindow.Present();
            parentWindow.GrabFocus();
        }
Exemplo n.º 2
0
        public void Render()
        {
            Gtk.Window parent = Toplevel as Gtk.Window;
            parent.Present();

            InitializeRenderer();

            Device.Gpu.Renderer.Initialize(_glLogLevel);

            _gpuVendorName = GetGpuVendorName();

            Device.Gpu.InitializeShaderCache();
            Translator.IsReadyForTranslation.Set();

            while (_isActive)
            {
                if (_isStopped)
                {
                    return;
                }

                _ticks += _chrono.ElapsedTicks;

                _chrono.Restart();

                if (Device.WaitFifo())
                {
                    Device.Statistics.RecordFifoStart();
                    Device.ProcessFrame();
                    Device.Statistics.RecordFifoEnd();
                }

                while (Device.ConsumeFrameAvailable())
                {
                    Device.PresentFrame(SwapBuffers);
                }

                if (_ticks >= _ticksPerFrame)
                {
                    string dockedMode = ConfigurationState.Instance.System.EnableDockedMode ? "Docked" : "Handheld";
                    float  scale      = Graphics.Gpu.GraphicsConfig.ResScale;
                    if (scale != 1)
                    {
                        dockedMode += $" ({scale}x)";
                    }

                    StatusUpdatedEvent?.Invoke(this, new StatusUpdatedEventArgs(
                                                   Device.EnableDeviceVsync,
                                                   dockedMode,
                                                   ConfigurationState.Instance.Graphics.AspectRatio.Value.ToText(),
                                                   $"Game: {Device.Statistics.GetGameFrameRate():00.00} FPS",
                                                   $"FIFO: {Device.Statistics.GetFifoPercent():0.00} %",
                                                   $"GPU: {_gpuVendorName}"));

                    _ticks = Math.Min(_ticks - _ticksPerFrame, _ticksPerFrame);
                }
            }
        }
Exemplo n.º 3
0
        public static void PresentWindowWithNotification(this Gtk.Window window)
        {
            window.Present();

            if (Platform.IsMac)
            {
                var dialog = window as Gtk.Dialog;
                MacRequestAttention(dialog == null? false : dialog.Modal);
            }
        }
Exemplo n.º 4
0
        public void Start()
        {
            _chrono.Restart();

            _isActive = true;

            Gtk.Window parent = Toplevel as Gtk.Window;

            Application.Invoke(delegate
            {
                parent.Present();

                string titleNameSection = string.IsNullOrWhiteSpace(Device.Application.TitleName) ? string.Empty
                    : $" - {Device.Application.TitleName}";

                string titleVersionSection = string.IsNullOrWhiteSpace(Device.Application.DisplayVersion) ? string.Empty
                    : $" v{Device.Application.DisplayVersion}";

                string titleIdSection = string.IsNullOrWhiteSpace(Device.Application.TitleIdText) ? string.Empty
                    : $" ({Device.Application.TitleIdText.ToUpper()})";

                string titleArchSection = Device.Application.TitleIs64Bit ? " (64-bit)" : " (32-bit)";

                parent.Title = $"Ryujinx {Program.Version}{titleNameSection}{titleVersionSection}{titleIdSection}{titleArchSection}";
            });

            Thread renderLoopThread = new Thread(Render)
            {
                Name = "GUI.RenderLoop"
            };

            renderLoopThread.Start();

            Thread nvStutterWorkaround = null;

            if (Renderer is Graphics.OpenGL.Renderer)
            {
                nvStutterWorkaround = new Thread(NVStutterWorkaround)
                {
                    Name = "GUI.NVStutterWorkaround"
                };
                nvStutterWorkaround.Start();
            }

            MainLoop();

            renderLoopThread.Join();
            nvStutterWorkaround?.Join();

            Exit();
        }
Exemplo n.º 5
0
        private static void dialog_FocusInEvent(object o, FocusInEventArgs args)
        {
            if (windows.Count == 0)
            {
                return;
            }

            Window top = windows.Peek();

            if (ReferenceEquals(top, o))
            {
                return;
            }

            top.Present();
            top.GrabFocus();
        }
Exemplo n.º 6
0
        static void Main(string[] args)
        {
            Application.Init();

            var window = new Gtk.Window("Example");

            var label = new Gtk.Label("Hello, World!");

            window.Add(label);
            label.Show();

            window.DeleteEvent += (win, ev) => {
                Application.Quit();
            };

            window.Present();
            Application.Run();
        }
Exemplo n.º 7
0
 public void Present(bool giveFocus)
 {
     if (dockBarItem != null)
     {
         dockBarItem.Present(Status == DockItemStatus.AutoHide || giveFocus);
     }
     else if (floatingWindow != null)
     {
         if (giveFocus)
         {
             floatingWindow.Present();
         }
         else
         {
             floatingWindow.Show();
         }
     }
     else
     {
         frame.Present(this, Status == DockItemStatus.AutoHide || giveFocus);
     }
 }
Exemplo n.º 8
0
    void on_button_take_photo_clicked(object o, EventArgs args)
    {
        List<LongoMatch.Video.Utils.Device> devices = LongoMatch.Video.Utils.Device.ListVideoDevices();
        if(devices.Count == 0) {
            new DialogMessage(Constants.MessageTypes.WARNING, Constants.CameraNotFound);
            return;
        }

        //deactivate camera to allow camera on edit person. videoOn will have same value to light checkbutton again later
        app1_checkbutton_video.Active = false;

        capturer = new CapturerBin();
        CapturePropertiesStruct s = new CapturePropertiesStruct();

        s.DeviceID = devices[0].ID;

        s.CaptureSourceType = CaptureSourceType.System;

        capturer.CaptureProperties = s;
        capturer.Type = CapturerType.Snapshot;
        capturer.Visible=true;
        capturer.NewSnapshot += on_snapshot_done;
        capturer.NewSnapshotMini += on_snapshot_mini_done;

        capturerWindow = new Gtk.Window("Capturer");
        capturerWindow.Add(capturer);
        capturerWindow.Modal=true;
        capturerWindow.SetDefaultSize(400,400);

        person_win.Hide();

        capturerWindow.ShowAll();
        capturerWindow.Present();
        capturerWindow.DeleteEvent += delegate(object sender, DeleteEventArgs e) {capturer.Close(); capturer.Dispose(); person_win.Show(); };

        capturer.Run();
    }
Exemplo n.º 9
0
    void on_button_take_photo_clicked(object o, EventArgs args)
    {
        capturer = new CapturerBin();
        CapturePropertiesStruct s = new CapturePropertiesStruct();

        s.CaptureSourceType = CaptureSourceType.Raw;

        capturer.CaptureProperties = s;
        capturer.Type = CapturerType.Snapshot;
        capturer.Visible=true;
        capturer.NewSnapshot += on_snapshot_done;
        capturer.NewSnapshotMini += on_snapshot_mini_done;

         		capturerWindow = new Gtk.Window("Capturer");
        capturerWindow.Add(capturer);
        capturerWindow.Modal=true;

        person_win.Hide();

        capturerWindow.ShowAll();
        capturerWindow.Present();
        capturerWindow.DeleteEvent += delegate(object sender, DeleteEventArgs e) {capturer.Close(); capturer.Dispose(); person_win.Show(); };
        capturer.Run();
    }
Exemplo n.º 10
0
        ////////////////////////////////////////////////////////////////////
        ///<summary>
        ///ThrowMessage receives a msg and show a window. 
        ///Is intended to show exception messages
        ///</summary>
        // FIXME: Draw a better interface with l10n messages
        public static void ThrowMessage(string Msg, string short_msg)
        {
            Gtk.Window msgwindow = new Gtk.Window("Exception");
                Gtk.VBox box = new Gtk.VBox(false, 0);
                Gtk.ScrolledWindow scrWin = new Gtk.ScrolledWindow();
                Gtk.TextView txtView = new Gtk.TextView();
                Gtk.TextBuffer buffer = txtView.Buffer;
                buffer.Text = "Critical exception: " + short_msg;
                buffer.Text += "\r\n \r\nReport for developers : " + Msg;
                Gtk.Button buttonAccept = new Button("Accept");
                Gtk.Button buttonExit = new Button("Exit");

                msgwindow.DeleteEvent += new DeleteEventHandler(OnDelete);
                buttonExit.Clicked += new EventHandler(OnDelete);
                msgwindow.DestroyEvent += new DestroyEventHandler(OnContinue);
                buttonAccept.Clicked += new EventHandler(OnContinue);
                msgwindow.Add(scrWin);
                scrWin.Add(txtView);
                box.Spacing = 20;
                box.PackStart(scrWin);
                box.PackStart(buttonExit);
                box.PackStart(buttonAccept);
                //txtView.Show();
                //buttonExit.Show();
                //box.Show();
                msgwindow.DefaultHeight = 300;
                msgwindow.DefaultWidth  = 600;
                msgwindow.SetPosition(WindowPosition.Center);
                msgwindow.ShowAll();
                msgwindow.Present();
        }
Exemplo n.º 11
0
 public ClientErrorMessages(string Msg)
 {
     try
     {
         msgwindow    = new Gtk.Window("Error");
         vbox         = new Gtk.VBox(false, 0);
         hbox         = new Gtk.HBox(true, 1);
         label			   = new Gtk.Label(Msg);
         buttonAccept = new Button("Aceptar");
         msgwindow.DeleteEvent += new DeleteEventHandler(OnDelete);
         msgwindow.DestroyEvent += new DestroyEventHandler(OnContinue);
         buttonAccept.Clicked += new EventHandler(OnContinue);
         msgwindow.Modal = true;
         msgwindow.Add(vbox);
         vbox.Spacing = 20;
         vbox.PackStart(label, false, false, 10);
         vbox.PackEnd(hbox, false, false, 10);
         hbox.PackEnd(buttonAccept, false, false, 10);
         //msgwindow.DefaultHeight = 150;
         //msgwindow.DefaultWidth  = 400;
         msgwindow.SetPosition(WindowPosition.Center);
         msgwindow.ShowAll();
         msgwindow.Present();
     }
     catch (Exception ex)
     {
         Console.WriteLine("Excepcion grave");
     }
 }