[retro-gtk/core-view: 3/4] core-view: Handle the display internaly



commit cf0c3890f72c409b8d1c77b651bdbae766ad3a79
Author: Adrien Plazas <kekun plazas laposte net>
Date:   Mon Sep 11 09:47:34 2017 +0200

    core-view: Handle the display internaly
    
    Add methods to CoreView to control the display rather than exposing it
    via an accessor. This will give more control over the display to
    CoreView and will allow to make the display private.

 retro-gtk/retro-core-view-extern.c |   25 +++++++++++++++++++++++++
 retro-gtk/retro-core-view.vala     |   18 ++++++++++++++----
 2 files changed, 39 insertions(+), 4 deletions(-)
---
diff --git a/retro-gtk/retro-core-view-extern.c b/retro-gtk/retro-core-view-extern.c
index c6614ff..089eaaf 100644
--- a/retro-gtk/retro-core-view-extern.c
+++ b/retro-gtk/retro-core-view-extern.c
@@ -390,3 +390,28 @@ retro_core_view_as_input_device (RetroCoreView   *self,
 
   return RETRO_INPUT_DEVICE (retro_core_view_input_device_new (self, device_type));
 }
+
+void
+retro_core_view_set_filter (RetroCoreView    *self,
+                            RetroVideoFilter  filter)
+{
+  g_return_val_if_fail (self != NULL, NULL);
+
+  retro_cairo_display_set_filter (self->display, filter);
+}
+
+void
+retro_core_view_show_video (RetroCoreView *self)
+{
+  g_return_val_if_fail (self != NULL, NULL);
+
+  retro_cairo_display_show_video (self->display);
+}
+
+void
+retro_core_view_hide_video (RetroCoreView *self)
+{
+  g_return_val_if_fail (self != NULL, NULL);
+
+  retro_cairo_display_hide_video (self->display);
+}
diff --git a/retro-gtk/retro-core-view.vala b/retro-gtk/retro-core-view.vala
index 8af89ca..dc3fd9b 100644
--- a/retro-gtk/retro-core-view.vala
+++ b/retro-gtk/retro-core-view.vala
@@ -1,6 +1,10 @@
 // This file is part of retro-gtk. License: GPL-3.0+.
 
 public class Retro.CoreView : Gtk.EventBox {
+       private Binding pixbuf_binding;
+       private Binding sensitive_binding;
+       public Gdk.Pixbuf pixbuf { set; get; }
+
        private bool _can_grab_pointer;
        public bool can_grab_pointer {
                set {
@@ -46,6 +50,13 @@ public class Retro.CoreView : Gtk.EventBox {
 
                audio_player = new PaPlayer ();
 
+               pixbuf_binding = display.bind_property ("pixbuf", this, "pixbuf",
+                                                       BindingFlags.BIDIRECTIONAL |
+                                                       BindingFlags.SYNC_CREATE);
+               sensitive_binding = bind_property ("sensitive", display, "sensitive",
+                                                  BindingFlags.BIDIRECTIONAL |
+                                                  BindingFlags.SYNC_CREATE);
+
                key_state = new HashTable<uint?, bool?> (int_hash, int_equal);
                mouse_button_state = new HashTable<uint?, bool?> (int_hash, int_equal);
 
@@ -71,10 +82,9 @@ public class Retro.CoreView : Gtk.EventBox {
                }
        }
 
-       public CairoDisplay get_display () {
-               return display;
-       }
-
+       public extern void set_filter (VideoFilter filter) ;
+       public extern void show_video ();
+       public extern void hide_video ();
        public extern InputDevice as_input_device (DeviceType device_type);
        internal extern int16 get_input_state (DeviceType device, uint index, uint id);
        internal extern uint64 get_device_capabilities ();


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]