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

[E-devel] e_border patch for having title change events



Hi,
I´m currently working on a taskbar which of course needs to be informaed
when border titles change. I hope this patch is ok, it works just like
the icon change event.  

Regards,
Hannes
? border-title-change.patch
Index: e_border.c
===================================================================
RCS file: /var/cvs/e/e17/apps/e/src/bin/e_border.c,v
retrieving revision 1.519
diff -u -r1.519 e_border.c
--- e_border.c	29 Jul 2006 15:09:53 -0000	1.519
+++ e_border.c	3 Aug 2006 14:45:18 -0000
@@ -67,6 +67,8 @@
 static void _e_border_event_border_desk_set_free(void *data, void *ev);
 static void _e_border_event_border_stack_free(void *data, void *ev);
 static void _e_border_event_border_icon_change_free(void *data, void *ev);
+static void _e_border_title_change(E_Border *border, char* title);
+static void _e_border_event_border_title_change_free(void *data, void *ev);
 static void _e_border_event_border_focus_in_free(void *data, void *ev);
 static void _e_border_event_border_focus_out_free(void *data, void *ev);
 static void _e_border_event_border_resize_free(void *data, void *ev);
@@ -129,6 +131,7 @@
 EAPI int E_EVENT_BORDER_UNSTICK = 0;
 EAPI int E_EVENT_BORDER_STACK = 0;
 EAPI int E_EVENT_BORDER_ICON_CHANGE = 0;
+EAPI int E_EVENT_BORDER_TITLE_CHANGE = 0;
 EAPI int E_EVENT_BORDER_FOCUS_IN = 0;
 EAPI int E_EVENT_BORDER_FOCUS_OUT = 0;
 
@@ -181,6 +184,7 @@
    E_EVENT_BORDER_UNSTICK = ecore_event_type_new();
    E_EVENT_BORDER_STACK = ecore_event_type_new();
    E_EVENT_BORDER_ICON_CHANGE = ecore_event_type_new();
+   E_EVENT_BORDER_TITLE_CHANGE = ecore_event_type_new();
    E_EVENT_BORDER_FOCUS_IN = ecore_event_type_new();
    E_EVENT_BORDER_FOCUS_OUT = ecore_event_type_new();
 
@@ -4686,8 +4690,7 @@
 	bd->client.icccm.fetch.title = 0;
 	if (bd->bg_object)
 	  {
-	     edje_object_part_text_set(bd->bg_object, "title_text",
-				       bd->client.icccm.title);
+	  	_e_border_title_change(bd, bd->client.icccm.title);
 	  }
      }
    if (bd->client.netwm.fetch.name)
@@ -4698,8 +4701,7 @@
 	bd->client.netwm.fetch.name = 0;
 	if (bd->bg_object)
 	  {
-	     edje_object_part_text_set(bd->bg_object, "title_text",
-				       bd->client.netwm.name);
+	    _e_border_title_change(bd, bd->client.netwm.name);
 	  }
      }
    if (bd->client.icccm.fetch.name_class)
@@ -5364,11 +5366,10 @@
 		    }
 
 		  if (bd->client.netwm.name)
-		    edje_object_part_text_set(o, "title_text",
-					      bd->client.netwm.name);
+		    _e_border_title_change(bd, bd->client.netwm.name);
 		  else if (bd->client.icccm.title)
-		    edje_object_part_text_set(o, "title_text",
-					      bd->client.icccm.title);
+		    _e_border_title_change(bd, bd->client.icccm.title);
+
 		  evas_object_resize(o, 1000, 1000);
 		  edje_object_calc_force(o);
 		  edje_object_part_geometry_get(o, "client", &cx, &cy, &cw, &ch);
@@ -6542,6 +6547,31 @@
    free(e);
 }
 
+
+static void _e_border_title_change(E_Border *bd, char* title)
+{
+	
+   edje_object_part_text_set(bd->bg_object, "title_text",
+				       title);
+   E_Event_Border_Title_Change *ev;
+   ev = calloc(1, sizeof(E_Event_Border_Title_Change));
+   ev->border = bd;
+   e_object_ref(E_OBJECT(bd));
+   //e_object_breadcrumb_add(E_OBJECT(bd), "border_title_change_event"); //hm, for which hungry duck might this be ?
+   ecore_event_add(E_EVENT_BORDER_TITLE_CHANGE, ev,
+	  _e_border_event_border_title_change_free, NULL);
+}
+
+static void
+_e_border_event_border_title_change_free(void *data, void *ev)
+{
+   E_Event_Border_Title_Change *e;
+
+   e = ev;
+   e_object_unref(E_OBJECT(e->border));
+   free(e);
+}
+
 static void
 _e_border_event_border_focus_in_free(void *data, void *ev)
 {
Index: e_border.h
===================================================================
RCS file: /var/cvs/e/e17/apps/e/src/bin/e_border.h,v
retrieving revision 1.146
diff -u -r1.146 e_border.h
--- e_border.h	17 Jul 2006 19:04:01 -0000	1.146
+++ e_border.h	3 Aug 2006 14:45:19 -0000
@@ -87,6 +87,7 @@
 typedef struct _E_Event_Border_Desk_Set      E_Event_Border_Desk_Set;
 typedef struct _E_Event_Border_Stack         E_Event_Border_Stack;
 typedef struct _E_Event_Border_Icon_Change   E_Event_Border_Icon_Change;
+typedef struct _E_Event_Border_Title_Change   E_Event_Border_Title_Change;
 typedef struct _E_Event_Border_Focus_In	     E_Event_Border_Focus_In;
 typedef struct _E_Event_Border_Focus_Out     E_Event_Border_Focus_Out;
 
@@ -525,6 +526,11 @@
    E_Border *border;
 };
 
+struct _E_Event_Border_Title_Change
+{
+   E_Border *border;
+};
+
 struct _E_Event_Border_Focus_In
 {
    E_Border *border;
@@ -626,6 +632,7 @@
 extern EAPI int E_EVENT_BORDER_DESK_SET;
 extern EAPI int E_EVENT_BORDER_STACK;
 extern EAPI int E_EVENT_BORDER_ICON_CHANGE;
+extern EAPI int E_EVENT_BORDER_TITLE_CHANGE;
 extern EAPI int E_EVENT_BORDER_FOCUS_IN;
 extern EAPI int E_EVENT_BORDER_FOCUS_OUT;