Enlightenment CVS committal
Author : rbdpngn
Project : e17
Module : libs/ecore
Dir : e17/libs/ecore/src/lib/ecore_x
Modified Files:
Ecore_X.h ecore_x.c ecore_x_events.c ecore_x_private.h
ecore_x_window_prop.c
Log Message:
Support WM_ICON_NAME and _NET_WM_ICON_NAME. Added test cases to ecore_test to
verify these are setting and retrieving the values as well as generating the
correct events.
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ecore/src/lib/ecore_x/Ecore_X.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -3 -r1.6 -r1.7
--- Ecore_X.h 12 Oct 2003 05:01:41 -0000 1.6
+++ Ecore_X.h 12 Oct 2003 06:25:25 -0000 1.7
@@ -102,6 +102,7 @@
typedef struct _Ecore_X_Event_Window_Delete_Request
Ecore_X_Event_Window_Delete_Request;
typedef struct _Ecore_X_Event_Window_Prop_Title_Change
Ecore_X_Event_Window_Prop_Title_Change;
typedef struct _Ecore_X_Event_Window_Prop_Visible_Title_Change
Ecore_X_Event_Window_Prop_Visible_Title_Change;
+typedef struct _Ecore_X_Event_Window_Prop_Icon_Name_Change
Ecore_X_Event_Window_Prop_Icon_Name_Change;
typedef struct _Ecore_X_Event_Window_Prop_Name_Class_Change
Ecore_X_Event_Window_Prop_Name_Class_Change;
struct _Ecore_X_Event_Key_Down
@@ -377,6 +378,13 @@
Ecore_X_Time time;
};
+struct _Ecore_X_Event_Window_Prop_Icon_Name_Change
+{
+ Ecore_X_Window win;
+ char *name;
+ Ecore_X_Time time;
+};
+
struct _Ecore_X_Event_Window_Prop_Name_Class_Change
{
Ecore_X_Window win;
@@ -422,6 +430,7 @@
extern int ECORE_X_EVENT_WINDOW_DELETE_REQUEST;
extern int ECORE_X_EVENT_WINDOW_PROP_TITLE_CHANGE;
extern int ECORE_X_EVENT_WINDOW_PROP_VISIBLE_TITLE_CHANGE;
+extern int ECORE_X_EVENT_WINDOW_PROP_ICON_NAME_CHANGE;
extern int ECORE_X_EVENT_WINDOW_PROP_NAME_CLASS_CHANGE;
extern int ECORE_X_MODIFIER_SHIFT;
@@ -504,6 +513,8 @@
char *ecore_x_window_prop_title_get(Ecore_X_Window win);
void ecore_x_window_prop_visible_title_set(Ecore_X_Window win, const char
*t);
char *ecore_x_window_prop_visible_title_get(Ecore_X_Window win);
+void ecore_x_window_prop_icon_name_set(Ecore_X_Window win, const char *t);
+char *ecore_x_window_prop_icon_name_get(Ecore_X_Window win);
void ecore_x_window_prop_name_class_set(Ecore_X_Window win, const char
*n, const char *c);
void ecore_x_window_prop_name_class_get(Ecore_X_Window win, char **n,
char **c);
void ecore_x_window_prop_protocol_set(Ecore_X_Window win,
Ecore_X_WM_Protocol protocol, int on);
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ecore/src/lib/ecore_x/ecore_x.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -3 -r1.7 -r1.8
--- ecore_x.c 12 Oct 2003 05:34:47 -0000 1.7
+++ ecore_x.c 12 Oct 2003 06:25:25 -0000 1.8
@@ -29,6 +29,7 @@
Atom _ecore_x_atom_wm_protocols = 0;
Atom _ecore_x_atom_wm_class = 0;
Atom _ecore_x_atom_wm_name = 0;
+Atom _ecore_x_atom_wm_icon_name = 0;
Atom _ecore_x_atom_motif_wm_hints = 0;
Atom _ecore_x_atom_win_layer = 0;
Atom _ecore_x_atom_net_wm_desktop = 0;
@@ -92,6 +93,7 @@
int ECORE_X_EVENT_WINDOW_PROP_TITLE_CHANGE = 0;
int ECORE_X_EVENT_WINDOW_PROP_VISIBLE_TITLE_CHANGE = 0;
int ECORE_X_EVENT_WINDOW_PROP_NAME_CLASS_CHANGE = 0;
+int ECORE_X_EVENT_WINDOW_PROP_ICON_NAME_CHANGE = 0;
int ECORE_X_MODIFIER_SHIFT = 0;
int ECORE_X_MODIFIER_CTRL = 0;
@@ -211,6 +213,7 @@
ECORE_X_EVENT_WINDOW_PROP_TITLE_CHANGE = ecore_event_type_new();
ECORE_X_EVENT_WINDOW_PROP_VISIBLE_TITLE_CHANGE = ecore_event_type_new();
ECORE_X_EVENT_WINDOW_PROP_NAME_CLASS_CHANGE = ecore_event_type_new();
+ ECORE_X_EVENT_WINDOW_PROP_ICON_NAME_CHANGE = ecore_event_type_new();
}
ECORE_X_MODIFIER_SHIFT = _ecore_x_key_mask_get(XK_Shift_L);
@@ -244,6 +247,7 @@
_ecore_x_atom_wm_protocols = XInternAtom(_ecore_x_disp, "WM_PROTOCOLS",
False);
_ecore_x_atom_wm_class = XInternAtom(_ecore_x_disp, "WM_CLASS",
False);
_ecore_x_atom_wm_name = XInternAtom(_ecore_x_disp, "WM_NAME",
False);
+ _ecore_x_atom_wm_icon_name = XInternAtom(_ecore_x_disp, "WM_ICON_NAME",
False);
_ecore_x_atom_motif_wm_hints = XInternAtom(_ecore_x_disp,
"_MOTIF_WM_HINTS", False);
_ecore_x_atom_win_layer = XInternAtom(_ecore_x_disp, "_WIN_LAYER",
False);
_ecore_x_atom_net_current_desktop = XInternAtom(_ecore_x_disp,
"_NET_CURRENT_DESKTOP", False);
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ecore/src/lib/ecore_x/ecore_x_events.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -3 -r1.5 -r1.6
--- ecore_x_events.c 12 Oct 2003 05:25:08 -0000 1.5
+++ ecore_x_events.c 12 Oct 2003 06:25:25 -0000 1.6
@@ -5,6 +5,7 @@
static void _ecore_x_event_free_window_prop_name_class_change(void *data, void *ev);
static void _ecore_x_event_free_window_prop_title_change(void *data, void *ev);
static void _ecore_x_event_free_window_prop_visible_title_change(void *data, void
*ev);
+static void _ecore_x_event_free_window_prop_icon_name_change(void *data, void *ev);
static void _ecore_x_event_free_key_down(void *data, void *ev);
static void _ecore_x_event_free_key_up(void *data, void *ev);
static void _ecore_x_event_free_generic(void *data, void *ev);
@@ -31,16 +32,6 @@
}
static void
-_ecore_x_event_free_window_prop_visible_title_change(void *data, void *ev)
-{
- Ecore_X_Event_Window_Prop_Visible_Title_Change *e;
-
- e = ev;
- if (e->title) free(e->title);
- free(e);
-}
-
-static void
_ecore_x_event_free_key_down(void *data, void *ev)
{
Ecore_X_Event_Key_Down *e;
@@ -65,6 +56,26 @@
}
static void
+_ecore_x_event_free_window_prop_icon_name_change(void *data, void *ev)
+{
+ Ecore_X_Event_Window_Prop_Icon_Name_Change *e;
+
+ e = ev;
+ if (e->name) free(e->name);
+ free(e);
+}
+
+static void
+_ecore_x_event_free_window_prop_visible_title_change(void *data, void *ev)
+{
+ Ecore_X_Event_Window_Prop_Visible_Title_Change *e;
+
+ e = ev;
+ if (e->title) free(e->title);
+ free(e);
+}
+
+static void
_ecore_x_event_free_generic(void *data, void *ev)
{
free(ev);
@@ -731,6 +742,15 @@
if (!e) return;
e->title = ecore_x_window_prop_visible_title_get(xevent->xproperty.window);
ecore_event_add(ECORE_X_EVENT_WINDOW_PROP_VISIBLE_TITLE_CHANGE, e,
_ecore_x_event_free_window_prop_visible_title_change, NULL);
+ }
+ else if ((xevent->xproperty.atom == _ecore_x_atom_wm_icon_name) ||
(xevent->xproperty.atom == _ecore_x_atom_net_wm_icon_name))
+ {
+ Ecore_X_Event_Window_Prop_Icon_Name_Change *e;
+
+ e = calloc(1, sizeof(Ecore_X_Event_Window_Prop_Icon_Name_Change));
+ if (!e) return;
+ e->name = ecore_x_window_prop_icon_name_get(xevent->xproperty.window);
+ ecore_event_add(ECORE_X_EVENT_WINDOW_PROP_ICON_NAME_CHANGE, e,
_ecore_x_event_free_window_prop_icon_name_change, NULL);
}
else
{
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ecore/src/lib/ecore_x/ecore_x_private.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -3 -r1.5 -r1.6
--- ecore_x_private.h 12 Oct 2003 05:34:47 -0000 1.5
+++ ecore_x_private.h 12 Oct 2003 06:25:25 -0000 1.6
@@ -56,6 +56,7 @@
extern Atom _ecore_x_atom_wm_protocols;
extern Atom _ecore_x_atom_wm_class;
extern Atom _ecore_x_atom_wm_name;
+extern Atom _ecore_x_atom_wm_icon_name;
extern Atom _ecore_x_atom_motif_wm_hints;
extern Atom _ecore_x_atom_win_layer;
extern Atom _ecore_x_atom_net_wm_desktop;
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ecore/src/lib/ecore_x/ecore_x_window_prop.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -3 -r1.8 -r1.9
--- ecore_x_window_prop.c 12 Oct 2003 05:34:47 -0000 1.8
+++ ecore_x_window_prop.c 12 Oct 2003 06:25:25 -0000 1.9
@@ -211,6 +211,40 @@
}
/**
+ * Set a window icon name.
+ * @param win The window
+ * @param t The icon name string
+ *
+ * Set a window icon name
+ * <hr><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
+ */
+void
+ecore_x_window_prop_icon_name_set(Ecore_X_Window win, const char *t)
+{
+ ecore_x_window_prop_string_set(win, _ecore_x_atom_wm_icon_name, (char *)t);
+ ecore_x_window_prop_string_set(win, _ecore_x_atom_net_wm_icon_name,
+ (char *)t);
+}
+
+/**
+ * Get a window icon name.
+ * @param win The window
+ * @return The windows icon name string
+ *
+ * Return the icon name of a window. String must be free'd when done with.
+ * <hr><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
+ */
+char *
+ecore_x_window_prop_icon_name_get(Ecore_X_Window win)
+{
+ char *name;
+
+ name = ecore_x_window_prop_string_get(win, _ecore_x_atom_net_wm_icon_name);
+ if (!name) name = ecore_x_window_prop_string_get(win, _ecore_x_atom_wm_icon_name);
+ return name;
+}
+
+/**
* Set a window name & class.
* @param win The window
* @param n The name string
-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
SourceForge.net hosts over 70,000 Open Source Projects.
See the people who have HELPED US provide better services:
Click here: http://sourceforge.net/supporters.php
_______________________________________________
enlightenment-cvs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs