Enlightenment CVS committal
Author : kwo
Project : e16
Module : e
Dir : e16/e/src
Modified Files:
E.h comms.c ecore-e16.c ecore-e16.h ewins.c gnome.c hints.c
icccm.c setup.c
Log Message:
Use more ecore_x atom functions.
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/E.h,v
retrieving revision 1.384
retrieving revision 1.385
diff -u -3 -r1.384 -r1.385
--- E.h 5 Mar 2005 17:52:01 -0000 1.384
+++ E.h 6 Mar 2005 11:16:49 -0000 1.385
@@ -745,6 +745,8 @@
char *wm_res_class;
char *wm_role;
char *wm_command;
+ int wm_command_argc;
+ char **wm_command_argv;
char *wm_machine;
} icccm;
struct
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/comms.c,v
retrieving revision 1.65
retrieving revision 1.66
diff -u -3 -r1.65 -r1.66
--- comms.c 31 Jan 2005 18:52:12 -0000 1.65
+++ comms.c 6 Mar 2005 11:17:04 -0000 1.66
@@ -259,10 +259,8 @@
Esnprintf(s, sizeof(s), "WINID %8x", (int)comms_win);
XA_ENLIGHTENMENT_COMMS = XInternAtom(disp, "ENLIGHTENMENT_COMMS", False);
- XChangeProperty(disp, comms_win, XA_ENLIGHTENMENT_COMMS, XA_STRING, 8,
- PropModeReplace, (unsigned char *)s, strlen(s));
- XChangeProperty(disp, VRoot.win, XA_ENLIGHTENMENT_COMMS, XA_STRING, 8,
- PropModeReplace, (unsigned char *)s, strlen(s));
+ ecore_x_window_prop_string_set(comms_win, XA_ENLIGHTENMENT_COMMS, s);
+ ecore_x_window_prop_string_set(VRoot.win, XA_ENLIGHTENMENT_COMMS, s);
XA_ENL_MSG = XInternAtom(disp, "ENL_MSG", False);
}
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/ecore-e16.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -3 -r1.6 -r1.7
--- ecore-e16.c 17 Feb 2005 23:14:12 -0000 1.6
+++ ecore-e16.c 6 Mar 2005 11:17:04 -0000 1.7
@@ -28,28 +28,6 @@
#define _ATOM_GET(name) \
XInternAtom(_ecore_x_disp, name, False)
-#define _ATOM_SET_STRING(win, atom, string) \
- XChangeProperty(_ecore_x_disp, win, atom, XA_STRING, 8, PropModeReplace, \
- (unsigned char *)string, strlen(string))
-#define _ATOM_SET_STRING_LIST(win, atom, string, cnt) \
- XChangeProperty(_ecore_x_disp, win, atom, XA_STRING, 8, PropModeReplace, \
- (unsigned char *)string, cnt)
-#define _ATOM_SET_UTF8_STRING(win, atom, string) \
- XChangeProperty(_ecore_x_disp, win, atom, ECORE_X_ATOM_UTF8_STRING, 8,
PropModeReplace, \
- (unsigned char *)string, strlen(string))
-#define _ATOM_SET_UTF8_STRING_LIST(win, atom, string, cnt) \
- XChangeProperty(_ecore_x_disp, win, atom, ECORE_X_ATOM_UTF8_STRING, 8,
PropModeReplace, \
- (unsigned char *)string, cnt)
-#define _ATOM_SET_WINDOW(win, atom, p_wins, cnt) \
- XChangeProperty(_ecore_x_disp, win, atom, XA_WINDOW, 32, PropModeReplace, \
- (unsigned char *)p_wins, cnt)
-#define _ATOM_SET_ATOM(win, atom, p_atom, cnt) \
- XChangeProperty(_ecore_x_disp, win, atom, XA_ATOM, 32, PropModeReplace, \
- (unsigned char *)p_atom, cnt)
-#define _ATOM_SET_CARD32(win, atom, p_val, cnt) \
- XChangeProperty(_ecore_x_disp, win, atom, XA_CARDINAL, 32, PropModeReplace,
\
- (unsigned char *)p_val, cnt)
-
/* Window property change actions (must match _NET_WM_STATE_... ones) */
#define ECORE_X_PROP_LIST_REMOVE 0
#define ECORE_X_PROP_LIST_ADD 1
@@ -121,7 +99,8 @@
unsigned int *val, unsigned int num)
{
#if SIZEOF_INT == SIZEOF_LONG
- _ATOM_SET_CARD32(win, atom, val, num);
+ XChangeProperty(_ecore_x_disp, win, atom, XA_CARDINAL, 32, PropModeReplace,
+ (unsigned char *)val, num);
#else
unsigned long *pl;
unsigned int i;
@@ -131,7 +110,8 @@
return;
for (i = 0; i < num; i++)
pl[i] = val[i];
- _ATOM_SET_CARD32(win, atom, pl, num);
+ XChangeProperty(_ecore_x_disp, win, atom, XA_CARDINAL, 32, PropModeReplace,
+ (unsigned char *)pl, num);
free(pl);
#endif
}
@@ -183,18 +163,73 @@
return num;
}
-#if 0 /* Unused */
+/*
+ * Set simple string list property
+ */
+void
+ecore_x_window_prop_string_list_set(Ecore_X_Window win, Ecore_X_Atom atom,
+ char **lst, int num)
+{
+ XTextProperty xtp;
+
+ if (XmbTextListToTextProperty(_ecore_x_disp, (char **)lst, num,
+ XStringStyle, &xtp) != Success)
+ return;
+ XSetTextProperty(_ecore_x_disp, win, &xtp, atom);
+ XFree(xtp.value);
+}
+
+/*
+ * Get simple string list property
+ */
+char **
+ecore_x_window_prop_string_list_get(Ecore_X_Window win, Ecore_X_Atom atom,
+ int *pnum)
+{
+ char **pstr = NULL;
+ XTextProperty xtp;
+ int i, items;
+ char **list;
+ Status s;
+
+ *pnum = 0;
+
+ if (!XGetTextProperty(_ecore_x_disp, win, &xtp, atom))
+ return NULL;
+
+ if (xtp.format == 8)
+ {
+ s = XmbTextPropertyToTextList(_ecore_x_disp, &xtp, &list, &items);
+ if ((s == Success) && (items > 0))
+ {
+ pstr = Emalloc(items * sizeof(char *));
+ for (i = 0; i < items; i++)
+ pstr[i] = Estrdup(list[i]);
+ XFreeStringList(list);
+ }
+ }
+ if (!pstr)
+ {
+ pstr = Emalloc(sizeof(char *));
+ pstr[1] = Estrdup((char *)xtp.value);
+ items = 1;
+ }
+
+ XFree(xtp.value);
+
+ *pnum = items;
+ return pstr;
+}
+
/*
* Set simple string property
- * NB! No encoding conversion done.
*/
void
ecore_x_window_prop_string_set(Ecore_X_Window win, Ecore_X_Atom atom,
const char *str)
{
- _ATOM_SET_STRING(win, atom, str);
+ ecore_x_window_prop_string_list_set(win, atom, (char **)(&str), 1);
}
-#endif
/*
* Get simple string property
@@ -203,29 +238,29 @@
ecore_x_window_prop_string_get(Ecore_X_Window win, Ecore_X_Atom atom)
{
XTextProperty xtp;
- char *str = NULL;
+ char *str;
+ int items;
+ char **list;
+ Status s;
- if (XGetTextProperty(_ecore_x_disp, win, &xtp, atom))
- {
- int items;
- char **list;
- Status s;
+ if (!XGetTextProperty(_ecore_x_disp, win, &xtp, atom))
+ return NULL;
- if (xtp.format == 8)
+ if (xtp.format == 8)
+ {
+ s = XmbTextPropertyToTextList(_ecore_x_disp, &xtp, &list, &items);
+ if ((s == Success) && (items > 0))
{
- s = XmbTextPropertyToTextList(_ecore_x_disp, &xtp, &list, &items);
- if ((s == Success) && (items > 0))
- {
- str = Estrdup(*list);
- XFreeStringList(list);
- }
- else
- str = Estrdup((char *)xtp.value);
+ str = Estrdup(*list);
+ XFreeStringList(list);
}
else
str = Estrdup((char *)xtp.value);
- XFree(xtp.value);
}
+ else
+ str = Estrdup((char *)xtp.value);
+
+ XFree(xtp.value);
return str;
}
@@ -237,7 +272,8 @@
_ecore_x_window_prop_string_utf8_set(Ecore_X_Window win, Ecore_X_Atom atom,
const char *str)
{
- _ATOM_SET_UTF8_STRING(win, atom, str);
+ XChangeProperty(_ecore_x_disp, win, atom, ECORE_X_ATOM_UTF8_STRING, 8,
+ PropModeReplace, (unsigned char *)str, strlen(str));
}
/*
@@ -650,6 +686,12 @@
}
#endif
+void
+ecore_x_icccm_title_set(Ecore_X_Window win, const char *title)
+{
+ return ecore_x_window_prop_string_set(win, ECORE_X_ATOM_WM_NAME, title);
+}
+
char *
ecore_x_icccm_title_get(Ecore_X_Window win)
{
@@ -857,9 +899,11 @@
&check, 1);
ecore_x_window_prop_window_set(check, ECORE_X_ATOM_NET_SUPPORTING_WM_CHECK,
&check, 1);
- _ATOM_SET_UTF8_STRING(check, ECORE_X_ATOM_NET_WM_NAME, wm_name);
+ _ecore_x_window_prop_string_utf8_set(check, ECORE_X_ATOM_NET_WM_NAME,
+ wm_name);
/* This one isn't mandatory */
- _ATOM_SET_UTF8_STRING(root, ECORE_X_ATOM_NET_WM_NAME, wm_name);
+ _ecore_x_window_prop_string_utf8_set(root, ECORE_X_ATOM_NET_WM_NAME,
+ wm_name);
}
/*
@@ -909,7 +953,9 @@
len += l;
}
- _ATOM_SET_UTF8_STRING_LIST(root, ECORE_X_ATOM_NET_DESKTOP_NAMES, buf, len);
+ XChangeProperty(_ecore_x_disp, root, ECORE_X_ATOM_NET_DESKTOP_NAMES,
+ ECORE_X_ATOM_UTF8_STRING, 8, PropModeReplace,
+ (unsigned char *)buf, len);
free(buf);
}
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/ecore-e16.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -3 -r1.4 -r1.5
--- ecore-e16.h 17 Feb 2005 23:14:13 -0000 1.4
+++ ecore-e16.h 6 Mar 2005 11:17:04 -0000 1.5
@@ -111,6 +111,8 @@
void ecore_x_icccm_take_focus_send(Ecore_X_Window win,
Ecore_X_Time ts);
+void ecore_x_icccm_title_set(Ecore_X_Window win,
+ const char *title);
char *ecore_x_icccm_title_get(Ecore_X_Window win);
/* NETWM (EWMH) */
@@ -261,6 +263,13 @@
void ecore_x_icccm_state_set_normal(Ecore_X_Window win);
void ecore_x_icccm_state_set_withdrawn(Ecore_X_Window win);
+void ecore_x_window_prop_string_list_set(Ecore_X_Window win,
+ Ecore_X_Atom atom,
+ char **lst, int num);
+char **ecore_x_window_prop_string_list_get(Ecore_X_Window win,
+ Ecore_X_Atom atom,
+ int *pnum);
+
void ecore_x_window_prop_xid_set(Ecore_X_Window win,
Ecore_X_Atom atom,
Ecore_X_Atom type,
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/ewins.c,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -3 -r1.25 -r1.26
--- ewins.c 5 Mar 2005 00:30:45 -0000 1.25
+++ ewins.c 6 Mar 2005 11:17:04 -0000 1.26
@@ -211,6 +211,8 @@
Efree(ewin->icccm.wm_role);
if (ewin->icccm.wm_command)
Efree(ewin->icccm.wm_command);
+ if (ewin->icccm.wm_command_argv)
+ freestrlist(ewin->icccm.wm_command_argv, ewin->icccm.wm_command_argc);
if (ewin->icccm.wm_machine)
Efree(ewin->icccm.wm_machine);
#if ENABLE_EWMH
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/gnome.c,v
retrieving revision 1.44
retrieving revision 1.45
diff -u -3 -r1.44 -r1.45
--- gnome.c 26 Feb 2005 16:40:36 -0000 1.44
+++ gnome.c 6 Mar 2005 11:17:04 -0000 1.45
@@ -446,7 +446,7 @@
GNOME_SetHint(EWin * ewin)
{
static Atom atom_set = 0;
- int val;
+ unsigned int val;
if ((ewin->type == EWIN_TYPE_MENU) || (ewin->type == EWIN_TYPE_PAGER))
return;
@@ -459,39 +459,36 @@
val |= WIN_STATE_SHADED;
if (ewin->fixedpos)
val |= WIN_STATE_FIXED_POSITION;
- XChangeProperty(disp, ewin->client.win, atom_set, XA_CARDINAL, 32,
- PropModeReplace, (unsigned char *)&val, 1);
+ ecore_x_window_prop_card32_set(ewin->client.win, atom_set, &val, 1);
}
void
GNOME_SetEwinArea(EWin * ewin)
{
static Atom atom_set = 0;
- CARD32 val[2];
+ unsigned int val[2];
if ((ewin->type == EWIN_TYPE_MENU) || (ewin->type == EWIN_TYPE_PAGER))
return;
if (!atom_set)
atom_set = XInternAtom(disp, XA_WIN_AREA, False);
- val[0] = (CARD32) ewin->area_x;
- val[1] = (CARD32) ewin->area_y;
- XChangeProperty(disp, ewin->client.win, atom_set, XA_CARDINAL, 32,
- PropModeReplace, (unsigned char *)val, 2);
+ val[0] = ewin->area_x;
+ val[1] = ewin->area_y;
+ ecore_x_window_prop_card32_set(ewin->client.win, atom_set, val, 2);
}
void
GNOME_SetEwinDesk(EWin * ewin)
{
static Atom atom_set = 0;
- int val;
+ unsigned int val;
if ((ewin->type == EWIN_TYPE_MENU) || (ewin->type == EWIN_TYPE_PAGER))
return;
if (!atom_set)
atom_set = XInternAtom(disp, XA_WIN_WORKSPACE, False);
val = EoGetDesk(ewin);
- XChangeProperty(disp, ewin->client.win, atom_set, XA_CARDINAL, 32,
- PropModeReplace, (unsigned char *)&val, 1);
+ ecore_x_window_prop_card32_set(ewin->client.win, atom_set, &val, 1);
}
#if 0 /* Does nothing */
@@ -527,7 +524,7 @@
GNOME_SetUsedHints(void)
{
static Atom atom_set = 0;
- Atom list[10];
+ Ecore_X_Atom list[10];
if (!atom_set)
atom_set = XInternAtom(disp, XA_WIN_PROTOCOLS, False);
@@ -541,15 +538,14 @@
list[7] = XInternAtom(disp, XA_WIN_WORKSPACE_COUNT, False);
list[8] = XInternAtom(disp, XA_WIN_WORKSPACE_NAMES, False);
list[9] = XInternAtom(disp, XA_WIN_CLIENT_LIST, False);
- XChangeProperty(disp, VRoot.win, atom_set, XA_ATOM, 32, PropModeReplace,
- (unsigned char *)list, 10);
+ ecore_x_window_prop_atom_set(VRoot.win, atom_set, list, 10);
}
void
GNOME_SetCurrentArea(void)
{
static Atom atom_set = 0;
- CARD32 val[2];
+ unsigned int val[2];
int ax, ay;
if (!atom_set)
@@ -557,49 +553,44 @@
DeskGetCurrentArea(&ax, &ay);
val[0] = ax;
val[1] = ay;
- XChangeProperty(disp, VRoot.win, atom_set, XA_CARDINAL, 32, PropModeReplace,
- (unsigned char *)val, 2);
+ ecore_x_window_prop_card32_set(VRoot.win, atom_set, val, 2);
}
void
GNOME_SetCurrentDesk(void)
{
static Atom atom_set = 0;
- CARD32 val;
+ unsigned int val;
if (!atom_set)
atom_set = XInternAtom(disp, XA_WIN_WORKSPACE, False);
- val = (CARD32) DesksGetCurrent();
- XChangeProperty(disp, VRoot.win, atom_set, XA_CARDINAL, 32, PropModeReplace,
- (unsigned char *)&val, 1);
+ val = DesksGetCurrent();
+ ecore_x_window_prop_card32_set(VRoot.win, atom_set, &val, 1);
}
static void
GNOME_SetWMCheck(Window win_wm_check)
{
static Atom atom_set = 0;
- CARD32 val;
+ unsigned int val;
if (!atom_set)
atom_set = XInternAtom(disp, XA_WIN_SUPPORTING_WM_CHECK, False);
val = win_wm_check;
- XChangeProperty(disp, VRoot.win, atom_set, XA_CARDINAL,
- 32, PropModeReplace, (unsigned char *)&val, 1);
- XChangeProperty(disp, win_wm_check, atom_set, XA_CARDINAL,
- 32, PropModeReplace, (unsigned char *)&val, 1);
+ ecore_x_window_prop_card32_set(VRoot.win, atom_set, &val, 1);
+ ecore_x_window_prop_card32_set(win_wm_check, atom_set, &val, 1);
}
void
GNOME_SetDeskCount(void)
{
static Atom atom_set = 0;
- CARD32 val;
+ unsigned int val;
if (!atom_set)
atom_set = XInternAtom(disp, XA_WIN_WORKSPACE_COUNT, False);
val = DesksGetNumber();
- XChangeProperty(disp, VRoot.win, atom_set, XA_CARDINAL, 32, PropModeReplace,
- (unsigned char *)&val, 1);
+ ecore_x_window_prop_card32_set(VRoot.win, atom_set, &val, 1);
}
void
@@ -607,22 +598,20 @@
{
static Atom atom_set = 0;
int ax, ay;
- CARD32 val[2];
+ unsigned int val[2];
if (!atom_set)
atom_set = XInternAtom(disp, XA_WIN_AREA_COUNT, False);
GetAreaSize(&ax, &ay);
val[0] = ax;
val[1] = ay;
- XChangeProperty(disp, VRoot.win, atom_set, XA_CARDINAL, 32, PropModeReplace,
- (unsigned char *)val, 2);
+ ecore_x_window_prop_card32_set(VRoot.win, atom_set, val, 2);
}
void
GNOME_SetDeskNames(void)
{
static Atom atom_set = 0;
- XTextProperty text;
char s[1024], **names;
int i, n_desks;
@@ -640,11 +629,7 @@
names[i] = Estrdup(s);
}
- if (XStringListToTextProperty(names, n_desks, &text))
- {
- XSetTextProperty(disp, VRoot.win, &text, atom_set);
- XFree(text.value);
- }
+ ecore_x_window_prop_string_list_set(VRoot.win, atom_set, names, n_desks);
for (i = 0; i < n_desks; i++)
if (names[i])
@@ -656,7 +641,7 @@
GNOME_SetClientList(void)
{
static Atom atom_set = 0;
- Window *wl;
+ unsigned int *wl;
int j, i, num;
EWin **lst;
@@ -667,7 +652,7 @@
j = 0;
if (lst)
{
- wl = Emalloc(sizeof(Window) * num);
+ wl = Emalloc(num * sizeof(unsigned int));
for (i = 0; i < num; i++)
{
if ((lst[i]->type != EWIN_TYPE_MENU) &&
@@ -676,8 +661,7 @@
wl[j++] = lst[i]->client.win;
}
}
- XChangeProperty(disp, VRoot.win, atom_set, XA_CARDINAL, 32, PropModeReplace,
- (unsigned char *)wl, j);
+ ecore_x_window_prop_card32_set(VRoot.win, atom_set, wl, j);
if (wl)
Efree(wl);
if (lst)
@@ -691,12 +675,11 @@
if (!atom_set)
atom_set = XInternAtom(disp, XA_WIN_WM_NAME, False);
- XChangeProperty(disp, VRoot.win, atom_set, XA_STRING, 8, PropModeReplace,
- (unsigned char *)e_wm_name, strlen(e_wm_name));
+ ecore_x_window_prop_string_set(VRoot.win, atom_set, e_wm_name);
+
if (!atom_set2)
atom_set2 = XInternAtom(disp, XA_WIN_WM_VERSION, False);
- XChangeProperty(disp, VRoot.win, atom_set2, XA_STRING, 8, PropModeReplace,
- (unsigned char *)e_wm_version, strlen(e_wm_version));
+ ecore_x_window_prop_string_set(VRoot.win, atom_set2, e_wm_version);
}
void
@@ -748,15 +731,13 @@
GNOME_SetWMCheck(win_wm_check);
{
Atom atom_set;
- CARD32 val;
+ unsigned int val;
atom_set = XInternAtom(disp, "_WIN_DESKTOP_BUTTON_PROXY", False);
Mode.button_proxy_win = ECreateWindow(VRoot.win, -80, -80, 24, 24, 0);
val = Mode.button_proxy_win;
- XChangeProperty(disp, VRoot.win, atom_set, XA_CARDINAL, 32,
- PropModeReplace, (unsigned char *)&val, 1);
- XChangeProperty(disp, Mode.button_proxy_win, atom_set, XA_CARDINAL, 32,
- PropModeReplace, (unsigned char *)&val, 1);
+ ecore_x_window_prop_card32_set(VRoot.win, atom_set, &val, 1);
+ ecore_x_window_prop_card32_set(Mode.button_proxy_win, atom_set, &val, 1);
}
}
@@ -791,10 +772,11 @@
ewin = FindItem(NULL, event->window, LIST_FINDBY_ID, LIST_TYPE_EWIN);
if (ewin)
{
- EoSetLayer(ewin, event->data.l[0]);
- XChangeProperty(disp, EoGetWin(ewin), a4, XA_CARDINAL, 32,
- PropModeReplace,
- (unsigned char *)(&(event->data.l[0])), 1);
+ unsigned int val;
+
+ val = event->data.l[0];
+ EoSetLayer(ewin, val);
+ ecore_x_window_prop_card32_set(ewin->client.win, a4, &val, 1);
RaiseEwin(ewin);
}
return;
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/hints.c,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -3 -r1.34 -r1.35
--- hints.c 5 Mar 2005 00:30:46 -0000 1.34
+++ hints.c 6 Mar 2005 11:17:04 -0000 1.35
@@ -48,8 +48,7 @@
EWMH_Init(win);
#endif
atom = XInternAtom(disp, "ENLIGHTENMENT_VERSION", False);
- XChangeProperty(disp, VRoot.win, atom, XA_STRING, 8, PropModeReplace,
- (unsigned char *)e_wm_version, strlen(e_wm_version));
+ ecore_x_window_prop_string_set(VRoot.win, atom, e_wm_version);
}
void
@@ -132,13 +131,7 @@
void
HintsSetWindowName(Window win, const char *name)
{
- XTextProperty xtp;
-
- xtp.encoding = XA_STRING;
- xtp.format = 8;
- xtp.value = (unsigned char *)name;
- xtp.nitems = strlen(name);
- XSetWMName(disp, win, &xtp);
+ ecore_x_window_prop_string_set(win, ECORE_X_ATOM_WM_NAME, name);
#if ENABLE_EWMH
EWMH_SetWindowName(win, name);
@@ -205,26 +198,6 @@
void
HintsSetWindowBorder(EWin * ewin)
{
-#if 0 /* I doubt this is used anywhere */
- static Atom atom_set = 0;
- CARD32 val[4];
-
- if (!atom_set)
- atom_set = XInternAtom(disp, "_E_FRAME_SIZE", False);
-
- if (ewin->border)
- {
- val[0] = ewin->border->border.left;
- val[1] = ewin->border->border.right;
- val[2] = ewin->border->border.top;
- val[3] = ewin->border->border.bottom;
- }
- else
- val[0] = val[1] = val[2] = val[3] = 0;
-
- XChangeProperty(disp, ewin->client.win, atom_set, XA_CARDINAL, 32,
- PropModeReplace, (unsigned char *)&val, 4);
-#endif
#if ENABLE_EWMH
EWMH_SetWindowBorder(ewin);
#endif
@@ -312,6 +285,7 @@
HintsSetRootInfo(Window win, Pixmap pmap, int color)
{
static Atom a = 0, aa = 0;
+ Ecore_X_Pixmap pm;
if (!a)
{
@@ -322,11 +296,10 @@
if (Conf.hints.set_xroot_info_on_root_window)
win = VRoot.win;
- XChangeProperty(disp, win, a, XA_PIXMAP, 32, PropModeReplace,
- (unsigned char *)&pmap, 1);
- XChangeProperty(disp, win, aa, XA_CARDINAL, 32, PropModeReplace,
- (unsigned char *)&color, 1);
+ pm = pmap;
+ ecore_x_window_prop_xid_set(win, a, XA_PIXMAP, &pm, 1);
+ ecore_x_window_prop_card32_set(win, aa, &color, 1);
}
void
@@ -355,9 +328,8 @@
ecore_x_window_prop_card32_set(ewin->client.win, a, c, 9);
- XChangeProperty(disp, ewin->client.win, aa, XA_STRING, 8, PropModeReplace,
- (unsigned char *)ewin->normal_border->name,
- strlen(ewin->normal_border->name) + 1);
+ ecore_x_window_prop_string_set(ewin->client.win, aa,
+ ewin->normal_border->name);
if (EventDebug(EDBUG_TYPE_SNAPS))
Eprintf("Snap set einf %#lx: %4d+%4d %4dx%4d: %s\n",
@@ -369,11 +341,8 @@
EHintsGetInfo(EWin * ewin)
{
static Atom a = 0, aa = 0;
- Atom a2;
char *str;
- unsigned long lnum, ldummy;
- int num, dummy;
- unsigned char *puc;
+ int num;
int c[9];
if (EwinIsInternal(ewin))
@@ -407,14 +376,11 @@
}
ewin->client.already_placed = 1;
- puc = NULL;
- XGetWindowProperty(disp, ewin->client.win, aa, 0, 0xffff, True,
- XA_STRING, &a2, &dummy, &lnum, &ldummy, &puc);
- str = (char *)puc;
- num = (int)lnum;
- if ((num > 0) && (str))
+ str = ecore_x_window_prop_string_get(ewin->client.win, aa);
+ if (str)
EwinSetBorderByName(ewin, str, 0);
- XFree(str);
+ Efree(str);
+
if (EventDebug(EDBUG_TYPE_SNAPS))
Eprintf("Snap get einf %#lx: %4d+%4d %4dx%4d: %s\n",
ewin->client.win, ewin->client.x, ewin->client.y,
@@ -428,78 +394,66 @@
{
Atom a;
int i, ax, ay, n_desks;
- CARD32 *cc;
+ unsigned int *c;
n_desks = DesksGetNumber();
if (n_desks <= 0)
return;
- cc = Emalloc(2 * n_desks * sizeof(CARD32));
- if (!cc)
+ c = Emalloc(2 * n_desks * sizeof(unsigned int));
+ if (!c)
return;
for (i = 0; i < n_desks; i++)
{
DeskGetArea(i, &ax, &ay);
- cc[(i * 2)] = ax;
- cc[(i * 2) + 1] = ay;
+ c[(i * 2)] = ax;
+ c[(i * 2) + 1] = ay;
}
a = XInternAtom(disp, "ENL_INTERNAL_AREA_DATA", False);
- XChangeProperty(disp, VRoot.win, a, XA_CARDINAL, 32, PropModeReplace,
- (unsigned char *)cc, n_desks * 2);
+ ecore_x_window_prop_card32_set(VRoot.win, a, c, 2 * n_desks);
a = XInternAtom(disp, "ENL_INTERNAL_DESK_DATA", False);
- cc[0] = DesksGetCurrent();
- XChangeProperty(disp, VRoot.win, a, XA_CARDINAL, 32, PropModeReplace,
- (unsigned char *)cc, 1);
+ c[0] = DesksGetCurrent();
+ ecore_x_window_prop_card32_set(VRoot.win, a, c, 1);
- Efree(cc);
+ Efree(c);
}
void
EHintsGetMainInfo(void)
{
- Atom a, a2;
- CARD32 *c;
- unsigned long lnum, ldummy;
- int num, dummy, i, n_desks;
- unsigned char *puc;
+ Atom a;
+ unsigned int *c;
+ int num, i, n_desks;
n_desks = DesksGetNumber();
+ c = Emalloc(2 * n_desks * sizeof(unsigned int));
+ if (!c)
+ return;
a = XInternAtom(disp, "ENL_INTERNAL_AREA_DATA", False);
- puc = NULL;
- XGetWindowProperty(disp, VRoot.win, a, 0, 0xffff, False, XA_CARDINAL, &a2,
- &dummy, &lnum, &ldummy, &puc);
- c = (CARD32 *) puc;
- num = (int)lnum;
- if ((num > 0) && (c))
+ num = ecore_x_window_prop_card32_get(VRoot.win, a, c, 2 * n_desks);
+ if (num > 0)
{
for (i = 0; i < (num / 2); i++)
- {
- if (i < n_desks)
- DeskSetArea(i, c[(i * 2)], c[(i * 2) + 1]);
- }
- XFree(c);
+ DeskSetArea(i, c[(i * 2)], c[(i * 2) + 1]);
}
a = XInternAtom(disp, "ENL_INTERNAL_DESK_DATA", False);
- puc = NULL;
- XGetWindowProperty(disp, VRoot.win, a, 0, 1, False, XA_CARDINAL, &a2,
- &dummy, &lnum, &ldummy, &puc);
- c = (CARD32 *) puc;
- num = (int)lnum;
- if ((num > 0) && (c))
+ num = ecore_x_window_prop_card32_get(VRoot.win, a, c, 1);
+ if (num > 0)
{
- DesksSetCurrent(*c);
- XFree(c);
+ DesksSetCurrent(c[0]);
}
else
{
/* Used to test if we should run cmd_init */
Mode.wm.session_start = 1;
}
+
+ Efree(c);
}
void
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/icccm.c,v
retrieving revision 1.86
retrieving revision 1.87
diff -u -3 -r1.86 -r1.87
--- icccm.c 12 Feb 2005 16:16:29 -0000 1.86
+++ icccm.c 6 Mar 2005 11:17:04 -0000 1.87
@@ -524,29 +524,26 @@
}
static char *
-WinGetWMCommand(Window win)
+Estrlistjoin(char **pstr, int nstr)
{
- int cargc, i, size;
- char **cargv, *s;
+ int i, size;
+ char *s;
- s = NULL;
-
- if (!XGetCommand(disp, win, &cargv, &cargc))
- return NULL;
- if (cargc <= 0)
+ if (!pstr || nstr <= 0)
return NULL;
- size = strlen(cargv[0]) + 1;
+ s = NULL;
+
+ size = strlen(pstr[0]) + 1;
s = Emalloc(size);
- strcpy(s, cargv[0]);
- for (i = 1; i < cargc; i++)
+ strcpy(s, pstr[0]);
+ for (i = 1; i < nstr; i++)
{
- size += strlen(cargv[i]) + 1;
+ size += strlen(pstr[i]) + 1;
s = Erealloc(s, size);
strcat(s, " ");
- strcat(s, cargv[i]);
+ strcat(s, pstr[i]);
}
- XFreeStringList(cargv);
return s;
}
@@ -554,11 +551,10 @@
void
ICCCM_GetInfo(EWin * ewin, Atom atom_change)
{
- XClassHint hint;
- XTextProperty xtp;
-
if (atom_change == 0 || atom_change == ECORE_X_ATOM_WM_CLASS)
{
+ XClassHint hint;
+
_EFREE(ewin->icccm.wm_res_name);
_EFREE(ewin->icccm.wm_res_class);
@@ -576,52 +572,45 @@
{
_EFREE(ewin->icccm.wm_command);
- ewin->icccm.wm_command = WinGetWMCommand(ewin->client.win);
-
+ ewin->icccm.wm_command_argv =
+ ecore_x_window_prop_string_list_get(ewin->client.win,
+ ECORE_X_ATOM_WM_COMMAND,
+ &(ewin->icccm.wm_command_argc));
if (!ewin->icccm.wm_command && ewin->client.win != ewin->client.group)
- ewin->icccm.wm_command = WinGetWMCommand(ewin->client.group);
+ ewin->icccm.wm_command_argv =
+ ecore_x_window_prop_string_list_get(ewin->client.group,
+ ECORE_X_ATOM_WM_COMMAND,
+ &(ewin->icccm.
+ wm_command_argc));
+ ewin->icccm.wm_command =
+ Estrlistjoin(ewin->icccm.wm_command_argv,
+ ewin->icccm.wm_command_argc);
}
if (atom_change == 0 || atom_change == ECORE_X_ATOM_WM_CLIENT_MACHINE)
{
_EFREE(ewin->icccm.wm_machine);
- if (XGetWMClientMachine(disp, ewin->client.win, &xtp) ||
- XGetWMClientMachine(disp, ewin->client.group, &xtp))
- {
- ewin->icccm.wm_machine = Estrdup((char *)xtp.value);
- XFree(xtp.value);
- }
+ ewin->icccm.wm_machine =
+ ecore_x_window_prop_string_get(ewin->client.win,
+ ECORE_X_ATOM_WM_CLIENT_MACHINE);
+ if (!ewin->icccm.wm_machine && ewin->client.win != ewin->client.group)
+ ewin->icccm.wm_machine =
+ ecore_x_window_prop_string_get(ewin->client.group,
+ ECORE_X_ATOM_WM_CLIENT_MACHINE);
}
if (atom_change == 0 || atom_change == ECORE_X_ATOM_WM_ICON_NAME)
{
_EFREE(ewin->icccm.wm_icon_name);
- if (XGetWMIconName(disp, ewin->client.win, &xtp) ||
- XGetWMIconName(disp, ewin->client.group, &xtp))
- {
- if (xtp.encoding == XA_STRING)
- {
- ewin->icccm.wm_icon_name = Estrdup((char *)xtp.value);
- }
- else
- {
- char **cl;
- Status status;
- int n;
-
- status = XmbTextPropertyToTextList(disp, &xtp, &cl, &n);
- if (status >= Success && n > 0 && cl[0])
- {
- ewin->icccm.wm_icon_name = Estrdup(cl[0]);
- XFreeStringList(cl);
- }
- else
- ewin->icccm.wm_icon_name = Estrdup((char *)xtp.value);
- }
- XFree(xtp.value);
- }
+ ewin->icccm.wm_icon_name =
+ ecore_x_window_prop_string_get(ewin->client.win,
+ ECORE_X_ATOM_WM_ICON_NAME);
+ if (!ewin->icccm.wm_icon_name && ewin->client.win != ewin->client.group)
+ ewin->icccm.wm_icon_name =
+ ecore_x_window_prop_string_get(ewin->client.group,
+ ECORE_X_ATOM_WM_ICON_NAME);
}
if (atom_change == 0 || atom_change == ECORE_X_ATOM_WM_WINDOW_ROLE)
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/setup.c,v
retrieving revision 1.152
retrieving revision 1.153
diff -u -3 -r1.152 -r1.153
--- setup.c 28 Feb 2005 21:50:45 -0000 1.152
+++ setup.c 6 Mar 2005 11:17:04 -0000 1.153
@@ -225,8 +225,6 @@
if (Mode.wm.window)
{
XSetWindowAttributes attr;
- XClassHint *xch;
- XTextProperty xtp;
/* Running E in its own virtual root window */
attr.backing_store = NotUseful;
@@ -242,16 +240,8 @@
CWBorderPixel, &attr);
ERegisterWindow(VRoot.win);
- xtp.encoding = XA_STRING;
- xtp.format = 8;
- xtp.value = (unsigned char *)("Enlightenment");
- xtp.nitems = strlen((char *)(xtp.value));
- XSetWMName(disp, VRoot.win, &xtp);
- xch = XAllocClassHint();
- xch->res_name = (char *)"Virtual-Root";
- xch->res_class = (char *)"Enlightenment";
- XSetClassHint(disp, VRoot.win, xch);
- XFree(xch);
+ HintsSetWindowName(VRoot.win, "Enlightenment");
+ HintsSetWindowClass(VRoot.win, "Virtual-Root", "Enlightenment");
EMapWindow(VRoot.win);
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
enlightenment-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs