diff src/aosd/ghosd-main.c @ 590:6584e697e6da trunk

[svn] - aosd: extended ghosd source with ghosd_set_event_button_cb to capture and handle button events in osd
author giacomo
date Wed, 31 Jan 2007 11:50:36 -0800
parents f574c2c52beb
children 443de962d0a0
line wrap: on
line diff
--- a/src/aosd/ghosd-main.c	Wed Jan 31 09:39:22 2007 -0800
+++ b/src/aosd/ghosd-main.c	Wed Jan 31 11:50:36 2007 -0800
@@ -1,5 +1,8 @@
 /* ghosd -- OSD with fake transparency, cairo, and pango.
  * Copyright (C) 2006 Evan Martin <martine@danga.com>
+ *
+ * With further development by Giacomo Lozito <james@develia.org>
+ * for the ghosd-based Audacious OSD
  */
 
 #include "config.h"
@@ -12,6 +15,7 @@
 #include <time.h>
 #include <unistd.h>
 #include <errno.h>
+#include <gdk/gdk.h>
 
 #include "ghosd.h"
 #include "ghosd-internal.h"
@@ -47,6 +51,21 @@
       }
     }
     break;
+  case ButtonPress:
+    /* create a GhosdEventButton event and pass it to callback function */
+    if ( ghosd->eventbutton.func != NULL )
+    {
+      GhosdEventButton gevb;
+      gevb.x = ev.xbutton.x;
+      gevb.y = ev.xbutton.y;
+      gevb.x_root = ev.xbutton.x_root;
+      gevb.y_root = ev.xbutton.y_root;
+      gevb.button = ev.xbutton.button;
+      gevb.send_event = ev.xbutton.send_event;
+      gevb.time = ev.xbutton.time;
+      ghosd->eventbutton.func( ghosd , &gevb , ghosd->eventbutton.data );
+    }
+    break;
   }
 }