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



commit 4bcd728088670f31d2950994b53e528a70fa2f61
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     |   14 ++++++++++----
 2 files changed, 35 insertions(+), 4 deletions(-)
---
diff --git a/retro-gtk/retro-core-view-extern.c b/retro-gtk/retro-core-view-extern.c
index 76c6694..fa9ee02 100644
--- a/retro-gtk/retro-core-view-extern.c
+++ b/retro-gtk/retro-core-view-extern.c
@@ -381,3 +381,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..2161756 100644
--- a/retro-gtk/retro-core-view.vala
+++ b/retro-gtk/retro-core-view.vala
@@ -1,6 +1,9 @@
 // This file is part of retro-gtk. License: GPL-3.0+.
 
 public class Retro.CoreView : Gtk.EventBox {
+       private Binding pixbuf_binding;
+       public Gdk.Pixbuf pixbuf { set; get; }
+
        private bool _can_grab_pointer;
        public bool can_grab_pointer {
                set {
@@ -46,6 +49,10 @@ public class Retro.CoreView : Gtk.EventBox {
 
                audio_player = new PaPlayer ();
 
+               pixbuf_binding = display.bind_property ("pixbuf", this, "pixbuf",
+                                                       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 +78,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]