changeset 907:f20ca9b8cd7d trunk

[svn] aosd: added some more error checking
author giacomo
date Sun, 01 Apr 2007 11:36:52 -0700
parents 16e51fb5908e
children 8b4b381b4399
files ChangeLog src/aosd/aosd_osd.c src/aosd/ghosd.c
diffstat 3 files changed, 60 insertions(+), 24 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Sat Mar 31 17:44:23 2007 -0700
+++ b/ChangeLog	Sun Apr 01 11:36:52 2007 -0700
@@ -1,3 +1,20 @@
+2007-04-01 00:44:23 +0000  Giacomo Lozito <james@develia.org>
+  revision [1912]
+  - aosd: beta4, ghosd source was rewritten to support argb visual (x composite extension) as an option, this allows to have real transparency in the OSD
+  trunk/src/aosd/aosd.c           |    2 
+  trunk/src/aosd/aosd_cfg.c       |   10 ++
+  trunk/src/aosd/aosd_cfg.h       |   14 +++
+  trunk/src/aosd/aosd_common.h    |    2 
+  trunk/src/aosd/aosd_osd.c       |    9 +-
+  trunk/src/aosd/aosd_osd.h       |    2 
+  trunk/src/aosd/aosd_ui.c        |   72 +++++++++++++++-
+  trunk/src/aosd/ghosd-internal.h |    9 ++
+  trunk/src/aosd/ghosd-main.c     |    3 
+  trunk/src/aosd/ghosd.c          |  176 +++++++++++++++++++++++++++++++++-------
+  trunk/src/aosd/ghosd.h          |    4 
+  11 files changed, 261 insertions(+), 42 deletions(-)
+
+
 2007-03-31 13:40:00 +0000  William Pitcock <nenolod@sacredspiral.co.uk>
   revision [1910]
   - for security reasons, do not try all of the players (only check extension)
--- a/src/aosd/aosd_osd.c	Sat Mar 31 17:44:23 2007 -0700
+++ b/src/aosd/aosd_osd.c	Sun Apr 01 11:36:52 2007 -0700
@@ -380,42 +380,56 @@
 gint
 aosd_osd_display ( gchar * markup_string , aosd_cfg_osd_t * cfg_osd , gboolean copy_cfg )
 {
-  if ( osd_status == AOSD_STATUS_HIDDEN )
+  if ( osd != NULL )
   {
-    aosd_osd_data_alloc( markup_string , cfg_osd , copy_cfg );
-    aosd_osd_create();
-    osd_status = AOSD_STATUS_FADEIN;
-    osd_source_id = g_timeout_add_full( G_PRIORITY_DEFAULT_IDLE , AOSD_TIMING ,
-                                        aosd_timer_func , NULL , NULL );
+    if ( osd_status == AOSD_STATUS_HIDDEN )
+    {
+      aosd_osd_data_alloc( markup_string , cfg_osd , copy_cfg );
+      aosd_osd_create();
+      osd_status = AOSD_STATUS_FADEIN;
+      osd_source_id = g_timeout_add_full( G_PRIORITY_DEFAULT_IDLE , AOSD_TIMING ,
+                                          aosd_timer_func , NULL , NULL );
+    }
+    else
+    {
+      g_source_remove( osd_source_id ); /* remove timer */
+      osd_source_id = 0;
+      aosd_osd_hide();
+      aosd_osd_data_free();
+      osd_status = AOSD_STATUS_HIDDEN;
+      /* now display new OSD */
+      aosd_osd_data_alloc( markup_string , cfg_osd , copy_cfg );
+      aosd_osd_create();
+      osd_status = AOSD_STATUS_FADEIN;
+      osd_source_id = g_timeout_add_full( G_PRIORITY_DEFAULT_IDLE , AOSD_TIMING ,
+                                          aosd_timer_func , NULL , NULL );
+    }
+    return 0;
   }
   else
   {
-    g_source_remove( osd_source_id ); /* remove timer */
-    osd_source_id = 0;
-    aosd_osd_hide();
-    aosd_osd_data_free();
-    osd_status = AOSD_STATUS_HIDDEN;
-    /* now display new OSD */
-    aosd_osd_data_alloc( markup_string , cfg_osd , copy_cfg );
-    aosd_osd_create();
-    osd_status = AOSD_STATUS_FADEIN;
-    osd_source_id = g_timeout_add_full( G_PRIORITY_DEFAULT_IDLE , AOSD_TIMING ,
-                                        aosd_timer_func , NULL , NULL );
+    g_warning( "OSD display requested, but no osd object is loaded!\n" );
   }
-  return 0;
 }
 
 
 void
 aosd_osd_shutdown ( void )
 {
-  if (( osd != NULL ) && ( osd_status != AOSD_STATUS_HIDDEN )) /* osd is being displayed */
+  if ( osd != NULL )
   {
-    g_source_remove( osd_source_id ); /* remove timer */
-    osd_source_id = 0;
-    aosd_osd_hide();
-    aosd_osd_data_free();
-    osd_status = AOSD_STATUS_HIDDEN;
+    if ( osd_status != AOSD_STATUS_HIDDEN ) /* osd is being displayed */
+    {
+      g_source_remove( osd_source_id ); /* remove timer */
+      osd_source_id = 0;
+      aosd_osd_hide();
+      aosd_osd_data_free();
+      osd_status = AOSD_STATUS_HIDDEN;
+    }
+  }
+  else
+  {
+    g_warning( "OSD shutdown requested, but no osd object is loaded!\n" );
   }
   return;
 }
@@ -431,6 +445,9 @@
       osd = ghosd_new();
     else
       osd = ghosd_new_with_argbvisual();
+    
+    if ( osd == NULL )
+      g_warning( "Unable to load osd object; OSD will not work properly!\n" );
   }
   return;
 }
--- a/src/aosd/ghosd.c	Sat Mar 31 17:44:23 2007 -0700
+++ b/src/aosd/ghosd.c	Sun Apr 01 11:36:52 2007 -0700
@@ -384,6 +384,8 @@
   screen_num = DefaultScreen(dpy);
   root_win = RootWindow(dpy, screen_num);
   visual = find_argb_visual(dpy, screen_num);
+  if (visual == NULL)
+    return NULL;
   colormap = XCreateColormap(dpy, root_win, visual, AllocNone);
 
   win = make_window(dpy, root_win, visual, colormap, use_argbvisual);