forked from enlightenment/efl
More ICCCM code, replicated from window_prop*. Corresponding functions are
deprecated and will be removed in the future. SVN revision: 12268
This commit is contained in:
parent
dcc1b8cea2
commit
00ea891439
|
@ -995,6 +995,24 @@ EAPI int ecore_x_client_message8_send(Ecore_X_Window win, Ecore_X_A
|
||||||
ecore_x_icccm_title_set(Ecore_X_Window win, const char *t);
|
ecore_x_icccm_title_set(Ecore_X_Window win, const char *t);
|
||||||
EAPI char *
|
EAPI char *
|
||||||
ecore_x_icccm_title_get(Ecore_X_Window win);
|
ecore_x_icccm_title_get(Ecore_X_Window win);
|
||||||
|
EAPI void
|
||||||
|
ecore_x_icccm_protocol_set(Ecore_X_Window win,
|
||||||
|
Ecore_X_WM_Protocol protocol,
|
||||||
|
int on);
|
||||||
|
EAPI int
|
||||||
|
ecore_x_icccm_protocol_isset(Ecore_X_Window win,
|
||||||
|
Ecore_X_WM_Protocol protocol);
|
||||||
|
EAPI void
|
||||||
|
ecore_x_icccm_name_class_set(Ecore_X_Window win,
|
||||||
|
const char *n,
|
||||||
|
const char *c);
|
||||||
|
EAPI char *
|
||||||
|
ecore_x_icccm_client_machine_get(Ecore_X_Window win);
|
||||||
|
EAPI void
|
||||||
|
ecore_x_icccm_command_set(Ecore_X_Window win, int argc, char **argv);
|
||||||
|
EAPI void
|
||||||
|
ecore_x_icccm_command_get(Ecore_X_Window win, int *argc, char ***argv);
|
||||||
|
|
||||||
|
|
||||||
typedef enum _Ecore_X_MWM_Hint_Func
|
typedef enum _Ecore_X_MWM_Hint_Func
|
||||||
{
|
{
|
||||||
|
|
|
@ -409,6 +409,191 @@ ecore_x_icccm_title_get(Ecore_X_Window win)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set or unset a wm protocol property.
|
||||||
|
* @param win The Window
|
||||||
|
* @param protocol The protocol to enable/disable
|
||||||
|
* @param on On/Off
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
ecore_x_icccm_protocol_set(Ecore_X_Window win,
|
||||||
|
Ecore_X_WM_Protocol protocol,
|
||||||
|
int on)
|
||||||
|
{
|
||||||
|
Atom *protos = NULL;
|
||||||
|
Atom proto;
|
||||||
|
int protos_count = 0;
|
||||||
|
int already_set = 0;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
/* Check for invalid values */
|
||||||
|
if (protocol < 0 || protocol >= ECORE_X_WM_PROTOCOL_NUM)
|
||||||
|
return;
|
||||||
|
|
||||||
|
proto = _ecore_x_atoms_wm_protocols[protocol];
|
||||||
|
|
||||||
|
if (!XGetWMProtocols(_ecore_x_disp, win, &protos, &protos_count))
|
||||||
|
{
|
||||||
|
protos = NULL;
|
||||||
|
protos_count = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (i = 0; i < protos_count; i++)
|
||||||
|
{
|
||||||
|
if (protos[i] == proto)
|
||||||
|
{
|
||||||
|
already_set = 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (on)
|
||||||
|
{
|
||||||
|
Atom *new_protos = NULL;
|
||||||
|
|
||||||
|
if (already_set) goto leave;
|
||||||
|
new_protos = malloc((protos_count + 1) * sizeof(Atom));
|
||||||
|
if (!new_protos) goto leave;
|
||||||
|
for (i = 0; i < protos_count; i++)
|
||||||
|
new_protos[i] = protos[i];
|
||||||
|
new_protos[protos_count] = proto;
|
||||||
|
XSetWMProtocols(_ecore_x_disp, win, new_protos, protos_count + 1);
|
||||||
|
free(new_protos);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (!already_set) goto leave;
|
||||||
|
for (i = 0; i < protos_count; i++)
|
||||||
|
{
|
||||||
|
if (protos[i] == proto)
|
||||||
|
{
|
||||||
|
int j;
|
||||||
|
|
||||||
|
for (j = i + 1; j < protos_count; j++)
|
||||||
|
protos[j-1] = protos[j];
|
||||||
|
if (protos_count > 1)
|
||||||
|
XSetWMProtocols(_ecore_x_disp, win, protos,
|
||||||
|
protos_count - 1);
|
||||||
|
else
|
||||||
|
XDeleteProperty(_ecore_x_disp, win,
|
||||||
|
_ecore_x_atom_wm_protocols);
|
||||||
|
goto leave;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
leave:
|
||||||
|
if (protos)
|
||||||
|
XFree(protos);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determines whether a protocol is set for a window.
|
||||||
|
* @param win The Window
|
||||||
|
* @param protocol The protocol to query
|
||||||
|
* @return 1 if the protocol is set, else 0.
|
||||||
|
*/
|
||||||
|
int
|
||||||
|
ecore_x_icccm_protocol_isset(Ecore_X_Window win,
|
||||||
|
Ecore_X_WM_Protocol protocol)
|
||||||
|
{
|
||||||
|
Atom proto, *protos = NULL;
|
||||||
|
int i, ret = 0, protos_count = 0;
|
||||||
|
|
||||||
|
/* check for invalid values */
|
||||||
|
if (protocol < 0 || protocol >= ECORE_X_WM_PROTOCOL_NUM)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
proto = _ecore_x_atoms_wm_protocols[protocol];
|
||||||
|
|
||||||
|
if (!XGetWMProtocols(_ecore_x_disp, win, &protos, &protos_count))
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
for (i = 0; i < protos_count; i++)
|
||||||
|
if (protos[i] == proto)
|
||||||
|
{
|
||||||
|
ret = 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
XFree(protos);
|
||||||
|
return ret;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set a window name & class.
|
||||||
|
* @param win The window
|
||||||
|
* @param n The name string
|
||||||
|
* @param c The class string
|
||||||
|
*
|
||||||
|
* Set a window name * class
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
ecore_x_icccm_name_class_set(Ecore_X_Window win,
|
||||||
|
const char *n,
|
||||||
|
const char *c)
|
||||||
|
{
|
||||||
|
XClassHint *xch;
|
||||||
|
|
||||||
|
xch = XAllocClassHint();
|
||||||
|
if (!xch)
|
||||||
|
return;
|
||||||
|
xch->res_name = (char *)n;
|
||||||
|
xch->res_class = (char *)c;
|
||||||
|
XSetClassHint(_ecore_x_disp, win, xch);
|
||||||
|
XFree(xch);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
char *
|
||||||
|
ecore_x_icccm_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;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the WM_COMMAND property for @a win.
|
||||||
|
*
|
||||||
|
* @param win The window.
|
||||||
|
* @param argc Number of arguments.
|
||||||
|
* @param argv Arguments.
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
ecore_x_icccm_command_set(Ecore_X_Window win, int argc, char **argv)
|
||||||
|
{
|
||||||
|
XSetCommand(_ecore_x_disp, win, argv, argc);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the WM_COMMAND property for @a win.
|
||||||
|
*
|
||||||
|
* Return the command of a window. String must be free'd when done with.
|
||||||
|
*
|
||||||
|
* @param win The window.
|
||||||
|
* @param argc Number of arguments.
|
||||||
|
* @param argv Arguments.
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
ecore_x_window_icccm_command_get(Ecore_X_Window win, int *argc, char ***argv)
|
||||||
|
{
|
||||||
|
XGetCommand(_ecore_x_disp, win, argv, argc);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* FIXME: move these things in here as they are icccm related */
|
/* FIXME: move these things in here as they are icccm related */
|
||||||
/* get/set wm protocols */
|
/* get/set wm protocols */
|
||||||
/* get/set name/class */
|
/* get/set name/class */
|
||||||
|
|
|
@ -260,6 +260,8 @@ ecore_x_window_prop_title_get(Ecore_X_Window win)
|
||||||
* @param win The window.
|
* @param win The window.
|
||||||
* @param argc Number of arguments.
|
* @param argc Number of arguments.
|
||||||
* @param argv Arguments.
|
* @param argv Arguments.
|
||||||
|
*
|
||||||
|
* DEPRECATED. Please use ecore_x_icccm_command_set() instead.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
ecore_x_window_prop_command_set(Ecore_X_Window win, int argc, char **argv)
|
ecore_x_window_prop_command_set(Ecore_X_Window win, int argc, char **argv)
|
||||||
|
@ -275,6 +277,8 @@ ecore_x_window_prop_command_set(Ecore_X_Window win, int argc, char **argv)
|
||||||
* @param win The window.
|
* @param win The window.
|
||||||
* @param argc Number of arguments.
|
* @param argc Number of arguments.
|
||||||
* @param argv Arguments.
|
* @param argv Arguments.
|
||||||
|
*
|
||||||
|
* DEPRECATED. Please use ecore_x_icccm_command_get() instead.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
ecore_x_window_prop_command_get(Ecore_X_Window win, int *argc, char ***argv)
|
ecore_x_window_prop_command_get(Ecore_X_Window win, int *argc, char ***argv)
|
||||||
|
@ -382,6 +386,7 @@ ecore_x_window_prop_visible_icon_name_get(Ecore_X_Window win)
|
||||||
* @return The windows client machine string
|
* @return The windows client machine string
|
||||||
*
|
*
|
||||||
* Return the client machine of a window. String must be free'd when done with.
|
* Return the client machine of a window. String must be free'd when done with.
|
||||||
|
* DEPRECATED. Please use ecore_x_icccm_client_machine_get() instead.
|
||||||
*/
|
*/
|
||||||
char *
|
char *
|
||||||
ecore_x_window_prop_client_machine_get(Ecore_X_Window win)
|
ecore_x_window_prop_client_machine_get(Ecore_X_Window win)
|
||||||
|
@ -423,6 +428,7 @@ ecore_x_window_prop_pid_get(Ecore_X_Window win)
|
||||||
* @param c The class string
|
* @param c The class string
|
||||||
*
|
*
|
||||||
* Set a window name * class
|
* Set a window name * class
|
||||||
|
* DEPRECATED. Please use ecore_x_icccm_name_class_set() instead.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
ecore_x_window_prop_name_class_set(Ecore_X_Window win, const char *n, const char *c)
|
ecore_x_window_prop_name_class_set(Ecore_X_Window win, const char *n, const char *c)
|
||||||
|
@ -473,7 +479,8 @@ ecore_x_window_prop_name_class_get(Ecore_X_Window win, char **n, char **c)
|
||||||
* @param win The Window
|
* @param win The Window
|
||||||
* @param protocol The protocol to enable/disable
|
* @param protocol The protocol to enable/disable
|
||||||
* @param on On/Off
|
* @param on On/Off
|
||||||
*
|
*
|
||||||
|
* DEPRECATED. Please use ecore_x_icccm_protocol_set() instead.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
ecore_x_window_prop_protocol_set(Ecore_X_Window win,
|
ecore_x_window_prop_protocol_set(Ecore_X_Window win,
|
||||||
|
@ -547,6 +554,8 @@ ecore_x_window_prop_protocol_set(Ecore_X_Window win,
|
||||||
* @param win The Window
|
* @param win The Window
|
||||||
* @param protocol The protocol to query
|
* @param protocol The protocol to query
|
||||||
* @return 1 if the protocol is set, else 0.
|
* @return 1 if the protocol is set, else 0.
|
||||||
|
*
|
||||||
|
* DEPRECATED. Please use ecore_x_icccm_protocol_isset() instead.
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
ecore_x_window_prop_protocol_isset(Ecore_X_Window win,
|
ecore_x_window_prop_protocol_isset(Ecore_X_Window win,
|
||||||
|
|
Loading…
Reference in New Issue