2005-02-07 05:51:05 -08:00
|
|
|
/*
|
|
|
|
* vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
|
|
|
|
*/
|
2004-10-23 07:26:25 -07:00
|
|
|
/*
|
|
|
|
* _NET_WM... aka Extended Window Manager Hint (EWMH) functions.
|
|
|
|
*/
|
2004-12-08 12:29:45 -08:00
|
|
|
#include "config.h"
|
2004-10-23 07:26:25 -07:00
|
|
|
#include "Ecore.h"
|
|
|
|
#include "ecore_x_private.h"
|
|
|
|
#include "Ecore_X.h"
|
2004-12-04 02:10:29 -08:00
|
|
|
#include "Ecore_X_Atoms.h"
|
2004-10-23 07:26:25 -07:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Convenience macros
|
|
|
|
*/
|
2004-10-27 14:50:58 -07:00
|
|
|
#define _ATOM_GET(name) \
|
|
|
|
XInternAtom(_ecore_x_disp, name, False)
|
|
|
|
|
2004-12-08 12:29:45 -08:00
|
|
|
#define _ATOM_SET_UTF8_STRING(win, atom, string) \
|
2004-12-04 02:10:29 -08:00
|
|
|
XChangeProperty(_ecore_x_disp, win, atom, ECORE_X_ATOM_UTF8_STRING, 8, PropModeReplace, \
|
2004-10-23 07:26:25 -07:00
|
|
|
(unsigned char *)string, strlen(string))
|
2004-12-08 12:29:45 -08:00
|
|
|
#define _ATOM_SET_UTF8_STRING_LIST(win, atom, string, cnt) \
|
2004-12-04 02:10:29 -08:00
|
|
|
XChangeProperty(_ecore_x_disp, win, atom, ECORE_X_ATOM_UTF8_STRING, 8, PropModeReplace, \
|
2004-10-23 07:26:25 -07:00
|
|
|
(unsigned char *)string, cnt)
|
2004-12-08 12:29:45 -08:00
|
|
|
#define _ATOM_SET_WINDOW(win, atom, p_wins, cnt) \
|
2004-10-23 07:26:25 -07:00
|
|
|
XChangeProperty(_ecore_x_disp, win, atom, XA_WINDOW, 32, PropModeReplace, \
|
|
|
|
(unsigned char *)p_wins, cnt)
|
2004-12-08 12:29:45 -08:00
|
|
|
#define _ATOM_SET_ATOM(win, atom, p_atom, cnt) \
|
2004-10-23 07:26:25 -07:00
|
|
|
XChangeProperty(_ecore_x_disp, win, atom, XA_ATOM, 32, PropModeReplace, \
|
|
|
|
(unsigned char *)p_atom, cnt)
|
2004-12-08 12:29:45 -08:00
|
|
|
#define _ATOM_SET_CARD32(win, atom, p_val, cnt) \
|
2004-10-23 07:26:25 -07:00
|
|
|
XChangeProperty(_ecore_x_disp, win, atom, XA_CARDINAL, 32, PropModeReplace, \
|
|
|
|
(unsigned char *)p_val, cnt)
|
|
|
|
|
2004-11-29 15:25:12 -08:00
|
|
|
/*
|
|
|
|
* Convenience functions. Should probably go elsewhere.
|
|
|
|
*/
|
|
|
|
|
2004-12-08 12:29:45 -08:00
|
|
|
/*
|
|
|
|
* Set CARD32 (array) property
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
ecore_x_window_prop_card32_set(Ecore_X_Window win, Ecore_X_Atom atom,
|
|
|
|
unsigned int *val, unsigned int num)
|
|
|
|
{
|
|
|
|
#if SIZEOF_INT == 4
|
|
|
|
_ATOM_SET_CARD32(win, atom, val, num);
|
|
|
|
#else
|
|
|
|
CARD32 *c32;
|
|
|
|
unsigned int i;
|
|
|
|
|
|
|
|
c32 = malloc(num * sizeof(CARD32));
|
|
|
|
if (!c32)
|
|
|
|
return;
|
|
|
|
for (i = 0; i < num; i++)
|
|
|
|
c32[i] = val[i];
|
|
|
|
_ATOM_SET_CARD32(win, atom, c32, num);
|
|
|
|
free(c32);
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Get CARD32 (array) property
|
|
|
|
*
|
|
|
|
* At most len items are returned in val.
|
|
|
|
* If the property was successfully fetched the number of items stored in
|
|
|
|
* val is returned, otherwise -1 is returned.
|
|
|
|
* Note: Return value 0 means that the property exists but has no elements.
|
|
|
|
*/
|
|
|
|
int
|
|
|
|
ecore_x_window_prop_card32_get(Ecore_X_Window win, Ecore_X_Atom atom,
|
|
|
|
unsigned int *val, unsigned int len)
|
|
|
|
{
|
|
|
|
unsigned char *prop_ret;
|
|
|
|
Atom type_ret;
|
|
|
|
unsigned long bytes_after, num_ret;
|
|
|
|
int format_ret;
|
|
|
|
unsigned int i;
|
2004-12-09 11:29:24 -08:00
|
|
|
int num;
|
2004-12-08 12:29:45 -08:00
|
|
|
|
|
|
|
prop_ret = NULL;
|
|
|
|
XGetWindowProperty(_ecore_x_disp, win, atom, 0, 0x7fffffff, False,
|
2004-12-09 11:29:24 -08:00
|
|
|
XA_CARDINAL, &type_ret, &format_ret, &num_ret,
|
|
|
|
&bytes_after, &prop_ret);
|
|
|
|
if (prop_ret && type_ret == XA_CARDINAL && format_ret == 32)
|
2004-12-08 12:29:45 -08:00
|
|
|
{
|
|
|
|
if (num_ret < len)
|
|
|
|
len = num_ret;
|
|
|
|
for (i = 0; i < len; i++)
|
2004-12-09 11:29:24 -08:00
|
|
|
val[i] = ((unsigned long *)prop_ret)[i];
|
|
|
|
num = len;
|
2004-12-08 12:29:45 -08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2004-12-09 11:29:24 -08:00
|
|
|
num = -1;
|
2004-12-08 12:29:45 -08:00
|
|
|
}
|
|
|
|
if (prop_ret)
|
|
|
|
XFree(prop_ret);
|
|
|
|
|
2004-12-09 11:29:24 -08:00
|
|
|
return num;
|
2004-12-08 12:29:45 -08:00
|
|
|
}
|
|
|
|
|
2004-11-29 15:25:12 -08:00
|
|
|
/*
|
|
|
|
* Set UTF-8 string property
|
|
|
|
*/
|
|
|
|
static void
|
2004-12-04 02:10:29 -08:00
|
|
|
_ecore_x_window_prop_string_utf8_set(Ecore_X_Window win, Ecore_X_Atom atom,
|
|
|
|
const char *str)
|
2004-11-29 15:25:12 -08:00
|
|
|
{
|
|
|
|
_ATOM_SET_UTF8_STRING(win, atom, str);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Get UTF-8 string property
|
|
|
|
*/
|
2005-02-07 05:51:05 -08:00
|
|
|
static char *
|
2004-11-29 15:25:12 -08:00
|
|
|
_ecore_x_window_prop_string_utf8_get(Ecore_X_Window win, Ecore_X_Atom atom)
|
|
|
|
{
|
|
|
|
char *str;
|
2004-12-08 12:29:45 -08:00
|
|
|
unsigned char *prop_ret;
|
2004-11-29 15:25:12 -08:00
|
|
|
Atom type_ret;
|
|
|
|
unsigned long bytes_after, num_ret;
|
|
|
|
int format_ret;
|
|
|
|
|
|
|
|
str = NULL;
|
2004-12-08 12:29:45 -08:00
|
|
|
prop_ret = NULL;
|
2004-11-29 15:25:12 -08:00
|
|
|
XGetWindowProperty(_ecore_x_disp, win, atom, 0, 0x7fffffff, False,
|
2004-12-04 02:10:29 -08:00
|
|
|
ECORE_X_ATOM_UTF8_STRING, &type_ret,
|
2004-12-08 12:29:45 -08:00
|
|
|
&format_ret, &num_ret, &bytes_after, &prop_ret);
|
|
|
|
if (prop_ret && num_ret > 0 && format_ret == 8)
|
2004-11-29 15:25:12 -08:00
|
|
|
{
|
|
|
|
str = malloc(num_ret + 1);
|
|
|
|
if (str)
|
|
|
|
{
|
2004-12-08 12:29:45 -08:00
|
|
|
memcpy(str, prop_ret, num_ret);
|
2004-11-29 15:25:12 -08:00
|
|
|
str[num_ret] = '\0';
|
|
|
|
}
|
|
|
|
}
|
2004-12-08 12:29:45 -08:00
|
|
|
if (prop_ret)
|
|
|
|
XFree(prop_ret);
|
2004-11-29 15:25:12 -08:00
|
|
|
|
|
|
|
return str;
|
|
|
|
}
|
|
|
|
|
2005-03-01 23:06:44 -08:00
|
|
|
#if 0 /* Unused */
|
2004-12-29 21:36:01 -08:00
|
|
|
/* Set/clear atom in list */
|
|
|
|
static void
|
2005-02-07 05:51:05 -08:00
|
|
|
_ecore_x_netwm_atom_list_set(Ecore_X_Atom *atoms, int size, int *count,
|
2004-12-29 21:36:01 -08:00
|
|
|
Ecore_X_Atom atom, int set)
|
|
|
|
{
|
2005-02-07 05:51:05 -08:00
|
|
|
int i, n, in_list = 0;
|
2004-12-29 21:36:01 -08:00
|
|
|
|
|
|
|
n = *count;
|
|
|
|
/* Check if atom is in list or not (+get index) */
|
|
|
|
for (i = 0; i < n; i++)
|
|
|
|
if (atoms[i] == atom)
|
2005-02-07 05:51:05 -08:00
|
|
|
{
|
|
|
|
in_list = 1;
|
|
|
|
break;
|
|
|
|
}
|
2004-12-29 21:36:01 -08:00
|
|
|
|
|
|
|
if (set && !in_list)
|
|
|
|
{
|
|
|
|
/* Add it (if space left) */
|
|
|
|
if (n < size)
|
|
|
|
atoms[n++] = atom;
|
|
|
|
*count = n;
|
|
|
|
}
|
|
|
|
else if (!set && in_list)
|
|
|
|
{
|
|
|
|
/* Remove it */
|
|
|
|
atoms[i] = atoms[--n];
|
|
|
|
*count = n;
|
|
|
|
}
|
|
|
|
}
|
2005-03-01 23:06:44 -08:00
|
|
|
#endif
|
2004-12-29 21:36:01 -08:00
|
|
|
|
|
|
|
|
2004-10-27 14:50:58 -07:00
|
|
|
/*
|
|
|
|
* Root window NetWM hints.
|
|
|
|
*/
|
2004-12-04 02:10:29 -08:00
|
|
|
Ecore_X_Atom ECORE_X_ATOM_NET_SUPPORTED = 0;
|
|
|
|
Ecore_X_Atom ECORE_X_ATOM_NET_SUPPORTING_WM_CHECK = 0;
|
2004-10-27 14:50:58 -07:00
|
|
|
|
2004-12-04 02:10:29 -08:00
|
|
|
Ecore_X_Atom ECORE_X_ATOM_NET_NUMBER_OF_DESKTOPS = 0;
|
|
|
|
Ecore_X_Atom ECORE_X_ATOM_NET_VIRTUAL_ROOTS = 0;
|
|
|
|
Ecore_X_Atom ECORE_X_ATOM_NET_DESKTOP_NAMES = 0;
|
|
|
|
Ecore_X_Atom ECORE_X_ATOM_NET_DESKTOP_GEOMETRY = 0;
|
|
|
|
Ecore_X_Atom ECORE_X_ATOM_NET_DESKTOP_VIEWPORT = 0;
|
|
|
|
Ecore_X_Atom ECORE_X_ATOM_NET_DESKTOP_LAYOUT = 0;
|
2005-02-07 05:51:05 -08:00
|
|
|
Ecore_X_Atom ECORE_X_ATOM_NET_WORKAREA = 0;
|
2004-10-27 14:50:58 -07:00
|
|
|
|
2004-12-04 02:10:29 -08:00
|
|
|
Ecore_X_Atom ECORE_X_ATOM_NET_CURRENT_DESKTOP = 0;
|
|
|
|
Ecore_X_Atom ECORE_X_ATOM_NET_SHOWING_DESKTOP = 0;
|
2004-10-27 14:50:58 -07:00
|
|
|
|
2004-12-04 02:10:29 -08:00
|
|
|
Ecore_X_Atom ECORE_X_ATOM_NET_CLIENT_LIST = 0;
|
|
|
|
Ecore_X_Atom ECORE_X_ATOM_NET_CLIENT_LIST_STACKING = 0;
|
|
|
|
Ecore_X_Atom ECORE_X_ATOM_NET_ACTIVE_WINDOW = 0;
|
2004-10-27 14:50:58 -07:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Client message types.
|
|
|
|
*/
|
2004-12-04 02:10:29 -08:00
|
|
|
Ecore_X_Atom ECORE_X_ATOM_NET_CLOSE_WINDOW = 0;
|
|
|
|
Ecore_X_Atom ECORE_X_ATOM_NET_WM_MOVERESIZE = 0;
|
2004-10-27 14:50:58 -07:00
|
|
|
|
2005-02-07 05:51:05 -08:00
|
|
|
/*
|
|
|
|
* Pagers
|
|
|
|
*/
|
|
|
|
Ecore_X_Atom ECORE_X_ATOM_NET_MOVERESIZE_WINDOW = 0;
|
|
|
|
Ecore_X_Atom ECORE_X_ATOM_NET_RESTACK_WINDOW = 0;
|
|
|
|
|
2004-10-23 07:26:25 -07:00
|
|
|
/*
|
2004-10-27 14:50:58 -07:00
|
|
|
* Application window specific NetWM hints.
|
2004-10-23 07:26:25 -07:00
|
|
|
*/
|
2004-12-04 02:10:29 -08:00
|
|
|
Ecore_X_Atom ECORE_X_ATOM_NET_WM_NAME = 0;
|
|
|
|
Ecore_X_Atom ECORE_X_ATOM_NET_WM_VISIBLE_NAME = 0;
|
|
|
|
Ecore_X_Atom ECORE_X_ATOM_NET_WM_ICON_NAME = 0;
|
|
|
|
Ecore_X_Atom ECORE_X_ATOM_NET_WM_VISIBLE_ICON_NAME = 0;
|
2005-02-07 05:51:05 -08:00
|
|
|
Ecore_X_Atom ECORE_X_ATOM_NET_WM_DESKTOP = 0;
|
2004-12-04 02:10:29 -08:00
|
|
|
Ecore_X_Atom ECORE_X_ATOM_NET_WM_STRUT = 0;
|
|
|
|
Ecore_X_Atom ECORE_X_ATOM_NET_WM_STRUT_PARTIAL = 0;
|
|
|
|
Ecore_X_Atom ECORE_X_ATOM_NET_WM_ICON_GEOMETRY = 0;
|
|
|
|
Ecore_X_Atom ECORE_X_ATOM_NET_WM_ICON = 0;
|
|
|
|
Ecore_X_Atom ECORE_X_ATOM_NET_WM_PID = 0;
|
2005-02-07 05:51:05 -08:00
|
|
|
Ecore_X_Atom ECORE_X_ATOM_NET_WM_HANDLED_ICONS = 0;
|
2004-12-04 02:10:29 -08:00
|
|
|
Ecore_X_Atom ECORE_X_ATOM_NET_WM_USER_TIME = 0;
|
|
|
|
|
2005-02-07 05:51:05 -08:00
|
|
|
Ecore_X_Atom ECORE_X_ATOM_NET_WM_ALLOWED_ACTIONS = 0;
|
|
|
|
Ecore_X_Atom ECORE_X_ATOM_NET_WM_ACTION_MOVE = 0;
|
|
|
|
Ecore_X_Atom ECORE_X_ATOM_NET_WM_ACTION_RESIZE = 0;
|
|
|
|
Ecore_X_Atom ECORE_X_ATOM_NET_WM_ACTION_MINIMIZE = 0;
|
|
|
|
Ecore_X_Atom ECORE_X_ATOM_NET_WM_ACTION_SHADE = 0;
|
|
|
|
Ecore_X_Atom ECORE_X_ATOM_NET_WM_ACTION_STICK = 0;
|
|
|
|
Ecore_X_Atom ECORE_X_ATOM_NET_WM_ACTION_MAXIMIZE_HORZ = 0;
|
|
|
|
Ecore_X_Atom ECORE_X_ATOM_NET_WM_ACTION_MAXIMIZE_VERT = 0;
|
|
|
|
Ecore_X_Atom ECORE_X_ATOM_NET_WM_ACTION_FULLSCREEN = 0;
|
|
|
|
Ecore_X_Atom ECORE_X_ATOM_NET_WM_ACTION_CHANGE_DESKTOP = 0;
|
|
|
|
Ecore_X_Atom ECORE_X_ATOM_NET_WM_ACTION_CLOSE = 0;
|
|
|
|
|
|
|
|
Ecore_X_Atom ECORE_X_ATOM_NET_WM_WINDOW_TYPE = 0;
|
2004-12-04 02:10:29 -08:00
|
|
|
Ecore_X_Atom ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DESKTOP = 0;
|
|
|
|
Ecore_X_Atom ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DOCK = 0;
|
|
|
|
Ecore_X_Atom ECORE_X_ATOM_NET_WM_WINDOW_TYPE_TOOLBAR = 0;
|
|
|
|
Ecore_X_Atom ECORE_X_ATOM_NET_WM_WINDOW_TYPE_MENU = 0;
|
|
|
|
Ecore_X_Atom ECORE_X_ATOM_NET_WM_WINDOW_TYPE_UTILITY = 0;
|
|
|
|
Ecore_X_Atom ECORE_X_ATOM_NET_WM_WINDOW_TYPE_SPLASH = 0;
|
|
|
|
Ecore_X_Atom ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DIALOG = 0;
|
|
|
|
Ecore_X_Atom ECORE_X_ATOM_NET_WM_WINDOW_TYPE_NORMAL = 0;
|
|
|
|
|
2005-02-07 05:51:05 -08:00
|
|
|
Ecore_X_Atom ECORE_X_ATOM_NET_WM_STATE = 0;
|
2004-12-04 02:10:29 -08:00
|
|
|
Ecore_X_Atom ECORE_X_ATOM_NET_WM_STATE_MODAL = 0;
|
|
|
|
Ecore_X_Atom ECORE_X_ATOM_NET_WM_STATE_STICKY = 0;
|
|
|
|
Ecore_X_Atom ECORE_X_ATOM_NET_WM_STATE_MAXIMIZED_VERT = 0;
|
|
|
|
Ecore_X_Atom ECORE_X_ATOM_NET_WM_STATE_MAXIMIZED_HORZ = 0;
|
|
|
|
Ecore_X_Atom ECORE_X_ATOM_NET_WM_STATE_SHADED = 0;
|
|
|
|
Ecore_X_Atom ECORE_X_ATOM_NET_WM_STATE_SKIP_TASKBAR = 0;
|
|
|
|
Ecore_X_Atom ECORE_X_ATOM_NET_WM_STATE_SKIP_PAGER = 0;
|
|
|
|
Ecore_X_Atom ECORE_X_ATOM_NET_WM_STATE_HIDDEN = 0;
|
|
|
|
Ecore_X_Atom ECORE_X_ATOM_NET_WM_STATE_FULLSCREEN = 0;
|
|
|
|
Ecore_X_Atom ECORE_X_ATOM_NET_WM_STATE_ABOVE = 0;
|
|
|
|
Ecore_X_Atom ECORE_X_ATOM_NET_WM_STATE_BELOW = 0;
|
2005-02-07 05:51:05 -08:00
|
|
|
Ecore_X_Atom ECORE_X_ATOM_NET_WM_STATE_DEMANDS_ATTENTION = 0;
|
2004-12-04 02:10:29 -08:00
|
|
|
|
|
|
|
Ecore_X_Atom ECORE_X_ATOM_NET_WM_WINDOW_OPACITY = 0;
|
2004-10-23 07:26:25 -07:00
|
|
|
|
2005-01-12 23:13:06 -08:00
|
|
|
Ecore_X_Atom ECORE_X_ATOM_NET_FRAME_EXTENTS = 0;
|
2005-02-07 05:51:05 -08:00
|
|
|
Ecore_X_Atom ECORE_X_ATOM_NET_REQUEST_FRAME_EXTENTS = 0;
|
2005-01-12 23:13:06 -08:00
|
|
|
|
2005-04-27 23:50:11 -07:00
|
|
|
Ecore_X_Atom ECORE_X_ATOM_NET_WM_PING = 0;
|
|
|
|
Ecore_X_Atom ECORE_X_ATOM_NET_WM_SYNC_REQUEST = 0;
|
|
|
|
|
2004-10-23 07:26:25 -07:00
|
|
|
void
|
|
|
|
ecore_x_netwm_init(void)
|
|
|
|
{
|
2004-12-04 02:10:29 -08:00
|
|
|
ECORE_X_ATOM_NET_SUPPORTED = _ATOM_GET("_NET_SUPPORTED");
|
|
|
|
ECORE_X_ATOM_NET_SUPPORTING_WM_CHECK = _ATOM_GET("_NET_SUPPORTING_WM_CHECK");
|
|
|
|
|
|
|
|
ECORE_X_ATOM_NET_NUMBER_OF_DESKTOPS = _ATOM_GET("_NET_NUMBER_OF_DESKTOPS");
|
|
|
|
ECORE_X_ATOM_NET_VIRTUAL_ROOTS = _ATOM_GET("_NET_VIRTUAL_ROOTS");
|
|
|
|
ECORE_X_ATOM_NET_DESKTOP_NAMES = _ATOM_GET("_NET_DESKTOP_NAMES");
|
2005-02-07 05:51:05 -08:00
|
|
|
ECORE_X_ATOM_NET_DESKTOP_GEOMETRY = _ATOM_GET("_NET_DESKTOP_GEOMETRY");
|
2004-12-04 02:10:29 -08:00
|
|
|
ECORE_X_ATOM_NET_DESKTOP_VIEWPORT = _ATOM_GET("_NET_DESKTOP_VIEWPORT");
|
2005-02-07 05:51:05 -08:00
|
|
|
ECORE_X_ATOM_NET_DESKTOP_LAYOUT = _ATOM_GET("_NET_DESKTOP_LAYOUT");
|
2004-12-04 02:10:29 -08:00
|
|
|
ECORE_X_ATOM_NET_WORKAREA = _ATOM_GET("_NET_WORKAREA");
|
|
|
|
|
2005-02-07 05:51:05 -08:00
|
|
|
ECORE_X_ATOM_NET_CURRENT_DESKTOP = _ATOM_GET("_NET_CURRENT_DESKTOP");
|
|
|
|
ECORE_X_ATOM_NET_SHOWING_DESKTOP = _ATOM_GET("_NET_SHOWING_DESKTOP");
|
|
|
|
|
2004-12-04 02:10:29 -08:00
|
|
|
ECORE_X_ATOM_NET_CLIENT_LIST = _ATOM_GET("_NET_CLIENT_LIST");
|
|
|
|
ECORE_X_ATOM_NET_CLIENT_LIST_STACKING =
|
|
|
|
_ATOM_GET("_NET_CLIENT_LIST_STACKING");
|
|
|
|
ECORE_X_ATOM_NET_ACTIVE_WINDOW = _ATOM_GET("_NET_ACTIVE_WINDOW");
|
|
|
|
|
|
|
|
ECORE_X_ATOM_NET_CLOSE_WINDOW = _ATOM_GET("_NET_CLOSE_WINDOW");
|
|
|
|
ECORE_X_ATOM_NET_WM_MOVERESIZE = _ATOM_GET("_NET_WM_MOVERESIZE");
|
|
|
|
|
2005-02-07 05:51:05 -08:00
|
|
|
ECORE_X_ATOM_NET_MOVERESIZE_WINDOW = _ATOM_GET("_NET_MOVERESIZE_WINDOW");
|
|
|
|
ECORE_X_ATOM_NET_RESTACK_WINDOW = _ATOM_GET("_NET_RESTACK_WINDOW");
|
|
|
|
|
2004-12-04 02:10:29 -08:00
|
|
|
ECORE_X_ATOM_NET_WM_NAME = _ATOM_GET("_NET_WM_NAME");
|
|
|
|
ECORE_X_ATOM_NET_WM_VISIBLE_NAME = _ATOM_GET("_NET_WM_VISIBLE_NAME");
|
|
|
|
ECORE_X_ATOM_NET_WM_ICON_NAME = _ATOM_GET("_NET_WM_ICON_NAME");
|
|
|
|
ECORE_X_ATOM_NET_WM_VISIBLE_ICON_NAME =
|
|
|
|
_ATOM_GET("_NET_WM_VISIBLE_ICON_NAME");
|
|
|
|
ECORE_X_ATOM_NET_WM_DESKTOP = _ATOM_GET("_NET_WM_DESKTOP");
|
|
|
|
ECORE_X_ATOM_NET_WM_STRUT = _ATOM_GET("_NET_WM_STRUT");
|
|
|
|
ECORE_X_ATOM_NET_WM_STRUT_PARTIAL = _ATOM_GET("_NET_WM_STRUT_PARTIAL");
|
|
|
|
ECORE_X_ATOM_NET_WM_ICON_GEOMETRY = _ATOM_GET("_NET_WM_ICON_GEOMETRY");
|
|
|
|
ECORE_X_ATOM_NET_WM_ICON = _ATOM_GET("_NET_WM_ICON");
|
|
|
|
ECORE_X_ATOM_NET_WM_PID = _ATOM_GET("_NET_WM_PID");
|
2005-02-07 05:51:05 -08:00
|
|
|
ECORE_X_ATOM_NET_WM_HANDLED_ICONS = _ATOM_GET("_NET_WM_HANDLED_ICONS");
|
2004-12-04 02:10:29 -08:00
|
|
|
ECORE_X_ATOM_NET_WM_USER_TIME = _ATOM_GET("_NET_WM_USER_TIME");
|
|
|
|
|
2005-02-07 05:51:05 -08:00
|
|
|
ECORE_X_ATOM_NET_WM_ALLOWED_ACTIONS = _ATOM_GET("_NET_WM_ALLOWED_ACTIONS");
|
|
|
|
ECORE_X_ATOM_NET_WM_ACTION_MOVE = _ATOM_GET("_NET_WM_ACTION_MOVE");
|
|
|
|
ECORE_X_ATOM_NET_WM_ACTION_RESIZE = _ATOM_GET("_NET_WM_ACTION_RESIZE");
|
|
|
|
ECORE_X_ATOM_NET_WM_ACTION_MINIMIZE = _ATOM_GET("_NET_WM_ACTION_MINIMIZE");
|
|
|
|
ECORE_X_ATOM_NET_WM_ACTION_SHADE = _ATOM_GET("_NET_WM_ACTION_SHADE");
|
|
|
|
ECORE_X_ATOM_NET_WM_ACTION_STICK = _ATOM_GET("_NET_WM_ACTION_STICK");
|
|
|
|
ECORE_X_ATOM_NET_WM_ACTION_MAXIMIZE_HORZ = _ATOM_GET("_NET_WM_ACTION_MAXIMIZE_HORZ");
|
|
|
|
ECORE_X_ATOM_NET_WM_ACTION_MAXIMIZE_VERT = _ATOM_GET("_NET_WM_ACTION_MAXIMIZE_VERT");
|
|
|
|
ECORE_X_ATOM_NET_WM_ACTION_FULLSCREEN = _ATOM_GET("_NET_WM_ACTION_FULLSCREEN");
|
|
|
|
ECORE_X_ATOM_NET_WM_ACTION_CHANGE_DESKTOP = _ATOM_GET("_NET_WM_ACTION_CHANGE_DESKTOP");
|
|
|
|
ECORE_X_ATOM_NET_WM_ACTION_CLOSE = _ATOM_GET("_NET_WM_ACTION_CLOSE");
|
|
|
|
|
|
|
|
ECORE_X_ATOM_NET_WM_WINDOW_TYPE = _ATOM_GET("_NET_WM_WINDOW_TYPE");
|
2004-12-04 02:10:29 -08:00
|
|
|
ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DESKTOP =
|
|
|
|
_ATOM_GET("_NET_WM_WINDOW_TYPE_DESKTOP");
|
|
|
|
ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DOCK = _ATOM_GET("_NET_WM_WINDOW_TYPE_DOCK");
|
|
|
|
ECORE_X_ATOM_NET_WM_WINDOW_TYPE_TOOLBAR =
|
|
|
|
_ATOM_GET("_NET_WM_WINDOW_TYPE_TOOLBAR");
|
|
|
|
ECORE_X_ATOM_NET_WM_WINDOW_TYPE_MENU = _ATOM_GET("_NET_WM_WINDOW_TYPE_MENU");
|
|
|
|
ECORE_X_ATOM_NET_WM_WINDOW_TYPE_UTILITY =
|
|
|
|
_ATOM_GET("_NET_WM_WINDOW_TYPE_UTILITY");
|
|
|
|
ECORE_X_ATOM_NET_WM_WINDOW_TYPE_SPLASH =
|
|
|
|
_ATOM_GET("_NET_WM_WINDOW_TYPE_SPLASH");
|
|
|
|
ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DIALOG =
|
|
|
|
_ATOM_GET("_NET_WM_WINDOW_TYPE_DIALOG");
|
|
|
|
ECORE_X_ATOM_NET_WM_WINDOW_TYPE_NORMAL =
|
|
|
|
_ATOM_GET("_NET_WM_WINDOW_TYPE_NORMAL");
|
|
|
|
|
2005-02-07 05:51:05 -08:00
|
|
|
ECORE_X_ATOM_NET_WM_STATE = _ATOM_GET("_NET_WM_STATE");
|
2004-12-04 02:10:29 -08:00
|
|
|
ECORE_X_ATOM_NET_WM_STATE_MODAL = _ATOM_GET("_NET_WM_STATE_MODAL");
|
|
|
|
ECORE_X_ATOM_NET_WM_STATE_STICKY = _ATOM_GET("_NET_WM_STATE_STICKY");
|
|
|
|
ECORE_X_ATOM_NET_WM_STATE_MAXIMIZED_VERT =
|
|
|
|
_ATOM_GET("_NET_WM_STATE_MAXIMIZED_VERT");
|
|
|
|
ECORE_X_ATOM_NET_WM_STATE_MAXIMIZED_HORZ =
|
|
|
|
_ATOM_GET("_NET_WM_STATE_MAXIMIZED_HORZ");
|
|
|
|
ECORE_X_ATOM_NET_WM_STATE_SHADED = _ATOM_GET("_NET_WM_STATE_SHADED");
|
|
|
|
ECORE_X_ATOM_NET_WM_STATE_SKIP_TASKBAR =
|
|
|
|
_ATOM_GET("_NET_WM_STATE_SKIP_TASKBAR");
|
|
|
|
ECORE_X_ATOM_NET_WM_STATE_SKIP_PAGER = _ATOM_GET("_NET_WM_STATE_SKIP_PAGER");
|
|
|
|
ECORE_X_ATOM_NET_WM_STATE_HIDDEN = _ATOM_GET("_NET_WM_STATE_HIDDEN");
|
|
|
|
ECORE_X_ATOM_NET_WM_STATE_FULLSCREEN = _ATOM_GET("_NET_WM_STATE_FULLSCREEN");
|
|
|
|
ECORE_X_ATOM_NET_WM_STATE_ABOVE = _ATOM_GET("_NET_WM_STATE_ABOVE");
|
|
|
|
ECORE_X_ATOM_NET_WM_STATE_BELOW = _ATOM_GET("_NET_WM_STATE_BELOW");
|
2005-02-07 05:51:05 -08:00
|
|
|
ECORE_X_ATOM_NET_WM_STATE_DEMANDS_ATTENTION = _ATOM_GET("_NET_WM_STATE_DEMANDS_ATTENTION");
|
2004-12-04 02:10:29 -08:00
|
|
|
|
|
|
|
ECORE_X_ATOM_NET_WM_WINDOW_OPACITY = _ATOM_GET("_NET_WM_WINDOW_OPACITY");
|
2005-02-07 05:51:05 -08:00
|
|
|
|
2005-01-12 23:13:06 -08:00
|
|
|
ECORE_X_ATOM_NET_FRAME_EXTENTS = _ATOM_GET("_NET_FRAME_EXTENTS");
|
2005-02-07 05:51:05 -08:00
|
|
|
ECORE_X_ATOM_NET_REQUEST_FRAME_EXTENTS = _ATOM_GET("_NET_REQUEST_FRAME_EXTENTS");
|
2005-04-27 23:50:11 -07:00
|
|
|
|
|
|
|
ECORE_X_ATOM_NET_WM_PING = _ATOM_GET("_NET_WM_PING");
|
|
|
|
ECORE_X_ATOM_NET_WM_SYNC_REQUEST = _ATOM_GET("_NET_WM_SYNC_REQUEST");
|
2004-10-23 07:26:25 -07:00
|
|
|
}
|
2004-10-27 14:50:58 -07:00
|
|
|
|
|
|
|
/*
|
|
|
|
* WM identification
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
ecore_x_netwm_wm_identify(Ecore_X_Window root, Ecore_X_Window check,
|
2004-12-04 02:10:29 -08:00
|
|
|
const char *wm_name)
|
2004-10-27 14:50:58 -07:00
|
|
|
{
|
2004-12-08 12:29:45 -08:00
|
|
|
_ATOM_SET_WINDOW(root, ECORE_X_ATOM_NET_SUPPORTING_WM_CHECK, &check, 1);
|
|
|
|
_ATOM_SET_WINDOW(check, ECORE_X_ATOM_NET_SUPPORTING_WM_CHECK, &check, 1);
|
|
|
|
_ATOM_SET_UTF8_STRING(check, ECORE_X_ATOM_NET_WM_NAME, wm_name);
|
2004-10-27 14:50:58 -07:00
|
|
|
/* This one isn't mandatory */
|
2004-12-08 12:29:45 -08:00
|
|
|
_ATOM_SET_UTF8_STRING(root, ECORE_X_ATOM_NET_WM_NAME, wm_name);
|
2004-12-04 02:10:29 -08:00
|
|
|
}
|
2004-10-23 07:26:25 -07:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Desktop configuration and status
|
|
|
|
*/
|
|
|
|
|
|
|
|
void
|
2004-12-08 12:29:45 -08:00
|
|
|
ecore_x_netwm_desk_count_set(Ecore_X_Window root, unsigned int n_desks)
|
2004-10-23 07:26:25 -07:00
|
|
|
{
|
2004-12-08 12:29:45 -08:00
|
|
|
ecore_x_window_prop_card32_set(root, ECORE_X_ATOM_NET_NUMBER_OF_DESKTOPS,
|
|
|
|
&n_desks, 1);
|
2004-10-23 07:26:25 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2004-12-08 12:29:45 -08:00
|
|
|
ecore_x_netwm_desk_roots_set(Ecore_X_Window root, unsigned int n_desks,
|
2004-10-23 07:26:25 -07:00
|
|
|
Ecore_X_Window * vroots)
|
|
|
|
{
|
2004-12-08 12:29:45 -08:00
|
|
|
_ATOM_SET_WINDOW(root, ECORE_X_ATOM_NET_VIRTUAL_ROOTS, vroots, n_desks);
|
2004-10-23 07:26:25 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2004-12-08 12:29:45 -08:00
|
|
|
ecore_x_netwm_desk_names_set(Ecore_X_Window root, unsigned int n_desks,
|
2004-10-23 07:26:25 -07:00
|
|
|
const char **names)
|
|
|
|
{
|
|
|
|
char ss[32], *buf;
|
|
|
|
const char *s;
|
2004-12-08 12:29:45 -08:00
|
|
|
unsigned int i;
|
|
|
|
int l, len;
|
2004-10-23 07:26:25 -07:00
|
|
|
|
|
|
|
buf = NULL;
|
|
|
|
len = 0;
|
|
|
|
|
|
|
|
for (i = 0; i < n_desks; i++)
|
|
|
|
{
|
|
|
|
s = (names) ? names[i] : NULL;
|
|
|
|
if (!s)
|
|
|
|
{
|
|
|
|
/* Default to "Desk-<number>" */
|
|
|
|
sprintf(ss, "Desk-%d", i);
|
|
|
|
s = ss;
|
|
|
|
}
|
|
|
|
|
|
|
|
l = strlen(s) + 1;
|
|
|
|
buf = realloc(buf, len + l);
|
|
|
|
memcpy(buf + len, s, l);
|
|
|
|
len += l;
|
|
|
|
}
|
|
|
|
|
2004-12-08 12:29:45 -08:00
|
|
|
_ATOM_SET_UTF8_STRING_LIST(root, ECORE_X_ATOM_NET_DESKTOP_NAMES, buf, len);
|
2004-10-23 07:26:25 -07:00
|
|
|
|
|
|
|
free(buf);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2004-12-08 12:29:45 -08:00
|
|
|
ecore_x_netwm_desk_size_set(Ecore_X_Window root, unsigned int width,
|
|
|
|
unsigned int height)
|
2004-10-23 07:26:25 -07:00
|
|
|
{
|
2004-12-08 12:29:45 -08:00
|
|
|
unsigned int size[2];
|
2004-10-23 07:26:25 -07:00
|
|
|
|
|
|
|
size[0] = width;
|
|
|
|
size[1] = height;
|
2004-12-08 12:29:45 -08:00
|
|
|
ecore_x_window_prop_card32_set(root, ECORE_X_ATOM_NET_DESKTOP_GEOMETRY, size,
|
|
|
|
2);
|
2004-10-23 07:26:25 -07:00
|
|
|
}
|
|
|
|
|
2005-02-07 05:51:05 -08:00
|
|
|
void
|
|
|
|
ecore_x_netwm_desk_viewports_set(Ecore_X_Window root, unsigned int n_desks,
|
|
|
|
unsigned int *origins)
|
|
|
|
{
|
|
|
|
ecore_x_window_prop_card32_set(root, ECORE_X_ATOM_NET_DESKTOP_VIEWPORT,
|
|
|
|
origins, 2 * n_desks);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
ecore_x_netwm_desk_layout_set(Ecore_X_Window root, int orientation,
|
|
|
|
int columns, int rows,
|
|
|
|
int starting_corner)
|
|
|
|
{
|
|
|
|
int layout[4];
|
|
|
|
|
|
|
|
layout[0] = orientation;
|
|
|
|
layout[1] = columns;
|
|
|
|
layout[2] = rows;
|
|
|
|
layout[3] = starting_corner;
|
|
|
|
ecore_x_window_prop_card32_set(root, ECORE_X_ATOM_NET_DESKTOP_LAYOUT,
|
|
|
|
layout, 4);
|
|
|
|
}
|
|
|
|
|
2004-10-23 07:26:25 -07:00
|
|
|
void
|
2004-12-08 12:29:45 -08:00
|
|
|
ecore_x_netwm_desk_workareas_set(Ecore_X_Window root, unsigned int n_desks,
|
|
|
|
unsigned int *areas)
|
2004-10-23 07:26:25 -07:00
|
|
|
{
|
2004-12-08 12:29:45 -08:00
|
|
|
ecore_x_window_prop_card32_set(root, ECORE_X_ATOM_NET_WORKAREA, areas,
|
|
|
|
4 * n_desks);
|
2004-10-23 07:26:25 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2004-12-08 12:29:45 -08:00
|
|
|
ecore_x_netwm_desk_current_set(Ecore_X_Window root, unsigned int desk)
|
2004-10-23 07:26:25 -07:00
|
|
|
{
|
2004-12-08 12:29:45 -08:00
|
|
|
ecore_x_window_prop_card32_set(root, ECORE_X_ATOM_NET_CURRENT_DESKTOP, &desk,
|
|
|
|
1);
|
2004-10-23 07:26:25 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
ecore_x_netwm_showing_desktop_set(Ecore_X_Window root, int on)
|
|
|
|
{
|
2004-12-08 12:29:45 -08:00
|
|
|
unsigned int val;
|
2004-10-23 07:26:25 -07:00
|
|
|
|
2004-12-08 12:29:45 -08:00
|
|
|
val = (on) ? 1 : 0;
|
|
|
|
ecore_x_window_prop_card32_set(root, ECORE_X_ATOM_NET_SHOWING_DESKTOP, &val,
|
|
|
|
1);
|
2004-10-23 07:26:25 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Client status
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* Mapping order */
|
|
|
|
void
|
2004-12-08 12:29:45 -08:00
|
|
|
ecore_x_netwm_client_list_set(Ecore_X_Window root, unsigned int n_clients,
|
2004-10-23 07:26:25 -07:00
|
|
|
Ecore_X_Window * p_clients)
|
|
|
|
{
|
2004-12-08 12:29:45 -08:00
|
|
|
_ATOM_SET_WINDOW(root, ECORE_X_ATOM_NET_CLIENT_LIST, p_clients, n_clients);
|
2004-10-23 07:26:25 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Stacking order */
|
|
|
|
void
|
2004-12-08 12:29:45 -08:00
|
|
|
ecore_x_netwm_client_list_stacking_set(Ecore_X_Window root,
|
|
|
|
unsigned int n_clients,
|
2004-10-23 07:26:25 -07:00
|
|
|
Ecore_X_Window * p_clients)
|
|
|
|
{
|
2004-12-08 12:29:45 -08:00
|
|
|
_ATOM_SET_WINDOW(root, ECORE_X_ATOM_NET_CLIENT_LIST_STACKING, p_clients,
|
2004-10-23 07:26:25 -07:00
|
|
|
n_clients);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
ecore_x_netwm_client_active_set(Ecore_X_Window root, Ecore_X_Window win)
|
|
|
|
{
|
2004-12-08 12:29:45 -08:00
|
|
|
_ATOM_SET_WINDOW(root, ECORE_X_ATOM_NET_ACTIVE_WINDOW, &win, 1);
|
2004-10-23 07:26:25 -07:00
|
|
|
}
|
2004-11-29 15:25:12 -08:00
|
|
|
|
|
|
|
void
|
|
|
|
ecore_x_netwm_name_set(Ecore_X_Window win, const char *name)
|
|
|
|
{
|
2004-12-08 12:29:45 -08:00
|
|
|
_ecore_x_window_prop_string_utf8_set(win, ECORE_X_ATOM_NET_WM_NAME, name);
|
2004-11-29 15:25:12 -08:00
|
|
|
}
|
|
|
|
|
2005-02-07 05:51:05 -08:00
|
|
|
char *
|
2004-11-29 15:25:12 -08:00
|
|
|
ecore_x_netwm_name_get(Ecore_X_Window win)
|
|
|
|
{
|
2004-12-04 02:10:29 -08:00
|
|
|
return _ecore_x_window_prop_string_utf8_get(win, ECORE_X_ATOM_NET_WM_NAME);
|
2004-11-29 15:25:12 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2005-02-07 05:51:05 -08:00
|
|
|
ecore_x_netwm_visible_name_set(Ecore_X_Window win, const char *name)
|
2004-12-04 02:10:29 -08:00
|
|
|
{
|
2005-02-07 05:51:05 -08:00
|
|
|
_ecore_x_window_prop_string_utf8_set(win, ECORE_X_ATOM_NET_WM_VISIBLE_NAME,
|
2004-12-04 02:10:29 -08:00
|
|
|
name);
|
|
|
|
}
|
|
|
|
|
2005-02-07 05:51:05 -08:00
|
|
|
char *
|
|
|
|
ecore_x_netwm_visible_name_get(Ecore_X_Window win)
|
2004-11-29 15:25:12 -08:00
|
|
|
{
|
2004-12-04 02:10:29 -08:00
|
|
|
return _ecore_x_window_prop_string_utf8_get(win,
|
2005-02-07 05:51:05 -08:00
|
|
|
ECORE_X_ATOM_NET_WM_VISIBLE_NAME);
|
2004-11-29 15:25:12 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2005-02-07 05:51:05 -08:00
|
|
|
ecore_x_netwm_icon_name_set(Ecore_X_Window win, const char *name)
|
2004-12-04 02:10:29 -08:00
|
|
|
{
|
2005-02-07 05:51:05 -08:00
|
|
|
_ecore_x_window_prop_string_utf8_set(win, ECORE_X_ATOM_NET_WM_ICON_NAME,
|
2004-12-04 02:10:29 -08:00
|
|
|
name);
|
2004-11-29 15:25:12 -08:00
|
|
|
}
|
|
|
|
|
2005-02-07 05:51:05 -08:00
|
|
|
char *
|
|
|
|
ecore_x_netwm_icon_name_get(Ecore_X_Window win)
|
2004-11-29 15:25:12 -08:00
|
|
|
{
|
2004-12-04 02:10:29 -08:00
|
|
|
return _ecore_x_window_prop_string_utf8_get(win,
|
2005-02-07 05:51:05 -08:00
|
|
|
ECORE_X_ATOM_NET_WM_ICON_NAME);
|
2004-11-29 15:25:12 -08:00
|
|
|
}
|
2004-12-04 02:10:29 -08:00
|
|
|
|
2004-11-29 15:25:12 -08:00
|
|
|
void
|
|
|
|
ecore_x_netwm_visible_icon_name_set(Ecore_X_Window win, const char *name)
|
2004-12-04 02:10:29 -08:00
|
|
|
{
|
2004-12-08 12:29:45 -08:00
|
|
|
_ecore_x_window_prop_string_utf8_set(win,
|
|
|
|
ECORE_X_ATOM_NET_WM_VISIBLE_ICON_NAME,
|
|
|
|
name);
|
2004-12-04 02:10:29 -08:00
|
|
|
}
|
|
|
|
|
2005-02-07 05:51:05 -08:00
|
|
|
char *
|
2004-11-29 15:25:12 -08:00
|
|
|
ecore_x_netwm_visible_icon_name_get(Ecore_X_Window win)
|
2004-12-04 02:10:29 -08:00
|
|
|
{
|
|
|
|
return _ecore_x_window_prop_string_utf8_get(win,
|
|
|
|
ECORE_X_ATOM_NET_WM_VISIBLE_ICON_NAME);
|
|
|
|
}
|
2004-12-08 12:29:45 -08:00
|
|
|
|
|
|
|
void
|
|
|
|
ecore_x_netwm_desktop_set(Ecore_X_Window win, unsigned int desk)
|
|
|
|
{
|
|
|
|
ecore_x_window_prop_card32_set(win, ECORE_X_ATOM_NET_WM_DESKTOP, &desk, 1);
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
ecore_x_netwm_desktop_get(Ecore_X_Window win, unsigned int *desk)
|
|
|
|
{
|
2005-02-15 03:21:47 -08:00
|
|
|
int ret;
|
|
|
|
ret = ecore_x_window_prop_card32_get(win, ECORE_X_ATOM_NET_WM_DESKTOP,
|
|
|
|
desk, 1);
|
|
|
|
|
|
|
|
return ret == 1 ? 1 : 0;
|
2004-12-08 12:29:45 -08:00
|
|
|
}
|
|
|
|
|
2005-02-07 05:51:05 -08:00
|
|
|
/*
|
|
|
|
* _NET_WM_STRUT is deprecated, set both _NET_WM_STRUT and _NET_WM_STRUT_PARTIAL.
|
|
|
|
*/
|
2004-12-08 12:29:45 -08:00
|
|
|
void
|
2005-02-07 05:51:05 -08:00
|
|
|
ecore_x_netwm_strut_set(Ecore_X_Window win, int left, int right,
|
|
|
|
int top, int bottom)
|
2004-12-08 12:29:45 -08:00
|
|
|
{
|
2005-02-07 05:51:05 -08:00
|
|
|
int strut[4];
|
|
|
|
|
|
|
|
ecore_x_netwm_strut_partial_set(win, left, right, top, bottom, 0, 0, 0, 0, 0, 0, 0, 0);
|
|
|
|
|
|
|
|
strut[0] = left;
|
|
|
|
strut[1] = right;
|
|
|
|
strut[2] = top;
|
|
|
|
strut[3] = bottom;
|
|
|
|
ecore_x_window_prop_card32_set(win, ECORE_X_ATOM_NET_WM_STRUT, strut, 4);
|
2004-12-08 12:29:45 -08:00
|
|
|
}
|
|
|
|
|
2005-02-07 05:51:05 -08:00
|
|
|
/*
|
|
|
|
* _NET_WM_STRUT is deprecated, check first _NET_WM_STRUT_PARTIAL
|
|
|
|
* and then _NET_WM_STRUT.
|
|
|
|
*/
|
2004-12-08 12:29:45 -08:00
|
|
|
int
|
2005-02-07 05:51:05 -08:00
|
|
|
ecore_x_netwm_strut_get(Ecore_X_Window win, int *left, int *right,
|
|
|
|
int *top, int *bottom)
|
2004-12-08 12:29:45 -08:00
|
|
|
{
|
2005-02-07 05:51:05 -08:00
|
|
|
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];
|
|
|
|
|
|
|
|
ret = ecore_x_netwm_strut_partial_get(win, left, right, top, bottom,
|
|
|
|
&left_start_y, &left_end_y, &right_start_y, &right_end_y,
|
|
|
|
&top_start_x, &top_end_x, &bottom_start_x, &bottom_end_x);
|
2005-02-15 03:21:47 -08:00
|
|
|
if (ret == 12)
|
|
|
|
return 1;
|
2005-02-07 05:51:05 -08:00
|
|
|
|
|
|
|
ret = ecore_x_window_prop_card32_get(win, ECORE_X_ATOM_NET_WM_STRUT, strut, 4);
|
|
|
|
if (ret != 4)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
*left = strut[0];
|
|
|
|
*right = strut[1];
|
|
|
|
*top = strut[2];
|
|
|
|
*bottom = strut[3];
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
ecore_x_netwm_strut_partial_set(Ecore_X_Window win, int left, int right,
|
|
|
|
int top, int bottom, int left_start_y, int left_end_y,
|
|
|
|
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];
|
|
|
|
|
|
|
|
strut[0] = left;
|
|
|
|
strut[1] = right;
|
|
|
|
strut[2] = top;
|
|
|
|
strut[3] = bottom;
|
|
|
|
strut[4] = left_start_y;
|
|
|
|
strut[5] = left_end_y;
|
|
|
|
strut[6] = right_start_y;
|
|
|
|
strut[7] = right_end_y;
|
|
|
|
strut[8] = top_start_x;
|
|
|
|
strut[9] = top_end_x;
|
|
|
|
strut[10] = bottom_start_x;
|
|
|
|
strut[11] = bottom_end_x;
|
2005-02-15 03:21:47 -08:00
|
|
|
ecore_x_window_prop_card32_set(win, ECORE_X_ATOM_NET_WM_STRUT_PARTIAL, strut, 12);
|
2005-02-07 05:51:05 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
ecore_x_netwm_strut_partial_get(Ecore_X_Window win, int *left, int *right,
|
|
|
|
int *top, int *bottom, int *left_start_y, int *left_end_y,
|
|
|
|
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 ret = 0;
|
|
|
|
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];
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
ecore_x_netwm_icon_geometry_set(Ecore_X_Window win, int x, int y, int width, int height)
|
|
|
|
{
|
|
|
|
int geometry[4];
|
|
|
|
|
|
|
|
geometry[0] = x;
|
|
|
|
geometry[1] = y;
|
|
|
|
geometry[2] = width;
|
|
|
|
geometry[3] = height;
|
|
|
|
ecore_x_window_prop_card32_set(win, ECORE_X_ATOM_NET_WM_ICON_GEOMETRY, geometry, 4);
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
ecore_x_netwm_icon_geometry_get(Ecore_X_Window win, int *x, int *y, int *width, int *height)
|
|
|
|
{
|
|
|
|
int ret;
|
|
|
|
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];
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
ecore_x_netwm_pid_set(Ecore_X_Window win, int pid)
|
|
|
|
{
|
|
|
|
ecore_x_window_prop_card32_set(win, ECORE_X_ATOM_NET_WM_PID,
|
|
|
|
&pid, 1);
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
ecore_x_netwm_pid_get(Ecore_X_Window win, int *pid)
|
|
|
|
{
|
2005-02-15 03:21:47 -08:00
|
|
|
int ret;
|
|
|
|
ret = ecore_x_window_prop_card32_get(win, ECORE_X_ATOM_NET_WM_PID,
|
|
|
|
pid, 1);
|
|
|
|
return ret == 1 ? 1 : 0;
|
2005-02-07 05:51:05 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
ecore_x_netwm_handled_icons_set(Ecore_X_Window win)
|
|
|
|
{
|
|
|
|
ecore_x_window_prop_card32_set(win, ECORE_X_ATOM_NET_WM_HANDLED_ICONS,
|
|
|
|
NULL, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
ecore_x_netwm_handled_icons_get(Ecore_X_Window win)
|
|
|
|
{
|
|
|
|
int ret = 0;
|
|
|
|
ret = ecore_x_window_prop_card32_get(win, ECORE_X_ATOM_NET_WM_HANDLED_ICONS,
|
|
|
|
NULL, 0);
|
|
|
|
return ret == 0 ? 1 : 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
ecore_x_netwm_user_time_set(Ecore_X_Window win, int time)
|
|
|
|
{
|
|
|
|
ecore_x_window_prop_card32_set(win, ECORE_X_ATOM_NET_WM_USER_TIME,
|
|
|
|
&time, 1);
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
ecore_x_netwm_user_time_get(Ecore_X_Window win, int *time)
|
|
|
|
{
|
2005-02-15 03:21:47 -08:00
|
|
|
int ret;
|
|
|
|
ret = ecore_x_window_prop_card32_get(win, ECORE_X_ATOM_NET_WM_USER_TIME,
|
|
|
|
time, 1);
|
|
|
|
return ret == 1 ? 1 : 0;
|
2004-12-08 12:29:45 -08:00
|
|
|
}
|
2004-12-29 21:36:01 -08:00
|
|
|
|
|
|
|
static Ecore_X_Atom
|
|
|
|
_ecore_x_netwm_state_atom_get(Ecore_X_Window_State s)
|
|
|
|
{
|
|
|
|
switch(s)
|
2005-03-22 11:34:10 -08:00
|
|
|
{
|
2004-12-29 21:36:01 -08:00
|
|
|
case ECORE_X_WINDOW_STATE_MODAL:
|
2005-03-22 11:34:10 -08:00
|
|
|
return ECORE_X_ATOM_NET_WM_STATE_MODAL;
|
2004-12-29 21:36:01 -08:00
|
|
|
case ECORE_X_WINDOW_STATE_STICKY:
|
2005-03-22 11:34:10 -08:00
|
|
|
return ECORE_X_ATOM_NET_WM_STATE_STICKY;
|
2004-12-29 21:36:01 -08:00
|
|
|
case ECORE_X_WINDOW_STATE_MAXIMIZED_VERT:
|
2005-03-22 11:34:10 -08:00
|
|
|
return ECORE_X_ATOM_NET_WM_STATE_MAXIMIZED_VERT;
|
2004-12-29 21:36:01 -08:00
|
|
|
case ECORE_X_WINDOW_STATE_MAXIMIZED_HORZ:
|
2005-03-22 11:34:10 -08:00
|
|
|
return ECORE_X_ATOM_NET_WM_STATE_MAXIMIZED_HORZ;
|
2004-12-29 21:36:01 -08:00
|
|
|
case ECORE_X_WINDOW_STATE_SHADED:
|
2005-03-22 11:34:10 -08:00
|
|
|
return ECORE_X_ATOM_NET_WM_STATE_SHADED;
|
2004-12-29 21:36:01 -08:00
|
|
|
case ECORE_X_WINDOW_STATE_SKIP_TASKBAR:
|
2005-03-22 11:34:10 -08:00
|
|
|
return ECORE_X_ATOM_NET_WM_STATE_SKIP_TASKBAR;
|
2004-12-29 21:36:01 -08:00
|
|
|
case ECORE_X_WINDOW_STATE_SKIP_PAGER:
|
2005-03-22 11:34:10 -08:00
|
|
|
return ECORE_X_ATOM_NET_WM_STATE_SKIP_PAGER;
|
2004-12-29 21:36:01 -08:00
|
|
|
case ECORE_X_WINDOW_STATE_HIDDEN:
|
2005-03-22 11:34:10 -08:00
|
|
|
return ECORE_X_ATOM_NET_WM_STATE_HIDDEN;
|
2004-12-29 21:36:01 -08:00
|
|
|
case ECORE_X_WINDOW_STATE_FULLSCREEN:
|
2005-03-22 11:34:10 -08:00
|
|
|
return ECORE_X_ATOM_NET_WM_STATE_FULLSCREEN;
|
2004-12-29 21:36:01 -08:00
|
|
|
case ECORE_X_WINDOW_STATE_ABOVE:
|
2005-03-22 11:34:10 -08:00
|
|
|
return ECORE_X_ATOM_NET_WM_STATE_ABOVE;
|
2004-12-29 21:36:01 -08:00
|
|
|
case ECORE_X_WINDOW_STATE_BELOW:
|
2005-03-22 11:34:10 -08:00
|
|
|
return ECORE_X_ATOM_NET_WM_STATE_BELOW;
|
2005-02-07 05:51:05 -08:00
|
|
|
case ECORE_X_WINDOW_STATE_DEMANDS_ATTENTION:
|
2005-03-22 11:34:10 -08:00
|
|
|
return ECORE_X_ATOM_NET_WM_STATE_DEMANDS_ATTENTION;
|
2004-12-29 21:36:01 -08:00
|
|
|
default:
|
2005-03-22 11:34:10 -08:00
|
|
|
return 0;
|
|
|
|
}
|
2004-12-29 21:36:01 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
ecore_x_netwm_window_state_isset(Ecore_X_Window win, Ecore_X_Window_State s)
|
|
|
|
{
|
|
|
|
int num, i, ret = 0;
|
|
|
|
unsigned char *data;
|
2005-02-07 05:51:05 -08:00
|
|
|
Ecore_X_Atom *atoms, atom;
|
2004-12-29 21:36:01 -08:00
|
|
|
|
|
|
|
if (!ecore_x_window_prop_property_get(win, ECORE_X_ATOM_NET_WM_STATE,
|
2005-02-15 03:21:47 -08:00
|
|
|
XA_ATOM, 32, &data, &num))
|
2004-12-29 21:36:01 -08:00
|
|
|
return ret;
|
|
|
|
|
2005-02-07 05:51:05 -08:00
|
|
|
atom = _ecore_x_netwm_state_atom_get(s);
|
|
|
|
atoms = (Ecore_X_Atom *) data;
|
2004-12-29 21:36:01 -08:00
|
|
|
|
|
|
|
for (i = 0; i < num; ++i)
|
2005-03-22 11:34:10 -08:00
|
|
|
{
|
|
|
|
if (atoms[i] == atom)
|
|
|
|
{
|
|
|
|
ret = 1;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2004-12-29 21:36:01 -08:00
|
|
|
|
|
|
|
XFree(data);
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
ecore_x_netwm_window_state_set(Ecore_X_Window win, Ecore_X_Window_State state, int on)
|
|
|
|
{
|
|
|
|
Ecore_X_Atom atom;
|
|
|
|
Ecore_X_Atom *oldset = NULL, *newset = NULL;
|
|
|
|
int i, j = 0, num = 0;
|
|
|
|
unsigned char *data = NULL;
|
|
|
|
unsigned char *old_data = NULL;
|
|
|
|
|
|
|
|
atom = _ecore_x_netwm_state_atom_get(state);
|
2005-02-07 05:51:05 -08:00
|
|
|
|
2004-12-29 21:36:01 -08:00
|
|
|
ecore_x_window_prop_property_get(win, ECORE_X_ATOM_NET_WM_STATE,
|
|
|
|
XA_ATOM, 32, &old_data, &num);
|
|
|
|
oldset = (Ecore_X_Atom *) old_data;
|
|
|
|
|
|
|
|
if (on)
|
2005-03-22 11:34:10 -08:00
|
|
|
{
|
|
|
|
if (ecore_x_netwm_window_state_isset(win, state))
|
|
|
|
{
|
|
|
|
XFree(old_data);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
newset = calloc(num + 1, sizeof(Ecore_X_Atom));
|
|
|
|
if (!newset) return;
|
|
|
|
data = (unsigned char *) newset;
|
|
|
|
|
|
|
|
for (i = 0; i < num; i++)
|
|
|
|
newset[i] = oldset[i];
|
|
|
|
newset[num] = atom;
|
|
|
|
|
|
|
|
ecore_x_window_prop_property_set(win, ECORE_X_ATOM_NET_WM_STATE,
|
|
|
|
XA_ATOM, 32, data, num + 1);
|
|
|
|
}
|
2004-12-29 21:36:01 -08:00
|
|
|
else
|
2005-03-22 11:34:10 -08:00
|
|
|
{
|
|
|
|
if (!ecore_x_netwm_window_state_isset(win, state))
|
|
|
|
{
|
|
|
|
XFree(old_data);
|
|
|
|
return;
|
|
|
|
}
|
2005-04-10 03:20:18 -07:00
|
|
|
newset = calloc(num - 1, sizeof(Ecore_X_Atom));
|
2005-03-22 11:34:10 -08:00
|
|
|
if (!newset)
|
|
|
|
{
|
|
|
|
XFree(old_data);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
data = (unsigned char *) newset;
|
|
|
|
for (i = 0; i < num; i++)
|
|
|
|
if (oldset[i] != atom)
|
|
|
|
newset[j++] = oldset[i];
|
|
|
|
|
|
|
|
ecore_x_window_prop_property_set(win, ECORE_X_ATOM_NET_WM_STATE,
|
|
|
|
XA_ATOM, 32, data, num - 1);
|
|
|
|
}
|
2005-02-07 05:51:05 -08:00
|
|
|
XFree(oldset);
|
|
|
|
free(newset);
|
|
|
|
}
|
|
|
|
|
|
|
|
static Ecore_X_Window_Type
|
|
|
|
_ecore_x_netwm_window_type_type_get(Ecore_X_Atom atom)
|
|
|
|
{
|
|
|
|
if (atom == ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DESKTOP)
|
|
|
|
return ECORE_X_WINDOW_TYPE_DESKTOP;
|
|
|
|
else if (atom == ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DOCK)
|
|
|
|
return ECORE_X_WINDOW_TYPE_DOCK;
|
|
|
|
else if (atom == ECORE_X_ATOM_NET_WM_WINDOW_TYPE_TOOLBAR)
|
|
|
|
return ECORE_X_WINDOW_TYPE_TOOLBAR;
|
|
|
|
else if (atom == ECORE_X_ATOM_NET_WM_WINDOW_TYPE_MENU)
|
|
|
|
return ECORE_X_WINDOW_TYPE_MENU;
|
|
|
|
else if (atom == ECORE_X_ATOM_NET_WM_WINDOW_TYPE_UTILITY)
|
|
|
|
return ECORE_X_WINDOW_TYPE_UTILITY;
|
|
|
|
else if (atom == ECORE_X_ATOM_NET_WM_WINDOW_TYPE_SPLASH)
|
|
|
|
return ECORE_X_WINDOW_TYPE_SPLASH;
|
|
|
|
else if (atom == ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DIALOG)
|
|
|
|
return ECORE_X_WINDOW_TYPE_DIALOG;
|
|
|
|
else if (atom == ECORE_X_ATOM_NET_WM_WINDOW_TYPE_NORMAL)
|
|
|
|
return ECORE_X_WINDOW_TYPE_NORMAL;
|
|
|
|
else
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static Ecore_X_Atom
|
|
|
|
_ecore_x_netwm_window_type_atom_get(Ecore_X_Window_Type type)
|
|
|
|
{
|
|
|
|
switch (type)
|
2005-03-22 11:34:10 -08:00
|
|
|
{
|
2005-02-07 05:51:05 -08:00
|
|
|
case ECORE_X_WINDOW_TYPE_DESKTOP:
|
2005-03-22 11:34:10 -08:00
|
|
|
return ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DESKTOP;
|
2005-02-07 05:51:05 -08:00
|
|
|
case ECORE_X_WINDOW_TYPE_DOCK:
|
2005-03-22 11:34:10 -08:00
|
|
|
return ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DOCK;
|
2005-02-07 05:51:05 -08:00
|
|
|
case ECORE_X_WINDOW_TYPE_TOOLBAR:
|
2005-03-22 11:34:10 -08:00
|
|
|
return ECORE_X_ATOM_NET_WM_WINDOW_TYPE_TOOLBAR;
|
2005-02-07 05:51:05 -08:00
|
|
|
case ECORE_X_WINDOW_TYPE_MENU:
|
2005-03-22 11:34:10 -08:00
|
|
|
return ECORE_X_ATOM_NET_WM_WINDOW_TYPE_MENU;
|
2005-02-07 05:51:05 -08:00
|
|
|
case ECORE_X_WINDOW_TYPE_UTILITY:
|
2005-03-22 11:34:10 -08:00
|
|
|
return ECORE_X_ATOM_NET_WM_WINDOW_TYPE_UTILITY;
|
2005-02-07 05:51:05 -08:00
|
|
|
case ECORE_X_WINDOW_TYPE_SPLASH:
|
2005-03-22 11:34:10 -08:00
|
|
|
return ECORE_X_ATOM_NET_WM_WINDOW_TYPE_SPLASH;
|
2005-02-07 05:51:05 -08:00
|
|
|
case ECORE_X_WINDOW_TYPE_DIALOG:
|
2005-03-22 11:34:10 -08:00
|
|
|
return ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DIALOG;
|
2005-02-07 05:51:05 -08:00
|
|
|
case ECORE_X_WINDOW_TYPE_NORMAL:
|
2005-03-22 11:34:10 -08:00
|
|
|
return ECORE_X_ATOM_NET_WM_WINDOW_TYPE_NORMAL;
|
2005-02-07 05:51:05 -08:00
|
|
|
default:
|
2005-03-22 11:34:10 -08:00
|
|
|
return 0;
|
|
|
|
}
|
2005-02-07 05:51:05 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* FIXME: We should set WM_TRANSIENT_FOR if type is ECORE_X_WINDOW_TYPE_TOOLBAR
|
|
|
|
* , ECORE_X_WINDOW_TYPE_MENU or ECORE_X_WINDOW_TYPE_DIALOG
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
ecore_x_netwm_window_type_set(Ecore_X_Window win, Ecore_X_Window_Type type)
|
|
|
|
{
|
|
|
|
Ecore_X_Atom atom;
|
|
|
|
|
|
|
|
atom = _ecore_x_netwm_window_type_atom_get(type);
|
|
|
|
ecore_x_window_prop_property_set(win, ECORE_X_ATOM_NET_WM_WINDOW_TYPE,
|
|
|
|
XA_ATOM, 32, (unsigned char *)&atom, 1);
|
|
|
|
}
|
|
|
|
|
|
|
|
Ecore_X_Window_Type
|
|
|
|
ecore_x_netwm_window_type_get(Ecore_X_Window win)
|
|
|
|
{
|
|
|
|
int num, i;
|
|
|
|
Ecore_X_Window_Type ret = ECORE_X_WINDOW_TYPE_NORMAL, type;
|
|
|
|
unsigned char *data;
|
|
|
|
Ecore_X_Atom *atoms;
|
|
|
|
|
|
|
|
if (!ecore_x_window_prop_property_get(win, ECORE_X_ATOM_NET_WM_WINDOW_TYPE,
|
|
|
|
XA_ATOM, 32, &data, &num))
|
|
|
|
{
|
|
|
|
/* Check if WM_TRANSIENT_FOR is set */
|
|
|
|
if (ecore_x_icccm_transient_for_get(win))
|
|
|
|
ret = ECORE_X_WINDOW_TYPE_DIALOG;
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
atoms = (Ecore_X_Atom *) data;
|
|
|
|
|
|
|
|
for (i = 0; i < num; ++i)
|
2005-03-22 11:34:10 -08:00
|
|
|
{
|
|
|
|
type = _ecore_x_netwm_window_type_type_get(atoms[i]);
|
|
|
|
if (type)
|
|
|
|
{
|
|
|
|
ret = type;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2005-02-07 05:51:05 -08:00
|
|
|
|
|
|
|
XFree(data);
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
static Ecore_X_Atom
|
|
|
|
_ecore_x_netwm_action_atom_get(Ecore_X_Action action)
|
|
|
|
{
|
|
|
|
switch (action)
|
|
|
|
{
|
|
|
|
case ECORE_X_ACTION_MOVE:
|
|
|
|
return ECORE_X_ATOM_NET_WM_ACTION_MOVE;
|
|
|
|
case ECORE_X_ACTION_RESIZE:
|
|
|
|
return ECORE_X_ATOM_NET_WM_ACTION_RESIZE;
|
|
|
|
case ECORE_X_ACTION_MINIMIZE:
|
|
|
|
return ECORE_X_ATOM_NET_WM_ACTION_MINIMIZE;
|
|
|
|
case ECORE_X_ACTION_SHADE:
|
|
|
|
return ECORE_X_ATOM_NET_WM_ACTION_SHADE;
|
|
|
|
case ECORE_X_ACTION_STICK:
|
|
|
|
return ECORE_X_ATOM_NET_WM_ACTION_STICK;
|
|
|
|
case ECORE_X_ACTION_MAXIMIZE_HORZ:
|
|
|
|
return ECORE_X_ATOM_NET_WM_ACTION_MAXIMIZE_HORZ;
|
|
|
|
case ECORE_X_ACTION_MAXIMIZE_VERT:
|
|
|
|
return ECORE_X_ATOM_NET_WM_ACTION_MAXIMIZE_VERT;
|
|
|
|
case ECORE_X_ACTION_FULLSCREEN:
|
|
|
|
return ECORE_X_ATOM_NET_WM_ACTION_FULLSCREEN;
|
|
|
|
case ECORE_X_ACTION_CHANGE_DESKTOP:
|
|
|
|
return ECORE_X_ATOM_NET_WM_ACTION_CHANGE_DESKTOP;
|
|
|
|
case ECORE_X_ACTION_CLOSE:
|
|
|
|
return ECORE_X_ATOM_NET_WM_ACTION_CLOSE;
|
|
|
|
default:
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
ecore_x_netwm_allowed_action_isset(Ecore_X_Window win, Ecore_X_Action action)
|
|
|
|
{
|
|
|
|
int num, i, ret = 0;
|
|
|
|
unsigned char *data;
|
|
|
|
Ecore_X_Atom *atoms, atom;
|
|
|
|
|
|
|
|
if (!ecore_x_window_prop_property_get(win, ECORE_X_ATOM_NET_WM_WINDOW_TYPE,
|
|
|
|
XA_ATOM, 32, &data, &num))
|
|
|
|
return ret;
|
|
|
|
|
|
|
|
atom = _ecore_x_netwm_action_atom_get(action);
|
|
|
|
atoms = (Ecore_X_Atom *) data;
|
|
|
|
|
|
|
|
for (i = 0; i < num; ++i)
|
2005-03-22 11:34:10 -08:00
|
|
|
{
|
|
|
|
if (atom == atoms[i])
|
|
|
|
{
|
|
|
|
ret = 1;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2005-02-07 05:51:05 -08:00
|
|
|
|
|
|
|
XFree(data);
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
ecore_x_netwm_allowed_action_set(Ecore_X_Window win, Ecore_X_Action action, int on)
|
|
|
|
{
|
|
|
|
Ecore_X_Atom atom;
|
|
|
|
Ecore_X_Atom *oldset = NULL, *newset = NULL;
|
|
|
|
int i, j = 0, num = 0;
|
|
|
|
unsigned char *data = NULL;
|
|
|
|
unsigned char *old_data = NULL;
|
|
|
|
|
|
|
|
atom = _ecore_x_netwm_action_atom_get(action);
|
|
|
|
|
|
|
|
ecore_x_window_prop_property_get(win, ECORE_X_ATOM_NET_WM_ALLOWED_ACTIONS,
|
|
|
|
XA_ATOM, 32, &old_data, &num);
|
|
|
|
oldset = (Ecore_X_Atom *) old_data;
|
|
|
|
|
|
|
|
if (on)
|
2005-03-22 11:34:10 -08:00
|
|
|
{
|
|
|
|
if (ecore_x_netwm_allowed_action_isset(win, action))
|
|
|
|
{
|
|
|
|
XFree(old_data);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
newset = calloc(num + 1, sizeof(Ecore_X_Atom));
|
|
|
|
if (!newset) return;
|
|
|
|
data = (unsigned char *) newset;
|
|
|
|
|
|
|
|
for (i = 0; i < num; i++)
|
|
|
|
newset[i] = oldset[i];
|
|
|
|
newset[num] = atom;
|
|
|
|
|
|
|
|
ecore_x_window_prop_property_set(win, ECORE_X_ATOM_NET_WM_ALLOWED_ACTIONS,
|
|
|
|
XA_ATOM, 32, data, num + 1);
|
|
|
|
}
|
2005-02-07 05:51:05 -08:00
|
|
|
else
|
2005-03-22 11:34:10 -08:00
|
|
|
{
|
|
|
|
if (!ecore_x_netwm_allowed_action_isset(win, action))
|
|
|
|
{
|
|
|
|
XFree(old_data);
|
|
|
|
return;
|
|
|
|
}
|
2005-04-10 03:20:18 -07:00
|
|
|
newset = calloc(num - 1, sizeof(Ecore_X_Atom));
|
2005-03-22 11:34:10 -08:00
|
|
|
if (!newset)
|
|
|
|
{
|
|
|
|
XFree(old_data);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
data = (unsigned char *) newset;
|
|
|
|
for (i = 0; i < num; i++)
|
|
|
|
if (oldset[i] != atom)
|
|
|
|
newset[j++] = oldset[i];
|
|
|
|
|
|
|
|
ecore_x_window_prop_property_set(win, ECORE_X_ATOM_NET_WM_ALLOWED_ACTIONS,
|
|
|
|
XA_ATOM, 32, data, num - 1);
|
|
|
|
}
|
2004-12-29 21:36:01 -08:00
|
|
|
XFree(oldset);
|
|
|
|
free(newset);
|
|
|
|
}
|
|
|
|
|
2005-02-07 05:51:05 -08:00
|
|
|
void
|
|
|
|
ecore_x_netwm_opacity_set(Ecore_X_Window win, unsigned int opacity)
|
|
|
|
{
|
|
|
|
ecore_x_window_prop_card32_set(win, ECORE_X_ATOM_NET_WM_WINDOW_OPACITY,
|
|
|
|
&opacity, 1);
|
|
|
|
}
|
2004-12-29 21:36:01 -08:00
|
|
|
|
2005-02-07 05:51:05 -08:00
|
|
|
int
|
|
|
|
ecore_x_netwm_opacity_get(Ecore_X_Window win, unsigned int *opacity)
|
|
|
|
{
|
2005-02-15 03:21:47 -08:00
|
|
|
int ret;
|
|
|
|
ret = ecore_x_window_prop_card32_get(win, ECORE_X_ATOM_NET_WM_WINDOW_OPACITY,
|
|
|
|
opacity, 1);
|
|
|
|
return ret == 1 ? 1 : 0;
|
2005-02-07 05:51:05 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
ecore_x_netwm_frame_size_set(Ecore_X_Window win, int fl, int fr, int ft, int fb)
|
|
|
|
{
|
|
|
|
int frames[4];
|
|
|
|
|
|
|
|
frames[0] = fl;
|
|
|
|
frames[1] = fr;
|
|
|
|
frames[2] = ft;
|
|
|
|
frames[3] = fb;
|
|
|
|
ecore_x_window_prop_card32_set(win, ECORE_X_ATOM_NET_FRAME_EXTENTS, frames, 4);
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
ecore_x_netwm_frame_size_get(Ecore_X_Window win, int *fl, int *fr, int *ft, int *fb)
|
|
|
|
{
|
|
|
|
int ret = 0;
|
|
|
|
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];
|
|
|
|
return 1;
|
|
|
|
}
|
2004-12-29 21:36:01 -08:00
|
|
|
|