コード例 #1
0
 public WindowBaseImpl(GtkWindow gtkWidget)
 {
     GtkWidget = gtkWidget;
     Disposables.Add(gtkWidget);
     _framebuffer = new FramebufferManager(this);
     _imContext   = Native.GtkImMulticontextNew();
     Disposables.Add(_imContext);
     Native.GtkWidgetSetEvents(gtkWidget, 0xFFFFFE);
     Disposables.Add(Signal.Connect <Native.D.signal_commit>(_imContext, "commit", OnCommit));
     Connect <Native.D.signal_widget_draw>("draw", OnDraw);
     Connect <Native.D.signal_generic>("realize", OnRealized);
     ConnectEvent("configure-event", OnConfigured);
     ConnectEvent("button-press-event", OnButton);
     ConnectEvent("button-release-event", OnButton);
     ConnectEvent("motion-notify-event", OnMotion);
     ConnectEvent("scroll-event", OnScroll);
     ConnectEvent("window-state-event", OnStateChanged);
     ConnectEvent("key-press-event", OnKeyEvent);
     ConnectEvent("key-release-event", OnKeyEvent);
     ConnectEvent("leave-notify-event", OnLeaveNotifyEvent);
     Connect <Native.D.signal_generic>("destroy", OnDestroy);
     Native.GtkWidgetRealize(gtkWidget);
     _lastSize = ClientSize;
     GlibTimeout.Add(0, 16, () =>
     {
         Invalidate(default(Rect));
         return(true);
     });
     if (Gtk3Platform.UseDeferredRendering)
     {
         Native.GtkWidgetSetDoubleBuffered(gtkWidget, false);
         _gcHandle = GCHandle.Alloc(this);
         Native.GtkWidgetAddTickCallback(GtkWidget, PinnedStaticCallback, GCHandle.ToIntPtr(_gcHandle), IntPtr.Zero);
     }
 }
コード例 #2
0
        public WindowBaseImpl(GtkWindow gtkWidget)
        {
            GtkWidget    = gtkWidget;
            _framebuffer = new FramebufferManager(this);
            _imContext   = Native.GtkImMulticontextNew();
            Disposables.Add(_imContext);
            Native.GtkWidgetSetEvents(gtkWidget, 0xFFFFFE);
            Disposables.Add(Signal.Connect <Native.D.signal_commit>(_imContext, "commit", OnCommit));

            Disposables.Add(EventManager.ConnectEvents(this));

            Native.GtkWidgetRealize(gtkWidget);
            GdkWindowHandle = this.Handle.Handle;
            _lastSize       = ClientSize;
        }
コード例 #3
0
        public WindowBaseImpl(GtkWindow gtkWidget)
        {
            GtkWidget = gtkWidget;

            var glf = AvaloniaLocator.Current.GetService <IWindowingPlatformGlFeature>() as EglGlPlatformFeature;

            if (glf != null)
            {
                _egl = new EglGlPlatformSurface((EglDisplay)glf.Display, glf.DeferredContext, this);
            }
            else
            {
                _framebuffer = new FramebufferManager(this);
            }

            _imContext = Native.GtkImMulticontextNew();
            Disposables.Add(_imContext);
            Native.GtkWidgetSetEvents(gtkWidget, 0xFFFFFE);
            Disposables.Add(Signal.Connect <Native.D.signal_commit>(_imContext, "commit", OnCommit));
            Connect <Native.D.signal_widget_draw>("draw", OnDraw);
            Connect <Native.D.signal_generic>("realize", OnRealized);
            ConnectEvent("configure-event", OnConfigured);
            ConnectEvent("button-press-event", OnButton);
            ConnectEvent("button-release-event", OnButton);
            ConnectEvent("motion-notify-event", OnMotion);
            ConnectEvent("scroll-event", OnScroll);
            ConnectEvent("window-state-event", OnStateChanged);
            ConnectEvent("key-press-event", OnKeyEvent);
            ConnectEvent("key-release-event", OnKeyEvent);
            ConnectEvent("leave-notify-event", OnLeaveNotifyEvent);
            ConnectEvent("delete-event", OnClosingEvent);
            Connect <Native.D.signal_generic>("destroy", OnDestroy);
            Native.GtkWidgetRealize(gtkWidget);
            GdkWindowHandle = this.Handle.Handle;
            _lastSize       = ClientSize;

            if (_egl != null)
            {
                Native.GtkWidgetSetDoubleBuffered(gtkWidget, false);
            }
            else if (Gtk3Platform.UseDeferredRendering)
            {
                Native.GtkWidgetSetDoubleBuffered(gtkWidget, false);
                _gcHandle     = GCHandle.Alloc(this);
                _tickCallback = Native.GtkWidgetAddTickCallback(GtkWidget, PinnedStaticCallback,
                                                                GCHandle.ToIntPtr(_gcHandle), IntPtr.Zero);
            }
        }
コード例 #4
0
 public TopLevelImpl(GtkWindow gtkWidget)
 {
     GtkWidget = gtkWidget;
     Disposables.Add(gtkWidget);
     _framebuffer = new FramebufferManager(this);
     _imContext   = Native.GtkImMulticontextNew();
     Disposables.Add(_imContext);
     Native.GtkWidgetSetEvents(gtkWidget, 0xFFFFFE);
     Disposables.Add(Signal.Connect <Native.D.signal_commit>(_imContext, "commit", OnCommit));
     Connect <Native.D.signal_widget_draw>("draw", OnDraw);
     Connect <Native.D.signal_generic>("realize", OnRealized);
     ConnectEvent("configure-event", OnConfigured);
     ConnectEvent("button-press-event", OnButton);
     ConnectEvent("button-release-event", OnButton);
     ConnectEvent("motion-notify-event", OnMotion);
     ConnectEvent("scroll-event", OnScroll);
     ConnectEvent("window-state-event", OnStateChanged);
     ConnectEvent("key-press-event", OnKeyEvent);
     ConnectEvent("key-release-event", OnKeyEvent);
     Connect <Native.D.signal_generic>("destroy", OnDestroy);
     Native.GtkWidgetRealize(gtkWidget);
     _lastSize = ClientSize;
 }