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_private.h ecore_x_window_prop.c
Log Message:
Include netinet/in.h for connections to be portable to BSD.
Added the atom declarations for the NetWM application window properties.
Created ecore_x_window_prop_string_{set,get}.
Changed ecore_x_window_prop_title_{set,get} to use the new string functions.
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ecore/src/lib/ecore_x/Ecore_X.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -3 -r1.4 -r1.5
--- Ecore_X.h 9 Oct 2003 02:20:37 -0000 1.4
+++ Ecore_X.h 11 Oct 2003 22:14:21 -0000 1.5
@@ -489,6 +489,8 @@
void ecore_x_window_cursor_show(Ecore_X_Window win, int show);
void ecore_x_window_prop_property_set(Ecore_X_Window win, Ecore_X_Atom
type, Ecore_X_Atom format, int size, void *data, int number);
+void ecore_x_window_prop_string_set(Ecore_X_Window win, Ecore_X_Atom
type, char *str);
+char *ecore_x_window_prop_string_get(Ecore_X_Window win, Ecore_X_Atom
type);
void ecore_x_window_prop_title_set(Ecore_X_Window win, const char *t);
char *ecore_x_window_prop_title_get(Ecore_X_Window win);
void ecore_x_window_prop_name_class_set(Ecore_X_Window win, const char
*n, const char *c);
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ecore/src/lib/ecore_x/ecore_x.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -3 -r1.4 -r1.5
--- ecore_x.c 9 Oct 2003 02:20:37 -0000 1.4
+++ ecore_x.c 11 Oct 2003 22:14:21 -0000 1.5
@@ -33,9 +33,22 @@
Atom _ecore_x_atom_win_layer = 0;
Atom _ecore_x_atom_net_wm_desktop = 0;
Atom _ecore_x_atom_net_current_desktop = 0;
+
+Atom _ecore_x_atom_net_wm_name = 0;
+Atom _ecore_x_atom_net_wm_visible_name = 0;
+Atom _ecore_x_atom_net_wm_icon_name = 0;
+Atom _ecore_x_atom_net_wm_window_type = 0;
Atom _ecore_x_atom_net_wm_state = 0;
Atom _ecore_x_atom_net_wm_state_above = 0;
Atom _ecore_x_atom_net_wm_state_below = 0;
+Atom _ecore_x_atom_net_wm_allowed_actions = 0;
+Atom _ecore_x_atom_net_wm_strut = 0;
+Atom _ecore_x_atom_net_wm_strut_partial = 0;
+Atom _ecore_x_atom_net_wm_icon_geometry = 0;
+Atom _ecore_x_atom_net_wm_icon = 0;
+Atom _ecore_x_atom_net_wm_pid = 0;
+Atom _ecore_x_atom_net_wm_handle_icons = 0;
+Atom _ecore_x_atom_net_wm_user_time = 0;
Atom _ecore_x_atoms_wm_protocols[ECORE_X_WM_PROTOCOL_NUM] = {0};
@@ -229,11 +242,22 @@
_ecore_x_atom_wm_name = XInternAtom(_ecore_x_disp, "WM_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_wm_desktop = XInternAtom(_ecore_x_disp,
"_NET_WM_DESKTOP", False);
_ecore_x_atom_net_current_desktop = XInternAtom(_ecore_x_disp,
"_NET_CURRENT_DESKTOP", False);
+ _ecore_x_atom_net_wm_name = XInternAtom(_ecore_x_disp, "_NET_WM_NAME",
False);
+ _ecore_x_atom_net_wm_visible_name = XInternAtom(_ecore_x_disp,
"_NET_WM_VISIBLE_NAME", False);
+ _ecore_x_atom_net_wm_icon_name = XInternAtom(_ecore_x_disp,
"_NET_WM_ICON_NAME", False);
+ _ecore_x_atom_net_wm_desktop = XInternAtom(_ecore_x_disp,
"_NET_WM_DESKTOP", False);
+ _ecore_x_atom_net_wm_window_type = XInternAtom(_ecore_x_disp,
"_NET_WM_WINDOW_TYPE", False);
_ecore_x_atom_net_wm_state = XInternAtom(_ecore_x_disp,
"_NET_WM_STATE", False);
_ecore_x_atom_net_wm_state_above = XInternAtom(_ecore_x_disp,
"_NET_WM_STATE_ABOVE", False);
_ecore_x_atom_net_wm_state_below = XInternAtom(_ecore_x_disp,
"_NET_WM_STATE_BELOW", False);
+ _ecore_x_atom_net_wm_allowed_actions = XInternAtom(_ecore_x_disp,
"_NET_WM_ALLOWED_ACTIONS", False);
+ _ecore_x_atom_net_wm_strut = XInternAtom(_ecore_x_disp,
"_NET_WM_STRUT", False);
+ _ecore_x_atom_net_wm_strut_partial = XInternAtom(_ecore_x_disp,
"_NET_WM_STRUT_PARTIAL", False);
+ _ecore_x_atom_net_wm_icon_geometry = XInternAtom(_ecore_x_disp,
"_NET_WM_ICON_GEOMETRY", False);
+ _ecore_x_atom_net_wm_icon = XInternAtom(_ecore_x_disp, "_NET_WM_ICON",
False);
+ _ecore_x_atom_net_wm_pid = XInternAtom(_ecore_x_disp, "_NET_WM_PID",
False);
+ _ecore_x_atom_net_wm_user_time = XInternAtom(_ecore_x_disp,
"_NET_WM_USER_TIME", False);
_ecore_x_atoms_wm_protocols[ECORE_X_WM_PROTOCOL_DELETE_REQUEST] =
_ecore_x_atom_wm_delete_window;
_ecore_x_atoms_wm_protocols[ECORE_X_WM_PROTOCOL_TAKE_FOCUS] =
_ecore_x_atom_wm_take_focus;
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ecore/src/lib/ecore_x/ecore_x_private.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -3 -r1.3 -r1.4
--- ecore_x_private.h 23 Sep 2003 22:33:10 -0000 1.3
+++ ecore_x_private.h 11 Oct 2003 22:14:22 -0000 1.4
@@ -64,6 +64,21 @@
extern Atom _ecore_x_atom_net_wm_state_above;
extern Atom _ecore_x_atom_net_wm_state_below;
+extern Atom _ecore_x_atom_net_wm_name;
+extern Atom _ecore_x_atom_net_wm_visible_name;
+extern Atom _ecore_x_atom_net_wm_icon_name;
+extern Atom _ecore_x_atom_net_wm_desktop;
+extern Atom _ecore_x_atom_net_wm_window_type;
+extern Atom _ecore_x_atom_net_wm_state;
+extern Atom _ecore_x_atom_net_wm_allowed_actions;
+extern Atom _ecore_x_atom_net_wm_strut;
+extern Atom _ecore_x_atom_net_wm_strut_partial;
+extern Atom _ecore_x_atom_net_wm_icon_geometry;
+extern Atom _ecore_x_atom_net_wm_icon;
+extern Atom _ecore_x_atom_net_wm_pid;
+extern Atom _ecore_x_atom_net_wm_handle_icons;
+extern Atom _ecore_x_atom_net_wm_user_time;
+
extern Atom _ecore_x_atoms_wm_protocols[ECORE_X_WM_PROTOCOL_NUM];
void _ecore_x_error_handler_init(void);
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ecore/src/lib/ecore_x/ecore_x_window_prop.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -3 -r1.4 -r1.5
--- ecore_x_window_prop.c 8 Oct 2003 20:33:30 -0000 1.4
+++ ecore_x_window_prop.c 11 Oct 2003 22:14:22 -0000 1.5
@@ -85,56 +85,95 @@
}
/**
- * Set a window title.
+ * Set a window string property.
* @param win The window
- * @param t The title string
+ * @param type The property
+ * @param str The string
*
- * Set a window title
+ * Set a window string property
* <hr><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
*/
void
-ecore_x_window_prop_title_set(Ecore_X_Window win, const char *t)
+ecore_x_window_prop_string_set(Ecore_X_Window win, Ecore_X_Atom type, char *str)
{
- XStoreName(_ecore_x_disp, win, t);
+ XTextProperty xtp;
+
+ xtp.value = str;
+ xtp.format = 8;
+ xtp.encoding = XA_STRING;
+ xtp.nitems = strlen(str);
+ XSetTextProperty(_ecore_x_disp, win, &xtp, type);
}
/**
- * Get a window title.
+ * Get a window string property.
* @param win The window
- * @return The windows title string
+ * @param type The property
*
- * Return the title of a window. String must be free'd when done with.
+ * Get a window string property
* <hr><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
*/
char *
-ecore_x_window_prop_title_get(Ecore_X_Window win)
+ecore_x_window_prop_string_get(Ecore_X_Window win, Ecore_X_Atom type)
{
XTextProperty xtp;
-
- if (XGetWMName(_ecore_x_disp, win, &xtp))
+ char *str = NULL;
+
+ if (XGetTextProperty(_ecore_x_disp, win, &xtp, type))
{
int items;
char **list;
Status s;
- char *title = NULL;
if (xtp.format == 8)
{
- s = XmbTextPropertyToTextList(_ecore_x_disp, &xtp, &list, &items);
+ s = Xutf8TextPropertyToTextList(_ecore_x_disp, &xtp, &list, &items);
if ((s == Success) && (items > 0))
{
- title = strdup(*list);
+ str = strdup(*list);
XFreeStringList(list);
}
else
- title = strdup((char *)xtp.value);
+ str = strdup((char *)xtp.value);
}
else
- title = strdup((char *)xtp.value);
+ str = strdup((char *)xtp.value);
XFree(xtp.value);
- return title;
}
- return NULL;
+ return str;
+}
+
+/**
+ * Set a window title.
+ * @param win The window
+ * @param t The title string
+ *
+ * Set a window title
+ * <hr><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
+ */
+void
+ecore_x_window_prop_title_set(Ecore_X_Window win, const char *t)
+{
+ ecore_x_window_prop_string_set(win, _ecore_x_atom_wm_name, t);
+ ecore_x_window_prop_string_set(win, _ecore_x_atom_net_wm_name, t);
+}
+
+/**
+ * Get a window title.
+ * @param win The window
+ * @return The windows title string
+ *
+ * Return the title 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_title_get(Ecore_X_Window win)
+{
+ char *title;
+
+ title = ecore_x_window_prop_string_get(win, _ecore_x_atom_net_wm_name);
+ if (!title) title = ecore_x_window_prop_string_get(win, _ecore_x_atom_wm_name);
+ return title;
}
/**
-------------------------------------------------------
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