forked from enlightenment/efl
parent
d07a90f62a
commit
54a05dc2aa
|
@ -1103,9 +1103,9 @@ EAPI Eina_Bool ecore_x_bell(int percent);
|
|||
|
||||
EAPI Ecore_X_Time ecore_x_current_time_get(void);
|
||||
|
||||
EAPI void ecore_x_error_handler_set(void (*func)(void *data), const void *data);
|
||||
EAPI void ecore_x_io_error_handler_set(void (*func)(
|
||||
void *data), const void *data);
|
||||
EAPI void ecore_x_error_handler_set(void (*func)(void *data), const void *data);
|
||||
EAPI void ecore_x_io_error_handler_set(void (*func)(
|
||||
void *data), const void *data);
|
||||
EAPI int ecore_x_error_request_get(void);
|
||||
EAPI int ecore_x_error_code_get(void);
|
||||
|
||||
|
@ -1157,29 +1157,29 @@ EAPI int ecore_x_selection_convert(Ecore_X_Atom selection,
|
|||
int *len,
|
||||
Ecore_X_Atom *targprop,
|
||||
int *targsize);
|
||||
EAPI void ecore_x_selection_converter_add(char *target, int (*func)(
|
||||
char *target,
|
||||
void *data,
|
||||
int size,
|
||||
void **data_ret,
|
||||
int *size_ret,
|
||||
Ecore_X_Atom *,
|
||||
int *));
|
||||
EAPI void ecore_x_selection_converter_atom_add(Ecore_X_Atom target, int (*func)(
|
||||
char *target,
|
||||
void *data,
|
||||
int size,
|
||||
void **data_ret,
|
||||
int *size_ret,
|
||||
Ecore_X_Atom *tprop,
|
||||
int *tsize));
|
||||
EAPI void ecore_x_selection_converter_add(char *target, int (*func)(
|
||||
char *target,
|
||||
void *data,
|
||||
int size,
|
||||
void **data_ret,
|
||||
int *size_ret,
|
||||
Ecore_X_Atom *,
|
||||
int *));
|
||||
EAPI void ecore_x_selection_converter_atom_add(Ecore_X_Atom target, int (*func)(
|
||||
char *target,
|
||||
void *data,
|
||||
int size,
|
||||
void **data_ret,
|
||||
int *size_ret,
|
||||
Ecore_X_Atom *tprop,
|
||||
int *tsize));
|
||||
EAPI void ecore_x_selection_converter_del(char *target);
|
||||
EAPI void ecore_x_selection_converter_atom_del(
|
||||
Ecore_X_Atom target);
|
||||
EAPI void ecore_x_selection_parser_add(const char *target,
|
||||
void *(*func)(const char *target,
|
||||
void *data, int size,
|
||||
int format));
|
||||
EAPI void ecore_x_selection_parser_add(const char *target,
|
||||
void *(*func)(const char *target,
|
||||
void *data, int size,
|
||||
int format));
|
||||
EAPI void ecore_x_selection_parser_del(const char *target);
|
||||
|
||||
EAPI void ecore_x_dnd_aware_set(Ecore_X_Window win, int on);
|
||||
|
@ -2402,10 +2402,10 @@ EAPI int ecore_x_keyboard_grab(Ecore_X_Window win);
|
|||
EAPI void ecore_x_keyboard_ungrab(void);
|
||||
EAPI void ecore_x_grab(void);
|
||||
EAPI void ecore_x_ungrab(void);
|
||||
EAPI void ecore_x_passive_grab_replay_func_set(Eina_Bool (*func)(void *data,
|
||||
int event_type,
|
||||
void *event),
|
||||
void *data);
|
||||
EAPI void ecore_x_passive_grab_replay_func_set(Eina_Bool (*func)(void *data,
|
||||
int event_type,
|
||||
void *event),
|
||||
void *data);
|
||||
EAPI void ecore_x_window_button_grab(Ecore_X_Window win, int button,
|
||||
Ecore_X_Event_Mask event_mask,
|
||||
int mod, int any_mod);
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -6,7 +6,6 @@
|
|||
|
||||
#include "ecore_xcb_private.h"
|
||||
|
||||
|
||||
/**
|
||||
* @defgroup Ecore_X_Atom_Group XCB Atom Functions
|
||||
*
|
||||
|
@ -24,14 +23,14 @@
|
|||
_ecore_xcb_atom_init_finalize. The first one gets the cookies and
|
||||
the second one gets the replies and set the atoms. */
|
||||
|
||||
#define FETCH_ATOM(s) \
|
||||
atom_cookies[i] = xcb_intern_atom(_ecore_xcb_conn, 0, strlen(s), s); \
|
||||
#define FETCH_ATOM(s)\
|
||||
atom_cookies[i] = xcb_intern_atom(_ecore_xcb_conn, 0, strlen(s), s);\
|
||||
i++
|
||||
|
||||
#define FETCH_ATOM_FINALIZE(x) \
|
||||
reply = xcb_intern_atom_reply(_ecore_xcb_conn, atom_cookies[i], NULL); \
|
||||
x = reply->atom; \
|
||||
free(reply); \
|
||||
#define FETCH_ATOM_FINALIZE(x)\
|
||||
reply = xcb_intern_atom_reply(_ecore_xcb_conn, atom_cookies[i], NULL);\
|
||||
x = reply->atom;\
|
||||
free(reply);\
|
||||
i++;
|
||||
|
||||
void
|
||||
|
@ -187,30 +186,30 @@ _ecore_x_atom_init(xcb_intern_atom_cookie_t *atom_cookies)
|
|||
FETCH_ATOM("_ECORE_SELECTION_CLIPBOARD");
|
||||
|
||||
/* These atoms are already internally defined */
|
||||
ECORE_X_ATOM_SELECTION_PRIMARY = 1;
|
||||
ECORE_X_ATOM_SELECTION_PRIMARY = 1;
|
||||
ECORE_X_ATOM_SELECTION_SECONDARY = 2;
|
||||
ECORE_X_ATOM_ATOM = 4;
|
||||
ECORE_X_ATOM_CARDINAL = 6;
|
||||
ECORE_X_ATOM_STRING = 31;
|
||||
ECORE_X_ATOM_WINDOW = 33;
|
||||
ECORE_X_ATOM_WM_NAME = 39;
|
||||
ECORE_X_ATOM_WM_ICON_NAME = 37;
|
||||
ECORE_X_ATOM_WM_NORMAL_HINTS = 40;
|
||||
ECORE_X_ATOM_WM_SIZE_HINTS = 41;
|
||||
ECORE_X_ATOM_WM_HINTS = 35;
|
||||
ECORE_X_ATOM_WM_CLASS = 67;
|
||||
ECORE_X_ATOM_WM_TRANSIENT_FOR = 68;
|
||||
ECORE_X_ATOM_WM_COMMAND = 34;
|
||||
ECORE_X_ATOM_WM_CLIENT_MACHINE = 36;
|
||||
ECORE_X_ATOM_WM_ICON_SIZE = 38;
|
||||
ECORE_X_ATOM_ATOM = 4;
|
||||
ECORE_X_ATOM_CARDINAL = 6;
|
||||
ECORE_X_ATOM_STRING = 31;
|
||||
ECORE_X_ATOM_WINDOW = 33;
|
||||
ECORE_X_ATOM_WM_NAME = 39;
|
||||
ECORE_X_ATOM_WM_ICON_NAME = 37;
|
||||
ECORE_X_ATOM_WM_NORMAL_HINTS = 40;
|
||||
ECORE_X_ATOM_WM_SIZE_HINTS = 41;
|
||||
ECORE_X_ATOM_WM_HINTS = 35;
|
||||
ECORE_X_ATOM_WM_CLASS = 67;
|
||||
ECORE_X_ATOM_WM_TRANSIENT_FOR = 68;
|
||||
ECORE_X_ATOM_WM_COMMAND = 34;
|
||||
ECORE_X_ATOM_WM_CLIENT_MACHINE = 36;
|
||||
ECORE_X_ATOM_WM_ICON_SIZE = 38;
|
||||
|
||||
/* Initialize the globally defined xdnd atoms */
|
||||
ECORE_X_DND_ACTION_COPY = ECORE_X_ATOM_XDND_ACTION_COPY;
|
||||
ECORE_X_DND_ACTION_MOVE = ECORE_X_ATOM_XDND_ACTION_MOVE;
|
||||
ECORE_X_DND_ACTION_LINK = ECORE_X_ATOM_XDND_ACTION_LINK;
|
||||
ECORE_X_DND_ACTION_ASK = ECORE_X_ATOM_XDND_ACTION_ASK;
|
||||
ECORE_X_DND_ACTION_PRIVATE = ECORE_X_ATOM_XDND_ACTION_PRIVATE;
|
||||
}
|
||||
ECORE_X_DND_ACTION_COPY = ECORE_X_ATOM_XDND_ACTION_COPY;
|
||||
ECORE_X_DND_ACTION_MOVE = ECORE_X_ATOM_XDND_ACTION_MOVE;
|
||||
ECORE_X_DND_ACTION_LINK = ECORE_X_ATOM_XDND_ACTION_LINK;
|
||||
ECORE_X_DND_ACTION_ASK = ECORE_X_ATOM_XDND_ACTION_ASK;
|
||||
ECORE_X_DND_ACTION_PRIVATE = ECORE_X_ATOM_XDND_ACTION_PRIVATE;
|
||||
} /* _ecore_x_atom_init */
|
||||
|
||||
void
|
||||
_ecore_x_atom_init_finalize(xcb_intern_atom_cookie_t *atom_cookies)
|
||||
|
@ -364,8 +363,7 @@ _ecore_x_atom_init_finalize(xcb_intern_atom_cookie_t *atom_cookies)
|
|||
FETCH_ATOM_FINALIZE(ECORE_X_ATOM_SELECTION_PROP_PRIMARY);
|
||||
FETCH_ATOM_FINALIZE(ECORE_X_ATOM_SELECTION_PROP_SECONDARY);
|
||||
FETCH_ATOM_FINALIZE(ECORE_X_ATOM_SELECTION_PROP_CLIPBOARD);
|
||||
}
|
||||
|
||||
} /* _ecore_x_atom_init_finalize */
|
||||
|
||||
/**
|
||||
* Sends the InternAtom request.
|
||||
|
@ -379,7 +377,7 @@ ecore_x_atom_get_prefetch(const char *name)
|
|||
|
||||
cookie = xcb_intern_atom_unchecked(_ecore_xcb_conn, 0, strlen(name), name);
|
||||
_ecore_xcb_cookie_cache(cookie.sequence);
|
||||
}
|
||||
} /* ecore_x_atom_get_prefetch */
|
||||
|
||||
/**
|
||||
* Gets the reply of the InternAtom request sent by ecore_x_atom_get_prefetch().
|
||||
|
@ -394,7 +392,7 @@ ecore_x_atom_get_fetch(void)
|
|||
cookie.sequence = _ecore_xcb_cookie_get();
|
||||
reply = xcb_intern_atom_reply(_ecore_xcb_conn, cookie, NULL);
|
||||
_ecore_xcb_reply_cache(reply);
|
||||
}
|
||||
} /* ecore_x_atom_get_fetch */
|
||||
|
||||
/**
|
||||
* Retrieves the atom value associated to a name.
|
||||
|
@ -417,11 +415,11 @@ ecore_x_atom_get(const char *name __UNUSED__)
|
|||
xcb_intern_atom_reply_t *reply;
|
||||
|
||||
reply = _ecore_xcb_reply_get();
|
||||
if (!reply) return XCB_NONE;
|
||||
if (!reply)
|
||||
return XCB_NONE;
|
||||
|
||||
return reply->atom;
|
||||
}
|
||||
|
||||
} /* ecore_x_atom_get */
|
||||
|
||||
/**
|
||||
* Sends the GetAtomName request.
|
||||
|
@ -435,7 +433,7 @@ ecore_x_get_atom_name_prefetch(Ecore_X_Atom atom)
|
|||
|
||||
cookie = xcb_get_atom_name_unchecked(_ecore_xcb_conn, atom);
|
||||
_ecore_xcb_cookie_cache(cookie.sequence);
|
||||
}
|
||||
} /* ecore_x_get_atom_name_prefetch */
|
||||
|
||||
/**
|
||||
* Gets the reply of the GetAtomName request sent by ecore_x_get_atom_name_prefetch().
|
||||
|
@ -450,7 +448,7 @@ ecore_x_get_atom_name_fetch(void)
|
|||
cookie.sequence = _ecore_xcb_cookie_get();
|
||||
reply = xcb_get_atom_name_reply(_ecore_xcb_conn, cookie, NULL);
|
||||
_ecore_xcb_reply_cache(reply);
|
||||
}
|
||||
} /* ecore_x_get_atom_name_fetch */
|
||||
|
||||
/**
|
||||
* Retrieves the name of the given atom.
|
||||
|
@ -466,18 +464,21 @@ EAPI char *
|
|||
ecore_x_atom_name_get(Ecore_X_Atom atom)
|
||||
{
|
||||
xcb_get_atom_name_reply_t *reply;
|
||||
char *name;
|
||||
int length;
|
||||
char *name;
|
||||
int length;
|
||||
|
||||
reply = _ecore_xcb_reply_get();
|
||||
if (!reply) return NULL;
|
||||
if (!reply)
|
||||
return NULL;
|
||||
|
||||
length = xcb_get_atom_name_name_length(reply);
|
||||
name = (char *)malloc(sizeof(char) * (length + 1));
|
||||
if (!name) return NULL;
|
||||
if (!name)
|
||||
return NULL;
|
||||
|
||||
memcpy(name, xcb_get_atom_name_name(reply), length);
|
||||
name[length] = '\0';
|
||||
|
||||
return name;
|
||||
}
|
||||
} /* ecore_x_atom_name_get */
|
||||
|
||||
|
|
|
@ -15,7 +15,6 @@ static uint8_t _composite_available = 0;
|
|||
static xcb_composite_query_version_cookie_t _ecore_xcb_composite_init_cookie;
|
||||
#endif /* ECORE_XCB_COMPOSITE */
|
||||
|
||||
|
||||
/* To avoid round trips, the initialization is separated in 2
|
||||
functions: _ecore_xcb_composite_init and
|
||||
_ecore_xcb_composite_init_finalize. The first one gets the cookies and
|
||||
|
@ -27,8 +26,9 @@ _ecore_x_composite_init(const xcb_query_extension_reply_t *reply)
|
|||
#ifdef ECORE_XCB_COMPOSITE
|
||||
if (reply && reply->present)
|
||||
_ecore_xcb_composite_init_cookie = xcb_composite_query_version_unchecked(_ecore_xcb_conn, XCB_COMPOSITE_MAJOR_VERSION, XCB_COMPOSITE_MINOR_VERSION);
|
||||
|
||||
#endif /* ECORE_XCB_COMPOSITE */
|
||||
}
|
||||
} /* _ecore_x_composite_init */
|
||||
|
||||
void
|
||||
_ecore_x_composite_init_finalize(void)
|
||||
|
@ -37,17 +37,19 @@ _ecore_x_composite_init_finalize(void)
|
|||
xcb_composite_query_version_reply_t *reply;
|
||||
|
||||
reply = xcb_composite_query_version_reply(_ecore_xcb_conn,
|
||||
_ecore_xcb_composite_init_cookie,
|
||||
NULL);
|
||||
_ecore_xcb_composite_init_cookie,
|
||||
NULL);
|
||||
if (reply)
|
||||
{
|
||||
if ((reply->major_version == XCB_COMPOSITE_MAJOR_VERSION) &&
|
||||
(reply->minor_version >= XCB_COMPOSITE_MINOR_VERSION))
|
||||
_composite_available = 1;
|
||||
(reply->minor_version >= XCB_COMPOSITE_MINOR_VERSION))
|
||||
_composite_available = 1;
|
||||
|
||||
free(reply);
|
||||
}
|
||||
|
||||
#endif /* ECORE_XCB_COMPOSITE */
|
||||
}
|
||||
} /* _ecore_x_composite_init_finalize */
|
||||
|
||||
/**
|
||||
* Return whether the Composite Extension is available.
|
||||
|
@ -62,7 +64,8 @@ ecore_x_composite_query(void)
|
|||
{
|
||||
#ifdef ECORE_XCB_COMPOSITE
|
||||
return _composite_available;
|
||||
#else
|
||||
#else /* ifdef ECORE_XCB_COMPOSITE */
|
||||
return 0;
|
||||
#endif /* ECORE_XCB_COMPOSITE */
|
||||
}
|
||||
} /* ecore_x_composite_query */
|
||||
|
||||
|
|
|
@ -6,15 +6,13 @@
|
|||
#include <xcb/shm.h>
|
||||
#include <xcb/xcb_image.h>
|
||||
|
||||
|
||||
extern int _ecore_xcb_xcursor;
|
||||
|
||||
|
||||
EAPI int
|
||||
ecore_x_cursor_color_supported_get(void)
|
||||
{
|
||||
return _ecore_xcb_xcursor;
|
||||
}
|
||||
} /* ecore_x_cursor_color_supported_get */
|
||||
|
||||
EAPI Ecore_X_Cursor
|
||||
ecore_x_cursor_new(Ecore_X_Window window,
|
||||
|
@ -29,195 +27,204 @@ ecore_x_cursor_new(Ecore_X_Window window,
|
|||
#ifdef ECORE_XCB_CURSOR
|
||||
if (_ecore_x_xcursor)
|
||||
{
|
||||
Cursor c;
|
||||
XcursorImage *xci;
|
||||
Cursor c;
|
||||
XcursorImage *xci;
|
||||
|
||||
xci = XcursorImageCreate(w, h);
|
||||
if (xci)
|
||||
{
|
||||
int i;
|
||||
xci = XcursorImageCreate(w, h);
|
||||
if (xci)
|
||||
{
|
||||
int i;
|
||||
|
||||
xci->xhot = hot_x;
|
||||
xci->yhot = hot_y;
|
||||
xci->delay = 0;
|
||||
for (i = 0; i < (w * h); i++)
|
||||
{
|
||||
xci->xhot = hot_x;
|
||||
xci->yhot = hot_y;
|
||||
xci->delay = 0;
|
||||
for (i = 0; i < (w * h); i++)
|
||||
{
|
||||
// int r, g, b, a;
|
||||
//
|
||||
// a = (pixels[i] >> 24) & 0xff;
|
||||
// r = (((pixels[i] >> 16) & 0xff) * a) / 0xff;
|
||||
// g = (((pixels[i] >> 8 ) & 0xff) * a) / 0xff;
|
||||
// b = (((pixels[i] ) & 0xff) * a) / 0xff;
|
||||
xci->pixels[i] = pixels[i];
|
||||
xci->pixels[i] = pixels[i];
|
||||
// (a << 24) | (r << 16) | (g << 8) | (b);
|
||||
}
|
||||
c = XcursorImageLoadCursor(_ecore_x_disp, xci);
|
||||
XcursorImageDestroy(xci);
|
||||
return c;
|
||||
}
|
||||
}
|
||||
c = XcursorImageLoadCursor(_ecore_x_disp, xci);
|
||||
XcursorImageDestroy(xci);
|
||||
return c;
|
||||
}
|
||||
}
|
||||
else
|
||||
#endif /* ECORE_XCB_CURSOR */
|
||||
{
|
||||
const uint32_t dither[2][2] =
|
||||
{
|
||||
{0, 2},
|
||||
{3, 1}
|
||||
};
|
||||
Ecore_X_Drawable draw;
|
||||
Ecore_X_Pixmap pixmap;
|
||||
Ecore_X_Pixmap mask;
|
||||
Ecore_X_GC gc;
|
||||
xcb_image_t *image;
|
||||
uint32_t *pix;
|
||||
uint8_t fr;
|
||||
uint8_t fg;
|
||||
uint8_t fb;
|
||||
uint8_t br;
|
||||
uint8_t bg;
|
||||
uint8_t bb;
|
||||
uint32_t brightest = 0;
|
||||
uint32_t darkest = 255 * 3;
|
||||
uint16_t x;
|
||||
uint16_t y;
|
||||
{
|
||||
const uint32_t dither[2][2] =
|
||||
{
|
||||
{0, 2},
|
||||
{3, 1}
|
||||
};
|
||||
Ecore_X_Drawable draw;
|
||||
Ecore_X_Pixmap pixmap;
|
||||
Ecore_X_Pixmap mask;
|
||||
Ecore_X_GC gc;
|
||||
xcb_image_t *image;
|
||||
uint32_t *pix;
|
||||
uint8_t fr;
|
||||
uint8_t fg;
|
||||
uint8_t fb;
|
||||
uint8_t br;
|
||||
uint8_t bg;
|
||||
uint8_t bb;
|
||||
uint32_t brightest = 0;
|
||||
uint32_t darkest = 255 * 3;
|
||||
uint16_t x;
|
||||
uint16_t y;
|
||||
|
||||
draw = window;
|
||||
pixmap = xcb_generate_id(_ecore_xcb_conn);
|
||||
xcb_create_pixmap(_ecore_xcb_conn,
|
||||
1, pixmap, draw,
|
||||
1, 1);
|
||||
mask = xcb_generate_id(_ecore_xcb_conn);
|
||||
xcb_create_pixmap(_ecore_xcb_conn,
|
||||
1, mask, draw,
|
||||
1, 1);
|
||||
draw = window;
|
||||
pixmap = xcb_generate_id(_ecore_xcb_conn);
|
||||
xcb_create_pixmap(_ecore_xcb_conn,
|
||||
1, pixmap, draw,
|
||||
1, 1);
|
||||
mask = xcb_generate_id(_ecore_xcb_conn);
|
||||
xcb_create_pixmap(_ecore_xcb_conn,
|
||||
1, mask, draw,
|
||||
1, 1);
|
||||
|
||||
image = xcb_image_create_native(_ecore_xcb_conn, w, h,
|
||||
XCB_IMAGE_FORMAT_Z_PIXMAP,
|
||||
32, NULL, ~0, NULL);
|
||||
image->data = malloc(image->size);
|
||||
image = xcb_image_create_native(_ecore_xcb_conn, w, h,
|
||||
XCB_IMAGE_FORMAT_Z_PIXMAP,
|
||||
32, NULL, ~0, NULL);
|
||||
image->data = malloc(image->size);
|
||||
|
||||
fr = 0x00; fg = 0x00; fb = 0x00;
|
||||
br = 0xff; bg = 0xff; bb = 0xff;
|
||||
pix = (uint32_t *)pixels;
|
||||
for (y = 0; y < h; y++)
|
||||
{
|
||||
for (x = 0; x < w; x++)
|
||||
{
|
||||
uint8_t r, g, b, a;
|
||||
fr = 0x00; fg = 0x00; fb = 0x00;
|
||||
br = 0xff; bg = 0xff; bb = 0xff;
|
||||
pix = (uint32_t *)pixels;
|
||||
for (y = 0; y < h; y++)
|
||||
{
|
||||
for (x = 0; x < w; x++)
|
||||
{
|
||||
uint8_t r, g, b, a;
|
||||
|
||||
a = (pix[0] >> 24) & 0xff;
|
||||
r = (pix[0] >> 16) & 0xff;
|
||||
g = (pix[0] >> 8 ) & 0xff;
|
||||
b = (pix[0] ) & 0xff;
|
||||
if (a > 0)
|
||||
{
|
||||
if ((uint32_t)(r + g + b) > brightest)
|
||||
{
|
||||
brightest = r + g + b;
|
||||
br = r;
|
||||
bg = g;
|
||||
bb = b;
|
||||
}
|
||||
if ((uint32_t)(r + g + b) < darkest)
|
||||
{
|
||||
darkest = r + g + b;
|
||||
fr = r;
|
||||
fg = g;
|
||||
fb = b;
|
||||
}
|
||||
}
|
||||
pix++;
|
||||
}
|
||||
}
|
||||
a = (pix[0] >> 24) & 0xff;
|
||||
r = (pix[0] >> 16) & 0xff;
|
||||
g = (pix[0] >> 8) & 0xff;
|
||||
b = (pix[0]) & 0xff;
|
||||
if (a > 0)
|
||||
{
|
||||
if ((uint32_t)(r + g + b) > brightest)
|
||||
{
|
||||
brightest = r + g + b;
|
||||
br = r;
|
||||
bg = g;
|
||||
bb = b;
|
||||
}
|
||||
|
||||
pix = (uint32_t *)pixels;
|
||||
for (y = 0; y < h; y++)
|
||||
{
|
||||
for (x = 0; x < w; x++)
|
||||
{
|
||||
uint32_t v;
|
||||
uint8_t r, g, b;
|
||||
int32_t d1, d2;
|
||||
if ((uint32_t)(r + g + b) < darkest)
|
||||
{
|
||||
darkest = r + g + b;
|
||||
fr = r;
|
||||
fg = g;
|
||||
fb = b;
|
||||
}
|
||||
}
|
||||
|
||||
r = (pix[0] >> 16) & 0xff;
|
||||
g = (pix[0] >> 8 ) & 0xff;
|
||||
b = (pix[0] ) & 0xff;
|
||||
d1 =
|
||||
((r - fr) * (r - fr)) +
|
||||
((g - fg) * (g - fg)) +
|
||||
((b - fb) * (b - fb));
|
||||
d2 =
|
||||
((r - br) * (r - br)) +
|
||||
((g - bg) * (g - bg)) +
|
||||
((b - bb) * (b - bb));
|
||||
if (d1 + d2)
|
||||
{
|
||||
v = (((d2 * 255) / (d1 + d2)) * 5) / 256;
|
||||
if (v > dither[x & 0x1][y & 0x1]) v = 1;
|
||||
else v = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
v = 0;
|
||||
}
|
||||
xcb_image_put_pixel(image, x, y, v);
|
||||
pix++;
|
||||
}
|
||||
}
|
||||
draw = pixmap;
|
||||
gc = xcb_generate_id(_ecore_xcb_conn);
|
||||
xcb_create_gc(_ecore_xcb_conn, gc, draw, 0, NULL);
|
||||
xcb_image_put(_ecore_xcb_conn, draw, gc, image, 0, 0, 0);
|
||||
xcb_free_gc(_ecore_xcb_conn, gc);
|
||||
pix++;
|
||||
}
|
||||
}
|
||||
|
||||
pix = (uint32_t *)pixels;
|
||||
for (y = 0; y < h; y++)
|
||||
{
|
||||
for (x = 0; x < w; x++)
|
||||
{
|
||||
uint32_t v;
|
||||
pix = (uint32_t *)pixels;
|
||||
for (y = 0; y < h; y++)
|
||||
{
|
||||
for (x = 0; x < w; x++)
|
||||
{
|
||||
uint32_t v;
|
||||
uint8_t r, g, b;
|
||||
int32_t d1, d2;
|
||||
|
||||
v = (((pix[0] >> 24) & 0xff) * 5) / 256;
|
||||
if (v > dither[x & 0x1][y & 0x1]) v = 1;
|
||||
else v = 0;
|
||||
xcb_image_put_pixel(image, x, y, v);
|
||||
pix++;
|
||||
}
|
||||
}
|
||||
draw = mask;
|
||||
gc = xcb_generate_id(_ecore_xcb_conn);
|
||||
xcb_create_gc (_ecore_xcb_conn, gc, draw, 0, NULL);
|
||||
xcb_image_put(_ecore_xcb_conn, draw, gc, image, 0, 0, 0);
|
||||
xcb_free_gc(_ecore_xcb_conn, gc);
|
||||
r = (pix[0] >> 16) & 0xff;
|
||||
g = (pix[0] >> 8) & 0xff;
|
||||
b = (pix[0]) & 0xff;
|
||||
d1 =
|
||||
((r - fr) * (r - fr)) +
|
||||
((g - fg) * (g - fg)) +
|
||||
((b - fb) * (b - fb));
|
||||
d2 =
|
||||
((r - br) * (r - br)) +
|
||||
((g - bg) * (g - bg)) +
|
||||
((b - bb) * (b - bb));
|
||||
if (d1 + d2)
|
||||
{
|
||||
v = (((d2 * 255) / (d1 + d2)) * 5) / 256;
|
||||
if (v > dither[x & 0x1][y & 0x1])
|
||||
v = 1;
|
||||
else
|
||||
v = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
v = 0;
|
||||
}
|
||||
|
||||
free(image->data);
|
||||
image->data = NULL;
|
||||
xcb_image_destroy(image);
|
||||
xcb_image_put_pixel(image, x, y, v);
|
||||
pix++;
|
||||
}
|
||||
}
|
||||
draw = pixmap;
|
||||
gc = xcb_generate_id(_ecore_xcb_conn);
|
||||
xcb_create_gc(_ecore_xcb_conn, gc, draw, 0, NULL);
|
||||
xcb_image_put(_ecore_xcb_conn, draw, gc, image, 0, 0, 0);
|
||||
xcb_free_gc(_ecore_xcb_conn, gc);
|
||||
|
||||
cursor = xcb_generate_id(_ecore_xcb_conn);
|
||||
xcb_create_cursor (_ecore_xcb_conn, cursor,
|
||||
pixmap, mask,
|
||||
fr << 8 | fr,
|
||||
fg << 8 | fg,
|
||||
fb << 8 | fb,
|
||||
br << 8 | br,
|
||||
bg << 8 | bg,
|
||||
bb << 8 | bb,
|
||||
hot_x,
|
||||
hot_y);
|
||||
xcb_free_pixmap(_ecore_xcb_conn, pixmap);
|
||||
xcb_free_pixmap(_ecore_xcb_conn, mask);
|
||||
pix = (uint32_t *)pixels;
|
||||
for (y = 0; y < h; y++)
|
||||
{
|
||||
for (x = 0; x < w; x++)
|
||||
{
|
||||
uint32_t v;
|
||||
|
||||
v = (((pix[0] >> 24) & 0xff) * 5) / 256;
|
||||
if (v > dither[x & 0x1][y & 0x1])
|
||||
v = 1;
|
||||
else
|
||||
v = 0;
|
||||
|
||||
xcb_image_put_pixel(image, x, y, v);
|
||||
pix++;
|
||||
}
|
||||
}
|
||||
draw = mask;
|
||||
gc = xcb_generate_id(_ecore_xcb_conn);
|
||||
xcb_create_gc (_ecore_xcb_conn, gc, draw, 0, NULL);
|
||||
xcb_image_put(_ecore_xcb_conn, draw, gc, image, 0, 0, 0);
|
||||
xcb_free_gc(_ecore_xcb_conn, gc);
|
||||
|
||||
free(image->data);
|
||||
image->data = NULL;
|
||||
xcb_image_destroy(image);
|
||||
|
||||
cursor = xcb_generate_id(_ecore_xcb_conn);
|
||||
xcb_create_cursor (_ecore_xcb_conn, cursor,
|
||||
pixmap, mask,
|
||||
fr << 8 | fr,
|
||||
fg << 8 | fg,
|
||||
fb << 8 | fb,
|
||||
br << 8 | br,
|
||||
bg << 8 | bg,
|
||||
bb << 8 | bb,
|
||||
hot_x,
|
||||
hot_y);
|
||||
xcb_free_pixmap(_ecore_xcb_conn, pixmap);
|
||||
xcb_free_pixmap(_ecore_xcb_conn, mask);
|
||||
|
||||
return cursor;
|
||||
}
|
||||
|
||||
return cursor;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
} /* ecore_x_cursor_new */
|
||||
|
||||
EAPI void
|
||||
ecore_x_cursor_free(Ecore_X_Cursor cursor)
|
||||
{
|
||||
xcb_free_cursor(_ecore_xcb_conn, cursor);
|
||||
}
|
||||
} /* ecore_x_cursor_free */
|
||||
|
||||
/*
|
||||
* Returns the cursor for the given shape.
|
||||
|
@ -228,7 +235,7 @@ EAPI Ecore_X_Cursor
|
|||
ecore_x_cursor_shape_get(int shape)
|
||||
{
|
||||
Ecore_X_Cursor cursor;
|
||||
xcb_font_t font;
|
||||
xcb_font_t font;
|
||||
|
||||
/* Shapes are defined in Ecore_X_Cursor.h */
|
||||
font = xcb_generate_id(_ecore_xcb_conn);
|
||||
|
@ -247,24 +254,25 @@ ecore_x_cursor_shape_get(int shape)
|
|||
xcb_close_font(_ecore_xcb_conn, font);
|
||||
|
||||
return cursor;
|
||||
}
|
||||
} /* ecore_x_cursor_shape_get */
|
||||
|
||||
EAPI void
|
||||
ecore_x_cursor_size_set(int size)
|
||||
{
|
||||
#ifdef ECORE_XCB_CURSOR
|
||||
XcursorSetDefaultSize(_ecore_x_disp, size);
|
||||
#else
|
||||
#else /* ifdef ECORE_XCB_CURSOR */
|
||||
size = 0;
|
||||
#endif /* ECORE_XCB_CURSOR */
|
||||
}
|
||||
} /* ecore_x_cursor_size_set */
|
||||
|
||||
EAPI int
|
||||
ecore_x_cursor_size_get(void)
|
||||
{
|
||||
#ifdef ECORE_XCB_CURSOR
|
||||
return XcursorGetDefaultSize(_ecore_x_disp);
|
||||
#else
|
||||
#else /* ifdef ECORE_XCB_CURSOR */
|
||||
return 0;
|
||||
#endif /* ECORE_XCB_CURSOR */
|
||||
}
|
||||
} /* ecore_x_cursor_size_get */
|
||||
|
||||
|
|
|
@ -4,20 +4,17 @@
|
|||
|
||||
#include "ecore_xcb_private.h"
|
||||
|
||||
|
||||
/**
|
||||
* @defgroup Ecore_X_Damage_Group X Damage Extension Functions
|
||||
*
|
||||
* Functions related to the X Damage extension.
|
||||
*/
|
||||
|
||||
|
||||
#ifdef ECORE_XCB_DAMAGE
|
||||
static uint8_t _damage_available = 0;
|
||||
static xcb_damage_query_version_cookie_t _ecore_xcb_damage_init_cookie;
|
||||
#endif /* ECORE_XCB_DAMAGE */
|
||||
|
||||
|
||||
/* To avoid round trips, the initialization is separated in 2
|
||||
functions: _ecore_xcb_damage_init and
|
||||
_ecore_xcb_damage_init_finalize. The first one gets the cookies and
|
||||
|
@ -29,8 +26,9 @@ _ecore_x_damage_init(const xcb_query_extension_reply_t *reply)
|
|||
#ifdef ECORE_XCB_DAMAGE
|
||||
if (reply && (reply->present))
|
||||
_ecore_xcb_damage_init_cookie = xcb_damage_query_version_unchecked(_ecore_xcb_conn, 1, 1);
|
||||
|
||||
#endif /* ECORE_XCB_DAMAGE */
|
||||
}
|
||||
} /* _ecore_x_damage_init */
|
||||
|
||||
void
|
||||
_ecore_x_damage_init_finalize(void)
|
||||
|
@ -44,12 +42,13 @@ _ecore_x_damage_init_finalize(void)
|
|||
if (reply)
|
||||
{
|
||||
if (reply->major_version >= 1)
|
||||
_damage_available = 1;
|
||||
_damage_available = 1;
|
||||
|
||||
free(reply);
|
||||
}
|
||||
#endif /* ECORE_XCB_DAMAGE */
|
||||
}
|
||||
|
||||
#endif /* ECORE_XCB_DAMAGE */
|
||||
} /* _ecore_x_damage_init_finalize */
|
||||
|
||||
/**
|
||||
* Return whether the Damage Extension is available.
|
||||
|
@ -64,11 +63,10 @@ ecore_x_damage_query(void)
|
|||
{
|
||||
#ifdef ECORE_XCB_DAMAGE
|
||||
return _damage_available;
|
||||
#else
|
||||
#else /* ifdef ECORE_XCB_DAMAGE */
|
||||
return 0;
|
||||
#endif /* ECORE_XCB_DAMAGE */
|
||||
}
|
||||
|
||||
} /* ecore_x_damage_query */
|
||||
|
||||
/**
|
||||
* Creates a damage object.
|
||||
|
@ -92,8 +90,7 @@ ecore_x_damage_new(Ecore_X_Drawable drawable,
|
|||
#endif /* ECORE_XCB_DAMAGE */
|
||||
|
||||
return damage;
|
||||
}
|
||||
|
||||
} /* ecore_x_damage_new */
|
||||
|
||||
/**
|
||||
* Destroys a damage object.
|
||||
|
@ -108,8 +105,7 @@ ecore_x_damage_free(Ecore_X_Damage damage)
|
|||
#ifdef ECORE_XCB_DAMAGE
|
||||
xcb_damage_destroy(_ecore_xcb_conn, damage);
|
||||
#endif /* ECORE_XCB_DAMAGE */
|
||||
}
|
||||
|
||||
} /* ecore_x_damage_free */
|
||||
|
||||
/**
|
||||
* Synchronously modifies the region.
|
||||
|
@ -135,4 +131,5 @@ ecore_x_damage_subtract(Ecore_X_Damage damage,
|
|||
#ifdef ECORE_XCB_DAMAGE
|
||||
xcb_damage_subtract(_ecore_xcb_conn, damage, repair, parts);
|
||||
#endif /* ECORE_XCB_DAMAGE */
|
||||
}
|
||||
} /* ecore_x_damage_subtract */
|
||||
|
||||
|
|
|
@ -8,65 +8,64 @@
|
|||
#include "ecore_xcb_private.h"
|
||||
#include "Ecore_X_Atoms.h"
|
||||
|
||||
|
||||
EAPI int ECORE_X_EVENT_XDND_ENTER = 0;
|
||||
EAPI int ECORE_X_EVENT_XDND_ENTER = 0;
|
||||
EAPI int ECORE_X_EVENT_XDND_POSITION = 0;
|
||||
EAPI int ECORE_X_EVENT_XDND_STATUS = 0;
|
||||
EAPI int ECORE_X_EVENT_XDND_LEAVE = 0;
|
||||
EAPI int ECORE_X_EVENT_XDND_DROP = 0;
|
||||
EAPI int ECORE_X_EVENT_XDND_STATUS = 0;
|
||||
EAPI int ECORE_X_EVENT_XDND_LEAVE = 0;
|
||||
EAPI int ECORE_X_EVENT_XDND_DROP = 0;
|
||||
EAPI int ECORE_X_EVENT_XDND_FINISHED = 0;
|
||||
|
||||
static Ecore_X_DND_Source *_source = NULL;
|
||||
static Ecore_X_DND_Target *_target = NULL;
|
||||
static int _ecore_x_dnd_init_count = 0;
|
||||
|
||||
|
||||
void
|
||||
_ecore_x_dnd_init(void)
|
||||
{
|
||||
if (!_ecore_x_dnd_init_count)
|
||||
{
|
||||
_source = calloc(1, sizeof(Ecore_X_DND_Source));
|
||||
_source->version = ECORE_X_DND_VERSION;
|
||||
_source->win = XCB_NONE;
|
||||
_source->dest = XCB_NONE;
|
||||
_source->state = ECORE_X_DND_SOURCE_IDLE;
|
||||
_source->prev.window = 0;
|
||||
|
||||
_source = calloc(1, sizeof(Ecore_X_DND_Source));
|
||||
_source->version = ECORE_X_DND_VERSION;
|
||||
_source->win = XCB_NONE;
|
||||
_source->dest = XCB_NONE;
|
||||
_source->state = ECORE_X_DND_SOURCE_IDLE;
|
||||
_source->prev.window = 0;
|
||||
_target = calloc(1, sizeof(Ecore_X_DND_Target));
|
||||
_target->win = XCB_NONE;
|
||||
_target->source = XCB_NONE;
|
||||
_target->state = ECORE_X_DND_TARGET_IDLE;
|
||||
|
||||
_target = calloc(1, sizeof(Ecore_X_DND_Target));
|
||||
_target->win = XCB_NONE;
|
||||
_target->source = XCB_NONE;
|
||||
_target->state = ECORE_X_DND_TARGET_IDLE;
|
||||
|
||||
ECORE_X_EVENT_XDND_ENTER = ecore_event_type_new();
|
||||
ECORE_X_EVENT_XDND_POSITION = ecore_event_type_new();
|
||||
ECORE_X_EVENT_XDND_STATUS = ecore_event_type_new();
|
||||
ECORE_X_EVENT_XDND_LEAVE = ecore_event_type_new();
|
||||
ECORE_X_EVENT_XDND_DROP = ecore_event_type_new();
|
||||
ECORE_X_EVENT_XDND_FINISHED = ecore_event_type_new();
|
||||
ECORE_X_EVENT_XDND_ENTER = ecore_event_type_new();
|
||||
ECORE_X_EVENT_XDND_POSITION = ecore_event_type_new();
|
||||
ECORE_X_EVENT_XDND_STATUS = ecore_event_type_new();
|
||||
ECORE_X_EVENT_XDND_LEAVE = ecore_event_type_new();
|
||||
ECORE_X_EVENT_XDND_DROP = ecore_event_type_new();
|
||||
ECORE_X_EVENT_XDND_FINISHED = ecore_event_type_new();
|
||||
}
|
||||
|
||||
_ecore_x_dnd_init_count++;
|
||||
}
|
||||
} /* _ecore_x_dnd_init */
|
||||
|
||||
void
|
||||
_ecore_x_dnd_shutdown(void)
|
||||
{
|
||||
_ecore_x_dnd_init_count--;
|
||||
if (_ecore_x_dnd_init_count > 0)
|
||||
return;
|
||||
return;
|
||||
|
||||
if (_source)
|
||||
free(_source);
|
||||
free(_source);
|
||||
|
||||
_source = NULL;
|
||||
|
||||
if (_target)
|
||||
free(_target);
|
||||
free(_target);
|
||||
|
||||
_target = NULL;
|
||||
|
||||
_ecore_x_dnd_init_count = 0;
|
||||
}
|
||||
} /* _ecore_x_dnd_shutdown */
|
||||
|
||||
EAPI void
|
||||
ecore_x_dnd_aware_set(Ecore_X_Window window,
|
||||
|
@ -75,11 +74,11 @@ ecore_x_dnd_aware_set(Ecore_X_Window window,
|
|||
Ecore_X_Atom prop_data = ECORE_X_DND_VERSION;
|
||||
|
||||
if (on)
|
||||
ecore_x_window_prop_property_set(window, ECORE_X_ATOM_XDND_AWARE,
|
||||
ECORE_X_ATOM_ATOM, 32, &prop_data, 1);
|
||||
ecore_x_window_prop_property_set(window, ECORE_X_ATOM_XDND_AWARE,
|
||||
ECORE_X_ATOM_ATOM, 32, &prop_data, 1);
|
||||
else
|
||||
ecore_x_window_prop_property_del(window, ECORE_X_ATOM_XDND_AWARE);
|
||||
}
|
||||
ecore_x_window_prop_property_del(window, ECORE_X_ATOM_XDND_AWARE);
|
||||
} /* ecore_x_dnd_aware_set */
|
||||
|
||||
/**
|
||||
* Sends the GetProperty request.
|
||||
|
@ -96,8 +95,7 @@ ecore_x_dnd_version_get_prefetch(Ecore_X_Window window)
|
|||
ECORE_X_ATOM_ATOM,
|
||||
0, LONG_MAX);
|
||||
_ecore_xcb_cookie_cache(cookie.sequence);
|
||||
}
|
||||
|
||||
} /* ecore_x_dnd_version_get_prefetch */
|
||||
|
||||
/**
|
||||
* Gets the reply of the GetProperty request sent by ecore_x_dnd_version_get_prefetch().
|
||||
|
@ -111,7 +109,7 @@ ecore_x_dnd_version_get_fetch(void)
|
|||
cookie.sequence = _ecore_xcb_cookie_get();
|
||||
reply = xcb_get_property_reply(_ecore_xcb_conn, cookie, NULL);
|
||||
_ecore_xcb_reply_cache(reply);
|
||||
}
|
||||
} /* ecore_x_dnd_version_get_fetch */
|
||||
|
||||
/**
|
||||
* Get the DnD version.
|
||||
|
@ -127,19 +125,19 @@ ecore_x_dnd_version_get_fetch(void)
|
|||
EAPI int
|
||||
ecore_x_dnd_version_get(Ecore_X_Window window)
|
||||
{
|
||||
unsigned char *prop_data;
|
||||
int num;
|
||||
unsigned char *prop_data;
|
||||
int num;
|
||||
|
||||
if (ecore_x_window_prop_property_get(window, ECORE_X_ATOM_XDND_AWARE,
|
||||
ECORE_X_ATOM_ATOM, 32, &prop_data, &num))
|
||||
{
|
||||
int version = (int) *prop_data;
|
||||
free(prop_data);
|
||||
return version;
|
||||
int version = (int)*prop_data;
|
||||
free(prop_data);
|
||||
return version;
|
||||
}
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
return 0;
|
||||
} /* ecore_x_dnd_version_get */
|
||||
|
||||
/**
|
||||
* Sends the GetProperty request.
|
||||
|
@ -156,8 +154,7 @@ ecore_x_dnd_type_get_prefetch(Ecore_X_Window window)
|
|||
ECORE_X_ATOM_ATOM,
|
||||
0, LONG_MAX);
|
||||
_ecore_xcb_cookie_cache(cookie.sequence);
|
||||
}
|
||||
|
||||
} /* ecore_x_dnd_type_get_prefetch */
|
||||
|
||||
/**
|
||||
* Gets the reply of the GetProperty request sent by ecore_x_dnd_type_get_prefetch().
|
||||
|
@ -171,7 +168,7 @@ ecore_x_dnd_type_get_fetch(void)
|
|||
cookie.sequence = _ecore_xcb_cookie_get();
|
||||
reply = xcb_get_property_reply(_ecore_xcb_conn, cookie, NULL);
|
||||
_ecore_xcb_reply_cache(reply);
|
||||
}
|
||||
} /* ecore_x_dnd_type_get_fetch */
|
||||
|
||||
/* FIXME: round trip (InternAtomGet request) */
|
||||
|
||||
|
@ -193,20 +190,22 @@ ecore_x_dnd_type_isset(Ecore_X_Window window,
|
|||
{
|
||||
xcb_intern_atom_cookie_t cookie;
|
||||
xcb_intern_atom_reply_t *reply;
|
||||
Ecore_X_Atom *atoms;
|
||||
unsigned char *data;
|
||||
int num;
|
||||
int i;
|
||||
uint8_t ret = 0;
|
||||
Ecore_X_Atom *atoms;
|
||||
unsigned char *data;
|
||||
int num;
|
||||
int i;
|
||||
uint8_t ret = 0;
|
||||
|
||||
cookie = xcb_intern_atom_unchecked(_ecore_xcb_conn, 0,
|
||||
strlen(type), type);
|
||||
|
||||
if (!ecore_x_window_prop_property_get(window, ECORE_X_ATOM_XDND_TYPE_LIST,
|
||||
ECORE_X_ATOM_ATOM, 32, &data, &num))
|
||||
ECORE_X_ATOM_ATOM, 32, &data, &num))
|
||||
{
|
||||
reply = xcb_intern_atom_reply(_ecore_xcb_conn, cookie, NULL);
|
||||
if (reply) free(reply);
|
||||
if (reply)
|
||||
free(reply);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -216,22 +215,23 @@ ecore_x_dnd_type_isset(Ecore_X_Window window,
|
|||
free(data);
|
||||
return 0;
|
||||
}
|
||||
|
||||
atoms = (Ecore_X_Atom *)data;
|
||||
|
||||
for (i = 0; i < num; ++i)
|
||||
{
|
||||
if (reply->atom == atoms[i])
|
||||
{
|
||||
ret = 1;
|
||||
break;
|
||||
}
|
||||
if (reply->atom == atoms[i])
|
||||
{
|
||||
ret = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
free(data);
|
||||
free(reply);
|
||||
|
||||
return ret;
|
||||
}
|
||||
} /* ecore_x_dnd_type_isset */
|
||||
|
||||
/* FIXME: round trip (InternAtomGet request) */
|
||||
|
||||
|
@ -254,12 +254,12 @@ ecore_x_dnd_type_set(Ecore_X_Window window,
|
|||
{
|
||||
xcb_intern_atom_cookie_t cookie;
|
||||
xcb_intern_atom_reply_t *reply;
|
||||
Ecore_X_Atom *oldset = NULL;
|
||||
Ecore_X_Atom *newset = NULL;
|
||||
unsigned char *data = NULL;
|
||||
unsigned char *old_data = NULL;
|
||||
Ecore_X_Atom atom;
|
||||
int i, j = 0, num = 0;
|
||||
Ecore_X_Atom *oldset = NULL;
|
||||
Ecore_X_Atom *newset = NULL;
|
||||
unsigned char *data = NULL;
|
||||
unsigned char *old_data = NULL;
|
||||
Ecore_X_Atom atom;
|
||||
int i, j = 0, num = 0;
|
||||
|
||||
cookie = xcb_intern_atom_unchecked(_ecore_xcb_conn, 0,
|
||||
strlen(type), type);
|
||||
|
@ -270,67 +270,79 @@ ecore_x_dnd_type_set(Ecore_X_Window window,
|
|||
32, &old_data, &num))
|
||||
{
|
||||
reply = xcb_intern_atom_reply(_ecore_xcb_conn, cookie, NULL);
|
||||
if (reply) free(reply);
|
||||
if (reply)
|
||||
free(reply);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
oldset = (Ecore_X_Atom *)old_data;
|
||||
|
||||
if (on)
|
||||
{
|
||||
if (ecore_x_dnd_type_isset(window, type))
|
||||
{
|
||||
free(old_data);
|
||||
reply = xcb_intern_atom_reply(_ecore_xcb_conn, cookie, NULL);
|
||||
if (reply) free(reply);
|
||||
return;
|
||||
}
|
||||
data = calloc(num + 1, sizeof(Ecore_X_Atom));
|
||||
if (!data)
|
||||
if (ecore_x_dnd_type_isset(window, type))
|
||||
{
|
||||
free(old_data);
|
||||
free(old_data);
|
||||
reply = xcb_intern_atom_reply(_ecore_xcb_conn, cookie, NULL);
|
||||
if (reply) free(reply);
|
||||
if (reply)
|
||||
free(reply);
|
||||
|
||||
return;
|
||||
}
|
||||
newset = (Ecore_X_Atom *)data;
|
||||
|
||||
for (i = 0; i < num; i++)
|
||||
newset[i + 1] = oldset[i];
|
||||
/* prepend the new type */
|
||||
data = calloc(num + 1, sizeof(Ecore_X_Atom));
|
||||
if (!data)
|
||||
{
|
||||
free(old_data);
|
||||
reply = xcb_intern_atom_reply(_ecore_xcb_conn, cookie, NULL);
|
||||
if (reply)
|
||||
free(reply);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
newset = (Ecore_X_Atom *)data;
|
||||
|
||||
for (i = 0; i < num; i++)
|
||||
newset[i + 1] = oldset[i];
|
||||
/* prepend the new type */
|
||||
|
||||
reply = xcb_intern_atom_reply(_ecore_xcb_conn, cookie, NULL);
|
||||
if (!reply)
|
||||
{
|
||||
free(old_data);
|
||||
return;
|
||||
free(old_data);
|
||||
return;
|
||||
}
|
||||
newset[0] = reply->atom;
|
||||
|
||||
newset[0] = reply->atom;
|
||||
free(reply);
|
||||
|
||||
ecore_x_window_prop_property_set(window,
|
||||
ecore_x_window_prop_property_set(window,
|
||||
ECORE_X_ATOM_XDND_TYPE_LIST,
|
||||
ECORE_X_ATOM_ATOM,
|
||||
32, data, num + 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!ecore_x_dnd_type_isset(window, type))
|
||||
{
|
||||
free(old_data);
|
||||
return;
|
||||
}
|
||||
newset = calloc(num - 1, sizeof(Ecore_X_Atom));
|
||||
if (!newset)
|
||||
{
|
||||
free(old_data);
|
||||
return;
|
||||
}
|
||||
data = (unsigned char *)newset;
|
||||
for (i = 0; i < num; i++)
|
||||
if (oldset[i] != atom)
|
||||
newset[j++] = oldset[i];
|
||||
if (!ecore_x_dnd_type_isset(window, type))
|
||||
{
|
||||
free(old_data);
|
||||
return;
|
||||
}
|
||||
|
||||
ecore_x_window_prop_property_set(window,
|
||||
newset = calloc(num - 1, sizeof(Ecore_X_Atom));
|
||||
if (!newset)
|
||||
{
|
||||
free(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(window,
|
||||
ECORE_X_ATOM_XDND_TYPE_LIST,
|
||||
ECORE_X_ATOM_ATOM,
|
||||
32, data, num - 1);
|
||||
|
@ -338,7 +350,7 @@ ecore_x_dnd_type_set(Ecore_X_Window window,
|
|||
|
||||
free(oldset);
|
||||
free(newset);
|
||||
}
|
||||
} /* ecore_x_dnd_type_set */
|
||||
|
||||
/* FIXME: round trips, but I don't think we can do much, here */
|
||||
|
||||
|
@ -360,36 +372,40 @@ ecore_x_dnd_types_set(Ecore_X_Window window,
|
|||
unsigned int num_types)
|
||||
{
|
||||
Ecore_X_Atom *newset = NULL;
|
||||
void *data = NULL;
|
||||
uint32_t i;
|
||||
void *data = NULL;
|
||||
uint32_t i;
|
||||
|
||||
if (!num_types)
|
||||
{
|
||||
ecore_x_window_prop_property_del(window, ECORE_X_ATOM_XDND_TYPE_LIST);
|
||||
ecore_x_window_prop_property_del(window, ECORE_X_ATOM_XDND_TYPE_LIST);
|
||||
}
|
||||
else
|
||||
{
|
||||
xcb_intern_atom_cookie_t *cookies;
|
||||
xcb_intern_atom_reply_t *reply;
|
||||
xcb_intern_atom_reply_t *reply;
|
||||
|
||||
cookies = (xcb_intern_atom_cookie_t *)malloc(sizeof(xcb_intern_atom_cookie_t));
|
||||
if (!cookies) return;
|
||||
for (i = 0; i < num_types; i++)
|
||||
cookies[i] = xcb_intern_atom_unchecked(_ecore_xcb_conn, 0,
|
||||
strlen(types[i]), types[i]);
|
||||
if (!cookies)
|
||||
return;
|
||||
|
||||
for (i = 0; i < num_types; i++)
|
||||
cookies[i] = xcb_intern_atom_unchecked(_ecore_xcb_conn, 0,
|
||||
strlen(types[i]), types[i]);
|
||||
data = calloc(num_types, sizeof(Ecore_X_Atom));
|
||||
if (!data)
|
||||
if (!data)
|
||||
{
|
||||
for (i = 0; i < num_types; i++)
|
||||
{
|
||||
reply = xcb_intern_atom_reply(_ecore_xcb_conn, cookies[i], NULL);
|
||||
if (reply) free(reply);
|
||||
}
|
||||
free(cookies);
|
||||
return;
|
||||
for (i = 0; i < num_types; i++)
|
||||
{
|
||||
reply = xcb_intern_atom_reply(_ecore_xcb_conn, cookies[i], NULL);
|
||||
if (reply)
|
||||
free(reply);
|
||||
}
|
||||
free(cookies);
|
||||
return;
|
||||
}
|
||||
newset = data;
|
||||
for (i = 0; i < num_types; i++)
|
||||
|
||||
newset = data;
|
||||
for (i = 0; i < num_types; i++)
|
||||
{
|
||||
reply = xcb_intern_atom_reply(_ecore_xcb_conn, cookies[i], NULL);
|
||||
if (reply)
|
||||
|
@ -398,26 +414,26 @@ ecore_x_dnd_types_set(Ecore_X_Window window,
|
|||
free(reply);
|
||||
}
|
||||
else
|
||||
newset[i] = XCB_NONE;
|
||||
newset[i] = XCB_NONE;
|
||||
}
|
||||
free(cookies);
|
||||
ecore_x_window_prop_property_set(window, ECORE_X_ATOM_XDND_TYPE_LIST,
|
||||
ecore_x_window_prop_property_set(window, ECORE_X_ATOM_XDND_TYPE_LIST,
|
||||
ECORE_X_ATOM_ATOM, 32, data, num_types);
|
||||
free(data);
|
||||
free(data);
|
||||
}
|
||||
}
|
||||
} /* ecore_x_dnd_types_set */
|
||||
|
||||
Ecore_X_DND_Source *
|
||||
_ecore_x_dnd_source_get(void)
|
||||
{
|
||||
return _source;
|
||||
}
|
||||
} /* _ecore_x_dnd_source_get */
|
||||
|
||||
Ecore_X_DND_Target *
|
||||
_ecore_x_dnd_target_get(void)
|
||||
{
|
||||
return _target;
|
||||
}
|
||||
} /* _ecore_x_dnd_target_get */
|
||||
|
||||
/**
|
||||
* Sends the GetProperty request.
|
||||
|
@ -434,8 +450,7 @@ ecore_x_dnd_begin_prefetch(Ecore_X_Window source)
|
|||
ECORE_X_ATOM_ATOM,
|
||||
0, LONG_MAX);
|
||||
_ecore_xcb_cookie_cache(cookie.sequence);
|
||||
}
|
||||
|
||||
} /* ecore_x_dnd_begin_prefetch */
|
||||
|
||||
/**
|
||||
* Gets the reply of the GetProperty request sent by ecore_x_dnd_begin_prefetch().
|
||||
|
@ -449,7 +464,7 @@ ecore_x_dnd_begin_fetch(void)
|
|||
cookie.sequence = _ecore_xcb_cookie_get();
|
||||
reply = xcb_get_property_reply(_ecore_xcb_conn, cookie, NULL);
|
||||
_ecore_xcb_reply_cache(reply);
|
||||
}
|
||||
} /* ecore_x_dnd_begin_fetch */
|
||||
|
||||
/* FIXME: round trip */
|
||||
|
||||
|
@ -482,7 +497,7 @@ ecore_x_dnd_begin(Ecore_X_Window source,
|
|||
ecore_x_selection_xdnd_prefetch();
|
||||
ecore_x_selection_xdnd_fetch();
|
||||
if (!ecore_x_selection_xdnd_set(source, data, size))
|
||||
return 0;
|
||||
return 0;
|
||||
|
||||
_source->win = source;
|
||||
ecore_x_window_ignore_set(_source->win, 1);
|
||||
|
@ -494,7 +509,7 @@ ecore_x_dnd_begin(Ecore_X_Window source,
|
|||
_source->action = ECORE_X_ATOM_XDND_ACTION_COPY;
|
||||
_source->accepted_action = XCB_NONE;
|
||||
return 1;
|
||||
}
|
||||
} /* ecore_x_dnd_begin */
|
||||
|
||||
EAPI int
|
||||
ecore_x_dnd_drop(void)
|
||||
|
@ -505,42 +520,43 @@ ecore_x_dnd_drop(void)
|
|||
{
|
||||
xcb_client_message_event_t ev;
|
||||
|
||||
ev.response_type = XCB_CLIENT_MESSAGE;
|
||||
ev.format = 32;
|
||||
ev.window = _source->dest;
|
||||
ev.response_type = XCB_CLIENT_MESSAGE;
|
||||
ev.format = 32;
|
||||
ev.window = _source->dest;
|
||||
|
||||
if (_source->will_accept)
|
||||
{
|
||||
ev.type = ECORE_X_ATOM_XDND_DROP;
|
||||
ev.data.data32[0] = _source->win;
|
||||
ev.data.data32[1] = 0;
|
||||
ev.data.data32[2] = _source->time;
|
||||
xcb_send_event(_ecore_xcb_conn, 0, _source->dest, 0, (const char *)&ev);
|
||||
_source->state = ECORE_X_DND_SOURCE_DROPPED;
|
||||
status = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
ev.type = ECORE_X_ATOM_XDND_LEAVE;
|
||||
ev.data.data32[0] = _source->win;
|
||||
ev.data.data32[1] = 0;
|
||||
xcb_send_event(_ecore_xcb_conn, 0, _source->dest, 0, (const char *)&ev);
|
||||
_source->state = ECORE_X_DND_SOURCE_IDLE;
|
||||
}
|
||||
if (_source->will_accept)
|
||||
{
|
||||
ev.type = ECORE_X_ATOM_XDND_DROP;
|
||||
ev.data.data32[0] = _source->win;
|
||||
ev.data.data32[1] = 0;
|
||||
ev.data.data32[2] = _source->time;
|
||||
xcb_send_event(_ecore_xcb_conn, 0, _source->dest, 0, (const char *)&ev);
|
||||
_source->state = ECORE_X_DND_SOURCE_DROPPED;
|
||||
status = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
ev.type = ECORE_X_ATOM_XDND_LEAVE;
|
||||
ev.data.data32[0] = _source->win;
|
||||
ev.data.data32[1] = 0;
|
||||
xcb_send_event(_ecore_xcb_conn, 0, _source->dest, 0, (const char *)&ev);
|
||||
_source->state = ECORE_X_DND_SOURCE_IDLE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Dropping on nothing */
|
||||
ecore_x_selection_xdnd_clear();
|
||||
_source->state = ECORE_X_DND_SOURCE_IDLE;
|
||||
/* Dropping on nothing */
|
||||
ecore_x_selection_xdnd_clear();
|
||||
_source->state = ECORE_X_DND_SOURCE_IDLE;
|
||||
}
|
||||
|
||||
ecore_x_window_ignore_set(_source->win, 0);
|
||||
|
||||
_source->prev.window = 0;
|
||||
_source->dest = XCB_NONE;
|
||||
|
||||
return status;
|
||||
}
|
||||
} /* ecore_x_dnd_drop */
|
||||
|
||||
EAPI void
|
||||
ecore_x_dnd_send_status(int will_accept,
|
||||
|
@ -551,7 +567,7 @@ ecore_x_dnd_send_status(int will_accept,
|
|||
xcb_client_message_event_t ev;
|
||||
|
||||
if (_target->state == ECORE_X_DND_TARGET_IDLE)
|
||||
return;
|
||||
return;
|
||||
|
||||
_target->will_accept = will_accept;
|
||||
|
||||
|
@ -563,9 +579,10 @@ ecore_x_dnd_send_status(int will_accept,
|
|||
ev.data.data32[0] = _target->win;
|
||||
ev.data.data32[1] = 0;
|
||||
if (will_accept)
|
||||
ev.data.data32[1] |= 0x1UL;
|
||||
ev.data.data32[1] |= 0x1UL;
|
||||
|
||||
if (!suppress)
|
||||
ev.data.data32[1] |= 0x2UL;
|
||||
ev.data.data32[1] |= 0x2UL;
|
||||
|
||||
/* Set rectangle information */
|
||||
ev.data.data32[2] = rectangle.x;
|
||||
|
@ -577,17 +594,17 @@ ecore_x_dnd_send_status(int will_accept,
|
|||
|
||||
if (will_accept)
|
||||
{
|
||||
ev.data.data32[4] = action;
|
||||
_target->accepted_action = action;
|
||||
ev.data.data32[4] = action;
|
||||
_target->accepted_action = action;
|
||||
}
|
||||
else
|
||||
{
|
||||
ev.data.data32[4] = XCB_NONE;
|
||||
_target->accepted_action = action;
|
||||
ev.data.data32[4] = XCB_NONE;
|
||||
_target->accepted_action = action;
|
||||
}
|
||||
|
||||
xcb_send_event(_ecore_xcb_conn, 0, _target->source, 0, (const char *)&ev);
|
||||
}
|
||||
} /* ecore_x_dnd_send_status */
|
||||
|
||||
EAPI void
|
||||
ecore_x_dnd_send_finished(void)
|
||||
|
@ -595,7 +612,7 @@ ecore_x_dnd_send_finished(void)
|
|||
xcb_client_message_event_t ev;
|
||||
|
||||
if (_target->state == ECORE_X_DND_TARGET_IDLE)
|
||||
return;
|
||||
return;
|
||||
|
||||
ev.response_type = XCB_CLIENT_MESSAGE;
|
||||
ev.format = 32;
|
||||
|
@ -607,40 +624,41 @@ ecore_x_dnd_send_finished(void)
|
|||
ev.data.data32[2] = 0;
|
||||
if (_target->will_accept)
|
||||
{
|
||||
ev.data.data32[1] |= 0x1UL;
|
||||
ev.data.data32[2] = _target->accepted_action;
|
||||
ev.data.data32[1] |= 0x1UL;
|
||||
ev.data.data32[2] = _target->accepted_action;
|
||||
}
|
||||
|
||||
xcb_send_event(_ecore_xcb_conn, 0, _target->source, 0, (const char *)&ev);
|
||||
|
||||
_target->state = ECORE_X_DND_TARGET_IDLE;
|
||||
}
|
||||
} /* ecore_x_dnd_send_finished */
|
||||
|
||||
void
|
||||
ecore_x_dnd_source_action_set(Ecore_X_Atom action)
|
||||
{
|
||||
_source->action = action;
|
||||
if (_source->prev.window)
|
||||
_ecore_x_dnd_drag(_source->prev.window, _source->prev.x, _source->prev.y);
|
||||
}
|
||||
_ecore_x_dnd_drag(_source->prev.window, _source->prev.x, _source->prev.y);
|
||||
} /* ecore_x_dnd_source_action_set */
|
||||
|
||||
Ecore_X_Atom
|
||||
ecore_x_dnd_source_action_get(void)
|
||||
{
|
||||
return _source->action;
|
||||
}
|
||||
} /* ecore_x_dnd_source_action_get */
|
||||
|
||||
void
|
||||
_ecore_x_dnd_drag(Ecore_X_Window root,
|
||||
int x,
|
||||
int y)
|
||||
int x,
|
||||
int y)
|
||||
{
|
||||
xcb_client_message_event_t ev;
|
||||
Ecore_X_Window win;
|
||||
Ecore_X_Window *skip;
|
||||
int num;
|
||||
Ecore_X_Window win;
|
||||
Ecore_X_Window *skip;
|
||||
int num;
|
||||
|
||||
if (_source->state != ECORE_X_DND_SOURCE_DRAGGING)
|
||||
return;
|
||||
return;
|
||||
|
||||
ev.response_type = XCB_CLIENT_MESSAGE;
|
||||
ev.format = 32;
|
||||
|
@ -662,35 +680,38 @@ _ecore_x_dnd_drag(Ecore_X_Window root,
|
|||
if (ecore_x_dnd_version_get(win))
|
||||
{
|
||||
reply_tree = xcb_query_tree_reply(_ecore_xcb_conn, cookie_tree, NULL);
|
||||
if (reply_tree) free(reply_tree);
|
||||
if (reply_tree)
|
||||
free(reply_tree);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
reply_tree = xcb_query_tree_reply(_ecore_xcb_conn, cookie_tree, NULL);
|
||||
if (reply_tree)
|
||||
{
|
||||
win = reply_tree->parent;
|
||||
free(reply_tree);
|
||||
win = reply_tree->parent;
|
||||
free(reply_tree);
|
||||
}
|
||||
}
|
||||
|
||||
/* Send XdndLeave to current destination window if we have left it */
|
||||
if ((_source->dest) && (win != _source->dest))
|
||||
{
|
||||
ev.window = _source->dest;
|
||||
ev.type = ECORE_X_ATOM_XDND_LEAVE;
|
||||
ev.data.data32[0] = _source->win;
|
||||
ev.data.data32[1] = 0;
|
||||
ev.window = _source->dest;
|
||||
ev.type = ECORE_X_ATOM_XDND_LEAVE;
|
||||
ev.data.data32[0] = _source->win;
|
||||
ev.data.data32[1] = 0;
|
||||
|
||||
xcb_send_event(_ecore_xcb_conn, 0, _source->dest, 0, (const char *)&ev);
|
||||
_source->suppress = 0;
|
||||
xcb_send_event(_ecore_xcb_conn, 0, _source->dest, 0, (const char *)&ev);
|
||||
_source->suppress = 0;
|
||||
}
|
||||
|
||||
if (win)
|
||||
{
|
||||
int16_t x1;
|
||||
int16_t x2;
|
||||
int16_t y1;
|
||||
int16_t y2;
|
||||
int16_t x1;
|
||||
int16_t x2;
|
||||
int16_t y1;
|
||||
int16_t y2;
|
||||
|
||||
ecore_x_dnd_version_get_prefetch(win);
|
||||
ecore_x_dnd_type_get_prefetch(_source->win);
|
||||
|
@ -698,76 +719,78 @@ _ecore_x_dnd_drag(Ecore_X_Window root,
|
|||
ecore_x_dnd_version_get_fetch();
|
||||
if (!ecore_x_dnd_version_get(win))
|
||||
{
|
||||
ecore_x_dnd_type_get_fetch();
|
||||
return;
|
||||
ecore_x_dnd_type_get_fetch();
|
||||
return;
|
||||
}
|
||||
|
||||
_source->version = MIN(ECORE_X_DND_VERSION,
|
||||
_source->version = MIN(ECORE_X_DND_VERSION,
|
||||
ecore_x_dnd_version_get(win));
|
||||
if (win != _source->dest)
|
||||
{
|
||||
unsigned char *data;
|
||||
Ecore_X_Atom *types;
|
||||
int num;
|
||||
int i;
|
||||
if (win != _source->dest)
|
||||
{
|
||||
unsigned char *data;
|
||||
Ecore_X_Atom *types;
|
||||
int num;
|
||||
int i;
|
||||
|
||||
ecore_x_dnd_type_get_fetch();
|
||||
if (!ecore_x_window_prop_property_get(_source->win,
|
||||
ECORE_X_ATOM_XDND_TYPE_LIST,
|
||||
ECORE_X_ATOM_ATOM,
|
||||
32, &data, &num))
|
||||
return;
|
||||
return;
|
||||
|
||||
types = (Ecore_X_Atom *)data;
|
||||
types = (Ecore_X_Atom *)data;
|
||||
|
||||
/* Entered new window, send XdndEnter */
|
||||
ev.window = win;
|
||||
ev.type = ECORE_X_ATOM_XDND_ENTER;
|
||||
ev.data.data32[0] = _source->win;
|
||||
ev.data.data32[1] = 0;
|
||||
if (num > 3)
|
||||
ev.data.data32[1] |= 0x1UL;
|
||||
else
|
||||
ev.data.data32[1] &= 0xfffffffeUL;
|
||||
ev.data.data32[1] |= ((unsigned long) _source->version) << 24;
|
||||
/* Entered new window, send XdndEnter */
|
||||
ev.window = win;
|
||||
ev.type = ECORE_X_ATOM_XDND_ENTER;
|
||||
ev.data.data32[0] = _source->win;
|
||||
ev.data.data32[1] = 0;
|
||||
if (num > 3)
|
||||
ev.data.data32[1] |= 0x1UL;
|
||||
else
|
||||
ev.data.data32[1] &= 0xfffffffeUL;
|
||||
|
||||
for (i = 2; i < 5; i++)
|
||||
ev.data.data32[i] = 0;
|
||||
for (i = 0; i < MIN(num, 3); ++i)
|
||||
ev.data.data32[i + 2] = types[i];
|
||||
free(data);
|
||||
xcb_send_event(_ecore_xcb_conn, 0, win, 0, (const char *)&ev);
|
||||
_source->await_status = 0;
|
||||
_source->will_accept = 0;
|
||||
}
|
||||
ev.data.data32[1] |= ((unsigned long)_source->version) << 24;
|
||||
|
||||
for (i = 2; i < 5; i++)
|
||||
ev.data.data32[i] = 0;
|
||||
for (i = 0; i < MIN(num, 3); ++i)
|
||||
ev.data.data32[i + 2] = types[i];
|
||||
free(data);
|
||||
xcb_send_event(_ecore_xcb_conn, 0, win, 0, (const char *)&ev);
|
||||
_source->await_status = 0;
|
||||
_source->will_accept = 0;
|
||||
}
|
||||
else
|
||||
ecore_x_dnd_type_get_fetch();
|
||||
ecore_x_dnd_type_get_fetch();
|
||||
|
||||
/* Determine if we're still in the rectangle from the last status */
|
||||
x1 = _source->rectangle.x;
|
||||
x2 = _source->rectangle.x + _source->rectangle.width;
|
||||
y1 = _source->rectangle.y;
|
||||
y2 = _source->rectangle.y + _source->rectangle.height;
|
||||
/* Determine if we're still in the rectangle from the last status */
|
||||
x1 = _source->rectangle.x;
|
||||
x2 = _source->rectangle.x + _source->rectangle.width;
|
||||
y1 = _source->rectangle.y;
|
||||
y2 = _source->rectangle.y + _source->rectangle.height;
|
||||
|
||||
if ((!_source->await_status) ||
|
||||
(!_source->suppress) ||
|
||||
((x < x1) || (x > x2) || (y < y1) || (y > y2)))
|
||||
{
|
||||
ev.window = win;
|
||||
ev.type = ECORE_X_ATOM_XDND_POSITION;
|
||||
ev.data.data32[0] = _source->win;
|
||||
ev.data.data32[1] = 0; /* Reserved */
|
||||
ev.data.data32[2] = ((x << 16) & 0xffff0000) | (y & 0xffff);
|
||||
ev.data.data32[3] = _source->time; /* Version 1 */
|
||||
ev.data.data32[4] = _source->action; /* Version 2, Needs to be pre-set */
|
||||
xcb_send_event(_ecore_xcb_conn, 0, win, 0, (const char *)&ev);
|
||||
if ((!_source->await_status) ||
|
||||
(!_source->suppress) ||
|
||||
((x < x1) || (x > x2) || (y < y1) || (y > y2)))
|
||||
{
|
||||
ev.window = win;
|
||||
ev.type = ECORE_X_ATOM_XDND_POSITION;
|
||||
ev.data.data32[0] = _source->win;
|
||||
ev.data.data32[1] = 0; /* Reserved */
|
||||
ev.data.data32[2] = ((x << 16) & 0xffff0000) | (y & 0xffff);
|
||||
ev.data.data32[3] = _source->time; /* Version 1 */
|
||||
ev.data.data32[4] = _source->action; /* Version 2, Needs to be pre-set */
|
||||
xcb_send_event(_ecore_xcb_conn, 0, win, 0, (const char *)&ev);
|
||||
|
||||
_source->await_status = 1;
|
||||
}
|
||||
_source->await_status = 1;
|
||||
}
|
||||
}
|
||||
|
||||
_source->prev.x = x;
|
||||
_source->prev.y = y;
|
||||
_source->prev.window = root;
|
||||
_source->dest = win;
|
||||
}
|
||||
} /* _ecore_x_dnd_drag */
|
||||
|
||||
|
|
|
@ -4,14 +4,12 @@
|
|||
|
||||
#include "ecore_xcb_private.h"
|
||||
|
||||
|
||||
/**
|
||||
* @defgroup Ecore_X_DPMS_Group X DPMS Extension Functions
|
||||
*
|
||||
* Functions related to the X DPMS extension.
|
||||
*/
|
||||
|
||||
|
||||
#ifdef ECORE_XCB_DPMS
|
||||
static int _dpms_available = 0;
|
||||
static xcb_dpms_get_version_cookie_t _ecore_xcb_dpms_init_cookie;
|
||||
|
@ -28,8 +26,9 @@ _ecore_x_dpms_init(const xcb_query_extension_reply_t *reply)
|
|||
#ifdef ECORE_XCB_DPMS
|
||||
if (reply && (reply->present))
|
||||
_ecore_xcb_dpms_init_cookie = xcb_dpms_get_version_unchecked(_ecore_xcb_conn, 0, 0);
|
||||
|
||||
#endif /* ECORE_XCB_DPMS */
|
||||
}
|
||||
} /* _ecore_x_dpms_init */
|
||||
|
||||
void
|
||||
_ecore_x_dpms_init_finalize(void)
|
||||
|
@ -43,12 +42,13 @@ _ecore_x_dpms_init_finalize(void)
|
|||
if (reply)
|
||||
{
|
||||
if (reply->server_major_version >= 1)
|
||||
_dpms_available = 1;
|
||||
_dpms_available = 1;
|
||||
|
||||
free(reply);
|
||||
}
|
||||
#endif /* ECORE_XCB_DPMS */
|
||||
}
|
||||
|
||||
#endif /* ECORE_XCB_DPMS */
|
||||
} /* _ecore_x_dpms_init_finalize */
|
||||
|
||||
/**
|
||||
* Checks if the DPMS extension is available or not.
|
||||
|
@ -63,11 +63,10 @@ ecore_x_dpms_query(void)
|
|||
{
|
||||
#ifdef ECORE_XCB_DPMS
|
||||
return _dpms_available;
|
||||
#else
|
||||
#else /* ifdef ECORE_XCB_DPMS */
|
||||
return 0;
|
||||
#endif /* ECORE_XCB_DPMS */
|
||||
}
|
||||
|
||||
} /* ecore_x_dpms_query */
|
||||
|
||||
/**
|
||||
* Sends the DPMSCapable request.
|
||||
|
@ -82,8 +81,7 @@ ecore_x_dpms_capable_get_prefetch(void)
|
|||
cookie = xcb_dpms_capable_unchecked(_ecore_xcb_conn);
|
||||
_ecore_xcb_cookie_cache(cookie.sequence);
|
||||
#endif /* ECORE_XCB_DPMS */
|
||||
}
|
||||
|
||||
} /* ecore_x_dpms_capable_get_prefetch */
|
||||
|
||||
/**
|
||||
* Gets the reply of the DPMSCapable request sent by ecore_x_dpms_capable_get_prefetch().
|
||||
|
@ -100,8 +98,7 @@ ecore_x_dpms_capable_get_fetch(void)
|
|||
reply = xcb_dpms_capable_reply(_ecore_xcb_conn, cookie, NULL);
|
||||
_ecore_xcb_reply_cache(reply);
|
||||
#endif /* ECORE_XCB_DPMS */
|
||||
}
|
||||
|
||||
} /* ecore_x_dpms_capable_get_fetch */
|
||||
|
||||
/**
|
||||
* Checks if the X server is capable of DPMS.
|
||||
|
@ -115,19 +112,19 @@ ecore_x_dpms_capable_get_fetch(void)
|
|||
EAPI int
|
||||
ecore_x_dpms_capable_get(void)
|
||||
{
|
||||
int capable = 0;
|
||||
int capable = 0;
|
||||
#ifdef ECORE_XCB_DPMS
|
||||
xcb_dpms_capable_reply_t *reply;
|
||||
|
||||
reply = _ecore_xcb_reply_get();
|
||||
if (!reply) return 0;
|
||||
if (!reply)
|
||||
return 0;
|
||||
|
||||
capable = reply->capable;
|
||||
#endif /* ECORE_XCB_DPMS */
|
||||
|
||||
return capable;
|
||||
}
|
||||
|
||||
} /* ecore_x_dpms_capable_get */
|
||||
|
||||
/**
|
||||
* Sends the DPMSInfo request.
|
||||
|
@ -142,8 +139,7 @@ ecore_x_dpms_enable_get_prefetch(void)
|
|||
cookie = xcb_dpms_info_unchecked(_ecore_xcb_conn);
|
||||
_ecore_xcb_cookie_cache(cookie.sequence);
|
||||
#endif /* ECORE_XCB_DPMS */
|
||||
}
|
||||
|
||||
} /* ecore_x_dpms_enable_get_prefetch */
|
||||
|
||||
/**
|
||||
* Gets the reply of the DPMSInfo request sent by ecore_x_dpms_enable_get_prefetch().
|
||||
|
@ -160,8 +156,7 @@ ecore_x_dpms_enable_get_fetch(void)
|
|||
reply = xcb_dpms_info_reply(_ecore_xcb_conn, cookie, NULL);
|
||||
_ecore_xcb_reply_cache(reply);
|
||||
#endif /* ECORE_XCB_DPMS */
|
||||
}
|
||||
|
||||
} /* ecore_x_dpms_enable_get_fetch */
|
||||
|
||||
/**
|
||||
* Checks the DPMS state of the display.
|
||||
|
@ -175,19 +170,19 @@ ecore_x_dpms_enable_get_fetch(void)
|
|||
EAPI int
|
||||
ecore_x_dpms_enable_get(void)
|
||||
{
|
||||
int enable = 0;
|
||||
int enable = 0;
|
||||
#ifdef ECORE_XCB_DPMS
|
||||
xcb_dpms_info_reply_t *reply;
|
||||
|
||||
reply = _ecore_xcb_reply_get();
|
||||
if (!reply) return 0;
|
||||
if (!reply)
|
||||
return 0;
|
||||
|
||||
enable = reply->state;
|
||||
#endif /* ECORE_XCB_DPMS */
|
||||
|
||||
return enable;
|
||||
}
|
||||
|
||||
} /* ecore_x_dpms_enable_get */
|
||||
|
||||
/**
|
||||
* Sets the DPMS state of the display.
|
||||
|
@ -202,9 +197,9 @@ ecore_x_dpms_enabled_set(int enabled)
|
|||
xcb_dpms_enable(_ecore_xcb_conn);
|
||||
else
|
||||
xcb_dpms_disable(_ecore_xcb_conn);
|
||||
#endif /* ECORE_XCB_DPMS */
|
||||
}
|
||||
|
||||
#endif /* ECORE_XCB_DPMS */
|
||||
} /* ecore_x_dpms_enabled_set */
|
||||
|
||||
/**
|
||||
* Sets the timeouts. The values are in unit of seconds.
|
||||
|
@ -224,8 +219,7 @@ ecore_x_dpms_timeouts_set(unsigned int standby,
|
|||
#endif /* ECORE_XCB_DPMS */
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
} /* ecore_x_dpms_timeouts_set */
|
||||
|
||||
/**
|
||||
* Sends the DPMSGetTimeouts request.
|
||||
|
@ -240,8 +234,7 @@ ecore_x_dpms_timeouts_get_prefetch(void)
|
|||
cookie = xcb_dpms_get_timeouts_unchecked(_ecore_xcb_conn);
|
||||
_ecore_xcb_cookie_cache(cookie.sequence);
|
||||
#endif /* ECORE_XCB_DPMS */
|
||||
}
|
||||
|
||||
} /* ecore_x_dpms_timeouts_get_prefetch */
|
||||
|
||||
/**
|
||||
* Gets the reply of the DPMSGetTimeouts request sent by ecore_x_dpms_timeouts_get_prefetch().
|
||||
|
@ -258,8 +251,7 @@ ecore_x_dpms_timeouts_get_fetch(void)
|
|||
reply = xcb_dpms_get_timeouts_reply(_ecore_xcb_conn, cookie, NULL);
|
||||
_ecore_xcb_reply_cache(reply);
|
||||
#endif /* ECORE_XCB_DPMS */
|
||||
}
|
||||
|
||||
} /* ecore_x_dpms_timeouts_get_fetch */
|
||||
|
||||
/**
|
||||
* Gets the timeouts. The values are in unit of seconds.
|
||||
|
@ -279,19 +271,28 @@ ecore_x_dpms_timeouts_get(unsigned int *standby,
|
|||
reply = _ecore_xcb_reply_get();
|
||||
if (reply)
|
||||
{
|
||||
if (standby) *standby = reply->standby_timeout;
|
||||
if (suspend) *suspend = reply->suspend_timeout;
|
||||
if (off) *off = 0;
|
||||
if (standby)
|
||||
*standby = reply->standby_timeout;
|
||||
|
||||
if (suspend)
|
||||
*suspend = reply->suspend_timeout;
|
||||
|
||||
if (off)
|
||||
*off = 0;
|
||||
}
|
||||
else
|
||||
#endif /* ECORE_XCB_DPMS */
|
||||
{
|
||||
if (standby) *standby = 0;
|
||||
if (suspend) *suspend = 0;
|
||||
if (off) *off = 0;
|
||||
}
|
||||
}
|
||||
{
|
||||
if (standby)
|
||||
*standby = 0;
|
||||
|
||||
if (suspend)
|
||||
*suspend = 0;
|
||||
|
||||
if (off)
|
||||
*off = 0;
|
||||
}
|
||||
} /* ecore_x_dpms_timeouts_get */
|
||||
|
||||
/**
|
||||
* Returns the amount of time of inactivity before standby mode is invoked.
|
||||
|
@ -305,19 +306,19 @@ ecore_x_dpms_timeouts_get(unsigned int *standby,
|
|||
EAPI unsigned int
|
||||
ecore_x_dpms_timeout_standby_get(void)
|
||||
{
|
||||
int standby = 0;
|
||||
int standby = 0;
|
||||
#ifdef ECORE_XCB_DPMS
|
||||
xcb_dpms_get_timeouts_reply_t *reply;
|
||||
|
||||
reply = _ecore_xcb_reply_get();
|
||||
if (!reply) return 0;
|
||||
if (!reply)
|
||||
return 0;
|
||||
|
||||
standby = reply->standby_timeout;
|
||||
#endif /* ECORE_XCB_DPMS */
|
||||
|
||||
return standby;
|
||||
}
|
||||
|
||||
} /* ecore_x_dpms_timeout_standby_get */
|
||||
|
||||
/**
|
||||
* Returns the amount of time of inactivity before the second level of
|
||||
|
@ -332,19 +333,19 @@ ecore_x_dpms_timeout_standby_get(void)
|
|||
EAPI unsigned int
|
||||
ecore_x_dpms_timeout_suspend_get(void)
|
||||
{
|
||||
int suspend = 0;;
|
||||
int suspend = 0;
|
||||
#ifdef ECORE_XCB_DPMS
|
||||
xcb_dpms_get_timeouts_reply_t *reply;
|
||||
|
||||
reply = _ecore_xcb_reply_get();
|
||||
if (!reply) return 0;
|
||||
if (!reply)
|
||||
return 0;
|
||||
|
||||
suspend = reply->suspend_timeout;
|
||||
#endif /* ECORE_XCB_DPMS */
|
||||
|
||||
return suspend;
|
||||
}
|
||||
|
||||
} /* ecore_x_dpms_timeout_suspend_get */
|
||||
|
||||
/**
|
||||
* Returns the amount of time of inactivity before the third and final
|
||||
|
@ -359,19 +360,19 @@ ecore_x_dpms_timeout_suspend_get(void)
|
|||
EAPI unsigned int
|
||||
ecore_x_dpms_timeout_off_get(void)
|
||||
{
|
||||
int off = 0;
|
||||
int off = 0;
|
||||
#ifdef ECORE_XCB_DPMS
|
||||
xcb_dpms_get_timeouts_reply_t *reply;
|
||||
|
||||
reply = _ecore_xcb_reply_get();
|
||||
if (!reply) return 0;
|
||||
if (!reply)
|
||||
return 0;
|
||||
|
||||
off = reply->off_timeout;
|
||||
#endif /* ECORE_XCB_DPMS */
|
||||
|
||||
return off;
|
||||
}
|
||||
|
||||
} /* ecore_x_dpms_timeout_off_get */
|
||||
|
||||
/**
|
||||
* Sets the standby timeout (in unit of seconds).
|
||||
|
@ -389,15 +390,15 @@ ecore_x_dpms_timeout_standby_set(unsigned int new_standby)
|
|||
xcb_dpms_get_timeouts_reply_t *reply;
|
||||
|
||||
reply = _ecore_xcb_reply_get();
|
||||
if (!reply) return;
|
||||
if (!reply)
|
||||
return;
|
||||
|
||||
xcb_dpms_set_timeouts(_ecore_xcb_conn,
|
||||
new_standby,
|
||||
reply->suspend_timeout,
|
||||
reply->off_timeout);
|
||||
#endif /* ECORE_XCB_DPMS */
|
||||
}
|
||||
|
||||
} /* ecore_x_dpms_timeout_standby_set */
|
||||
|
||||
/**
|
||||
* Sets the suspend timeout (in unit of seconds).
|
||||
|
@ -415,15 +416,15 @@ ecore_x_dpms_timeout_suspend_set(unsigned int new_suspend)
|
|||
xcb_dpms_get_timeouts_reply_t *reply;
|
||||
|
||||
reply = _ecore_xcb_reply_get();
|
||||
if (!reply) return;
|
||||
if (!reply)
|
||||
return;
|
||||
|
||||
xcb_dpms_set_timeouts(_ecore_xcb_conn,
|
||||
reply->standby_timeout,
|
||||
new_suspend,
|
||||
reply->off_timeout);
|
||||
#endif /* ECORE_XCB_DPMS */
|
||||
}
|
||||
|
||||
} /* ecore_x_dpms_timeout_suspend_set */
|
||||
|
||||
/**
|
||||
* Sets the off timeout (in unit of seconds).
|
||||
|
@ -441,11 +442,13 @@ ecore_x_dpms_timeout_off_set(unsigned int new_off)
|
|||
xcb_dpms_get_timeouts_reply_t *reply;
|
||||
|
||||
reply = _ecore_xcb_reply_get();
|
||||
if (!reply) return;
|
||||
if (!reply)
|
||||
return;
|
||||
|
||||
xcb_dpms_set_timeouts(_ecore_xcb_conn,
|
||||
reply->standby_timeout,
|
||||
reply->suspend_timeout,
|
||||
new_off);
|
||||
#endif /* ECORE_XCB_DPMS */
|
||||
}
|
||||
} /* ecore_x_dpms_timeout_off_set */
|
||||
|
||||
|
|
|
@ -5,14 +5,12 @@
|
|||
#include "ecore_xcb_private.h"
|
||||
#include <xcb/xcb.h>
|
||||
|
||||
|
||||
/**
|
||||
* @defgroup Ecore_X_Drawable_Group X Drawable Functions
|
||||
*
|
||||
* Functions that operate on drawables.
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Sends the GetGeometry request.
|
||||
* @param drawable Drawable whose characteristics are sought.
|
||||
|
@ -25,8 +23,7 @@ ecore_x_drawable_geometry_get_prefetch(Ecore_X_Drawable drawable)
|
|||
|
||||
cookie = xcb_get_geometry_unchecked(_ecore_xcb_conn, drawable);
|
||||
_ecore_xcb_cookie_cache(cookie.sequence);
|
||||
}
|
||||
|
||||
} /* ecore_x_drawable_geometry_get_prefetch */
|
||||
|
||||
/**
|
||||
* Gets the reply of the GetGeometry request sent by ecore_x_atom_get_prefetch().
|
||||
|
@ -41,8 +38,7 @@ ecore_x_drawable_geometry_get_fetch(void)
|
|||
cookie.sequence = _ecore_xcb_cookie_get();
|
||||
reply = xcb_get_geometry_reply(_ecore_xcb_conn, cookie, NULL);
|
||||
_ecore_xcb_reply_cache(reply);
|
||||
}
|
||||
|
||||
} /* ecore_x_drawable_geometry_get_fetch */
|
||||
|
||||
/**
|
||||
* Retrieves the geometry of the given drawable.
|
||||
|
@ -59,29 +55,43 @@ ecore_x_drawable_geometry_get_fetch(void)
|
|||
*/
|
||||
EAPI void
|
||||
ecore_x_drawable_geometry_get(Ecore_X_Drawable drawable __UNUSED__,
|
||||
int *x,
|
||||
int *y,
|
||||
int *width,
|
||||
int *height)
|
||||
int *x,
|
||||
int *y,
|
||||
int *width,
|
||||
int *height)
|
||||
{
|
||||
xcb_get_geometry_reply_t *reply;
|
||||
|
||||
reply = _ecore_xcb_reply_get();
|
||||
if (!reply)
|
||||
{
|
||||
if (x) *x = 0;
|
||||
if (y) *y = 0;
|
||||
if (width) *width = 0;
|
||||
if (height) *height = 0;
|
||||
if (x)
|
||||
*x = 0;
|
||||
|
||||
if (y)
|
||||
*y = 0;
|
||||
|
||||
if (width)
|
||||
*width = 0;
|
||||
|
||||
if (height)
|
||||
*height = 0;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (x) *x = reply->x;
|
||||
if (y) *y = reply->y;
|
||||
if (width) *width = reply->width;
|
||||
if (height) *height = reply->height;
|
||||
}
|
||||
if (x)
|
||||
*x = reply->x;
|
||||
|
||||
if (y)
|
||||
*y = reply->y;
|
||||
|
||||
if (width)
|
||||
*width = reply->width;
|
||||
|
||||
if (height)
|
||||
*height = reply->height;
|
||||
} /* ecore_x_drawable_geometry_get */
|
||||
|
||||
/**
|
||||
* Retrieves the width of the border of the given drawable.
|
||||
|
@ -100,11 +110,10 @@ ecore_x_drawable_border_width_get(Ecore_X_Drawable drawable __UNUSED__)
|
|||
|
||||
reply = _ecore_xcb_reply_get();
|
||||
if (!reply)
|
||||
return 0;
|
||||
return 0;
|
||||
|
||||
return reply->border_width;
|
||||
}
|
||||
|
||||
} /* ecore_x_drawable_border_width_get */
|
||||
|
||||
/**
|
||||
* Retrieves the depth of the given drawable.
|
||||
|
@ -123,10 +132,10 @@ ecore_x_drawable_depth_get(Ecore_X_Drawable drawable __UNUSED__)
|
|||
|
||||
reply = _ecore_xcb_reply_get();
|
||||
if (!reply)
|
||||
return 0;
|
||||
return 0;
|
||||
|
||||
return reply->depth;
|
||||
}
|
||||
} /* ecore_x_drawable_depth_get */
|
||||
|
||||
/**
|
||||
* Fill the specified rectangle on a drawable.
|
||||
|
@ -147,4 +156,5 @@ ecore_x_drawable_rectangle_fill(Ecore_X_Drawable d, Ecore_X_GC gc, int x, int y,
|
|||
rectangle.width = width;
|
||||
rectangle.height = height;
|
||||
xcb_poly_fill_rectangle(_ecore_xcb_conn, d, gc, 1, &rectangle);
|
||||
}
|
||||
} /* ecore_x_drawable_rectangle_fill */
|
||||
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
#include "ecore_xcb_private.h"
|
||||
#include "Ecore_X_Atoms.h"
|
||||
|
||||
|
||||
EAPI void
|
||||
ecore_x_e_frame_size_set(Ecore_X_Window window,
|
||||
int fl,
|
||||
|
@ -26,4 +25,5 @@ ecore_x_e_frame_size_set(Ecore_X_Window window,
|
|||
xcb_change_property(_ecore_xcb_conn, XCB_PROP_MODE_REPLACE, window,
|
||||
ECORE_X_ATOM_E_FRAME_SIZE, ECORE_X_ATOM_CARDINAL, 32,
|
||||
4, (const void *)frames);
|
||||
}
|
||||
} /* ecore_x_e_frame_size_set */
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -4,20 +4,17 @@
|
|||
|
||||
#include "ecore_xcb_private.h"
|
||||
|
||||
|
||||
/**
|
||||
* @defgroup Ecore_X_Fixes_Group X Fixes Extension Functions
|
||||
*
|
||||
* Functions related to the X Fixes extension.
|
||||
*/
|
||||
|
||||
|
||||
#ifdef ECORE_XCB_FIXES
|
||||
static int _xfixes_available = 0;
|
||||
static xcb_xfixes_query_version_cookie_t _ecore_xcb_xfixes_init_cookie;
|
||||
#endif /* ECORE_XCB_FIXES */
|
||||
|
||||
|
||||
/* To avoid round trips, the initialization is separated in 2
|
||||
functions: _ecore_xcb_xfixes_init and
|
||||
_ecore_xcb_xfixes_init_finalize. The first one gets the cookies and
|
||||
|
@ -29,8 +26,9 @@ _ecore_x_xfixes_init(const xcb_query_extension_reply_t *reply)
|
|||
#ifdef ECORE_XCB_FIXES
|
||||
if (reply && (reply->present))
|
||||
_ecore_xcb_xfixes_init_cookie = xcb_xfixes_query_version_unchecked(_ecore_xcb_conn, 4, 0);
|
||||
|
||||
#endif /* ECORE_XCB_FIXES */
|
||||
}
|
||||
} /* _ecore_x_xfixes_init */
|
||||
|
||||
void
|
||||
_ecore_x_xfixes_init_finalize(void)
|
||||
|
@ -44,12 +42,13 @@ _ecore_x_xfixes_init_finalize(void)
|
|||
if (reply)
|
||||
{
|
||||
if (reply->major_version >= 3)
|
||||
_xfixes_available = 1;
|
||||
_xfixes_available = 1;
|
||||
|
||||
free(reply);
|
||||
}
|
||||
#endif /* ECORE_XCB_FIXES */
|
||||
}
|
||||
|
||||
#endif /* ECORE_XCB_FIXES */
|
||||
} /* _ecore_x_xfixes_init_finalize */
|
||||
|
||||
/**
|
||||
* Return whether the X server supports the Fixes Extension.
|
||||
|
@ -64,11 +63,10 @@ ecore_x_xfixes_query(void)
|
|||
{
|
||||
#ifdef ECORE_XCB_FIXES
|
||||
return _xfixes_available;
|
||||
#else
|
||||
#else /* ifdef ECORE_XCB_FIXES */
|
||||
return 0;
|
||||
#endif /* ECORE_XCB_FIXES */
|
||||
}
|
||||
|
||||
} /* ecore_x_xfixes_query */
|
||||
|
||||
/**
|
||||
* Create a region from rectangles.
|
||||
|
@ -93,8 +91,7 @@ ecore_x_region_new(Ecore_X_Rectangle *rects,
|
|||
#endif /* ECORE_XCB_FIXES */
|
||||
|
||||
return region;
|
||||
}
|
||||
|
||||
} /* ecore_x_region_new */
|
||||
|
||||
/**
|
||||
* Create a region from a pixmap.
|
||||
|
@ -116,8 +113,7 @@ ecore_x_region_new_from_bitmap(Ecore_X_Pixmap bitmap)
|
|||
#endif /* ECORE_XCB_FIXES */
|
||||
|
||||
return region;
|
||||
}
|
||||
|
||||
} /* ecore_x_region_new_from_bitmap */
|
||||
|
||||
/**
|
||||
* Create a region from a window.
|
||||
|
@ -142,8 +138,7 @@ ecore_x_region_new_from_window(Ecore_X_Window window,
|
|||
#endif /* ECORE_XCB_FIXES */
|
||||
|
||||
return region;
|
||||
}
|
||||
|
||||
} /* ecore_x_region_new_from_window */
|
||||
|
||||
/**
|
||||
* Create a region from a graphic context.
|
||||
|
@ -164,8 +159,7 @@ ecore_x_region_new_from_gc(Ecore_X_GC gc)
|
|||
#endif /* ECORE_XCB_FIXES */
|
||||
|
||||
return region;
|
||||
}
|
||||
|
||||
} /* ecore_x_region_new_from_gc */
|
||||
|
||||
/**
|
||||
* Create a region from a picture.
|
||||
|
@ -186,8 +180,7 @@ ecore_x_region_new_from_picture(Ecore_X_Picture picture)
|
|||
#endif /* ECORE_XCB_FIXES */
|
||||
|
||||
return region;
|
||||
}
|
||||
|
||||
} /* ecore_x_region_new_from_picture */
|
||||
|
||||
/**
|
||||
* Destroy a region.
|
||||
|
@ -202,8 +195,7 @@ ecore_x_region_free(Ecore_X_Region region)
|
|||
#ifdef ECORE_XCB_FIXES
|
||||
xcb_xfixes_destroy_region(_ecore_xcb_conn, region);
|
||||
#endif /* ECORE_XCB_FIXES */
|
||||
}
|
||||
|
||||
} /* ecore_x_region_free */
|
||||
|
||||
/**
|
||||
* Set the content of a region.
|
||||
|
@ -223,8 +215,7 @@ ecore_x_region_set(Ecore_X_Region region,
|
|||
#ifdef ECORE_XCB_FIXES
|
||||
xcb_xfixes_set_region(_ecore_xcb_conn, region, num, (xcb_rectangle_t *)rects);
|
||||
#endif /* ECORE_XCB_FIXES */
|
||||
}
|
||||
|
||||
} /* ecore_x_region_set */
|
||||
|
||||
/**
|
||||
* Copy the content of a region.
|
||||
|
@ -241,8 +232,7 @@ ecore_x_region_copy(Ecore_X_Region dest,
|
|||
#ifdef ECORE_XCB_FIXES
|
||||
xcb_xfixes_copy_region(_ecore_xcb_conn, source, dest);
|
||||
#endif /* ECORE_XCB_FIXES */
|
||||
}
|
||||
|
||||
} /* ecore_x_region_copy */
|
||||
|
||||
/**
|
||||
* Make the union of two regions.
|
||||
|
@ -262,8 +252,7 @@ ecore_x_region_combine(Ecore_X_Region dest,
|
|||
#ifdef ECORE_XCB_FIXES
|
||||
xcb_xfixes_union_region(_ecore_xcb_conn, source1, source2, dest);
|
||||
#endif /* ECORE_XCB_FIXES */
|
||||
}
|
||||
|
||||
} /* ecore_x_region_combine */
|
||||
|
||||
/**
|
||||
* Make the intersection of two regions.
|
||||
|
@ -283,8 +272,7 @@ ecore_x_region_intersect(Ecore_X_Region dest,
|
|||
#ifdef ECORE_XCB_FIXES
|
||||
xcb_xfixes_intersect_region(_ecore_xcb_conn, source1, source2, dest);
|
||||
#endif /* ECORE_XCB_FIXES */
|
||||
}
|
||||
|
||||
} /* ecore_x_region_intersect */
|
||||
|
||||
/**
|
||||
* Make the substraction of two regions.
|
||||
|
@ -304,8 +292,7 @@ ecore_x_region_subtract(Ecore_X_Region dest,
|
|||
#ifdef ECORE_XCB_FIXES
|
||||
xcb_xfixes_subtract_region(_ecore_xcb_conn, source1, source2, dest);
|
||||
#endif /* ECORE_XCB_FIXES */
|
||||
}
|
||||
|
||||
} /* ecore_x_region_subtract */
|
||||
|
||||
/**
|
||||
* Make the substraction of regions by bounds.
|
||||
|
@ -332,8 +319,7 @@ ecore_x_region_invert(Ecore_X_Region dest,
|
|||
rect.height = bounds->height;
|
||||
xcb_xfixes_invert_region(_ecore_xcb_conn, source, rect, dest);
|
||||
#endif /* ECORE_XCB_FIXES */
|
||||
}
|
||||
|
||||
} /* ecore_x_region_invert */
|
||||
|
||||
/**
|
||||
* Translate a region.
|
||||
|
@ -352,8 +338,7 @@ ecore_x_region_translate(Ecore_X_Region region,
|
|||
#ifdef ECORE_XCB_FIXES
|
||||
xcb_xfixes_translate_region(_ecore_xcb_conn, region, dx, dy);
|
||||
#endif /* ECORE_XCB_FIXES */
|
||||
}
|
||||
|
||||
} /* ecore_x_region_translate */
|
||||
|
||||
/**
|
||||
* Extent a region.
|
||||
|
@ -370,8 +355,7 @@ ecore_x_region_extents(Ecore_X_Region dest,
|
|||
#ifdef ECORE_XCB_FIXES
|
||||
xcb_xfixes_region_extents(_ecore_xcb_conn, source, dest);
|
||||
#endif /* ECORE_XCB_FIXES */
|
||||
}
|
||||
|
||||
} /* ecore_x_region_extents */
|
||||
|
||||
/**
|
||||
* Sends the XFixesFetchRegion request.
|
||||
|
@ -387,8 +371,7 @@ ecore_x_region_fetch_prefetch(Ecore_X_Region region)
|
|||
cookie = xcb_xfixes_fetch_region_unchecked(_ecore_xcb_conn, region);
|
||||
_ecore_xcb_cookie_cache(cookie.sequence);
|
||||
#endif /* ECORE_XCB_FIXES */
|
||||
}
|
||||
|
||||
} /* ecore_x_region_fetch_prefetch */
|
||||
|
||||
/**
|
||||
* Gets the reply of the XFixesFetchRegion request sent by ecore_xcb_region_fetch_prefetch().
|
||||
|
@ -405,8 +388,7 @@ ecore_x_region_fetch_fetch(void)
|
|||
reply = xcb_xfixes_fetch_region_reply(_ecore_xcb_conn, cookie, NULL);
|
||||
_ecore_xcb_reply_cache(reply);
|
||||
#endif /* ECORE_XCB_FIXES */
|
||||
}
|
||||
|
||||
} /* ecore_x_region_fetch_fetch */
|
||||
|
||||
/**
|
||||
* Return the rectangles that compose a region.
|
||||
|
@ -424,34 +406,44 @@ ecore_x_region_fetch_fetch(void)
|
|||
* @ingroup Ecore_X_Fixes_Group
|
||||
*/
|
||||
EAPI Ecore_X_Rectangle *
|
||||
ecore_x_region_fetch(Ecore_X_Region region __UNUSED__,
|
||||
int *num,
|
||||
Ecore_X_Rectangle *bounds)
|
||||
ecore_x_region_fetch(Ecore_X_Region region __UNUSED__,
|
||||
int *num,
|
||||
Ecore_X_Rectangle *bounds)
|
||||
{
|
||||
Ecore_X_Rectangle extents = { 0, 0, 0, 0};
|
||||
Ecore_X_Rectangle extents = { 0, 0, 0, 0};
|
||||
Ecore_X_Rectangle *rects = NULL;
|
||||
#ifdef ECORE_XCB_FIXES
|
||||
int n;
|
||||
int n;
|
||||
xcb_xfixes_fetch_region_reply_t *reply;
|
||||
|
||||
reply = _ecore_xcb_reply_get();
|
||||
if (!reply)
|
||||
{
|
||||
if (num) *num = 0;
|
||||
if (bounds) *bounds = extents;
|
||||
return NULL;
|
||||
if (num)
|
||||
*num = 0;
|
||||
|
||||
if (bounds)
|
||||
*bounds = extents;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
n = xcb_xfixes_fetch_region_rectangles_length(reply);
|
||||
rects = (Ecore_X_Rectangle *)malloc(n * sizeof(Ecore_X_Rectangle));
|
||||
if (!rects)
|
||||
{
|
||||
if (num) *num = 0;
|
||||
if (bounds) *bounds = extents;
|
||||
if (num)
|
||||
*num = 0;
|
||||
|
||||
return NULL;
|
||||
if (bounds)
|
||||
*bounds = extents;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (num) *num = n;
|
||||
if (num)
|
||||
*num = n;
|
||||
|
||||
if (bounds)
|
||||
{
|
||||
bounds->x = reply->extents.x;
|
||||
|
@ -459,18 +451,22 @@ ecore_x_region_fetch(Ecore_X_Region region __UNUSED__,
|
|||
bounds->width = reply->extents.width;
|
||||
bounds->height = reply->extents.height;
|
||||
}
|
||||
|
||||
memcpy(rects,
|
||||
xcb_xfixes_fetch_region_rectangles(reply),
|
||||
sizeof(Ecore_X_Rectangle) * n);
|
||||
|
||||
return rects;
|
||||
#else
|
||||
if (num) *num = 0;
|
||||
if (bounds) *bounds = extents;
|
||||
#else /* ifdef ECORE_XCB_FIXES */
|
||||
if (num)
|
||||
*num = 0;
|
||||
|
||||
if (bounds)
|
||||
*bounds = extents;
|
||||
|
||||
return NULL;
|
||||
#endif /* ECORE_XCB_FIXES */
|
||||
}
|
||||
|
||||
} /* ecore_x_region_fetch */
|
||||
|
||||
/**
|
||||
* Expand a region.
|
||||
|
@ -497,8 +493,7 @@ ecore_x_region_expand(Ecore_X_Region dest,
|
|||
#ifdef ECORE_XCB_FIXES
|
||||
xcb_xfixes_expand_region(_ecore_xcb_conn, source, dest, left, right, top, bottom);
|
||||
#endif /* ECORE_XCB_FIXES */
|
||||
}
|
||||
|
||||
} /* ecore_x_region_expand */
|
||||
|
||||
/**
|
||||
* Change clip-mask in a graphic context to the specified region.
|
||||
|
@ -525,8 +520,7 @@ ecore_x_region_gc_clip_set(Ecore_X_Region region,
|
|||
#ifdef ECORE_XCB_FIXES
|
||||
xcb_xfixes_set_gc_clip_region(_ecore_xcb_conn, gc, region, x_origin, y_origin);
|
||||
#endif /* ECORE_XCB_FIXES */
|
||||
}
|
||||
|
||||
} /* ecore_x_region_gc_clip_set */
|
||||
|
||||
/**
|
||||
* Change the shape extension of a window.
|
||||
|
@ -551,8 +545,7 @@ ecore_x_region_window_shape_set(Ecore_X_Region region,
|
|||
#ifdef ECORE_XCB_FIXES
|
||||
xcb_xfixes_set_window_shape_region(_ecore_xcb_conn, dest, type, x_offset, y_offset, region);
|
||||
#endif /* ECORE_XCB_FIXES */
|
||||
}
|
||||
|
||||
} /* ecore_x_region_window_shape_set */
|
||||
|
||||
/**
|
||||
* Change clip-mask in picture to the specified region.
|
||||
|
@ -578,4 +571,5 @@ ecore_x_region_picture_clip_set(Ecore_X_Region region,
|
|||
#ifdef ECORE_XCB_FIXES
|
||||
xcb_xfixes_set_picture_clip_region(_ecore_xcb_conn, picture, region, x_origin, y_origin);
|
||||
#endif /* ECORE_XCB_FIXES */
|
||||
}
|
||||
} /* ecore_x_region_picture_clip_set */
|
||||
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
|
||||
#include "ecore_xcb_private.h"
|
||||
|
||||
|
||||
/**
|
||||
* Creates a new default graphics context associated with the given
|
||||
* drawable.
|
||||
|
@ -25,14 +24,14 @@ ecore_x_gc_new(Ecore_X_Drawable drawable, Ecore_X_GC_Value_Mask value_mask, cons
|
|||
{
|
||||
xcb_gcontext_t gc;
|
||||
|
||||
if (!drawable) drawable = ((xcb_screen_t *)_ecore_xcb_screen)->root;
|
||||
if (!drawable)
|
||||
drawable = ((xcb_screen_t *)_ecore_xcb_screen)->root;
|
||||
|
||||
gc = xcb_generate_id(_ecore_xcb_conn);
|
||||
xcb_create_gc(_ecore_xcb_conn, gc, drawable, value_mask, value_list);
|
||||
|
||||
return gc;
|
||||
}
|
||||
|
||||
} /* ecore_x_gc_new */
|
||||
|
||||
/**
|
||||
* Deletes and frees the given graphics context.
|
||||
|
@ -45,4 +44,5 @@ EAPI void
|
|||
ecore_x_gc_free(Ecore_X_GC gc)
|
||||
{
|
||||
xcb_free_gc(_ecore_xcb_conn, gc);
|
||||
}
|
||||
} /* ecore_x_gc_free */
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* Various MWM related functions.
|
||||
*
|
||||
*
|
||||
* This is ALL the code involving anything MWM related. for both WM and
|
||||
* client.
|
||||
*/
|
||||
|
@ -8,17 +8,16 @@
|
|||
#include "ecore_xcb_private.h"
|
||||
#include "Ecore_X_Atoms.h"
|
||||
|
||||
|
||||
/**
|
||||
* @defgroup Ecore_X_MWM_Group MWM related functions.
|
||||
*
|
||||
* Functions related to MWM.
|
||||
*/
|
||||
|
||||
#define ECORE_X_MWM_HINTS_FUNCTIONS (1 << 0)
|
||||
#define ECORE_X_MWM_HINTS_DECORATIONS (1 << 1)
|
||||
#define ECORE_X_MWM_HINTS_INPUT_MODE (1 << 2)
|
||||
#define ECORE_X_MWM_HINTS_STATUS (1 << 3)
|
||||
#define ECORE_X_MWM_HINTS_FUNCTIONS (1 << 0)
|
||||
#define ECORE_X_MWM_HINTS_DECORATIONS (1 << 1)
|
||||
#define ECORE_X_MWM_HINTS_INPUT_MODE (1 << 2)
|
||||
#define ECORE_X_MWM_HINTS_STATUS (1 << 3)
|
||||
|
||||
typedef struct _mwmhints
|
||||
{
|
||||
|
@ -30,7 +29,6 @@ typedef struct _mwmhints
|
|||
}
|
||||
MWMHints;
|
||||
|
||||
|
||||
/**
|
||||
* Sends the GetProperty request.
|
||||
* @param window Window whose MWM hints are requested.
|
||||
|
@ -47,8 +45,7 @@ ecore_x_mwm_hints_get_prefetch(Ecore_X_Window window)
|
|||
ECORE_X_ATOM_MOTIF_WM_HINTS,
|
||||
0, LONG_MAX);
|
||||
_ecore_xcb_cookie_cache(cookie.sequence);
|
||||
}
|
||||
|
||||
} /* ecore_x_mwm_hints_get_prefetch */
|
||||
|
||||
/**
|
||||
* Gets the reply of the GetProperty request sent by ecore_x_mwm_hints_get_prefetch().
|
||||
|
@ -63,7 +60,7 @@ ecore_x_mwm_hints_get_fetch(void)
|
|||
cookie.sequence = _ecore_xcb_cookie_get();
|
||||
reply = xcb_get_property_reply(_ecore_xcb_conn, cookie, NULL);
|
||||
_ecore_xcb_reply_cache(reply);
|
||||
}
|
||||
} /* ecore_x_mwm_hints_get_fetch */
|
||||
|
||||
/**
|
||||
* To document.
|
||||
|
@ -79,13 +76,13 @@ ecore_x_mwm_hints_get_fetch(void)
|
|||
* @ingroup Ecore_X_MWM_Group
|
||||
*/
|
||||
EAPI int
|
||||
ecore_x_mwm_hints_get(Ecore_X_Window window __UNUSED__,
|
||||
Ecore_X_MWM_Hint_Func *fhint,
|
||||
Ecore_X_MWM_Hint_Decor *dhint,
|
||||
Ecore_X_MWM_Hint_Input *ihint)
|
||||
ecore_x_mwm_hints_get(Ecore_X_Window window __UNUSED__,
|
||||
Ecore_X_MWM_Hint_Func *fhint,
|
||||
Ecore_X_MWM_Hint_Decor *dhint,
|
||||
Ecore_X_MWM_Hint_Input *ihint)
|
||||
{
|
||||
MWMHints *mwmhints = NULL;
|
||||
int ret = 0;
|
||||
MWMHints *mwmhints = NULL;
|
||||
int ret = 0;
|
||||
xcb_get_property_reply_t *reply;
|
||||
|
||||
reply = _ecore_xcb_reply_get();
|
||||
|
@ -102,29 +99,32 @@ ecore_x_mwm_hints_get(Ecore_X_Window window __UNUSED__,
|
|||
if (dhint)
|
||||
{
|
||||
if (mwmhints->flags & ECORE_X_MWM_HINTS_DECORATIONS)
|
||||
*dhint = mwmhints->decorations;
|
||||
*dhint = mwmhints->decorations;
|
||||
else
|
||||
*dhint = ECORE_X_MWM_HINT_DECOR_ALL;
|
||||
*dhint = ECORE_X_MWM_HINT_DECOR_ALL;
|
||||
}
|
||||
|
||||
if (fhint)
|
||||
{
|
||||
if (mwmhints->flags & ECORE_X_MWM_HINTS_FUNCTIONS)
|
||||
*fhint = mwmhints->functions;
|
||||
*fhint = mwmhints->functions;
|
||||
else
|
||||
*fhint = ECORE_X_MWM_HINT_FUNC_ALL;
|
||||
*fhint = ECORE_X_MWM_HINT_FUNC_ALL;
|
||||
}
|
||||
|
||||
if (ihint)
|
||||
{
|
||||
if (mwmhints->flags & ECORE_X_MWM_HINTS_INPUT_MODE)
|
||||
*ihint = mwmhints->inputmode;
|
||||
*ihint = mwmhints->inputmode;
|
||||
else
|
||||
*ihint = ECORE_X_MWM_HINT_INPUT_MODELESS;
|
||||
*ihint = ECORE_X_MWM_HINT_INPUT_MODELESS;
|
||||
}
|
||||
|
||||
ret = 1;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
} /* ecore_x_mwm_hints_get */
|
||||
|
||||
/**
|
||||
* Sets the borderless flag of a window using MWM.
|
||||
|
@ -140,10 +140,12 @@ ecore_x_mwm_borderless_set(Ecore_X_Window window,
|
|||
|
||||
data[0] = 2; /* just set the decorations hint! */
|
||||
data[2] = !borderless;
|
||||
|
||||
if (window == 0) window = ((xcb_screen_t *)_ecore_xcb_screen)->root;
|
||||
|
||||
if (window == 0)
|
||||
window = ((xcb_screen_t *)_ecore_xcb_screen)->root;
|
||||
|
||||
xcb_change_property(_ecore_xcb_conn, XCB_PROP_MODE_REPLACE, window,
|
||||
ECORE_X_ATOM_MOTIF_WM_HINTS, ECORE_X_ATOM_MOTIF_WM_HINTS,
|
||||
32, 5, data);
|
||||
}
|
||||
} /* ecore_x_mwm_borderless_set */
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -4,14 +4,12 @@
|
|||
|
||||
#include "ecore_xcb_private.h"
|
||||
|
||||
|
||||
/**
|
||||
* @defgroup Ecore_X_Pixmap_Group X Pixmap Functions
|
||||
*
|
||||
* Functions that operate on pixmaps.
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Creates a new pixmap.
|
||||
* @param win Window used to determine which screen of the display the
|
||||
|
@ -32,15 +30,17 @@ ecore_x_pixmap_new(Ecore_X_Window win,
|
|||
{
|
||||
Ecore_X_Pixmap pmap;
|
||||
|
||||
if (win == 0) win = ((xcb_screen_t *)_ecore_xcb_screen)->root;
|
||||
if (dep == 0) dep = ((xcb_screen_t *)_ecore_xcb_screen)->root_depth;
|
||||
if (win == 0)
|
||||
win = ((xcb_screen_t *)_ecore_xcb_screen)->root;
|
||||
|
||||
if (dep == 0)
|
||||
dep = ((xcb_screen_t *)_ecore_xcb_screen)->root_depth;
|
||||
|
||||
pmap = xcb_generate_id(_ecore_xcb_conn);
|
||||
xcb_create_pixmap(_ecore_xcb_conn, dep, pmap, win, w, h);
|
||||
|
||||
return pmap;
|
||||
}
|
||||
|
||||
} /* ecore_x_pixmap_new */
|
||||
|
||||
/**
|
||||
* Deletes the reference to the given pixmap.
|
||||
|
@ -55,8 +55,7 @@ EAPI void
|
|||
ecore_x_pixmap_free(Ecore_X_Pixmap pmap)
|
||||
{
|
||||
xcb_free_pixmap(_ecore_xcb_conn, pmap);
|
||||
}
|
||||
|
||||
} /* ecore_x_pixmap_free */
|
||||
|
||||
/**
|
||||
* Pastes a rectangular area of the given pixmap onto the given drawable.
|
||||
|
@ -75,17 +74,16 @@ ecore_x_pixmap_free(Ecore_X_Pixmap pmap)
|
|||
EAPI void
|
||||
ecore_x_pixmap_paste(Ecore_X_Pixmap pmap,
|
||||
Ecore_X_Drawable dest,
|
||||
Ecore_X_GC gc,
|
||||
Ecore_X_GC gc,
|
||||
int sx,
|
||||
int sy,
|
||||
int w,
|
||||
int w,
|
||||
int h,
|
||||
int dx,
|
||||
int dy)
|
||||
{
|
||||
xcb_copy_area(_ecore_xcb_conn, pmap, dest, gc, sx, sy, dx, dy, w, h);
|
||||
}
|
||||
|
||||
} /* ecore_x_pixmap_paste */
|
||||
|
||||
/**
|
||||
* Retrieves the size of the given pixmap.
|
||||
|
@ -101,8 +99,7 @@ ecore_x_pixmap_geometry_get(Ecore_X_Pixmap pmap, int *x, int *y, int *w, int *h)
|
|||
{
|
||||
if (pmap)
|
||||
ecore_x_drawable_geometry_get(pmap, x, y, w, h);
|
||||
}
|
||||
|
||||
} /* ecore_x_pixmap_geometry_get */
|
||||
|
||||
/**
|
||||
* Retrieves the depth of the given pixmap.
|
||||
|
@ -114,4 +111,5 @@ EAPI int
|
|||
ecore_x_pixmap_depth_get(Ecore_X_Pixmap pmap)
|
||||
{
|
||||
return ecore_x_drawable_depth_get(pmap);
|
||||
}
|
||||
} /* ecore_x_pixmap_depth_get */
|
||||
|
||||
|
|
|
@ -7,10 +7,10 @@
|
|||
|
||||
#ifndef MAXHOSTNAMELEN
|
||||
# define MAXHOSTNAMELEN 256
|
||||
#endif
|
||||
#endif /* ifndef MAXHOSTNAMELEN */
|
||||
|
||||
#ifndef XK_MISCELLANY
|
||||
# define XK_MISCELLANY 1
|
||||
# define XK_MISCELLANY 1
|
||||
#endif /* XK_MISCELLANY */
|
||||
|
||||
#include <xcb/xcb.h>
|
||||
|
@ -58,72 +58,72 @@
|
|||
#include "ecore_private.h"
|
||||
#include "Ecore_X.h"
|
||||
|
||||
extern int _ecore_x11xcb_log_dom ;
|
||||
extern int _ecore_x11xcb_log_dom;
|
||||
|
||||
#ifdef ECORE_XLIB_XCB_DEFAULT_LOG_COLOR
|
||||
# undef ECORE_XLIB_XCB_DEFAULT_LOG_COLOR
|
||||
#endif
|
||||
#endif /* ifdef ECORE_XLIB_XCB_DEFAULT_LOG_COLOR */
|
||||
#define ECORE_XLIB_XCB_DEFAULT_LOG_COLOR EINA_COLOR_BLUE
|
||||
|
||||
#ifdef ERR
|
||||
# undef ERR
|
||||
#endif
|
||||
#endif /* ifdef ERR */
|
||||
#define ERR(...) EINA_LOG_DOM_ERR(_ecore_x11xcb_log_dom, __VA_ARGS__)
|
||||
|
||||
#ifdef DBG
|
||||
# undef DBG
|
||||
#endif
|
||||
#endif /* ifdef DBG */
|
||||
#define DBG(...) EINA_LOG_DOM_DBG(_ecore_x11xcb_log_dom, __VA_ARGS__)
|
||||
|
||||
#ifdef INF
|
||||
# undef INF
|
||||
#endif
|
||||
#endif /* ifdef INF */
|
||||
#define INF(...) EINA_LOG_DOM_INFO(_ecore_x11xcb_log_dom, __VA_ARGS__)
|
||||
|
||||
#ifdef WRN
|
||||
# undef WRN
|
||||
#endif
|
||||
#endif /* ifdef WRN */
|
||||
#define WRN(...) EINA_LOG_DOM_WARN(_ecore_x11xcb_log_dom, __VA_ARGS__)
|
||||
|
||||
#ifdef CRIT
|
||||
# undef CRIT
|
||||
#endif
|
||||
#endif /* ifdef CRIT */
|
||||
#define CRIT(...) EINA_LOG_DOM_CRIT(_ecore_x11xcb_log_dom, __VA_ARGS__)
|
||||
|
||||
typedef struct _Ecore_X_Selection_Intern Ecore_X_Selection_Intern;
|
||||
typedef struct _Ecore_X_Selection_Intern Ecore_X_Selection_Intern;
|
||||
|
||||
struct _Ecore_X_Selection_Intern
|
||||
{
|
||||
Ecore_X_Window win;
|
||||
Ecore_X_Atom selection;
|
||||
unsigned char *data;
|
||||
int length;
|
||||
Ecore_X_Time time;
|
||||
Ecore_X_Window win;
|
||||
Ecore_X_Atom selection;
|
||||
unsigned char *data;
|
||||
int length;
|
||||
Ecore_X_Time time;
|
||||
};
|
||||
|
||||
typedef struct _Ecore_X_Selection_Converter Ecore_X_Selection_Converter;
|
||||
typedef struct _Ecore_X_Selection_Converter Ecore_X_Selection_Converter;
|
||||
|
||||
struct _Ecore_X_Selection_Converter
|
||||
{
|
||||
Ecore_X_Atom target;
|
||||
int (*convert)(char *target, void *data, int size,
|
||||
void **data_ret, int *size_ret,
|
||||
Ecore_X_Atom *type, int *typeseize);
|
||||
Ecore_X_Atom target;
|
||||
int (*convert)(char *target, void *data, int size,
|
||||
void **data_ret, int *size_ret,
|
||||
Ecore_X_Atom *type, int *typeseize);
|
||||
Ecore_X_Selection_Converter *next;
|
||||
};
|
||||
|
||||
typedef struct _Ecore_X_Selection_Parser Ecore_X_Selection_Parser;
|
||||
typedef struct _Ecore_X_Selection_Parser Ecore_X_Selection_Parser;
|
||||
|
||||
struct _Ecore_X_Selection_Parser
|
||||
{
|
||||
char *target;
|
||||
void *(*parse)(const char *target, void *data, int size, int format);
|
||||
char *target;
|
||||
void *(*parse)(const char *target, void *data, int size, int format);
|
||||
Ecore_X_Selection_Parser *next;
|
||||
};
|
||||
|
||||
typedef struct _Ecore_X_DND_Source
|
||||
{
|
||||
int version;
|
||||
int version;
|
||||
Ecore_X_Window win, dest;
|
||||
|
||||
enum {
|
||||
|
@ -133,29 +133,31 @@ typedef struct _Ecore_X_DND_Source
|
|||
ECORE_X_DND_SOURCE_CONVERTING
|
||||
} state;
|
||||
|
||||
struct {
|
||||
short x, y;
|
||||
struct
|
||||
{
|
||||
short x, y;
|
||||
unsigned short width, height;
|
||||
} rectangle;
|
||||
|
||||
struct {
|
||||
struct
|
||||
{
|
||||
Ecore_X_Window window;
|
||||
int x, y;
|
||||
int x, y;
|
||||
} prev;
|
||||
|
||||
|
||||
Ecore_X_Time time;
|
||||
|
||||
Ecore_X_Atom action, accepted_action;
|
||||
|
||||
int will_accept;
|
||||
int suppress;
|
||||
int will_accept;
|
||||
int suppress;
|
||||
|
||||
int await_status;
|
||||
int await_status;
|
||||
} Ecore_X_DND_Source;
|
||||
|
||||
typedef struct _Ecore_X_DND_Target
|
||||
{
|
||||
int version;
|
||||
int version;
|
||||
Ecore_X_Window win, source;
|
||||
|
||||
enum {
|
||||
|
@ -163,7 +165,8 @@ typedef struct _Ecore_X_DND_Target
|
|||
ECORE_X_DND_TARGET_ENTERED
|
||||
} state;
|
||||
|
||||
struct {
|
||||
struct
|
||||
{
|
||||
int x, y;
|
||||
} pos;
|
||||
|
||||
|
@ -171,101 +174,98 @@ typedef struct _Ecore_X_DND_Target
|
|||
|
||||
Ecore_X_Atom action, accepted_action;
|
||||
|
||||
int will_accept;
|
||||
int will_accept;
|
||||
} Ecore_X_DND_Target;
|
||||
|
||||
extern int ECORE_X_MODIFIER_SHIFT;
|
||||
extern int ECORE_X_MODIFIER_CTRL;
|
||||
extern int ECORE_X_MODIFIER_ALT;
|
||||
extern int ECORE_X_MODIFIER_WIN;
|
||||
|
||||
extern int ECORE_X_LOCK_SCROLL;
|
||||
extern int ECORE_X_LOCK_NUM;
|
||||
extern int ECORE_X_LOCK_CAPS;
|
||||
extern int ECORE_X_MODIFIER_CTRL;
|
||||
extern int ECORE_X_MODIFIER_ALT;
|
||||
extern int ECORE_X_MODIFIER_WIN;
|
||||
|
||||
extern int ECORE_X_LOCK_SCROLL;
|
||||
extern int ECORE_X_LOCK_NUM;
|
||||
extern int ECORE_X_LOCK_CAPS;
|
||||
|
||||
extern Ecore_X_Connection *_ecore_xcb_conn;
|
||||
extern Ecore_X_Screen *_ecore_xcb_screen;
|
||||
extern double _ecore_xcb_double_click_time;
|
||||
extern Ecore_X_Time _ecore_xcb_event_last_time;
|
||||
extern Ecore_X_Window _ecore_xcb_event_last_window;
|
||||
extern int16_t _ecore_xcb_event_last_root_x;
|
||||
extern int16_t _ecore_xcb_event_last_root_y;
|
||||
extern int _ecore_xcb_xcursor;
|
||||
extern Ecore_X_Screen *_ecore_xcb_screen;
|
||||
extern double _ecore_xcb_double_click_time;
|
||||
extern Ecore_X_Time _ecore_xcb_event_last_time;
|
||||
extern Ecore_X_Window _ecore_xcb_event_last_window;
|
||||
extern int16_t _ecore_xcb_event_last_root_x;
|
||||
extern int16_t _ecore_xcb_event_last_root_y;
|
||||
extern int _ecore_xcb_xcursor;
|
||||
|
||||
extern Ecore_X_Atom _ecore_xcb_atoms_wm_protocols[ECORE_X_WM_PROTOCOL_NUM];
|
||||
extern Ecore_X_Atom _ecore_xcb_atoms_wm_protocols[ECORE_X_WM_PROTOCOL_NUM];
|
||||
|
||||
extern int _ecore_window_grabs_num;
|
||||
extern Ecore_X_Window *_ecore_window_grabs;
|
||||
extern int (*_ecore_window_grab_replay_func) (void *data, int event_type, void *event);
|
||||
extern void *_ecore_window_grab_replay_data;
|
||||
extern int _ecore_window_grabs_num;
|
||||
extern Ecore_X_Window *_ecore_window_grabs;
|
||||
extern int (*_ecore_window_grab_replay_func)(void *data, int event_type, void *event);
|
||||
extern void *_ecore_window_grab_replay_data;
|
||||
|
||||
extern Ecore_X_Window _ecore_xcb_private_window;
|
||||
extern Ecore_X_Window _ecore_xcb_private_window;
|
||||
|
||||
void _ecore_x_error_handler_init(void);
|
||||
|
||||
void _ecore_x_error_handler_init(void);
|
||||
|
||||
void _ecore_x_event_handle_any_event (xcb_generic_event_t *event);
|
||||
void _ecore_x_event_handle_key_press (xcb_generic_event_t *event);
|
||||
void _ecore_x_event_handle_key_release (xcb_generic_event_t *event);
|
||||
void _ecore_x_event_handle_button_press (xcb_generic_event_t *event);
|
||||
void _ecore_x_event_handle_button_release (xcb_generic_event_t *event);
|
||||
void _ecore_x_event_handle_motion_notify (xcb_generic_event_t *event);
|
||||
void _ecore_x_event_handle_enter_notify (xcb_generic_event_t *event);
|
||||
void _ecore_x_event_handle_leave_notify (xcb_generic_event_t *event);
|
||||
void _ecore_x_event_handle_focus_in (xcb_generic_event_t *event);
|
||||
void _ecore_x_event_handle_focus_out (xcb_generic_event_t *event);
|
||||
void _ecore_x_event_handle_keymap_notify (xcb_generic_event_t *event);
|
||||
void _ecore_x_event_handle_expose (xcb_generic_event_t *event);
|
||||
void _ecore_x_event_handle_graphics_expose (xcb_generic_event_t *event);
|
||||
void _ecore_x_event_handle_visibility_notify (xcb_generic_event_t *event);
|
||||
void _ecore_x_event_handle_create_notify (xcb_generic_event_t *event);
|
||||
void _ecore_x_event_handle_destroy_notify (xcb_generic_event_t *event);
|
||||
void _ecore_x_event_handle_unmap_notify (xcb_generic_event_t *event);
|
||||
void _ecore_x_event_handle_map_notify (xcb_generic_event_t *event);
|
||||
void _ecore_x_event_handle_map_request (xcb_generic_event_t *event);
|
||||
void _ecore_x_event_handle_reparent_notify (xcb_generic_event_t *event);
|
||||
void _ecore_x_event_handle_configure_notify (xcb_generic_event_t *event);
|
||||
void _ecore_x_event_handle_configure_request (xcb_generic_event_t *event);
|
||||
void _ecore_x_event_handle_gravity_notify (xcb_generic_event_t *event);
|
||||
void _ecore_x_event_handle_resize_request (xcb_generic_event_t *event);
|
||||
void _ecore_x_event_handle_circulate_notify (xcb_generic_event_t *event);
|
||||
void _ecore_x_event_handle_circulate_request (xcb_generic_event_t *event);
|
||||
void _ecore_x_event_handle_property_notify (xcb_generic_event_t *event);
|
||||
void _ecore_x_event_handle_selection_clear (xcb_generic_event_t *event);
|
||||
void _ecore_x_event_handle_selection_request (xcb_generic_event_t *event);
|
||||
void _ecore_x_event_handle_selection_notify (xcb_generic_event_t *event);
|
||||
void _ecore_x_event_handle_colormap_notify (xcb_generic_event_t *event);
|
||||
void _ecore_x_event_handle_client_message (xcb_generic_event_t *event);
|
||||
void _ecore_x_event_handle_mapping_notify (xcb_generic_event_t *event);
|
||||
void _ecore_x_event_handle_any_event (xcb_generic_event_t *event);
|
||||
void _ecore_x_event_handle_key_press (xcb_generic_event_t *event);
|
||||
void _ecore_x_event_handle_key_release (xcb_generic_event_t *event);
|
||||
void _ecore_x_event_handle_button_press (xcb_generic_event_t *event);
|
||||
void _ecore_x_event_handle_button_release (xcb_generic_event_t *event);
|
||||
void _ecore_x_event_handle_motion_notify (xcb_generic_event_t *event);
|
||||
void _ecore_x_event_handle_enter_notify (xcb_generic_event_t *event);
|
||||
void _ecore_x_event_handle_leave_notify (xcb_generic_event_t *event);
|
||||
void _ecore_x_event_handle_focus_in (xcb_generic_event_t *event);
|
||||
void _ecore_x_event_handle_focus_out (xcb_generic_event_t *event);
|
||||
void _ecore_x_event_handle_keymap_notify (xcb_generic_event_t *event);
|
||||
void _ecore_x_event_handle_expose (xcb_generic_event_t *event);
|
||||
void _ecore_x_event_handle_graphics_expose (xcb_generic_event_t *event);
|
||||
void _ecore_x_event_handle_visibility_notify (xcb_generic_event_t *event);
|
||||
void _ecore_x_event_handle_create_notify (xcb_generic_event_t *event);
|
||||
void _ecore_x_event_handle_destroy_notify (xcb_generic_event_t *event);
|
||||
void _ecore_x_event_handle_unmap_notify (xcb_generic_event_t *event);
|
||||
void _ecore_x_event_handle_map_notify (xcb_generic_event_t *event);
|
||||
void _ecore_x_event_handle_map_request (xcb_generic_event_t *event);
|
||||
void _ecore_x_event_handle_reparent_notify (xcb_generic_event_t *event);
|
||||
void _ecore_x_event_handle_configure_notify (xcb_generic_event_t *event);
|
||||
void _ecore_x_event_handle_configure_request (xcb_generic_event_t *event);
|
||||
void _ecore_x_event_handle_gravity_notify (xcb_generic_event_t *event);
|
||||
void _ecore_x_event_handle_resize_request (xcb_generic_event_t *event);
|
||||
void _ecore_x_event_handle_circulate_notify (xcb_generic_event_t *event);
|
||||
void _ecore_x_event_handle_circulate_request (xcb_generic_event_t *event);
|
||||
void _ecore_x_event_handle_property_notify (xcb_generic_event_t *event);
|
||||
void _ecore_x_event_handle_selection_clear (xcb_generic_event_t *event);
|
||||
void _ecore_x_event_handle_selection_request (xcb_generic_event_t *event);
|
||||
void _ecore_x_event_handle_selection_notify (xcb_generic_event_t *event);
|
||||
void _ecore_x_event_handle_colormap_notify (xcb_generic_event_t *event);
|
||||
void _ecore_x_event_handle_client_message (xcb_generic_event_t *event);
|
||||
void _ecore_x_event_handle_mapping_notify (xcb_generic_event_t *event);
|
||||
#ifdef ECORE_XCB_DAMAGE
|
||||
void _ecore_x_event_handle_damage_notify (xcb_generic_event_t *event);
|
||||
void _ecore_x_event_handle_damage_notify (xcb_generic_event_t *event);
|
||||
#endif /* ECORE_XCB_DAMAGE */
|
||||
#ifdef ECORE_XCB_RANDR
|
||||
void _ecore_x_event_handle_randr_change (xcb_generic_event_t *event);
|
||||
void _ecore_x_event_handle_randr_change (xcb_generic_event_t *event);
|
||||
#endif /* ECORE_XCB_RANDR */
|
||||
#ifdef ECORE_XCB_SCREENSAVER
|
||||
void _ecore_x_event_handle_screensaver_notify (xcb_generic_event_t *event);
|
||||
void _ecore_x_event_handle_screensaver_notify (xcb_generic_event_t *event);
|
||||
#endif /* ECORE_XCB_SCREENSAVER */
|
||||
#ifdef ECORE_XCB_SHAPE
|
||||
void _ecore_x_event_handle_shape_change (xcb_generic_event_t *event);
|
||||
void _ecore_x_event_handle_shape_change (xcb_generic_event_t *event);
|
||||
#endif /* ECORE_XCB_SHAPE */
|
||||
#ifdef ECORE_XCB_SYNC
|
||||
void _ecore_x_event_handle_sync_counter (xcb_generic_event_t *event);
|
||||
void _ecore_x_event_handle_sync_alarm (xcb_generic_event_t *event);
|
||||
void _ecore_x_event_handle_sync_counter (xcb_generic_event_t *event);
|
||||
void _ecore_x_event_handle_sync_alarm (xcb_generic_event_t *event);
|
||||
#endif /* ECORE_XCB_SYNC */
|
||||
#ifdef ECORE_XCB_FIXES
|
||||
void _ecore_x_event_handle_fixes_selection_notify(xcb_generic_event_t *event);
|
||||
void _ecore_x_event_handle_fixes_selection_notify(xcb_generic_event_t *event);
|
||||
#endif /* ECORE_XCB_FIXES */
|
||||
|
||||
|
||||
/* requests / replies */
|
||||
int _ecore_x_reply_init ();
|
||||
void _ecore_x_reply_shutdown ();
|
||||
void _ecore_xcb_cookie_cache (unsigned int cookie);
|
||||
unsigned int _ecore_xcb_cookie_get (void);
|
||||
void _ecore_xcb_reply_cache (void *reply);
|
||||
void *_ecore_xcb_reply_get (void);
|
||||
|
||||
int _ecore_x_reply_init ();
|
||||
void _ecore_x_reply_shutdown ();
|
||||
void _ecore_xcb_cookie_cache (unsigned int cookie);
|
||||
unsigned int _ecore_xcb_cookie_get (void);
|
||||
void _ecore_xcb_reply_cache (void *reply);
|
||||
void * _ecore_xcb_reply_get (void);
|
||||
|
||||
/* atoms */
|
||||
extern Ecore_X_Atom ECORE_X_ATOM_ATOM;
|
||||
|
@ -277,88 +277,76 @@ extern Ecore_X_Atom ECORE_X_ATOM_WM_SIZE_HINTS;
|
|||
|
||||
#define ECORE_X_ATOMS_COUNT 117
|
||||
|
||||
void _ecore_x_atom_init (xcb_intern_atom_cookie_t *);
|
||||
void _ecore_x_atom_init_finalize (xcb_intern_atom_cookie_t *);
|
||||
|
||||
void _ecore_x_atom_init (xcb_intern_atom_cookie_t *);
|
||||
void _ecore_x_atom_init_finalize (xcb_intern_atom_cookie_t *);
|
||||
|
||||
/* damage */
|
||||
void _ecore_x_damage_init (const xcb_query_extension_reply_t *reply);
|
||||
void _ecore_x_damage_init_finalize (void);
|
||||
void _ecore_x_damage_init (const xcb_query_extension_reply_t *reply);
|
||||
void _ecore_x_damage_init_finalize (void);
|
||||
|
||||
/* composite */
|
||||
void _ecore_x_composite_init (const xcb_query_extension_reply_t *reply);
|
||||
void _ecore_x_composite_init_finalize (void);
|
||||
void _ecore_x_composite_init (const xcb_query_extension_reply_t *reply);
|
||||
void _ecore_x_composite_init_finalize (void);
|
||||
|
||||
/* from dnd */
|
||||
void _ecore_x_dnd_init (void);
|
||||
void _ecore_x_dnd_shutdown (void);
|
||||
Ecore_X_DND_Source *_ecore_x_dnd_source_get (void);
|
||||
Ecore_X_DND_Target *_ecore_x_dnd_target_get (void);
|
||||
void _ecore_x_dnd_drag (Ecore_X_Window root,
|
||||
int x,
|
||||
int y);
|
||||
|
||||
void _ecore_x_dnd_init (void);
|
||||
void _ecore_x_dnd_shutdown (void);
|
||||
Ecore_X_DND_Source * _ecore_x_dnd_source_get (void);
|
||||
Ecore_X_DND_Target * _ecore_x_dnd_target_get (void);
|
||||
void _ecore_x_dnd_drag (Ecore_X_Window root,
|
||||
int x,
|
||||
int y);
|
||||
|
||||
/* dpms */
|
||||
void _ecore_x_dpms_init (const xcb_query_extension_reply_t *reply);
|
||||
void _ecore_x_dpms_init_finalize (void);
|
||||
|
||||
void _ecore_x_dpms_init (const xcb_query_extension_reply_t *reply);
|
||||
void _ecore_x_dpms_init_finalize (void);
|
||||
|
||||
/* netwm */
|
||||
Ecore_X_Window_State _ecore_x_netwm_state_get(Ecore_X_Atom a);
|
||||
int _ecore_x_netwm_startup_info_begin(Ecore_X_Window win, char *data);
|
||||
int _ecore_x_netwm_startup_info(Ecore_X_Window win, char *data);
|
||||
|
||||
Ecore_X_Window_State _ecore_x_netwm_state_get(Ecore_X_Atom a);
|
||||
int _ecore_x_netwm_startup_info_begin(Ecore_X_Window win, char *data);
|
||||
int _ecore_x_netwm_startup_info(Ecore_X_Window win, char *data);
|
||||
|
||||
/* randr */
|
||||
void _ecore_x_randr_init (const xcb_query_extension_reply_t *reply);
|
||||
void _ecore_x_randr_init_finalize (void);
|
||||
|
||||
void _ecore_x_randr_init (const xcb_query_extension_reply_t *reply);
|
||||
void _ecore_x_randr_init_finalize (void);
|
||||
|
||||
/* selection */
|
||||
void _ecore_x_selection_init(void);
|
||||
void _ecore_x_selection_shutdown(void);
|
||||
Ecore_X_Atom _ecore_x_selection_target_atom_get(const char *target);
|
||||
char *_ecore_x_selection_target_get(Ecore_X_Atom target);
|
||||
Ecore_X_Selection_Intern *_ecore_x_selection_get(Ecore_X_Atom selection);
|
||||
int _ecore_x_selection_set(Ecore_X_Window w, const void *data, int len, Ecore_X_Atom selection);
|
||||
int _ecore_x_selection_convert(Ecore_X_Atom selection, Ecore_X_Atom target, void **data_ret);
|
||||
void *_ecore_x_selection_parse(const char *target, void *data, int size, int format);
|
||||
|
||||
void _ecore_x_selection_init(void);
|
||||
void _ecore_x_selection_shutdown(void);
|
||||
Ecore_X_Atom _ecore_x_selection_target_atom_get(const char *target);
|
||||
char * _ecore_x_selection_target_get(Ecore_X_Atom target);
|
||||
Ecore_X_Selection_Intern * _ecore_x_selection_get(Ecore_X_Atom selection);
|
||||
int _ecore_x_selection_set(Ecore_X_Window w, const void *data, int len, Ecore_X_Atom selection);
|
||||
int _ecore_x_selection_convert(Ecore_X_Atom selection, Ecore_X_Atom target, void **data_ret);
|
||||
void * _ecore_x_selection_parse(const char *target, void *data, int size, int format);
|
||||
|
||||
/* screensaver */
|
||||
void _ecore_x_screensaver_init (const xcb_query_extension_reply_t *reply);
|
||||
void _ecore_x_screensaver_init_finalize (void);
|
||||
|
||||
void _ecore_x_screensaver_init (const xcb_query_extension_reply_t *reply);
|
||||
void _ecore_x_screensaver_init_finalize (void);
|
||||
|
||||
/* shape */
|
||||
void _ecore_x_shape_init (const xcb_query_extension_reply_t *reply);
|
||||
void _ecore_x_shape_init_finalize (void);
|
||||
|
||||
void _ecore_x_shape_init (const xcb_query_extension_reply_t *reply);
|
||||
void _ecore_x_shape_init_finalize (void);
|
||||
|
||||
/* sync */
|
||||
void _ecore_x_sync_init (const xcb_query_extension_reply_t *reply);
|
||||
void _ecore_x_sync_init_finalize (void);
|
||||
|
||||
void _ecore_x_sync_init (const xcb_query_extension_reply_t *reply);
|
||||
void _ecore_x_sync_init_finalize (void);
|
||||
|
||||
/* xfixes */
|
||||
void _ecore_x_xfixes_init (const xcb_query_extension_reply_t *reply);
|
||||
void _ecore_x_xfixes_init_finalize (void);
|
||||
|
||||
void _ecore_x_xfixes_init (const xcb_query_extension_reply_t *reply);
|
||||
void _ecore_x_xfixes_init_finalize (void);
|
||||
|
||||
/* xinerama */
|
||||
void _ecore_x_xinerama_init (const xcb_query_extension_reply_t *reply);
|
||||
void _ecore_x_xinerama_init_finalize (void);
|
||||
|
||||
void _ecore_x_xinerama_init (const xcb_query_extension_reply_t *reply);
|
||||
void _ecore_x_xinerama_init_finalize (void);
|
||||
|
||||
/* xprint */
|
||||
void _ecore_x_xprint_init (const xcb_query_extension_reply_t *reply);
|
||||
void _ecore_x_xprint_init_finalize (void);
|
||||
void _ecore_x_xprint_init (const xcb_query_extension_reply_t *reply);
|
||||
void _ecore_x_xprint_init_finalize (void);
|
||||
|
||||
/* to categorize */
|
||||
void _ecore_x_sync_magic_send(int val, Ecore_X_Window swin);
|
||||
void _ecore_x_window_grab_remove(Ecore_X_Window win);
|
||||
void _ecore_x_key_grab_remove(Ecore_X_Window win);
|
||||
|
||||
void _ecore_x_sync_magic_send(int val, Ecore_X_Window swin);
|
||||
void _ecore_x_window_grab_remove(Ecore_X_Window win);
|
||||
void _ecore_x_key_grab_remove(Ecore_X_Window win);
|
||||
|
||||
#endif /* __ECORE_XCB_PRIVATE_H__*/
|
||||
|
|
|
@ -4,20 +4,17 @@
|
|||
|
||||
#include "ecore_xcb_private.h"
|
||||
|
||||
|
||||
/**
|
||||
* @defgroup Ecore_X_RandR_Group X RandR Extension Functions
|
||||
*
|
||||
* Functions related to the X RandR extension.
|
||||
*/
|
||||
|
||||
|
||||
#ifdef ECORE_XCB_RANDR
|
||||
static int _randr_available = 0;
|
||||
static xcb_randr_query_version_cookie_t _ecore_xcb_randr_init_cookie;
|
||||
#endif /* ECORE_XCB_RANDR */
|
||||
|
||||
|
||||
/* To avoid round trips, the initialization is separated in 2
|
||||
functions: _ecore_xcb_randr_init and
|
||||
_ecore_xcb_randr_init_finalize. The first one gets the cookies and
|
||||
|
@ -29,8 +26,9 @@ _ecore_x_randr_init(const xcb_query_extension_reply_t *reply)
|
|||
#ifdef ECORE_XCB_RANDR
|
||||
if (reply && (reply->present))
|
||||
_ecore_xcb_randr_init_cookie = xcb_randr_query_version_unchecked(_ecore_xcb_conn, 1, 2);
|
||||
|
||||
#endif /* ECORE_XCB_RANDR */
|
||||
}
|
||||
} /* _ecore_x_randr_init */
|
||||
|
||||
void
|
||||
_ecore_x_randr_init_finalize(void)
|
||||
|
@ -45,11 +43,13 @@ _ecore_x_randr_init_finalize(void)
|
|||
{
|
||||
if ((reply->major_version >= 1) &&
|
||||
(reply->minor_version >= 1))
|
||||
_randr_available = 1;
|
||||
_randr_available = 1;
|
||||
|
||||
free(reply);
|
||||
}
|
||||
|
||||
#endif /* ECORE_XCB_RANDR */
|
||||
}
|
||||
} /* _ecore_x_randr_init_finalize */
|
||||
|
||||
/**
|
||||
* Return whether the X server supports the RandR Extension.
|
||||
|
@ -64,11 +64,10 @@ ecore_x_randr_query(void)
|
|||
{
|
||||
#ifdef ECORE_XCB_RANDR
|
||||
return _randr_available;
|
||||
#else
|
||||
#else /* ifdef ECORE_XCB_RANDR */
|
||||
return 0;
|
||||
#endif /* ECORE_XCB_RANDR */
|
||||
}
|
||||
|
||||
} /* ecore_x_randr_query */
|
||||
|
||||
static Ecore_X_Window
|
||||
_xcb_randr_root_to_screen(Ecore_X_Window root)
|
||||
|
@ -79,11 +78,11 @@ _xcb_randr_root_to_screen(Ecore_X_Window root)
|
|||
for (; iter.rem; xcb_screen_next(&iter))
|
||||
{
|
||||
if (iter.data->root == root)
|
||||
return iter.data->root;
|
||||
return iter.data->root;
|
||||
}
|
||||
|
||||
return XCB_NONE;
|
||||
}
|
||||
} /* _xcb_randr_root_to_screen */
|
||||
|
||||
/**
|
||||
* Select if the ScreenChangeNotify events will be sent.
|
||||
|
@ -104,13 +103,13 @@ ecore_x_randr_events_select(Ecore_X_Window window,
|
|||
int on)
|
||||
{
|
||||
#ifdef ECORE_XCB_RANDR
|
||||
xcb_randr_select_input(_ecore_xcb_conn, window,
|
||||
on ? XCB_RANDR_SCREEN_CHANGE_NOTIFY : 0);
|
||||
return 1;
|
||||
#else
|
||||
xcb_randr_select_input(_ecore_xcb_conn, window,
|
||||
on ? XCB_RANDR_SCREEN_CHANGE_NOTIFY : 0);
|
||||
return 1;
|
||||
#else /* ifdef ECORE_XCB_RANDR */
|
||||
return 0;
|
||||
#endif /* ECORE_XCB_RANDR */
|
||||
}
|
||||
} /* ecore_x_randr_events_select */
|
||||
|
||||
/**
|
||||
* Sends the GetScreenInfo request.
|
||||
|
@ -127,8 +126,7 @@ ecore_x_randr_get_screen_info_prefetch(Ecore_X_Window window)
|
|||
_xcb_randr_root_to_screen(window));
|
||||
_ecore_xcb_cookie_cache(cookie.sequence);
|
||||
#endif /* ECORE_XCB_RANDR */
|
||||
}
|
||||
|
||||
} /* ecore_x_randr_get_screen_info_prefetch */
|
||||
|
||||
/**
|
||||
* Gets the reply of the GetScreenInfo request sent by ecore_x_randr_get_screen_info_prefetch().
|
||||
|
@ -145,7 +143,7 @@ ecore_x_randr_get_screen_info_fetch(void)
|
|||
reply = xcb_randr_get_screen_info_reply(_ecore_xcb_conn, cookie, NULL);
|
||||
_ecore_xcb_reply_cache(reply);
|
||||
#endif /* ECORE_XCB_RANDR */
|
||||
}
|
||||
} /* ecore_x_randr_get_screen_info_fetch */
|
||||
|
||||
/**
|
||||
* Get the set of rotations and reflections.
|
||||
|
@ -169,13 +167,13 @@ ecore_x_randr_screen_rotations_get(Ecore_X_Window root __UNUSED__)
|
|||
|
||||
reply = _ecore_xcb_reply_get();
|
||||
if (!reply)
|
||||
return 0;
|
||||
return 0;
|
||||
|
||||
return reply->rotations;
|
||||
#else
|
||||
#else /* ifdef ECORE_XCB_RANDR */
|
||||
return 0;
|
||||
#endif /* ECORE_XCB_RANDR */
|
||||
}
|
||||
} /* ecore_x_randr_screen_rotations_get */
|
||||
|
||||
/**
|
||||
* Get the rotation.
|
||||
|
@ -199,13 +197,13 @@ ecore_x_randr_screen_rotation_get(Ecore_X_Window root __UNUSED__)
|
|||
|
||||
reply = _ecore_xcb_reply_get();
|
||||
if (!reply)
|
||||
return 0;
|
||||
return 0;
|
||||
|
||||
return reply->rotation;
|
||||
#else
|
||||
#else /* ifdef ECORE_XCB_RANDR */
|
||||
return 0;
|
||||
#endif /* ECORE_XCB_RANDR */
|
||||
}
|
||||
} /* ecore_x_randr_screen_rotation_get */
|
||||
|
||||
/**
|
||||
* Get the frame buffer sizes.
|
||||
|
@ -225,26 +223,30 @@ ecore_x_randr_screen_rotation_get(Ecore_X_Window root __UNUSED__)
|
|||
*/
|
||||
EAPI Ecore_X_Screen_Size *
|
||||
ecore_x_randr_screen_sizes_get(Ecore_X_Window root __UNUSED__,
|
||||
int *num)
|
||||
int *num)
|
||||
{
|
||||
#ifdef ECORE_XCB_RANDR
|
||||
xcb_randr_get_screen_info_reply_t *reply;
|
||||
xcb_randr_screen_size_t *sizes;
|
||||
Ecore_X_Screen_Size *ret;
|
||||
int n;
|
||||
int i;
|
||||
xcb_randr_screen_size_t *sizes;
|
||||
Ecore_X_Screen_Size *ret;
|
||||
int n;
|
||||
int i;
|
||||
|
||||
if (num) *num = 0;
|
||||
if (num)
|
||||
*num = 0;
|
||||
|
||||
reply = _ecore_xcb_reply_get();
|
||||
if (!reply)
|
||||
return NULL;
|
||||
return NULL;
|
||||
|
||||
n = xcb_randr_get_screen_info_sizes_length(reply);
|
||||
ret = calloc(n, sizeof(Ecore_X_Screen_Size));
|
||||
if (!ret) return NULL;
|
||||
if (!ret)
|
||||
return NULL;
|
||||
|
||||
if (num)
|
||||
*num = n;
|
||||
|
||||
if (num) *num = n;
|
||||
sizes = xcb_randr_get_screen_info_sizes(reply);
|
||||
for (i = 0; i < n; i++)
|
||||
{
|
||||
|
@ -253,11 +255,13 @@ ecore_x_randr_screen_sizes_get(Ecore_X_Window root __UNUSED__,
|
|||
}
|
||||
|
||||
return ret;
|
||||
#else
|
||||
if (num) *num = 0;
|
||||
#else /* ifdef ECORE_XCB_RANDR */
|
||||
if (num)
|
||||
*num = 0;
|
||||
|
||||
return NULL;
|
||||
#endif /* ECORE_XCB_RANDR */
|
||||
}
|
||||
} /* ecore_x_randr_screen_sizes_get */
|
||||
|
||||
/**
|
||||
* Get the current frame buffer size.
|
||||
|
@ -279,12 +283,12 @@ ecore_x_randr_current_screen_size_get(Ecore_X_Window root __UNUSED__)
|
|||
Ecore_X_Screen_Size ret = { -1, -1 };
|
||||
#ifdef ECORE_XCB_RANDR
|
||||
xcb_randr_get_screen_info_reply_t *reply;
|
||||
xcb_randr_screen_size_t *sizes;
|
||||
uint16_t size_index;
|
||||
xcb_randr_screen_size_t *sizes;
|
||||
uint16_t size_index;
|
||||
|
||||
reply = _ecore_xcb_reply_get();
|
||||
if (!reply)
|
||||
return ret;
|
||||
return ret;
|
||||
|
||||
size_index = reply->sizeID;
|
||||
sizes = xcb_randr_get_screen_info_sizes(reply);
|
||||
|
@ -293,10 +297,11 @@ ecore_x_randr_current_screen_size_get(Ecore_X_Window root __UNUSED__)
|
|||
ret.width = sizes[size_index].mwidth;
|
||||
ret.height = sizes[size_index].mheight;
|
||||
}
|
||||
|
||||
#endif /* ECORE_XCB_RANDR */
|
||||
|
||||
return ret;
|
||||
}
|
||||
} /* ecore_x_randr_current_screen_size_get */
|
||||
|
||||
/**
|
||||
* Get the current refresh rate.
|
||||
|
@ -315,19 +320,19 @@ ecore_x_randr_current_screen_size_get(Ecore_X_Window root __UNUSED__)
|
|||
EAPI Ecore_X_Screen_Refresh_Rate
|
||||
ecore_x_randr_current_screen_refresh_rate_get(Ecore_X_Window root __UNUSED__)
|
||||
{
|
||||
Ecore_X_Screen_Refresh_Rate ret = { -1 };
|
||||
Ecore_X_Screen_Refresh_Rate ret = { -1 };
|
||||
#ifdef ECORE_XCB_RANDR
|
||||
xcb_randr_get_screen_info_reply_t *reply;
|
||||
|
||||
reply = _ecore_xcb_reply_get();
|
||||
if (!reply)
|
||||
return ret;
|
||||
return ret;
|
||||
|
||||
ret.rate = reply->rate;
|
||||
#endif /* ECORE_XCB_RANDR */
|
||||
|
||||
return ret;
|
||||
}
|
||||
} /* ecore_x_randr_current_screen_refresh_rate_get */
|
||||
|
||||
/**
|
||||
* Get the refresh rates.
|
||||
|
@ -349,43 +354,47 @@ ecore_x_randr_current_screen_refresh_rate_get(Ecore_X_Window root __UNUSED__)
|
|||
*/
|
||||
EAPI Ecore_X_Screen_Refresh_Rate *
|
||||
ecore_x_randr_screen_refresh_rates_get(Ecore_X_Window root __UNUSED__,
|
||||
int size_id __UNUSED__,
|
||||
int *num)
|
||||
int size_id __UNUSED__,
|
||||
int *num)
|
||||
{
|
||||
#ifdef ECORE_XCB_RANDR
|
||||
xcb_randr_get_screen_info_reply_t *reply;
|
||||
Ecore_X_Screen_Refresh_Rate *ret;
|
||||
Ecore_X_Screen_Refresh_Rate *tmp;
|
||||
Ecore_X_Screen_Refresh_Rate *ret;
|
||||
Ecore_X_Screen_Refresh_Rate *tmp;
|
||||
xcb_randr_refresh_rates_iterator_t iter;
|
||||
uint16_t n;
|
||||
uint16_t n;
|
||||
|
||||
if (num) *num = 0;
|
||||
if (num)
|
||||
*num = 0;
|
||||
|
||||
reply = _ecore_xcb_reply_get();
|
||||
if (!reply)
|
||||
return NULL;
|
||||
return NULL;
|
||||
|
||||
n = reply->nSizes;
|
||||
ret = calloc(n, sizeof(Ecore_X_Screen_Refresh_Rate));
|
||||
if (!ret)
|
||||
return NULL;
|
||||
return NULL;
|
||||
|
||||
if (num) *num = n;
|
||||
if (num)
|
||||
*num = n;
|
||||
|
||||
/* FIXME: maybe there's a missing function in xcb randr implementation */
|
||||
iter = xcb_randr_get_screen_info_rates_iterator(reply);
|
||||
tmp = ret;
|
||||
for (; iter.rem; xcb_randr_refresh_rates_next(&iter), tmp++)
|
||||
{
|
||||
tmp->rate = iter.data->nRates;;
|
||||
tmp->rate = iter.data->nRates;
|
||||
}
|
||||
|
||||
return ret;
|
||||
#else
|
||||
if (num) *num = 0;
|
||||
#else /* ifdef ECORE_XCB_RANDR */
|
||||
if (num)
|
||||
*num = 0;
|
||||
|
||||
return NULL;
|
||||
#endif /* ECORE_XCB_RANDR */
|
||||
}
|
||||
} /* ecore_x_randr_screen_refresh_rates_get */
|
||||
|
||||
/* FIXME: round trip. Should we remove it ? */
|
||||
|
||||
|
@ -406,11 +415,11 @@ ecore_x_randr_screen_rotation_set(Ecore_X_Window root,
|
|||
#ifdef ECORE_XCB_RANDR
|
||||
xcb_randr_set_screen_config_cookie_t cookie;
|
||||
xcb_randr_set_screen_config_reply_t *reply_config;
|
||||
xcb_randr_get_screen_info_reply_t *reply;
|
||||
xcb_randr_get_screen_info_reply_t *reply;
|
||||
|
||||
reply = _ecore_xcb_reply_get();
|
||||
if (!reply)
|
||||
return;
|
||||
return;
|
||||
|
||||
cookie = xcb_randr_set_screen_config_unchecked(_ecore_xcb_conn, root,
|
||||
XCB_CURRENT_TIME,
|
||||
|
@ -420,9 +429,10 @@ ecore_x_randr_screen_rotation_set(Ecore_X_Window root,
|
|||
0);
|
||||
reply_config = xcb_randr_set_screen_config_reply(_ecore_xcb_conn, cookie, NULL);
|
||||
if (reply_config)
|
||||
free(reply_config);
|
||||
free(reply_config);
|
||||
|
||||
#endif /* ECORE_XCB_RANDR */
|
||||
}
|
||||
} /* ecore_x_randr_screen_rotation_set */
|
||||
|
||||
/* FIXME: round trip. Should we remove it ? */
|
||||
|
||||
|
@ -443,14 +453,14 @@ ecore_x_randr_screen_size_set(Ecore_X_Window root,
|
|||
#ifdef ECORE_XCB_RANDR
|
||||
xcb_randr_set_screen_config_cookie_t cookie;
|
||||
xcb_randr_set_screen_config_reply_t *reply_config;
|
||||
xcb_randr_get_screen_info_reply_t *reply;
|
||||
xcb_randr_screen_size_iterator_t iter;
|
||||
int size_index = -1;
|
||||
int i;
|
||||
xcb_randr_get_screen_info_reply_t *reply;
|
||||
xcb_randr_screen_size_iterator_t iter;
|
||||
int size_index = -1;
|
||||
int i;
|
||||
|
||||
reply = _ecore_xcb_reply_get();
|
||||
if (!reply)
|
||||
return 0;
|
||||
return 0;
|
||||
|
||||
iter = xcb_randr_get_screen_info_sizes_iterator(reply);
|
||||
for (i = 0; iter.rem; xcb_randr_screen_size_next(&iter), i++)
|
||||
|
@ -460,11 +470,12 @@ ecore_x_randr_screen_size_set(Ecore_X_Window root,
|
|||
(iter.data->mwidth = size.width) &&
|
||||
(iter.data->mheight = size.height))
|
||||
{
|
||||
size_index = i;
|
||||
break;
|
||||
size_index = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (size_index == -1) return 0;
|
||||
if (size_index == -1)
|
||||
return 0;
|
||||
|
||||
cookie = xcb_randr_set_screen_config_unchecked(_ecore_xcb_conn, root,
|
||||
XCB_CURRENT_TIME,
|
||||
|
@ -474,15 +485,15 @@ ecore_x_randr_screen_size_set(Ecore_X_Window root,
|
|||
0);
|
||||
reply_config = xcb_randr_set_screen_config_reply(_ecore_xcb_conn, cookie, NULL);
|
||||
if (!reply_config)
|
||||
return 0;
|
||||
return 0;
|
||||
|
||||
free(reply_config);
|
||||
|
||||
return 1;
|
||||
#else
|
||||
#else /* ifdef ECORE_XCB_RANDR */
|
||||
return 0;
|
||||
#endif /* ECORE_XCB_RANDR */
|
||||
}
|
||||
} /* ecore_x_randr_screen_size_set */
|
||||
|
||||
/* FIXME: round trip. Should we remove it ? */
|
||||
|
||||
|
@ -506,14 +517,14 @@ ecore_x_randr_screen_refresh_rate_set(Ecore_X_Window root,
|
|||
#ifdef ECORE_XCB_RANDR
|
||||
xcb_randr_set_screen_config_cookie_t cookie;
|
||||
xcb_randr_set_screen_config_reply_t *reply_config;
|
||||
xcb_randr_get_screen_info_reply_t *reply;
|
||||
xcb_randr_screen_size_iterator_t iter;
|
||||
int size_index = -1;
|
||||
int i;
|
||||
xcb_randr_get_screen_info_reply_t *reply;
|
||||
xcb_randr_screen_size_iterator_t iter;
|
||||
int size_index = -1;
|
||||
int i;
|
||||
|
||||
reply = _ecore_xcb_reply_get();
|
||||
if (!reply)
|
||||
return 0;
|
||||
return 0;
|
||||
|
||||
iter = xcb_randr_get_screen_info_sizes_iterator(reply);
|
||||
for (i = 0; iter.rem; xcb_randr_screen_size_next(&iter), i++)
|
||||
|
@ -523,11 +534,12 @@ ecore_x_randr_screen_refresh_rate_set(Ecore_X_Window root,
|
|||
(iter.data->mwidth = size.width) &&
|
||||
(iter.data->mheight = size.height))
|
||||
{
|
||||
size_index = i;
|
||||
break;
|
||||
size_index = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (size_index == -1) return 0;
|
||||
if (size_index == -1)
|
||||
return 0;
|
||||
|
||||
cookie = xcb_randr_set_screen_config_unchecked(_ecore_xcb_conn, root,
|
||||
XCB_CURRENT_TIME,
|
||||
|
@ -537,12 +549,13 @@ ecore_x_randr_screen_refresh_rate_set(Ecore_X_Window root,
|
|||
rate.rate);
|
||||
reply_config = xcb_randr_set_screen_config_reply(_ecore_xcb_conn, cookie, NULL);
|
||||
if (!reply_config)
|
||||
return 0;
|
||||
return 0;
|
||||
|
||||
free(reply_config);
|
||||
|
||||
return 1;
|
||||
#else
|
||||
#else /* ifdef ECORE_XCB_RANDR */
|
||||
return 0;
|
||||
#endif /* ECORE_XCB_RANDR */
|
||||
}
|
||||
} /* ecore_x_randr_screen_refresh_rate_set */
|
||||
|
||||
|
|
|
@ -4,13 +4,12 @@
|
|||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
#endif /* ifdef HAVE_CONFIG_H */
|
||||
|
||||
#include <pixman.h>
|
||||
|
||||
#include "ecore_xcb_private.h"
|
||||
|
||||
|
||||
/*
|
||||
* [x] XCreateRegion
|
||||
* [ ] XPolygonRegion
|
||||
|
@ -39,44 +38,44 @@ ecore_x_xregion_new()
|
|||
{
|
||||
pixman_region16_t *region;
|
||||
|
||||
region = (pixman_region16_t *)malloc (sizeof (pixman_region16_t));
|
||||
region = (pixman_region16_t *)malloc (sizeof (pixman_region16_t));
|
||||
if (!region)
|
||||
return NULL;
|
||||
return NULL;
|
||||
|
||||
pixman_region_init(region);
|
||||
|
||||
return (Ecore_X_XRegion *)region;
|
||||
}
|
||||
} /* ecore_x_xregion_new */
|
||||
|
||||
EAPI void
|
||||
ecore_x_xregion_free(Ecore_X_XRegion *region)
|
||||
{
|
||||
if (!region)
|
||||
return;
|
||||
return;
|
||||
|
||||
pixman_region_fini(region);
|
||||
free(region);
|
||||
}
|
||||
} /* ecore_x_xregion_free */
|
||||
|
||||
EAPI int
|
||||
ecore_x_xregion_set(Ecore_X_XRegion *region, Ecore_X_GC gc)
|
||||
{
|
||||
xcb_rectangle_t *rects;
|
||||
pixman_box16_t *boxes;
|
||||
int num;
|
||||
int i;
|
||||
pixman_box16_t *boxes;
|
||||
int num;
|
||||
int i;
|
||||
|
||||
if (!region)
|
||||
return 0;
|
||||
return 0;
|
||||
|
||||
boxes = pixman_region_rectangles ((pixman_region16_t *)region, &num);
|
||||
|
||||
if (!boxes || (num == 0))
|
||||
return 0;
|
||||
return 0;
|
||||
|
||||
rects = (xcb_rectangle_t *)malloc(sizeof(xcb_rectangle_t) * num);
|
||||
if (!rects)
|
||||
return 0;
|
||||
return 0;
|
||||
|
||||
for (i = 0; i < num; i++)
|
||||
{
|
||||
|
@ -93,68 +92,68 @@ ecore_x_xregion_set(Ecore_X_XRegion *region, Ecore_X_GC gc)
|
|||
num,
|
||||
rects);
|
||||
return 1;
|
||||
}
|
||||
} /* ecore_x_xregion_set */
|
||||
|
||||
EAPI void
|
||||
ecore_x_xregion_translate(Ecore_X_XRegion *region, int x, int y)
|
||||
{
|
||||
if (!region)
|
||||
return;
|
||||
return;
|
||||
|
||||
pixman_region_translate((pixman_region16_t *)region, x, y);
|
||||
}
|
||||
} /* ecore_x_xregion_translate */
|
||||
|
||||
EAPI int
|
||||
ecore_x_xregion_intersect(Ecore_X_XRegion *dst, Ecore_X_XRegion *r1, Ecore_X_XRegion *r2)
|
||||
{
|
||||
return pixman_region_intersect((pixman_region16_t *)dst, (pixman_region16_t *)r1, (pixman_region16_t *)r2);
|
||||
}
|
||||
} /* ecore_x_xregion_intersect */
|
||||
|
||||
EAPI int
|
||||
ecore_x_xregion_union(Ecore_X_XRegion *dst, Ecore_X_XRegion *r1, Ecore_X_XRegion *r2)
|
||||
{
|
||||
return pixman_region_union((pixman_region16_t *)dst, (pixman_region16_t *)r1, (pixman_region16_t *)r2);
|
||||
}
|
||||
} /* ecore_x_xregion_union */
|
||||
|
||||
EAPI int
|
||||
ecore_x_xregion_union_rect(Ecore_X_XRegion *dst, Ecore_X_XRegion *src, Ecore_X_Rectangle *rect)
|
||||
{
|
||||
return pixman_region_union_rect((pixman_region16_t *)dst, (pixman_region16_t *)src,
|
||||
rect->x, rect->y, rect->width, rect->height);
|
||||
}
|
||||
} /* ecore_x_xregion_union_rect */
|
||||
|
||||
EAPI int
|
||||
ecore_x_xregion_subtract(Ecore_X_XRegion *dst, Ecore_X_XRegion *rm, Ecore_X_XRegion *rs)
|
||||
{
|
||||
return pixman_region_subtract((pixman_region16_t *)dst, (pixman_region16_t *)rm, (pixman_region16_t *)rs);
|
||||
}
|
||||
} /* ecore_x_xregion_subtract */
|
||||
|
||||
EAPI int
|
||||
ecore_x_xregion_is_empty(Ecore_X_XRegion *region)
|
||||
{
|
||||
if (!region)
|
||||
return 1;
|
||||
return 1;
|
||||
|
||||
return !pixman_region_not_empty((pixman_region16_t *)region);
|
||||
}
|
||||
} /* ecore_x_xregion_is_empty */
|
||||
|
||||
EAPI int
|
||||
ecore_x_xregion_is_equal(Ecore_X_XRegion *r1, Ecore_X_XRegion *r2)
|
||||
{
|
||||
if (!r1 || !r2)
|
||||
return 0;
|
||||
return 0;
|
||||
|
||||
return pixman_region_equal((pixman_region16_t *)r1, (pixman_region16_t *)r2);
|
||||
}
|
||||
} /* ecore_x_xregion_is_equal */
|
||||
|
||||
EAPI int
|
||||
ecore_x_xregion_point_contain(Ecore_X_XRegion *region, int x, int y)
|
||||
{
|
||||
if (!region)
|
||||
return 0;
|
||||
return 0;
|
||||
|
||||
return pixman_region_contains_point((pixman_region16_t *)region, x, y, NULL);
|
||||
}
|
||||
} /* ecore_x_xregion_point_contain */
|
||||
|
||||
EAPI int
|
||||
ecore_x_xregion_rect_contain(Ecore_X_XRegion *region, Ecore_X_Rectangle *rect)
|
||||
|
@ -162,7 +161,7 @@ ecore_x_xregion_rect_contain(Ecore_X_XRegion *region, Ecore_X_Rectangle *rect)
|
|||
pixman_box16_t box;
|
||||
|
||||
if (!region || !rect)
|
||||
return 0;
|
||||
return 0;
|
||||
|
||||
box.x1 = rect->x;
|
||||
box.y1 = rect->y;
|
||||
|
@ -170,4 +169,5 @@ ecore_x_xregion_rect_contain(Ecore_X_XRegion *region, Ecore_X_Rectangle *rect)
|
|||
box.y2 = rect->y + rect->height - 1;
|
||||
|
||||
return pixman_region_contains_rectangle((pixman_region16_t *)region, &box);
|
||||
}
|
||||
} /* ecore_x_xregion_rect_contain */
|
||||
|
||||
|
|
|
@ -6,8 +6,7 @@
|
|||
|
||||
#include <Eina.h>
|
||||
|
||||
|
||||
/*
|
||||
/*
|
||||
* FIXME:
|
||||
* - in ecore_xcb_cookie_cache, should provide better error management
|
||||
* when memory allocation fails
|
||||
|
@ -19,37 +18,36 @@
|
|||
* but its code is commented.
|
||||
*/
|
||||
|
||||
static Eina_List *_ecore_xcb_cookies = NULL;
|
||||
static void *_ecore_xcb_reply = NULL;
|
||||
static Eina_List *_ecore_xcb_cookies = NULL;
|
||||
static void *_ecore_xcb_reply = NULL;
|
||||
|
||||
typedef struct _Ecore_Xcb_Data Ecore_Xcb_Data;
|
||||
typedef struct _Ecore_Xcb_Data Ecore_Xcb_Data;
|
||||
|
||||
struct _Ecore_Xcb_Data
|
||||
{
|
||||
unsigned int cookie;
|
||||
unsigned int cookie;
|
||||
};
|
||||
|
||||
|
||||
int
|
||||
_ecore_x_reply_init ()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
} /* _ecore_x_reply_init */
|
||||
|
||||
void
|
||||
_ecore_x_reply_shutdown ()
|
||||
{
|
||||
Ecore_Xcb_Data *data;
|
||||
Ecore_Xcb_Data *data;
|
||||
|
||||
if (_ecore_xcb_reply)
|
||||
free(_ecore_xcb_reply);
|
||||
if (_ecore_xcb_reply)
|
||||
free(_ecore_xcb_reply);
|
||||
|
||||
if (!_ecore_xcb_cookies)
|
||||
return;
|
||||
return;
|
||||
|
||||
EINA_LIST_FREE(_ecore_xcb_cookies, data)
|
||||
free(data);
|
||||
}
|
||||
free(data);
|
||||
} /* _ecore_x_reply_shutdown */
|
||||
|
||||
void
|
||||
_ecore_xcb_cookie_cache (unsigned int cookie)
|
||||
|
@ -57,11 +55,11 @@ _ecore_xcb_cookie_cache (unsigned int cookie)
|
|||
Ecore_Xcb_Data *data;
|
||||
|
||||
if (!_ecore_xcb_cookies)
|
||||
return;
|
||||
return;
|
||||
|
||||
data = (Ecore_Xcb_Data *)malloc(sizeof(Ecore_Xcb_Data));
|
||||
if (!data)
|
||||
return;
|
||||
return;
|
||||
|
||||
data->cookie = cookie;
|
||||
|
||||
|
@ -71,40 +69,42 @@ _ecore_xcb_cookie_cache (unsigned int cookie)
|
|||
free(data);
|
||||
return;
|
||||
}
|
||||
}
|
||||
} /* _ecore_xcb_cookie_cache */
|
||||
|
||||
unsigned int
|
||||
_ecore_xcb_cookie_get (void)
|
||||
{
|
||||
Ecore_Xcb_Data *data;
|
||||
unsigned int cookie;
|
||||
unsigned int cookie;
|
||||
|
||||
if (!_ecore_xcb_cookies)
|
||||
return 0;
|
||||
return 0;
|
||||
|
||||
data = eina_list_data_get(_ecore_xcb_cookies);
|
||||
if (!data) return 0;
|
||||
if (!data)
|
||||
return 0;
|
||||
|
||||
_ecore_xcb_cookies = eina_list_remove_list(_ecore_xcb_cookies, _ecore_xcb_cookies);
|
||||
cookie = data->cookie;
|
||||
free(data);
|
||||
cookie = data->cookie;
|
||||
free(data);
|
||||
|
||||
return cookie;
|
||||
}
|
||||
return cookie;
|
||||
} /* _ecore_xcb_cookie_get */
|
||||
|
||||
void
|
||||
_ecore_xcb_reply_cache (void *reply)
|
||||
{
|
||||
if (_ecore_xcb_reply)
|
||||
free(_ecore_xcb_reply);
|
||||
free(_ecore_xcb_reply);
|
||||
|
||||
_ecore_xcb_reply = reply;
|
||||
}
|
||||
} /* _ecore_xcb_reply_cache */
|
||||
|
||||
void *
|
||||
_ecore_xcb_reply_get (void)
|
||||
{
|
||||
return _ecore_xcb_reply;
|
||||
}
|
||||
} /* _ecore_xcb_reply_get */
|
||||
|
||||
EAPI void
|
||||
ecore_xcb_reply_free()
|
||||
|
@ -114,4 +114,5 @@ ecore_xcb_reply_free()
|
|||
/* free(_ecore_xcb_reply); */
|
||||
/* _ecore_xcb_reply = NULL; */
|
||||
/* } */
|
||||
}
|
||||
} /* ecore_xcb_reply_free */
|
||||
|
||||
|
|
|
@ -4,20 +4,17 @@
|
|||
|
||||
#include "ecore_xcb_private.h"
|
||||
|
||||
|
||||
/**
|
||||
* @defgroup Ecore_X_ScreenSaver_Group X ScreenSaver extension
|
||||
*
|
||||
* These functions use the ScreenSaver extension of the X server
|
||||
*/
|
||||
|
||||
*/
|
||||
|
||||
#ifdef ECORE_XCB_SCREENSAVER
|
||||
static int _screensaver_available = 0;
|
||||
static xcb_screensaver_query_version_cookie_t _ecore_xcb_screensaver_init_cookie;
|
||||
#endif /* ECORE_XCB_SCREENSAVER */
|
||||
|
||||
|
||||
/* To avoid round trips, the initialization is separated in 2
|
||||
functions: _ecore_xcb_screensaver_init and
|
||||
_ecore_xcb_screensaver_init_finalize. The first one gets the cookies and
|
||||
|
@ -29,8 +26,9 @@ _ecore_x_screensaver_init(const xcb_query_extension_reply_t *reply)
|
|||
#ifdef ECORE_XCB_SCREENSAVER
|
||||
if (reply && (reply->present))
|
||||
_ecore_xcb_screensaver_init_cookie = xcb_screensaver_query_version_unchecked(_ecore_xcb_conn, 1, 1);
|
||||
|
||||
#endif /* ECORE_XCB_SCREENSAVER */
|
||||
}
|
||||
} /* _ecore_x_screensaver_init */
|
||||
|
||||
void
|
||||
_ecore_x_screensaver_init_finalize(void)
|
||||
|
@ -45,12 +43,13 @@ _ecore_x_screensaver_init_finalize(void)
|
|||
{
|
||||
if ((reply->server_major_version >= 1) &&
|
||||
(reply->server_minor_version >= 1))
|
||||
_screensaver_available = 1;
|
||||
_screensaver_available = 1;
|
||||
|
||||
free(reply);
|
||||
}
|
||||
#endif /* ECORE_XCB_SCREENSAVER */
|
||||
}
|
||||
|
||||
#endif /* ECORE_XCB_SCREENSAVER */
|
||||
} /* _ecore_x_screensaver_init_finalize */
|
||||
|
||||
/**
|
||||
* Return whether the X server supports the ScreenSaver Extension.
|
||||
|
@ -64,8 +63,7 @@ EAPI int
|
|||
ecore_x_screensaver_event_available_get(void)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
} /* ecore_x_screensaver_event_available_get */
|
||||
|
||||
/**
|
||||
* Sends the QueryInfo request.
|
||||
|
@ -80,8 +78,7 @@ ecore_x_screensaver_idle_time_prefetch(void)
|
|||
cookie = xcb_screensaver_query_info_unchecked(_ecore_xcb_conn, ((xcb_screen_t *)_ecore_xcb_screen)->root);
|
||||
_ecore_xcb_cookie_cache(cookie.sequence);
|
||||
#endif /* ECORE_XCB_SCREENSAVER */
|
||||
}
|
||||
|
||||
} /* ecore_x_screensaver_idle_time_prefetch */
|
||||
|
||||
/**
|
||||
* Gets the reply of the QueryInfo request sent by ecore_x_get_screensaver_prefetch().
|
||||
|
@ -98,8 +95,7 @@ ecore_x_screensaver_idle_time_fetch(void)
|
|||
reply = xcb_screensaver_query_info_reply(_ecore_xcb_conn, cookie, NULL);
|
||||
_ecore_xcb_reply_cache(reply);
|
||||
#endif /* ECORE_XCB_SCREENSAVER */
|
||||
}
|
||||
|
||||
} /* ecore_x_screensaver_idle_time_fetch */
|
||||
|
||||
/**
|
||||
* Get the number of seconds since the last input was received.
|
||||
|
@ -116,21 +112,21 @@ ecore_x_screensaver_idle_time_fetch(void)
|
|||
EAPI int
|
||||
ecore_x_screensaver_idle_time_get(void)
|
||||
{
|
||||
int idle = 0;
|
||||
int idle = 0;
|
||||
#ifdef ECORE_XCB_SCREENSAVER
|
||||
xcb_screensaver_query_info_reply_t *reply;
|
||||
|
||||
reply = _ecore_xcb_reply_get();
|
||||
|
||||
if (!reply) return 0;
|
||||
if (!reply)
|
||||
return 0;
|
||||
|
||||
/* FIXME: check if it is ms_since_user_input or ms_until_server */
|
||||
idle = reply->ms_since_user_input / 1000;
|
||||
#endif /* ECORE_XCB_SCREENSAVER */
|
||||
|
||||
return idle;
|
||||
}
|
||||
|
||||
} /* ecore_x_screensaver_idle_time_get */
|
||||
|
||||
/**
|
||||
* Set the parameters of the screen saver.
|
||||
|
@ -157,8 +153,7 @@ ecore_x_screensaver_set(int timeout,
|
|||
(int16_t)interval,
|
||||
(uint8_t)blank,
|
||||
(uint8_t)expose);
|
||||
}
|
||||
|
||||
} /* ecore_x_screensaver_set */
|
||||
|
||||
/**
|
||||
* Sends the GetScreenSaver request.
|
||||
|
@ -171,8 +166,7 @@ ecore_x_get_screensaver_prefetch(void)
|
|||
|
||||
cookie = xcb_get_screen_saver_unchecked(_ecore_xcb_conn);
|
||||
_ecore_xcb_cookie_cache(cookie.sequence);
|
||||
}
|
||||
|
||||
} /* ecore_x_get_screensaver_prefetch */
|
||||
|
||||
/**
|
||||
* Gets the reply of the GetScreenSaver request sent by ecore_x_get_screensaver_prefetch().
|
||||
|
@ -187,8 +181,7 @@ ecore_x_get_screensaver_fetch(void)
|
|||
cookie.sequence = _ecore_xcb_cookie_get();
|
||||
reply = xcb_get_screen_saver_reply(_ecore_xcb_conn, cookie, NULL);
|
||||
_ecore_xcb_reply_cache(reply);
|
||||
}
|
||||
|
||||
} /* ecore_x_get_screensaver_fetch */
|
||||
|
||||
/**
|
||||
* Set the timeout of the screen saver.
|
||||
|
@ -207,15 +200,15 @@ ecore_x_screensaver_timeout_set(int timeout)
|
|||
xcb_get_screen_saver_reply_t *reply;
|
||||
|
||||
reply = _ecore_xcb_reply_get();
|
||||
if (!reply) return;
|
||||
if (!reply)
|
||||
return;
|
||||
|
||||
xcb_set_screen_saver(_ecore_xcb_conn,
|
||||
(int16_t)timeout,
|
||||
reply->interval,
|
||||
reply->prefer_blanking,
|
||||
reply->allow_exposures);
|
||||
}
|
||||
|
||||
} /* ecore_x_screensaver_timeout_set */
|
||||
|
||||
/**
|
||||
* Get the timeout of the screen saver.
|
||||
|
@ -234,11 +227,11 @@ ecore_x_screensaver_timeout_get(void)
|
|||
xcb_get_screen_saver_reply_t *reply;
|
||||
|
||||
reply = _ecore_xcb_reply_get();
|
||||
if (!reply) return 0.0;
|
||||
if (!reply)
|
||||
return 0.0;
|
||||
|
||||
return (int)reply->timeout;
|
||||
}
|
||||
|
||||
} /* ecore_x_screensaver_timeout_get */
|
||||
|
||||
/**
|
||||
* Set the interval of the screen saver.
|
||||
|
@ -257,15 +250,15 @@ ecore_x_screensaver_interval_set(int interval)
|
|||
xcb_get_screen_saver_reply_t *reply;
|
||||
|
||||
reply = _ecore_xcb_reply_get();
|
||||
if (!reply) return;
|
||||
if (!reply)
|
||||
return;
|
||||
|
||||
xcb_set_screen_saver(_ecore_xcb_conn,
|
||||
reply->timeout,
|
||||
(int16_t)interval,
|
||||
reply->prefer_blanking,
|
||||
reply->allow_exposures);
|
||||
}
|
||||
|
||||
} /* ecore_x_screensaver_interval_set */
|
||||
|
||||
/**
|
||||
* Get the interval of the screen saver.
|
||||
|
@ -284,11 +277,11 @@ ecore_x_screensaver_interval_get(void)
|
|||
xcb_get_screen_saver_reply_t *reply;
|
||||
|
||||
reply = _ecore_xcb_reply_get();
|
||||
if (!reply) return 0.0;
|
||||
if (!reply)
|
||||
return 0.0;
|
||||
|
||||
return (int)reply->interval;
|
||||
}
|
||||
|
||||
} /* ecore_x_screensaver_interval_get */
|
||||
|
||||
/**
|
||||
* Set the screen blanking.
|
||||
|
@ -307,15 +300,15 @@ ecore_x_screensaver_blank_set(int blank)
|
|||
xcb_get_screen_saver_reply_t *reply;
|
||||
|
||||
reply = _ecore_xcb_reply_get();
|
||||
if (!reply) return;
|
||||
if (!reply)
|
||||
return;
|
||||
|
||||
xcb_set_screen_saver(_ecore_xcb_conn,
|
||||
reply->timeout,
|
||||
reply->interval,
|
||||
(uint8_t)blank,
|
||||
reply->allow_exposures);
|
||||
}
|
||||
|
||||
} /* ecore_x_screensaver_blank_set */
|
||||
|
||||
/**
|
||||
* Get the screen blanking.
|
||||
|
@ -334,11 +327,11 @@ ecore_x_screensaver_blank_get(void)
|
|||
xcb_get_screen_saver_reply_t *reply;
|
||||
|
||||
reply = _ecore_xcb_reply_get();
|
||||
if (!reply) return 0.0;
|
||||
if (!reply)
|
||||
return 0.0;
|
||||
|
||||
return (int)reply->prefer_blanking;
|
||||
}
|
||||
|
||||
} /* ecore_x_screensaver_blank_get */
|
||||
|
||||
/**
|
||||
* Set the screen save control values.
|
||||
|
@ -357,15 +350,15 @@ ecore_x_screensaver_expose_set(int expose)
|
|||
xcb_get_screen_saver_reply_t *reply;
|
||||
|
||||
reply = _ecore_xcb_reply_get();
|
||||
if (!reply) return;
|
||||
if (!reply)
|
||||
return;
|
||||
|
||||
xcb_set_screen_saver(_ecore_xcb_conn,
|
||||
reply->timeout,
|
||||
reply->interval,
|
||||
reply->prefer_blanking,
|
||||
(uint8_t)expose);
|
||||
}
|
||||
|
||||
} /* ecore_x_screensaver_expose_set */
|
||||
|
||||
/**
|
||||
* Get the screen save control values.
|
||||
|
@ -384,11 +377,11 @@ ecore_x_screensaver_expose_get(void)
|
|||
xcb_get_screen_saver_reply_t *reply;
|
||||
|
||||
reply = _ecore_xcb_reply_get();
|
||||
if (!reply) return 0.0;
|
||||
if (!reply)
|
||||
return 0.0;
|
||||
|
||||
return (int)reply->allow_exposures;
|
||||
}
|
||||
|
||||
} /* ecore_x_screensaver_expose_get */
|
||||
|
||||
/**
|
||||
* Specifies if the Screen Saver NotifyMask event should be generated.
|
||||
|
@ -408,4 +401,5 @@ ecore_x_screensaver_event_listen_set(int on)
|
|||
((xcb_screen_t *)_ecore_xcb_screen)->root,
|
||||
on ? XCB_SCREENSAVER_EVENT_NOTIFY_MASK : 0);
|
||||
#endif /* ECORE_XCB_SCREENSAVER */
|
||||
}
|
||||
} /* ecore_x_screensaver_event_listen_set */
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -4,20 +4,17 @@
|
|||
|
||||
#include "ecore_xcb_private.h"
|
||||
|
||||
|
||||
/**
|
||||
* @defgroup Ecore_X_Shape_Group X Shape extension
|
||||
*
|
||||
* Functions that use the shape extension of the X server to change shape of given windows.
|
||||
*/
|
||||
|
||||
|
||||
#ifdef ECORE_XCB_SHAPE
|
||||
static int _shape_available = 0;
|
||||
static xcb_shape_query_version_cookie_t _ecore_xcb_shape_init_cookie;
|
||||
#endif /* ECORE_XCB_SHAPE */
|
||||
|
||||
|
||||
/* To avoid round trips, the initialization is separated in 2
|
||||
functions: _ecore_xcb_shape_init and
|
||||
_ecore_xcb_shape_init_finalize. The first one gets the cookies and
|
||||
|
@ -29,8 +26,9 @@ _ecore_x_shape_init(const xcb_query_extension_reply_t *reply)
|
|||
#ifdef ECORE_XCB_SHAPE
|
||||
if (reply && (reply->present))
|
||||
_ecore_xcb_shape_init_cookie = xcb_shape_query_version_unchecked(_ecore_xcb_conn);
|
||||
|
||||
#endif /* ECORE_XCB_SHAPE */
|
||||
}
|
||||
} /* _ecore_x_shape_init */
|
||||
|
||||
void
|
||||
_ecore_x_shape_init_finalize(void)
|
||||
|
@ -46,9 +44,9 @@ _ecore_x_shape_init_finalize(void)
|
|||
_shape_available = 1;
|
||||
free(reply);
|
||||
}
|
||||
#endif /* ECORE_XCB_SHAPE */
|
||||
}
|
||||
|
||||
#endif /* ECORE_XCB_SHAPE */
|
||||
} /* _ecore_x_shape_init_finalize */
|
||||
|
||||
/**
|
||||
* Sets the shape of the given window to the given pixmap.
|
||||
|
@ -65,7 +63,7 @@ ecore_x_window_shape_mask_set(Ecore_X_Window dest_win,
|
|||
#ifdef ECORE_XCB_SHAPE
|
||||
xcb_shape_mask(_ecore_xcb_conn, XCB_SHAPE_SO_SET, XCB_SHAPE_SK_BOUNDING, dest_win, 0, 0, source_mask);
|
||||
#endif /* ECORE_XCB_SHAPE */
|
||||
}
|
||||
} /* ecore_x_window_shape_mask_set */
|
||||
|
||||
EAPI void
|
||||
ecore_x_window_shape_window_set(Ecore_X_Window dest_win,
|
||||
|
@ -74,7 +72,7 @@ ecore_x_window_shape_window_set(Ecore_X_Window dest_win,
|
|||
#ifdef ECORE_XCB_SHAPE
|
||||
xcb_shape_combine(_ecore_xcb_conn, XCB_SHAPE_SO_SET, XCB_SHAPE_SK_BOUNDING, XCB_SHAPE_SK_BOUNDING, dest_win, 0, 0, shape_win);
|
||||
#endif /* ECORE_XCB_SHAPE */
|
||||
}
|
||||
} /* ecore_x_window_shape_window_set */
|
||||
|
||||
EAPI void
|
||||
ecore_x_window_shape_window_set_xy(Ecore_X_Window dest_win,
|
||||
|
@ -85,8 +83,7 @@ ecore_x_window_shape_window_set_xy(Ecore_X_Window dest_win,
|
|||
#ifdef ECORE_XCB_SHAPE
|
||||
xcb_shape_combine(_ecore_xcb_conn, XCB_SHAPE_SO_SET, XCB_SHAPE_SK_BOUNDING, XCB_SHAPE_SK_BOUNDING, dest_win, x, y, shape_win);
|
||||
#endif /* ECORE_XCB_SHAPE */
|
||||
}
|
||||
|
||||
} /* ecore_x_window_shape_window_set_xy */
|
||||
|
||||
/**
|
||||
* Sets the shape of the given window to a rectangle.
|
||||
|
@ -116,7 +113,7 @@ ecore_x_window_shape_rectangle_set(Ecore_X_Window dest_win,
|
|||
rect.height = height;
|
||||
xcb_shape_rectangles(_ecore_xcb_conn, XCB_SHAPE_SO_SET, XCB_SHAPE_SK_BOUNDING, 0, dest_win, 0, 0, 1, &rect);
|
||||
#endif /* ECORE_XCB_SHAPE */
|
||||
}
|
||||
} /* ecore_x_window_shape_rectangle_set */
|
||||
|
||||
EAPI void
|
||||
ecore_x_window_shape_rectangles_set(Ecore_X_Window dest_win,
|
||||
|
@ -125,13 +122,14 @@ ecore_x_window_shape_rectangles_set(Ecore_X_Window dest_win,
|
|||
{
|
||||
#ifdef ECORE_XCB_SHAPE
|
||||
if (num > 0)
|
||||
xcb_shape_rectangles(_ecore_xcb_conn,
|
||||
XCB_SHAPE_SO_SET, XCB_SHAPE_SK_BOUNDING,
|
||||
0, dest_win, 0, 0, num, (xcb_rectangle_t *)rects);
|
||||
xcb_shape_rectangles(_ecore_xcb_conn,
|
||||
XCB_SHAPE_SO_SET, XCB_SHAPE_SK_BOUNDING,
|
||||
0, dest_win, 0, 0, num, (xcb_rectangle_t *)rects);
|
||||
else
|
||||
xcb_shape_rectangles(_ecore_xcb_conn, XCB_SHAPE_SO_SET, XCB_SHAPE_SK_BOUNDING, 0, dest_win, 0, 0, 0, NULL);
|
||||
xcb_shape_rectangles(_ecore_xcb_conn, XCB_SHAPE_SO_SET, XCB_SHAPE_SK_BOUNDING, 0, dest_win, 0, 0, 0, NULL);
|
||||
|
||||
#endif /* ECORE_XCB_SHAPE */
|
||||
}
|
||||
} /* ecore_x_window_shape_rectangles_set */
|
||||
|
||||
EAPI void
|
||||
ecore_x_window_shape_window_add(Ecore_X_Window dest_win,
|
||||
|
@ -140,7 +138,7 @@ ecore_x_window_shape_window_add(Ecore_X_Window dest_win,
|
|||
#ifdef ECORE_XCB_SHAPE
|
||||
xcb_shape_combine(_ecore_xcb_conn, XCB_SHAPE_SO_UNION, XCB_SHAPE_SK_BOUNDING, XCB_SHAPE_SK_BOUNDING, dest_win, 0, 0, shape_win);
|
||||
#endif /* ECORE_XCB_SHAPE */
|
||||
}
|
||||
} /* ecore_x_window_shape_window_add */
|
||||
|
||||
EAPI void
|
||||
ecore_x_window_shape_window_add_xy(Ecore_X_Window dest_win,
|
||||
|
@ -151,7 +149,7 @@ ecore_x_window_shape_window_add_xy(Ecore_X_Window dest_win,
|
|||
#ifdef ECORE_XCB_SHAPE
|
||||
xcb_shape_combine(_ecore_xcb_conn, XCB_SHAPE_SO_UNION, XCB_SHAPE_SK_BOUNDING, XCB_SHAPE_SK_BOUNDING, dest_win, x, y, shape_win);
|
||||
#endif /* ECORE_XCB_SHAPE */
|
||||
}
|
||||
} /* ecore_x_window_shape_window_add_xy */
|
||||
|
||||
EAPI void
|
||||
ecore_x_window_shape_rectangle_add(Ecore_X_Window dest_win,
|
||||
|
@ -169,7 +167,7 @@ ecore_x_window_shape_rectangle_add(Ecore_X_Window dest_win,
|
|||
rect.height = height;
|
||||
xcb_shape_rectangles(_ecore_xcb_conn, XCB_SHAPE_SO_UNION, XCB_SHAPE_SK_BOUNDING, 0, dest_win, 0, 0, 1, &rect);
|
||||
#endif /* ECORE_XCB_SHAPE */
|
||||
}
|
||||
} /* ecore_x_window_shape_rectangle_add */
|
||||
|
||||
EAPI void
|
||||
ecore_x_window_shape_rectangle_clip(Ecore_X_Window dest_win,
|
||||
|
@ -180,7 +178,7 @@ ecore_x_window_shape_rectangle_clip(Ecore_X_Window dest_win,
|
|||
{
|
||||
#ifdef ECORE_XCB_SHAPE
|
||||
xcb_rectangle_t rect;
|
||||
|
||||
|
||||
rect.x = x;
|
||||
rect.y = y;
|
||||
rect.width = width;
|
||||
|
@ -189,7 +187,7 @@ ecore_x_window_shape_rectangle_clip(Ecore_X_Window dest_win,
|
|||
XCB_SHAPE_SO_INTERSECT, XCB_SHAPE_SK_BOUNDING,
|
||||
0, dest_win, 0, 0, 1, &rect);
|
||||
#endif /* ECORE_XCB_SHAPE */
|
||||
}
|
||||
} /* ecore_x_window_shape_rectangle_clip */
|
||||
|
||||
EAPI void
|
||||
ecore_x_window_shape_rectangles_add(Ecore_X_Window dest_win,
|
||||
|
@ -198,12 +196,12 @@ ecore_x_window_shape_rectangles_add(Ecore_X_Window dest_win,
|
|||
{
|
||||
#ifdef ECORE_XCB_SHAPE
|
||||
if (num > 0)
|
||||
xcb_shape_rectangles(_ecore_xcb_conn, XCB_SHAPE_SO_UNION, XCB_SHAPE_SK_BOUNDING, 0, dest_win, 0, 0, num, (const xcb_rectangle_t *)rects);
|
||||
xcb_shape_rectangles(_ecore_xcb_conn, XCB_SHAPE_SO_UNION, XCB_SHAPE_SK_BOUNDING, 0, dest_win, 0, 0, num, (const xcb_rectangle_t *)rects);
|
||||
else
|
||||
xcb_shape_rectangles(_ecore_xcb_conn, XCB_SHAPE_SO_UNION, XCB_SHAPE_SK_BOUNDING, 0, dest_win, 0, 0, 0, NULL);
|
||||
#endif /* ECORE_XCB_SHAPE */
|
||||
}
|
||||
xcb_shape_rectangles(_ecore_xcb_conn, XCB_SHAPE_SO_UNION, XCB_SHAPE_SK_BOUNDING, 0, dest_win, 0, 0, 0, NULL);
|
||||
|
||||
#endif /* ECORE_XCB_SHAPE */
|
||||
} /* ecore_x_window_shape_rectangles_add */
|
||||
|
||||
/**
|
||||
* Sends the ShapeGetRectangles request.
|
||||
|
@ -219,8 +217,7 @@ ecore_x_window_shape_rectangles_get_prefetch(Ecore_X_Window window)
|
|||
cookie = xcb_shape_get_rectangles_unchecked(_ecore_xcb_conn, window, XCB_SHAPE_SK_BOUNDING);
|
||||
_ecore_xcb_cookie_cache(cookie.sequence);
|
||||
#endif /* ECORE_XCB_SHAPE */
|
||||
}
|
||||
|
||||
} /* ecore_x_window_shape_rectangles_get_prefetch */
|
||||
|
||||
/**
|
||||
* Gets the reply of the ShapeGetRectangles request sent by ecore_x_window_shape_rectangles_get_prefetch().
|
||||
|
@ -237,8 +234,7 @@ ecore_x_window_shape_rectangles_get_fetch(void)
|
|||
reply = xcb_shape_get_rectangles_reply(_ecore_xcb_conn, cookie, NULL);
|
||||
_ecore_xcb_reply_cache(reply);
|
||||
#endif /* ECORE_XCB_SHAPE */
|
||||
}
|
||||
|
||||
} /* ecore_x_window_shape_rectangles_get_fetch */
|
||||
|
||||
/**
|
||||
* To document.
|
||||
|
@ -253,40 +249,45 @@ ecore_x_window_shape_rectangles_get_fetch(void)
|
|||
*/
|
||||
EAPI Ecore_X_Rectangle *
|
||||
ecore_x_window_shape_rectangles_get(Ecore_X_Window window __UNUSED__,
|
||||
int *num_ret)
|
||||
int *num_ret)
|
||||
{
|
||||
Ecore_X_Rectangle *rects = NULL;
|
||||
uint32_t num = 0;
|
||||
uint32_t num = 0;
|
||||
#ifdef ECORE_XCB_SHAPE
|
||||
xcb_shape_get_rectangles_reply_t *reply;
|
||||
|
||||
reply = _ecore_xcb_reply_get();
|
||||
if (!reply)
|
||||
{
|
||||
if (num_ret) *num_ret = 0;
|
||||
return NULL;
|
||||
if (num_ret)
|
||||
*num_ret = 0;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
num = reply->rectangles_len;
|
||||
rects = malloc(sizeof(Ecore_X_Rectangle) * num);
|
||||
if (rects)
|
||||
memcpy (rects,
|
||||
xcb_shape_get_rectangles_rectangles(reply),
|
||||
num * sizeof (Ecore_X_Rectangle));
|
||||
memcpy (rects,
|
||||
xcb_shape_get_rectangles_rectangles(reply),
|
||||
num * sizeof (Ecore_X_Rectangle));
|
||||
else
|
||||
num = 0;
|
||||
num = 0;
|
||||
|
||||
#endif /* ECORE_XCB_SHAPE */
|
||||
|
||||
if (num_ret) *num_ret = num;
|
||||
if (num_ret)
|
||||
*num_ret = num;
|
||||
|
||||
return rects;
|
||||
}
|
||||
} /* ecore_x_window_shape_rectangles_get */
|
||||
|
||||
EAPI void
|
||||
ecore_x_window_shape_events_select(Ecore_X_Window dest_win,
|
||||
int on)
|
||||
{
|
||||
#ifdef ECORE_XCB_SHAPE
|
||||
xcb_shape_select_input(_ecore_xcb_conn, dest_win, on ? 1 : 0);
|
||||
xcb_shape_select_input(_ecore_xcb_conn, dest_win, on ? 1 : 0);
|
||||
#endif /* ECORE_XCB_SHAPE */
|
||||
}
|
||||
} /* ecore_x_window_shape_events_select */
|
||||
|
||||
|
|
|
@ -4,20 +4,17 @@
|
|||
|
||||
#include "ecore_xcb_private.h"
|
||||
|
||||
|
||||
/**
|
||||
* @defgroup Ecore_X_Sync_Group X Sync Extension Functions
|
||||
*
|
||||
* Functions related to the X Sync extension.
|
||||
*/
|
||||
|
||||
|
||||
#ifdef ECORE_XCB_SYNC
|
||||
static int _sync_available = 0;
|
||||
static xcb_sync_initialize_cookie_t _ecore_xcb_sync_init_cookie;
|
||||
#endif /* ECORE_XCB_SYNC */
|
||||
|
||||
|
||||
/* To avoid round trips, the initialization is separated in 2
|
||||
functions: _ecore_xcb_sync_init and
|
||||
_ecore_xcb_sync_init_finalize. The first one gets the cookies and
|
||||
|
@ -28,11 +25,12 @@ _ecore_x_sync_init(const xcb_query_extension_reply_t *reply)
|
|||
{
|
||||
#ifdef ECORE_XCB_SYNC
|
||||
if (reply && (reply->present))
|
||||
_ecore_xcb_sync_init_cookie = xcb_sync_initialize_unchecked(_ecore_xcb_conn,
|
||||
XCB_SYNC_MAJOR_VERSION,
|
||||
XCB_SYNC_MINOR_VERSION);
|
||||
_ecore_xcb_sync_init_cookie = xcb_sync_initialize_unchecked(_ecore_xcb_conn,
|
||||
XCB_SYNC_MAJOR_VERSION,
|
||||
XCB_SYNC_MINOR_VERSION);
|
||||
|
||||
#endif /* ECORE_XCB_SYNC */
|
||||
}
|
||||
} /* _ecore_x_sync_init */
|
||||
|
||||
void
|
||||
_ecore_x_sync_init_finalize(void)
|
||||
|
@ -45,13 +43,14 @@ _ecore_x_sync_init_finalize(void)
|
|||
|
||||
if (reply)
|
||||
{
|
||||
if (reply->major_version >= 3)
|
||||
_sync_available = 1;
|
||||
if (reply->major_version >= 3)
|
||||
_sync_available = 1;
|
||||
|
||||
free(reply);
|
||||
}
|
||||
#endif /* ECORE_XCB_SYNC */
|
||||
}
|
||||
|
||||
#endif /* ECORE_XCB_SYNC */
|
||||
} /* _ecore_x_sync_init_finalize */
|
||||
|
||||
/**
|
||||
* Return whether the X server supports the Sync Extension.
|
||||
|
@ -66,11 +65,10 @@ ecore_x_sync_query(void)
|
|||
{
|
||||
#ifdef ECORE_XCB_SYNC
|
||||
return _sync_available;
|
||||
#else
|
||||
#else /* ifdef ECORE_XCB_SYNC */
|
||||
return 0;
|
||||
#endif /* ECORE_XCB_SYNC */
|
||||
}
|
||||
|
||||
} /* ecore_x_sync_query */
|
||||
|
||||
/**
|
||||
* Create a new alarm.
|
||||
|
@ -84,19 +82,19 @@ EAPI Ecore_X_Sync_Alarm
|
|||
ecore_x_sync_alarm_new(Ecore_X_Sync_Counter counter)
|
||||
{
|
||||
#ifdef ECORE_XCB_SYNC
|
||||
uint32_t value_list[6];
|
||||
xcb_sync_int64_t init;
|
||||
uint32_t value_list[6];
|
||||
xcb_sync_int64_t init;
|
||||
Ecore_X_Sync_Alarm alarm;
|
||||
uint32_t value_mask;
|
||||
uint32_t value_mask;
|
||||
|
||||
init.lo = 0;
|
||||
init.hi = 0;
|
||||
xcb_sync_set_counter(_ecore_xcb_conn, counter, init);
|
||||
|
||||
value_mask =
|
||||
XCB_SYNC_CA_COUNTER | XCB_SYNC_CA_VALUE_TYPE |
|
||||
XCB_SYNC_CA_VALUE | XCB_SYNC_CA_TEST_TYPE |
|
||||
XCB_SYNC_CA_DELTA | XCB_SYNC_CA_EVENTS;
|
||||
XCB_SYNC_CA_COUNTER | XCB_SYNC_CA_VALUE_TYPE |
|
||||
XCB_SYNC_CA_VALUE | XCB_SYNC_CA_TEST_TYPE |
|
||||
XCB_SYNC_CA_DELTA | XCB_SYNC_CA_EVENTS;
|
||||
value_list[0] = counter;
|
||||
value_list[1] = XCB_SYNC_VALUETYPE_ABSOLUTE;
|
||||
value_list[2] = 1;
|
||||
|
@ -111,11 +109,10 @@ ecore_x_sync_alarm_new(Ecore_X_Sync_Counter counter)
|
|||
|
||||
ecore_x_sync();
|
||||
return alarm;
|
||||
#else
|
||||
#else /* ifdef ECORE_XCB_SYNC */
|
||||
return 0;
|
||||
#endif /* ECORE_XCB_SYNC */
|
||||
}
|
||||
|
||||
} /* ecore_x_sync_alarm_new */
|
||||
|
||||
/**
|
||||
* Delete an alarm.
|
||||
|
@ -131,10 +128,10 @@ ecore_x_sync_alarm_free(Ecore_X_Sync_Alarm alarm)
|
|||
#ifdef ECORE_XCB_SYNC
|
||||
xcb_sync_destroy_alarm(_ecore_xcb_conn, alarm);
|
||||
return 1;
|
||||
#else
|
||||
#else /* ifdef ECORE_XCB_SYNC */
|
||||
return 0;
|
||||
#endif /* ECORE_XCB_SYNC */
|
||||
}
|
||||
} /* ecore_x_sync_alarm_free */
|
||||
|
||||
/* FIXME: round trip */
|
||||
|
||||
|
@ -142,21 +139,22 @@ EAPI int
|
|||
ecore_x_sync_counter_query(Ecore_X_Sync_Counter counter, unsigned int *val)
|
||||
{
|
||||
#ifdef ECORE_XCB_SYNC
|
||||
xcb_sync_query_counter_cookie_t cookie;
|
||||
xcb_sync_query_counter_reply_t *reply;
|
||||
xcb_sync_query_counter_cookie_t cookie;
|
||||
xcb_sync_query_counter_reply_t *reply;
|
||||
|
||||
cookie = xcb_sync_query_counter_unchecked(_ecore_xcb_conn, counter);
|
||||
reply = xcb_sync_query_counter_reply(_ecore_xcb_conn, cookie, NULL);
|
||||
if (reply)
|
||||
{
|
||||
*val = (unsigned int)reply->counter_value.lo;
|
||||
free(reply);
|
||||
return 1;
|
||||
}
|
||||
|
||||
cookie = xcb_sync_query_counter_unchecked(_ecore_xcb_conn, counter);
|
||||
reply = xcb_sync_query_counter_reply(_ecore_xcb_conn, cookie, NULL);
|
||||
if (reply)
|
||||
{
|
||||
*val = (unsigned int)reply->counter_value.lo;
|
||||
free(reply);
|
||||
return 1;
|
||||
}
|
||||
#endif /* ECORE_XCB_SYNC */
|
||||
|
||||
return 0;
|
||||
}
|
||||
return 0;
|
||||
} /* ecore_x_sync_counter_query */
|
||||
|
||||
EAPI Ecore_X_Sync_Counter
|
||||
ecore_x_sync_counter_new(int val)
|
||||
|
@ -173,7 +171,7 @@ ecore_x_sync_counter_new(int val)
|
|||
#else /* ! ECORE_XCB_SYNC */
|
||||
return 0;
|
||||
#endif /* ! ECORE_XCB_SYNC */
|
||||
}
|
||||
} /* ecore_x_sync_counter_new */
|
||||
|
||||
EAPI void
|
||||
ecore_x_sync_counter_free(Ecore_X_Sync_Counter counter)
|
||||
|
@ -181,7 +179,7 @@ ecore_x_sync_counter_free(Ecore_X_Sync_Counter counter)
|
|||
#ifdef ECORE_XCB_SYNC
|
||||
xcb_sync_destroy_counter(_ecore_xcb_conn, counter);
|
||||
#endif /* ECORE_XCB_SYNC */
|
||||
}
|
||||
} /* ecore_x_sync_counter_free */
|
||||
|
||||
EAPI void
|
||||
ecore_x_sync_counter_inc(Ecore_X_Sync_Counter counter, int by)
|
||||
|
@ -193,7 +191,7 @@ ecore_x_sync_counter_inc(Ecore_X_Sync_Counter counter, int by)
|
|||
v.lo = by;
|
||||
xcb_sync_change_counter(_ecore_xcb_conn, counter, v);
|
||||
#endif /* ECORE_XCB_SYNC */
|
||||
}
|
||||
} /* ecore_x_sync_counter_inc */
|
||||
|
||||
EAPI void
|
||||
ecore_x_sync_counter_val_wait(Ecore_X_Sync_Counter counter, int val)
|
||||
|
@ -223,4 +221,5 @@ ecore_x_sync_counter_val_wait(Ecore_X_Sync_Counter counter, int val)
|
|||
|
||||
xcb_sync_await(_ecore_xcb_conn, 1, (const xcb_sync_waitcondition_t *)&cond);
|
||||
#endif /* ECORE_XCB_SYNC */
|
||||
}
|
||||
} /* ecore_x_sync_counter_val_wait */
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -8,19 +8,18 @@
|
|||
#include "ecore_xcb_private.h"
|
||||
#include "Ecore_X_Atoms.h"
|
||||
|
||||
|
||||
/*
|
||||
* Set CARD32 (array) property
|
||||
*/
|
||||
EAPI void
|
||||
ecore_x_window_prop_card32_set(Ecore_X_Window win,
|
||||
Ecore_X_Atom atom,
|
||||
unsigned int *val,
|
||||
unsigned int *val,
|
||||
unsigned int num)
|
||||
{
|
||||
xcb_change_property(_ecore_xcb_conn, XCB_PROP_MODE_REPLACE, win,
|
||||
atom, ECORE_X_ATOM_CARDINAL, 32, num, (const void *)val);
|
||||
}
|
||||
} /* ecore_x_window_prop_card32_set */
|
||||
|
||||
/**
|
||||
* Sends the GetProperty request.
|
||||
|
@ -29,7 +28,7 @@ ecore_x_window_prop_card32_set(Ecore_X_Window win,
|
|||
*/
|
||||
EAPI void
|
||||
ecore_x_window_prop_card32_get_prefetch(Ecore_X_Window window,
|
||||
Ecore_X_Atom atom)
|
||||
Ecore_X_Atom atom)
|
||||
{
|
||||
xcb_get_property_cookie_t cookie;
|
||||
|
||||
|
@ -39,8 +38,7 @@ ecore_x_window_prop_card32_get_prefetch(Ecore_X_Window window,
|
|||
ECORE_X_ATOM_CARDINAL,
|
||||
0, 0x7fffffff);
|
||||
_ecore_xcb_cookie_cache(cookie.sequence);
|
||||
}
|
||||
|
||||
} /* ecore_x_window_prop_card32_get_prefetch */
|
||||
|
||||
/**
|
||||
* Gets the reply of the GetProperty request sent by ecore_x_window_prop_card32_get_prefetch().
|
||||
|
@ -54,7 +52,7 @@ ecore_x_window_prop_card32_get_fetch(void)
|
|||
cookie.sequence = _ecore_xcb_cookie_get();
|
||||
reply = xcb_get_property_reply(_ecore_xcb_conn, cookie, NULL);
|
||||
_ecore_xcb_reply_cache(reply);
|
||||
}
|
||||
} /* ecore_x_window_prop_card32_get_fetch */
|
||||
|
||||
/*
|
||||
* Get CARD32 (array) property
|
||||
|
@ -66,9 +64,9 @@ ecore_x_window_prop_card32_get_fetch(void)
|
|||
*/
|
||||
EAPI int
|
||||
ecore_x_window_prop_card32_get(Ecore_X_Window win __UNUSED__,
|
||||
Ecore_X_Atom atom __UNUSED__,
|
||||
unsigned int *val,
|
||||
unsigned int len)
|
||||
Ecore_X_Atom atom __UNUSED__,
|
||||
unsigned int *val,
|
||||
unsigned int len)
|
||||
{
|
||||
xcb_get_property_reply_t *reply;
|
||||
|
||||
|
@ -79,13 +77,13 @@ ecore_x_window_prop_card32_get(Ecore_X_Window win __UNUSED__,
|
|||
return -1;
|
||||
|
||||
if (reply->value_len < len)
|
||||
len = xcb_get_property_value_length(reply);
|
||||
len = xcb_get_property_value_length(reply);
|
||||
|
||||
if (val)
|
||||
memcpy(val, xcb_get_property_value(reply), len);
|
||||
|
||||
return (int)len;
|
||||
}
|
||||
} /* ecore_x_window_prop_card32_get */
|
||||
|
||||
/*
|
||||
* Get CARD32 (array) property of any length
|
||||
|
@ -96,11 +94,11 @@ ecore_x_window_prop_card32_get(Ecore_X_Window win __UNUSED__,
|
|||
*/
|
||||
EAPI int
|
||||
ecore_x_window_prop_card32_list_get(Ecore_X_Window win __UNUSED__,
|
||||
Ecore_X_Atom atom __UNUSED__,
|
||||
unsigned int **plist)
|
||||
Ecore_X_Atom atom __UNUSED__,
|
||||
unsigned int **plist)
|
||||
{
|
||||
xcb_get_property_reply_t *reply;
|
||||
int num = -1;
|
||||
int num = -1;
|
||||
|
||||
if (plist)
|
||||
*plist = NULL;
|
||||
|
@ -115,24 +113,24 @@ ecore_x_window_prop_card32_list_get(Ecore_X_Window win __UNUSED__,
|
|||
else if ((reply->type == ECORE_X_ATOM_CARDINAL) &&
|
||||
(reply->format == 32))
|
||||
{
|
||||
uint32_t *val;
|
||||
uint32_t *val;
|
||||
|
||||
num = xcb_get_property_value_length(reply);
|
||||
if (plist)
|
||||
{
|
||||
val = (uint32_t *)malloc (num);
|
||||
if (!val)
|
||||
goto error;
|
||||
num = xcb_get_property_value_length(reply);
|
||||
if (plist)
|
||||
{
|
||||
val = (uint32_t *)malloc (num);
|
||||
if (!val)
|
||||
goto error;
|
||||
|
||||
memcpy(val, xcb_get_property_value(reply), num);
|
||||
*plist = val;
|
||||
}
|
||||
memcpy(val, xcb_get_property_value(reply), num);
|
||||
*plist = val;
|
||||
}
|
||||
}
|
||||
|
||||
error:
|
||||
error:
|
||||
|
||||
return num;
|
||||
}
|
||||
} /* ecore_x_window_prop_card32_list_get */
|
||||
|
||||
/*
|
||||
* Set X ID (array) property
|
||||
|
@ -140,13 +138,13 @@ ecore_x_window_prop_card32_list_get(Ecore_X_Window win __UNUSED__,
|
|||
EAPI void
|
||||
ecore_x_window_prop_xid_set(Ecore_X_Window win,
|
||||
Ecore_X_Atom atom,
|
||||
Ecore_X_Atom type,
|
||||
Ecore_X_Atom type,
|
||||
Ecore_X_ID *xids,
|
||||
unsigned int num)
|
||||
unsigned int num)
|
||||
{
|
||||
xcb_change_property(_ecore_xcb_conn, XCB_PROP_MODE_REPLACE, win,
|
||||
atom, type, 32, num, xids);
|
||||
}
|
||||
} /* ecore_x_window_prop_xid_set */
|
||||
|
||||
/**
|
||||
* Sends the GetProperty request.
|
||||
|
@ -167,8 +165,7 @@ ecore_x_window_prop_xid_get_prefetch(Ecore_X_Window window,
|
|||
type,
|
||||
0, 0x7fffffff);
|
||||
_ecore_xcb_cookie_cache(cookie.sequence);
|
||||
}
|
||||
|
||||
} /* ecore_x_window_prop_xid_get_prefetch */
|
||||
|
||||
/**
|
||||
* Gets the reply of the GetProperty request sent by ecore_x_window_prop_xid_get_prefetch().
|
||||
|
@ -182,7 +179,7 @@ ecore_x_window_prop_xid_get_fetch(void)
|
|||
cookie.sequence = _ecore_xcb_cookie_get();
|
||||
reply = xcb_get_property_reply(_ecore_xcb_conn, cookie, NULL);
|
||||
_ecore_xcb_reply_cache(reply);
|
||||
}
|
||||
} /* ecore_x_window_prop_xid_get_fetch */
|
||||
|
||||
/*
|
||||
* Get X ID (array) property
|
||||
|
@ -194,13 +191,13 @@ ecore_x_window_prop_xid_get_fetch(void)
|
|||
*/
|
||||
EAPI int
|
||||
ecore_x_window_prop_xid_get(Ecore_X_Window win __UNUSED__,
|
||||
Ecore_X_Atom atom __UNUSED__,
|
||||
Ecore_X_Atom type __UNUSED__,
|
||||
Ecore_X_ID *xids,
|
||||
unsigned int len)
|
||||
Ecore_X_Atom atom __UNUSED__,
|
||||
Ecore_X_Atom type __UNUSED__,
|
||||
Ecore_X_ID *xids,
|
||||
unsigned int len)
|
||||
{
|
||||
xcb_get_property_reply_t *reply;
|
||||
int num = len;
|
||||
int num = len;
|
||||
|
||||
reply = _ecore_xcb_reply_get();
|
||||
if (!reply)
|
||||
|
@ -211,14 +208,14 @@ ecore_x_window_prop_xid_get(Ecore_X_Window win __UNUSED__,
|
|||
else if (reply->format == 32)
|
||||
{
|
||||
if (reply->value_len < len)
|
||||
num = xcb_get_property_value_length(reply);
|
||||
num = xcb_get_property_value_length(reply);
|
||||
|
||||
if (xids)
|
||||
memcpy(xids, xcb_get_property_value(reply), num);
|
||||
}
|
||||
|
||||
return num;
|
||||
}
|
||||
} /* ecore_x_window_prop_xid_get */
|
||||
|
||||
/*
|
||||
* Get X ID (array) property
|
||||
|
@ -230,12 +227,12 @@ ecore_x_window_prop_xid_get(Ecore_X_Window win __UNUSED__,
|
|||
*/
|
||||
EAPI int
|
||||
ecore_x_window_prop_xid_list_get(Ecore_X_Window win __UNUSED__,
|
||||
Ecore_X_Atom atom __UNUSED__,
|
||||
Ecore_X_Atom type __UNUSED__,
|
||||
Ecore_X_ID **pxids)
|
||||
Ecore_X_Atom atom __UNUSED__,
|
||||
Ecore_X_Atom type __UNUSED__,
|
||||
Ecore_X_ID **pxids)
|
||||
{
|
||||
xcb_get_property_reply_t *reply;
|
||||
int num = -1;
|
||||
int num = -1;
|
||||
|
||||
if (pxids)
|
||||
*pxids = NULL;
|
||||
|
@ -250,22 +247,22 @@ ecore_x_window_prop_xid_list_get(Ecore_X_Window win __UNUSED__,
|
|||
else if ((reply->type == ECORE_X_ATOM_CARDINAL) &&
|
||||
(reply->format == 32))
|
||||
{
|
||||
uint32_t *val;
|
||||
uint32_t *val;
|
||||
|
||||
num = xcb_get_property_value_length(reply);
|
||||
if (pxids)
|
||||
{
|
||||
val = (uint32_t *)malloc (num);
|
||||
if (!val)
|
||||
return -1;
|
||||
num = xcb_get_property_value_length(reply);
|
||||
if (pxids)
|
||||
{
|
||||
val = (uint32_t *)malloc (num);
|
||||
if (!val)
|
||||
return -1;
|
||||
|
||||
memcpy(val, xcb_get_property_value(reply), num);
|
||||
*pxids = val;
|
||||
}
|
||||
memcpy(val, xcb_get_property_value(reply), num);
|
||||
*pxids = val;
|
||||
}
|
||||
}
|
||||
|
||||
return num;
|
||||
}
|
||||
} /* ecore_x_window_prop_xid_list_get */
|
||||
|
||||
/*
|
||||
* Remove/add/toggle X ID list item.
|
||||
|
@ -278,47 +275,49 @@ ecore_x_window_prop_xid_list_change(Ecore_X_Window win,
|
|||
int op)
|
||||
{
|
||||
Ecore_X_ID *lst;
|
||||
int i;
|
||||
int num;
|
||||
int i;
|
||||
int num;
|
||||
|
||||
num = ecore_x_window_prop_xid_list_get(win, atom, type, &lst);
|
||||
if (num < 0)
|
||||
return; /* Error - assuming invalid window */
|
||||
return; /* Error - assuming invalid window */
|
||||
|
||||
/* Is it there? */
|
||||
for (i = 0; i < num; i++)
|
||||
{
|
||||
if (lst[i] == item)
|
||||
break;
|
||||
if (lst[i] == item)
|
||||
break;
|
||||
}
|
||||
|
||||
if (i < num)
|
||||
{
|
||||
/* Was in list */
|
||||
if (op == ECORE_X_PROP_LIST_ADD)
|
||||
goto done;
|
||||
/* Remove it */
|
||||
num--;
|
||||
for (; i < num; i++)
|
||||
lst[i] = lst[i + 1];
|
||||
/* Was in list */
|
||||
if (op == ECORE_X_PROP_LIST_ADD)
|
||||
goto done;
|
||||
|
||||
/* Remove it */
|
||||
num--;
|
||||
for (; i < num; i++)
|
||||
lst[i] = lst[i + 1];
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Was not in list */
|
||||
if (op == ECORE_X_PROP_LIST_REMOVE)
|
||||
goto done;
|
||||
/* Add it */
|
||||
num++;
|
||||
lst = realloc(lst, num * sizeof(Ecore_X_ID));
|
||||
lst[i] = item;
|
||||
/* Was not in list */
|
||||
if (op == ECORE_X_PROP_LIST_REMOVE)
|
||||
goto done;
|
||||
|
||||
/* Add it */
|
||||
num++;
|
||||
lst = realloc(lst, num * sizeof(Ecore_X_ID));
|
||||
lst[i] = item;
|
||||
}
|
||||
|
||||
ecore_x_window_prop_xid_set(win, atom, type, lst, num);
|
||||
|
||||
done:
|
||||
done:
|
||||
if (lst)
|
||||
free(lst);
|
||||
}
|
||||
} /* ecore_x_window_prop_xid_list_change */
|
||||
|
||||
/*
|
||||
* Set Atom (array) property
|
||||
|
@ -330,7 +329,7 @@ ecore_x_window_prop_atom_set(Ecore_X_Window win,
|
|||
unsigned int num)
|
||||
{
|
||||
ecore_x_window_prop_xid_set(win, atom, ECORE_X_ATOM_ATOM, list, num);
|
||||
}
|
||||
} /* ecore_x_window_prop_atom_set */
|
||||
|
||||
/**
|
||||
* Sends the GetProperty request.
|
||||
|
@ -349,8 +348,7 @@ ecore_x_window_prop_atom_get_prefetch(Ecore_X_Window window,
|
|||
ECORE_X_ATOM_ATOM,
|
||||
0, 0x7fffffff);
|
||||
_ecore_xcb_cookie_cache(cookie.sequence);
|
||||
}
|
||||
|
||||
} /* ecore_x_window_prop_atom_get_prefetch */
|
||||
|
||||
/**
|
||||
* Gets the reply of the GetProperty request sent by ecore_x_window_prop_atom_get_prefetch().
|
||||
|
@ -364,7 +362,7 @@ ecore_x_window_prop_atom_get_fetch(void)
|
|||
cookie.sequence = _ecore_xcb_cookie_get();
|
||||
reply = xcb_get_property_reply(_ecore_xcb_conn, cookie, NULL);
|
||||
_ecore_xcb_reply_cache(reply);
|
||||
}
|
||||
} /* ecore_x_window_prop_atom_get_fetch */
|
||||
|
||||
/*
|
||||
* Get Atom (array) property
|
||||
|
@ -378,10 +376,10 @@ EAPI int
|
|||
ecore_x_window_prop_atom_get(Ecore_X_Window win,
|
||||
Ecore_X_Atom atom,
|
||||
Ecore_X_Atom *list,
|
||||
unsigned int len)
|
||||
unsigned int len)
|
||||
{
|
||||
return ecore_x_window_prop_xid_get(win, atom, ECORE_X_ATOM_ATOM, list, len);
|
||||
}
|
||||
} /* ecore_x_window_prop_atom_get */
|
||||
|
||||
/*
|
||||
* Get Atom (array) property
|
||||
|
@ -397,7 +395,7 @@ ecore_x_window_prop_atom_list_get(Ecore_X_Window win,
|
|||
Ecore_X_Atom **plist)
|
||||
{
|
||||
return ecore_x_window_prop_xid_list_get(win, atom, ECORE_X_ATOM_ATOM, plist);
|
||||
}
|
||||
} /* ecore_x_window_prop_atom_list_get */
|
||||
|
||||
/*
|
||||
* Remove/add/toggle atom list item.
|
||||
|
@ -409,7 +407,7 @@ ecore_x_window_prop_atom_list_change(Ecore_X_Window win,
|
|||
int op)
|
||||
{
|
||||
ecore_x_window_prop_xid_list_change(win, atom, ECORE_X_ATOM_ATOM, item, op);
|
||||
}
|
||||
} /* ecore_x_window_prop_atom_list_change */
|
||||
|
||||
/*
|
||||
* Set Window (array) property
|
||||
|
@ -421,7 +419,7 @@ ecore_x_window_prop_window_set(Ecore_X_Window win,
|
|||
unsigned int num)
|
||||
{
|
||||
ecore_x_window_prop_xid_set(win, atom, ECORE_X_ATOM_WINDOW, list, num);
|
||||
}
|
||||
} /* ecore_x_window_prop_window_set */
|
||||
|
||||
/**
|
||||
* Sends the GetProperty request.
|
||||
|
@ -440,8 +438,7 @@ ecore_x_window_prop_window_get_prefetch(Ecore_X_Window window,
|
|||
ECORE_X_ATOM_WINDOW,
|
||||
0, 0x7fffffff);
|
||||
_ecore_xcb_cookie_cache(cookie.sequence);
|
||||
}
|
||||
|
||||
} /* ecore_x_window_prop_window_get_prefetch */
|
||||
|
||||
/**
|
||||
* Gets the reply of the GetProperty request sent by ecore_x_window_prop_window_get_prefetch().
|
||||
|
@ -455,7 +452,7 @@ ecore_x_window_prop_window_get_fetch(void)
|
|||
cookie.sequence = _ecore_xcb_cookie_get();
|
||||
reply = xcb_get_property_reply(_ecore_xcb_conn, cookie, NULL);
|
||||
_ecore_xcb_reply_cache(reply);
|
||||
}
|
||||
} /* ecore_x_window_prop_window_get_fetch */
|
||||
|
||||
/*
|
||||
* Get Window (array) property
|
||||
|
@ -472,7 +469,7 @@ ecore_x_window_prop_window_get(Ecore_X_Window win,
|
|||
unsigned int len)
|
||||
{
|
||||
return ecore_x_window_prop_xid_get(win, atom, ECORE_X_ATOM_WINDOW, list, len);
|
||||
}
|
||||
} /* ecore_x_window_prop_window_get */
|
||||
|
||||
/*
|
||||
* Get Window (array) property
|
||||
|
@ -488,7 +485,7 @@ ecore_x_window_prop_window_list_get(Ecore_X_Window win,
|
|||
Ecore_X_Window **plist)
|
||||
{
|
||||
return ecore_x_window_prop_xid_list_get(win, atom, ECORE_X_ATOM_WINDOW, plist);
|
||||
}
|
||||
} /* ecore_x_window_prop_window_list_get */
|
||||
|
||||
/**
|
||||
* To be documented.
|
||||
|
@ -499,7 +496,7 @@ EAPI Ecore_X_Atom
|
|||
ecore_x_window_prop_any_type(void)
|
||||
{
|
||||
return XCB_GET_PROPERTY_TYPE_ANY;
|
||||
}
|
||||
} /* ecore_x_window_prop_any_type */
|
||||
|
||||
/**
|
||||
* To be documented.
|
||||
|
@ -520,11 +517,13 @@ ecore_x_window_prop_property_set(Ecore_X_Window window,
|
|||
void *data,
|
||||
int number)
|
||||
{
|
||||
if (window == 0) window = ((xcb_screen_t *)_ecore_xcb_screen)->root;
|
||||
if (window == 0)
|
||||
window = ((xcb_screen_t *)_ecore_xcb_screen)->root;
|
||||
|
||||
xcb_change_property(_ecore_xcb_conn, XCB_PROP_MODE_REPLACE, window,
|
||||
property, type,
|
||||
size, number, data);
|
||||
}
|
||||
} /* ecore_x_window_prop_property_set */
|
||||
|
||||
/**
|
||||
* Sends the GetProperty request.
|
||||
|
@ -543,8 +542,7 @@ ecore_x_window_prop_property_get_prefetch(Ecore_X_Window window,
|
|||
window ? window : ((xcb_screen_t *)_ecore_xcb_screen)->root,
|
||||
property, type, 0, LONG_MAX);
|
||||
_ecore_xcb_cookie_cache(cookie.sequence);
|
||||
}
|
||||
|
||||
} /* ecore_x_window_prop_property_get_prefetch */
|
||||
|
||||
/**
|
||||
* Gets the reply of the GetProperty request sent by ecore_x_window_prop_property_get_prefetch().
|
||||
|
@ -558,7 +556,7 @@ ecore_x_window_prop_property_get_fetch(void)
|
|||
cookie.sequence = _ecore_xcb_cookie_get();
|
||||
reply = xcb_get_property_reply(_ecore_xcb_conn, cookie, NULL);
|
||||
_ecore_xcb_reply_cache(reply);
|
||||
}
|
||||
} /* ecore_x_window_prop_property_get_fetch */
|
||||
|
||||
/**
|
||||
* To be documented.
|
||||
|
@ -573,26 +571,27 @@ ecore_x_window_prop_property_get_fetch(void)
|
|||
* FIXME: To be fixed.
|
||||
*/
|
||||
EAPI int
|
||||
ecore_x_window_prop_property_get(Ecore_X_Window window __UNUSED__,
|
||||
Ecore_X_Atom property __UNUSED__,
|
||||
Ecore_X_Atom type __UNUSED__,
|
||||
int size __UNUSED__,
|
||||
unsigned char **data,
|
||||
int *num)
|
||||
ecore_x_window_prop_property_get(Ecore_X_Window window __UNUSED__,
|
||||
Ecore_X_Atom property __UNUSED__,
|
||||
Ecore_X_Atom type __UNUSED__,
|
||||
int size __UNUSED__,
|
||||
unsigned char **data,
|
||||
int *num)
|
||||
{
|
||||
xcb_get_property_reply_t *reply;
|
||||
|
||||
/* make sure these are initialized */
|
||||
if (num) *num = 0L;
|
||||
if (num)
|
||||
*num = 0L;
|
||||
|
||||
if (data)
|
||||
*data = NULL;
|
||||
*data = NULL;
|
||||
else /* we can't store the retrieved data, so just return */
|
||||
return 0;
|
||||
return 0;
|
||||
|
||||
reply = _ecore_xcb_reply_get();
|
||||
if (!reply)
|
||||
return 0;
|
||||
return 0;
|
||||
|
||||
if ((reply->format != size) ||
|
||||
(reply->value_len == 0))
|
||||
|
@ -602,21 +601,21 @@ ecore_x_window_prop_property_get(Ecore_X_Window window __UNUSED__,
|
|||
if (!*data)
|
||||
return 0;
|
||||
|
||||
memcpy(*data, xcb_get_property_value(reply),
|
||||
memcpy(*data, xcb_get_property_value(reply),
|
||||
xcb_get_property_value_length(reply));
|
||||
|
||||
if (num)
|
||||
*num = reply->value_len;
|
||||
|
||||
return reply->format;
|
||||
}
|
||||
} /* ecore_x_window_prop_property_get */
|
||||
|
||||
EAPI void
|
||||
ecore_x_window_prop_property_del(Ecore_X_Window window,
|
||||
Ecore_X_Atom property)
|
||||
{
|
||||
xcb_delete_property(_ecore_xcb_conn, window, property);
|
||||
}
|
||||
} /* ecore_x_window_prop_property_del */
|
||||
|
||||
/**
|
||||
* Sends the ListProperties request.
|
||||
|
@ -629,8 +628,7 @@ ecore_x_window_prop_list_prefetch(Ecore_X_Window window)
|
|||
|
||||
cookie = xcb_list_properties_unchecked(_ecore_xcb_conn, window);
|
||||
_ecore_xcb_cookie_cache(cookie.sequence);
|
||||
}
|
||||
|
||||
} /* ecore_x_window_prop_list_prefetch */
|
||||
|
||||
/**
|
||||
* Gets the reply of the ListProperties request sent by ecore_x_window_prop_list_prefetch().
|
||||
|
@ -644,8 +642,7 @@ ecore_x_window_prop_list_fetch(void)
|
|||
cookie.sequence = _ecore_xcb_cookie_get();
|
||||
reply = xcb_list_properties_reply(_ecore_xcb_conn, cookie, NULL);
|
||||
_ecore_xcb_reply_cache(reply);
|
||||
}
|
||||
|
||||
} /* ecore_x_window_prop_list_fetch */
|
||||
|
||||
/**
|
||||
* To be documented.
|
||||
|
@ -657,12 +654,13 @@ ecore_x_window_prop_list_fetch(void)
|
|||
*/
|
||||
EAPI Ecore_X_Atom *
|
||||
ecore_x_window_prop_list(Ecore_X_Window window __UNUSED__,
|
||||
int *num_ret)
|
||||
int *num_ret)
|
||||
{
|
||||
xcb_list_properties_reply_t *reply;
|
||||
Ecore_X_Atom *atoms;
|
||||
Ecore_X_Atom *atoms;
|
||||
|
||||
if (num_ret) *num_ret = 0;
|
||||
if (num_ret)
|
||||
*num_ret = 0;
|
||||
|
||||
reply = _ecore_xcb_reply_get();
|
||||
if (!reply)
|
||||
|
@ -671,14 +669,15 @@ ecore_x_window_prop_list(Ecore_X_Window window __UNUSED__,
|
|||
atoms = (Ecore_X_Atom *)malloc(reply->atoms_len * sizeof(Ecore_X_Atom));
|
||||
if (!atoms)
|
||||
return NULL;
|
||||
|
||||
memcpy(atoms,
|
||||
xcb_list_properties_atoms(reply),
|
||||
reply->atoms_len * sizeof(Ecore_X_Atom));
|
||||
if(num_ret)
|
||||
*num_ret = reply->atoms_len;
|
||||
*num_ret = reply->atoms_len;
|
||||
|
||||
return atoms;
|
||||
}
|
||||
} /* ecore_x_window_prop_list */
|
||||
|
||||
/**
|
||||
* Set a window string property.
|
||||
|
@ -693,11 +692,13 @@ ecore_x_window_prop_string_set(Ecore_X_Window win,
|
|||
Ecore_X_Atom type,
|
||||
const char *str)
|
||||
{
|
||||
if (win == 0) win = ((xcb_screen_t *)_ecore_xcb_screen)->root;
|
||||
if (win == 0)
|
||||
win = ((xcb_screen_t *)_ecore_xcb_screen)->root;
|
||||
|
||||
xcb_change_property(_ecore_xcb_conn, XCB_PROP_MODE_REPLACE, win,
|
||||
type, ECORE_X_ATOM_UTF8_STRING,
|
||||
8, strlen(str), str);
|
||||
}
|
||||
type, ECORE_X_ATOM_UTF8_STRING,
|
||||
8, strlen(str), str);
|
||||
} /* ecore_x_window_prop_string_set */
|
||||
|
||||
/**
|
||||
* Sends the GetProperty request.
|
||||
|
@ -714,8 +715,7 @@ ecore_x_window_prop_string_get_prefetch(Ecore_X_Window window,
|
|||
window ? window : ((xcb_screen_t *)_ecore_xcb_screen)->root,
|
||||
type, XCB_GET_PROPERTY_TYPE_ANY, 0L, 1000000L);
|
||||
_ecore_xcb_cookie_cache(cookie.sequence);
|
||||
}
|
||||
|
||||
} /* ecore_x_window_prop_string_get_prefetch */
|
||||
|
||||
/**
|
||||
* Gets the reply of the GetProperty request sent by ecore_x_window_prop_string_get_prefetch().
|
||||
|
@ -729,7 +729,7 @@ ecore_x_window_prop_string_get_fetch(void)
|
|||
cookie.sequence = _ecore_xcb_cookie_get();
|
||||
reply = xcb_get_property_reply(_ecore_xcb_conn, cookie, NULL);
|
||||
_ecore_xcb_reply_cache(reply);
|
||||
}
|
||||
} /* ecore_x_window_prop_string_get_fetch */
|
||||
|
||||
/**
|
||||
* Get a window string property.
|
||||
|
@ -744,14 +744,14 @@ ecore_x_window_prop_string_get_fetch(void)
|
|||
*/
|
||||
EAPI char *
|
||||
ecore_x_window_prop_string_get(Ecore_X_Window window __UNUSED__,
|
||||
Ecore_X_Atom type __UNUSED__)
|
||||
Ecore_X_Atom type __UNUSED__)
|
||||
{
|
||||
xcb_get_property_reply_t *reply;
|
||||
char *str = NULL;
|
||||
char *str = NULL;
|
||||
|
||||
reply = _ecore_xcb_reply_get();
|
||||
if (!reply)
|
||||
return NULL;
|
||||
return NULL;
|
||||
|
||||
if (reply->type == ECORE_X_ATOM_UTF8_STRING)
|
||||
{
|
||||
|
@ -766,7 +766,7 @@ ecore_x_window_prop_string_get(Ecore_X_Window window __UNUSED__,
|
|||
}
|
||||
else
|
||||
{
|
||||
/* FIXME: to be done... */
|
||||
/* FIXME: to be done... */
|
||||
|
||||
/* #ifdef X_HAVE_UTF8_STRING */
|
||||
/* s = Xutf8TextPropertyToTextList(_ecore_xcb_conn, &xtp, */
|
||||
|
@ -789,7 +789,7 @@ ecore_x_window_prop_string_get(Ecore_X_Window window __UNUSED__,
|
|||
}
|
||||
|
||||
return str;
|
||||
}
|
||||
} /* ecore_x_window_prop_string_get */
|
||||
|
||||
/* FIXME : round trips because of GetWMProtocols */
|
||||
/* should we rewrite its code ? */
|
||||
|
@ -797,34 +797,34 @@ EAPI int
|
|||
ecore_x_window_prop_protocol_isset(Ecore_X_Window window,
|
||||
Ecore_X_WM_Protocol protocol)
|
||||
{
|
||||
xcb_get_property_cookie_t cookie;
|
||||
xcb_get_property_cookie_t cookie;
|
||||
xcb_get_wm_protocols_reply_t protocols;
|
||||
Ecore_X_Atom proto;
|
||||
uint32_t i;
|
||||
uint8_t ret = 0;
|
||||
Ecore_X_Atom proto;
|
||||
uint32_t i;
|
||||
uint8_t ret = 0;
|
||||
|
||||
/* check for invalid values */
|
||||
if (protocol >= ECORE_X_WM_PROTOCOL_NUM)
|
||||
return ret;
|
||||
return ret;
|
||||
|
||||
proto = _ecore_xcb_atoms_wm_protocols[protocol];
|
||||
|
||||
cookie = xcb_get_wm_protocols(_ecore_xcb_conn, window, ECORE_X_ATOM_WM_PROTOCOLS);
|
||||
|
||||
if (!xcb_get_wm_protocols_reply(_ecore_xcb_conn, cookie, &protocols, NULL))
|
||||
return ret;
|
||||
return ret;
|
||||
|
||||
for (i = 0; i < protocols.atoms_len; i++)
|
||||
if (protocols.atoms[i] == proto)
|
||||
{
|
||||
ret = 1;
|
||||
break;
|
||||
}
|
||||
if (protocols.atoms[i] == proto)
|
||||
{
|
||||
ret = 1;
|
||||
break;
|
||||
}
|
||||
|
||||
xcb_get_wm_protocols_reply_wipe(&protocols);
|
||||
|
||||
return ret;
|
||||
}
|
||||
} /* ecore_x_window_prop_protocol_isset */
|
||||
|
||||
/**
|
||||
* To be documented.
|
||||
|
@ -842,38 +842,41 @@ EAPI Ecore_X_WM_Protocol *
|
|||
ecore_x_window_prop_protocol_list_get(Ecore_X_Window window,
|
||||
int *num_ret)
|
||||
{
|
||||
xcb_get_property_cookie_t cookie;
|
||||
xcb_get_property_cookie_t cookie;
|
||||
xcb_get_wm_protocols_reply_t protocols;
|
||||
Ecore_X_WM_Protocol *prot_ret = NULL;
|
||||
uint32_t protos_count;
|
||||
uint32_t i;
|
||||
Ecore_X_WM_Protocol *prot_ret = NULL;
|
||||
uint32_t protos_count;
|
||||
uint32_t i;
|
||||
|
||||
cookie = xcb_get_wm_protocols(_ecore_xcb_conn, window, ECORE_X_ATOM_WM_PROTOCOLS);
|
||||
|
||||
if (!xcb_get_wm_protocols_reply(_ecore_xcb_conn, cookie, &protocols, NULL))
|
||||
return NULL;
|
||||
|
||||
if ((protocols.atoms_len <= 0)) return NULL;
|
||||
if ((protocols.atoms_len <= 0))
|
||||
return NULL;
|
||||
|
||||
prot_ret = calloc(1, protocols.atoms_len * sizeof(Ecore_X_WM_Protocol));
|
||||
if (!prot_ret)
|
||||
{
|
||||
xcb_get_wm_protocols_reply_wipe(&protocols);
|
||||
return NULL;
|
||||
xcb_get_wm_protocols_reply_wipe(&protocols);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
for (i = 0; i < protocols.atoms_len; i++)
|
||||
{
|
||||
Ecore_X_WM_Protocol j;
|
||||
Ecore_X_WM_Protocol j;
|
||||
|
||||
prot_ret[i] = -1;
|
||||
for (j = 0; j < ECORE_X_WM_PROTOCOL_NUM; j++)
|
||||
{
|
||||
if (_ecore_xcb_atoms_wm_protocols[j] == protocols.atoms[i])
|
||||
prot_ret[i] = j;
|
||||
}
|
||||
prot_ret[i] = -1;
|
||||
for (j = 0; j < ECORE_X_WM_PROTOCOL_NUM; j++)
|
||||
{
|
||||
if (_ecore_xcb_atoms_wm_protocols[j] == protocols.atoms[i])
|
||||
prot_ret[i] = j;
|
||||
}
|
||||
}
|
||||
xcb_get_wm_protocols_reply_wipe(&protocols);
|
||||
*num_ret = protos_count;
|
||||
|
||||
return prot_ret;
|
||||
}
|
||||
} /* ecore_x_window_prop_protocol_list_get */
|
||||
|
||||
|
|
|
@ -6,37 +6,35 @@
|
|||
#include "ecore_xcb_private.h"
|
||||
#include "Ecore_X.h"
|
||||
|
||||
|
||||
typedef struct _Shadow Shadow;
|
||||
typedef struct _Shadow Shadow;
|
||||
struct _Shadow
|
||||
{
|
||||
Shadow *parent;
|
||||
Shadow **children;
|
||||
Ecore_X_Window win;
|
||||
int children_num;
|
||||
short x, y;
|
||||
unsigned short w, h;
|
||||
Shadow *parent;
|
||||
Shadow **children;
|
||||
Ecore_X_Window win;
|
||||
int children_num;
|
||||
short x, y;
|
||||
unsigned short w, h;
|
||||
};
|
||||
|
||||
static int shadow_count = 0;
|
||||
static Shadow **shadow_base = NULL;
|
||||
static int shadow_num = 0;
|
||||
|
||||
|
||||
/* FIXME: round trips */
|
||||
static Shadow *
|
||||
_ecore_x_window_tree_walk(Ecore_X_Window window)
|
||||
{
|
||||
Shadow *s;
|
||||
Shadow **sl;
|
||||
Shadow *s;
|
||||
Shadow **sl;
|
||||
xcb_get_window_attributes_reply_t *reply_attr;
|
||||
xcb_get_geometry_reply_t *reply_geom;
|
||||
xcb_query_tree_reply_t *reply_tree;
|
||||
xcb_get_geometry_reply_t *reply_geom;
|
||||
xcb_query_tree_reply_t *reply_tree;
|
||||
xcb_get_window_attributes_cookie_t cookie_attr;
|
||||
xcb_get_geometry_cookie_t cookie_geom;
|
||||
xcb_query_tree_cookie_t cookie_tree;
|
||||
int i;
|
||||
int j;
|
||||
xcb_get_geometry_cookie_t cookie_geom;
|
||||
xcb_query_tree_cookie_t cookie_tree;
|
||||
int i;
|
||||
int j;
|
||||
|
||||
cookie_attr = xcb_get_window_attributes_unchecked(_ecore_xcb_conn, window);
|
||||
cookie_geom = xcb_get_geometry_unchecked(_ecore_xcb_conn, window);
|
||||
|
@ -46,31 +44,42 @@ _ecore_x_window_tree_walk(Ecore_X_Window window)
|
|||
if (!reply_attr)
|
||||
{
|
||||
reply_geom = xcb_get_geometry_reply(_ecore_xcb_conn, cookie_geom, NULL);
|
||||
if (reply_geom) free(reply_geom);
|
||||
if (reply_geom)
|
||||
free(reply_geom);
|
||||
|
||||
reply_tree = xcb_query_tree_reply(_ecore_xcb_conn, cookie_tree, NULL);
|
||||
if (reply_tree) free(reply_tree);
|
||||
if (reply_tree)
|
||||
free(reply_tree);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (reply_attr->map_state != XCB_MAP_STATE_VIEWABLE)
|
||||
{
|
||||
reply_geom = xcb_get_geometry_reply(_ecore_xcb_conn, cookie_geom, NULL);
|
||||
if (reply_geom) free(reply_geom);
|
||||
if (reply_geom)
|
||||
free(reply_geom);
|
||||
|
||||
reply_tree = xcb_query_tree_reply(_ecore_xcb_conn, cookie_tree, NULL);
|
||||
if (reply_tree) free(reply_tree);
|
||||
if (reply_tree)
|
||||
free(reply_tree);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
free(reply_attr);
|
||||
|
||||
s = calloc(1, sizeof(Shadow));
|
||||
if (!s) return NULL;
|
||||
if (!s)
|
||||
return NULL;
|
||||
|
||||
reply_geom = xcb_get_geometry_reply(_ecore_xcb_conn, cookie_geom, NULL);
|
||||
if (!reply_geom)
|
||||
{
|
||||
reply_tree = xcb_query_tree_reply(_ecore_xcb_conn, cookie_tree, NULL);
|
||||
if (reply_tree) free(reply_tree);
|
||||
if (reply_tree)
|
||||
free(reply_tree);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -84,121 +93,137 @@ _ecore_x_window_tree_walk(Ecore_X_Window window)
|
|||
|
||||
reply_tree = xcb_query_tree_reply(_ecore_xcb_conn, cookie_tree, NULL);
|
||||
if (reply_tree)
|
||||
/* if (XQueryTree(_ecore_xcb_conn, s->win, &root_win, &parent_win, */
|
||||
/* &list, &num)) */
|
||||
{
|
||||
/* if (XQueryTree(_ecore_xcb_conn, s->win, &root_win, &parent_win, */
|
||||
/* &list, &num)) */
|
||||
xcb_window_t *list;
|
||||
int num;
|
||||
int num;
|
||||
|
||||
num = xcb_query_tree_children_length(reply_tree);
|
||||
list = xcb_query_tree_children(reply_tree);
|
||||
|
||||
s->children = calloc(1, sizeof(Shadow *) * num);
|
||||
if (s->children)
|
||||
{
|
||||
s->children_num = num;
|
||||
for (i = 0; i < num; i++)
|
||||
{
|
||||
s->children[i] = _ecore_x_window_tree_walk(list[i]);
|
||||
if (s->children[i]) s->children[i]->parent = s;
|
||||
}
|
||||
/* compress list down */
|
||||
j = 0;
|
||||
for (i = 0; i < num; i++)
|
||||
{
|
||||
if (s->children[i])
|
||||
{
|
||||
s->children[j] = s->children[i];
|
||||
j++;
|
||||
}
|
||||
}
|
||||
if (j == 0)
|
||||
{
|
||||
free(s->children);
|
||||
s->children = NULL;
|
||||
s->children_num = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
s->children_num = j;
|
||||
sl = realloc(s->children, sizeof(Shadow *) * j);
|
||||
if (sl) s->children = sl;
|
||||
}
|
||||
}
|
||||
s->children = calloc(1, sizeof(Shadow *) * num);
|
||||
if (s->children)
|
||||
{
|
||||
s->children_num = num;
|
||||
for (i = 0; i < num; i++)
|
||||
{
|
||||
s->children[i] = _ecore_x_window_tree_walk(list[i]);
|
||||
if (s->children[i])
|
||||
s->children[i]->parent = s;
|
||||
}
|
||||
/* compress list down */
|
||||
j = 0;
|
||||
for (i = 0; i < num; i++)
|
||||
{
|
||||
if (s->children[i])
|
||||
{
|
||||
s->children[j] = s->children[i];
|
||||
j++;
|
||||
}
|
||||
}
|
||||
if (j == 0)
|
||||
{
|
||||
free(s->children);
|
||||
s->children = NULL;
|
||||
s->children_num = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
s->children_num = j;
|
||||
sl = realloc(s->children, sizeof(Shadow *) * j);
|
||||
if (sl)
|
||||
s->children = sl;
|
||||
}
|
||||
}
|
||||
|
||||
free(reply_tree);
|
||||
}
|
||||
|
||||
return s;
|
||||
}
|
||||
} /* _ecore_x_window_tree_walk */
|
||||
|
||||
static void
|
||||
_ecore_x_window_tree_shadow_free1(Shadow *s)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (!s) return;
|
||||
if (!s)
|
||||
return;
|
||||
|
||||
if (s->children)
|
||||
{
|
||||
for (i = 0; i < s->children_num; i++)
|
||||
{
|
||||
if (s->children[i])
|
||||
_ecore_x_window_tree_shadow_free1(s->children[i]);
|
||||
}
|
||||
free(s->children);
|
||||
for (i = 0; i < s->children_num; i++)
|
||||
{
|
||||
if (s->children[i])
|
||||
_ecore_x_window_tree_shadow_free1(s->children[i]);
|
||||
}
|
||||
free(s->children);
|
||||
}
|
||||
|
||||
free(s);
|
||||
}
|
||||
} /* _ecore_x_window_tree_shadow_free1 */
|
||||
|
||||
static void
|
||||
_ecore_x_window_tree_shadow_free(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (!shadow_base) return;
|
||||
if (!shadow_base)
|
||||
return;
|
||||
|
||||
for (i = 0; i < shadow_num; i++)
|
||||
{
|
||||
if (!shadow_base[i]) continue;
|
||||
_ecore_x_window_tree_shadow_free1(shadow_base[i]);
|
||||
if (!shadow_base[i])
|
||||
continue;
|
||||
|
||||
_ecore_x_window_tree_shadow_free1(shadow_base[i]);
|
||||
}
|
||||
free(shadow_base);
|
||||
shadow_base = NULL;
|
||||
shadow_num = 0;
|
||||
}
|
||||
} /* _ecore_x_window_tree_shadow_free */
|
||||
|
||||
static void
|
||||
_ecore_x_window_tree_shadow_populate(void)
|
||||
{
|
||||
Ecore_X_Window *roots;
|
||||
int i, num;
|
||||
Ecore_X_Window *roots;
|
||||
int i, num;
|
||||
|
||||
roots = ecore_x_window_root_list(&num);
|
||||
if (roots)
|
||||
{
|
||||
shadow_base = calloc(1, sizeof(Shadow *) * num);
|
||||
if (shadow_base)
|
||||
{
|
||||
shadow_num = num;
|
||||
for (i = 0; i < num; i++)
|
||||
shadow_base[i] = _ecore_x_window_tree_walk(roots[i]);
|
||||
}
|
||||
free(roots);
|
||||
shadow_base = calloc(1, sizeof(Shadow *) * num);
|
||||
if (shadow_base)
|
||||
{
|
||||
shadow_num = num;
|
||||
for (i = 0; i < num; i++)
|
||||
shadow_base[i] = _ecore_x_window_tree_walk(roots[i]);
|
||||
}
|
||||
|
||||
free(roots);
|
||||
}
|
||||
}
|
||||
} /* _ecore_x_window_tree_shadow_populate */
|
||||
|
||||
static void
|
||||
_ecore_x_window_tree_shadow_start(void)
|
||||
{
|
||||
shadow_count++;
|
||||
if (shadow_count > 1) return;
|
||||
if (shadow_count > 1)
|
||||
return;
|
||||
|
||||
_ecore_x_window_tree_shadow_populate();
|
||||
}
|
||||
} /* _ecore_x_window_tree_shadow_start */
|
||||
|
||||
static void
|
||||
_ecore_x_window_tree_shadow_stop(void)
|
||||
{
|
||||
shadow_count--;
|
||||
if (shadow_count != 0) return;
|
||||
if (shadow_count != 0)
|
||||
return;
|
||||
|
||||
_ecore_x_window_tree_shadow_free();
|
||||
}
|
||||
} /* _ecore_x_window_tree_shadow_stop */
|
||||
|
||||
Shadow *
|
||||
_ecore_x_window_shadow_tree_find_shadow(Shadow *s, Ecore_X_Window win)
|
||||
|
@ -206,18 +231,23 @@ _ecore_x_window_shadow_tree_find_shadow(Shadow *s, Ecore_X_Window win)
|
|||
Shadow *ss;
|
||||
int i;
|
||||
|
||||
if (s->win == win) return s;
|
||||
if (s->win == win)
|
||||
return s;
|
||||
|
||||
if (s->children)
|
||||
{
|
||||
for (i = 0; i < s->children_num; i++)
|
||||
{
|
||||
if (!s->children[i]) continue;
|
||||
if ((ss = _ecore_x_window_shadow_tree_find_shadow(s->children[i], win)))
|
||||
return ss;
|
||||
}
|
||||
for (i = 0; i < s->children_num; i++)
|
||||
{
|
||||
if (!s->children[i])
|
||||
continue;
|
||||
|
||||
if ((ss = _ecore_x_window_shadow_tree_find_shadow(s->children[i], win)))
|
||||
return ss;
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
} /* _ecore_x_window_shadow_tree_find_shadow */
|
||||
|
||||
Shadow *
|
||||
_ecore_x_window_shadow_tree_find(Ecore_X_Window base)
|
||||
|
@ -227,16 +257,18 @@ _ecore_x_window_shadow_tree_find(Ecore_X_Window base)
|
|||
|
||||
for (i = 0; i < shadow_num; i++)
|
||||
{
|
||||
if (!shadow_base[i]) continue;
|
||||
if ((s = _ecore_x_window_shadow_tree_find_shadow(shadow_base[i], base)))
|
||||
return s;
|
||||
if (!shadow_base[i])
|
||||
continue;
|
||||
|
||||
if ((s = _ecore_x_window_shadow_tree_find_shadow(shadow_base[i], base)))
|
||||
return s;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
} /* _ecore_x_window_shadow_tree_find */
|
||||
|
||||
static Ecore_X_Window
|
||||
_ecore_x_window_shadow_tree_at_xy_get_shadow(Shadow *s, int bx, int by, int x, int y,
|
||||
Ecore_X_Window *skip, int skip_num)
|
||||
Ecore_X_Window *skip, int skip_num)
|
||||
{
|
||||
Ecore_X_Window child;
|
||||
int i, j;
|
||||
|
@ -245,54 +277,63 @@ _ecore_x_window_shadow_tree_at_xy_get_shadow(Shadow *s, int bx, int by, int x, i
|
|||
wx = s->x + bx;
|
||||
wy = s->y + by;
|
||||
if (!((x >= wx) && (y >= wy) && (x < (wx + s->w)) && (y < (wy + s->h))))
|
||||
return 0;
|
||||
return 0;
|
||||
|
||||
if (s->children)
|
||||
{
|
||||
int skipit = 0;
|
||||
int skipit = 0;
|
||||
|
||||
for (i = s->children_num - 1; i >= 0; --i)
|
||||
{
|
||||
if (!s->children[i]) continue;
|
||||
skipit = 0;
|
||||
if (skip)
|
||||
{
|
||||
for (j = 0; j < skip_num; j++)
|
||||
{
|
||||
if (s->children[i]->win == skip[j])
|
||||
{
|
||||
skipit = 1;
|
||||
goto onward;
|
||||
}
|
||||
}
|
||||
}
|
||||
onward:
|
||||
if (!skipit)
|
||||
{
|
||||
if ((child = _ecore_x_window_shadow_tree_at_xy_get_shadow(s->children[i], wx, wy, x, y, skip, skip_num)))
|
||||
{
|
||||
return child;
|
||||
}
|
||||
}
|
||||
}
|
||||
for (i = s->children_num - 1; i >= 0; --i)
|
||||
{
|
||||
if (!s->children[i])
|
||||
continue;
|
||||
|
||||
skipit = 0;
|
||||
if (skip)
|
||||
{
|
||||
for (j = 0; j < skip_num; j++)
|
||||
{
|
||||
if (s->children[i]->win == skip[j])
|
||||
{
|
||||
skipit = 1;
|
||||
goto onward;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
onward:
|
||||
if (!skipit)
|
||||
{
|
||||
if ((child = _ecore_x_window_shadow_tree_at_xy_get_shadow(s->children[i], wx, wy, x, y, skip, skip_num)))
|
||||
{
|
||||
return child;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return s->win;
|
||||
}
|
||||
} /* _ecore_x_window_shadow_tree_at_xy_get_shadow */
|
||||
|
||||
static Ecore_X_Window
|
||||
_ecore_x_window_shadow_tree_at_xy_get(Ecore_X_Window base, int bx, int by, int x, int y,
|
||||
Ecore_X_Window *skip, int skip_num)
|
||||
Ecore_X_Window *skip, int skip_num)
|
||||
{
|
||||
Shadow *s;
|
||||
|
||||
if (!shadow_base)
|
||||
{
|
||||
_ecore_x_window_tree_shadow_populate();
|
||||
if (!shadow_base) return 0;
|
||||
_ecore_x_window_tree_shadow_populate();
|
||||
if (!shadow_base)
|
||||
return 0;
|
||||
}
|
||||
|
||||
s = _ecore_x_window_shadow_tree_find(base);
|
||||
if (!s) return 0;
|
||||
if (!s)
|
||||
return 0;
|
||||
|
||||
return _ecore_x_window_shadow_tree_at_xy_get_shadow(s, bx, by, x, y, skip, skip_num);
|
||||
}
|
||||
} /* _ecore_x_window_shadow_tree_at_xy_get */
|
||||
|
||||
/**
|
||||
* Retrieves the top, visible window at the given location,
|
||||
|
@ -310,7 +351,7 @@ EAPI Ecore_X_Window
|
|||
ecore_x_window_shadow_tree_at_xy_with_skip_get(Ecore_X_Window base, int x, int y, Ecore_X_Window *skip, int skip_num)
|
||||
{
|
||||
return _ecore_x_window_shadow_tree_at_xy_get(base, 0, 0, x, y, skip, skip_num);
|
||||
}
|
||||
} /* ecore_x_window_shadow_tree_at_xy_with_skip_get */
|
||||
|
||||
/**
|
||||
* Retrieves the parent window a given window has. This uses the shadow window
|
||||
|
@ -324,25 +365,31 @@ EAPI Ecore_X_Window
|
|||
ecore_x_window_shadow_parent_get(Ecore_X_Window root, Ecore_X_Window win)
|
||||
{
|
||||
Shadow *s;
|
||||
int i;
|
||||
int i;
|
||||
|
||||
if (!shadow_base)
|
||||
{
|
||||
_ecore_x_window_tree_shadow_populate();
|
||||
if (!shadow_base) return 0;
|
||||
_ecore_x_window_tree_shadow_populate();
|
||||
if (!shadow_base)
|
||||
return 0;
|
||||
}
|
||||
|
||||
for (i = 0; i < shadow_num; i++)
|
||||
{
|
||||
if (!shadow_base[i]) continue;
|
||||
s = _ecore_x_window_shadow_tree_find_shadow(shadow_base[i], win);
|
||||
if (s)
|
||||
{
|
||||
if (!s->parent) return 0;
|
||||
return s->parent->win;
|
||||
}
|
||||
if (!shadow_base[i])
|
||||
continue;
|
||||
|
||||
s = _ecore_x_window_shadow_tree_find_shadow(shadow_base[i], win);
|
||||
if (s)
|
||||
{
|
||||
if (!s->parent)
|
||||
return 0;
|
||||
|
||||
return s->parent->win;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
} /* ecore_x_window_shadow_parent_get */
|
||||
|
||||
/**
|
||||
* Flushes the window shadow tree so nothing is stored.
|
||||
|
@ -352,4 +399,5 @@ EAPI void
|
|||
ecore_x_window_shadow_tree_flush(void)
|
||||
{
|
||||
_ecore_x_window_tree_shadow_free();
|
||||
}
|
||||
} /* ecore_x_window_shadow_tree_flush */
|
||||
|
||||
|
|
|
@ -4,20 +4,17 @@
|
|||
|
||||
#include "ecore_xcb_private.h"
|
||||
|
||||
|
||||
/**
|
||||
* @defgroup Ecore_X_Xinerama_Group X Xinerama Extension Functions
|
||||
*
|
||||
* Functions related to the X Xinerama extension.
|
||||
*/
|
||||
|
||||
|
||||
#ifdef ECORE_XCB_XINERAMA
|
||||
static int _xinerama_available = 0;
|
||||
static xcb_xinerama_query_version_cookie_t _ecore_xcb_xinerama_init_cookie;
|
||||
#endif /* ECORE_XCB_XINERAMA */
|
||||
|
||||
|
||||
/* To avoid round trips, the initialization is separated in 2
|
||||
functions: _ecore_xcb_xinerama_init and
|
||||
_ecore_xcb_xinerama_init_finalize. The first one gets the cookies and
|
||||
|
@ -29,8 +26,9 @@ _ecore_x_xinerama_init(const xcb_query_extension_reply_t *reply)
|
|||
#ifdef ECORE_XCB_XINERAMA
|
||||
if (reply && (reply->present))
|
||||
_ecore_xcb_xinerama_init_cookie = xcb_xinerama_query_version_unchecked(_ecore_xcb_conn, 1, 2);
|
||||
|
||||
#endif /* ECORE_XCB_XINERAMA */
|
||||
}
|
||||
} /* _ecore_x_xinerama_init */
|
||||
|
||||
void
|
||||
_ecore_x_xinerama_init_finalize(void)
|
||||
|
@ -39,18 +37,19 @@ _ecore_x_xinerama_init_finalize(void)
|
|||
xcb_xinerama_query_version_reply_t *reply;
|
||||
|
||||
reply = xcb_xinerama_query_version_reply(_ecore_xcb_conn,
|
||||
_ecore_xcb_xinerama_init_cookie, NULL);
|
||||
_ecore_xcb_xinerama_init_cookie, NULL);
|
||||
|
||||
if (reply)
|
||||
{
|
||||
if ((reply->major >= 1) &&
|
||||
(reply->minor >= 1))
|
||||
_xinerama_available = 1;
|
||||
_xinerama_available = 1;
|
||||
|
||||
free(reply);
|
||||
}
|
||||
#endif /* ECORE_XCB_XINERAMA */
|
||||
}
|
||||
|
||||
#endif /* ECORE_XCB_XINERAMA */
|
||||
} /* _ecore_x_xinerama_init_finalize */
|
||||
|
||||
/**
|
||||
* Return whether the X server supports the Xinerama Extension.
|
||||
|
@ -65,11 +64,10 @@ ecore_x_xinerama_query(void)
|
|||
{
|
||||
#ifdef ECORE_XCB_XINERAMA
|
||||
return _xinerama_available;
|
||||
#else
|
||||
#else /* ifdef ECORE_XCB_XINERAMA */
|
||||
return 0;
|
||||
#endif /* ECORE_XCB_XINERAMA */
|
||||
}
|
||||
|
||||
} /* ecore_x_xinerama_query */
|
||||
|
||||
/**
|
||||
* Sends the XineramaQueryScreens request.
|
||||
|
@ -84,8 +82,7 @@ ecore_x_xinerama_query_screens_prefetch(void)
|
|||
cookie = xcb_xinerama_query_screens_unchecked(_ecore_xcb_conn);
|
||||
_ecore_xcb_cookie_cache(cookie.sequence);
|
||||
#endif /* ECORE_XCB_XINERAMA */
|
||||
}
|
||||
|
||||
} /* ecore_x_xinerama_query_screens_prefetch */
|
||||
|
||||
/**
|
||||
* Gets the reply of the XineramaQueryScreens request sent by ecore_x_xinerama_query_screens_prefetch().
|
||||
|
@ -102,8 +99,7 @@ ecore_x_xinerama_query_screens_fetch(void)
|
|||
reply = xcb_xinerama_query_screens_reply(_ecore_xcb_conn, cookie, NULL);
|
||||
_ecore_xcb_reply_cache(reply);
|
||||
#endif /* ECORE_XCB_XINERAMA */
|
||||
}
|
||||
|
||||
} /* ecore_x_xinerama_query_screens_fetch */
|
||||
|
||||
/**
|
||||
* Return the number of screens.
|
||||
|
@ -119,21 +115,21 @@ ecore_x_xinerama_query_screens_fetch(void)
|
|||
EAPI int
|
||||
ecore_x_xinerama_screen_count_get(void)
|
||||
{
|
||||
int screen_count = 0;
|
||||
int screen_count = 0;
|
||||
#ifdef ECORE_XCB_XINERAMA
|
||||
xcb_xinerama_screen_info_iterator_t iter;
|
||||
xcb_xinerama_query_screens_reply_t *reply;
|
||||
|
||||
reply = _ecore_xcb_reply_get();
|
||||
if (!reply) return 0;
|
||||
if (!reply)
|
||||
return 0;
|
||||
|
||||
iter = xcb_xinerama_query_screens_screen_info_iterator(reply);
|
||||
screen_count = iter.rem;
|
||||
#endif /* ECORE_XCB_XINERAMA */
|
||||
|
||||
return screen_count;
|
||||
}
|
||||
|
||||
} /* ecore_x_xinerama_screen_count_get */
|
||||
|
||||
/**
|
||||
* Get the geometry of the screen.
|
||||
|
@ -166,10 +162,17 @@ ecore_x_xinerama_screen_geometry_get(int screen,
|
|||
reply = _ecore_xcb_reply_get();
|
||||
if (!reply)
|
||||
{
|
||||
if (x) *x = 0;
|
||||
if (y) *y = 0;
|
||||
if (width) *width = ((xcb_screen_t *)_ecore_xcb_screen)->width_in_pixels;
|
||||
if (height) *height = ((xcb_screen_t *)_ecore_xcb_screen)->height_in_pixels;
|
||||
if (x)
|
||||
*x = 0;
|
||||
|
||||
if (y)
|
||||
*y = 0;
|
||||
|
||||
if (width)
|
||||
*width = ((xcb_screen_t *)_ecore_xcb_screen)->width_in_pixels;
|
||||
|
||||
if (height)
|
||||
*height = ((xcb_screen_t *)_ecore_xcb_screen)->height_in_pixels;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -179,19 +182,35 @@ ecore_x_xinerama_screen_geometry_get(int screen,
|
|||
{
|
||||
if (screen == 0)
|
||||
{
|
||||
if (x) *x = iter.data->x_org;
|
||||
if (y) *y = iter.data->y_org;
|
||||
if (width) *width = iter.data->width;
|
||||
if (height) *height = iter.data->height;
|
||||
if (x)
|
||||
*x = iter.data->x_org;
|
||||
|
||||
if (y)
|
||||
*y = iter.data->y_org;
|
||||
|
||||
if (width)
|
||||
*width = iter.data->width;
|
||||
|
||||
if (height)
|
||||
*height = iter.data->height;
|
||||
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
#endif /* ECORE_XCB_XINERAMA */
|
||||
|
||||
if (x) *x = 0;
|
||||
if (y) *y = 0;
|
||||
if (width) *width = ((xcb_screen_t *)_ecore_xcb_screen)->width_in_pixels;
|
||||
if (height) *height = ((xcb_screen_t *)_ecore_xcb_screen)->height_in_pixels;
|
||||
if (x)
|
||||
*x = 0;
|
||||
|
||||
if (y)
|
||||
*y = 0;
|
||||
|
||||
if (width)
|
||||
*width = ((xcb_screen_t *)_ecore_xcb_screen)->width_in_pixels;
|
||||
|
||||
if (height)
|
||||
*height = ((xcb_screen_t *)_ecore_xcb_screen)->height_in_pixels;
|
||||
|
||||
return 0;
|
||||
}
|
||||
} /* ecore_x_xinerama_screen_geometry_get */
|
||||
|
||||
|
|
Loading…
Reference in New Issue