Exemplo n.º 1
0
        public ImageSurfaceFramebuffer(WindowBaseImpl impl, int width, int height, int factor)
        {
            _impl    = impl;
            _widget  = impl.GtkWidget;
            _factor  = factor;
            width   *= _factor;
            height  *= _factor;
            _surface = new ManagedCairoSurface(width, height);

            Size     = new PixelSize(width, height);
            Address  = _surface.Buffer;
            RowBytes = _surface.Stride;
            Native.CairoSurfaceFlush(_surface.Surface);
        }
        public ImageSurfaceFramebuffer(WindowBaseImpl impl, int width, int height, int factor)
        {
            _impl    = impl;
            _widget  = impl.GtkWidget;
            _factor  = factor;
            width   *= _factor;
            height  *= _factor;
            _surface = Native.CairoImageSurfaceCreate(1, width, height);

            Width    = width;
            Height   = height;
            Address  = Native.CairoImageSurfaceGetData(_surface);
            RowBytes = Native.CairoImageSurfaceGetStride(_surface);
            Native.CairoSurfaceFlush(_surface);
        }
Exemplo n.º 3
0
        private static WindowBaseImpl FilterImplementationThroughModal(WindowBaseImpl impl, bool ignoreModal = false)
        {
            var index = windowStack.IndexOf(impl);

            if (modalStack.Any())
            {
                var modal      = modalStack.LastOrDefault();
                var modalIndex = windowStack.IndexOf(modal);
                if (modalIndex > index && !ignoreModal)
                {
                    return(null);
                }
            }

            return(impl);
        }
Exemplo n.º 4
0
        internal static IDisposable ConnectEvents(WindowBaseImpl impl)
        {
            var subscription = new EventSubscription(impl.GtkWidget);
            var userData     = impl.GtkWidget.DangerousGetHandle();

            subscription.Connect <Native.D.signal_widget_draw>("draw", OnDraw, userData);
            subscription.Connect <Native.D.signal_generic>("realize", OnRealized, userData);
            subscription.Connect <Native.D.signal_generic>("destroy", OnDestroy, userData);
            subscription.Connect <Native.D.signal_generic>("show", OnShown, userData);

            subscription.ConnectEvent("configure-event", OnConfigured);
            subscription.ConnectEvent("button-press-event", OnButton);
            subscription.ConnectEvent("button-release-event", OnButton);
            subscription.ConnectEvent("motion-notify-event", OnMotion);
            subscription.ConnectEvent("scroll-event", OnScroll);
            subscription.ConnectEvent("window-state-event", OnStateChanged);
            subscription.ConnectEvent("key-press-event", OnKeyEvent);
            subscription.ConnectEvent("key-release-event", OnKeyEvent);
            subscription.ConnectEvent("leave-notify-event", OnLeaveNotifyEvent);
            subscription.ConnectEvent("delete-event", OnClosingEvent);

            if (Gtk3Platform.UseDeferredRendering)
            {
                Native.GtkWidgetSetDoubleBuffered(impl.GtkWidget, false);
                subscription.AddTickCallback(userData);
            }

            windowStack.Add(impl);

            if (!modalStack.Any())
            {
                modalStack.Add(impl);
            }
            else
            {
                var lastModal = modalStack.Last();
                if (!lastModal.GtkWidget.IsInvalid)
                {
                    Native.GtkWindowSetTransientFor(impl.GtkWidget, lastModal.GtkWidget);
                }
            }

            return(subscription);
        }
Exemplo n.º 5
0
 public FramebufferManager(WindowBaseImpl window)
 {
     _window = window;
 }
Exemplo n.º 6
0
 internal static void EnterModal(WindowBaseImpl impl)
 {
     modalStack.Add(impl);
 }