Enlightenment CVS committal
Author : sebastid
Project : e17
Module : libs/ecore
Dir : e17/libs/ecore/src/lib/ecore_x
Modified Files:
Ecore_X.h Ecore_X_Atoms.h ecore_x.c ecore_x_e.c
ecore_x_events.c ecore_x_icccm.c ecore_x_netwm.c
ecore_x_selection.c ecore_x_window_prop.c
Log Message:
Cleanup and netwm work.
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ecore/src/lib/ecore_x/Ecore_X.h,v
retrieving revision 1.116
retrieving revision 1.117
diff -u -3 -r1.116 -r1.117
--- Ecore_X.h 2 May 2005 07:13:51 -0000 1.116
+++ Ecore_X.h 16 May 2005 12:59:26 -0000 1.117
@@ -950,9 +950,10 @@
EAPI Ecore_X_Atom ecore_x_window_prop_any_type(void);
EAPI 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);
EAPI int ecore_x_window_prop_property_get(Ecore_X_Window win,
Ecore_X_Atom property, Ecore_X_Atom type, int size, unsigned char **data, int
*num);
-EAPI void ecore_x_window_prop_card32_set(Ecore_X_Window win,
Ecore_X_Atom atom, unsigned int *val, unsigned int num);
+EAPI void ecore_x_window_prop_card32_set(Ecore_X_Window win,
Ecore_X_Atom atom,
+ unsigned int *val,
unsigned int num);
EAPI int ecore_x_window_prop_card32_get(Ecore_X_Window win,
Ecore_X_Atom atom,
- unsigned int *val, unsigned int len);
+ unsigned int *val,
unsigned int len);
EAPI void ecore_x_window_prop_property_del(Ecore_X_Window win,
Ecore_X_Atom property);
EAPI void ecore_x_window_prop_property_notify(Ecore_X_Window win,
const char *type, long *data);
EAPI void ecore_x_window_prop_string_set(Ecore_X_Window win,
Ecore_X_Atom type, const char *str);
@@ -1153,8 +1154,10 @@
Ecore_X_MWM_Hint_Decor *dhint,
Ecore_X_MWM_Hint_Input *ihint);
+/* netwm */
EAPI void ecore_x_netwm_init(void);
EAPI void ecore_x_netwm_wm_identify(Ecore_X_Window root,
Ecore_X_Window check, const char *wm_name);
+EAPI void ecore_x_netwm_supported(Ecore_X_Window root,
Ecore_X_Atom atom, int supported);
EAPI void ecore_x_netwm_desk_count_set(Ecore_X_Window root,
unsigned int n_desks);
EAPI void ecore_x_netwm_desk_roots_set(Ecore_X_Window root,
unsigned int n_desks, Ecore_X_Window * vroots);
EAPI void ecore_x_netwm_desk_names_set(Ecore_X_Window root,
unsigned int n_desks, const char **names);
===================================================================
RCS file:
/cvsroot/enlightenment/e17/libs/ecore/src/lib/ecore_x/Ecore_X_Atoms.h,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -3 -r1.7 -r1.8
--- Ecore_X_Atoms.h 28 Apr 2005 06:50:11 -0000 1.7
+++ Ecore_X_Atoms.h 16 May 2005 12:59:26 -0000 1.8
@@ -44,6 +44,9 @@
extern Ecore_X_Atom ECORE_X_ATOM_WIN_LAYER;
/* EWMH */
+extern Ecore_X_Atom ECORE_X_ATOM_NET_SUPPORTED;
+extern Ecore_X_Atom ECORE_X_ATOM_NET_SUPPORTING_WM_CHECK;
+
extern Ecore_X_Atom ECORE_X_ATOM_NET_NUMBER_OF_DESKTOPS;
extern Ecore_X_Atom ECORE_X_ATOM_NET_VIRTUAL_ROOTS;
extern Ecore_X_Atom ECORE_X_ATOM_NET_DESKTOP_NAMES;
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ecore/src/lib/ecore_x/ecore_x.c,v
retrieving revision 1.79
retrieving revision 1.80
diff -u -3 -r1.79 -r1.80
--- ecore_x.c 3 May 2005 04:28:15 -0000 1.79
+++ ecore_x.c 16 May 2005 12:59:26 -0000 1.80
@@ -544,10 +544,10 @@
Window root_r;
Window parent_r;
Window *children_r = NULL;
- int num_children = 0;
+ unsigned int num_children = 0;
while (XQueryTree(_ecore_x_disp, root, &root_r, &parent_r,
- &children_r, &num_children) && num_children > 0)
+ &children_r, &num_children) && (num_children > 0))
{
for (j = 0; j < num_children; ++j)
{
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ecore/src/lib/ecore_x/ecore_x_e.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -3 -r1.1 -r1.2
--- ecore_x_e.c 14 Mar 2005 15:32:10 -0000 1.1
+++ ecore_x_e.c 16 May 2005 12:59:26 -0000 1.2
@@ -27,7 +27,7 @@
void
ecore_x_e_frame_size_set(Ecore_X_Window win, int fl, int fr, int ft, int fb)
{
- int frames[4];
+ unsigned int frames[4];
frames[0] = fl;
frames[1] = fr;
===================================================================
RCS file:
/cvsroot/enlightenment/e17/libs/ecore/src/lib/ecore_x/ecore_x_events.c,v
retrieving revision 1.55
retrieving revision 1.56
diff -u -3 -r1.55 -r1.56
--- ecore_x_events.c 2 May 2005 08:13:25 -0000 1.55
+++ ecore_x_events.c 16 May 2005 12:59:26 -0000 1.56
@@ -1030,6 +1030,8 @@
xnotify.selection = xevent->xselectionrequest.selection;
xnotify.target = xevent->xselectionrequest.target;
xnotify.time = CurrentTime;
+ xnotify.send_event = True;
+ xnotify.serial = 0;
if ((sd = _ecore_x_selection_get(xnotify.selection))
&& (sd->win == xevent->xselectionrequest.owner))
===================================================================
RCS file:
/cvsroot/enlightenment/e17/libs/ecore/src/lib/ecore_x/ecore_x_icccm.c,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -3 -r1.25 -r1.26
--- ecore_x_icccm.c 29 Apr 2005 08:48:04 -0000 1.25
+++ ecore_x_icccm.c 16 May 2005 12:59:26 -0000 1.26
@@ -489,7 +489,7 @@
if (xprop.encoding == ECORE_X_ATOM_UTF8_STRING)
{
- t = strdup(xprop.value);
+ t = strdup((char *)xprop.value);
}
else
{
@@ -506,7 +506,7 @@
if ((ret == XLocaleNotSupported) ||
(ret == XNoMemory) || (ret == XConverterNotFound))
{
- t = strdup(xprop.value);
+ t = strdup((char *)xprop.value);
}
else if (ret >= Success)
{
===================================================================
RCS file:
/cvsroot/enlightenment/e17/libs/ecore/src/lib/ecore_x/ecore_x_netwm.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -3 -r1.15 -r1.16
--- ecore_x_netwm.c 28 Apr 2005 12:26:34 -0000 1.15
+++ ecore_x_netwm.c 16 May 2005 12:59:26 -0000 1.16
@@ -380,9 +380,74 @@
}
/*
- * Desktop configuration and status
+ * Set supported atoms
*/
+void
+ecore_x_netwm_supported(Ecore_X_Window root, Ecore_X_Atom atom, int supported)
+{
+ Ecore_X_Atom *oldset = NULL, *newset = NULL;
+ int i, j = 0, num = 0;
+ unsigned char *data = NULL;
+ unsigned char *old_data = NULL;
+
+ ecore_x_window_prop_property_get(root, ECORE_X_ATOM_NET_SUPPORTED,
+ XA_ATOM, 32, &old_data, &num);
+ oldset = (Ecore_X_Atom *)old_data;
+
+ if (supported)
+ {
+ for (i = 0; i < num; ++i)
+ {
+ if (oldset[i] == atom)
+ goto done;
+ }
+
+ newset = calloc(num + 1, sizeof(Ecore_X_Atom));
+ if (!newset)
+ goto done;
+
+ data = (unsigned char *) newset;
+ for (i = 0; i < num; i++)
+ newset[i] = oldset[i];
+ newset[num] = atom;
+
+ ecore_x_window_prop_property_set(root, ECORE_X_ATOM_NET_SUPPORTED,
+ XA_ATOM, 32, data, num + 1);
+ }
+ else
+ {
+ int has;
+
+ has = 0;
+ for (i = 0; i < num; ++i)
+ {
+ if (oldset[i] == atom)
+ has = 1;
+ }
+ if (!has)
+ goto done;
+
+ newset = calloc(num - 1, sizeof(Ecore_X_Atom));
+ if (!newset)
+ goto done;
+
+ data = (unsigned char *) newset;
+ for (i = 0; i < num; i++)
+ if (oldset[i] != atom)
+ newset[j++] = oldset[i];
+ ecore_x_window_prop_property_set(root, ECORE_X_ATOM_NET_SUPPORTED,
+ XA_ATOM, 32, data, num - 1);
+ }
+ free(newset);
+done:
+ XFree(oldset);
+}
+
+
+/*
+ * Desktop configuration and status
+ */
void
ecore_x_netwm_desk_count_set(Ecore_X_Window root, unsigned int n_desks)
{
@@ -455,7 +520,7 @@
int columns, int rows,
int starting_corner)
{
- int layout[4];
+ unsigned int layout[4];
layout[0] = orientation;
layout[1] = columns;
@@ -583,9 +648,12 @@
ecore_x_netwm_desktop_get(Ecore_X_Window win, unsigned int *desk)
{
int ret;
+ unsigned int tmp;
+
ret = ecore_x_window_prop_card32_get(win, ECORE_X_ATOM_NET_WM_DESKTOP,
- desk, 1);
+ &tmp, 1);
+ if (desk) *desk = tmp;
return ret == 1 ? 1 : 0;
}
@@ -596,7 +664,7 @@
ecore_x_netwm_strut_set(Ecore_X_Window win, int left, int right,
int top, int bottom)
{
- int strut[4];
+ unsigned int strut[4];
ecore_x_netwm_strut_partial_set(win, left, right, top, bottom, 0, 0, 0, 0,
0, 0, 0, 0);
@@ -618,7 +686,7 @@
int ret = 0;
int left_start_y, left_end_y, right_start_y, right_end_y;
int top_start_x, top_end_x, bottom_start_x, bottom_end_x;
- int strut[4];
+ unsigned int strut[4];
ret = ecore_x_netwm_strut_partial_get(win, left, right, top, bottom,
&left_start_y, &left_end_y,
&right_start_y, &right_end_y,
@@ -630,10 +698,10 @@
if (ret != 4)
return 0;
- *left = strut[0];
- *right = strut[1];
- *top = strut[2];
- *bottom = strut[3];
+ if (left) *left = strut[0];
+ if (right) *right = strut[1];
+ if (top) *top = strut[2];
+ if (bottom) *bottom = strut[3];
return 1;
}
@@ -643,7 +711,7 @@
int right_start_y, int right_end_y, int
top_start_x,
int top_end_x, int bottom_start_x, int
bottom_end_x)
{
- int strut[12];
+ unsigned int strut[12];
strut[0] = left;
strut[1] = right;
@@ -667,31 +735,31 @@
int *top_end_x, int *bottom_start_x, int
*bottom_end_x)
{
int ret = 0;
- int strut[12];
+ unsigned int strut[12];
ret = ecore_x_window_prop_card32_get(win,
ECORE_X_ATOM_NET_WM_STRUT_PARTIAL, strut, 12);
if (ret != 12)
return 0;
- *left = strut[0];
- *right = strut[1];
- *top = strut[2];
- *bottom = strut[3];
- *left_start_y = strut[4];
- *left_end_y = strut[5];
- *right_start_y = strut[6];
- *right_end_y = strut[7];
- *top_start_x = strut[8];
- *top_end_x = strut[9];
- *bottom_start_x = strut[10];
- *bottom_end_x = strut[11];
+ if (left) *left = strut[0];
+ if (right) *right = strut[1];
+ if (top) *top = strut[2];
+ if (bottom) *bottom = strut[3];
+ if (left_start_y) *left_start_y = strut[4];
+ if (left_end_y) *left_end_y = strut[5];
+ if (right_start_y) *right_start_y = strut[6];
+ if (right_end_y) *right_end_y = strut[7];
+ if (top_start_x) *top_start_x = strut[8];
+ if (top_end_x) *top_end_x = strut[9];
+ if (bottom_start_x) *bottom_start_x = strut[10];
+ if (bottom_end_x) *bottom_end_x = strut[11];
return 1;
}
void
ecore_x_netwm_icon_geometry_set(Ecore_X_Window win, int x, int y, int width,
int height)
{
- int geometry[4];
+ unsigned int geometry[4];
geometry[0] = x;
geometry[1] = y;
@@ -704,32 +772,38 @@
ecore_x_netwm_icon_geometry_get(Ecore_X_Window win, int *x, int *y, int
*width, int *height)
{
int ret;
- int geometry[4];
+ unsigned int geometry[4];
ret = ecore_x_window_prop_card32_get(win,
ECORE_X_ATOM_NET_WM_ICON_GEOMETRY, geometry, 4);
if (ret != 4)
return 0;
- *x = geometry[0];
- *y = geometry[1];
- *width = geometry[2];
- *height = geometry[3];
+ if (x) *x = geometry[0];
+ if (y) *y = geometry[1];
+ if (width) *width = geometry[2];
+ if (height) *height = geometry[3];
return 1;
}
void
ecore_x_netwm_pid_set(Ecore_X_Window win, int pid)
{
+ unsigned int tmp;
+
+ tmp = pid;
ecore_x_window_prop_card32_set(win, ECORE_X_ATOM_NET_WM_PID,
- &pid, 1);
+ &tmp, 1);
}
int
ecore_x_netwm_pid_get(Ecore_X_Window win, int *pid)
{
int ret;
+ unsigned int tmp;
+
ret = ecore_x_window_prop_card32_get(win, ECORE_X_ATOM_NET_WM_PID,
- pid, 1);
+ &tmp, 1);
+ if (pid) *pid = tmp;
return ret == 1 ? 1 : 0;
}
@@ -752,16 +826,22 @@
void
ecore_x_netwm_user_time_set(Ecore_X_Window win, int time)
{
+ unsigned int tmp;
+
+ tmp = time;
ecore_x_window_prop_card32_set(win, ECORE_X_ATOM_NET_WM_USER_TIME,
- &time, 1);
+ &tmp, 1);
}
int
ecore_x_netwm_user_time_get(Ecore_X_Window win, int *time)
{
int ret;
+ unsigned int tmp;
+
ret = ecore_x_window_prop_card32_get(win, ECORE_X_ATOM_NET_WM_USER_TIME,
- time, 1);
+ &tmp, 1);
+ if (time) *time = tmp;
return ret == 1 ? 1 : 0;
}
@@ -874,13 +954,16 @@
if (on)
{
- if (ecore_x_netwm_window_state_isset(win, state))
+ for (i = 0; i < num; ++i)
{
- XFree(old_data);
- return;
+ if (oldset[i] == atom)
+ goto done;
}
+
newset = calloc(num + 1, sizeof(Ecore_X_Atom));
- if (!newset) return;
+ if (!newset)
+ goto done;
+
data = (unsigned char *) newset;
for (i = 0; i < num; i++)
@@ -892,17 +975,21 @@
}
else
{
- if (!ecore_x_netwm_window_state_isset(win, state))
+ int has;
+
+ has = 0;
+ for (i = 0; i < num; ++i)
{
- XFree(old_data);
- return;
+ if (oldset[i] == atom)
+ has = 1;
}
+ if (!has)
+ goto done;
+
newset = calloc(num - 1, sizeof(Ecore_X_Atom));
if (!newset)
- {
- XFree(old_data);
- return;
- }
+ goto done;
+
data = (unsigned char *) newset;
for (i = 0; i < num; i++)
if (oldset[i] != atom)
@@ -911,8 +998,9 @@
ecore_x_window_prop_property_set(win, ECORE_X_ATOM_NET_WM_STATE,
XA_ATOM, 32, data, num - 1);
}
- XFree(oldset);
free(newset);
+done:
+ XFree(oldset);
}
static Ecore_X_Window_Type
@@ -1085,15 +1173,17 @@
if (on)
{
- if (ecore_x_netwm_allowed_action_isset(win, action))
+ for (i = 0; i < num; ++i)
{
- XFree(old_data);
- return;
+ if (oldset[i] == atom)
+ goto done;
}
+
newset = calloc(num + 1, sizeof(Ecore_X_Atom));
- if (!newset) return;
- data = (unsigned char *) newset;
+ if (!newset)
+ goto done;
+ data = (unsigned char *) newset;
for (i = 0; i < num; i++)
newset[i] = oldset[i];
newset[num] = atom;
@@ -1103,17 +1193,21 @@
}
else
{
- if (!ecore_x_netwm_allowed_action_isset(win, action))
+ int has;
+
+ has = 0;
+ for (i = 0; i < num; ++i)
{
- XFree(old_data);
- return;
+ if (oldset[i] == atom)
+ has = 1;
}
+ if (!has)
+ goto done;
+
newset = calloc(num - 1, sizeof(Ecore_X_Atom));
if (!newset)
- {
- XFree(old_data);
- return;
- }
+ goto done;
+
data = (unsigned char *) newset;
for (i = 0; i < num; i++)
if (oldset[i] != atom)
@@ -1122,8 +1216,9 @@
ecore_x_window_prop_property_set(win,
ECORE_X_ATOM_NET_WM_ALLOWED_ACTIONS,
XA_ATOM, 32, data, num - 1);
}
- XFree(oldset);
free(newset);
+done:
+ XFree(oldset);
}
void
@@ -1137,15 +1232,18 @@
ecore_x_netwm_opacity_get(Ecore_X_Window win, unsigned int *opacity)
{
int ret;
+ unsigned int tmp;
+
ret = ecore_x_window_prop_card32_get(win,
ECORE_X_ATOM_NET_WM_WINDOW_OPACITY,
- opacity, 1);
+ &tmp, 1);
+ if (opacity) *opacity = tmp;
return ret == 1 ? 1 : 0;
}
void
ecore_x_netwm_frame_size_set(Ecore_X_Window win, int fl, int fr, int ft, int
fb)
{
- int frames[4];
+ unsigned int frames[4];
frames[0] = fl;
frames[1] = fr;
@@ -1158,16 +1256,16 @@
ecore_x_netwm_frame_size_get(Ecore_X_Window win, int *fl, int *fr, int *ft,
int *fb)
{
int ret = 0;
- int frames[4];
+ unsigned int frames[4];
ret = ecore_x_window_prop_card32_get(win, ECORE_X_ATOM_NET_FRAME_EXTENTS,
frames, 4);
if (ret != 4)
return 0;
- *fl = frames[0];
- *fr = frames[1];
- *ft = frames[2];
- *fb = frames[3];
+ if (fl) *fl = frames[0];
+ if (fr) *fr = frames[1];
+ if (ft) *ft = frames[2];
+ if (fb) *fb = frames[3];
return 1;
}
===================================================================
RCS file:
/cvsroot/enlightenment/e17/libs/ecore/src/lib/ecore_x/ecore_x_selection.c,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -3 -r1.25 -r1.26
--- ecore_x_selection.c 11 Apr 2005 21:41:45 -0000 1.25
+++ ecore_x_selection.c 16 May 2005 12:59:26 -0000 1.26
@@ -494,7 +494,7 @@
#ifdef X_HAVE_UTF8_STRING
if (Xutf8TextListToTextProperty(_ecore_x_disp, &mystr, 1, style,
&text_prop) == Success)
{
- int bufsize = strlen(text_prop.value) + 1;
+ int bufsize = strlen((char *)text_prop.value) + 1;
*data_ret = malloc(bufsize);
memcpy(*data_ret, text_prop.value, bufsize);
*size_ret = bufsize;
@@ -718,7 +718,7 @@
data[size - 1] = 0;
}
- sel->text = data;
+ sel->text = (char *)data;
ECORE_X_SELECTION_DATA(sel)->free = _ecore_x_selection_data_text_free;
return sel;
}
===================================================================
RCS file:
/cvsroot/enlightenment/e17/libs/ecore/src/lib/ecore_x/ecore_x_window_prop.c,v
retrieving revision 1.64
retrieving revision 1.65
diff -u -3 -r1.64 -r1.65
--- ecore_x_window_prop.c 29 Apr 2005 08:48:04 -0000 1.64
+++ ecore_x_window_prop.c 16 May 2005 12:59:26 -0000 1.65
@@ -162,7 +162,7 @@
XTextProperty xtp;
if (win == 0) win = DefaultRootWindow(_ecore_x_disp);
- xtp.value = (char*)str;
+ xtp.value = (unsigned char *)str;
xtp.format = 8;
xtp.encoding = ECORE_X_ATOM_UTF8_STRING;
xtp.nitems = strlen(str);
-------------------------------------------------------
This SF.Net email is sponsored by Oracle Space Sweepstakes
Want to be the first software developer in space?
Enter now for the Oracle Space Sweepstakes!
http://ads.osdn.com/?ad_id=7412&alloc_id=16344&op=click
_______________________________________________
enlightenment-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs