2005-02-07 05:51:05 -08:00
|
|
|
/*
|
|
|
|
* vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
|
|
|
|
*/
|
2009-01-31 10:33:39 -08:00
|
|
|
|
2004-10-23 07:26:25 -07:00
|
|
|
/*
|
|
|
|
* _NET_WM... aka Extended Window Manager Hint (EWMH) functions.
|
|
|
|
*/
|
2009-01-31 10:33:39 -08:00
|
|
|
|
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
# include <config.h>
|
|
|
|
#endif
|
|
|
|
|
2009-03-16 09:24:43 -07:00
|
|
|
#include <string.h>
|
|
|
|
|
2004-10-23 07:26:25 -07:00
|
|
|
#include "Ecore.h"
|
2005-09-29 23:16:49 -07:00
|
|
|
#include "Ecore_Data.h"
|
2004-10-23 07:26:25 -07:00
|
|
|
#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
|
|
|
|
2005-09-29 23:16:49 -07:00
|
|
|
typedef struct _Ecore_X_Startup_Info Ecore_X_Startup_Info;
|
|
|
|
|
|
|
|
struct _Ecore_X_Startup_Info
|
|
|
|
{
|
|
|
|
Ecore_X_Window win;
|
|
|
|
|
|
|
|
int init;
|
|
|
|
|
|
|
|
int buffer_size;
|
|
|
|
char *buffer;
|
|
|
|
|
|
|
|
int length;
|
|
|
|
|
|
|
|
/* These are the sequence info fields */
|
|
|
|
char *id;
|
|
|
|
char *name;
|
|
|
|
int screen;
|
|
|
|
char *bin;
|
|
|
|
char *icon;
|
|
|
|
int desktop;
|
|
|
|
int timestamp;
|
|
|
|
char *description;
|
|
|
|
char *wmclass;
|
|
|
|
int silent;
|
|
|
|
};
|
|
|
|
|
|
|
|
static void _ecore_x_window_prop_string_utf8_set(Ecore_X_Window win, Ecore_X_Atom atom, const char *str);
|
|
|
|
static char *_ecore_x_window_prop_string_utf8_get(Ecore_X_Window win, Ecore_X_Atom atom);
|
2006-01-06 13:56:05 -08:00
|
|
|
#if 0 /* Unused */
|
2005-09-29 23:16:49 -07:00
|
|
|
static int _ecore_x_netwm_startup_info_process(Ecore_X_Startup_Info *info);
|
|
|
|
static int _ecore_x_netwm_startup_info_parse(Ecore_X_Startup_Info *info, char *data);
|
2006-01-06 13:56:05 -08:00
|
|
|
#endif
|
2005-09-29 23:16:49 -07:00
|
|
|
static void _ecore_x_netwm_startup_info_free(void *data);
|
|
|
|
|
2004-10-23 07:26:25 -07:00
|
|
|
/*
|
|
|
|
* Convenience macros
|
|
|
|
*/
|
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-11-29 15:25:12 -08:00
|
|
|
/*
|
2005-09-29 23:16:49 -07:00
|
|
|
* Local variables
|
2004-11-29 15:25:12 -08:00
|
|
|
*/
|
|
|
|
|
2008-12-11 05:55:47 -08:00
|
|
|
static Eina_Hash *startup_info = NULL;
|
2004-11-29 15:25:12 -08:00
|
|
|
|
2006-01-06 12:22:09 -08:00
|
|
|
EAPI void
|
2005-09-07 02:50:14 -07:00
|
|
|
ecore_x_netwm_init(void)
|
2004-10-23 07:26:25 -07:00
|
|
|
{
|
2008-12-11 05:55:47 -08:00
|
|
|
startup_info = eina_hash_string_superfast_new(_ecore_x_netwm_startup_info_free);
|
2005-09-29 23:16:49 -07:00
|
|
|
}
|
|
|
|
|
2006-01-06 12:22:09 -08:00
|
|
|
EAPI void
|
2005-09-29 23:16:49 -07:00
|
|
|
ecore_x_netwm_shutdown(void)
|
|
|
|
{
|
|
|
|
if (startup_info)
|
2008-12-11 05:55:47 -08:00
|
|
|
eina_hash_free(startup_info);
|
2005-09-29 23:16:49 -07:00
|
|
|
startup_info = NULL;
|
2004-10-23 07:26:25 -07:00
|
|
|
}
|
2004-10-27 14:50:58 -07:00
|
|
|
|
|
|
|
/*
|
|
|
|
* WM identification
|
|
|
|
*/
|
2006-01-06 12:22:09 -08:00
|
|
|
EAPI void
|
2004-10-27 14:50:58 -07:00
|
|
|
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
|
|
|
{
|
2006-01-05 13:41:30 -08:00
|
|
|
ecore_x_window_prop_window_set(root, ECORE_X_ATOM_NET_SUPPORTING_WM_CHECK, &check, 1);
|
|
|
|
ecore_x_window_prop_window_set(check, ECORE_X_ATOM_NET_SUPPORTING_WM_CHECK, &check, 1);
|
|
|
|
_ecore_x_window_prop_string_utf8_set(check, ECORE_X_ATOM_NET_WM_NAME, wm_name);
|
2004-10-27 14:50:58 -07:00
|
|
|
/* This one isn't mandatory */
|
2006-01-05 13:41:30 -08:00
|
|
|
_ecore_x_window_prop_string_utf8_set(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
|
|
|
|
|
|
|
/*
|
2005-05-16 05:59:26 -07:00
|
|
|
* Set supported atoms
|
2004-10-23 07:26:25 -07:00
|
|
|
*/
|
2006-01-06 12:22:09 -08:00
|
|
|
EAPI void
|
2005-06-04 03:01:23 -07:00
|
|
|
ecore_x_netwm_supported_set(Ecore_X_Window root, Ecore_X_Atom *supported, int num)
|
2005-05-16 05:59:26 -07:00
|
|
|
{
|
2006-01-05 13:41:30 -08:00
|
|
|
ecore_x_window_prop_atom_set(root, ECORE_X_ATOM_NET_SUPPORTED, supported, num);
|
2005-06-04 03:01:23 -07:00
|
|
|
}
|
2005-05-16 05:59:26 -07:00
|
|
|
|
2006-01-06 12:22:09 -08:00
|
|
|
EAPI int
|
2005-06-07 08:34:54 -07:00
|
|
|
ecore_x_netwm_supported_get(Ecore_X_Window root, Ecore_X_Atom **supported, int *num)
|
2005-06-04 03:01:23 -07:00
|
|
|
{
|
2005-06-05 01:25:48 -07:00
|
|
|
int num_ret;
|
2005-05-16 05:59:26 -07:00
|
|
|
|
2005-06-04 03:01:23 -07:00
|
|
|
if (num) *num = 0;
|
2005-06-07 08:34:54 -07:00
|
|
|
if (supported) *supported = NULL;
|
2005-05-16 05:59:26 -07:00
|
|
|
|
2006-01-05 13:41:30 -08:00
|
|
|
num_ret = ecore_x_window_prop_atom_list_get(root, ECORE_X_ATOM_NET_SUPPORTED,
|
|
|
|
supported);
|
|
|
|
if (num_ret <= 0)
|
2005-06-07 08:34:54 -07:00
|
|
|
return 0;
|
2005-05-16 05:59:26 -07:00
|
|
|
|
2005-06-04 03:01:23 -07:00
|
|
|
if (num) *num = num_ret;
|
2005-06-07 08:34:54 -07:00
|
|
|
return 1;
|
2005-05-16 05:59:26 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Desktop configuration and status
|
|
|
|
*/
|
2006-01-06 12:22:09 -08:00
|
|
|
EAPI 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
|
|
|
}
|
|
|
|
|
2006-01-06 12:22:09 -08:00
|
|
|
EAPI void
|
2005-06-07 08:34:54 -07:00
|
|
|
ecore_x_netwm_desk_roots_set(Ecore_X_Window root,
|
|
|
|
Ecore_X_Window *vroots, unsigned int n_desks)
|
2004-10-23 07:26:25 -07:00
|
|
|
{
|
2006-01-05 13:41:30 -08:00
|
|
|
ecore_x_window_prop_window_set(root, ECORE_X_ATOM_NET_VIRTUAL_ROOTS, vroots, n_desks);
|
2004-10-23 07:26:25 -07:00
|
|
|
}
|
|
|
|
|
2006-01-06 12:22:09 -08:00
|
|
|
EAPI void
|
2005-06-07 08:34:54 -07:00
|
|
|
ecore_x_netwm_desk_names_set(Ecore_X_Window root,
|
|
|
|
const char **names, unsigned int n_desks)
|
2004-10-23 07:26:25 -07:00
|
|
|
{
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
2006-01-06 12:22:09 -08:00
|
|
|
EAPI 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
|
|
|
}
|
|
|
|
|
2006-01-06 12:22:09 -08:00
|
|
|
EAPI void
|
2005-06-07 08:34:54 -07:00
|
|
|
ecore_x_netwm_desk_viewports_set(Ecore_X_Window root,
|
|
|
|
unsigned int *origins, unsigned int n_desks)
|
2005-02-07 05:51:05 -08:00
|
|
|
{
|
|
|
|
ecore_x_window_prop_card32_set(root, ECORE_X_ATOM_NET_DESKTOP_VIEWPORT,
|
|
|
|
origins, 2 * n_desks);
|
|
|
|
}
|
|
|
|
|
2006-01-06 12:22:09 -08:00
|
|
|
EAPI void
|
2005-02-07 05:51:05 -08:00
|
|
|
ecore_x_netwm_desk_layout_set(Ecore_X_Window root, int orientation,
|
|
|
|
int columns, int rows,
|
|
|
|
int starting_corner)
|
|
|
|
{
|
2005-05-16 05:59:26 -07:00
|
|
|
unsigned int layout[4];
|
2005-02-07 05:51:05 -08:00
|
|
|
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
2006-01-06 12:22:09 -08:00
|
|
|
EAPI void
|
2005-06-07 08:34:54 -07:00
|
|
|
ecore_x_netwm_desk_workareas_set(Ecore_X_Window root,
|
|
|
|
unsigned int *areas, 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_WORKAREA, areas,
|
|
|
|
4 * n_desks);
|
2004-10-23 07:26:25 -07:00
|
|
|
}
|
|
|
|
|
2006-01-06 12:22:09 -08:00
|
|
|
EAPI 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
|
|
|
}
|
|
|
|
|
2006-01-06 12:22:09 -08:00
|
|
|
EAPI void
|
2004-10-23 07:26:25 -07:00
|
|
|
ecore_x_netwm_showing_desktop_set(Ecore_X_Window root, int on)
|
|
|
|
{
|
2005-06-07 08:34:54 -07: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 */
|
2006-01-06 12:22:09 -08:00
|
|
|
EAPI void
|
2005-06-07 08:34:54 -07:00
|
|
|
ecore_x_netwm_client_list_set(Ecore_X_Window root,
|
|
|
|
Ecore_X_Window *p_clients, unsigned int n_clients)
|
2004-10-23 07:26:25 -07:00
|
|
|
{
|
2006-01-05 13:41:30 -08:00
|
|
|
ecore_x_window_prop_window_set(root, ECORE_X_ATOM_NET_CLIENT_LIST,
|
|
|
|
p_clients, n_clients);
|
2004-10-23 07:26:25 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Stacking order */
|
2006-01-06 12:22:09 -08:00
|
|
|
EAPI void
|
2004-12-08 12:29:45 -08:00
|
|
|
ecore_x_netwm_client_list_stacking_set(Ecore_X_Window root,
|
2005-06-07 08:34:54 -07:00
|
|
|
Ecore_X_Window *p_clients,
|
|
|
|
unsigned int n_clients)
|
2004-10-23 07:26:25 -07:00
|
|
|
{
|
2006-01-05 13:41:30 -08:00
|
|
|
ecore_x_window_prop_window_set(root, ECORE_X_ATOM_NET_CLIENT_LIST_STACKING,
|
|
|
|
p_clients, n_clients);
|
2004-10-23 07:26:25 -07:00
|
|
|
}
|
|
|
|
|
2006-01-06 12:22:09 -08:00
|
|
|
EAPI void
|
2004-10-23 07:26:25 -07:00
|
|
|
ecore_x_netwm_client_active_set(Ecore_X_Window root, Ecore_X_Window win)
|
|
|
|
{
|
2006-01-05 13:41:30 -08:00
|
|
|
ecore_x_window_prop_window_set(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
|
|
|
|
2008-06-30 01:39:36 -07:00
|
|
|
EAPI void
|
|
|
|
ecore_x_netwm_client_active_request(Ecore_X_Window root, Ecore_X_Window win, int type, Ecore_X_Window current_win)
|
|
|
|
{
|
|
|
|
XEvent xev;
|
|
|
|
|
|
|
|
if (!root) root = DefaultRootWindow(_ecore_x_disp);
|
|
|
|
|
|
|
|
xev.xclient.type = ClientMessage;
|
|
|
|
xev.xclient.display = _ecore_x_disp;
|
|
|
|
xev.xclient.window = win;
|
|
|
|
xev.xclient.message_type = ECORE_X_ATOM_NET_ACTIVE_WINDOW;
|
|
|
|
xev.xclient.format = 32;
|
|
|
|
xev.xclient.data.l[0] = type;
|
|
|
|
xev.xclient.data.l[1] = CurrentTime;
|
|
|
|
xev.xclient.data.l[2] = current_win;
|
|
|
|
xev.xclient.data.l[3] = 0;
|
|
|
|
xev.xclient.data.l[4] = 0;
|
|
|
|
|
2008-07-01 00:12:27 -07:00
|
|
|
XSendEvent(_ecore_x_disp, root, False,
|
|
|
|
SubstructureRedirectMask | SubstructureNotifyMask, &xev);
|
2008-06-30 01:39:36 -07:00
|
|
|
}
|
|
|
|
|
2006-01-06 12:22:09 -08:00
|
|
|
EAPI void
|
2004-11-29 15:25:12 -08:00
|
|
|
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
|
|
|
}
|
|
|
|
|
2006-01-06 12:22:09 -08:00
|
|
|
EAPI int
|
2005-06-07 08:34:54 -07:00
|
|
|
ecore_x_netwm_name_get(Ecore_X_Window win, char **name)
|
2004-11-29 15:25:12 -08:00
|
|
|
{
|
2005-06-07 08:34:54 -07:00
|
|
|
if (name)
|
|
|
|
*name = _ecore_x_window_prop_string_utf8_get(win, ECORE_X_ATOM_NET_WM_NAME);
|
|
|
|
return 1;
|
2004-11-29 15:25:12 -08:00
|
|
|
}
|
|
|
|
|
2006-01-06 12:22:09 -08:00
|
|
|
EAPI void
|
2005-09-13 20:26:23 -07:00
|
|
|
ecore_x_netwm_startup_id_set(Ecore_X_Window win, const char *id)
|
|
|
|
{
|
|
|
|
_ecore_x_window_prop_string_utf8_set(win, ECORE_X_ATOM_NET_STARTUP_ID, id);
|
|
|
|
}
|
|
|
|
|
2006-01-06 12:22:09 -08:00
|
|
|
EAPI int
|
2005-09-13 20:26:23 -07:00
|
|
|
ecore_x_netwm_startup_id_get(Ecore_X_Window win, char **id)
|
|
|
|
{
|
|
|
|
if (id)
|
|
|
|
*id = _ecore_x_window_prop_string_utf8_get(win, ECORE_X_ATOM_NET_STARTUP_ID);
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2006-01-06 12:22:09 -08:00
|
|
|
EAPI 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);
|
|
|
|
}
|
|
|
|
|
2006-01-06 12:22:09 -08:00
|
|
|
EAPI int
|
2005-06-07 08:34:54 -07:00
|
|
|
ecore_x_netwm_visible_name_get(Ecore_X_Window win, char **name)
|
2004-11-29 15:25:12 -08:00
|
|
|
{
|
2005-06-07 08:34:54 -07:00
|
|
|
if (name)
|
|
|
|
*name = _ecore_x_window_prop_string_utf8_get(win,
|
|
|
|
ECORE_X_ATOM_NET_WM_VISIBLE_NAME);
|
|
|
|
return 1;
|
2004-11-29 15:25:12 -08:00
|
|
|
}
|
|
|
|
|
2006-01-06 12:22:09 -08:00
|
|
|
EAPI 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
|
|
|
}
|
|
|
|
|
2006-01-06 12:22:09 -08:00
|
|
|
EAPI int
|
2005-06-07 08:34:54 -07:00
|
|
|
ecore_x_netwm_icon_name_get(Ecore_X_Window win, char **name)
|
2004-11-29 15:25:12 -08:00
|
|
|
{
|
2005-06-07 08:34:54 -07:00
|
|
|
if (name)
|
|
|
|
*name = _ecore_x_window_prop_string_utf8_get(win,
|
|
|
|
ECORE_X_ATOM_NET_WM_ICON_NAME);
|
|
|
|
return 1;
|
2004-11-29 15:25:12 -08:00
|
|
|
}
|
2004-12-04 02:10:29 -08:00
|
|
|
|
2006-01-06 12:22:09 -08:00
|
|
|
EAPI void
|
2004-11-29 15:25:12 -08:00
|
|
|
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
|
|
|
}
|
|
|
|
|
2006-01-06 12:22:09 -08:00
|
|
|
EAPI int
|
2005-06-07 08:34:54 -07:00
|
|
|
ecore_x_netwm_visible_icon_name_get(Ecore_X_Window win, char **name)
|
2004-12-04 02:10:29 -08:00
|
|
|
{
|
2005-06-07 08:34:54 -07:00
|
|
|
if (name)
|
|
|
|
*name = _ecore_x_window_prop_string_utf8_get(win,
|
|
|
|
ECORE_X_ATOM_NET_WM_VISIBLE_ICON_NAME);
|
|
|
|
return 1;
|
2004-12-04 02:10:29 -08:00
|
|
|
}
|
2004-12-08 12:29:45 -08:00
|
|
|
|
2006-01-06 12:22:09 -08:00
|
|
|
EAPI void
|
2004-12-08 12:29:45 -08:00
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
2006-01-06 12:22:09 -08:00
|
|
|
EAPI int
|
2004-12-08 12:29:45 -08:00
|
|
|
ecore_x_netwm_desktop_get(Ecore_X_Window win, unsigned int *desk)
|
|
|
|
{
|
2005-02-15 03:21:47 -08:00
|
|
|
int ret;
|
2005-05-16 05:59:26 -07:00
|
|
|
unsigned int tmp;
|
|
|
|
|
2005-02-15 03:21:47 -08:00
|
|
|
ret = ecore_x_window_prop_card32_get(win, ECORE_X_ATOM_NET_WM_DESKTOP,
|
2005-05-16 05:59:26 -07:00
|
|
|
&tmp, 1);
|
2005-02-15 03:21:47 -08:00
|
|
|
|
2005-05-16 05:59:26 -07:00
|
|
|
if (desk) *desk = tmp;
|
2005-02-15 03:21:47 -08:00
|
|
|
return ret == 1 ? 1 : 0;
|
2004-12-08 12:29:45 -08:00
|
|
|
}
|
|
|
|
|
2005-02-07 05:51:05 -08:00
|
|
|
/*
|
2005-06-03 05:11:27 -07:00
|
|
|
* _NET_WM_STRUT is deprecated
|
2005-02-07 05:51:05 -08:00
|
|
|
*/
|
2006-01-06 12:22:09 -08:00
|
|
|
EAPI 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-05-16 05:59:26 -07:00
|
|
|
unsigned int strut[4];
|
2005-02-07 05:51:05 -08:00
|
|
|
|
|
|
|
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
|
|
|
/*
|
2005-06-03 05:11:27 -07:00
|
|
|
* _NET_WM_STRUT is deprecated
|
2005-02-07 05:51:05 -08:00
|
|
|
*/
|
2006-01-06 12:22:09 -08:00
|
|
|
EAPI 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;
|
2005-05-16 05:59:26 -07:00
|
|
|
unsigned int strut[4];
|
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;
|
|
|
|
|
2005-05-16 05:59:26 -07:00
|
|
|
if (left) *left = strut[0];
|
|
|
|
if (right) *right = strut[1];
|
|
|
|
if (top) *top = strut[2];
|
|
|
|
if (bottom) *bottom = strut[3];
|
2005-02-07 05:51:05 -08:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2006-01-06 12:22:09 -08:00
|
|
|
EAPI void
|
2005-02-07 05:51:05 -08:00
|
|
|
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,
|
2006-05-16 19:26:52 -07:00
|
|
|
int right_start_y, int right_end_y, int top_start_x,
|
|
|
|
int top_end_x, int bottom_start_x, int bottom_end_x)
|
2005-02-07 05:51:05 -08:00
|
|
|
{
|
2005-05-16 05:59:26 -07:00
|
|
|
unsigned int strut[12];
|
2005-02-07 05:51:05 -08:00
|
|
|
|
|
|
|
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
|
|
|
}
|
|
|
|
|
2006-01-06 12:22:09 -08:00
|
|
|
EAPI int
|
2005-02-07 05:51:05 -08:00
|
|
|
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,
|
2006-05-16 19:26:52 -07:00
|
|
|
int *right_start_y, int *right_end_y, int *top_start_x,
|
|
|
|
int *top_end_x, int *bottom_start_x, int *bottom_end_x)
|
2005-02-07 05:51:05 -08:00
|
|
|
{
|
|
|
|
int ret = 0;
|
2005-05-16 05:59:26 -07:00
|
|
|
unsigned int strut[12];
|
2005-02-07 05:51:05 -08:00
|
|
|
|
|
|
|
ret = ecore_x_window_prop_card32_get(win, ECORE_X_ATOM_NET_WM_STRUT_PARTIAL, strut, 12);
|
|
|
|
if (ret != 12)
|
2005-06-03 05:11:27 -07:00
|
|
|
return 0;
|
2005-02-07 05:51:05 -08:00
|
|
|
|
2005-05-16 05:59:26 -07:00
|
|
|
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];
|
2005-02-07 05:51:05 -08:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2006-01-06 12:22:09 -08:00
|
|
|
EAPI int
|
2005-09-25 09:48:30 -07:00
|
|
|
ecore_x_netwm_icons_get(Ecore_X_Window win, Ecore_X_Icon **icon, int *num)
|
2005-06-02 13:14:13 -07:00
|
|
|
{
|
2005-09-25 09:48:30 -07:00
|
|
|
unsigned int *data, *p;
|
2005-06-02 18:18:58 -07:00
|
|
|
unsigned int *src;
|
2005-09-25 09:48:30 -07:00
|
|
|
unsigned int len, icons, i;
|
|
|
|
int num_ret;
|
2005-06-02 13:14:13 -07:00
|
|
|
|
|
|
|
if (num) *num = 0;
|
2005-09-25 09:48:30 -07:00
|
|
|
if (icon) *icon = NULL;
|
2005-06-02 13:14:13 -07:00
|
|
|
|
2006-01-05 13:41:30 -08:00
|
|
|
num_ret = ecore_x_window_prop_card32_list_get(win, ECORE_X_ATOM_NET_WM_ICON,
|
|
|
|
&data);
|
|
|
|
if (num_ret <= 0)
|
2005-06-02 13:14:13 -07:00
|
|
|
return 0;
|
2006-01-05 13:41:30 -08:00
|
|
|
if (!data) return 0;
|
2005-09-24 06:18:43 -07:00
|
|
|
if (num_ret < 2)
|
|
|
|
{
|
2006-01-05 13:41:30 -08:00
|
|
|
free(data);
|
2005-09-24 06:18:43 -07:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2005-09-25 09:48:30 -07:00
|
|
|
/* Check how many icons there are */
|
|
|
|
icons = 0;
|
|
|
|
p = data;
|
|
|
|
while (p)
|
2005-06-02 18:18:58 -07:00
|
|
|
{
|
2005-09-25 09:48:30 -07:00
|
|
|
len = p[0] * p[1];
|
|
|
|
p += (len + 2);
|
|
|
|
if ((p - data) > num_ret)
|
|
|
|
{
|
2006-01-05 13:41:30 -08:00
|
|
|
free(data);
|
2005-09-25 09:48:30 -07:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
icons++;
|
|
|
|
|
|
|
|
if ((p - data) == num_ret)
|
|
|
|
p = NULL;
|
2005-06-02 18:18:58 -07:00
|
|
|
}
|
2005-09-25 09:48:30 -07:00
|
|
|
if (num) *num = icons;
|
2005-06-02 13:14:13 -07:00
|
|
|
|
2005-09-25 09:48:30 -07:00
|
|
|
/* If the user doesn't want the icons, return */
|
|
|
|
if (!icon)
|
|
|
|
{
|
2006-01-05 13:41:30 -08:00
|
|
|
free(data);
|
2005-09-25 09:48:30 -07:00
|
|
|
return 1;
|
|
|
|
}
|
2005-06-02 13:14:13 -07:00
|
|
|
|
2005-09-25 09:48:30 -07:00
|
|
|
/* Allocate memory */
|
|
|
|
*icon = malloc(icons * sizeof(Ecore_X_Icon));
|
|
|
|
if (!(*icon))
|
2005-09-24 04:36:22 -07:00
|
|
|
{
|
2006-01-05 13:41:30 -08:00
|
|
|
free(data);
|
2005-09-24 04:36:22 -07:00
|
|
|
return 0;
|
|
|
|
}
|
2005-09-25 09:48:30 -07:00
|
|
|
|
2005-10-09 02:56:47 -07:00
|
|
|
/* Fetch the icons */
|
|
|
|
p = data;
|
2005-09-25 09:48:30 -07:00
|
|
|
for (i = 0; i < icons; i++)
|
|
|
|
{
|
2006-11-05 07:14:49 -08:00
|
|
|
unsigned int *ps, *pd, *pe;
|
2006-09-30 03:18:37 -07:00
|
|
|
|
2005-10-09 02:56:47 -07:00
|
|
|
len = p[0] * p[1];
|
|
|
|
((*icon)[i]).width = p[0];
|
|
|
|
((*icon)[i]).height = p[1];
|
|
|
|
src = &(p[2]);
|
2005-09-25 09:48:30 -07:00
|
|
|
((*icon)[i]).data = malloc(len * sizeof(unsigned int));
|
|
|
|
if (!((*icon)[i]).data)
|
|
|
|
{
|
|
|
|
while (i)
|
|
|
|
free(((*icon)[--i]).data);
|
|
|
|
free(*icon);
|
2006-01-05 13:41:30 -08:00
|
|
|
free(data);
|
2005-09-25 09:48:30 -07:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2006-09-30 03:18:37 -07:00
|
|
|
pd = ((*icon)[i]).data;
|
|
|
|
ps = src;
|
|
|
|
pe = ps + len;
|
2006-11-05 07:14:49 -08:00
|
|
|
for (; ps < pe; ps++)
|
2006-09-30 03:18:37 -07:00
|
|
|
{
|
2006-10-02 03:37:13 -07:00
|
|
|
unsigned int r, g, b, a;
|
2006-09-30 03:18:37 -07:00
|
|
|
|
|
|
|
a = (*ps >> 24) & 0xff;
|
2006-10-02 03:37:13 -07:00
|
|
|
r = (((*ps >> 16) & 0xff) * a) / 255;
|
|
|
|
g = (((*ps >> 8) & 0xff) * a) / 255;
|
|
|
|
b = (((*ps ) & 0xff) * a) / 255;
|
|
|
|
*pd = (a << 24) | (r << 16) | (g << 8) | (b);
|
|
|
|
pd++;
|
2006-09-30 03:18:37 -07:00
|
|
|
}
|
2005-09-25 09:48:30 -07:00
|
|
|
p += (len + 2);
|
|
|
|
}
|
|
|
|
|
2006-01-05 13:41:30 -08:00
|
|
|
free(data);
|
2005-06-02 13:14:13 -07:00
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2006-01-06 12:22:09 -08:00
|
|
|
EAPI void
|
2005-02-07 05:51:05 -08:00
|
|
|
ecore_x_netwm_icon_geometry_set(Ecore_X_Window win, int x, int y, int width, int height)
|
|
|
|
{
|
2005-05-16 05:59:26 -07:00
|
|
|
unsigned int geometry[4];
|
2005-02-07 05:51:05 -08:00
|
|
|
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
2006-01-06 12:22:09 -08:00
|
|
|
EAPI int
|
2005-02-07 05:51:05 -08:00
|
|
|
ecore_x_netwm_icon_geometry_get(Ecore_X_Window win, int *x, int *y, int *width, int *height)
|
|
|
|
{
|
|
|
|
int ret;
|
2005-05-16 05:59:26 -07:00
|
|
|
unsigned int geometry[4];
|
2005-02-07 05:51:05 -08:00
|
|
|
|
|
|
|
ret = ecore_x_window_prop_card32_get(win, ECORE_X_ATOM_NET_WM_ICON_GEOMETRY, geometry, 4);
|
|
|
|
if (ret != 4)
|
|
|
|
return 0;
|
|
|
|
|
2005-05-16 05:59:26 -07:00
|
|
|
if (x) *x = geometry[0];
|
|
|
|
if (y) *y = geometry[1];
|
|
|
|
if (width) *width = geometry[2];
|
|
|
|
if (height) *height = geometry[3];
|
2005-02-07 05:51:05 -08:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2006-01-06 12:22:09 -08:00
|
|
|
EAPI void
|
2005-02-07 05:51:05 -08:00
|
|
|
ecore_x_netwm_pid_set(Ecore_X_Window win, int pid)
|
|
|
|
{
|
2005-05-16 05:59:26 -07:00
|
|
|
unsigned int tmp;
|
|
|
|
|
|
|
|
tmp = pid;
|
2005-02-07 05:51:05 -08:00
|
|
|
ecore_x_window_prop_card32_set(win, ECORE_X_ATOM_NET_WM_PID,
|
2005-05-16 05:59:26 -07:00
|
|
|
&tmp, 1);
|
2005-02-07 05:51:05 -08:00
|
|
|
}
|
|
|
|
|
2006-01-06 12:22:09 -08:00
|
|
|
EAPI int
|
2005-02-07 05:51:05 -08:00
|
|
|
ecore_x_netwm_pid_get(Ecore_X_Window win, int *pid)
|
|
|
|
{
|
2005-02-15 03:21:47 -08:00
|
|
|
int ret;
|
2005-05-16 05:59:26 -07:00
|
|
|
unsigned int tmp;
|
|
|
|
|
2005-02-15 03:21:47 -08:00
|
|
|
ret = ecore_x_window_prop_card32_get(win, ECORE_X_ATOM_NET_WM_PID,
|
2005-05-16 05:59:26 -07:00
|
|
|
&tmp, 1);
|
|
|
|
if (pid) *pid = tmp;
|
2005-02-15 03:21:47 -08:00
|
|
|
return ret == 1 ? 1 : 0;
|
2005-02-07 05:51:05 -08:00
|
|
|
}
|
|
|
|
|
2006-01-06 12:22:09 -08:00
|
|
|
EAPI void
|
2005-02-07 05:51:05 -08:00
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
2006-01-06 12:22:09 -08:00
|
|
|
EAPI int
|
2005-02-07 05:51:05 -08:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2006-01-06 12:22:09 -08:00
|
|
|
EAPI void
|
2005-06-03 04:58:10 -07:00
|
|
|
ecore_x_netwm_user_time_set(Ecore_X_Window win, unsigned int time)
|
2005-02-07 05:51:05 -08:00
|
|
|
{
|
|
|
|
ecore_x_window_prop_card32_set(win, ECORE_X_ATOM_NET_WM_USER_TIME,
|
2005-06-03 04:58:10 -07:00
|
|
|
&time, 1);
|
2005-02-07 05:51:05 -08:00
|
|
|
}
|
|
|
|
|
2006-01-06 12:22:09 -08:00
|
|
|
EAPI int
|
2005-06-03 04:58:10 -07:00
|
|
|
ecore_x_netwm_user_time_get(Ecore_X_Window win, unsigned int *time)
|
2005-02-07 05:51:05 -08:00
|
|
|
{
|
2005-02-15 03:21:47 -08:00
|
|
|
int ret;
|
2005-05-16 05:59:26 -07:00
|
|
|
unsigned int tmp;
|
|
|
|
|
2005-02-15 03:21:47 -08:00
|
|
|
ret = ecore_x_window_prop_card32_get(win, ECORE_X_ATOM_NET_WM_USER_TIME,
|
2005-05-16 05:59:26 -07:00
|
|
|
&tmp, 1);
|
|
|
|
if (time) *time = tmp;
|
2005-02-15 03:21:47 -08:00
|
|
|
return ret == 1 ? 1 : 0;
|
2004-12-08 12:29:45 -08:00
|
|
|
}
|
2004-12-29 21:36:01 -08:00
|
|
|
|
2005-04-28 05:26:34 -07:00
|
|
|
Ecore_X_Window_State
|
|
|
|
_ecore_x_netwm_state_get(Ecore_X_Atom a)
|
|
|
|
{
|
|
|
|
if (a == ECORE_X_ATOM_NET_WM_STATE_MODAL)
|
|
|
|
return ECORE_X_WINDOW_STATE_MODAL;
|
|
|
|
else if (a == ECORE_X_ATOM_NET_WM_STATE_STICKY)
|
|
|
|
return ECORE_X_WINDOW_STATE_STICKY;
|
|
|
|
else if (a == ECORE_X_ATOM_NET_WM_STATE_MAXIMIZED_VERT)
|
|
|
|
return ECORE_X_WINDOW_STATE_MAXIMIZED_VERT;
|
|
|
|
else if (a == ECORE_X_ATOM_NET_WM_STATE_MAXIMIZED_HORZ)
|
|
|
|
return ECORE_X_WINDOW_STATE_MAXIMIZED_HORZ;
|
|
|
|
else if (a == ECORE_X_ATOM_NET_WM_STATE_SHADED)
|
|
|
|
return ECORE_X_WINDOW_STATE_SHADED;
|
|
|
|
else if (a == ECORE_X_ATOM_NET_WM_STATE_SKIP_TASKBAR)
|
|
|
|
return ECORE_X_WINDOW_STATE_SKIP_TASKBAR;
|
|
|
|
else if (a == ECORE_X_ATOM_NET_WM_STATE_SKIP_PAGER)
|
|
|
|
return ECORE_X_WINDOW_STATE_SKIP_PAGER;
|
|
|
|
else if (a == ECORE_X_ATOM_NET_WM_STATE_HIDDEN)
|
|
|
|
return ECORE_X_WINDOW_STATE_HIDDEN;
|
|
|
|
else if (a == ECORE_X_ATOM_NET_WM_STATE_FULLSCREEN)
|
|
|
|
return ECORE_X_WINDOW_STATE_FULLSCREEN;
|
|
|
|
else if (a == ECORE_X_ATOM_NET_WM_STATE_ABOVE)
|
|
|
|
return ECORE_X_WINDOW_STATE_ABOVE;
|
|
|
|
else if (a == ECORE_X_ATOM_NET_WM_STATE_BELOW)
|
|
|
|
return ECORE_X_WINDOW_STATE_BELOW;
|
|
|
|
else if (a == ECORE_X_ATOM_NET_WM_STATE_DEMANDS_ATTENTION)
|
|
|
|
return ECORE_X_WINDOW_STATE_DEMANDS_ATTENTION;
|
|
|
|
else
|
|
|
|
return ECORE_X_WINDOW_STATE_UNKNOWN;
|
|
|
|
}
|
|
|
|
|
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
|
|
|
}
|
|
|
|
|
2006-01-06 12:22:09 -08:00
|
|
|
EAPI void
|
2005-06-07 08:34:54 -07:00
|
|
|
ecore_x_netwm_window_state_set(Ecore_X_Window win, Ecore_X_Window_State *state, unsigned int num)
|
2005-05-30 23:51:50 -07:00
|
|
|
{
|
|
|
|
Ecore_X_Atom *set;
|
2006-11-05 07:14:49 -08:00
|
|
|
unsigned int i;
|
2005-05-30 23:51:50 -07:00
|
|
|
|
2005-06-07 08:34:54 -07:00
|
|
|
if (!num)
|
2005-05-30 23:51:50 -07:00
|
|
|
{
|
2005-06-09 21:18:24 -07:00
|
|
|
ecore_x_window_prop_property_del(win, ECORE_X_ATOM_NET_WM_STATE);
|
2005-06-07 08:34:54 -07:00
|
|
|
return;
|
2005-05-30 23:51:50 -07:00
|
|
|
}
|
|
|
|
|
2006-01-05 13:41:30 -08:00
|
|
|
set = malloc(num * sizeof(Ecore_X_Atom));
|
|
|
|
if (!set) return;
|
2005-05-30 23:51:50 -07:00
|
|
|
|
|
|
|
for (i = 0; i < num; i++)
|
|
|
|
set[i] = _ecore_x_netwm_state_atom_get(state[i]);
|
|
|
|
|
2006-01-05 13:41:30 -08:00
|
|
|
ecore_x_window_prop_atom_set(win, ECORE_X_ATOM_NET_WM_STATE, set, num);
|
2005-06-05 01:25:48 -07:00
|
|
|
|
2006-01-05 13:41:30 -08:00
|
|
|
free(set);
|
2005-05-30 23:51:50 -07:00
|
|
|
}
|
|
|
|
|
2006-01-06 12:22:09 -08:00
|
|
|
EAPI int
|
2005-06-07 08:34:54 -07:00
|
|
|
ecore_x_netwm_window_state_get(Ecore_X_Window win, Ecore_X_Window_State **state, unsigned int *num)
|
2004-12-29 21:36:01 -08:00
|
|
|
{
|
2005-06-07 08:34:54 -07:00
|
|
|
int num_ret, i;
|
|
|
|
Ecore_X_Atom *atoms;
|
2004-12-29 21:36:01 -08:00
|
|
|
|
2005-06-07 08:34:54 -07:00
|
|
|
if (num) *num = 0;
|
|
|
|
if (state) *state = NULL;
|
2004-12-29 21:36:01 -08:00
|
|
|
|
2006-01-05 13:41:30 -08:00
|
|
|
num_ret = ecore_x_window_prop_atom_list_get(win, ECORE_X_ATOM_NET_WM_STATE,
|
|
|
|
&atoms);
|
|
|
|
if (num_ret <= 0)
|
2005-06-07 08:34:54 -07:00
|
|
|
return 0;
|
2005-02-07 05:51:05 -08:00
|
|
|
|
2005-06-07 08:34:54 -07:00
|
|
|
if (state)
|
2005-03-22 11:34:10 -08:00
|
|
|
{
|
2005-06-07 08:34:54 -07:00
|
|
|
*state = malloc(num_ret * sizeof(Ecore_X_Window_State));
|
|
|
|
if (*state)
|
|
|
|
for (i = 0; i < num_ret; ++i)
|
|
|
|
(*state)[i] = _ecore_x_netwm_state_get(atoms[i]);
|
2005-03-22 11:34:10 -08:00
|
|
|
|
2005-06-07 08:34:54 -07:00
|
|
|
if (num) *num = num_ret;
|
2005-03-22 11:34:10 -08:00
|
|
|
}
|
2005-05-16 05:59:26 -07:00
|
|
|
|
2006-01-05 13:41:30 -08:00
|
|
|
free(atoms);
|
2005-06-07 08:34:54 -07:00
|
|
|
return 1;
|
2005-02-07 05:51:05 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
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
|
2005-06-03 12:46:40 -07:00
|
|
|
return ECORE_X_WINDOW_TYPE_UNKNOWN;
|
2005-02-07 05:51:05 -08:00
|
|
|
}
|
|
|
|
|
2006-05-16 19:26:52 -07:00
|
|
|
static Ecore_X_Atom
|
2005-02-07 05:51:05 -08:00
|
|
|
_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
|
|
|
|
*/
|
2006-01-06 12:22:09 -08:00
|
|
|
EAPI void
|
2005-02-07 05:51:05 -08:00
|
|
|
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);
|
2006-01-05 13:41:30 -08:00
|
|
|
ecore_x_window_prop_atom_set(win, ECORE_X_ATOM_NET_WM_WINDOW_TYPE,
|
|
|
|
&atom, 1);
|
2005-02-07 05:51:05 -08:00
|
|
|
}
|
|
|
|
|
2005-06-07 08:34:54 -07:00
|
|
|
/* FIXME: Maybe return 0 on some conditions? */
|
2006-01-06 12:22:09 -08:00
|
|
|
EAPI int
|
2005-06-07 08:34:54 -07:00
|
|
|
ecore_x_netwm_window_type_get(Ecore_X_Window win, Ecore_X_Window_Type *type)
|
2005-02-07 05:51:05 -08:00
|
|
|
{
|
2008-03-12 23:36:50 -07:00
|
|
|
int num;
|
2008-03-07 03:02:22 -08:00
|
|
|
Ecore_X_Atom *atoms = NULL;
|
2005-02-07 05:51:05 -08:00
|
|
|
|
2005-06-07 08:34:54 -07:00
|
|
|
if (type) *type = ECORE_X_WINDOW_TYPE_NORMAL;
|
|
|
|
|
2008-03-07 03:02:22 -08:00
|
|
|
num = ecore_x_window_prop_atom_list_get(win,
|
|
|
|
ECORE_X_ATOM_NET_WM_WINDOW_TYPE,
|
2006-01-05 13:41:30 -08:00
|
|
|
&atoms);
|
2008-03-07 03:02:22 -08:00
|
|
|
if ((type) && (num >= 1) && (atoms))
|
|
|
|
*type = _ecore_x_netwm_window_type_type_get(atoms[0]);
|
|
|
|
|
|
|
|
free(atoms);
|
|
|
|
if (num >= 1) return 1;
|
|
|
|
return 0;
|
|
|
|
}
|
2005-02-07 05:51:05 -08:00
|
|
|
|
2008-03-07 03:02:22 -08:00
|
|
|
EAPI int
|
|
|
|
ecore_x_netwm_window_types_get(Ecore_X_Window win, Ecore_X_Window_Type **types)
|
|
|
|
{
|
2008-07-23 14:01:36 -07:00
|
|
|
int num, i;
|
|
|
|
Ecore_X_Atom *atoms = NULL;
|
|
|
|
Ecore_X_Window_Type *atoms2 = NULL;
|
|
|
|
|
2008-03-07 03:02:22 -08:00
|
|
|
if (types) *types = NULL;
|
|
|
|
num = ecore_x_window_prop_atom_list_get(win,
|
|
|
|
ECORE_X_ATOM_NET_WM_WINDOW_TYPE,
|
|
|
|
&atoms);
|
|
|
|
if ((num <= 0) || (!atoms))
|
2005-03-22 11:34:10 -08:00
|
|
|
{
|
2008-03-07 03:02:22 -08:00
|
|
|
if (atoms) free(atoms);
|
|
|
|
return 0;
|
2005-03-22 11:34:10 -08:00
|
|
|
}
|
2008-07-23 14:01:36 -07:00
|
|
|
atoms2 = malloc(num * sizeof(Ecore_X_Window_Type));
|
2008-07-23 13:58:47 -07:00
|
|
|
if (!atoms2) return 0;
|
2008-07-23 14:01:36 -07:00
|
|
|
for (i = 0; i < num; i++)
|
|
|
|
atoms2[i] = _ecore_x_netwm_window_type_type_get(atoms[i]);
|
2008-07-23 13:58:47 -07:00
|
|
|
free(atoms);
|
|
|
|
if (types) *types = atoms2;
|
|
|
|
else free(atoms2);
|
2008-07-23 14:01:36 -07:00
|
|
|
return num;
|
2005-02-07 05:51:05 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
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;
|
2009-02-07 04:16:13 -08:00
|
|
|
case ECORE_X_ACTION_ABOVE:
|
|
|
|
return ECORE_X_ATOM_NET_WM_ACTION_ABOVE;
|
|
|
|
case ECORE_X_ACTION_BELOW:
|
|
|
|
return ECORE_X_ATOM_NET_WM_ACTION_BELOW;
|
2005-02-07 05:51:05 -08:00
|
|
|
default:
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-06-07 08:34:54 -07:00
|
|
|
/* FIXME: Get complete list */
|
2006-01-06 12:22:09 -08:00
|
|
|
EAPI int
|
2005-02-07 05:51:05 -08:00
|
|
|
ecore_x_netwm_allowed_action_isset(Ecore_X_Window win, Ecore_X_Action action)
|
|
|
|
{
|
|
|
|
int num, i, ret = 0;
|
|
|
|
Ecore_X_Atom *atoms, atom;
|
|
|
|
|
2006-01-05 13:41:30 -08:00
|
|
|
num = ecore_x_window_prop_atom_list_get(win, ECORE_X_ATOM_NET_WM_WINDOW_TYPE,
|
|
|
|
&atoms);
|
|
|
|
if (num <= 0)
|
2005-02-07 05:51:05 -08:00
|
|
|
return ret;
|
|
|
|
|
|
|
|
atom = _ecore_x_netwm_action_atom_get(action);
|
|
|
|
|
|
|
|
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
|
|
|
|
2006-01-05 13:41:30 -08:00
|
|
|
free(atoms);
|
2005-02-07 05:51:05 -08:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2005-06-07 08:34:54 -07:00
|
|
|
/* FIXME: Set complete list */
|
2006-01-06 12:22:09 -08:00
|
|
|
EAPI void
|
2006-06-07 16:30:15 -07:00
|
|
|
ecore_x_netwm_allowed_action_set(Ecore_X_Window win, Ecore_X_Action *action, unsigned int num)
|
2005-02-07 05:51:05 -08:00
|
|
|
{
|
2006-06-07 16:30:15 -07:00
|
|
|
Ecore_X_Atom *set;
|
2006-11-05 07:14:49 -08:00
|
|
|
unsigned int i;
|
2005-02-07 05:51:05 -08:00
|
|
|
|
2006-06-07 16:30:15 -07:00
|
|
|
if (!num)
|
|
|
|
{
|
|
|
|
ecore_x_window_prop_property_del(win, ECORE_X_ATOM_NET_WM_ALLOWED_ACTIONS);
|
|
|
|
return;
|
|
|
|
}
|
2005-02-07 05:51:05 -08:00
|
|
|
|
2006-06-07 16:30:15 -07:00
|
|
|
set = malloc(num * sizeof(Ecore_X_Atom));
|
|
|
|
if (!set) return;
|
|
|
|
|
|
|
|
for (i = 0; i < num; i++)
|
|
|
|
set[i] = _ecore_x_netwm_action_atom_get(action[i]);
|
|
|
|
|
|
|
|
ecore_x_window_prop_atom_set(win, ECORE_X_ATOM_NET_WM_ALLOWED_ACTIONS, set, num);
|
|
|
|
|
|
|
|
free(set);
|
2004-12-29 21:36:01 -08:00
|
|
|
}
|
|
|
|
|
2006-05-16 19:26:52 -07:00
|
|
|
EAPI int
|
|
|
|
ecore_x_netwm_allowed_action_get(Ecore_X_Window win, Ecore_X_Action **action, unsigned int *num)
|
|
|
|
{
|
|
|
|
int num_ret, i;
|
|
|
|
Ecore_X_Atom *atoms;
|
|
|
|
|
|
|
|
if (num) *num = 0;
|
|
|
|
if (action) *action = NULL;
|
|
|
|
|
|
|
|
num_ret = ecore_x_window_prop_atom_list_get(win, ECORE_X_ATOM_NET_WM_ALLOWED_ACTIONS,
|
|
|
|
&atoms);
|
|
|
|
if (num_ret <= 0)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
if (action)
|
|
|
|
{
|
|
|
|
*action = malloc(num_ret * sizeof(Ecore_X_Action));
|
|
|
|
if (*action)
|
|
|
|
for (i = 0; i < num_ret; ++i)
|
|
|
|
(*action)[i] = _ecore_x_netwm_action_atom_get(atoms[i]);
|
|
|
|
|
|
|
|
if (num) *num = num_ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
free(atoms);
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2006-01-06 12:22:09 -08:00
|
|
|
EAPI void
|
2005-02-07 05:51:05 -08:00
|
|
|
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
|
|
|
|
2006-01-06 12:22:09 -08:00
|
|
|
EAPI int
|
2005-02-07 05:51:05 -08:00
|
|
|
ecore_x_netwm_opacity_get(Ecore_X_Window win, unsigned int *opacity)
|
|
|
|
{
|
2005-02-15 03:21:47 -08:00
|
|
|
int ret;
|
2005-05-16 05:59:26 -07:00
|
|
|
unsigned int tmp;
|
|
|
|
|
2005-02-15 03:21:47 -08:00
|
|
|
ret = ecore_x_window_prop_card32_get(win, ECORE_X_ATOM_NET_WM_WINDOW_OPACITY,
|
2005-05-16 05:59:26 -07:00
|
|
|
&tmp, 1);
|
|
|
|
if (opacity) *opacity = tmp;
|
2005-02-15 03:21:47 -08:00
|
|
|
return ret == 1 ? 1 : 0;
|
2005-02-07 05:51:05 -08:00
|
|
|
}
|
|
|
|
|
2006-01-06 12:22:09 -08:00
|
|
|
EAPI void
|
2005-02-07 05:51:05 -08:00
|
|
|
ecore_x_netwm_frame_size_set(Ecore_X_Window win, int fl, int fr, int ft, int fb)
|
|
|
|
{
|
2005-05-16 05:59:26 -07:00
|
|
|
unsigned int frames[4];
|
2005-02-07 05:51:05 -08:00
|
|
|
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
2006-01-06 12:22:09 -08:00
|
|
|
EAPI int
|
2005-02-07 05:51:05 -08:00
|
|
|
ecore_x_netwm_frame_size_get(Ecore_X_Window win, int *fl, int *fr, int *ft, int *fb)
|
|
|
|
{
|
|
|
|
int ret = 0;
|
2005-05-16 05:59:26 -07:00
|
|
|
unsigned int frames[4];
|
2005-02-07 05:51:05 -08:00
|
|
|
|
|
|
|
ret = ecore_x_window_prop_card32_get(win, ECORE_X_ATOM_NET_FRAME_EXTENTS, frames, 4);
|
|
|
|
if (ret != 4)
|
|
|
|
return 0;
|
|
|
|
|
2005-05-16 05:59:26 -07:00
|
|
|
if (fl) *fl = frames[0];
|
|
|
|
if (fr) *fr = frames[1];
|
|
|
|
if (ft) *ft = frames[2];
|
|
|
|
if (fb) *fb = frames[3];
|
2005-02-07 05:51:05 -08:00
|
|
|
return 1;
|
|
|
|
}
|
2004-12-29 21:36:01 -08:00
|
|
|
|
2006-01-06 12:22:09 -08:00
|
|
|
EAPI int
|
2005-06-07 08:34:54 -07:00
|
|
|
ecore_x_netwm_sync_counter_get(Ecore_X_Window win, Ecore_X_Sync_Counter *counter)
|
|
|
|
{
|
|
|
|
int ret;
|
|
|
|
unsigned int tmp;
|
|
|
|
|
|
|
|
ret = ecore_x_window_prop_card32_get(win, ECORE_X_ATOM_NET_WM_SYNC_REQUEST_COUNTER,
|
|
|
|
&tmp, 1);
|
|
|
|
|
|
|
|
if (counter) *counter = tmp;
|
|
|
|
return ret == 1 ? 1 : 0;
|
|
|
|
}
|
|
|
|
|
2006-01-06 12:22:09 -08:00
|
|
|
EAPI void
|
2005-06-09 21:18:24 -07:00
|
|
|
ecore_x_netwm_ping_send(Ecore_X_Window win)
|
2005-06-05 07:38:42 -07:00
|
|
|
{
|
|
|
|
XEvent xev;
|
|
|
|
|
|
|
|
if (!win) return;
|
|
|
|
|
|
|
|
xev.xclient.type = ClientMessage;
|
|
|
|
xev.xclient.display = _ecore_x_disp;
|
|
|
|
xev.xclient.window = win;
|
|
|
|
xev.xclient.message_type = ECORE_X_ATOM_WM_PROTOCOLS;
|
|
|
|
xev.xclient.format = 32;
|
|
|
|
xev.xclient.data.l[0] = ECORE_X_ATOM_NET_WM_PING;
|
2009-10-01 01:23:00 -07:00
|
|
|
xev.xclient.data.l[1] = _ecore_x_event_last_time;
|
2005-06-05 07:38:42 -07:00
|
|
|
xev.xclient.data.l[2] = win;
|
|
|
|
xev.xclient.data.l[3] = 0;
|
|
|
|
xev.xclient.data.l[4] = 0;
|
|
|
|
|
|
|
|
XSendEvent(_ecore_x_disp, win, False, NoEventMask, &xev);
|
|
|
|
}
|
2005-06-06 08:04:28 -07:00
|
|
|
|
2006-01-06 12:22:09 -08:00
|
|
|
EAPI void
|
2005-06-06 08:04:28 -07:00
|
|
|
ecore_x_netwm_sync_request_send(Ecore_X_Window win, unsigned int serial)
|
|
|
|
{
|
|
|
|
XSyncValue value;
|
|
|
|
XEvent xev;
|
|
|
|
|
2005-06-07 00:43:58 -07:00
|
|
|
if (!win) return;
|
|
|
|
|
2006-11-05 07:14:49 -08:00
|
|
|
XSyncIntToValue(&value, (int)serial);
|
2005-06-06 08:04:28 -07:00
|
|
|
|
|
|
|
xev.xclient.type = ClientMessage;
|
|
|
|
xev.xclient.display = _ecore_x_disp;
|
|
|
|
xev.xclient.window = win;
|
|
|
|
xev.xclient.message_type = ECORE_X_ATOM_WM_PROTOCOLS;
|
|
|
|
xev.xclient.format = 32;
|
|
|
|
xev.xclient.data.l[0] = ECORE_X_ATOM_NET_WM_SYNC_REQUEST;
|
2009-10-01 01:23:00 -07:00
|
|
|
xev.xclient.data.l[1] = _ecore_x_event_last_time;
|
2005-06-06 08:04:28 -07:00
|
|
|
xev.xclient.data.l[2] = XSyncValueLow32(value);
|
|
|
|
xev.xclient.data.l[3] = XSyncValueHigh32(value);
|
|
|
|
xev.xclient.data.l[4] = 0;
|
|
|
|
|
2008-06-30 01:39:36 -07:00
|
|
|
XSendEvent(_ecore_x_disp, win, False, NoEventMask, &xev);
|
2005-06-06 08:04:28 -07:00
|
|
|
}
|
2005-06-09 21:18:24 -07:00
|
|
|
|
2006-01-06 12:22:09 -08:00
|
|
|
EAPI void
|
2005-06-09 21:18:24 -07:00
|
|
|
ecore_x_netwm_state_request_send(Ecore_X_Window win, Ecore_X_Window root,
|
|
|
|
Ecore_X_Window_State s1, Ecore_X_Window_State s2, int set)
|
|
|
|
{
|
|
|
|
XEvent xev;
|
|
|
|
|
|
|
|
if (!win) return;
|
|
|
|
if (!root) root = DefaultRootWindow(_ecore_x_disp);
|
|
|
|
|
|
|
|
xev.xclient.type = ClientMessage;
|
|
|
|
xev.xclient.serial = 0;
|
|
|
|
xev.xclient.send_event = True;
|
|
|
|
xev.xclient.display = _ecore_x_disp;
|
|
|
|
xev.xclient.window = win;
|
|
|
|
xev.xclient.format = 32;
|
|
|
|
xev.xclient.message_type = ECORE_X_ATOM_NET_WM_STATE;
|
|
|
|
xev.xclient.data.l[0] = !!set;
|
|
|
|
xev.xclient.data.l[1] = _ecore_x_netwm_state_atom_get(s1);
|
|
|
|
xev.xclient.data.l[2] = _ecore_x_netwm_state_atom_get(s2);
|
|
|
|
/* 1 == normal client, if someone wants to use this
|
|
|
|
* function in a pager, this should be 2 */
|
|
|
|
xev.xclient.data.l[3] = 1;
|
|
|
|
xev.xclient.data.l[4] = 0;
|
|
|
|
|
2006-06-07 03:36:47 -07:00
|
|
|
XSendEvent(_ecore_x_disp, root, False,
|
|
|
|
SubstructureNotifyMask | SubstructureRedirectMask, &xev);
|
2005-06-09 21:18:24 -07:00
|
|
|
}
|
|
|
|
|
2006-01-06 12:22:09 -08:00
|
|
|
EAPI void
|
2005-06-09 21:18:24 -07:00
|
|
|
ecore_x_netwm_desktop_request_send(Ecore_X_Window win, Ecore_X_Window root, unsigned int desktop)
|
|
|
|
{
|
|
|
|
XEvent xev;
|
|
|
|
|
|
|
|
if (!win) return;
|
|
|
|
if (!root) root = DefaultRootWindow(_ecore_x_disp);
|
|
|
|
|
|
|
|
xev.xclient.type = ClientMessage;
|
|
|
|
xev.xclient.serial = 0;
|
|
|
|
xev.xclient.send_event = True;
|
|
|
|
xev.xclient.display = _ecore_x_disp;
|
|
|
|
xev.xclient.window = win;
|
|
|
|
xev.xclient.format = 32;
|
|
|
|
xev.xclient.message_type = ECORE_X_ATOM_NET_WM_DESKTOP;
|
|
|
|
xev.xclient.data.l[0] = desktop;
|
|
|
|
|
|
|
|
XSendEvent(_ecore_x_disp, root, False,
|
|
|
|
SubstructureNotifyMask | SubstructureRedirectMask, &xev);
|
|
|
|
}
|
2005-09-29 23:16:49 -07:00
|
|
|
|
|
|
|
int
|
2009-12-07 13:01:26 -08:00
|
|
|
_ecore_x_netwm_startup_info_begin(Ecore_X_Window win __UNUSED__, char *data __UNUSED__)
|
2005-09-29 23:16:49 -07:00
|
|
|
{
|
2005-10-08 05:39:07 -07:00
|
|
|
#if 0
|
2005-09-29 23:16:49 -07:00
|
|
|
Ecore_X_Startup_Info *info;
|
2008-12-11 05:55:47 -08:00
|
|
|
unsigned char *exists = 0;
|
2005-09-29 23:16:49 -07:00
|
|
|
|
|
|
|
if (!startup_info) return 0;
|
2008-12-11 05:55:47 -08:00
|
|
|
info = eina_hash_find(startup_info, (void *)win);
|
2005-09-29 23:16:49 -07:00
|
|
|
if (info)
|
|
|
|
{
|
2008-12-11 05:55:47 -08:00
|
|
|
exists = 1;
|
2005-09-29 23:16:49 -07:00
|
|
|
printf("Already got info for win: 0x%x\n", win);
|
|
|
|
_ecore_x_netwm_startup_info_free(info);
|
|
|
|
}
|
|
|
|
info = calloc(1, sizeof(Ecore_X_Startup_Info));
|
|
|
|
if (!info) return 0;
|
|
|
|
info->win = win;
|
|
|
|
info->length = 0;
|
|
|
|
info->buffer_size = 161;
|
|
|
|
info->buffer = calloc(info->buffer_size, sizeof(char));
|
|
|
|
if (!info->buffer)
|
|
|
|
{
|
|
|
|
_ecore_x_netwm_startup_info_free(info);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
memcpy(info->buffer, data, 20);
|
|
|
|
info->length += 20;
|
|
|
|
info->buffer[info->length] = 0;
|
2008-12-11 05:55:47 -08:00
|
|
|
if (exists)
|
|
|
|
eina_hash_modify(startup_info, (void *)info->win, info);
|
|
|
|
else
|
|
|
|
eina_hash_add(startup_info, (void *)info->win, info);
|
2005-09-29 23:16:49 -07:00
|
|
|
if (strlen(info->buffer) != 20)
|
|
|
|
{
|
|
|
|
/* We have a '\0' in there, the message is done */
|
|
|
|
_ecore_x_netwm_startup_info_process(info);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
2009-12-07 13:01:26 -08:00
|
|
|
_ecore_x_netwm_startup_info(Ecore_X_Window win __UNUSED__, char *data __UNUSED__)
|
2005-09-29 23:16:49 -07:00
|
|
|
{
|
2005-10-08 05:39:07 -07:00
|
|
|
#if 0
|
2005-09-29 23:16:49 -07:00
|
|
|
Ecore_X_Startup_Info *info;
|
|
|
|
char *p;
|
|
|
|
|
|
|
|
if (!startup_info) return 0;
|
2008-12-11 05:55:47 -08:00
|
|
|
info = eina_hash_find(startup_info, (void *)win);
|
2005-09-29 23:16:49 -07:00
|
|
|
if (!info) return 0;
|
|
|
|
if ((info->length + 20) > info->buffer_size)
|
|
|
|
{
|
|
|
|
info->buffer_size += 160;
|
|
|
|
info->buffer = realloc(info->buffer, info->buffer_size * sizeof(char));
|
|
|
|
if (!info->buffer)
|
|
|
|
{
|
2008-12-11 05:55:47 -08:00
|
|
|
eina_hash_del(startup_info, (void *)info->win);
|
2005-09-29 23:16:49 -07:00
|
|
|
_ecore_x_netwm_startup_info_free(info);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
memcpy(info->buffer + info->length, data, 20);
|
|
|
|
p = info->buffer + info->length;
|
|
|
|
info->length += 20;
|
|
|
|
info->buffer[info->length] = 0;
|
|
|
|
if (strlen(p) != 20)
|
|
|
|
{
|
|
|
|
/* We have a '\0' in there, the message is done */
|
|
|
|
_ecore_x_netwm_startup_info_process(info);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Set UTF-8 string property
|
|
|
|
*/
|
|
|
|
static void
|
|
|
|
_ecore_x_window_prop_string_utf8_set(Ecore_X_Window win, Ecore_X_Atom atom,
|
|
|
|
const char *str)
|
|
|
|
{
|
2006-01-05 13:41:30 -08:00
|
|
|
XChangeProperty(_ecore_x_disp, win, atom, ECORE_X_ATOM_UTF8_STRING, 8,
|
|
|
|
PropModeReplace, (unsigned char *)str, strlen(str));
|
2005-09-29 23:16:49 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Get UTF-8 string property
|
|
|
|
*/
|
|
|
|
static char *
|
|
|
|
_ecore_x_window_prop_string_utf8_get(Ecore_X_Window win, Ecore_X_Atom atom)
|
|
|
|
{
|
|
|
|
char *str;
|
|
|
|
unsigned char *prop_ret;
|
|
|
|
Atom type_ret;
|
|
|
|
unsigned long bytes_after, num_ret;
|
|
|
|
int format_ret;
|
|
|
|
|
|
|
|
str = NULL;
|
|
|
|
prop_ret = NULL;
|
|
|
|
XGetWindowProperty(_ecore_x_disp, win, atom, 0, 0x7fffffff, False,
|
|
|
|
ECORE_X_ATOM_UTF8_STRING, &type_ret,
|
|
|
|
&format_ret, &num_ret, &bytes_after, &prop_ret);
|
|
|
|
if (prop_ret && num_ret > 0 && format_ret == 8)
|
|
|
|
{
|
|
|
|
str = malloc(num_ret + 1);
|
|
|
|
if (str)
|
|
|
|
{
|
|
|
|
memcpy(str, prop_ret, num_ret);
|
|
|
|
str[num_ret] = '\0';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (prop_ret)
|
|
|
|
XFree(prop_ret);
|
|
|
|
|
|
|
|
return str;
|
|
|
|
}
|
|
|
|
|
2006-01-06 13:56:05 -08:00
|
|
|
#if 0 /* Unused */
|
2005-09-29 23:16:49 -07:00
|
|
|
/*
|
|
|
|
* Process startup info
|
|
|
|
*/
|
|
|
|
static int
|
|
|
|
_ecore_x_netwm_startup_info_process(Ecore_X_Startup_Info *info)
|
|
|
|
{
|
|
|
|
Ecore_X_Event_Startup_Sequence *e;
|
|
|
|
int event;
|
|
|
|
char *p;
|
|
|
|
|
|
|
|
p = strchr(info->buffer, ':');
|
|
|
|
if (!p)
|
|
|
|
{
|
2008-12-11 05:55:47 -08:00
|
|
|
eina_hash_del(startup_info, (void *)info->win);
|
2005-09-29 23:16:49 -07:00
|
|
|
_ecore_x_netwm_startup_info_free(info);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
*p = 0;
|
|
|
|
if (!strcmp(info->buffer, "new"))
|
|
|
|
{
|
|
|
|
if (info->init)
|
|
|
|
event = ECORE_X_EVENT_STARTUP_SEQUENCE_CHANGE;
|
|
|
|
else
|
|
|
|
event = ECORE_X_EVENT_STARTUP_SEQUENCE_NEW;
|
|
|
|
info->init = 1;
|
|
|
|
}
|
|
|
|
else if (!strcmp(info->buffer, "change"))
|
|
|
|
{
|
|
|
|
event = ECORE_X_EVENT_STARTUP_SEQUENCE_CHANGE;
|
|
|
|
}
|
|
|
|
else if (!strcmp(info->buffer, "remove"))
|
|
|
|
event = ECORE_X_EVENT_STARTUP_SEQUENCE_REMOVE;
|
|
|
|
else
|
|
|
|
{
|
2008-12-11 05:55:47 -08:00
|
|
|
eina_hash_del(startup_info, (void *)info->win);
|
2005-09-29 23:16:49 -07:00
|
|
|
_ecore_x_netwm_startup_info_free(info);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
p++;
|
|
|
|
|
|
|
|
if (!_ecore_x_netwm_startup_info_parse(info, p))
|
|
|
|
{
|
2008-12-11 05:55:47 -08:00
|
|
|
eina_hash_del(startup_info, (void *)info->win);
|
2005-09-29 23:16:49 -07:00
|
|
|
_ecore_x_netwm_startup_info_free(info);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (info->init)
|
|
|
|
{
|
|
|
|
e = calloc(1, sizeof(Ecore_X_Event_Startup_Sequence));
|
|
|
|
if (!e)
|
|
|
|
{
|
2008-12-11 05:55:47 -08:00
|
|
|
eina_hash_del(startup_info, (void *)info->win);
|
2005-09-29 23:16:49 -07:00
|
|
|
_ecore_x_netwm_startup_info_free(info);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
e->win = info->win;
|
|
|
|
ecore_event_add(event, e, NULL, NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (event == ECORE_X_EVENT_STARTUP_SEQUENCE_REMOVE)
|
|
|
|
{
|
2008-12-11 05:55:47 -08:00
|
|
|
eina_hash_del(startup_info, (void *)info->win);
|
2005-09-29 23:16:49 -07:00
|
|
|
_ecore_x_netwm_startup_info_free(info);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* Discard buffer */
|
|
|
|
info->length = 0;
|
|
|
|
info->buffer[0] = 0;
|
|
|
|
}
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Parse startup info
|
|
|
|
*/
|
|
|
|
static int
|
|
|
|
_ecore_x_netwm_startup_info_parse(Ecore_X_Startup_Info *info, char *data)
|
|
|
|
{
|
|
|
|
|
|
|
|
while (*data)
|
|
|
|
{
|
|
|
|
int in_quot_sing, in_quot_dbl, escaped;
|
|
|
|
char *p, *pp;
|
|
|
|
char *key;
|
|
|
|
char value[1024];
|
|
|
|
|
|
|
|
/* Skip space */
|
|
|
|
while (*data == ' ') data++;
|
|
|
|
/* Get key */
|
|
|
|
key = data;
|
|
|
|
data = strchr(key, '=');
|
|
|
|
if (!data) return 0;
|
|
|
|
*data = 0;
|
|
|
|
data++;
|
|
|
|
|
|
|
|
/* Get value */
|
|
|
|
p = data;
|
|
|
|
pp = value;
|
|
|
|
in_quot_dbl = 0;
|
|
|
|
in_quot_sing = 0;
|
|
|
|
escaped = 0;
|
|
|
|
while (*p)
|
|
|
|
{
|
|
|
|
if ((pp - value) >= 1024) return 0;
|
|
|
|
if (escaped)
|
|
|
|
{
|
|
|
|
*pp = *p;
|
|
|
|
pp++;
|
|
|
|
escaped = 0;
|
|
|
|
}
|
|
|
|
else if (in_quot_sing)
|
|
|
|
{
|
|
|
|
if (*p == '\\')
|
|
|
|
escaped = 1;
|
|
|
|
else if (*p == '\'')
|
|
|
|
in_quot_sing = 0;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
*pp = *p;
|
|
|
|
pp++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (in_quot_dbl)
|
|
|
|
{
|
|
|
|
if (*p == '\\')
|
|
|
|
escaped = 1;
|
|
|
|
else if (*p == '\"')
|
|
|
|
in_quot_dbl = 0;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
*pp = *p;
|
|
|
|
pp++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (*p == '\\')
|
|
|
|
escaped = 1;
|
|
|
|
else if (*p == '\'')
|
|
|
|
in_quot_sing = 1;
|
|
|
|
else if (*p == '\"')
|
|
|
|
in_quot_dbl = 1;
|
|
|
|
else if (*p == ' ')
|
|
|
|
{
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
*pp = *p;
|
|
|
|
pp++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
p++;
|
|
|
|
}
|
2005-10-04 10:41:08 -07:00
|
|
|
if ((in_quot_dbl) || (in_quot_sing)) return 0;
|
2005-09-29 23:16:49 -07:00
|
|
|
data = p;
|
|
|
|
*pp = 0;
|
|
|
|
|
|
|
|
/* Parse info */
|
|
|
|
if (!strcmp(key, "ID"))
|
|
|
|
{
|
|
|
|
if ((info->id) && (strcmp(info->id, value))) return 0;
|
|
|
|
info->id = strdup(value);
|
|
|
|
p = strstr(value, "_TIME");
|
|
|
|
if (p)
|
|
|
|
{
|
|
|
|
info->timestamp = atoi(p + 5);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (!strcmp(key, "NAME"))
|
|
|
|
{
|
|
|
|
if (info->name) free(info->name);
|
|
|
|
info->name = strdup(value);
|
|
|
|
}
|
|
|
|
else if (!strcmp(key, "SCREEN"))
|
|
|
|
{
|
|
|
|
info->screen = atoi(value);
|
|
|
|
}
|
|
|
|
else if (!strcmp(key, "BIN"))
|
|
|
|
{
|
|
|
|
if (info->bin) free(info->bin);
|
|
|
|
info->bin = strdup(value);
|
|
|
|
}
|
|
|
|
else if (!strcmp(key, "ICON"))
|
|
|
|
{
|
|
|
|
if (info->icon) free(info->icon);
|
|
|
|
info->icon = strdup(value);
|
|
|
|
}
|
|
|
|
else if (!strcmp(key, "DESKTOP"))
|
|
|
|
{
|
|
|
|
info->desktop = atoi(value);
|
|
|
|
}
|
|
|
|
else if (!strcmp(key, "TIMESTAMP"))
|
|
|
|
{
|
|
|
|
if (!info->timestamp)
|
|
|
|
info->timestamp = atoi(value);
|
|
|
|
}
|
|
|
|
else if (!strcmp(key, "DESCRIPTION"))
|
|
|
|
{
|
|
|
|
if (info->description) free(info->description);
|
|
|
|
info->description = strdup(value);
|
|
|
|
}
|
|
|
|
else if (!strcmp(key, "WMCLASS"))
|
|
|
|
{
|
|
|
|
if (info->wmclass) free(info->wmclass);
|
|
|
|
info->wmclass = strdup(value);
|
|
|
|
}
|
|
|
|
else if (!strcmp(key, "SILENT"))
|
|
|
|
{
|
|
|
|
info->silent = atoi(value);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
printf("Ecore X Sequence, Unknown: %s=%s\n", key, value);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (!info->id) return 0;
|
|
|
|
return 1;
|
|
|
|
}
|
2006-01-06 13:56:05 -08:00
|
|
|
#endif
|
2005-09-29 23:16:49 -07:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Free startup info struct
|
|
|
|
*/
|
|
|
|
static void
|
|
|
|
_ecore_x_netwm_startup_info_free(void *data)
|
|
|
|
{
|
|
|
|
Ecore_X_Startup_Info *info;
|
|
|
|
|
|
|
|
info = data;
|
|
|
|
if (!info) return;
|
|
|
|
if (info->buffer) free(info->buffer);
|
|
|
|
if (info->id) free(info->id);
|
|
|
|
if (info->name) free(info->name);
|
|
|
|
if (info->bin) free(info->bin);
|
|
|
|
if (info->icon) free(info->icon);
|
|
|
|
if (info->description) free(info->description);
|
|
|
|
if (info->wmclass) free(info->wmclass);
|
|
|
|
free(info);
|
|
|
|
}
|
2006-09-13 10:45:12 -07:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Is screen composited?
|
|
|
|
*/
|
|
|
|
EAPI int
|
|
|
|
ecore_x_screen_is_composited(int screen)
|
|
|
|
{
|
|
|
|
Ecore_X_Window win;
|
2009-09-02 05:48:56 -07:00
|
|
|
static Ecore_X_Atom atom = None;
|
2006-09-13 10:45:12 -07:00
|
|
|
char buf[32];
|
|
|
|
|
|
|
|
snprintf(buf, sizeof(buf), "_NET_WM_CM_S%d", screen);
|
2009-09-02 05:48:56 -07:00
|
|
|
if (atom == None) atom = XInternAtom(_ecore_x_disp, buf, True);
|
2006-09-13 10:45:12 -07:00
|
|
|
if (atom == None) return 0;
|
|
|
|
|
|
|
|
win = XGetSelectionOwner(_ecore_x_disp, atom);
|
|
|
|
|
|
|
|
return win != None;
|
|
|
|
}
|