API for manipulating the WM_CLIENT_MACHINE string.

SVN revision: 7556
This commit is contained in:
rbdpngn 2003-10-12 17:35:35 +00:00 committed by rbdpngn
parent 7d371a9fb3
commit 24d7903e31
6 changed files with 110 additions and 22 deletions

View File

@ -455,6 +455,19 @@ handler_x_window_prop_visible_icon_name_change(void *data, int type, void *event
return 1;
}
int
handler_x_window_prop_client_machine_change(void *data, int type, void *event)
{
Ecore_X_Event_Window_Prop_Client_Machine_Change *e;
e = event;
if (e->name)
printf("Client machine change to \"%s\"\n", e->name);
else
printf("Client machine deleted\n");
return 1;
}
int
handler_x_window_prop_name_class_change(void *data, int type, void *event)
{
@ -505,6 +518,15 @@ setup_ecore_x_test(void)
}
printf("Visible icon Name: %s\n", tmp);
free(tmp);
tmp = ecore_x_window_prop_client_machine_get(win);
if (!tmp)
{
printf("No client machine, setting it to host.test.com\n");
ecore_x_window_prop_client_machine_set(win, "host.test.com");
tmp = ecore_x_window_prop_client_machine_get(win);
}
printf("Client machine: %s\n", tmp);
free(tmp);
ecore_x_window_prop_name_class_set(win, "ecore_test", "main");
ecore_x_window_prop_protocol_set(win, ECORE_X_WM_PROTOCOL_DELETE_REQUEST, 1);
ecore_x_window_show(win);

View File

@ -104,6 +104,7 @@ typedef struct _Ecore_X_Event_Window_Prop_Title_Change Ecore_X_Event
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_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;
struct _Ecore_X_Event_Key_Down
@ -393,6 +394,13 @@ struct _Ecore_X_Event_Window_Prop_Visible_Icon_Name_Change
Ecore_X_Time time;
};
struct _Ecore_X_Event_Window_Prop_Client_Machine_Change
{
Ecore_X_Window win;
char *name;
Ecore_X_Time time;
};
struct _Ecore_X_Event_Window_Prop_Name_Class_Change
{
Ecore_X_Window win;
@ -440,6 +448,7 @@ 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_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_MODIFIER_SHIFT;
@ -527,6 +536,8 @@ void ecore_x_window_prop_icon_name_set(Ecore_X_Window win, const cha
char *ecore_x_window_prop_icon_name_get(Ecore_X_Window win);
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);
void ecore_x_window_prop_client_machine_set(Ecore_X_Window win, const char *t);
char *ecore_x_window_prop_client_machine_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);

View File

@ -30,6 +30,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_wm_client_machine = 0;
Atom _ecore_x_atom_motif_wm_hints = 0;
Atom _ecore_x_atom_win_layer = 0;
Atom _ecore_x_atom_net_wm_desktop = 0;
@ -96,6 +97,7 @@ 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_EVENT_WINDOW_PROP_VISIBLE_ICON_NAME_CHANGE = 0;
int ECORE_X_EVENT_WINDOW_PROP_CLIENT_MACHINE_CHANGE = 0;
int ECORE_X_MODIFIER_SHIFT = 0;
int ECORE_X_MODIFIER_CTRL = 0;
@ -251,6 +253,7 @@ ecore_x_init(const char *name)
_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_wm_client_machine = XInternAtom(_ecore_x_disp, "WM_CLIENT_MACHINE", 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);
@ -396,7 +399,7 @@ ecore_x_killall(Ecore_X_Window root)
Window parent_r;
Window *children_r = NULL;
int num_children = 0;
Window root = RootWindow(d->display, i);
Window root = RootWindow(_ecore_x_disp, i);
while (XQueryTree(_ecore_x_disp, root, &root_r, &parent_r,
&children_r, &num_children) && num_children > 0)

View File

@ -7,6 +7,7 @@ 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_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_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);
@ -33,26 +34,12 @@ _ecore_x_event_free_window_prop_title_change(void *data, void *ev)
}
static void
_ecore_x_event_free_key_down(void *data, void *ev)
_ecore_x_event_free_window_prop_visible_title_change(void *data, void *ev)
{
Ecore_X_Event_Key_Down *e;
Ecore_X_Event_Window_Prop_Visible_Title_Change *e;
e = ev;
if (e->keyname) free(e->keyname);
if (e->keysymbol) free(e->keysymbol);
if (e->key_compose) free(e->key_compose);
free(e);
}
static void
_ecore_x_event_free_key_up(void *data, void *ev)
{
Ecore_X_Event_Key_Up *e;
e = ev;
if (e->keyname) free(e->keyname);
if (e->keysymbol) free(e->keysymbol);
if (e->key_compose) free(e->key_compose);
if (e->title) free(e->title);
free(e);
}
@ -77,12 +64,36 @@ _ecore_x_event_free_window_prop_visible_icon_name_change(void *data, void *ev)
}
static void
_ecore_x_event_free_window_prop_visible_title_change(void *data, void *ev)
_ecore_x_event_free_window_prop_client_machine_change(void *data, void *ev)
{
Ecore_X_Event_Window_Prop_Visible_Title_Change *e;
Ecore_X_Event_Window_Prop_Client_Machine_Change *e;
e = ev;
if (e->title) free(e->title);
if (e->name) free(e->name);
free(e);
}
static void
_ecore_x_event_free_key_down(void *data, void *ev)
{
Ecore_X_Event_Key_Down *e;
e = ev;
if (e->keyname) free(e->keyname);
if (e->keysymbol) free(e->keysymbol);
if (e->key_compose) free(e->key_compose);
free(e);
}
static void
_ecore_x_event_free_key_up(void *data, void *ev)
{
Ecore_X_Event_Key_Up *e;
e = ev;
if (e->keyname) free(e->keyname);
if (e->keysymbol) free(e->keysymbol);
if (e->key_compose) free(e->key_compose);
free(e);
}
@ -772,6 +783,15 @@ _ecore_x_event_handle_property_notify(XEvent *xevent)
e->name = ecore_x_window_prop_visible_icon_name_get(xevent->xproperty.window);
ecore_event_add(ECORE_X_EVENT_WINDOW_PROP_VISIBLE_ICON_NAME_CHANGE, e, _ecore_x_event_free_window_prop_visible_icon_name_change, NULL);
}
else if (xevent->xproperty.atom == _ecore_x_atom_wm_client_machine)
{
Ecore_X_Event_Window_Prop_Client_Machine_Change *e;
e = calloc(1, sizeof(Ecore_X_Event_Window_Prop_Client_Machine_Change));
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
{
Ecore_X_Event_Window_Property *e;

View File

@ -57,6 +57,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_wm_client_machine;
extern Atom _ecore_x_atom_motif_wm_hints;
extern Atom _ecore_x_atom_win_layer;
extern Atom _ecore_x_atom_net_wm_desktop;

View File

@ -276,6 +276,37 @@ ecore_x_window_prop_visible_icon_name_get(Ecore_X_Window win)
return name;
}
/**
* Set a window client machine.
* @param win The window
* @param t The client machine string
*
* Set a window client machine string
* <hr><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
*/
void
ecore_x_window_prop_client_machine_set(Ecore_X_Window win, const char *t)
{
ecore_x_window_prop_string_set(win, _ecore_x_atom_wm_client_machine, (char *)t);
}
/**
* Get a window client machine string.
* @param win The window
* @return The windows client machine string
*
* Return the client machine 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_client_machine_get(Ecore_X_Window win)
{
char *name;
name = ecore_x_window_prop_string_get(win, _ecore_x_atom_wm_client_machine);
return name;
}
/**
* Set a window name & class.
* @param win The window