[Splashy-devel] 4b/6 Make simple interface for splashy_video.h

Tim Dijkstra newsuser at famdijkstra.org
Sat Aug 12 22:41:04 UTC 2006


[4/6 was to big for the list]
Remove "splashy_video_t * video" from the functions argument list,
make an instance of splashy_video_t local to splashy_video.c instead.
That way the rest of splashy doesn't have to know about splashy_video_t
at all. 


diff -u splashy_functions.c splashy_functions.c
--- splashy_functions.c	2006-08-12 14:20:00.000000000 +0200
+++ splashy_functions.c	2006-08-12 13:43:35.000000000 +0200
@@ -80,8 +80,6 @@
 static gint arg_progress = 0;   /* value to be sent to last_progress from
                                  * FIFO. @see keyevent_loop() */
 
-static splashy_video_t video;
-
 static gboolean exiting = FALSE;        /* threads should read this before
                                          * doing anything at all. this is set 
                                          * to true at cmd_exit() */
@@ -149,7 +147,7 @@
                 if (g_ascii_strncasecmp (fadeout, "yes", 3) == 0)
                 {
                         DEBUG_PRINT ("cmd_exit fadeout routine %s", "");
-                        video_fade_out (&video);
+                        video_fade_out ();
                 }
         }
 
@@ -176,7 +174,7 @@
 
         DEBUG_PRINT ("cmd_exit releasing memory %s", "");
 
-        video_stop_splash (&video);
+        video_stop_splash ();
 
         exit (0);
         return 0;               /* we never reach this */
@@ -200,7 +198,7 @@
         {
                 DEBUG_PRINT ("cmd_progress: Setting progressbar to %d ticks",
                              arg_progress);
-                video_update_progressbar (&video, arg_progress);
+                video_update_progressbar (arg_progress);
         }
 
         last_progress = arg_progress;
@@ -213,14 +211,14 @@
 gint
 cmd_print (void **args)
 {
-        video_printline (&video, args[0]);
+        video_printline (args[0]);
         return 0;
 }
 
 gint
 cmd_print_clear (void **args)
 {
-        video_printline (&video, "");
+        video_printline ("");
         return 0;
 }
 
@@ -257,7 +255,7 @@
          * TODO change background to current image 
          */
         /*
-         * video_printline (&video, ""); 
+         * video_printline (""); 
          */
         return 0;
 }
@@ -490,7 +488,7 @@
                 background =
                         _splashy_theme_image_path
                         (SPL_DEFAULT_THEME, "/splashy/background/errorimg");
-        video_change_splash (&video, background);
+        video_change_splash (background);
 
         /*
          * safe for future reference 
@@ -707,8 +705,7 @@
                                     || F2_toggle_pressed == TRUE)
                                 {
                                         if (!exiting)
-                                                video_printline_s (&video,
-                                                                   (char *)
+                                                video_printline_s ((char *)
                                                                    buf_str->
                                                                    str);
 
@@ -824,13 +821,12 @@
                                  * re-draw the image so that we can get our
                                  * progressbar filled 
                                  */
-                                video_change_splash (&video,
-                                                     _current_background);
+                                video_change_splash (_current_background);
                                 sched_yield ();
                                 nanosleep (&_sleep, NULL);
                         }
                         g_printerr ("Updating progressbar by %d+10\n", i);
-                        video_update_progressbar (&video, i += 10);
+                        video_update_progressbar (i += 10);
                         sched_yield ();
                         nanosleep (&_sleep, NULL);
                 }
@@ -962,13 +958,13 @@
                 /*
                  * sub-parent (we are a fork after all). init is our parent 
                  */
-                video_wait_for_event(&video);
+                video_wait_for_event();
 
                 /*
                  * get all events from our event buffer (fifo style) and
                  * process them. 
                  */
-                while (video_get_key_event (&video, &key))
+                while (video_get_key_event (&key))
                 {
                         /*
                          * exit if ESC or F2 is pressed also kill our
@@ -992,7 +988,7 @@
                                                 F2_toggle_pressed = TRUE;
                                                 show_textbox_area = TRUE;
                                                 /* now show the box */
-                                                video_printline_s (&video,"");
+                                                video_printline_s ("");
                                         }
                                         else
                                         {
@@ -1004,8 +1000,7 @@
                                                  * @see verbose_text_loop
                                                  * we need to re-draw the screen
                                                  */
-                                                video_change_splash (&video,
-                                                                     _current_background);
+                                                video_change_splash (_current_background);
                                         }
                                 }
                 }               /* ends while ev_buffer */
@@ -1172,7 +1167,7 @@
                 close (i);
         }
 
-        video_start_splash (&video, background);
+        video_start_splash (background);
         _current_background = background;       /* safe for future reference */
 
         if (show_progress == TRUE)
@@ -1181,7 +1176,7 @@
                  * starting bars stuff! 
                  */
                 DEBUG_PRINT ("_splashy_child() starting progressbar %s", "");
-                video_draw_progressbar (&video);
+                video_draw_progressbar ();
         }
 
         /*
@@ -1192,10 +1187,10 @@
          * Note that this won't actually show the text area until we print
          * to it. @see verbose_text_loop() and the create thread below
          */
-        video_start_text_area (&video);
+        video_start_text_area ();
 
         /* Maybe this can be moved to video_start_splash? */
-        video_create_event_buffer(&video);
+        video_create_event_buffer();
 
         /*
          * here is where the magic happens: because WaitForEvent*() waits idle

diff -u splashy_video.h splashy_video.h
--- splashy_video.h	2006-08-12 14:20:00.000000000 +0200
+++ splashy_video.h	2006-08-12 14:01:20.000000000 +0200
@@ -21,84 +21,43 @@
 #define _video_H
 
 #include <glib.h>
-#include <directfb.h>
-
-typedef struct splashy_videomode_s
-{
-        gint width;
-        gint height;
-        gint out_width;
-        gint out_height;
-        gint overx;
-        gint overy;
-        gint bpp;
-} splashy_videomode_t;
-
-typedef struct
-{
-        gboolean enabled;
-        IDirectFBSurface *offscreen;    /** off-screen storage */
-        IDirectFBSurface *surface;      /** Subsurface to draw text on */
-        DFBSurfaceDescription desc;
-        DFBRectangle area;
-        DFBFontDescription fontdesc;
-} splashy_textbox_t;
-
-typedef struct
-{
-        IDirectFB *dfb;                         /** our directfb object */
-        IDirectFBImageProvider *provider;       /** our image class */
-        IDirectFBWindow *primary_window;        /** our main window. where opacity takes place */
-        IDirectFBSurface *primary_window_surface; /** interface to window's surface */
-
-        IDirectFBDisplayLayer *primary_layer;   /** interface to our layer */
-        DFBDisplayLayerConfig  primary_layer_config; /** configuration for our primary_layer */
-        IDirectFBSurface *primary_surface;      /** our main background */
-        IDirectFBInputDevice *keyboard;         /** our main input dev */
-        IDirectFBEventBuffer *ev_buffer;        /** our events listener */
-        splashy_videomode_t *mode;              /** video mode supported by surface */
-        splashy_textbox_t *textbox;             /** text box parameters */
-        DFBRectangle progressbar;               /** our progressbar */
-        __u8 opacity;                           /** current opacity level */
-} splashy_video_t;
 
 /*
  * public functions 
  */
-void
-video_reset_progressbar_counters();
+void video_reset_progressbar_counters();
 void video_set_progressbar_forward(gboolean go_forward);
-gint video_draw_progressbar (splashy_video_t * video);
-gint video_update_progressbar (splashy_video_t * video, gint perc);
-void video_start_splash (splashy_video_t * video, const gchar * background);
-void video_change_splash (splashy_video_t * video, const gchar * newimage);
-void video_start_text_area (splashy_video_t * video);
-void video_set_mode (splashy_video_t * video);
+gint video_draw_progressbar ();
+gint video_update_progressbar (gint perc);
+void video_start_splash (const gchar * background);
+void video_change_splash (const gchar * newimage);
+void video_start_text_area ();
+void video_set_mode ();
 void video_allow_vt_switching ();
 /*
  * allows to print a single message to the center of the textbox area
  * reseting the old one
  */
-void video_printline (splashy_video_t * video, gchar * string);
+void video_printline (gchar * string);
 /*
  * allows to print a message appended to the end of the textbox area
  * keeping the old one
  */
-void video_printline_s (splashy_video_t * video, gchar * string);
+void video_printline_s (gchar * string);
 /* 
  * write data to our textbox the right way. it uses video_printline_s() to do
  * the actual writing. @see verbose_text_loop() in splashy_functions.c
  */
-void video_writelog (splashy_video_t * video, unsigned char *ptr, 
+void video_writelog (unsigned char *ptr, 
                 gint len, char *ringbuf, char *outptr, char *endptr);
 
-void video_fade_in (splashy_video_t * video);
-void video_fade_out (splashy_video_t * video);
+void video_fade_in ();
+void video_fade_out ();
 
-void video_stop_splash (splashy_video_t * video);
+void video_stop_splash ();
 
-void video_create_event_buffer (splashy_video_t * video);
-void video_wait_for_event (splashy_video_t * video);
-int video_get_key_event (splashy_video_t * video, int * key_id);
+void video_create_event_buffer ();
+void video_wait_for_event ();
+int video_get_key_event (int * key_id);
 
 #endif
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.alioth.debian.org/pipermail/splashy-devel/attachments/20060813/7f5beb93/signature.pgp


More information about the Splashy-devel mailing list