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_window.c
ecore_x_window_prop.c
Log Message:
Missed assigning an event for client machine change. Also added support for
_NET_WM_PID.
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ecore/src/lib/ecore_x/Ecore_X.h,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -3 -r1.11 -r1.12
--- Ecore_X.h 13 Oct 2003 16:28:30 -0000 1.11
+++ Ecore_X.h 13 Oct 2003 17:36:09 -0000 1.12
@@ -106,6 +106,7 @@
typedef struct _Ecore_X_Event_Window_Prop_Visible_Icon_Name_Change
Ecore_X_Event_Window_Prop_Visible_Icon_Name_Change;
typedef struct _Ecore_X_Event_Window_Prop_Client_Machine_Change
Ecore_X_Event_Window_Prop_Client_Machine_Change;
typedef struct _Ecore_X_Event_Window_Prop_Name_Class_Change
Ecore_X_Event_Window_Prop_Name_Class_Change;
+typedef struct _Ecore_X_Event_Window_Prop_Pid_Change
Ecore_X_Event_Window_Prop_Pid_Change;
struct _Ecore_X_Event_Key_Down
{
@@ -409,6 +410,13 @@
Ecore_X_Time time;
};
+struct _Ecore_X_Event_Window_Prop_Pid_Change
+{
+ Ecore_X_Window win;
+ pid_t pid;
+ Ecore_X_Time time;
+};
+
extern int ECORE_X_EVENT_KEY_DOWN;
extern int ECORE_X_EVENT_KEY_UP;
extern int ECORE_X_EVENT_MOUSE_BUTTON_DOWN;
@@ -450,6 +458,7 @@
extern int ECORE_X_EVENT_WINDOW_PROP_VISIBLE_ICON_NAME_CHANGE;
extern int ECORE_X_EVENT_WINDOW_PROP_CLIENT_MACHINE_CHANGE;
extern int ECORE_X_EVENT_WINDOW_PROP_NAME_CLASS_CHANGE;
+extern int ECORE_X_EVENT_WINDOW_PROP_PID_CHANGE;
extern int ECORE_X_MODIFIER_SHIFT;
extern int ECORE_X_MODIFIER_CTRL;
@@ -524,6 +533,7 @@
void ecore_x_window_reparent(Ecore_X_Window win, Ecore_X_Window
new_parent, int x, int y);
void ecore_x_window_size_get(Ecore_X_Window win, int *w, int *h);
void ecore_x_window_cursor_show(Ecore_X_Window win, int show);
+void ecore_x_window_defaults_set(Ecore_X_Window win);
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);
@@ -537,6 +547,7 @@
void ecore_x_window_prop_visible_icon_name_set(Ecore_X_Window win, const
char *t);
char *ecore_x_window_prop_visible_icon_name_get(Ecore_X_Window win);
char *ecore_x_window_prop_client_machine_get(Ecore_X_Window win);
+pid_t ecore_x_window_prop_pid_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.13
retrieving revision 1.14
diff -u -3 -r1.13 -r1.14
--- ecore_x.c 12 Oct 2003 22:39:12 -0000 1.13
+++ ecore_x.c 13 Oct 2003 17:36:09 -0000 1.14
@@ -98,6 +98,7 @@
int ECORE_X_EVENT_WINDOW_PROP_ICON_NAME_CHANGE = 0;
int ECORE_X_EVENT_WINDOW_PROP_VISIBLE_ICON_NAME_CHANGE = 0;
int ECORE_X_EVENT_WINDOW_PROP_CLIENT_MACHINE_CHANGE = 0;
+int ECORE_X_EVENT_WINDOW_PROP_PID_CHANGE = 0;
int ECORE_X_MODIFIER_SHIFT = 0;
int ECORE_X_MODIFIER_CTRL = 0;
@@ -219,6 +220,8 @@
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_EVENT_WINDOW_PROP_VISIBLE_ICON_NAME_CHANGE = ecore_event_type_new();
+ ECORE_X_EVENT_WINDOW_PROP_CLIENT_MACHINE_CHANGE = ecore_event_type_new();
+ ECORE_X_EVENT_WINDOW_PROP_PID_CHANGE = ecore_event_type_new();
}
ECORE_X_MODIFIER_SHIFT = _ecore_x_key_mask_get(XK_Shift_L);
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ecore/src/lib/ecore_x/ecore_x_events.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -3 -r1.8 -r1.9
--- ecore_x_events.c 12 Oct 2003 17:35:35 -0000 1.8
+++ ecore_x_events.c 13 Oct 2003 17:36:09 -0000 1.9
@@ -8,6 +8,7 @@
static void _ecore_x_event_free_window_prop_icon_name_change(void *data, void *ev);
static void _ecore_x_event_free_window_prop_visible_icon_name_change(void *data, void
*ev);
static void _ecore_x_event_free_window_prop_client_machine_change(void *data, void
*ev);
+static void _ecore_x_event_free_window_prop_pid_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);
@@ -74,6 +75,15 @@
}
static void
+_ecore_x_event_free_window_prop_pid_change(void *data, void *ev)
+{
+ Ecore_X_Event_Window_Prop_Client_Machine_Change *e;
+
+ e = ev;
+ free(e);
+}
+
+static void
_ecore_x_event_free_key_down(void *data, void *ev)
{
Ecore_X_Event_Key_Down *e;
@@ -791,6 +801,15 @@
if (!e) return;
e->name = ecore_x_window_prop_client_machine_get(xevent->xproperty.window);
ecore_event_add(ECORE_X_EVENT_WINDOW_PROP_CLIENT_MACHINE_CHANGE, e,
_ecore_x_event_free_window_prop_client_machine_change, NULL);
+ }
+ else if (xevent->xproperty.atom == _ecore_x_atom_net_wm_pid)
+ {
+ Ecore_X_Event_Window_Prop_Pid_Change *e;
+
+ e = calloc(1, sizeof(Ecore_X_Event_Window_Prop_Pid_Change));
+ if (!e) return;
+ e->pid = ecore_x_window_prop_pid_get(xevent->xproperty.window);
+ ecore_event_add(ECORE_X_EVENT_WINDOW_PROP_PID_CHANGE, e,
_ecore_x_event_free_window_prop_pid_change, NULL);
}
else
{
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ecore/src/lib/ecore_x/ecore_x_window.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -3 -r1.6 -r1.7
--- ecore_x_window.c 13 Oct 2003 16:28:30 -0000 1.6
+++ ecore_x_window.c 13 Oct 2003 17:36:09 -0000 1.7
@@ -17,7 +17,6 @@
Ecore_X_Window
ecore_x_window_new(Ecore_X_Window parent, int x, int y, int w, int h)
{
- char buf[MAXHOSTNAMELEN];
Window win;
XSetWindowAttributes attr;
@@ -57,13 +56,7 @@
CWEventMask,
&attr);
- if (parent == DefaultRootWindow(_ecore_x_disp))
- {
- gethostname(buf, MAXHOSTNAMELEN);
- buf[MAXHOSTNAMELEN - 1] = '\0';
- ecore_x_window_prop_string_set(win, _ecore_x_atom_wm_client_machine,
- (char *)buf);
- }
+ if (parent == DefaultRootWindow(_ecore_x_disp)) ecore_x_window_defaults_set(win);
return win;
}
@@ -82,7 +75,6 @@
Ecore_X_Window
ecore_x_window_override_new(Ecore_X_Window parent, int x, int y, int w, int h)
{
- char buf[MAXHOSTNAMELEN];
Window win;
XSetWindowAttributes attr;
@@ -122,13 +114,7 @@
CWEventMask,
&attr);
- if (parent == DefaultRootWindow(_ecore_x_disp))
- {
- gethostname(buf, MAXHOSTNAMELEN);
- buf[MAXHOSTNAMELEN - 1] = '\0';
- ecore_x_window_prop_string_set(win, _ecore_x_atom_wm_client_machine,
- (char *)buf);
- }
+ if (parent == DefaultRootWindow(_ecore_x_disp)) ecore_x_window_defaults_set(win);
return win;
}
@@ -147,7 +133,6 @@
Ecore_X_Window
ecore_x_window_input_new(Ecore_X_Window parent, int x, int y, int w, int h)
{
- char buf[MAXHOSTNAMELEN];
Window win;
XSetWindowAttributes attr;
@@ -179,12 +164,37 @@
if (parent == DefaultRootWindow(_ecore_x_disp))
{
- gethostname(buf, MAXHOSTNAMELEN);
- buf[MAXHOSTNAMELEN - 1] = '\0';
- ecore_x_window_prop_string_set(win, _ecore_x_atom_wm_client_machine,
- (char *)buf);
}
return win;
+}
+
+/**
+ * Set defaults for a window
+ * @param win The window to set defaults
+ *
+ * Set defaults for a window
+ * <hr><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
+ */
+void
+ecore_x_window_defaults_set(Ecore_X_Window win)
+{
+ long pid;
+ char buf[MAXHOSTNAMELEN];
+
+ /*
+ * Set WM_CLIENT_MACHINE.
+ */
+ gethostname(buf, MAXHOSTNAMELEN);
+ buf[MAXHOSTNAMELEN - 1] = '\0';
+ ecore_x_window_prop_string_set(win, _ecore_x_atom_wm_client_machine,
+ (char *)buf);
+
+ /*
+ * Set _NET_WM_PID
+ */
+ pid = getpid();
+ ecore_x_window_prop_property_set(win, _ecore_x_atom_net_wm_pid, XA_CARDINAL,
+ 32, &pid, 1);
}
/**
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ecore/src/lib/ecore_x/ecore_x_window_prop.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -3 -r1.12 -r1.13
--- ecore_x_window_prop.c 13 Oct 2003 16:28:30 -0000 1.12
+++ ecore_x_window_prop.c 13 Oct 2003 17:36:09 -0000 1.13
@@ -47,14 +47,14 @@
unsigned long num_ret = 0, bytes = 0, i;
unsigned char *prop_ret = NULL;
- if (!win)
- win = DefaultRootWindow(_ecore_x_disp);
+ if (!win) win = DefaultRootWindow(_ecore_x_disp);
ret = XGetWindowProperty(_ecore_x_disp, win, type, 0, LONG_MAX, False, format,
&type_ret, &size_ret, &num_ret, &bytes, &prop_ret);
- if (ret != Success) {
- *data = NULL;
- return 0;
- }
+ if (ret != Success)
+ {
+ *data = NULL;
+ return 0;
+ }
if (size != size_ret || !num_ret) {
XFree(prop_ret);
@@ -291,6 +291,28 @@
name = ecore_x_window_prop_string_get(win, _ecore_x_atom_wm_client_machine);
return name;
+}
+
+/**
+ * Get a windows process id
+ * @param win The window
+ * @return The windows process id
+ *
+ * Return the process id of a window.
+ * <hr><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
+ */
+pid_t
+ecore_x_window_prop_pid_get(Ecore_X_Window win)
+{
+ int num = 0;
+ long *tmp;
+ pid_t pid = 0;
+
+ ecore_x_window_prop_property_get(win, _ecore_x_atom_net_wm_pid, XA_CARDINAL,
+ 32, &tmp, &num);
+ if (num && tmp) pid = (pid_t)(*tmp);
+ free(tmp);
+ return pid;
}
/**
-------------------------------------------------------
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