ecrustify on ecore-x.

SVN revision: 64239
This commit is contained in:
Carsten Haitzler 2011-10-21 05:40:59 +00:00
parent 58cbf16625
commit 37e2ab21c1
75 changed files with 11210 additions and 9060 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -5,9 +5,9 @@
#define ECORE_X_ATOMS_COUNT 199
typedef struct _Xcb_Atom Xcb_Atom;
struct _Xcb_Atom
struct _Xcb_Atom
{
const char *name;
const char *name;
Ecore_X_Atom *atom;
};
@ -15,7 +15,7 @@ struct _Xcb_Atom
/* local variables */
static xcb_intern_atom_cookie_t cookies[ECORE_X_ATOMS_COUNT];
static Xcb_Atom atoms[] =
static Xcb_Atom atoms[] =
{
{ "ATOM", &ECORE_X_ATOM_ATOM },
{ "CARDINAL", &ECORE_X_ATOM_CARDINAL },
@ -124,12 +124,12 @@ static Xcb_Atom atoms[] =
{ "_NET_WM_WINDOW_TYPE_DIALOG", &ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DIALOG },
{ "_NET_WM_WINDOW_TYPE_NORMAL", &ECORE_X_ATOM_NET_WM_WINDOW_TYPE_NORMAL },
{ "_NET_WM_WINDOW_TYPE_DROPDOWN_MENU",
&ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DROPDOWN_MENU },
&ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DROPDOWN_MENU },
{ "_NET_WM_WINDOW_TYPE_POPUP_MENU",
&ECORE_X_ATOM_NET_WM_WINDOW_TYPE_POPUP_MENU },
&ECORE_X_ATOM_NET_WM_WINDOW_TYPE_POPUP_MENU },
{ "_NET_WM_WINDOW_TYPE_TOOLTIP", &ECORE_X_ATOM_NET_WM_WINDOW_TYPE_TOOLTIP },
{ "_NET_WM_WINDOW_TYPE_NOTIFICATION",
&ECORE_X_ATOM_NET_WM_WINDOW_TYPE_NOTIFICATION },
&ECORE_X_ATOM_NET_WM_WINDOW_TYPE_NOTIFICATION },
{ "_NET_WM_WINDOW_TYPE_COMBO", &ECORE_X_ATOM_NET_WM_WINDOW_TYPE_COMBO },
{ "_NET_WM_WINDOW_TYPE_DND", &ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DND },
@ -137,9 +137,9 @@ static Xcb_Atom atoms[] =
{ "_NET_WM_STATE_MODAL", &ECORE_X_ATOM_NET_WM_STATE_MODAL },
{ "_NET_WM_STATE_STICKY", &ECORE_X_ATOM_NET_WM_STATE_STICKY },
{ "_NET_WM_STATE_MAXIMIZED_VERT",
&ECORE_X_ATOM_NET_WM_STATE_MAXIMIZED_VERT },
&ECORE_X_ATOM_NET_WM_STATE_MAXIMIZED_VERT },
{ "_NET_WM_STATE_MAXIMIZED_HORZ",
&ECORE_X_ATOM_NET_WM_STATE_MAXIMIZED_HORZ },
&ECORE_X_ATOM_NET_WM_STATE_MAXIMIZED_HORZ },
{ "_NET_WM_STATE_SHADED", &ECORE_X_ATOM_NET_WM_STATE_SHADED },
{ "_NET_WM_STATE_SKIP_TASKBAR", &ECORE_X_ATOM_NET_WM_STATE_SKIP_TASKBAR },
{ "_NET_WM_STATE_SKIP_PAGER", &ECORE_X_ATOM_NET_WM_STATE_SKIP_PAGER },
@ -148,7 +148,7 @@ static Xcb_Atom atoms[] =
{ "_NET_WM_STATE_ABOVE", &ECORE_X_ATOM_NET_WM_STATE_ABOVE },
{ "_NET_WM_STATE_BELOW", &ECORE_X_ATOM_NET_WM_STATE_BELOW },
{ "_NET_WM_STATE_DEMANDS_ATTENTION",
&ECORE_X_ATOM_NET_WM_STATE_DEMANDS_ATTENTION },
&ECORE_X_ATOM_NET_WM_STATE_DEMANDS_ATTENTION },
{ "_NET_WM_ALLOWED_ACTIONS", &ECORE_X_ATOM_NET_WM_ALLOWED_ACTIONS },
{ "_NET_WM_ACTION_MOVE", &ECORE_X_ATOM_NET_WM_ACTION_MOVE },
@ -157,12 +157,12 @@ static Xcb_Atom atoms[] =
{ "_NET_WM_ACTION_SHADE", &ECORE_X_ATOM_NET_WM_ACTION_SHADE },
{ "_NET_WM_ACTION_STICK", &ECORE_X_ATOM_NET_WM_ACTION_STICK },
{ "_NET_WM_ACTION_MAXIMIZE_HORZ",
&ECORE_X_ATOM_NET_WM_ACTION_MAXIMIZE_HORZ },
&ECORE_X_ATOM_NET_WM_ACTION_MAXIMIZE_HORZ },
{ "_NET_WM_ACTION_MAXIMIZE_VERT",
&ECORE_X_ATOM_NET_WM_ACTION_MAXIMIZE_VERT },
&ECORE_X_ATOM_NET_WM_ACTION_MAXIMIZE_VERT },
{ "_NET_WM_ACTION_FULLSCREEN", &ECORE_X_ATOM_NET_WM_ACTION_FULLSCREEN },
{ "_NET_WM_ACTION_CHANGE_DESKTOP",
&ECORE_X_ATOM_NET_WM_ACTION_CHANGE_DESKTOP },
&ECORE_X_ATOM_NET_WM_ACTION_CHANGE_DESKTOP },
{ "_NET_WM_ACTION_CLOSE", &ECORE_X_ATOM_NET_WM_ACTION_CLOSE },
{ "_NET_WM_ACTION_ABOVE", &ECORE_X_ATOM_NET_WM_ACTION_ABOVE },
{ "_NET_WM_ACTION_BELOW", &ECORE_X_ATOM_NET_WM_ACTION_BELOW },
@ -180,7 +180,7 @@ static Xcb_Atom atoms[] =
{ "_NET_WM_PING", &ECORE_X_ATOM_NET_WM_PING },
{ "_NET_WM_SYNC_REQUEST", &ECORE_X_ATOM_NET_WM_SYNC_REQUEST },
{ "_NET_WM_SYNC_REQUEST_COUNTER",
&ECORE_X_ATOM_NET_WM_SYNC_REQUEST_COUNTER },
&ECORE_X_ATOM_NET_WM_SYNC_REQUEST_COUNTER },
{ "_NET_WM_WINDOW_OPACITY", &ECORE_X_ATOM_NET_WM_WINDOW_OPACITY },
{ "_NET_WM_WINDOW_SHADOW", &ECORE_X_ATOM_NET_WM_WINDOW_SHADOW },
@ -202,12 +202,12 @@ static Xcb_Atom atoms[] =
{ "_E_VIRTUAL_KEYBOARD_NUMERIC", &ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_NUMERIC },
{ "_E_VIRTUAL_KEYBOARD_PIN", &ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_PIN },
{ "_E_VIRTUAL_KEYBOARD_PHONE_NUMBER",
&ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_PHONE_NUMBER },
&ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_PHONE_NUMBER },
{ "_E_VIRTUAL_KEYBOARD_HEX", &ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_HEX },
{ "_E_VIRTUAL_KEYBOARD_TERMINAL",
&ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_TERMINAL },
{ "_E_VIRTUAL_KEYBOARD_PASSWORD",
&ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_PASSWORD },
&ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_TERMINAL },
{ "_E_VIRTUAL_KEYBOARD_PASSWORD",
&ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_PASSWORD },
{ "_E_VIRTUAL_KEYBOARD_IP", &ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_IP },
{ "_E_VIRTUAL_KEYBOARD_HOST", &ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_HOST },
{ "_E_VIRTUAL_KEYBOARD_FILE", &ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_FILE },
@ -233,22 +233,22 @@ static Xcb_Atom atoms[] =
{ "_E_ILLUME_DRAG_START", &ECORE_X_ATOM_E_ILLUME_DRAG_START },
{ "_E_ILLUME_DRAG_END", &ECORE_X_ATOM_E_ILLUME_DRAG_END },
{ "_E_ILLUME_INDICATOR_GEOMETRY",
&ECORE_X_ATOM_E_ILLUME_INDICATOR_GEOMETRY },
&ECORE_X_ATOM_E_ILLUME_INDICATOR_GEOMETRY },
{ "_E_ILLUME_SOFTKEY_GEOMETRY", &ECORE_X_ATOM_E_ILLUME_SOFTKEY_GEOMETRY },
{ "_E_ILLUME_KEYBOARD_GEOMETRY", &ECORE_X_ATOM_E_ILLUME_KEYBOARD_GEOMETRY },
{ "_E_ILLUME_QUICKPANEL", &ECORE_X_ATOM_E_ILLUME_QUICKPANEL },
{ "_E_ILLUME_QUICKPANEL_STATE", &ECORE_X_ATOM_E_ILLUME_QUICKPANEL_STATE },
{ "_E_ILLUME_QUICKPANEL_STATE_TOGGLE",
&ECORE_X_ATOM_E_ILLUME_QUICKPANEL_STATE_TOGGLE },
&ECORE_X_ATOM_E_ILLUME_QUICKPANEL_STATE_TOGGLE },
{ "_E_ILLUME_QUICKPANEL_ON", &ECORE_X_ATOM_E_ILLUME_QUICKPANEL_ON },
{ "_E_ILLUME_QUICKPANEL_OFF", &ECORE_X_ATOM_E_ILLUME_QUICKPANEL_OFF },
{ "_E_ILLUME_QUICKPANEL_PRIORITY_MAJOR",
&ECORE_X_ATOM_E_ILLUME_QUICKPANEL_PRIORITY_MAJOR },
&ECORE_X_ATOM_E_ILLUME_QUICKPANEL_PRIORITY_MAJOR },
{ "_E_ILLUME_QUICKPANEL_PRIORITY_MINOR",
&ECORE_X_ATOM_E_ILLUME_QUICKPANEL_PRIORITY_MINOR },
&ECORE_X_ATOM_E_ILLUME_QUICKPANEL_PRIORITY_MINOR },
{ "_E_ILLUME_QUICKPANEL_ZONE", &ECORE_X_ATOM_E_ILLUME_QUICKPANEL_ZONE },
{ "_E_ILLUME_QUICKPANEL_POSITION_UPDATE",
&ECORE_X_ATOM_E_ILLUME_QUICKPANEL_POSITION_UPDATE },
&ECORE_X_ATOM_E_ILLUME_QUICKPANEL_POSITION_UPDATE },
{ "_E_COMP_SYNC_COUNTER", &ECORE_X_ATOM_E_COMP_SYNC_COUNTER },
{ "_E_COMP_SYNC_DRAW_DONE", &ECORE_X_ATOM_E_COMP_SYNC_DRAW_DONE },
@ -264,8 +264,8 @@ static Xcb_Atom atoms[] =
{ "_E_VIDEO_POSITION", &ECORE_X_ATOM_E_VIDEO_POSITION }
};
void
_ecore_xcb_atoms_init(void)
void
_ecore_xcb_atoms_init(void)
{
int i = 0, num = 0;
@ -273,16 +273,16 @@ _ecore_xcb_atoms_init(void)
CHECK_XCB_CONN;
num = (sizeof(atoms) / sizeof(Xcb_Atom));
for (i = 0; i < num; i++)
for (i = 0; i < num; i++)
{
cookies[i] =
xcb_intern_atom_unchecked(_ecore_xcb_conn, 0,
cookies[i] =
xcb_intern_atom_unchecked(_ecore_xcb_conn, 0,
strlen(atoms[i].name), atoms[i].name);
}
}
void
_ecore_xcb_atoms_finalize(void)
void
_ecore_xcb_atoms_finalize(void)
{
int i = 0, num = 0;
@ -290,7 +290,7 @@ _ecore_xcb_atoms_finalize(void)
CHECK_XCB_CONN;
num = (sizeof(atoms) / sizeof(Xcb_Atom));
for (i = 0; i < num; i++)
for (i = 0; i < num; i++)
{
xcb_intern_atom_reply_t *reply = NULL;
@ -303,13 +303,13 @@ _ecore_xcb_atoms_finalize(void)
/**
* @defgroup Ecore_X_Atom_Group XCB Atom Functions
*
*
* Functions that operate on atoms
*/
/**
* Retrieves the atom value associated to a name.
*
*
* @param name Unused.
* @return Associated atom value.
*
@ -321,11 +321,11 @@ _ecore_xcb_atoms_finalize(void)
* To use this function, you must call before, and in order,
* ecore_x_atom_get_prefetch(), which sends the InternAtom request,
* then ecore_x_atom_get_fetch(), which gets the reply.
*
*
* @ingroup Ecore_X_Atom_Group
*/
EAPI Ecore_X_Atom
ecore_x_atom_get(const char *name)
EAPI Ecore_X_Atom
ecore_x_atom_get(const char *name)
{
xcb_intern_atom_cookie_t cookie;
xcb_intern_atom_reply_t *reply;
@ -344,14 +344,14 @@ ecore_x_atom_get(const char *name)
/**
* Retrieves the name of the given atom.
*
* @param atom
*
* @param atom
* @return The name of the atom.
*
* @ingroup Ecore_X_Atom_Group
*/
EAPI char *
ecore_x_atom_name_get(Ecore_X_Atom atom)
ecore_x_atom_name_get(Ecore_X_Atom atom)
{
xcb_get_atom_name_cookie_t cookie;
xcb_get_atom_name_reply_t *reply;
@ -366,7 +366,7 @@ ecore_x_atom_name_get(Ecore_X_Atom atom)
if (!reply) return NULL;
len = xcb_get_atom_name_name_length(reply);
name = (char *)malloc(sizeof(char) * (len + 1));
if (!name)
if (!name)
{
free(reply);
return NULL;
@ -378,8 +378,10 @@ ecore_x_atom_name_get(Ecore_X_Atom atom)
return name;
}
EAPI void
ecore_x_atoms_get(const char **names, int num, Ecore_X_Atom *atoms)
EAPI void
ecore_x_atoms_get(const char **names,
int num,
Ecore_X_Atom *atoms)
{
xcb_intern_atom_cookie_t cookies[num];
int i = 0;
@ -387,13 +389,13 @@ ecore_x_atoms_get(const char **names, int num, Ecore_X_Atom *atoms)
LOGFN(__FILE__, __LINE__, __FUNCTION__);
CHECK_XCB_CONN;
for (i = 0; i < num; i++)
for (i = 0; i < num; i++)
{
cookies[i] =
xcb_intern_atom_unchecked(_ecore_xcb_conn, 0,
cookies[i] =
xcb_intern_atom_unchecked(_ecore_xcb_conn, 0,
strlen(names[i]), names[i]);
}
for (i = 0; i < num; i++)
for (i = 0; i < num; i++)
{
xcb_intern_atom_reply_t *reply = NULL;
@ -403,3 +405,4 @@ ecore_x_atoms_get(const char **names, int num, Ecore_X_Atom *atoms)
free(reply);
}
}

View File

@ -6,8 +6,8 @@
/* local variables */
static Eina_Bool _composite_avail = EINA_FALSE;
void
_ecore_xcb_composite_init(void)
void
_ecore_xcb_composite_init(void)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
@ -16,8 +16,8 @@ _ecore_xcb_composite_init(void)
#endif
}
void
_ecore_xcb_composite_finalize(void)
void
_ecore_xcb_composite_finalize(void)
{
#ifdef ECORE_XCB_COMPOSITE
const xcb_query_extension_reply_t *ext_reply;
@ -27,34 +27,34 @@ _ecore_xcb_composite_finalize(void)
#ifdef ECORE_XCB_COMPOSITE
ext_reply = xcb_get_extension_data(_ecore_xcb_conn, &xcb_composite_id);
if ((ext_reply) && (ext_reply->present))
if ((ext_reply) && (ext_reply->present))
{
xcb_composite_query_version_cookie_t cookie;
xcb_composite_query_version_reply_t *reply;
cookie =
xcb_composite_query_version_unchecked(_ecore_xcb_conn,
XCB_COMPOSITE_MAJOR_VERSION,
cookie =
xcb_composite_query_version_unchecked(_ecore_xcb_conn,
XCB_COMPOSITE_MAJOR_VERSION,
XCB_COMPOSITE_MINOR_VERSION);
reply =
reply =
xcb_composite_query_version_reply(_ecore_xcb_conn, cookie, NULL);
if (reply)
if (reply)
{
// if ((reply->major_version >= XCB_COMPOSITE_MAJOR_VERSION) &&
if (reply->minor_version >= XCB_COMPOSITE_MINOR_VERSION)
{
// if ((reply->major_version >= XCB_COMPOSITE_MAJOR_VERSION) &&
if (reply->minor_version >= XCB_COMPOSITE_MINOR_VERSION)
{
# ifdef ECORE_XCB_RENDER
if (_ecore_xcb_render_avail_get())
{
if (_ecore_xcb_render_avail_get())
{
# ifdef ECORE_XCB_XFIXES
if (_ecore_xcb_xfixes_avail_get())
_composite_avail = EINA_TRUE;
if (_ecore_xcb_xfixes_avail_get())
_composite_avail = EINA_TRUE;
# endif
}
}
# endif
}
}
free(reply);
free(reply);
}
}
#endif
@ -62,26 +62,27 @@ _ecore_xcb_composite_finalize(void)
/**
* @defgroup Ecore_X_Composite_Group X Composite Extension Functions
*
*
* Functions related to the X Composite Extension
*/
/**
* Return whether the Composite Extension is available
*
*
* @return EINA_TRUE is the Composite Extension is available, EINA_FALSE if not
*
*
* @ingroup Ecore_X_Composite_Group
*/
EAPI Eina_Bool
ecore_x_composite_query(void)
EAPI Eina_Bool
ecore_x_composite_query(void)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
return _composite_avail;
}
EAPI void
ecore_x_composite_redirect_window(Ecore_X_Window win, Ecore_X_Composite_Update_Type type)
EAPI void
ecore_x_composite_redirect_window(Ecore_X_Window win,
Ecore_X_Composite_Update_Type type)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
CHECK_XCB_CONN;
@ -91,11 +92,12 @@ ecore_x_composite_redirect_window(Ecore_X_Window win, Ecore_X_Composite_Update_T
#ifdef ECORE_XCB_COMPOSITE
uint8_t update = XCB_COMPOSITE_REDIRECT_AUTOMATIC;
switch (type)
switch (type)
{
case ECORE_X_COMPOSITE_UPDATE_AUTOMATIC:
update = XCB_COMPOSITE_REDIRECT_AUTOMATIC;
break;
case ECORE_X_COMPOSITE_UPDATE_MANUAL:
update = XCB_COMPOSITE_REDIRECT_MANUAL;
break;
@ -105,8 +107,9 @@ ecore_x_composite_redirect_window(Ecore_X_Window win, Ecore_X_Composite_Update_T
#endif
}
EAPI void
ecore_x_composite_redirect_subwindows(Ecore_X_Window win, Ecore_X_Composite_Update_Type type)
EAPI void
ecore_x_composite_redirect_subwindows(Ecore_X_Window win,
Ecore_X_Composite_Update_Type type)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
CHECK_XCB_CONN;
@ -116,11 +119,12 @@ ecore_x_composite_redirect_subwindows(Ecore_X_Window win, Ecore_X_Composite_Upda
#ifdef ECORE_XCB_COMPOSITE
uint8_t update = XCB_COMPOSITE_REDIRECT_AUTOMATIC;
switch (type)
switch (type)
{
case ECORE_X_COMPOSITE_UPDATE_AUTOMATIC:
update = XCB_COMPOSITE_REDIRECT_AUTOMATIC;
break;
case ECORE_X_COMPOSITE_UPDATE_MANUAL:
update = XCB_COMPOSITE_REDIRECT_MANUAL;
break;
@ -130,8 +134,9 @@ ecore_x_composite_redirect_subwindows(Ecore_X_Window win, Ecore_X_Composite_Upda
#endif
}
EAPI void
ecore_x_composite_unredirect_window(Ecore_X_Window win, Ecore_X_Composite_Update_Type type)
EAPI void
ecore_x_composite_unredirect_window(Ecore_X_Window win,
Ecore_X_Composite_Update_Type type)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
CHECK_XCB_CONN;
@ -141,11 +146,12 @@ ecore_x_composite_unredirect_window(Ecore_X_Window win, Ecore_X_Composite_Update
#ifdef ECORE_XCB_COMPOSITE
uint8_t update = XCB_COMPOSITE_REDIRECT_AUTOMATIC;
switch (type)
switch (type)
{
case ECORE_X_COMPOSITE_UPDATE_AUTOMATIC:
update = XCB_COMPOSITE_REDIRECT_AUTOMATIC;
break;
case ECORE_X_COMPOSITE_UPDATE_MANUAL:
update = XCB_COMPOSITE_REDIRECT_MANUAL;
break;
@ -155,8 +161,9 @@ ecore_x_composite_unredirect_window(Ecore_X_Window win, Ecore_X_Composite_Update
#endif
}
EAPI void
ecore_x_composite_unredirect_subwindows(Ecore_X_Window win, Ecore_X_Composite_Update_Type type)
EAPI void
ecore_x_composite_unredirect_subwindows(Ecore_X_Window win,
Ecore_X_Composite_Update_Type type)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
CHECK_XCB_CONN;
@ -166,11 +173,12 @@ ecore_x_composite_unredirect_subwindows(Ecore_X_Window win, Ecore_X_Composite_Up
#ifdef ECORE_XCB_COMPOSITE
uint8_t update = XCB_COMPOSITE_REDIRECT_AUTOMATIC;
switch (type)
switch (type)
{
case ECORE_X_COMPOSITE_UPDATE_AUTOMATIC:
update = XCB_COMPOSITE_REDIRECT_AUTOMATIC;
break;
case ECORE_X_COMPOSITE_UPDATE_MANUAL:
update = XCB_COMPOSITE_REDIRECT_MANUAL;
break;
@ -180,8 +188,8 @@ ecore_x_composite_unredirect_subwindows(Ecore_X_Window win, Ecore_X_Composite_Up
#endif
}
EAPI Ecore_X_Pixmap
ecore_x_composite_name_window_pixmap_get(Ecore_X_Window win)
EAPI Ecore_X_Pixmap
ecore_x_composite_name_window_pixmap_get(Ecore_X_Window win)
{
#ifdef ECORE_XCB_COMPOSITE
Ecore_X_Pixmap pmap = XCB_NONE;
@ -201,8 +209,8 @@ ecore_x_composite_name_window_pixmap_get(Ecore_X_Window win)
return pmap;
}
EAPI void
ecore_x_composite_window_events_disable(Ecore_X_Window win)
EAPI void
ecore_x_composite_window_events_disable(Ecore_X_Window win)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
CHECK_XCB_CONN;
@ -218,8 +226,8 @@ ecore_x_composite_window_events_disable(Ecore_X_Window win)
#endif
}
EAPI void
ecore_x_composite_window_events_enable(Ecore_X_Window win)
EAPI void
ecore_x_composite_window_events_enable(Ecore_X_Window win)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
CHECK_XCB_CONN;
@ -235,8 +243,8 @@ ecore_x_composite_window_events_enable(Ecore_X_Window win)
#endif
}
EAPI Ecore_X_Window
ecore_x_composite_render_window_enable(Ecore_X_Window root)
EAPI Ecore_X_Window
ecore_x_composite_render_window_enable(Ecore_X_Window root)
{
Ecore_X_Window win = 0;
#ifdef ECORE_XCB_COMPOSITE
@ -251,7 +259,7 @@ ecore_x_composite_render_window_enable(Ecore_X_Window root)
#ifdef ECORE_XCB_COMPOSITE
cookie = xcb_composite_get_overlay_window_unchecked(_ecore_xcb_conn, root);
reply =
reply =
xcb_composite_get_overlay_window_reply(_ecore_xcb_conn, cookie, NULL);
if (!reply) return win;
@ -265,8 +273,8 @@ ecore_x_composite_render_window_enable(Ecore_X_Window root)
return win;
}
EAPI void
ecore_x_composite_render_window_disable(Ecore_X_Window win)
EAPI void
ecore_x_composite_render_window_disable(Ecore_X_Window win)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
CHECK_XCB_CONN;
@ -278,3 +286,4 @@ ecore_x_composite_render_window_disable(Ecore_X_Window win)
// ecore_x_flush();
#endif
}

View File

@ -8,11 +8,13 @@
#ifdef ECORE_XCB_CURSOR
static xcb_render_pictforminfo_t *_ecore_xcb_cursor_format_get(void);
#endif
static void _ecore_xcb_cursor_default_size_get(void);
static void _ecore_xcb_cursor_dpi_size_get(void);
static void _ecore_xcb_cursor_guess_size(void);
static void _ecore_xcb_cursor_default_size_get(void);
static void _ecore_xcb_cursor_dpi_size_get(void);
static void _ecore_xcb_cursor_guess_size(void);
#ifdef ECORE_XCB_CURSOR
static Ecore_X_Cursor _ecore_xcb_cursor_image_load_cursor(xcb_image_t *img, int hot_x, int hot_y);
static Ecore_X_Cursor _ecore_xcb_cursor_image_load_cursor(xcb_image_t *img,
int hot_x,
int hot_y);
#endif
static void _ecore_xcb_cursor_image_destroy(xcb_image_t *img);
@ -24,15 +26,15 @@ static uint32_t _ecore_xcb_cursor_format_id = 0;
// static xcb_render_pictforminfo_t *_ecore_xcb_cursor_format = NULL;
#endif
void
_ecore_xcb_cursor_init(void)
void
_ecore_xcb_cursor_init(void)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
/* NB: No-op */
}
void
_ecore_xcb_cursor_finalize(void)
void
_ecore_xcb_cursor_finalize(void)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
@ -40,7 +42,7 @@ _ecore_xcb_cursor_finalize(void)
_ecore_xcb_cursor = _ecore_xcb_render_argb_get();
/* find render pict format */
if (_ecore_xcb_cursor_format_id <= 0)
if (_ecore_xcb_cursor_format_id <= 0)
_ecore_xcb_cursor_format_id = _ecore_xcb_cursor_format_get()->id;
#endif
@ -55,21 +57,26 @@ _ecore_xcb_cursor_finalize(void)
if (_ecore_xcb_cursor_size == 0)
_ecore_xcb_cursor_guess_size();
/* NB: Would normally add theme stuff here, but E cursor does not support
* xcursor themes. Delay parsing that stuff out until such time if/when the
/* NB: Would normally add theme stuff here, but E cursor does not support
* xcursor themes. Delay parsing that stuff out until such time if/when the
* user selects to use X Cursor, rather than E cursor */
}
EAPI Eina_Bool
ecore_x_cursor_color_supported_get(void)
EAPI Eina_Bool
ecore_x_cursor_color_supported_get(void)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
return _ecore_xcb_cursor;
}
EAPI Ecore_X_Cursor
ecore_x_cursor_new(Ecore_X_Window win, int *pixels, int w, int h, int hot_x, int hot_y)
EAPI Ecore_X_Cursor
ecore_x_cursor_new(Ecore_X_Window win,
int *pixels,
int w,
int h,
int hot_x,
int hot_y)
{
Ecore_X_Cursor cursor = 0;
xcb_image_t *img;
@ -78,10 +85,10 @@ ecore_x_cursor_new(Ecore_X_Window win, int *pixels, int w, int h, int hot_x, int
CHECK_XCB_CONN;
#ifdef ECORE_XCB_CURSOR
if (_ecore_xcb_cursor)
if (_ecore_xcb_cursor)
{
img = _ecore_xcb_image_create_native(w, h, XCB_IMAGE_FORMAT_Z_PIXMAP,
32, NULL, (w * h * sizeof(int)),
img = _ecore_xcb_image_create_native(w, h, XCB_IMAGE_FORMAT_Z_PIXMAP,
32, NULL, (w * h * sizeof(int)),
(uint8_t *)pixels);
cursor = _ecore_xcb_cursor_image_load_cursor(img, hot_x, hot_y);
_ecore_xcb_cursor_image_destroy(img);
@ -89,152 +96,152 @@ ecore_x_cursor_new(Ecore_X_Window win, int *pixels, int w, int h, int hot_x, int
}
else
#endif
{
Ecore_X_GC gc;
xcb_pixmap_t pmap, mask;
uint32_t *pix;
uint8_t fr = 0x00, fg = 0x00, fb = 0x00;
uint8_t br = 0xff, bg = 0xff, bb = 0xff;
uint32_t brightest = 0, darkest = 255 * 3;
uint16_t x, y;
const uint32_t dither[2][2] =
{
{0, 2},
{3, 1}
};
{
Ecore_X_GC gc;
xcb_pixmap_t pmap, mask;
uint32_t *pix;
uint8_t fr = 0x00, fg = 0x00, fb = 0x00;
uint8_t br = 0xff, bg = 0xff, bb = 0xff;
uint32_t brightest = 0, darkest = 255 * 3;
uint16_t x, y;
const uint32_t dither[2][2] =
{
{0, 2},
{3, 1}
};
img = _ecore_xcb_image_create_native(w, h, XCB_IMAGE_FORMAT_Z_PIXMAP,
1, NULL, ~0, NULL);
if (img->data) free(img->data);
img->data = malloc(img->size);
img = _ecore_xcb_image_create_native(w, h, XCB_IMAGE_FORMAT_Z_PIXMAP,
1, NULL, ~0, NULL);
if (img->data) free(img->data);
img->data = malloc(img->size);
pmap = xcb_generate_id(_ecore_xcb_conn);
xcb_create_pixmap(_ecore_xcb_conn, 1, pmap, win, w, h);
mask = xcb_generate_id(_ecore_xcb_conn);
xcb_create_pixmap(_ecore_xcb_conn, 1, mask, win, w, h);
pmap = xcb_generate_id(_ecore_xcb_conn);
xcb_create_pixmap(_ecore_xcb_conn, 1, pmap, win, w, h);
mask = xcb_generate_id(_ecore_xcb_conn);
xcb_create_pixmap(_ecore_xcb_conn, 1, mask, win, w, h);
pix = (uint32_t *)pixels;
for (y = 0; y < h; y++)
{
for (x = 0; x < w; x++)
{
uint8_t r, g, b, a;
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;
}
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++;
}
}
if ((uint32_t)(r + g + b) < darkest)
{
darkest = r + g + b;
fr = r;
fg = g;
fb = b;
}
}
pix++;
}
}
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;
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;
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;
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(img, x, y, v);
pix++;
}
}
xcb_image_put_pixel(img, x, y, v);
pix++;
}
}
gc = ecore_x_gc_new(pmap, 0, NULL);
xcb_put_image(_ecore_xcb_conn, img->format, pmap, gc, w, h,
0, 0, 0, img->depth, img->size, img->data);
ecore_x_gc_free(gc);
gc = ecore_x_gc_new(pmap, 0, NULL);
xcb_put_image(_ecore_xcb_conn, img->format, pmap, gc, w, h,
0, 0, 0, img->depth, img->size, img->data);
ecore_x_gc_free(gc);
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;
v = (((pix[0] >> 24) & 0xff) * 5) / 256;
if (v > dither[x & 0x1][y & 0x1])
v = 1;
else
v = 0;
v = (((pix[0] >> 24) & 0xff) * 5) / 256;
if (v > dither[x & 0x1][y & 0x1])
v = 1;
else
v = 0;
xcb_image_put_pixel(img, x, y, v);
pix++;
}
}
xcb_image_put_pixel(img, x, y, v);
pix++;
}
}
gc = ecore_x_gc_new(mask, 0, NULL);
xcb_put_image(_ecore_xcb_conn, img->format, mask, gc, w, h,
0, 0, 0, img->depth, img->size, img->data);
ecore_x_gc_free(gc);
gc = ecore_x_gc_new(mask, 0, NULL);
xcb_put_image(_ecore_xcb_conn, img->format, mask, gc, w, h,
0, 0, 0, img->depth, img->size, img->data);
ecore_x_gc_free(gc);
if (img->data) free(img->data);
_ecore_xcb_cursor_image_destroy(img);
if (img->data) free(img->data);
_ecore_xcb_cursor_image_destroy(img);
cursor = xcb_generate_id(_ecore_xcb_conn);
xcb_create_cursor(_ecore_xcb_conn, cursor, pmap, mask,
fr << 8 | fr, fg << 8 | fg, fb << 8 | fb,
br << 8 | br, bg << 8 | bg, bb << 8 | bb,
hot_x, hot_y);
cursor = xcb_generate_id(_ecore_xcb_conn);
xcb_create_cursor(_ecore_xcb_conn, cursor, pmap, 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, pmap);
xcb_free_pixmap(_ecore_xcb_conn, mask);
xcb_free_pixmap(_ecore_xcb_conn, pmap);
xcb_free_pixmap(_ecore_xcb_conn, mask);
return cursor;
}
return cursor;
}
return 0;
}
EAPI void
ecore_x_cursor_free(Ecore_X_Cursor c)
EAPI void
ecore_x_cursor_free(Ecore_X_Cursor c)
{
// LOGFN(__FILE__, __LINE__, __FUNCTION__);
CHECK_XCB_CONN;
CHECK_XCB_CONN;
xcb_free_cursor(_ecore_xcb_conn, c);
xcb_free_cursor(_ecore_xcb_conn, c);
}
/*
@ -242,8 +249,8 @@ ecore_x_cursor_free(Ecore_X_Cursor c)
* Note that the return value must not be freed with
* ecore_x_cursor_free()!
*/
EAPI Ecore_X_Cursor
ecore_x_cursor_shape_get(int shape)
EAPI Ecore_X_Cursor
ecore_x_cursor_shape_get(int shape)
{
Ecore_X_Cursor cursor = 0;
xcb_font_t font;
@ -256,15 +263,15 @@ ecore_x_cursor_shape_get(int shape)
cursor = xcb_generate_id(_ecore_xcb_conn);
/* FIXME: Add request check ?? */
xcb_create_glyph_cursor(_ecore_xcb_conn, cursor, font, font,
xcb_create_glyph_cursor(_ecore_xcb_conn, cursor, font, font,
shape, shape + 1, 0, 0, 0, 65535, 65535, 65535);
xcb_close_font(_ecore_xcb_conn, font);
return cursor;
}
EAPI void
ecore_x_cursor_size_set(int size)
EAPI void
ecore_x_cursor_size_set(int size)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
@ -272,8 +279,8 @@ ecore_x_cursor_size_set(int size)
/* NB: May need to adjust size of current cursors here */
}
EAPI int
ecore_x_cursor_size_get(void)
EAPI int
ecore_x_cursor_size_get(void)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
@ -283,7 +290,7 @@ ecore_x_cursor_size_get(void)
/* local functions */
#ifdef ECORE_XCB_CURSOR
static xcb_render_pictforminfo_t *
_ecore_xcb_cursor_format_get(void)
_ecore_xcb_cursor_format_get(void)
{
const xcb_render_query_pict_formats_reply_t *reply;
xcb_render_pictforminfo_t *ret = NULL;
@ -291,16 +298,17 @@ _ecore_xcb_cursor_format_get(void)
CHECK_XCB_CONN;
reply = xcb_render_util_query_formats(_ecore_xcb_conn);
if (reply)
ret = xcb_render_util_find_standard_format(reply,
if (reply)
ret = xcb_render_util_find_standard_format(reply,
XCB_PICT_STANDARD_ARGB_32);
return ret;
}
#endif
static void
_ecore_xcb_cursor_default_size_get(void)
static void
_ecore_xcb_cursor_default_size_get(void)
{
char *s = NULL;
int v = 0;
@ -308,7 +316,7 @@ _ecore_xcb_cursor_default_size_get(void)
LOGFN(__FILE__, __LINE__, __FUNCTION__);
s = getenv("XCURSOR_SIZE");
if (!s)
if (!s)
{
_ecore_xcb_xdefaults_init();
v = _ecore_xcb_xdefaults_int_get("Xcursor", "size");
@ -319,8 +327,8 @@ _ecore_xcb_cursor_default_size_get(void)
if (v) _ecore_xcb_cursor_size = ((v * 16) / 72);
}
static void
_ecore_xcb_cursor_dpi_size_get(void)
static void
_ecore_xcb_cursor_dpi_size_get(void)
{
int v = 0;
@ -332,8 +340,8 @@ _ecore_xcb_cursor_dpi_size_get(void)
_ecore_xcb_xdefaults_shutdown();
}
static void
_ecore_xcb_cursor_guess_size(void)
static void
_ecore_xcb_cursor_guess_size(void)
{
int w = 0, h = 0, s = 0;
@ -346,8 +354,10 @@ _ecore_xcb_cursor_guess_size(void)
}
#ifdef ECORE_XCB_CURSOR
static Ecore_X_Cursor
_ecore_xcb_cursor_image_load_cursor(xcb_image_t *img, int hot_x, int hot_y)
static Ecore_X_Cursor
_ecore_xcb_cursor_image_load_cursor(xcb_image_t *img,
int hot_x,
int hot_y)
{
Ecore_X_Cursor cursor = 0;
Ecore_X_GC gc;
@ -357,18 +367,18 @@ _ecore_xcb_cursor_image_load_cursor(xcb_image_t *img, int hot_x, int hot_y)
CHECK_XCB_CONN;
pmap = xcb_generate_id(_ecore_xcb_conn);
xcb_create_pixmap(_ecore_xcb_conn, img->depth, pmap,
((xcb_screen_t *)_ecore_xcb_screen)->root,
xcb_create_pixmap(_ecore_xcb_conn, img->depth, pmap,
((xcb_screen_t *)_ecore_xcb_screen)->root,
img->width, img->height);
gc = ecore_x_gc_new(pmap, 0, NULL);
xcb_put_image(_ecore_xcb_conn, img->format, pmap, gc,
img->width, img->height, 0, 0, 0, img->depth,
xcb_put_image(_ecore_xcb_conn, img->format, pmap, gc,
img->width, img->height, 0, 0, 0, img->depth,
img->size, img->data);
ecore_x_gc_free(gc);
pict = xcb_generate_id(_ecore_xcb_conn);
xcb_render_create_picture(_ecore_xcb_conn, pict, pmap,
xcb_render_create_picture(_ecore_xcb_conn, pict, pmap,
_ecore_xcb_cursor_format_id, 0, NULL);
xcb_free_pixmap(_ecore_xcb_conn, pmap);
@ -378,11 +388,13 @@ _ecore_xcb_cursor_image_load_cursor(xcb_image_t *img, int hot_x, int hot_y)
return cursor;
}
#endif
static void
_ecore_xcb_cursor_image_destroy(xcb_image_t *img)
static void
_ecore_xcb_cursor_image_destroy(xcb_image_t *img)
{
CHECK_XCB_CONN;
if (img) xcb_image_destroy(img);
}

View File

@ -9,8 +9,8 @@ static Eina_Bool _damage_avail = EINA_FALSE;
/* external variables */
int _ecore_xcb_event_damage = -1;
void
_ecore_xcb_damage_init(void)
void
_ecore_xcb_damage_init(void)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
@ -19,8 +19,8 @@ _ecore_xcb_damage_init(void)
#endif
}
void
_ecore_xcb_damage_finalize(void)
void
_ecore_xcb_damage_finalize(void)
{
#ifdef ECORE_XCB_DAMAGE
const xcb_query_extension_reply_t *ext_reply;
@ -30,14 +30,14 @@ _ecore_xcb_damage_finalize(void)
#ifdef ECORE_XCB_DAMAGE
ext_reply = xcb_get_extension_data(_ecore_xcb_conn, &xcb_damage_id);
if ((ext_reply) && (ext_reply->present))
if ((ext_reply) && (ext_reply->present))
{
xcb_damage_query_version_cookie_t cookie;
xcb_damage_query_version_reply_t *reply;
cookie =
xcb_damage_query_version_unchecked(_ecore_xcb_conn,
XCB_DAMAGE_MAJOR_VERSION,
cookie =
xcb_damage_query_version_unchecked(_ecore_xcb_conn,
XCB_DAMAGE_MAJOR_VERSION,
XCB_DAMAGE_MINOR_VERSION);
reply = xcb_damage_query_version_reply(_ecore_xcb_conn, cookie, NULL);
if (reply)
@ -54,30 +54,31 @@ _ecore_xcb_damage_finalize(void)
/**
* @defgroup Ecore_X_Damage_Group X Damage Extension Functions
*
*
* Functions related to the X Damage Extension.
*/
EAPI Eina_Bool
ecore_x_damage_query(void)
EAPI Eina_Bool
ecore_x_damage_query(void)
{
return _damage_avail;
}
/**
* Create a damage object
*
*
* @param drawable The drawable to monitor
* @param level The level of the damage report
* @return The damage object
*
* Creates a damage object to monitor changes to @p drawable,
*
* Creates a damage object to monitor changes to @p drawable,
* with the level @p level.
*
*
* @ingroup Ecore_X_Damage_Group
*/
EAPI Ecore_X_Damage
ecore_x_damage_new(Ecore_X_Drawable drawable, Ecore_X_Damage_Report_Level level)
EAPI Ecore_X_Damage
ecore_x_damage_new(Ecore_X_Drawable drawable,
Ecore_X_Damage_Report_Level level)
{
Ecore_X_Damage damage = 0;
@ -97,15 +98,15 @@ ecore_x_damage_new(Ecore_X_Drawable drawable, Ecore_X_Damage_Report_Level level)
/**
* Destroy a damage object
*
*
* @param The damage object to destroy
*
*
* Destroys the damage object @p damage
*
*
* @ingroup Ecore_X_Damage_Group
*/
EAPI void
ecore_x_damage_free(Ecore_X_Damage damage)
EAPI void
ecore_x_damage_free(Ecore_X_Damage damage)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
CHECK_XCB_CONN;
@ -120,7 +121,7 @@ ecore_x_damage_free(Ecore_X_Damage damage)
/**
* Synchronously modifies the region
*
*
* @param damage The damage object to destroy
* @param repair The repair region
* @param parts The parts region
@ -133,11 +134,13 @@ ecore_x_damage_free(Ecore_X_Damage damage)
* 1) parts = damage INTERSECT repair
* 2) damage = damage - parts
* 3) Generate DamageNotify for remaining damage areas
*
*
* @ingroup Ecore_X_Damage_Group
*/
EAPI void
ecore_x_damage_subtract(Ecore_X_Damage damage, Ecore_X_Region repair, Ecore_X_Region parts)
EAPI void
ecore_x_damage_subtract(Ecore_X_Damage damage,
Ecore_X_Region repair,
Ecore_X_Region parts)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
CHECK_XCB_CONN;
@ -149,3 +152,4 @@ ecore_x_damage_subtract(Ecore_X_Damage damage, Ecore_X_Region repair, Ecore_X_Re
// ecore_x_flush();
#endif
}

View File

@ -5,14 +5,20 @@
#endif
/* local structures */
typedef struct _Version_Cache_Item
typedef struct _Version_Cache_Item
{
Ecore_X_Window win;
int ver;
int ver;
} Version_Cache_Item;
/* local function prototypes */
static Eina_Bool _ecore_xcb_dnd_converter_copy(char *target __UNUSED__, void *data, int size, void **data_ret, int *size_ret, Ecore_X_Atom *tprop __UNUSED__, int *count __UNUSED__);
static Eina_Bool _ecore_xcb_dnd_converter_copy(char *target __UNUSED__,
void *data,
int size,
void **data_ret,
int *size_ret,
Ecore_X_Atom *tprop __UNUSED__,
int *count __UNUSED__);
/* local variables */
static int _ecore_xcb_dnd_init_count = 0;
@ -20,7 +26,8 @@ static Ecore_X_DND_Source *_source = NULL;
static Ecore_X_DND_Target *_target = NULL;
static Version_Cache_Item *_version_cache = NULL;
static int _version_cache_num = 0, _version_cache_alloc = 0;
static void (*_posupdatecb)(void *, Ecore_X_Xdnd_Position *);
static void (*_posupdatecb)(void *,
Ecore_X_Xdnd_Position *);
static void *_posupdatedata;
/* external variables */
@ -31,12 +38,12 @@ EAPI int ECORE_X_EVENT_XDND_LEAVE = 0;
EAPI int ECORE_X_EVENT_XDND_DROP = 0;
EAPI int ECORE_X_EVENT_XDND_FINISHED = 0;
void
_ecore_xcb_dnd_init(void)
void
_ecore_xcb_dnd_init(void)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
if (!_ecore_xcb_dnd_init_count)
if (!_ecore_xcb_dnd_init_count)
{
_source = calloc(1, sizeof(Ecore_X_DND_Source));
if (!_source) return;
@ -47,7 +54,7 @@ _ecore_xcb_dnd_init(void)
_source->prev.window = 0;
_target = calloc(1, sizeof(Ecore_X_DND_Target));
if (!_target)
if (!_target)
{
free(_source);
_source = NULL;
@ -67,8 +74,8 @@ _ecore_xcb_dnd_init(void)
_ecore_xcb_dnd_init_count++;
}
void
_ecore_xcb_dnd_shutdown(void)
void
_ecore_xcb_dnd_shutdown(void)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
@ -81,8 +88,11 @@ _ecore_xcb_dnd_shutdown(void)
_ecore_xcb_dnd_init_count = 0;
}
EAPI void
ecore_x_dnd_send_status(Eina_Bool will_accept, Eina_Bool suppress, Ecore_X_Rectangle rect, Ecore_X_Atom action)
EAPI void
ecore_x_dnd_send_status(Eina_Bool will_accept,
Eina_Bool suppress,
Ecore_X_Rectangle rect,
Ecore_X_Atom action)
{
xcb_client_message_event_t ev;
@ -111,19 +121,19 @@ ecore_x_dnd_send_status(Eina_Bool will_accept, Eina_Bool suppress, Ecore_X_Recta
ev.data.data32[3] <<= 16;
ev.data.data32[3] |= rect.height;
if (will_accept)
if (will_accept)
ev.data.data32[4] = action;
else
else
ev.data.data32[4] = XCB_NONE;
_target->accepted_action = action;
xcb_send_event(_ecore_xcb_conn, 0, _target->source,
xcb_send_event(_ecore_xcb_conn, 0, _target->source,
XCB_EVENT_MASK_NO_EVENT, (const char *)&ev);
// ecore_x_flush();
}
EAPI Eina_Bool
ecore_x_dnd_drop(void)
EAPI Eina_Bool
ecore_x_dnd_drop(void)
{
xcb_client_message_event_t ev;
Eina_Bool status = EINA_FALSE;
@ -133,38 +143,38 @@ ecore_x_dnd_drop(void)
memset(&ev, 0, sizeof(xcb_client_message_event_t));
if (_source->dest)
if (_source->dest)
{
ev.response_type = XCB_CLIENT_MESSAGE;
ev.format = 32;
ev.window = _source->dest;
if (_source->will_accept)
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,
xcb_send_event(_ecore_xcb_conn, 0, _source->dest,
XCB_EVENT_MASK_NO_EVENT, (const char *)&ev);
// ecore_x_flush();
_source->state = ECORE_X_DND_SOURCE_DROPPED;
status = EINA_TRUE;
}
else
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,
xcb_send_event(_ecore_xcb_conn, 0, _source->dest,
XCB_EVENT_MASK_NO_EVENT, (const char *)&ev);
// ecore_x_flush();
_source->state = ECORE_X_DND_SOURCE_IDLE;
}
}
else
else
{
ecore_x_selection_xdnd_clear();
_source->state = ECORE_X_DND_SOURCE_IDLE;
@ -176,22 +186,23 @@ ecore_x_dnd_drop(void)
return status;
}
EAPI void
ecore_x_dnd_aware_set(Ecore_X_Window win, Eina_Bool on)
EAPI void
ecore_x_dnd_aware_set(Ecore_X_Window win,
Eina_Bool on)
{
Ecore_X_Atom prop_data = ECORE_X_DND_VERSION;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
if (on)
ecore_x_window_prop_property_set(win, ECORE_X_ATOM_XDND_AWARE,
ecore_x_window_prop_property_set(win, ECORE_X_ATOM_XDND_AWARE,
ECORE_X_ATOM_ATOM, 32, &prop_data, 1);
else
ecore_x_window_prop_property_del(win, ECORE_X_ATOM_XDND_AWARE);
}
EAPI int
ecore_x_dnd_version_get(Ecore_X_Window win)
EAPI int
ecore_x_dnd_version_get(Ecore_X_Window win)
{
unsigned char *data;
int num = 0;
@ -199,13 +210,13 @@ ecore_x_dnd_version_get(Ecore_X_Window win)
LOGFN(__FILE__, __LINE__, __FUNCTION__);
if (_source->state == ECORE_X_DND_SOURCE_DRAGGING)
if (_source->state == ECORE_X_DND_SOURCE_DRAGGING)
{
if (_version_cache)
if (_version_cache)
{
int i = 0;
for (i = 0; i < _version_cache_num; i++)
for (i = 0; i < _version_cache_num; i++)
{
if (_version_cache[i].win == win)
return _version_cache[i].ver;
@ -213,19 +224,19 @@ ecore_x_dnd_version_get(Ecore_X_Window win)
}
}
if (ecore_x_window_prop_property_get(win, ECORE_X_ATOM_XDND_AWARE,
ECORE_X_ATOM_ATOM, 32, &data, &num))
if (ecore_x_window_prop_property_get(win, ECORE_X_ATOM_XDND_AWARE,
ECORE_X_ATOM_ATOM, 32, &data, &num))
{
int version = 0;
version = (int)*data;
free(data);
if (_source->state == ECORE_X_DND_SOURCE_DRAGGING)
if (_source->state == ECORE_X_DND_SOURCE_DRAGGING)
{
_version_cache_num++;
if (_version_cache_num > _version_cache_alloc)
_version_cache_alloc += 16;
t = realloc(_version_cache,
t = realloc(_version_cache,
_version_cache_alloc * sizeof(Version_Cache_Item));
if (!t) return 0;
_version_cache = t;
@ -235,12 +246,12 @@ ecore_x_dnd_version_get(Ecore_X_Window win)
return version;
}
if (_source->state == ECORE_X_DND_SOURCE_DRAGGING)
if (_source->state == ECORE_X_DND_SOURCE_DRAGGING)
{
_version_cache_num++;
if (_version_cache_num > _version_cache_alloc)
_version_cache_alloc += 16;
t = realloc(_version_cache,
t = realloc(_version_cache,
_version_cache_alloc * sizeof(Version_Cache_Item));
if (!t) return 0;
_version_cache = t;
@ -251,8 +262,9 @@ ecore_x_dnd_version_get(Ecore_X_Window win)
return 0;
}
EAPI Eina_Bool
ecore_x_dnd_type_isset(Ecore_X_Window win, const char *type)
EAPI Eina_Bool
ecore_x_dnd_type_isset(Ecore_X_Window win,
const char *type)
{
int num = 0, i = 0;
Eina_Bool ret = EINA_FALSE;
@ -262,15 +274,15 @@ ecore_x_dnd_type_isset(Ecore_X_Window win, const char *type)
LOGFN(__FILE__, __LINE__, __FUNCTION__);
CHECK_XCB_CONN;
if (!ecore_x_window_prop_property_get(win, ECORE_X_ATOM_XDND_TYPE_LIST,
if (!ecore_x_window_prop_property_get(win, ECORE_X_ATOM_XDND_TYPE_LIST,
ECORE_X_ATOM_ATOM, 32, &data, &num))
return ret;
atom = ecore_x_atom_get(type);
atoms = (Ecore_X_Atom *)data;
for (i = 0; i < num; ++i)
for (i = 0; i < num; ++i)
{
if (atom == atoms[i])
if (atom == atoms[i])
{
ret = EINA_TRUE;
break;
@ -281,8 +293,10 @@ ecore_x_dnd_type_isset(Ecore_X_Window win, const char *type)
return ret;
}
EAPI void
ecore_x_dnd_type_set(Ecore_X_Window win, const char *type, Eina_Bool on)
EAPI void
ecore_x_dnd_type_set(Ecore_X_Window win,
const char *type,
Eina_Bool on)
{
Ecore_X_Atom atom, *oldset = NULL, *newset = NULL;
int i = 0, j = 0, num = 0;
@ -292,12 +306,12 @@ ecore_x_dnd_type_set(Ecore_X_Window win, const char *type, Eina_Bool on)
CHECK_XCB_CONN;
atom = ecore_x_atom_get(type);
ecore_x_window_prop_property_get(win, ECORE_X_ATOM_XDND_TYPE_LIST,
ecore_x_window_prop_property_get(win, ECORE_X_ATOM_XDND_TYPE_LIST,
ECORE_X_ATOM_ATOM, 32, &old_data, &num);
oldset = (Ecore_X_Atom *)old_data;
if (on)
if (on)
{
if (ecore_x_dnd_type_isset(win, type))
if (ecore_x_dnd_type_isset(win, type))
{
free(old_data);
return;
@ -308,27 +322,27 @@ ecore_x_dnd_type_set(Ecore_X_Window win, const char *type, Eina_Bool on)
for (i = 0; i < num; i++)
newset[i + 1] = oldset[i];
newset[0] = atom;
ecore_x_window_prop_property_set(win, ECORE_X_ATOM_XDND_TYPE_LIST,
ecore_x_window_prop_property_set(win, ECORE_X_ATOM_XDND_TYPE_LIST,
ECORE_X_ATOM_ATOM, 32, data, num + 1);
}
else
else
{
if (!ecore_x_dnd_type_isset(win, type))
if (!ecore_x_dnd_type_isset(win, type))
{
free(old_data);
return;
}
newset = calloc(num - 1, sizeof(Ecore_X_Atom));
if (!newset)
if (!newset)
{
free(old_data);
return;
}
data = (unsigned char *)newset;
for (i = 0; i < num; i++)
if (oldset[i] != atom)
if (oldset[i] != atom)
newset[j++] = oldset[i];
ecore_x_window_prop_property_set(win, ECORE_X_ATOM_XDND_TYPE_LIST,
ecore_x_window_prop_property_set(win, ECORE_X_ATOM_XDND_TYPE_LIST,
ECORE_X_ATOM_ATOM, 32, data, num - 1);
}
free(oldset);
@ -336,7 +350,9 @@ ecore_x_dnd_type_set(Ecore_X_Window win, const char *type, Eina_Bool on)
}
EAPI void
ecore_x_dnd_types_set(Ecore_X_Window win, const char **types, unsigned int num_types)
ecore_x_dnd_types_set(Ecore_X_Window win,
const char **types,
unsigned int num_types)
{
Ecore_X_Atom *newset = NULL;
unsigned int i;
@ -346,7 +362,7 @@ ecore_x_dnd_types_set(Ecore_X_Window win, const char **types, unsigned int num_t
CHECK_XCB_CONN;
if (!num_types)
ecore_x_window_prop_property_del(win, ECORE_X_ATOM_XDND_TYPE_LIST);
ecore_x_window_prop_property_del(win, ECORE_X_ATOM_XDND_TYPE_LIST);
else
{
newset = calloc(num_types, sizeof(Ecore_X_Atom));
@ -360,14 +376,16 @@ ecore_x_dnd_types_set(Ecore_X_Window win, const char **types, unsigned int num_t
_ecore_xcb_dnd_converter_copy);
}
ecore_x_window_prop_property_set(win, ECORE_X_ATOM_XDND_TYPE_LIST,
ECORE_X_ATOM_ATOM, 32, data,
ECORE_X_ATOM_ATOM, 32, data,
num_types);
free(newset);
}
}
EAPI void
ecore_x_dnd_actions_set(Ecore_X_Window win, Ecore_X_Atom *actions, unsigned int num_actions)
ecore_x_dnd_actions_set(Ecore_X_Window win,
Ecore_X_Atom *actions,
unsigned int num_actions)
{
unsigned int i;
unsigned char *data = NULL;
@ -376,7 +394,7 @@ ecore_x_dnd_actions_set(Ecore_X_Window win, Ecore_X_Atom *actions, unsigned int
CHECK_XCB_CONN;
if (!num_actions)
ecore_x_window_prop_property_del(win, ECORE_X_ATOM_XDND_ACTION_LIST);
ecore_x_window_prop_property_del(win, ECORE_X_ATOM_XDND_ACTION_LIST);
else
{
data = (unsigned char *)actions;
@ -384,7 +402,7 @@ ecore_x_dnd_actions_set(Ecore_X_Window win, Ecore_X_Atom *actions, unsigned int
ecore_x_selection_converter_atom_add(actions[i],
_ecore_xcb_dnd_converter_copy);
ecore_x_window_prop_property_set(win, ECORE_X_ATOM_XDND_ACTION_LIST,
ECORE_X_ATOM_ATOM, 32, data,
ECORE_X_ATOM_ATOM, 32, data,
num_actions);
}
}
@ -404,14 +422,18 @@ ecore_x_dnd_actions_set(Ecore_X_Window win, Ecore_X_Atom *actions, unsigned int
* @param data User data.
*/
EAPI void
ecore_x_dnd_callback_pos_update_set(void (*cb)(void *, Ecore_X_Xdnd_Position *data), const void *data)
ecore_x_dnd_callback_pos_update_set(void (*cb)(void *,
Ecore_X_Xdnd_Position *data),
const void *data)
{
_posupdatecb = cb;
_posupdatedata = (void *)data;
}
EAPI Eina_Bool
ecore_x_dnd_begin(Ecore_X_Window source, unsigned char *data, int size)
EAPI Eina_Bool
ecore_x_dnd_begin(Ecore_X_Window source,
unsigned char *data,
int size)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
@ -444,8 +466,8 @@ ecore_x_dnd_begin(Ecore_X_Window source, unsigned char *data, int size)
return EINA_TRUE;
}
EAPI void
ecore_x_dnd_send_finished(void)
EAPI void
ecore_x_dnd_send_finished(void)
{
xcb_client_message_event_t ev;
@ -463,43 +485,45 @@ ecore_x_dnd_send_finished(void)
ev.data.data32[0] = _target->win;
ev.data.data32[1] = 0;
ev.data.data32[2] = 0;
if (_target->will_accept)
if (_target->will_accept)
{
ev.data.data32[1] |= 0x1UL;
ev.data.data32[2] = _target->accepted_action;
}
xcb_send_event(_ecore_xcb_conn, 0, _target->source,
xcb_send_event(_ecore_xcb_conn, 0, _target->source,
XCB_EVENT_MASK_NO_EVENT, (const char *)&ev);
// ecore_x_flush();
_target->state = ECORE_X_DND_TARGET_IDLE;
}
EAPI void
ecore_x_dnd_source_action_set(Ecore_X_Atom action)
EAPI void
ecore_x_dnd_source_action_set(Ecore_X_Atom action)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
_source->action = action;
if (_source->prev.window)
_ecore_xcb_dnd_drag(_source->prev.window,
_ecore_xcb_dnd_drag(_source->prev.window,
_source->prev.x, _source->prev.y);
}
Ecore_X_DND_Source *
_ecore_xcb_dnd_source_get(void)
_ecore_xcb_dnd_source_get(void)
{
return _source;
}
Ecore_X_DND_Target *
_ecore_xcb_dnd_target_get(void)
_ecore_xcb_dnd_target_get(void)
{
return _target;
}
void
_ecore_xcb_dnd_drag(Ecore_X_Window root, int x, int y)
void
_ecore_xcb_dnd_drag(Ecore_X_Window root,
int x,
int y)
{
xcb_client_message_event_t ev;
Ecore_X_Window win, *skip;
@ -521,34 +545,34 @@ _ecore_xcb_dnd_drag(Ecore_X_Window root, int x, int y)
while ((win) && !(ecore_x_dnd_version_get(win)))
win = ecore_x_window_shadow_parent_get(root, win);
if ((_source->dest) && (win != _source->dest))
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;
xcb_send_event(_ecore_xcb_conn, 0, _source->dest,
xcb_send_event(_ecore_xcb_conn, 0, _source->dest,
XCB_EVENT_MASK_NO_EVENT, (const char *)&ev);
// ecore_x_flush();
_source->suppress = 0;
}
if (win)
if (win)
{
int x1, x2, y1, y2;
_source->version = MIN(ECORE_X_DND_VERSION,
_source->version = MIN(ECORE_X_DND_VERSION,
ecore_x_dnd_version_get(win));
if (win != _source->dest)
if (win != _source->dest)
{
int i = 0;
unsigned char *data;
Ecore_X_Atom *types;
ecore_x_window_prop_property_get(_source->win,
ECORE_X_ATOM_XDND_TYPE_LIST,
ECORE_X_ATOM_ATOM, 32,
ecore_x_window_prop_property_get(_source->win,
ECORE_X_ATOM_XDND_TYPE_LIST,
ECORE_X_ATOM_ATOM, 32,
&data, &num);
types = (Ecore_X_Atom *)data;
ev.window = win;
@ -567,7 +591,7 @@ _ecore_xcb_dnd_drag(Ecore_X_Window root, int x, int y)
ev.data.data32[i + 2] = types[i];
free(data);
xcb_send_event(_ecore_xcb_conn, 0, win,
xcb_send_event(_ecore_xcb_conn, 0, win,
XCB_EVENT_MASK_NO_EVENT, (const char *)&ev);
// ecore_x_flush();
_source->await_status = 0;
@ -579,8 +603,8 @@ _ecore_xcb_dnd_drag(Ecore_X_Window root, int x, int y)
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)))
if ((!_source->await_status) || (!_source->suppress) ||
((x < x1) || (x > x2) || (y < y1) || (y > y2)))
{
ev.window = win;
ev.type = ECORE_X_ATOM_XDND_POSITION;
@ -590,14 +614,14 @@ _ecore_xcb_dnd_drag(Ecore_X_Window root, int x, int y)
ev.data.data32[3] = _source->time;
ev.data.data32[4] = _source->action;
xcb_send_event(_ecore_xcb_conn, 0, win,
xcb_send_event(_ecore_xcb_conn, 0, win,
XCB_EVENT_MASK_NO_EVENT, (const char *)&ev);
// ecore_x_flush();
_source->await_status = 1;
}
}
if (_posupdatecb)
if (_posupdatecb)
{
pos.position.x = x;
pos.position.y = y;
@ -612,15 +636,21 @@ _ecore_xcb_dnd_drag(Ecore_X_Window root, int x, int y)
_source->dest = win;
}
EAPI Ecore_X_Atom
ecore_x_dnd_source_action_get(void)
EAPI Ecore_X_Atom
ecore_x_dnd_source_action_get(void)
{
return _source->action;
}
/* local functions */
static Eina_Bool
_ecore_xcb_dnd_converter_copy(char *target __UNUSED__, void *data, int size, void **data_ret, int *size_ret, Ecore_X_Atom *tprop __UNUSED__, int *count __UNUSED__)
static Eina_Bool
_ecore_xcb_dnd_converter_copy(char *target __UNUSED__,
void *data,
int size,
void **data_ret,
int *size_ret,
Ecore_X_Atom *tprop __UNUSED__,
int *count __UNUSED__)
{
Ecore_Xcb_Textproperty text_prop;
Ecore_Xcb_Encoding_Style style = XcbTextStyle;
@ -634,12 +664,12 @@ _ecore_xcb_dnd_converter_copy(char *target __UNUSED__, void *data, int size, voi
if (!mystr) return EINA_FALSE;
memcpy(mystr, data, size);
if (_ecore_xcb_mb_textlist_to_textproperty(&mystr, 1, style, &text_prop))
if (_ecore_xcb_mb_textlist_to_textproperty(&mystr, 1, style, &text_prop))
{
int len;
len = strlen((char *)text_prop.value) + 1;
if (!(*data_ret = malloc(len)))
if (!(*data_ret = malloc(len)))
{
free(mystr);
return EINA_FALSE;
@ -650,9 +680,10 @@ _ecore_xcb_dnd_converter_copy(char *target __UNUSED__, void *data, int size, voi
free(mystr);
return EINA_TRUE;
}
else
else
{
free(mystr);
return EINA_FALSE;
}
}

View File

@ -6,8 +6,8 @@
/* local variables */
static Eina_Bool _dpms_avail = EINA_FALSE;
void
_ecore_xcb_dpms_init(void)
void
_ecore_xcb_dpms_init(void)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
@ -16,8 +16,8 @@ _ecore_xcb_dpms_init(void)
#endif
}
void
_ecore_xcb_dpms_finalize(void)
void
_ecore_xcb_dpms_finalize(void)
{
#ifdef ECORE_XCB_DPMS
const xcb_query_extension_reply_t *ext_reply;
@ -25,21 +25,21 @@ _ecore_xcb_dpms_finalize(void)
LOGFN(__FILE__, __LINE__, __FUNCTION__);
#ifdef ECORE_XCB_DPMS
#ifdef ECORE_XCB_DPMS
ext_reply = xcb_get_extension_data(_ecore_xcb_conn, &xcb_dpms_id);
if ((ext_reply) && (ext_reply->present))
if ((ext_reply) && (ext_reply->present))
{
xcb_dpms_get_version_cookie_t cookie;
xcb_dpms_get_version_reply_t *reply;
cookie =
xcb_dpms_get_version_unchecked(_ecore_xcb_conn,
XCB_DPMS_MAJOR_VERSION,
cookie =
xcb_dpms_get_version_unchecked(_ecore_xcb_conn,
XCB_DPMS_MAJOR_VERSION,
XCB_DPMS_MINOR_VERSION);
reply = xcb_dpms_get_version_reply(_ecore_xcb_conn, cookie, NULL);
if (reply)
if (reply)
{
if (reply->server_major_version >= 1)
if (reply->server_major_version >= 1)
_dpms_avail = EINA_TRUE;
free(reply);
}
@ -49,27 +49,27 @@ _ecore_xcb_dpms_finalize(void)
/**
* @defgroup Ecore_X_DPMS_Group X DPMS Extension Functions
*
*
* Functions related to the X DPMS Extension
*/
/**
* Checks if the DPMS extension is available or not.
*
* @return @c EINA_TRUE if the DPMS extension is available,
*
* @return @c EINA_TRUE if the DPMS extension is available,
* @c EINA_FALSE otherwise.
*
* Return EINA_TRUE if the X server supports the DPMS Extension version 1.0,
* EINA_FALSE otherwise.
*
*
* @ingroup Ecore_X_DPMS_Group
*/
EAPI Eina_Bool
ecore_x_dpms_query(void)
EAPI Eina_Bool
ecore_x_dpms_query(void)
{
// LOGFN(__FILE__, __LINE__, __FUNCTION__);
return _dpms_avail;
return _dpms_avail;
}
/**
@ -77,8 +77,8 @@ ecore_x_dpms_query(void)
* @return @c 1 if the X server is capable of DPMS, @c 0 otherwise.
* @ingroup Ecore_X_DPMS_Group
*/
EAPI Eina_Bool
ecore_x_dpms_capable_get(void)
EAPI Eina_Bool
ecore_x_dpms_capable_get(void)
{
Eina_Bool ret = EINA_FALSE;
#ifdef ECORE_XCB_DPMS
@ -94,7 +94,7 @@ ecore_x_dpms_capable_get(void)
#ifdef ECORE_XCB_DPMS
cookie = xcb_dpms_capable_unchecked(_ecore_xcb_conn);
reply = xcb_dpms_capable_reply(_ecore_xcb_conn, cookie, NULL);
if (reply)
if (reply)
{
ret = reply->capable;
free(reply);
@ -109,8 +109,8 @@ ecore_x_dpms_capable_get(void)
* @return @c EINA_TRUE if DPMS is enabled, @c EINA_FALSE otherwise.
* @ingroup Ecore_X_DPMS_Group
*/
EAPI Eina_Bool
ecore_x_dpms_enabled_get(void)
EAPI Eina_Bool
ecore_x_dpms_enabled_get(void)
{
Eina_Bool ret = EINA_FALSE;
#ifdef ECORE_XCB_DPMS
@ -139,8 +139,8 @@ ecore_x_dpms_enabled_get(void)
* @param enabled @c 0 to disable DPMS characteristics of the server, enable it otherwise.
* @ingroup Ecore_X_DPMS_Group
*/
EAPI void
ecore_x_dpms_enabled_set(int enabled)
EAPI void
ecore_x_dpms_enabled_set(int enabled)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
CHECK_XCB_CONN;
@ -148,9 +148,9 @@ ecore_x_dpms_enabled_set(int enabled)
if (!_dpms_avail) return;
#ifdef ECORE_XCB_DPMS
if (enabled)
if (enabled)
xcb_dpms_enable(_ecore_xcb_conn);
else
else
xcb_dpms_disable(_ecore_xcb_conn);
#endif
}
@ -162,8 +162,10 @@ ecore_x_dpms_enabled_set(int enabled)
* @param off Amount of time of inactivity before the monitor is shut off.
* @ingroup Ecore_X_DPMS_Group
*/
EAPI void
ecore_x_dpms_timeouts_get(unsigned int *standby, unsigned int *suspend, unsigned int *off)
EAPI void
ecore_x_dpms_timeouts_get(unsigned int *standby,
unsigned int *suspend,
unsigned int *off)
{
#ifdef ECORE_XCB_DPMS
xcb_dpms_get_timeouts_cookie_t cookie;
@ -197,8 +199,10 @@ ecore_x_dpms_timeouts_get(unsigned int *standby, unsigned int *suspend, unsigned
* @param off Amount of time of inactivity before the monitor is shut off.
* @ingroup Ecore_X_DPMS_Group
*/
EAPI Eina_Bool
ecore_x_dpms_timeouts_set(unsigned int standby, unsigned int suspend, unsigned int off)
EAPI Eina_Bool
ecore_x_dpms_timeouts_set(unsigned int standby,
unsigned int suspend,
unsigned int off)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
CHECK_XCB_CONN;
@ -219,8 +223,8 @@ ecore_x_dpms_timeouts_set(unsigned int standby, unsigned int suspend, unsigned i
* @return The standby timeout value.
* @ingroup Ecore_X_DPMS_Group
*/
EAPI unsigned int
ecore_x_dpms_timeout_standby_get(void)
EAPI unsigned int
ecore_x_dpms_timeout_standby_get(void)
{
unsigned int standby = 0;
@ -236,8 +240,8 @@ ecore_x_dpms_timeout_standby_get(void)
* @return The suspend timeout value.
* @ingroup Ecore_X_DPMS_Group
*/
EAPI unsigned int
ecore_x_dpms_timeout_suspend_get(void)
EAPI unsigned int
ecore_x_dpms_timeout_suspend_get(void)
{
unsigned int suspend = 0;
@ -253,8 +257,8 @@ ecore_x_dpms_timeout_suspend_get(void)
* @return The off timeout value.
* @ingroup Ecore_X_DPMS_Group
*/
EAPI unsigned int
ecore_x_dpms_timeout_off_get(void)
EAPI unsigned int
ecore_x_dpms_timeout_off_get(void)
{
unsigned int off = 0;
@ -269,8 +273,8 @@ ecore_x_dpms_timeout_off_get(void)
* @param new_standby Amount of time of inactivity before standby mode will be invoked.
* @ingroup Ecore_X_DPMS_Group
*/
EAPI void
ecore_x_dpms_timeout_standby_set(unsigned int new_timeout)
EAPI void
ecore_x_dpms_timeout_standby_set(unsigned int new_timeout)
{
unsigned int standby = 0, suspend = 0, off = 0;
@ -285,8 +289,8 @@ ecore_x_dpms_timeout_standby_set(unsigned int new_timeout)
* @param suspend Amount of time of inactivity before the screen is placed into suspend mode.
* @ingroup Ecore_X_DPMS_Group
*/
EAPI void
ecore_x_dpms_timeout_suspend_set(unsigned int new_timeout)
EAPI void
ecore_x_dpms_timeout_suspend_set(unsigned int new_timeout)
{
unsigned int standby = 0, suspend = 0, off = 0;
@ -301,8 +305,8 @@ ecore_x_dpms_timeout_suspend_set(unsigned int new_timeout)
* @param off Amount of time of inactivity before the monitor is shut off.
* @ingroup Ecore_X_DPMS_Group
*/
EAPI void
ecore_x_dpms_timeout_off_set(unsigned int new_timeout)
EAPI void
ecore_x_dpms_timeout_off_set(unsigned int new_timeout)
{
unsigned int standby = 0, suspend = 0, off = 0;
@ -311,3 +315,4 @@ ecore_x_dpms_timeout_off_set(unsigned int new_timeout)
ecore_x_dpms_timeouts_get(&standby, &suspend, &off);
ecore_x_dpms_timeouts_set(standby, suspend, new_timeout);
}

View File

@ -15,8 +15,13 @@
* @param width The width of the rectangle.
* @param height The height of the rectangle.
*/
EAPI void
ecore_x_drawable_rectangle_fill(Ecore_X_Drawable draw, Ecore_X_GC gc, int x, int y, int w, int h)
EAPI void
ecore_x_drawable_rectangle_fill(Ecore_X_Drawable draw,
Ecore_X_GC gc,
int x,
int y,
int w,
int h)
{
xcb_rectangle_t rect;
@ -27,7 +32,7 @@ ecore_x_drawable_rectangle_fill(Ecore_X_Drawable draw, Ecore_X_GC gc, int x, int
rect.y = y;
rect.width = w;
rect.height = h;
xcb_poly_fill_rectangle(_ecore_xcb_conn, draw, gc, 1,
xcb_poly_fill_rectangle(_ecore_xcb_conn, draw, gc, 1,
(const xcb_rectangle_t *)&rect);
// ecore_x_flush();
}
@ -41,8 +46,12 @@ ecore_x_drawable_rectangle_fill(Ecore_X_Drawable draw, Ecore_X_GC gc, int x, int
* @param h Pointer to an integer into which the height is to be stored.
* @ingroup Ecore_X_Drawable_Group
*/
EAPI void
ecore_x_drawable_geometry_get(Ecore_X_Drawable draw, int *x, int *y, int *w, int *h)
EAPI void
ecore_x_drawable_geometry_get(Ecore_X_Drawable draw,
int *x,
int *y,
int *w,
int *h)
{
xcb_get_geometry_cookie_t cookie;
xcb_get_geometry_reply_t *reply;
@ -70,8 +79,8 @@ ecore_x_drawable_geometry_get(Ecore_X_Drawable draw, int *x, int *y, int *w, int
* @return The border width of the given drawable.
* @ingroup Ecore_X_Drawable_Group
*/
EAPI int
ecore_x_drawable_border_width_get(Ecore_X_Drawable d)
EAPI int
ecore_x_drawable_border_width_get(Ecore_X_Drawable d)
{
xcb_get_geometry_cookie_t cookie;
xcb_get_geometry_reply_t *reply;
@ -94,8 +103,8 @@ ecore_x_drawable_border_width_get(Ecore_X_Drawable d)
* @return The depth of the given drawable.
* @ingroup Ecore_X_Drawable_Group
*/
EAPI int
ecore_x_drawable_depth_get(Ecore_X_Drawable d)
EAPI int
ecore_x_drawable_depth_get(Ecore_X_Drawable d)
{
xcb_get_geometry_cookie_t cookie;
xcb_get_geometry_reply_t *reply;
@ -111,3 +120,4 @@ ecore_x_drawable_depth_get(Ecore_X_Drawable d)
free(reply);
return ret;
}

File diff suppressed because it is too large Load Diff

View File

@ -16,8 +16,9 @@ static int _error_code = 0;
*
* Set the X error handler function
*/
EAPI void
ecore_x_error_handler_set(void (*func)(void *data), const void *data)
EAPI void
ecore_x_error_handler_set(void (*func)(void *data),
const void *data)
{
_error_func = func;
_error_data = (void *)data;
@ -30,8 +31,9 @@ ecore_x_error_handler_set(void (*func)(void *data), const void *data)
*
* Set the X I/O error handler function
*/
EAPI void
ecore_x_io_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)
{
_io_error_func = func;
_io_error_data = (void *)data;
@ -43,8 +45,8 @@ ecore_x_io_error_handler_set(void (*func)(void *data), const void *data)
*
* Return the X request code that caused the last X error
*/
EAPI int
ecore_x_error_request_get(void)
EAPI int
ecore_x_error_request_get(void)
{
return _error_request_code;
}
@ -55,14 +57,14 @@ ecore_x_error_request_get(void)
*
* Return the error code from the last X error
*/
EAPI int
ecore_x_error_code_get(void)
EAPI int
ecore_x_error_code_get(void)
{
return _error_code;
}
int
_ecore_xcb_error_handle(xcb_generic_error_t *err)
int
_ecore_xcb_error_handle(xcb_generic_error_t *err)
{
WRN("Got Error:");
WRN("\tEvent: %s", xcb_event_get_request_label(err->major_code));
@ -71,12 +73,12 @@ _ecore_xcb_error_handle(xcb_generic_error_t *err)
#ifdef OLD_XCB_VERSION
if (err->error_code == XCB_EVENT_ERROR_BAD_VALUE)
WRN("\tBad Value: %d", ((xcb_value_error_t *)err)->bad_value);
else if (err->error_code == XCB_EVENT_ERROR_BAD_WINDOW)
else if (err->error_code == XCB_EVENT_ERROR_BAD_WINDOW)
WRN("\tBad Window: %d", ((xcb_window_error_t *)err)->bad_value);
#else
if (err->error_code == XCB_VALUE)
WRN("\tBad Value: %d", ((xcb_value_error_t *)err)->bad_value);
else if (err->error_code == XCB_WINDOW)
else if (err->error_code == XCB_WINDOW)
WRN("\tBad Window: %d", ((xcb_window_error_t *)err)->bad_value);
#endif
@ -88,11 +90,11 @@ _ecore_xcb_error_handle(xcb_generic_error_t *err)
return 0;
}
int
_ecore_xcb_io_error_handle(xcb_generic_error_t *err)
int
_ecore_xcb_io_error_handle(xcb_generic_error_t *err)
{
CRIT("IO Error:");
if (err)
if (err)
{
CRIT("\tRequest: %d", err->sequence);
CRIT("\tCode: %d", err->error_code);
@ -104,3 +106,4 @@ _ecore_xcb_io_error_handle(xcb_generic_error_t *err)
return 0;
}

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +1,7 @@
#include "ecore_xcb_private.h"
void
_ecore_xcb_extensions_init(void)
void
_ecore_xcb_extensions_init(void)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
@ -71,8 +71,8 @@ _ecore_xcb_extensions_init(void)
xcb_prefetch_maximum_request_length(_ecore_xcb_conn);
}
void
_ecore_xcb_extensions_finalize(void)
void
_ecore_xcb_extensions_finalize(void)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
@ -137,3 +137,4 @@ _ecore_xcb_extensions_finalize(void)
xcb_get_maximum_request_length(_ecore_xcb_conn);
}

View File

@ -10,8 +10,10 @@
* same than the corresponding bitmaks.
* @return The new default graphics context.
*/
EAPI Ecore_X_GC
ecore_x_gc_new(Ecore_X_Drawable drawable, Ecore_X_GC_Value_Mask value_mask, const unsigned int *value_list)
EAPI Ecore_X_GC
ecore_x_gc_new(Ecore_X_Drawable drawable,
Ecore_X_GC_Value_Mask value_mask,
const unsigned int *value_list)
{
xcb_gcontext_t gc;
uint32_t vmask = 0;
@ -22,76 +24,98 @@ ecore_x_gc_new(Ecore_X_Drawable drawable, Ecore_X_GC_Value_Mask value_mask, cons
if (!drawable) drawable = ((xcb_screen_t *)_ecore_xcb_screen)->root;
for (i = 0, mask = 1; i <= 22; i++, mask <<= 1)
for (i = 0, mask = 1; i <= 22; i++, mask <<= 1)
{
switch (mask & value_mask)
switch (mask & value_mask)
{
case ECORE_X_GC_VALUE_MASK_FUNCTION:
vmask |= XCB_GC_FUNCTION;
break;
case ECORE_X_GC_VALUE_MASK_PLANE_MASK:
vmask |= XCB_GC_PLANE_MASK;
break;
case ECORE_X_GC_VALUE_MASK_FOREGROUND:
vmask |= XCB_GC_FOREGROUND;
break;
case ECORE_X_GC_VALUE_MASK_BACKGROUND:
vmask |= XCB_GC_BACKGROUND;
break;
case ECORE_X_GC_VALUE_MASK_LINE_WIDTH:
vmask |= XCB_GC_LINE_WIDTH;
break;
case ECORE_X_GC_VALUE_MASK_LINE_STYLE:
vmask |= XCB_GC_LINE_STYLE;
break;
case ECORE_X_GC_VALUE_MASK_CAP_STYLE:
vmask |= XCB_GC_CAP_STYLE;
break;
case ECORE_X_GC_VALUE_MASK_JOIN_STYLE:
vmask |= XCB_GC_JOIN_STYLE;
break;
case ECORE_X_GC_VALUE_MASK_FILL_STYLE:
vmask |= XCB_GC_FILL_STYLE;
break;
case ECORE_X_GC_VALUE_MASK_FILL_RULE:
vmask |= XCB_GC_FILL_RULE;
break;
case ECORE_X_GC_VALUE_MASK_TILE:
vmask |= XCB_GC_TILE;
break;
case ECORE_X_GC_VALUE_MASK_STIPPLE:
vmask |= XCB_GC_STIPPLE;
break;
case ECORE_X_GC_VALUE_MASK_TILE_STIPPLE_ORIGIN_X:
vmask |= XCB_GC_TILE_STIPPLE_ORIGIN_X;
break;
case ECORE_X_GC_VALUE_MASK_TILE_STIPPLE_ORIGIN_Y:
vmask |= XCB_GC_TILE_STIPPLE_ORIGIN_Y;
break;
case ECORE_X_GC_VALUE_MASK_FONT:
vmask |= XCB_GC_FONT;
break;
case ECORE_X_GC_VALUE_MASK_SUBWINDOW_MODE:
vmask |= XCB_GC_SUBWINDOW_MODE;
break;
case ECORE_X_GC_VALUE_MASK_GRAPHICS_EXPOSURES:
vmask |= XCB_GC_GRAPHICS_EXPOSURES;
break;
case ECORE_X_GC_VALUE_MASK_CLIP_ORIGIN_X:
vmask |= XCB_GC_CLIP_ORIGIN_X;
break;
case ECORE_X_GC_VALUE_MASK_CLIP_ORIGIN_Y:
vmask |= XCB_GC_CLIP_ORIGIN_Y;
break;
case ECORE_X_GC_VALUE_MASK_CLIP_MASK:
vmask |= XCB_GC_CLIP_MASK;
break;
case ECORE_X_GC_VALUE_MASK_DASH_OFFSET:
vmask |= XCB_GC_DASH_OFFSET;
break;
case ECORE_X_GC_VALUE_MASK_DASH_LIST:
vmask |= XCB_GC_DASH_LIST;
break;
case ECORE_X_GC_VALUE_MASK_ARC_MODE:
vmask |= XCB_GC_ARC_MODE;
break;
@ -109,8 +133,8 @@ ecore_x_gc_new(Ecore_X_Drawable drawable, Ecore_X_GC_Value_Mask value_mask, cons
* Deletes and frees the given graphics context.
* @param gc The given graphics context.
*/
EAPI void
ecore_x_gc_free(Ecore_X_GC gc)
EAPI void
ecore_x_gc_free(Ecore_X_GC gc)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
CHECK_XCB_CONN;
@ -119,8 +143,9 @@ ecore_x_gc_free(Ecore_X_GC gc)
// ecore_x_flush();
}
EAPI void
ecore_x_gc_foreground_set(Ecore_X_GC gc, unsigned long foreground)
EAPI void
ecore_x_gc_foreground_set(Ecore_X_GC gc,
unsigned long foreground)
{
uint32_t list;
@ -132,8 +157,9 @@ ecore_x_gc_foreground_set(Ecore_X_GC gc, unsigned long foreground)
// ecore_x_flush();
}
EAPI void
ecore_x_gc_background_set(Ecore_X_GC gc, unsigned long background)
EAPI void
ecore_x_gc_background_set(Ecore_X_GC gc,
unsigned long background)
{
uint32_t list;
@ -144,3 +170,4 @@ ecore_x_gc_background_set(Ecore_X_GC gc, unsigned long background)
xcb_change_gc(_ecore_xcb_conn, gc, XCB_GC_BACKGROUND, &list);
// ecore_x_flush();
}

View File

@ -1,10 +1,9 @@
#include "ecore_xcb_private.h"
#include <xcb/xcb_icccm.h>
EAPI void
ecore_x_icccm_init(void)
EAPI void
ecore_x_icccm_init(void)
{
}
/**
@ -14,8 +13,10 @@ ecore_x_icccm_init(void)
* @param argc Number of arguments.
* @param argv Arguments.
*/
EAPI void
ecore_x_icccm_command_set(Ecore_X_Window win, int argc, char **argv)
EAPI void
ecore_x_icccm_command_set(Ecore_X_Window win,
int argc,
char **argv)
{
void *buf;
char *b;
@ -41,8 +42,8 @@ ecore_x_icccm_command_set(Ecore_X_Window win, int argc, char **argv)
else
*b++ = '\0';
}
xcb_change_property(_ecore_xcb_conn, XCB_PROP_MODE_REPLACE, win,
ECORE_X_ATOM_WM_COMMAND, ECORE_X_ATOM_STRING, 8,
xcb_change_property(_ecore_xcb_conn, XCB_PROP_MODE_REPLACE, win,
ECORE_X_ATOM_WM_COMMAND, ECORE_X_ATOM_STRING, 8,
nbytes, buf);
free(buf);
}
@ -56,8 +57,10 @@ ecore_x_icccm_command_set(Ecore_X_Window win, int argc, char **argv)
* @param argc Number of arguments.
* @param argv Arguments.
*/
EAPI void
ecore_x_icccm_command_get(Ecore_X_Window win, int *argc, char ***argv)
EAPI void
ecore_x_icccm_command_get(Ecore_X_Window win,
int *argc,
char ***argv)
{
xcb_get_property_cookie_t cookie;
xcb_get_property_reply_t *reply;
@ -78,14 +81,14 @@ ecore_x_icccm_command_get(Ecore_X_Window win, int *argc, char ***argv)
reply = xcb_get_property_reply(_ecore_xcb_conn, cookie, NULL);
if (!reply) return;
if ((reply->type != ECORE_X_ATOM_STRING) || (reply->format != 8))
if ((reply->type != ECORE_X_ATOM_STRING) || (reply->format != 8))
{
free(reply);
return;
}
len = reply->value_len;
if (len < 1)
if (len < 1)
{
free(reply);
return;
@ -100,7 +103,7 @@ ecore_x_icccm_command_get(Ecore_X_Window win, int *argc, char ***argv)
if (*cp == '\0') c++;
v = (char **)malloc((c + 1) * sizeof(char *));
if (!v)
if (!v)
{
free(reply);
return;
@ -116,7 +119,7 @@ ecore_x_icccm_command_get(Ecore_X_Window win, int *argc, char ***argv)
memcpy(start, (char *)data, len);
start[len] = '\0';
for (cp = start, i = len + 1, j = 0; i > 0; cp++, i--)
for (cp = start, i = len + 1, j = 0; i > 0; cp++, i--)
{
if (*cp == '\0')
{
@ -160,7 +163,7 @@ ecore_x_icccm_command_get(Ecore_X_Window win, int *argc, char ***argv)
}
EAPI char *
ecore_x_icccm_title_get(Ecore_X_Window win)
ecore_x_icccm_title_get(Ecore_X_Window win)
{
xcb_get_property_cookie_t cookie;
#ifdef OLD_XCB_VERSION
@ -183,7 +186,7 @@ ecore_x_icccm_title_get(Ecore_X_Window win)
ret = xcb_icccm_get_wm_name_reply(_ecore_xcb_conn, cookie, &prop, NULL);
#endif
if (ret == 0) return NULL;
if (prop.name_len < 1)
if (prop.name_len < 1)
{
#ifdef OLD_XCB_VERSION
xcb_get_text_property_reply_wipe(&prop);
@ -194,7 +197,7 @@ ecore_x_icccm_title_get(Ecore_X_Window win)
}
if (!(title = malloc((prop.name_len + 1) * sizeof(char *))))
{
{
#ifdef OLD_XCB_VERSION
xcb_get_text_property_reply_wipe(&prop);
#else
@ -205,7 +208,7 @@ ecore_x_icccm_title_get(Ecore_X_Window win)
memcpy(title, prop.name, sizeof(char *) * prop.name_len);
title[prop.name_len] = '\0';
if (prop.encoding != ECORE_X_ATOM_UTF8_STRING)
if (prop.encoding != ECORE_X_ATOM_UTF8_STRING)
{
Ecore_Xcb_Textproperty tp;
int count = 0;
@ -237,8 +240,9 @@ ecore_x_icccm_title_get(Ecore_X_Window win)
return title;
}
EAPI void
ecore_x_icccm_title_set(Ecore_X_Window win, const char *title)
EAPI void
ecore_x_icccm_title_set(Ecore_X_Window win,
const char *title)
{
Ecore_Xcb_Textproperty prop;
char *list[1];
@ -253,31 +257,31 @@ ecore_x_icccm_title_set(Ecore_X_Window win, const char *title)
list[0] = strdup(title);
#ifdef HAVE_ICONV
ret = _ecore_xcb_utf8_textlist_to_textproperty(list, 1, XcbUTF8StringStyle,
ret = _ecore_xcb_utf8_textlist_to_textproperty(list, 1, XcbUTF8StringStyle,
&prop);
#else
ret = _ecore_xcb_mb_textlist_to_textproperty(list, 1, XcbStdICCTextStyle,
ret = _ecore_xcb_mb_textlist_to_textproperty(list, 1, XcbStdICCTextStyle,
&prop);
#endif
if (ret)
if (ret)
{
#ifdef OLD_XCB_VERSION
xcb_set_wm_name(_ecore_xcb_conn, win, ECORE_X_ATOM_STRING,
xcb_set_wm_name(_ecore_xcb_conn, win, ECORE_X_ATOM_STRING,
strlen(prop.value), prop.value);
#else
xcb_icccm_set_wm_name(_ecore_xcb_conn, win, ECORE_X_ATOM_STRING, 8,
xcb_icccm_set_wm_name(_ecore_xcb_conn, win, ECORE_X_ATOM_STRING, 8,
strlen(prop.value), prop.value);
#endif
if (prop.value) free(prop.value);
}
else
else
#ifdef OLD_XCB_VERSION
xcb_set_wm_name(_ecore_xcb_conn, win, ECORE_X_ATOM_STRING,
strlen(title), title);
xcb_set_wm_name(_ecore_xcb_conn, win, ECORE_X_ATOM_STRING,
strlen(title), title);
#else
xcb_icccm_set_wm_name(_ecore_xcb_conn, win, ECORE_X_ATOM_STRING, 8,
strlen(title), title);
xcb_icccm_set_wm_name(_ecore_xcb_conn, win, ECORE_X_ATOM_STRING, 8,
strlen(title), title);
#endif
free(list[0]);
}
@ -290,8 +294,10 @@ ecore_x_icccm_title_set(Ecore_X_Window win, const char *title)
*
* Get a window name * class
*/
EAPI void
ecore_x_icccm_name_class_get(Ecore_X_Window win, char **name, char **class)
EAPI void
ecore_x_icccm_name_class_get(Ecore_X_Window win,
char **name,
char **class)
{
xcb_get_property_cookie_t cookie;
#ifdef OLD_XCB_VERSION
@ -334,8 +340,10 @@ ecore_x_icccm_name_class_get(Ecore_X_Window win, char **name, char **class)
*
* Set a window name * class
*/
EAPI void
ecore_x_icccm_name_class_set(Ecore_X_Window win, const char *name, const char *class)
EAPI void
ecore_x_icccm_name_class_set(Ecore_X_Window win,
const char *name,
const char *class)
{
char *class_string, *s;
int length_name, length_class;
@ -345,7 +353,7 @@ ecore_x_icccm_name_class_set(Ecore_X_Window win, const char *name, const char *c
length_name = strlen(name);
length_class = strlen(class);
class_string =
class_string =
(char *)malloc(sizeof(char) * (length_name + length_class + 2));
if (!class_string) return;
@ -356,7 +364,7 @@ ecore_x_icccm_name_class_set(Ecore_X_Window win, const char *name, const char *c
s += length_name + 1;
}
else
*s++ = '\0';
*s++ = '\0';
if (length_class)
strcpy(s, class);
@ -374,14 +382,15 @@ ecore_x_icccm_name_class_set(Ecore_X_Window win, const char *name, const char *c
* @param win the transient window
* @param forwin the toplevel window
*/
EAPI void
ecore_x_icccm_transient_for_set(Ecore_X_Window win, Ecore_X_Window forwindow)
EAPI void
ecore_x_icccm_transient_for_set(Ecore_X_Window win,
Ecore_X_Window forwindow)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
CHECK_XCB_CONN;
xcb_change_property(_ecore_xcb_conn, XCB_PROP_MODE_REPLACE, win,
ECORE_X_ATOM_WM_TRANSIENT_FOR, ECORE_X_ATOM_WINDOW, 32,
xcb_change_property(_ecore_xcb_conn, XCB_PROP_MODE_REPLACE, win,
ECORE_X_ATOM_WM_TRANSIENT_FOR, ECORE_X_ATOM_WINDOW, 32,
1, (void *)&forwindow);
}
@ -389,8 +398,8 @@ ecore_x_icccm_transient_for_set(Ecore_X_Window win, Ecore_X_Window forwindow)
* Remove the transient_for setting from a window.
* @param The window
*/
EAPI void
ecore_x_icccm_transient_for_unset(Ecore_X_Window win)
EAPI void
ecore_x_icccm_transient_for_unset(Ecore_X_Window win)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
@ -402,8 +411,8 @@ ecore_x_icccm_transient_for_unset(Ecore_X_Window win)
* @param win The window to check
* @return The window ID of the top-level window, or 0 if the property does not exist.
*/
EAPI Ecore_X_Window
ecore_x_icccm_transient_for_get(Ecore_X_Window win)
EAPI Ecore_X_Window
ecore_x_icccm_transient_for_get(Ecore_X_Window win)
{
Ecore_X_Window forwin = 0;
xcb_get_property_cookie_t cookie;
@ -428,7 +437,7 @@ ecore_x_icccm_transient_for_get(Ecore_X_Window win)
* @return The window's role string.
*/
EAPI char *
ecore_x_icccm_window_role_get(Ecore_X_Window win)
ecore_x_icccm_window_role_get(Ecore_X_Window win)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
@ -440,8 +449,9 @@ ecore_x_icccm_window_role_get(Ecore_X_Window win)
* @param win The window
* @param role The role string
*/
EAPI void
ecore_x_icccm_window_role_set(Ecore_X_Window win, const char *role)
EAPI void
ecore_x_icccm_window_role_set(Ecore_X_Window win,
const char *role)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
@ -453,14 +463,14 @@ ecore_x_icccm_window_role_set(Ecore_X_Window win, const char *role)
* @param win The window
* @return The window's client leader window, or 0 if unset
*/
EAPI Ecore_X_Window
ecore_x_icccm_client_leader_get(Ecore_X_Window win)
EAPI Ecore_X_Window
ecore_x_icccm_client_leader_get(Ecore_X_Window win)
{
Ecore_X_Window leader;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
if (ecore_x_window_prop_window_get(win, ECORE_X_ATOM_WM_CLIENT_LEADER,
if (ecore_x_window_prop_window_get(win, ECORE_X_ATOM_WM_CLIENT_LEADER,
&leader, 1) > 0)
return leader;
@ -475,17 +485,18 @@ ecore_x_icccm_client_leader_get(Ecore_X_Window win)
* All non-transient top-level windows created by an app other than
* the main window must have this property set to the app's main window.
*/
EAPI void
ecore_x_icccm_client_leader_set(Ecore_X_Window win, Ecore_X_Window leader)
EAPI void
ecore_x_icccm_client_leader_set(Ecore_X_Window win,
Ecore_X_Window leader)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
ecore_x_window_prop_window_set(win, ECORE_X_ATOM_WM_CLIENT_LEADER,
ecore_x_window_prop_window_set(win, ECORE_X_ATOM_WM_CLIENT_LEADER,
&leader, 1);
}
EAPI Ecore_X_Window_State_Hint
ecore_x_icccm_state_get(Ecore_X_Window win)
EAPI Ecore_X_Window_State_Hint
ecore_x_icccm_state_get(Ecore_X_Window win)
{
xcb_get_property_cookie_t cookie;
xcb_get_property_reply_t *reply;
@ -495,13 +506,13 @@ ecore_x_icccm_state_get(Ecore_X_Window win)
LOGFN(__FILE__, __LINE__, __FUNCTION__);
CHECK_XCB_CONN;
cookie =
xcb_get_property_unchecked(_ecore_xcb_conn, 0, win,
ECORE_X_ATOM_WM_STATE, ECORE_X_ATOM_WM_STATE,
cookie =
xcb_get_property_unchecked(_ecore_xcb_conn, 0, win,
ECORE_X_ATOM_WM_STATE, ECORE_X_ATOM_WM_STATE,
0L, 0x7fffffff);
reply = xcb_get_property_reply(_ecore_xcb_conn, cookie, NULL);
if (!reply) return hint;
if ((reply->type == 0) || (reply->format != 8) || (reply->value_len != 2))
if ((reply->type == 0) || (reply->format != 8) || (reply->value_len != 2))
{
free(reply);
return hint;
@ -509,32 +520,38 @@ ecore_x_icccm_state_get(Ecore_X_Window win)
prop = (uint8_t *)xcb_get_property_value(reply);
#ifdef OLD_XCB_VERSION
switch (prop[0])
switch (prop[0])
{
case XCB_WM_STATE_WITHDRAWN:
hint = ECORE_X_WINDOW_STATE_HINT_WITHDRAWN;
break;
case XCB_WM_STATE_NORMAL:
hint = ECORE_X_WINDOW_STATE_HINT_NORMAL;
break;
case XCB_WM_STATE_ICONIC:
hint = ECORE_X_WINDOW_STATE_HINT_ICONIC;
break;
default:
break;
}
#else
switch (prop[0])
switch (prop[0])
{
case XCB_ICCCM_WM_STATE_WITHDRAWN:
hint = ECORE_X_WINDOW_STATE_HINT_WITHDRAWN;
break;
case XCB_ICCCM_WM_STATE_NORMAL:
hint = ECORE_X_WINDOW_STATE_HINT_NORMAL;
break;
case XCB_ICCCM_WM_STATE_ICONIC:
hint = ECORE_X_WINDOW_STATE_HINT_ICONIC;
break;
default:
break;
}
@ -544,8 +561,9 @@ ecore_x_icccm_state_get(Ecore_X_Window win)
return hint;
}
EAPI void
ecore_x_icccm_state_set(Ecore_X_Window win, Ecore_X_Window_State_Hint state)
EAPI void
ecore_x_icccm_state_set(Ecore_X_Window win,
Ecore_X_Window_State_Hint state)
{
#ifdef OLD_XCB_VERSION
xcb_wm_hints_t hints;
@ -583,20 +601,27 @@ ecore_x_icccm_state_set(Ecore_X_Window win, Ecore_X_Window_State_Hint state)
xcb_icccm_set_wm_hints(_ecore_xcb_conn, win, &hints);
#endif
}
EAPI void
ecore_x_icccm_delete_window_send(Ecore_X_Window win, Ecore_X_Time t)
EAPI void
ecore_x_icccm_delete_window_send(Ecore_X_Window win,
Ecore_X_Time t)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
ecore_x_client_message32_send(win, ECORE_X_ATOM_WM_PROTOCOLS,
ECORE_X_EVENT_MASK_NONE,
ecore_x_client_message32_send(win, ECORE_X_ATOM_WM_PROTOCOLS,
ECORE_X_EVENT_MASK_NONE,
ECORE_X_ATOM_WM_DELETE_WINDOW, t, 0, 0, 0);
}
EAPI void
ecore_x_icccm_hints_set(Ecore_X_Window win, Eina_Bool accepts_focus, Ecore_X_Window_State_Hint initial_state, Ecore_X_Pixmap icon_pixmap, Ecore_X_Pixmap icon_mask, Ecore_X_Window icon_window, Ecore_X_Window window_group, Eina_Bool is_urgent)
EAPI void
ecore_x_icccm_hints_set(Ecore_X_Window win,
Eina_Bool accepts_focus,
Ecore_X_Window_State_Hint initial_state,
Ecore_X_Pixmap icon_pixmap,
Ecore_X_Pixmap icon_mask,
Ecore_X_Window icon_window,
Ecore_X_Window window_group,
Eina_Bool is_urgent)
{
#ifdef OLD_XCB_VERSION
xcb_wm_hints_t hints;
@ -636,23 +661,30 @@ ecore_x_icccm_hints_set(Ecore_X_Window win, Eina_Bool accepts_focus, Ecore_X_Win
else if (initial_state == ECORE_X_WINDOW_STATE_HINT_ICONIC)
xcb_icccm_wm_hints_set_iconic(&hints);
if (icon_pixmap != 0)
if (icon_pixmap != 0)
xcb_icccm_wm_hints_set_icon_pixmap(&hints, icon_pixmap);
if (icon_mask != 0)
if (icon_mask != 0)
xcb_icccm_wm_hints_set_icon_mask(&hints, icon_mask);
if (icon_window != 0)
if (icon_window != 0)
xcb_icccm_wm_hints_set_icon_window(&hints, icon_window);
if (window_group != 0)
if (window_group != 0)
xcb_icccm_wm_hints_set_window_group(&hints, window_group);
if (is_urgent)
if (is_urgent)
xcb_icccm_wm_hints_set_urgency(&hints);
xcb_icccm_set_wm_hints(_ecore_xcb_conn, win, &hints);
#endif
}
EAPI Eina_Bool
ecore_x_icccm_hints_get(Ecore_X_Window win, Eina_Bool *accepts_focus, Ecore_X_Window_State_Hint *initial_state, Ecore_X_Pixmap *icon_pixmap, Ecore_X_Pixmap *icon_mask, Ecore_X_Window *icon_window, Ecore_X_Window *window_group, Eina_Bool *is_urgent)
EAPI Eina_Bool
ecore_x_icccm_hints_get(Ecore_X_Window win,
Eina_Bool *accepts_focus,
Ecore_X_Window_State_Hint *initial_state,
Ecore_X_Pixmap *icon_pixmap,
Ecore_X_Pixmap *icon_mask,
Ecore_X_Window *icon_window,
Ecore_X_Window *window_group,
Eina_Bool *is_urgent)
{
xcb_get_property_cookie_t cookie;
#ifdef OLD_XCB_VERSION
@ -759,7 +791,7 @@ ecore_x_icccm_hints_get(Ecore_X_Window win, Eina_Bool *accepts_focus, Ecore_X_Wi
* Return the icon name of a window. String must be free'd when done with.
*/
EAPI char *
ecore_x_icccm_icon_name_get(Ecore_X_Window win)
ecore_x_icccm_icon_name_get(Ecore_X_Window win)
{
xcb_get_property_cookie_t cookie;
#ifdef OLD_XCB_VERSION
@ -784,7 +816,7 @@ ecore_x_icccm_icon_name_get(Ecore_X_Window win)
#endif
if (ret == 0) return NULL;
if (prop.name_len < 1)
if (prop.name_len < 1)
{
#ifdef OLD_XCB_VERSION
xcb_get_text_property_reply_wipe(&prop);
@ -795,7 +827,7 @@ ecore_x_icccm_icon_name_get(Ecore_X_Window win)
}
if (!(tmp = malloc((prop.name_len + 1) * sizeof(char *))))
{
{
#ifdef OLD_XCB_VERSION
xcb_get_text_property_reply_wipe(&prop);
#else
@ -806,7 +838,7 @@ ecore_x_icccm_icon_name_get(Ecore_X_Window win)
memcpy(tmp, prop.name, sizeof(char *) * prop.name_len);
tmp[prop.name_len] = '\0';
if (prop.encoding != ECORE_X_ATOM_UTF8_STRING)
if (prop.encoding != ECORE_X_ATOM_UTF8_STRING)
{
Ecore_Xcb_Textproperty tp;
int count = 0;
@ -845,8 +877,9 @@ ecore_x_icccm_icon_name_get(Ecore_X_Window win)
*
* Set a window icon name
*/
EAPI void
ecore_x_icccm_icon_name_set(Ecore_X_Window win, const char *name)
EAPI void
ecore_x_icccm_icon_name_set(Ecore_X_Window win,
const char *name)
{
Ecore_Xcb_Textproperty prop;
char *list[1];
@ -861,38 +894,39 @@ ecore_x_icccm_icon_name_set(Ecore_X_Window win, const char *name)
list[0] = strdup(name);
#ifdef HAVE_ICONV
ret = _ecore_xcb_utf8_textlist_to_textproperty(list, 1, XcbUTF8StringStyle,
ret = _ecore_xcb_utf8_textlist_to_textproperty(list, 1, XcbUTF8StringStyle,
&prop);
#else
ret = _ecore_xcb_mb_textlist_to_textproperty(list, 1, XcbStdICCTextStyle,
ret = _ecore_xcb_mb_textlist_to_textproperty(list, 1, XcbStdICCTextStyle,
&prop);
#endif
if (ret)
if (ret)
{
#ifdef OLD_XCB_VERSION
xcb_set_wm_icon_name(_ecore_xcb_conn, win, ECORE_X_ATOM_STRING,
xcb_set_wm_icon_name(_ecore_xcb_conn, win, ECORE_X_ATOM_STRING,
strlen(prop.value), prop.value);
#else
xcb_icccm_set_wm_icon_name(_ecore_xcb_conn, win, ECORE_X_ATOM_STRING,
xcb_icccm_set_wm_icon_name(_ecore_xcb_conn, win, ECORE_X_ATOM_STRING,
8, strlen(prop.value), prop.value);
#endif
if (prop.value) free(prop.value);
}
else
else
#ifdef OLD_XCB_VERSION
xcb_set_wm_icon_name(_ecore_xcb_conn, win, ECORE_X_ATOM_STRING,
xcb_set_wm_icon_name(_ecore_xcb_conn, win, ECORE_X_ATOM_STRING,
strlen(name), name);
#else
xcb_icccm_set_wm_icon_name(_ecore_xcb_conn, win, ECORE_X_ATOM_STRING,
xcb_icccm_set_wm_icon_name(_ecore_xcb_conn, win, ECORE_X_ATOM_STRING,
8, strlen(name), name);
#endif
free(list[0]);
}
EAPI void
ecore_x_icccm_iconic_request_send(Ecore_X_Window win, Ecore_X_Window root)
EAPI void
ecore_x_icccm_iconic_request_send(Ecore_X_Window win,
Ecore_X_Window root)
{
xcb_client_message_event_t ev;
@ -914,9 +948,9 @@ ecore_x_icccm_iconic_request_send(Ecore_X_Window win, Ecore_X_Window root)
ev.data.data32[0] = XCB_ICCCM_WM_STATE_ICONIC;
#endif
xcb_send_event(_ecore_xcb_conn, 0, root,
(XCB_EVENT_MASK_SUBSTRUCTURE_NOTIFY |
XCB_EVENT_MASK_SUBSTRUCTURE_REDIRECT),
xcb_send_event(_ecore_xcb_conn, 0, root,
(XCB_EVENT_MASK_SUBSTRUCTURE_NOTIFY |
XCB_EVENT_MASK_SUBSTRUCTURE_REDIRECT),
(const char *)&ev);
// ecore_x_flush();
}
@ -927,8 +961,10 @@ ecore_x_icccm_iconic_request_send(Ecore_X_Window win, Ecore_X_Window root)
* @param protocol The protocol to enable/disable
* @param on On/Off
*/
EAPI void
ecore_x_icccm_protocol_set(Ecore_X_Window win, Ecore_X_WM_Protocol protocol, Eina_Bool on)
EAPI void
ecore_x_icccm_protocol_set(Ecore_X_Window win,
Ecore_X_WM_Protocol protocol,
Eina_Bool on)
{
Ecore_X_Atom proto;
xcb_get_property_cookie_t cookie;
@ -955,65 +991,65 @@ ecore_x_icccm_protocol_set(Ecore_X_Window win, Ecore_X_WM_Protocol protocol, Ein
else
count = protos.atoms_len;
for (i = 0; i < count; i++)
for (i = 0; i < count; i++)
{
if (protos.atoms[i] == proto)
if (protos.atoms[i] == proto)
{
set = 1;
break;
}
}
if (on)
if (on)
{
if (!set)
if (!set)
{
Ecore_X_Atom *atoms = NULL;
atoms = malloc((count + 1) * sizeof(Ecore_X_Atom));
if (atoms)
if (atoms)
{
for (i = 0; i < count; i++)
atoms[i] = protos.atoms[i];
atoms[count] = proto;
#ifdef OLD_XCB_VERSION
xcb_set_wm_protocols(_ecore_xcb_conn,
ECORE_X_ATOM_WM_PROTOCOLS,
xcb_set_wm_protocols(_ecore_xcb_conn,
ECORE_X_ATOM_WM_PROTOCOLS,
win, count, atoms);
#else
xcb_icccm_set_wm_protocols(_ecore_xcb_conn,
ECORE_X_ATOM_WM_PROTOCOLS,
xcb_icccm_set_wm_protocols(_ecore_xcb_conn,
ECORE_X_ATOM_WM_PROTOCOLS,
win, count, atoms);
#endif
free(atoms);
}
}
}
else
else
{
if (set)
if (set)
{
for (i = 0; i < count; i++)
for (i = 0; i < count; i++)
{
if (protos.atoms[i] == proto)
if (protos.atoms[i] == proto)
{
int j = 0;
for (j = (i + 1); j < count; j++)
protos.atoms[j - 1] = protos.atoms[j];
if (count > 1)
if (count > 1)
#ifdef OLD_XCB_VERSION
xcb_set_wm_protocols(_ecore_xcb_conn,
ECORE_X_ATOM_WM_PROTOCOLS,
xcb_set_wm_protocols(_ecore_xcb_conn,
ECORE_X_ATOM_WM_PROTOCOLS,
win, count - 1, protos.atoms);
#else
xcb_icccm_set_wm_protocols(_ecore_xcb_conn,
ECORE_X_ATOM_WM_PROTOCOLS,
win, count - 1,
xcb_icccm_set_wm_protocols(_ecore_xcb_conn,
ECORE_X_ATOM_WM_PROTOCOLS,
win, count - 1,
protos.atoms);
#endif
else
ecore_x_window_prop_property_del(win,
ecore_x_window_prop_property_del(win,
ECORE_X_ATOM_WM_PROTOCOLS);
break;
}
@ -1034,8 +1070,9 @@ ecore_x_icccm_protocol_set(Ecore_X_Window win, Ecore_X_WM_Protocol protocol, Ein
* @param protocol The protocol to query
* @return 1 if the protocol is set, else 0.
*/
EAPI Eina_Bool
ecore_x_icccm_protocol_isset(Ecore_X_Window win, Ecore_X_WM_Protocol protocol)
EAPI Eina_Bool
ecore_x_icccm_protocol_isset(Ecore_X_Window win,
Ecore_X_WM_Protocol protocol)
{
Ecore_X_Atom proto;
Eina_Bool ret = EINA_FALSE;
@ -1064,7 +1101,7 @@ ecore_x_icccm_protocol_isset(Ecore_X_Window win, Ecore_X_WM_Protocol protocol)
if (!val) return EINA_FALSE;
for (i = 0; i < reply.atoms_len; i++)
if (reply.atoms[i] == proto)
if (reply.atoms[i] == proto)
{
ret = EINA_TRUE;
break;
@ -1085,27 +1122,40 @@ ecore_x_icccm_protocol_isset(Ecore_X_Window win, Ecore_X_WM_Protocol protocol)
* @param protos An array of protocol atoms
* @param num the number of members of the array
*/
EAPI void
ecore_x_icccm_protocol_atoms_set(Ecore_X_Window win, Ecore_X_Atom *protos, int num)
EAPI void
ecore_x_icccm_protocol_atoms_set(Ecore_X_Window win,
Ecore_X_Atom *protos,
int num)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
CHECK_XCB_CONN;
if (num > 0)
if (num > 0)
#ifdef OLD_XCB_VERSION
xcb_set_wm_protocols(_ecore_xcb_conn, ECORE_X_ATOM_WM_PROTOCOLS,
xcb_set_wm_protocols(_ecore_xcb_conn, ECORE_X_ATOM_WM_PROTOCOLS,
win, num, protos);
#else
xcb_icccm_set_wm_protocols(_ecore_xcb_conn, ECORE_X_ATOM_WM_PROTOCOLS,
xcb_icccm_set_wm_protocols(_ecore_xcb_conn, ECORE_X_ATOM_WM_PROTOCOLS,
win, num, protos);
#endif
else
else
ecore_x_window_prop_property_del(win, ECORE_X_ATOM_WM_PROTOCOLS);
}
EAPI Eina_Bool
ecore_x_icccm_size_pos_hints_get(Ecore_X_Window win, Eina_Bool *request_pos, Ecore_X_Gravity *gravity, int *min_w, int *min_h, int *max_w, int *max_h, int *base_w, int *base_h, int *step_x, int *step_y, double *min_aspect, double *max_aspect)
EAPI Eina_Bool
ecore_x_icccm_size_pos_hints_get(Ecore_X_Window win,
Eina_Bool *request_pos,
Ecore_X_Gravity *gravity,
int *min_w,
int *min_h,
int *max_w,
int *max_h,
int *base_w,
int *base_h,
int *step_x,
int *step_y,
double *min_aspect,
double *max_aspect)
{
xcb_size_hints_t hints;
xcb_get_property_cookie_t cookie;
@ -1137,17 +1187,17 @@ ecore_x_icccm_size_pos_hints_get(Ecore_X_Window win, Eina_Bool *request_pos, Eco
ret = xcb_get_wm_normal_hints_reply(_ecore_xcb_conn, cookie, &hints, NULL);
#else
cookie = xcb_icccm_get_wm_normal_hints_unchecked(_ecore_xcb_conn, win);
ret = xcb_icccm_get_wm_normal_hints_reply(_ecore_xcb_conn, cookie,
ret = xcb_icccm_get_wm_normal_hints_reply(_ecore_xcb_conn, cookie,
&hints, NULL);
#endif
if (!ret) return EINA_FALSE;
#ifdef OLD_XCB_VERSION
if ((hints.flags & XCB_SIZE_HINT_US_POSITION) ||
(hints.flags & XCB_SIZE_HINT_P_POSITION))
if ((hints.flags & XCB_SIZE_HINT_US_POSITION) ||
(hints.flags & XCB_SIZE_HINT_P_POSITION))
#else
if ((hints.flags & XCB_ICCCM_SIZE_HINT_US_POSITION) ||
(hints.flags & XCB_ICCCM_SIZE_HINT_P_POSITION))
if ((hints.flags & XCB_ICCCM_SIZE_HINT_US_POSITION) ||
(hints.flags & XCB_ICCCM_SIZE_HINT_P_POSITION))
#endif
{
if (request_pos) *request_pos = EINA_TRUE;
@ -1236,7 +1286,19 @@ ecore_x_icccm_size_pos_hints_get(Ecore_X_Window win, Eina_Bool *request_pos, Eco
}
EAPI void
ecore_x_icccm_size_pos_hints_set(Ecore_X_Window win, Eina_Bool request_pos, Ecore_X_Gravity gravity, int min_w, int min_h, int max_w, int max_h, int base_w, int base_h, int step_x, int step_y, double min_aspect, double max_aspect)
ecore_x_icccm_size_pos_hints_set(Ecore_X_Window win,
Eina_Bool request_pos,
Ecore_X_Gravity gravity,
int min_w,
int min_h,
int max_w,
int max_h,
int base_w,
int base_h,
int step_x,
int step_y,
double min_aspect,
double max_aspect)
{
xcb_get_property_cookie_t cookie;
xcb_size_hints_t hints;
@ -1250,7 +1312,7 @@ ecore_x_icccm_size_pos_hints_set(Ecore_X_Window win, Eina_Bool request_pos, Ecor
ret = xcb_get_wm_normal_hints_reply(_ecore_xcb_conn, cookie, &hints, NULL);
#else
cookie = xcb_icccm_get_wm_normal_hints_unchecked(_ecore_xcb_conn, win);
ret = xcb_icccm_get_wm_normal_hints_reply(_ecore_xcb_conn, cookie,
ret = xcb_icccm_get_wm_normal_hints_reply(_ecore_xcb_conn, cookie,
&hints, NULL);
#endif
if (!ret) memset(&hints, 0, sizeof(xcb_size_hints_t));
@ -1258,50 +1320,54 @@ ecore_x_icccm_size_pos_hints_set(Ecore_X_Window win, Eina_Bool request_pos, Ecor
hints.flags = 0;
#ifdef OLD_XCB_VERSION
if (request_pos)
if (request_pos)
hints.flags |= XCB_SIZE_HINT_US_POSITION;
if (gravity != ECORE_X_GRAVITY_NW)
xcb_size_hints_set_win_gravity(&hints, gravity);
if ((min_w > 0) || (min_h > 0))
if ((min_w > 0) || (min_h > 0))
xcb_size_hints_set_min_size(&hints, min_w, min_h);
if ((max_w > 0) || (max_h > 0))
xcb_size_hints_set_max_size(&hints, max_w, max_h);
if ((base_w > 0) || (base_h > 0))
if ((base_w > 0) || (base_h > 0))
xcb_size_hints_set_base_size(&hints, base_w, base_h);
if ((step_x > 1) || (step_y > 1))
if ((step_x > 1) || (step_y > 1))
xcb_size_hints_set_resize_inc(&hints, step_x, step_y);
if ((min_aspect > 0.0) || (max_aspect > 0.0))
xcb_size_hints_set_aspect(&hints,
(int32_t)(min_aspect * 10000), 10000,
if ((min_aspect > 0.0) || (max_aspect > 0.0))
xcb_size_hints_set_aspect(&hints,
(int32_t)(min_aspect * 10000), 10000,
(int32_t)(max_aspect * 10000), 10000);
xcb_set_wm_normal_hints(_ecore_xcb_conn, win, &hints);
#else
if (request_pos)
if (request_pos)
hints.flags |= XCB_ICCCM_SIZE_HINT_US_POSITION;
if (gravity != ECORE_X_GRAVITY_NW)
xcb_icccm_size_hints_set_win_gravity(&hints, gravity);
if ((min_w > 0) || (min_h > 0))
if ((min_w > 0) || (min_h > 0))
xcb_icccm_size_hints_set_min_size(&hints, min_w, min_h);
if ((max_w > 0) || (max_h > 0))
xcb_icccm_size_hints_set_max_size(&hints, max_w, max_h);
if ((base_w > 0) || (base_h > 0))
if ((base_w > 0) || (base_h > 0))
xcb_icccm_size_hints_set_base_size(&hints, base_w, base_h);
if ((step_x > 1) || (step_y > 1))
if ((step_x > 1) || (step_y > 1))
xcb_icccm_size_hints_set_resize_inc(&hints, step_x, step_y);
if ((min_aspect > 0.0) || (max_aspect > 0.0))
xcb_icccm_size_hints_set_aspect(&hints,
(int32_t)(min_aspect * 10000), 10000,
if ((min_aspect > 0.0) || (max_aspect > 0.0))
xcb_icccm_size_hints_set_aspect(&hints,
(int32_t)(min_aspect * 10000), 10000,
(int32_t)(max_aspect * 10000), 10000);
xcb_icccm_set_wm_normal_hints(_ecore_xcb_conn, win, &hints);
#endif
}
EAPI void
ecore_x_icccm_move_resize_send(Ecore_X_Window win, int x, int y, int w, int h)
EAPI void
ecore_x_icccm_move_resize_send(Ecore_X_Window win,
int x,
int y,
int w,
int h)
{
xcb_configure_notify_event_t ev;
@ -1323,7 +1389,7 @@ ecore_x_icccm_move_resize_send(Ecore_X_Window win, int x, int y, int w, int h)
ev.border_width = 0;
ev.override_redirect = 0;
xcb_send_event(_ecore_xcb_conn, 0, win,
xcb_send_event(_ecore_xcb_conn, 0, win,
XCB_EVENT_MASK_STRUCTURE_NOTIFY, (const char *)&ev);
// ecore_x_flush();
}
@ -1336,7 +1402,7 @@ ecore_x_icccm_move_resize_send(Ecore_X_Window win, int x, int y, int w, int h)
* Return the client machine of a window. String must be free'd when done with.
*/
EAPI char *
ecore_x_icccm_client_machine_get(Ecore_X_Window win)
ecore_x_icccm_client_machine_get(Ecore_X_Window win)
{
xcb_get_property_cookie_t cookie;
#ifdef OLD_XCB_VERSION
@ -1355,14 +1421,14 @@ ecore_x_icccm_client_machine_get(Ecore_X_Window win)
ret = xcb_get_wm_client_machine_reply(_ecore_xcb_conn, cookie, &prop, NULL);
#else
cookie = xcb_icccm_get_wm_client_machine_unchecked(_ecore_xcb_conn, win);
ret = xcb_icccm_get_wm_client_machine_reply(_ecore_xcb_conn, cookie,
ret = xcb_icccm_get_wm_client_machine_reply(_ecore_xcb_conn, cookie,
&prop, NULL);
#endif
if (ret == 0) return NULL;
tmp = malloc((prop.name_len + 1) * sizeof(char *));
if (!tmp)
{
if (!tmp)
{
#ifdef OLD_XCB_VERSION
xcb_get_text_property_reply_wipe(&prop);
#else
@ -1382,22 +1448,24 @@ ecore_x_icccm_client_machine_get(Ecore_X_Window win)
return tmp;
}
EAPI void
ecore_x_icccm_take_focus_send(Ecore_X_Window win, Ecore_X_Time t)
EAPI void
ecore_x_icccm_take_focus_send(Ecore_X_Window win,
Ecore_X_Time t)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
ecore_x_client_message32_send(win, ECORE_X_ATOM_WM_PROTOCOLS,
XCB_EVENT_MASK_NO_EVENT,
ecore_x_client_message32_send(win, ECORE_X_ATOM_WM_PROTOCOLS,
XCB_EVENT_MASK_NO_EVENT,
ECORE_X_ATOM_WM_TAKE_FOCUS, t, 0, 0, 0);
}
EAPI void
ecore_x_icccm_save_yourself_send(Ecore_X_Window win, Ecore_X_Time t)
EAPI void
ecore_x_icccm_save_yourself_send(Ecore_X_Window win,
Ecore_X_Time t)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
ecore_x_client_message32_send(win, ECORE_X_ATOM_WM_PROTOCOLS,
XCB_EVENT_MASK_NO_EVENT,
ecore_x_client_message32_send(win, ECORE_X_ATOM_WM_PROTOCOLS,
XCB_EVENT_MASK_NO_EVENT,
ECORE_X_ATOM_WM_SAVE_YOURSELF, t, 0, 0, 0);
}
@ -1406,8 +1474,9 @@ ecore_x_icccm_save_yourself_send(Ecore_X_Window win, Ecore_X_Time t)
* @param win The toplevel window
* @param subwin The subwindow to be added to the colormap windows list
*/
EAPI void
ecore_x_icccm_colormap_window_set(Ecore_X_Window win, Ecore_X_Window subwin)
EAPI void
ecore_x_icccm_colormap_window_set(Ecore_X_Window win,
Ecore_X_Window subwin)
{
int num = 0, i = 0;
unsigned char *odata = NULL, *data = NULL;
@ -1415,21 +1484,21 @@ ecore_x_icccm_colormap_window_set(Ecore_X_Window win, Ecore_X_Window subwin)
LOGFN(__FILE__, __LINE__, __FUNCTION__);
if (!ecore_x_window_prop_property_get(win, ECORE_X_ATOM_WM_COLORMAP_WINDOWS,
ECORE_X_ATOM_WINDOW, 32, &odata, &num))
if (!ecore_x_window_prop_property_get(win, ECORE_X_ATOM_WM_COLORMAP_WINDOWS,
ECORE_X_ATOM_WINDOW, 32, &odata, &num))
{
if (!(newset = calloc(1, sizeof(Ecore_X_Window)))) return;
newset[0] = subwin;
num = 1;
data = (unsigned char *)newset;
}
else
else
{
if (!(newset = calloc(num + 1, sizeof(Ecore_X_Window)))) return;
oldset = (Ecore_X_Window *)odata;
for (i = 0; i < num; i++)
for (i = 0; i < num; i++)
{
if (oldset[i] == subwin)
if (oldset[i] == subwin)
{
if (odata) free(odata);
odata = NULL;
@ -1442,7 +1511,7 @@ ecore_x_icccm_colormap_window_set(Ecore_X_Window win, Ecore_X_Window subwin)
if (odata) free(odata);
data = (unsigned char *)newset;
}
ecore_x_window_prop_property_set(win, ECORE_X_ATOM_WM_COLORMAP_WINDOWS,
ecore_x_window_prop_property_set(win, ECORE_X_ATOM_WM_COLORMAP_WINDOWS,
ECORE_X_ATOM_WINDOW, 32, data, num);
free(newset);
}
@ -1452,8 +1521,9 @@ ecore_x_icccm_colormap_window_set(Ecore_X_Window win, Ecore_X_Window subwin)
* @param win The toplevel window
* @param subwin The window to be removed from the colormap window list.
*/
EAPI void
ecore_x_icccm_colormap_window_unset(Ecore_X_Window win, Ecore_X_Window subwin)
EAPI void
ecore_x_icccm_colormap_window_unset(Ecore_X_Window win,
Ecore_X_Window subwin)
{
int num = 0, i = 0, j = 0, k = 0;
unsigned char *odata = NULL, *data = NULL;
@ -1461,23 +1531,23 @@ ecore_x_icccm_colormap_window_unset(Ecore_X_Window win, Ecore_X_Window subwin)
LOGFN(__FILE__, __LINE__, __FUNCTION__);
if (!ecore_x_window_prop_property_get(win, ECORE_X_ATOM_WM_COLORMAP_WINDOWS,
ECORE_X_ATOM_WINDOW, 32, &odata, &num))
if (!ecore_x_window_prop_property_get(win, ECORE_X_ATOM_WM_COLORMAP_WINDOWS,
ECORE_X_ATOM_WINDOW, 32, &odata, &num))
return;
oldset = (Ecore_X_Window *)odata;
for (i = 0; i < num; i++)
for (i = 0; i < num; i++)
{
if (oldset[i] == subwin)
if (oldset[i] == subwin)
{
if (num == 1)
if (num == 1)
{
ecore_x_window_prop_property_del(win, ECORE_X_ATOM_WM_COLORMAP_WINDOWS);
if (odata) free(odata);
odata = NULL;
return;
}
else
else
{
newset = calloc(num - 1, sizeof(Ecore_X_Window));
data = (unsigned char *)newset;
@ -1485,7 +1555,7 @@ ecore_x_icccm_colormap_window_unset(Ecore_X_Window win, Ecore_X_Window subwin)
if (oldset[j] != subwin)
newset[k++] = oldset[j];
ecore_x_window_prop_property_set(win, ECORE_X_ATOM_WM_COLORMAP_WINDOWS,
ecore_x_window_prop_property_set(win, ECORE_X_ATOM_WM_COLORMAP_WINDOWS,
ECORE_X_ATOM_WINDOW, 32, data, k);
if (odata) free(odata);
odata = NULL;
@ -1496,3 +1566,4 @@ ecore_x_icccm_colormap_window_unset(Ecore_X_Window win, Ecore_X_Window subwin)
}
if (odata) free(odata);
}

View File

@ -4,27 +4,31 @@
#include <xcb/xcb_event.h>
#include <xcb/shm.h>
struct _Ecore_X_Image
struct _Ecore_X_Image
{
xcb_shm_segment_info_t shminfo;
xcb_image_t *xim;
Ecore_X_Visual vis;
int depth, w, h;
int bpl, bpp, rows;
unsigned char *data;
Eina_Bool shm : 1;
xcb_image_t *xim;
Ecore_X_Visual vis;
int depth, w, h;
int bpl, bpp, rows;
unsigned char *data;
Eina_Bool shm : 1;
};
/* local function prototypes */
static void _ecore_xcb_image_shm_check(void);
static void _ecore_xcb_image_shm_create(Ecore_X_Image *im);
static xcb_format_t *_ecore_xcb_image_find_format(const xcb_setup_t *setup, uint8_t depth);
static void _ecore_xcb_image_shm_check(void);
static void _ecore_xcb_image_shm_create(Ecore_X_Image *im);
static xcb_format_t *_ecore_xcb_image_find_format(const xcb_setup_t *setup,
uint8_t depth);
/* local variables */
static int _ecore_xcb_image_shm_can = -1;
EAPI Ecore_X_Image *
ecore_x_image_new(int w, int h, Ecore_X_Visual vis, int depth)
ecore_x_image_new(int w,
int h,
Ecore_X_Visual vis,
int depth)
{
Ecore_X_Image *im;
@ -40,16 +44,16 @@ ecore_x_image_new(int w, int h, Ecore_X_Visual vis, int depth)
return im;
}
EAPI void
ecore_x_image_free(Ecore_X_Image *im)
EAPI void
ecore_x_image_free(Ecore_X_Image *im)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
CHECK_XCB_CONN;
if (!im) return;
if (im->shm)
if (im->shm)
{
if (im->xim)
if (im->xim)
{
xcb_shm_detach(_ecore_xcb_conn, im->shminfo.shmseg);
xcb_image_destroy(im->xim);
@ -57,7 +61,7 @@ ecore_x_image_free(Ecore_X_Image *im)
shmctl(im->shminfo.shmid, IPC_RMID, 0);
}
}
else if (im->xim)
else if (im->xim)
{
if (im->xim->data) free(im->xim->data);
im->xim->data = NULL;
@ -68,29 +72,36 @@ ecore_x_image_free(Ecore_X_Image *im)
// ecore_x_flush();
}
EAPI Eina_Bool
ecore_x_image_get(Ecore_X_Image *im, Ecore_X_Drawable draw, int x, int y, int sx, int sy, int w, int h)
EAPI Eina_Bool
ecore_x_image_get(Ecore_X_Image *im,
Ecore_X_Drawable draw,
int x,
int y,
int sx,
int sy,
int w,
int h)
{
Eina_Bool ret = EINA_TRUE;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
CHECK_XCB_CONN;
if (im->shm)
if (im->shm)
{
if (!im->xim) _ecore_xcb_image_shm_create(im);
if (!im->xim) return EINA_FALSE;
if ((sx == 0) && (w == im->w))
if ((sx == 0) && (w == im->w))
{
im->xim->data = (uint8_t *)im->data + (im->xim->stride * sy) +
im->xim->data = (uint8_t *)im->data + (im->xim->stride * sy) +
(sx * im->bpp);
im->xim->width = w;
im->xim->height = h;
ecore_x_grab();
if (!xcb_image_shm_get(_ecore_xcb_conn, draw, im->xim,
im->shminfo, x, y, 0xffffffff))
if (!xcb_image_shm_get(_ecore_xcb_conn, draw, im->xim,
im->shminfo, x, y, 0xffffffff))
{
DBG("\tImage Shm Get Failed");
ret = EINA_FALSE;
@ -98,31 +109,31 @@ ecore_x_image_get(Ecore_X_Image *im, Ecore_X_Drawable draw, int x, int y, int sx
ecore_x_ungrab();
ecore_x_sync(); // needed
}
else
else
{
Ecore_X_Image *tim;
tim = ecore_x_image_new(w, h, im->vis, im->depth);
if (tim)
if (tim)
{
ret = ecore_x_image_get(tim, draw, x, y, 0, 0, w, h);
if (ret)
if (ret)
{
unsigned char *spixels, *pixels;
int sbpp = 0, sbpl = 0, srows = 0;
int bpp = 0, bpl = 0, rows = 0;
spixels =
spixels =
ecore_x_image_data_get(tim, &sbpl, &srows, &sbpp);
pixels = ecore_x_image_data_get(im, &bpl, &rows, &bpp);
if ((spixels) && (pixels))
if ((spixels) && (pixels))
{
unsigned char *p, *sp;
int r = 0;
p = (pixels + (sy * bpl) + (sx * bpp));
sp = spixels;
for (r = srows; r > 0; r--)
for (r = srows; r > 0; r--)
{
memcpy(p, sp, sbpl);
p += bpl;
@ -134,18 +145,18 @@ ecore_x_image_get(Ecore_X_Image *im, Ecore_X_Drawable draw, int x, int y, int sx
}
}
}
else
else
{
ret = EINA_FALSE;
ecore_x_grab();
im->xim =
xcb_image_get(_ecore_xcb_conn, draw, x, y, w, h,
im->xim =
xcb_image_get(_ecore_xcb_conn, draw, x, y, w, h,
0xffffffff, XCB_IMAGE_FORMAT_Z_PIXMAP);
if (!im->xim) ret = EINA_FALSE;
ecore_x_ungrab();
ecore_x_sync(); // needed
if (im->xim)
if (im->xim)
{
im->data = (unsigned char *)im->xim->data;
im->bpl = im->xim->stride;
@ -163,7 +174,10 @@ ecore_x_image_get(Ecore_X_Image *im, Ecore_X_Drawable draw, int x, int y, int sx
}
EAPI void *
ecore_x_image_data_get(Ecore_X_Image *im, int *bpl, int *rows, int *bpp)
ecore_x_image_data_get(Ecore_X_Image *im,
int *bpl,
int *rows,
int *bpp)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
@ -178,15 +192,23 @@ ecore_x_image_data_get(Ecore_X_Image *im, int *bpl, int *rows, int *bpp)
return im->data;
}
EAPI void
ecore_x_image_put(Ecore_X_Image *im, Ecore_X_Drawable draw, Ecore_X_GC gc, int x, int y, int sx, int sy, int w, int h)
EAPI void
ecore_x_image_put(Ecore_X_Image *im,
Ecore_X_Drawable draw,
Ecore_X_GC gc,
int x,
int y,
int sx,
int sy,
int w,
int h)
{
Ecore_X_GC tgc = 0;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
CHECK_XCB_CONN;
if (!gc)
if (!gc)
{
uint32_t mask, values[1];
@ -197,26 +219,25 @@ ecore_x_image_put(Ecore_X_Image *im, Ecore_X_Drawable draw, Ecore_X_GC gc, int x
gc = tgc;
}
if (!im->xim) _ecore_xcb_image_shm_create(im);
if (im->xim)
if (im->xim)
{
if (im->shm)
xcb_shm_put_image(_ecore_xcb_conn, draw, gc, im->xim->width,
im->xim->height, sx, sy, w, h, x, y,
im->xim->depth, im->xim->format, 0,
im->shminfo.shmseg,
if (im->shm)
xcb_shm_put_image(_ecore_xcb_conn, draw, gc, im->xim->width,
im->xim->height, sx, sy, w, h, x, y,
im->xim->depth, im->xim->format, 0,
im->shminfo.shmseg,
im->xim->data - im->shminfo.shmaddr);
// xcb_image_shm_put(_ecore_xcb_conn, draw, gc, im->xim,
// xcb_image_shm_put(_ecore_xcb_conn, draw, gc, im->xim,
// im->shminfo, sx, sy, x, y, w, h, 0);
else
else
xcb_image_put(_ecore_xcb_conn, draw, gc, im->xim, sx, sy, 0);
}
if (tgc) ecore_x_gc_free(tgc);
ecore_x_sync();
}
EAPI Eina_Bool
ecore_x_image_is_argb32_get(Ecore_X_Image *im)
EAPI Eina_Bool
ecore_x_image_is_argb32_get(Ecore_X_Image *im)
{
xcb_visualtype_t *vis;
@ -226,16 +247,16 @@ ecore_x_image_is_argb32_get(Ecore_X_Image *im)
vis = (xcb_visualtype_t *)im->vis;
if (!im->xim) _ecore_xcb_image_shm_create(im);
if (((vis->_class == XCB_VISUAL_CLASS_TRUE_COLOR) ||
(vis->_class == XCB_VISUAL_CLASS_DIRECT_COLOR)) &&
(im->depth >= 24) && (vis->red_mask == 0xff0000) &&
if (((vis->_class == XCB_VISUAL_CLASS_TRUE_COLOR) ||
(vis->_class == XCB_VISUAL_CLASS_DIRECT_COLOR)) &&
(im->depth >= 24) && (vis->red_mask == 0xff0000) &&
(vis->green_mask == 0x00ff00) && (vis->blue_mask == 0x0000ff))
{
#ifdef WORDS_BIGENDIAN
if (im->xim->byte_order == XCB_IMAGE_ORDER_LSB_FIRST)
if (im->xim->byte_order == XCB_IMAGE_ORDER_LSB_FIRST)
return EINA_TRUE;
#else
if (im->xim->byte_order == XCB_IMAGE_ORDER_MSB_FIRST)
if (im->xim->byte_order == XCB_IMAGE_ORDER_MSB_FIRST)
return EINA_TRUE;
#endif
}
@ -243,25 +264,37 @@ ecore_x_image_is_argb32_get(Ecore_X_Image *im)
return EINA_FALSE;
}
EAPI Eina_Bool
ecore_x_image_to_argb_convert(void *src, int sbpp, int sbpl, Ecore_X_Colormap c, Ecore_X_Visual v, int x, int y, int w, int h, unsigned int *dst, int dbpl, int dx, int dy)
EAPI Eina_Bool
ecore_x_image_to_argb_convert(void *src,
int sbpp,
int sbpl,
Ecore_X_Colormap c,
Ecore_X_Visual v,
int x,
int y,
int w,
int h,
unsigned int *dst,
int dbpl,
int dx,
int dy)
{
xcb_visualtype_t *vis;
uint32_t *cols;
int n = 0, nret = 0, i, row, mode = 0;
unsigned int pal[256], r, g, b;
enum
{
rgbnone = 0,
rgb565,
bgr565,
rgbx555,
argbx888,
abgrx888,
rgba888x,
bgra888x,
argbx666
};
{
rgbnone = 0,
rgb565,
bgr565,
rgbx555,
argbx888,
abgrx888,
rgba888x,
bgra888x,
argbx666
};
LOGFN(__FILE__, __LINE__, __FUNCTION__);
CHECK_XCB_CONN;
@ -272,14 +305,14 @@ ecore_x_image_to_argb_convert(void *src, int sbpp, int sbpl, Ecore_X_Colormap c,
n = vis->colormap_entries;
if ((n <= 256) &&
((vis->_class == XCB_VISUAL_CLASS_PSEUDO_COLOR) ||
(vis->_class == XCB_VISUAL_CLASS_STATIC_COLOR) ||
(vis->_class == XCB_VISUAL_CLASS_GRAY_SCALE) ||
(vis->_class == XCB_VISUAL_CLASS_STATIC_GRAY)))
(vis->_class == XCB_VISUAL_CLASS_STATIC_COLOR) ||
(vis->_class == XCB_VISUAL_CLASS_GRAY_SCALE) ||
(vis->_class == XCB_VISUAL_CLASS_STATIC_GRAY)))
{
xcb_query_colors_cookie_t cookie;
xcb_query_colors_reply_t *reply;
if (!c)
if (!c)
{
c = (xcb_colormap_t)((xcb_screen_t *)
_ecore_xcb_screen)->default_colormap;
@ -291,61 +324,61 @@ ecore_x_image_to_argb_convert(void *src, int sbpp, int sbpl, Ecore_X_Colormap c,
cookie = xcb_query_colors_unchecked(_ecore_xcb_conn, c, n, cols);
reply = xcb_query_colors_reply(_ecore_xcb_conn, cookie, NULL);
if (reply)
if (reply)
{
xcb_rgb_iterator_t iter;
xcb_rgb_t *ret;
iter = xcb_query_colors_colors_iterator(reply);
ret = xcb_query_colors_colors(reply);
if (ret)
if (ret)
{
for (i = 0; iter.rem; xcb_rgb_next(&iter), i++)
for (i = 0; iter.rem; xcb_rgb_next(&iter), i++)
{
pal[i] = 0xff000000 |
((iter.data->red >> 8) << 16) |
pal[i] = 0xff000000 |
((iter.data->red >> 8) << 16) |
((iter.data->green >> 8) << 8) |
((iter.data->blue >> 8));
((iter.data->blue >> 8));
}
nret = n;
}
free(reply);
}
}
else if ((vis->_class == XCB_VISUAL_CLASS_TRUE_COLOR) ||
else if ((vis->_class == XCB_VISUAL_CLASS_TRUE_COLOR) ||
(vis->_class == XCB_VISUAL_CLASS_DIRECT_COLOR))
{
if ((vis->red_mask == 0x00ff0000) &&
if ((vis->red_mask == 0x00ff0000) &&
(vis->green_mask == 0x0000ff00) &&
(vis->blue_mask == 0x000000ff))
(vis->blue_mask == 0x000000ff))
mode = argbx888;
else if ((vis->red_mask == 0x000000ff) &&
else if ((vis->red_mask == 0x000000ff) &&
(vis->green_mask == 0x0000ff00) &&
(vis->blue_mask == 0x00ff0000))
(vis->blue_mask == 0x00ff0000))
mode = abgrx888;
else if ((vis->red_mask == 0xff000000) &&
else if ((vis->red_mask == 0xff000000) &&
(vis->green_mask == 0x00ff0000) &&
(vis->blue_mask == 0x0000ff00))
(vis->blue_mask == 0x0000ff00))
mode = rgba888x;
else if ((vis->red_mask == 0x0000ff00) &&
else if ((vis->red_mask == 0x0000ff00) &&
(vis->green_mask == 0x00ff0000) &&
(vis->blue_mask == 0xff000000))
(vis->blue_mask == 0xff000000))
mode = bgra888x;
else if ((vis->red_mask == 0x0003f000) &&
else if ((vis->red_mask == 0x0003f000) &&
(vis->green_mask == 0x00000fc0) &&
(vis->blue_mask == 0x0000003f))
(vis->blue_mask == 0x0000003f))
mode = argbx666;
else if ((vis->red_mask == 0x0000f800) &&
else if ((vis->red_mask == 0x0000f800) &&
(vis->green_mask == 0x000007e0) &&
(vis->blue_mask == 0x0000001f))
(vis->blue_mask == 0x0000001f))
mode = rgb565;
else if ((vis->red_mask == 0x0000001f) &&
else if ((vis->red_mask == 0x0000001f) &&
(vis->green_mask == 0x000007e0) &&
(vis->blue_mask == 0x0000f800))
(vis->blue_mask == 0x0000f800))
mode = bgr565;
else if ((vis->red_mask == 0x00007c00) &&
else if ((vis->red_mask == 0x00007c00) &&
(vis->green_mask == 0x000003e0) &&
(vis->blue_mask == 0x0000001f))
(vis->blue_mask == 0x0000001f))
mode = rgbx555;
else
return EINA_FALSE;
@ -356,13 +389,13 @@ ecore_x_image_to_argb_convert(void *src, int sbpp, int sbpl, Ecore_X_Colormap c,
unsigned short *s16;
unsigned int *s32, *dp, *de;
dp = ((unsigned int *)(((unsigned char *)dst) +
dp = ((unsigned int *)(((unsigned char *)dst) +
((dy + row) * dbpl))) + dx;
de = dp + w;
switch (sbpp)
{
case 8:
s8 = ((unsigned char *)(((unsigned char *)src) +
s8 = ((unsigned char *)(((unsigned char *)src) +
((y + row) * sbpl))) + x;
if (nret > 0)
{
@ -375,8 +408,9 @@ ecore_x_image_to_argb_convert(void *src, int sbpp, int sbpl, Ecore_X_Colormap c,
else
return EINA_FALSE;
break;
case 16:
s16 = ((unsigned short *)(((unsigned char *)src) +
s16 = ((unsigned short *)(((unsigned char *)src) +
((y + row) * sbpl))) + x;
switch (mode)
{
@ -393,6 +427,7 @@ ecore_x_image_to_argb_convert(void *src, int sbpp, int sbpl, Ecore_X_Colormap c,
s16++; dp++;
}
break;
case bgr565:
while (dp < de)
{
@ -406,6 +441,7 @@ ecore_x_image_to_argb_convert(void *src, int sbpp, int sbpl, Ecore_X_Colormap c,
s16++; dp++;
}
break;
case rgbx555:
while (dp < de)
{
@ -419,14 +455,16 @@ ecore_x_image_to_argb_convert(void *src, int sbpp, int sbpl, Ecore_X_Colormap c,
s16++; dp++;
}
break;
default:
return EINA_FALSE;
break;
}
break;
case 24:
case 32:
s32 = ((unsigned int *)(((unsigned char *)src) +
s32 = ((unsigned int *)(((unsigned char *)src) +
((y + row) * sbpl))) + x;
switch (mode)
{
@ -437,6 +475,7 @@ ecore_x_image_to_argb_convert(void *src, int sbpp, int sbpl, Ecore_X_Colormap c,
s32++; dp++;
}
break;
case abgrx888:
while (dp < de)
{
@ -447,6 +486,7 @@ ecore_x_image_to_argb_convert(void *src, int sbpp, int sbpl, Ecore_X_Colormap c,
s32++; dp++;
}
break;
case rgba888x:
while (dp < de)
{
@ -454,6 +494,7 @@ ecore_x_image_to_argb_convert(void *src, int sbpp, int sbpl, Ecore_X_Colormap c,
s32++; dp++;
}
break;
case bgra888x:
while (dp < de)
{
@ -464,6 +505,7 @@ ecore_x_image_to_argb_convert(void *src, int sbpp, int sbpl, Ecore_X_Colormap c,
s32++; dp++;
}
break;
case argbx666:
while (dp < de)
{
@ -477,12 +519,14 @@ ecore_x_image_to_argb_convert(void *src, int sbpp, int sbpl, Ecore_X_Colormap c,
s32++; dp++;
}
break;
default:
return EINA_FALSE;
break;
}
break;
break;
default:
return EINA_FALSE;
break;
@ -492,107 +536,107 @@ ecore_x_image_to_argb_convert(void *src, int sbpp, int sbpl, Ecore_X_Colormap c,
}
/* local functions */
static void
_ecore_xcb_image_shm_check(void)
static void
_ecore_xcb_image_shm_check(void)
{
// xcb_shm_query_version_reply_t *reply;
xcb_shm_segment_info_t shminfo;
xcb_shm_get_image_cookie_t cookie;
xcb_shm_get_image_reply_t *ireply;
xcb_image_t *img = 0;
uint8_t depth = 0;
xcb_shm_segment_info_t shminfo;
xcb_shm_get_image_cookie_t cookie;
xcb_shm_get_image_reply_t *ireply;
xcb_image_t *img = 0;
uint8_t depth = 0;
if (_ecore_xcb_image_shm_can != -1) return;
CHECK_XCB_CONN;
if (_ecore_xcb_image_shm_can != -1) return;
CHECK_XCB_CONN;
/* reply = */
/* xcb_shm_query_version_reply(_ecore_xcb_conn, */
/* xcb_shm_query_version(_ecore_xcb_conn), NULL); */
/* if (!reply) */
/* { */
/* _ecore_xcb_image_shm_can = 0; */
/* return; */
/* } */
/* reply = */
/* xcb_shm_query_version_reply(_ecore_xcb_conn, */
/* xcb_shm_query_version(_ecore_xcb_conn), NULL); */
/* if (!reply) */
/* { */
/* _ecore_xcb_image_shm_can = 0; */
/* return; */
/* } */
/* if ((reply->major_version < 1) || */
/* ((reply->major_version == 1) && (reply->minor_version == 0))) */
/* { */
/* _ecore_xcb_image_shm_can = 0; */
/* free(reply); */
/* return; */
/* } */
/* if ((reply->major_version < 1) || */
/* ((reply->major_version == 1) && (reply->minor_version == 0))) */
/* { */
/* _ecore_xcb_image_shm_can = 0; */
/* free(reply); */
/* return; */
/* } */
/* free(reply); */
/* free(reply); */
depth = ((xcb_screen_t *)_ecore_xcb_screen)->root_depth;
depth = ((xcb_screen_t *)_ecore_xcb_screen)->root_depth;
ecore_x_sync(); // needed
ecore_x_sync(); // needed
img = _ecore_xcb_image_create_native(1, 1, XCB_IMAGE_FORMAT_Z_PIXMAP,
depth, NULL, ~0, NULL);
if (!img)
{
_ecore_xcb_image_shm_can = 0;
return;
}
img = _ecore_xcb_image_create_native(1, 1, XCB_IMAGE_FORMAT_Z_PIXMAP,
depth, NULL, ~0, NULL);
if (!img)
{
_ecore_xcb_image_shm_can = 0;
return;
}
shminfo.shmid =
shmget(IPC_PRIVATE, img->stride * img->height, (IPC_CREAT | 0666));
if (shminfo.shmid == (uint32_t)-1)
{
xcb_image_destroy(img);
_ecore_xcb_image_shm_can = 0;
return;
}
shminfo.shmid =
shmget(IPC_PRIVATE, img->stride * img->height, (IPC_CREAT | 0666));
if (shminfo.shmid == (uint32_t)-1)
{
xcb_image_destroy(img);
_ecore_xcb_image_shm_can = 0;
return;
}
shminfo.shmaddr = shmat(shminfo.shmid, 0, 0);
img->data = shminfo.shmaddr;
if (img->data == (uint8_t *)-1)
{
xcb_image_destroy(img);
_ecore_xcb_image_shm_can = 0;
return;
}
shminfo.shmaddr = shmat(shminfo.shmid, 0, 0);
img->data = shminfo.shmaddr;
if (img->data == (uint8_t *)-1)
{
xcb_image_destroy(img);
_ecore_xcb_image_shm_can = 0;
return;
}
shminfo.shmseg = xcb_generate_id(_ecore_xcb_conn);
xcb_shm_attach(_ecore_xcb_conn, shminfo.shmseg, shminfo.shmid, 0);
shminfo.shmseg = xcb_generate_id(_ecore_xcb_conn);
xcb_shm_attach(_ecore_xcb_conn, shminfo.shmseg, shminfo.shmid, 0);
cookie =
xcb_shm_get_image(_ecore_xcb_conn,
((xcb_screen_t *)_ecore_xcb_screen)->root,
0, 0, img->width, img->height,
0xffffffff, img->format,
shminfo.shmseg, img->data - shminfo.shmaddr);
cookie =
xcb_shm_get_image(_ecore_xcb_conn,
((xcb_screen_t *)_ecore_xcb_screen)->root,
0, 0, img->width, img->height,
0xffffffff, img->format,
shminfo.shmseg, img->data - shminfo.shmaddr);
ecore_x_sync(); // needed
ecore_x_sync(); // needed
ireply = xcb_shm_get_image_reply(_ecore_xcb_conn, cookie, NULL);
if (ireply)
{
_ecore_xcb_image_shm_can = 1;
free(ireply);
}
else
_ecore_xcb_image_shm_can = 0;
ireply = xcb_shm_get_image_reply(_ecore_xcb_conn, cookie, NULL);
if (ireply)
{
_ecore_xcb_image_shm_can = 1;
free(ireply);
}
else
_ecore_xcb_image_shm_can = 0;
xcb_shm_detach(_ecore_xcb_conn, shminfo.shmseg);
xcb_image_destroy(img);
shmdt(shminfo.shmaddr);
shmctl(shminfo.shmid, IPC_RMID, 0);
xcb_shm_detach(_ecore_xcb_conn, shminfo.shmseg);
xcb_image_destroy(img);
shmdt(shminfo.shmaddr);
shmctl(shminfo.shmid, IPC_RMID, 0);
}
static void
_ecore_xcb_image_shm_create(Ecore_X_Image *im)
static void
_ecore_xcb_image_shm_create(Ecore_X_Image *im)
{
CHECK_XCB_CONN;
im->xim =
_ecore_xcb_image_create_native(im->w, im->h, XCB_IMAGE_FORMAT_Z_PIXMAP,
im->xim =
_ecore_xcb_image_create_native(im->w, im->h, XCB_IMAGE_FORMAT_Z_PIXMAP,
im->depth, NULL, ~0, NULL);
if (!im->xim) return;
im->shminfo.shmid = shmget(IPC_PRIVATE, im->xim->size, (IPC_CREAT | 0666));
if (im->shminfo.shmid == (uint32_t)-1)
if (im->shminfo.shmid == (uint32_t)-1)
{
xcb_image_destroy(im->xim);
return;
@ -624,7 +668,13 @@ _ecore_xcb_image_shm_create(Ecore_X_Image *im)
}
xcb_image_t *
_ecore_xcb_image_create_native(int w, int h, xcb_image_format_t format, uint8_t depth, void *base, uint32_t bytes, uint8_t *data)
_ecore_xcb_image_create_native(int w,
int h,
xcb_image_format_t format,
uint8_t depth,
void *base,
uint32_t bytes,
uint8_t *data)
{
static uint8_t dpth = 0;
static xcb_format_t *fmt = NULL;
@ -633,8 +683,8 @@ _ecore_xcb_image_create_native(int w, int h, xcb_image_format_t format, uint8_t
CHECK_XCB_CONN;
/* NB: We cannot use xcb_image_create_native as it only creates images
* using MSB_FIRST, so this routine recreates that function and uses
/* NB: We cannot use xcb_image_create_native as it only creates images
* using MSB_FIRST, so this routine recreates that function and uses
* the endian-ness of the server setup */
setup = xcb_get_setup(_ecore_xcb_conn);
xif = format;
@ -642,26 +692,28 @@ _ecore_xcb_image_create_native(int w, int h, xcb_image_format_t format, uint8_t
if ((xif == XCB_IMAGE_FORMAT_Z_PIXMAP) && (depth == 1))
xif = XCB_IMAGE_FORMAT_XY_PIXMAP;
if (dpth != depth)
if (dpth != depth)
{
dpth = depth;
fmt = _ecore_xcb_image_find_format(setup, depth);
if (!fmt) return 0;
}
switch (xif)
switch (xif)
{
case XCB_IMAGE_FORMAT_XY_BITMAP:
if (depth != 1) return 0;
case XCB_IMAGE_FORMAT_XY_PIXMAP:
case XCB_IMAGE_FORMAT_Z_PIXMAP:
return xcb_image_create(w, h, xif,
fmt->scanline_pad,
fmt->depth, fmt->bits_per_pixel,
setup->bitmap_format_scanline_unit,
setup->image_byte_order,
setup->bitmap_format_bit_order,
return xcb_image_create(w, h, xif,
fmt->scanline_pad,
fmt->depth, fmt->bits_per_pixel,
setup->bitmap_format_scanline_unit,
setup->image_byte_order,
setup->bitmap_format_bit_order,
base, bytes, data);
default:
break;
}
@ -670,7 +722,8 @@ _ecore_xcb_image_create_native(int w, int h, xcb_image_format_t format, uint8_t
}
static xcb_format_t *
_ecore_xcb_image_find_format(const xcb_setup_t *setup, uint8_t depth)
_ecore_xcb_image_find_format(const xcb_setup_t *setup,
uint8_t depth)
{
xcb_format_t *fmt, *fmtend;
@ -679,8 +732,9 @@ _ecore_xcb_image_find_format(const xcb_setup_t *setup, uint8_t depth)
fmt = xcb_setup_pixmap_formats(setup);
fmtend = fmt + xcb_setup_pixmap_formats_length(setup);
for (; fmt != fmtend; ++fmt)
if (fmt->depth == depth)
if (fmt->depth == depth)
return fmt;
return 0;
}

View File

@ -27,8 +27,8 @@ static Eina_Bool _input_avail = EINA_FALSE;
/* external variables */
int _ecore_xcb_event_input = 0;
void
_ecore_xcb_input_init(void)
void
_ecore_xcb_input_init(void)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
@ -37,8 +37,8 @@ _ecore_xcb_input_init(void)
#endif
}
void
_ecore_xcb_input_finalize(void)
void
_ecore_xcb_input_finalize(void)
{
#ifdef ECORE_XCB_XINPUT
xcb_input_get_extension_version_cookie_t cookie;
@ -49,38 +49,38 @@ _ecore_xcb_input_finalize(void)
LOGFN(__FILE__, __LINE__, __FUNCTION__);
#ifdef ECORE_XCB_XINPUT
cookie =
cookie =
xcb_input_get_extension_version_unchecked(_ecore_xcb_conn, 127, buff);
reply =
reply =
xcb_input_get_extension_version_reply(_ecore_xcb_conn, cookie, NULL);
if (reply)
if (reply)
{
_input_avail = EINA_TRUE;
free(reply);
}
if (_input_avail)
if (_input_avail)
{
const xcb_query_extension_reply_t *ext_reply;
ext_reply = xcb_get_extension_data(_ecore_xcb_conn, &xcb_input_id);
if (ext_reply)
if (ext_reply)
_ecore_xcb_event_input = ext_reply->first_event;
}
#endif
}
void
_ecore_xcb_input_shutdown(void)
void
_ecore_xcb_input_shutdown(void)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
}
void
void
#ifdef ECORE_XCB_XINPUT
_ecore_xcb_input_handle_event(xcb_generic_event_t *event)
_ecore_xcb_input_handle_event(xcb_generic_event_t *event)
#else
_ecore_xcb_input_handle_event(xcb_generic_event_t *event __UNUSED__)
_ecore_xcb_input_handle_event(xcb_generic_event_t * event __UNUSED__)
#endif
{
#ifdef ECORE_XCB_XINPUT
@ -94,120 +94,126 @@ _ecore_xcb_input_handle_event(xcb_generic_event_t *event __UNUSED__)
* xcb-input lib to test with */
#ifdef ECORE_XCB_XINPUT
ev = (xcb_ge_event_t *)event;
switch (ev->event_type)
switch (ev->event_type)
{
case XCB_INPUT_DEVICE_MOTION_NOTIFY:
{
xcb_input_device_motion_notify_event_t *de;
unsigned int child_win = 0;
case XCB_INPUT_DEVICE_MOTION_NOTIFY:
{
xcb_input_device_motion_notify_event_t *de;
unsigned int child_win = 0;
de = (xcb_input_device_motion_notify_event_t *)ev->pad1;
child_win = (de->child ? de->child : de->event);
_ecore_xcb_event_mouse_move(de->time, de->state, de->event_x,
de->event_y, de->root_x, de->root_y,
de->event, child_win, de->root,
de->same_screen, de->device_id,
1, 1, 1.0, 0.0,
de->event_x, de->event_y,
de->root_x, de->root_y);
}
break;
case XCB_INPUT_DEVICE_BUTTON_PRESS:
{
xcb_input_device_button_press_event_t *de;
unsigned int child_win = 0;
de = (xcb_input_device_motion_notify_event_t *)ev->pad1;
child_win = (de->child ? de->child : de->event);
_ecore_xcb_event_mouse_move(de->time, de->state, de->event_x,
de->event_y, de->root_x, de->root_y,
de->event, child_win, de->root,
de->same_screen, de->device_id,
1, 1, 1.0, 0.0,
de->event_x, de->event_y,
de->root_x, de->root_y);
}
break;
de = (xcb_input_device_button_press_event_t *)ev->pad1;
child_win = (de->child ? de->child : de->event);
_ecore_xcb_event_mouse_button(ECORE_EVENT_MOUSE_BUTTON_DOWN,
de->time, de->state, de->detail,
de->event_x, de->event_y,
de->root_x, de->root_y, de->event,
child_win, de->root,
de->same_screen, de->device_id,
1, 1, 1.0, 0.0,
de->event_x, de->event_y,
de->root_x, de->root_y);
}
break;
case XCB_INPUT_DEVICE_BUTTON_RELEASE:
{
xcb_input_device_button_release_event_t *de;
unsigned int child_win = 0;
case XCB_INPUT_DEVICE_BUTTON_PRESS:
{
xcb_input_device_button_press_event_t *de;
unsigned int child_win = 0;
de = (xcb_input_device_button_press_event_t *)ev->pad1;
child_win = (de->child ? de->child : de->event);
_ecore_xcb_event_mouse_button(ECORE_EVENT_MOUSE_BUTTON_DOWN,
de->time, de->state, de->detail,
de->event_x, de->event_y,
de->root_x, de->root_y, de->event,
child_win, de->root,
de->same_screen, de->device_id,
1, 1, 1.0, 0.0,
de->event_x, de->event_y,
de->root_x, de->root_y);
}
break;
case XCB_INPUT_DEVICE_BUTTON_RELEASE:
{
xcb_input_device_button_release_event_t *de;
unsigned int child_win = 0;
de = (xcb_input_device_button_release_event_t *)ev->pad1;
child_win = (de->child ? de->child : de->event);
_ecore_xcb_event_mouse_button(ECORE_EVENT_MOUSE_BUTTON_UP,
de->time, de->state, de->detail,
de->event_x, de->event_y,
de->root_x, de->root_y, de->event,
child_win, de->root,
de->same_screen, de->device_id,
1, 1, 1.0, 0.0,
de->event_x, de->event_y,
de->root_x, de->root_y);
}
break;
de = (xcb_input_device_button_release_event_t *)ev->pad1;
child_win = (de->child ? de->child : de->event);
_ecore_xcb_event_mouse_button(ECORE_EVENT_MOUSE_BUTTON_UP,
de->time, de->state, de->detail,
de->event_x, de->event_y,
de->root_x, de->root_y, de->event,
child_win, de->root,
de->same_screen, de->device_id,
1, 1, 1.0, 0.0,
de->event_x, de->event_y,
de->root_x, de->root_y);
}
break;
case XCB_INPUT_DEVICE_TOUCH_UPDATE:
{
xcb_input_device_motion_notify_event_t *de;
unsigned int child_win = 0;
{
xcb_input_device_motion_notify_event_t *de;
unsigned int child_win = 0;
de = (xcb_input_device_motion_notify_event_t *)ev->pad1;
child_win = (de->child ? de->child : de->event);
_ecore_xcb_event_mouse_move(de->time, de->state, de->event_x,
de->event_y, de->root_x, de->root_y,
de->event, child_win, de->root,
de->same_screen, de->device_id,
1, 1, 1.0, 0.0,
de->event_x, de->event_y,
de->root_x, de->root_y);
}
break;
de = (xcb_input_device_motion_notify_event_t *)ev->pad1;
child_win = (de->child ? de->child : de->event);
_ecore_xcb_event_mouse_move(de->time, de->state, de->event_x,
de->event_y, de->root_x, de->root_y,
de->event, child_win, de->root,
de->same_screen, de->device_id,
1, 1, 1.0, 0.0,
de->event_x, de->event_y,
de->root_x, de->root_y);
}
break;
case XCB_INPUT_DEVICE_TOUCH_BEGIN:
{
xcb_input_device_button_press_event_t *de;
unsigned int child_win = 0;
{
xcb_input_device_button_press_event_t *de;
unsigned int child_win = 0;
de = (xcb_input_device_button_press_event_t *)ev->pad1;
child_win = (de->child ? de->child : de->event);
_ecore_xcb_event_mouse_button(ECORE_EVENT_MOUSE_BUTTON_DOWN,
de->time, de->state, de->detail,
de->event_x, de->event_y,
de->root_x, de->root_y, de->event,
child_win, de->root,
de->same_screen, de->device_id,
1, 1, 1.0, 0.0,
de->event_x, de->event_y,
de->root_x, de->root_y);
}
break;
de = (xcb_input_device_button_press_event_t *)ev->pad1;
child_win = (de->child ? de->child : de->event);
_ecore_xcb_event_mouse_button(ECORE_EVENT_MOUSE_BUTTON_DOWN,
de->time, de->state, de->detail,
de->event_x, de->event_y,
de->root_x, de->root_y, de->event,
child_win, de->root,
de->same_screen, de->device_id,
1, 1, 1.0, 0.0,
de->event_x, de->event_y,
de->root_x, de->root_y);
}
break;
case XCB_INPUT_DEVICE_TOUCH_END:
{
xcb_input_device_button_release_event_t *de;
unsigned int child_win = 0;
{
xcb_input_device_button_release_event_t *de;
unsigned int child_win = 0;
de = (xcb_input_device_button_release_event_t *)ev->pad1;
child_win = (de->child ? de->child : de->event);
_ecore_xcb_event_mouse_button(ECORE_EVENT_MOUSE_BUTTON_UP,
de->time, de->state, de->detail,
de->event_x, de->event_y,
de->root_x, de->root_y, de->event,
child_win, de->root,
de->same_screen, de->device_id,
1, 1, 1.0, 0.0,
de->event_x, de->event_y,
de->root_x, de->root_y);
}
break;
de = (xcb_input_device_button_release_event_t *)ev->pad1;
child_win = (de->child ? de->child : de->event);
_ecore_xcb_event_mouse_button(ECORE_EVENT_MOUSE_BUTTON_UP,
de->time, de->state, de->detail,
de->event_x, de->event_y,
de->root_x, de->root_y, de->event,
child_win, de->root,
de->same_screen, de->device_id,
1, 1, 1.0, 0.0,
de->event_x, de->event_y,
de->root_x, de->root_y);
}
break;
default:
break;
}
#endif
}
EAPI Eina_Bool
ecore_x_input_multi_select(Ecore_X_Window win)
EAPI Eina_Bool
ecore_x_input_multi_select(Ecore_X_Window win)
{
Eina_Bool find = EINA_FALSE;
#ifdef ECORE_XCB_XINPUT
@ -226,33 +232,33 @@ ecore_x_input_multi_select(Ecore_X_Window win)
* when we can */
#ifdef ECORE_XCB_XINPUT
dcookie = xcb_input_list_input_devices_unchecked(_ecore_xcb_conn);
dreply =
dreply =
xcb_input_list_input_devices_reply(_ecore_xcb_conn, dcookie, NULL);
if (!dreply) return EINA_FALSE;
diter = xcb_input_list_input_devices_devices_iterator(dreply);
while (diter.rem)
while (diter.rem)
{
xcb_input_device_info_t *dev;
const xcb_input_event_class_t iclass[] =
{
XCB_INPUT_DEVICE_BUTTON_PRESS,
XCB_INPUT_DEVICE_BUTTON_RELEASE,
XCB_INPUT_DEVICE_MOTION_NOTIFY,
XCB_INPUT_DEVICE_TOUCH_BEGIN,
XCB_INPUT_DEVICE_TOUCH_END,
XCB_INPUT_DEVICE_TOUCH_UPDATE
};
const xcb_input_event_class_t iclass[] =
{
XCB_INPUT_DEVICE_BUTTON_PRESS,
XCB_INPUT_DEVICE_BUTTON_RELEASE,
XCB_INPUT_DEVICE_MOTION_NOTIFY,
XCB_INPUT_DEVICE_TOUCH_BEGIN,
XCB_INPUT_DEVICE_TOUCH_END,
XCB_INPUT_DEVICE_TOUCH_UPDATE
};
dev = diter.data;
if (dev->device_use == XCB_INPUT_DEVICE_USE_IS_X_EXTENSION_DEVICE)
if (dev->device_use == XCB_INPUT_DEVICE_USE_IS_X_EXTENSION_DEVICE)
{
DBG("Device %d", dev->device_id);
DBG("\tType: %d", dev->device_type);
DBG("\tNum Classes: %d", dev->num_class_info);
DBG("\tUse: %d", dev->device_use);
xcb_input_select_extension_event(_ecore_xcb_conn, win,
xcb_input_select_extension_event(_ecore_xcb_conn, win,
sizeof(iclass) / sizeof(xcb_input_event_class_t),
iclass);
find = EINA_TRUE;
@ -265,3 +271,4 @@ ecore_x_input_multi_select(Ecore_X_Window win)
return find;
win = 0;
}

View File

@ -6,10 +6,17 @@
#include <X11/keysym.h>
/* local function prototypes */
static int _ecore_xcb_keymap_mask_get(void *reply, xcb_keysym_t sym);
static int _ecore_xcb_keymap_mask_get(void *reply,
xcb_keysym_t sym);
static xcb_keysym_t _ecore_xcb_keymap_string_to_keysym(const char *str);
static int _ecore_xcb_keymap_translate_key(xcb_keycode_t keycode, unsigned int modifiers, unsigned int *modifiers_return, xcb_keysym_t *keysym_return);
static int _ecore_xcb_keymap_translate_keysym(xcb_keysym_t keysym, unsigned int modifiers, char *buffer, int bytes);
static int _ecore_xcb_keymap_translate_key(xcb_keycode_t keycode,
unsigned int modifiers,
unsigned int *modifiers_return,
xcb_keysym_t *keysym_return);
static int _ecore_xcb_keymap_translate_keysym(xcb_keysym_t keysym,
unsigned int modifiers,
char *buffer,
int bytes);
/* local variables */
static xcb_key_symbols_t *_ecore_xcb_keysyms;
@ -25,16 +32,16 @@ EAPI int ECORE_X_LOCK_NUM = 0;
EAPI int ECORE_X_LOCK_CAPS = 0;
EAPI int ECORE_X_LOCK_SHIFT = 0;
void
_ecore_xcb_keymap_init(void)
void
_ecore_xcb_keymap_init(void)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
_ecore_xcb_keysyms = xcb_key_symbols_alloc(_ecore_xcb_conn);
}
void
_ecore_xcb_keymap_finalize(void)
void
_ecore_xcb_keymap_finalize(void)
{
xcb_get_modifier_mapping_cookie_t cookie;
xcb_get_modifier_mapping_reply_t *reply;
@ -84,33 +91,34 @@ _ecore_xcb_modifiers_get(void)
_ecore_xcb_keymap_finalize();
}
void
_ecore_xcb_keymap_shutdown(void)
void
_ecore_xcb_keymap_shutdown(void)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
if (_ecore_xcb_keysyms) xcb_key_symbols_free(_ecore_xcb_keysyms);
}
void
_ecore_xcb_keymap_refresh(xcb_mapping_notify_event_t *event)
void
_ecore_xcb_keymap_refresh(xcb_mapping_notify_event_t *event)
{
CHECK_XCB_CONN;
xcb_refresh_keyboard_mapping(_ecore_xcb_keysyms, event);
}
xcb_keysym_t
_ecore_xcb_keymap_keycode_to_keysym(xcb_keycode_t keycode, int col)
xcb_keysym_t
_ecore_xcb_keymap_keycode_to_keysym(xcb_keycode_t keycode,
int col)
{
xcb_keysym_t key0, key1;
CHECK_XCB_CONN;
if (col & _ecore_xcb_mode_switch)
if (col & _ecore_xcb_mode_switch)
{
key0 = xcb_key_symbols_get_keysym(_ecore_xcb_keysyms, keycode, 4);
key1 = xcb_key_symbols_get_keysym(_ecore_xcb_keysyms, keycode, 5);
}
else
else
{
key0 = xcb_key_symbols_get_keysym(_ecore_xcb_keysyms, keycode, 0);
key1 = xcb_key_symbols_get_keysym(_ecore_xcb_keysyms, keycode, 1);
@ -119,24 +127,24 @@ _ecore_xcb_keymap_keycode_to_keysym(xcb_keycode_t keycode, int col)
if (key1 == XCB_NO_SYMBOL)
key1 = key0;
if ((col & ECORE_X_LOCK_NUM) &&
if ((col & ECORE_X_LOCK_NUM) &&
((xcb_is_keypad_key(key1)) || (xcb_is_private_keypad_key(key1))))
{
if ((col & XCB_MOD_MASK_SHIFT) ||
if ((col & XCB_MOD_MASK_SHIFT) ||
((col & XCB_MOD_MASK_LOCK) && (col & ECORE_X_LOCK_SHIFT)))
return key0;
else
return key1;
}
else if (!(col & XCB_MOD_MASK_SHIFT) && !(col & XCB_MOD_MASK_LOCK))
else if (!(col & XCB_MOD_MASK_SHIFT) && !(col & XCB_MOD_MASK_LOCK))
return key0;
else if (!(col & XCB_MOD_MASK_SHIFT) &&
else if (!(col & XCB_MOD_MASK_SHIFT) &&
(col & XCB_MOD_MASK_LOCK && (col & ECORE_X_LOCK_CAPS)))
return key1;
else if ((col & XCB_MOD_MASK_SHIFT) &&
else if ((col & XCB_MOD_MASK_SHIFT) &&
(col & XCB_MOD_MASK_LOCK) && (col & ECORE_X_LOCK_CAPS))
return key0;
else if ((col & XCB_MOD_MASK_SHIFT) ||
else if ((col & XCB_MOD_MASK_SHIFT) ||
(col & XCB_MOD_MASK_LOCK && (col & ECORE_X_LOCK_SHIFT)))
return key1;
@ -144,14 +152,14 @@ _ecore_xcb_keymap_keycode_to_keysym(xcb_keycode_t keycode, int col)
}
xcb_keycode_t *
_ecore_xcb_keymap_keysym_to_keycode(xcb_keysym_t keysym)
_ecore_xcb_keymap_keysym_to_keycode(xcb_keysym_t keysym)
{
CHECK_XCB_CONN;
return xcb_key_symbols_get_keycode(_ecore_xcb_keysyms, keysym);
}
char *
_ecore_xcb_keymap_keysym_to_string(xcb_keysym_t keysym)
_ecore_xcb_keymap_keysym_to_string(xcb_keysym_t keysym)
{
int i = 0, n = 0, h = 0, idx = 0;
const unsigned char *entry;
@ -160,7 +168,7 @@ _ecore_xcb_keymap_keysym_to_string(xcb_keysym_t keysym)
CHECK_XCB_CONN;
if (!keysym) return NULL;
if (keysym == XK_VoidSymbol) keysym = 0;
if (keysym <= 0x1fffffff)
if (keysym <= 0x1fffffff)
{
val1 = (keysym >> 24);
val2 = ((keysym >> 16) & 0xff);
@ -169,26 +177,26 @@ _ecore_xcb_keymap_keysym_to_string(xcb_keysym_t keysym)
i = keysym % VTABLESIZE;
h = i + 1;
n = VMAXHASH;
while ((idx = hashKeysym[i]))
while ((idx = hashKeysym[i]))
{
entry = &_ecore_xcb_keytable[idx];
if ((entry[0] == val1) && (entry[1] == val2) &&
if ((entry[0] == val1) && (entry[1] == val2) &&
(entry[2] == val3) && (entry[3] == val4))
return ((char *)entry + 4);
return (char *)entry + 4;
if (!--n) break;
i += h;
if (i >= VTABLESIZE) i -= VTABLESIZE;
}
}
if ((keysym >= 0x01000100) && (keysym <= 0x0110ffff))
if ((keysym >= 0x01000100) && (keysym <= 0x0110ffff))
{
xcb_keysym_t val;
char *s = NULL;
int i = 0;
val = (keysym & 0xffffff);
if (val & 0xff0000)
if (val & 0xff0000)
i = 10;
else
i = 6;
@ -196,7 +204,7 @@ _ecore_xcb_keymap_keysym_to_string(xcb_keysym_t keysym)
if (!(s = malloc(i))) return NULL;
i--;
s[i--] = '\0';
for (; i; i--)
for (; i; i--)
{
val1 = (val & 0xf);
val >>= 4;
@ -212,12 +220,12 @@ _ecore_xcb_keymap_keysym_to_string(xcb_keysym_t keysym)
return NULL;
}
xcb_keycode_t
_ecore_xcb_keymap_string_to_keycode(const char *key)
xcb_keycode_t
_ecore_xcb_keymap_string_to_keycode(const char *key)
{
if (!strncmp(key, "Keycode-", 8))
return atoi(key + 8);
else
else
{
xcb_keysym_t keysym = XCB_NO_SYMBOL;
xcb_keycode_t *keycodes, keycode = 0;
@ -231,9 +239,9 @@ _ecore_xcb_keymap_string_to_keycode(const char *key)
keycodes = _ecore_xcb_keymap_keysym_to_keycode(keysym);
if (!keycodes) return XCB_NO_SYMBOL;
while (keycodes[i] != XCB_NO_SYMBOL)
while (keycodes[i] != XCB_NO_SYMBOL)
{
if (keycodes[i] != 0)
if (keycodes[i] != 0)
{
keycode = keycodes[i];
break;
@ -244,8 +252,12 @@ _ecore_xcb_keymap_string_to_keycode(const char *key)
}
}
int
_ecore_xcb_keymap_lookup_string(xcb_keycode_t keycode, int state, char *buffer, int bytes, xcb_keysym_t *sym)
int
_ecore_xcb_keymap_lookup_string(xcb_keycode_t keycode,
int state,
char *buffer,
int bytes,
xcb_keysym_t *sym)
{
unsigned int modifiers = 0;
xcb_keysym_t keysym;
@ -260,7 +272,7 @@ _ecore_xcb_keymap_lookup_string(xcb_keycode_t keycode, int state, char *buffer,
}
EAPI const char *
ecore_x_keysym_string_get(int keysym)
ecore_x_keysym_string_get(int keysym)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
@ -268,18 +280,19 @@ ecore_x_keysym_string_get(int keysym)
}
/* local functions */
static int
_ecore_xcb_keymap_mask_get(void *reply, xcb_keysym_t sym)
static int
_ecore_xcb_keymap_mask_get(void *reply,
xcb_keysym_t sym)
{
xcb_get_modifier_mapping_reply_t *rep;
xcb_keysym_t sym2;
int mask = 0;
const int masks[8] =
{
XCB_MOD_MASK_SHIFT, XCB_MOD_MASK_LOCK, XCB_MOD_MASK_CONTROL,
XCB_MOD_MASK_1, XCB_MOD_MASK_2, XCB_MOD_MASK_3, XCB_MOD_MASK_4,
XCB_MOD_MASK_5
};
const int masks[8] =
{
XCB_MOD_MASK_SHIFT, XCB_MOD_MASK_LOCK, XCB_MOD_MASK_CONTROL,
XCB_MOD_MASK_1, XCB_MOD_MASK_2, XCB_MOD_MASK_3, XCB_MOD_MASK_4,
XCB_MOD_MASK_5
};
LOGFN(__FILE__, __LINE__, __FUNCTION__);
CHECK_XCB_CONN;
@ -291,18 +304,18 @@ _ecore_xcb_keymap_mask_get(void *reply, xcb_keysym_t sym)
xcb_keycode_t *modmap;
modmap = xcb_get_modifier_mapping_keycodes(rep);
for (i = 0; i < (8 * rep->keycodes_per_modifier); i++)
for (i = 0; i < (8 * rep->keycodes_per_modifier); i++)
{
int j = 0;
for (j = 0; j < 8; j++)
for (j = 0; j < 8; j++)
{
sym2 =
xcb_key_symbols_get_keysym(_ecore_xcb_keysyms,
sym2 =
xcb_key_symbols_get_keysym(_ecore_xcb_keysyms,
modmap[i], j);
if (sym2 != 0) break;
}
if (sym2 == sym)
if (sym2 == sym)
{
mask = masks[i / rep->keycodes_per_modifier];
break;
@ -313,8 +326,8 @@ _ecore_xcb_keymap_mask_get(void *reply, xcb_keysym_t sym)
return mask;
}
static xcb_keysym_t
_ecore_xcb_keymap_string_to_keysym(const char *str)
static xcb_keysym_t
_ecore_xcb_keymap_string_to_keysym(const char *str)
{
int i = 0, n = 0, h = 0;
unsigned long sig = 0;
@ -334,26 +347,26 @@ _ecore_xcb_keymap_string_to_keysym(const char *str)
sig2 = sig & 0xff;
n = KMAXHASH;
while ((idx = hashString[i]))
while ((idx = hashString[i]))
{
entry = &_ecore_xcb_keytable[idx];
if ((entry[0] == sig1) && (entry[1] == sig2) &&
if ((entry[0] == sig1) && (entry[1] == sig2) &&
!strcmp(str, (char *)entry + 6))
{
val = ((entry[2] << 24) | (entry[3] << 16) |
val = ((entry[2] << 24) | (entry[3] << 16) |
(entry[4] << 8) | (entry[5]));
if (!val) val = 0xffffff;
return val;
}
if (!--n) break;
i += h;
if (i >= KTABLESIZE) i-= KTABLESIZE;
if (i >= KTABLESIZE) i -= KTABLESIZE;
}
if (*str == 'U')
if (*str == 'U')
{
val = 0;
for (p = &str[1]; *p; p++)
for (p = &str[1]; *p; p++)
{
c = *p;
if (('0' <= c) && (c <= '9'))
@ -369,10 +382,10 @@ _ecore_xcb_keymap_string_to_keysym(const char *str)
if ((val < 0x20) || ((val > 0x7e) && (val < 0xa0)))
return XCB_NO_SYMBOL;
if (val < 0x100) return val;
return (val | 0x01000000);
return val | 0x01000000;
}
if ((strlen(str) > 2) && (str[0] == '0') && (str[1] == 'x'))
if ((strlen(str) > 2) && (str[0] == '0') && (str[1] == 'x'))
{
char *tmp = NULL;
@ -383,7 +396,7 @@ _ecore_xcb_keymap_string_to_keysym(const char *str)
return val;
}
if (!strncmp(str, "XF86_", 5))
if (!strncmp(str, "XF86_", 5))
{
long unsigned int ret;
char *tmp;
@ -399,8 +412,11 @@ _ecore_xcb_keymap_string_to_keysym(const char *str)
return XCB_NO_SYMBOL;
}
static int
_ecore_xcb_keymap_translate_key(xcb_keycode_t keycode, unsigned int modifiers, unsigned int *modifiers_return, xcb_keysym_t *keysym_return)
static int
_ecore_xcb_keymap_translate_key(xcb_keycode_t keycode,
unsigned int modifiers,
unsigned int *modifiers_return,
xcb_keysym_t *keysym_return)
{
xcb_keysym_t sym;
@ -409,7 +425,7 @@ _ecore_xcb_keymap_translate_key(xcb_keycode_t keycode, unsigned int modifiers, u
sym = _ecore_xcb_keymap_keycode_to_keysym(keycode, modifiers);
if (modifiers_return)
*modifiers_return = ((XCB_MOD_MASK_SHIFT | XCB_MOD_MASK_LOCK) |
*modifiers_return = ((XCB_MOD_MASK_SHIFT | XCB_MOD_MASK_LOCK) |
_ecore_xcb_mode_switch | ECORE_X_LOCK_NUM);
if (keysym_return)
*keysym_return = sym;
@ -417,8 +433,11 @@ _ecore_xcb_keymap_translate_key(xcb_keycode_t keycode, unsigned int modifiers, u
return 1;
}
static int
_ecore_xcb_keymap_translate_keysym(xcb_keysym_t keysym, unsigned int modifiers, char *buffer, int bytes)
static int
_ecore_xcb_keymap_translate_keysym(xcb_keysym_t keysym,
unsigned int modifiers,
char *buffer,
int bytes)
{
unsigned long hbytes = 0;
unsigned char c;
@ -427,14 +446,14 @@ _ecore_xcb_keymap_translate_keysym(xcb_keysym_t keysym, unsigned int modifiers,
hbytes = (keysym >> 8);
if (!(bytes &&
((hbytes == 0) ||
((hbytes == 0xFF) &&
(((keysym >= XK_BackSpace) && (keysym <= XK_Clear)) ||
(keysym == XK_Return) || (keysym == XK_Escape) ||
(keysym == XK_KP_Space) || (keysym == XK_KP_Tab) ||
(keysym == XK_KP_Enter) ||
((keysym >= XK_KP_Multiply) && (keysym <= XK_KP_9)) ||
(keysym == XK_KP_Equal) || (keysym == XK_Delete))))))
((hbytes == 0) ||
((hbytes == 0xFF) &&
(((keysym >= XK_BackSpace) && (keysym <= XK_Clear)) ||
(keysym == XK_Return) || (keysym == XK_Escape) ||
(keysym == XK_KP_Space) || (keysym == XK_KP_Tab) ||
(keysym == XK_KP_Enter) ||
((keysym >= XK_KP_Multiply) && (keysym <= XK_KP_9)) ||
(keysym == XK_KP_Equal) || (keysym == XK_Delete))))))
return 0;
if (keysym == XK_KP_Space)
@ -444,19 +463,20 @@ _ecore_xcb_keymap_translate_keysym(xcb_keysym_t keysym, unsigned int modifiers,
else
c = (keysym & 0xFF);
if (modifiers & ECORE_X_MODIFIER_CTRL)
if (modifiers & ECORE_X_MODIFIER_CTRL)
{
if (((c >= '@') && (c < '\177')) || c == ' ')
c &= 0x1F;
else if (c == '2')
else if (c == '2')
c = '\000';
else if ((c >= '3') && (c <= '7'))
c -= ('3' - '\033');
else if (c == '8')
else if (c == '8')
c = '\177';
else if (c == '/')
else if (c == '/')
c = '_' & 0x1F;
}
buffer[0] = c;
return 1;
}

View File

@ -1,17 +1,17 @@
#include "ecore_xcb_private.h"
//#include "Ecore_X_Atoms.h"
#define ECORE_X_MWM_HINTS_FUNCTIONS (1 << 0)
#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_INPUT_MODE (1 << 2)
#define ECORE_X_MWM_HINTS_STATUS (1 << 3)
typedef struct _mwmhints
{
uint32_t flags;
uint32_t functions;
uint32_t decorations;
int32_t inputmode;
int32_t inputmode;
uint32_t status;
} MWMHints;
@ -23,14 +23,15 @@ typedef struct _mwmhints
/**
* Sets the borderless flag of a window using MWM.
*
*
* @param win The window.
* @param borderless The borderless flag.
*
*
* @ingroup Ecore_X_MWM_Group
*/
EAPI void
ecore_x_mwm_borderless_set(Ecore_X_Window win, Eina_Bool borderless)
EAPI void
ecore_x_mwm_borderless_set(Ecore_X_Window win,
Eina_Bool borderless)
{
uint32_t data[5] = { 0, 0, 0, 0, 0 };
@ -39,14 +40,17 @@ ecore_x_mwm_borderless_set(Ecore_X_Window win, Eina_Bool borderless)
data[0] = 2;
data[2] = !borderless;
ecore_x_window_prop_property_set(win,
ECORE_X_ATOM_MOTIF_WM_HINTS,
ECORE_X_ATOM_MOTIF_WM_HINTS, 32,
ecore_x_window_prop_property_set(win,
ECORE_X_ATOM_MOTIF_WM_HINTS,
ECORE_X_ATOM_MOTIF_WM_HINTS, 32,
(void *)data, 5);
}
EAPI Eina_Bool
ecore_x_mwm_hints_get(Ecore_X_Window win, Ecore_X_MWM_Hint_Func *fhint, Ecore_X_MWM_Hint_Decor *dhint, Ecore_X_MWM_Hint_Input *ihint)
EAPI Eina_Bool
ecore_x_mwm_hints_get(Ecore_X_Window win,
Ecore_X_MWM_Hint_Func *fhint,
Ecore_X_MWM_Hint_Decor *dhint,
Ecore_X_MWM_Hint_Input *ihint)
{
xcb_get_property_cookie_t cookie;
xcb_get_property_reply_t *reply;
@ -56,36 +60,36 @@ ecore_x_mwm_hints_get(Ecore_X_Window win, Ecore_X_MWM_Hint_Func *fhint, Ecore_X_
LOGFN(__FILE__, __LINE__, __FUNCTION__);
CHECK_XCB_CONN;
cookie =
xcb_get_property_unchecked(_ecore_xcb_conn, 0, win,
ECORE_X_ATOM_MOTIF_WM_HINTS,
cookie =
xcb_get_property_unchecked(_ecore_xcb_conn, 0, win,
ECORE_X_ATOM_MOTIF_WM_HINTS,
ECORE_X_ATOM_MOTIF_WM_HINTS, 0, LONG_MAX);
reply = xcb_get_property_reply(_ecore_xcb_conn, cookie, NULL);
if (!reply) return EINA_FALSE;
if ((reply->format != 32) || (reply->value_len == 0))
if ((reply->format != 32) || (reply->value_len == 0))
{
free(reply);
return EINA_FALSE;
}
mwmhints = xcb_get_property_value(reply);
if (reply->value_len >= 4)
if (reply->value_len >= 4)
{
if (dhint)
if (dhint)
{
if (mwmhints->flags & ECORE_X_MWM_HINTS_DECORATIONS)
*dhint = mwmhints->decorations;
else
*dhint = ECORE_X_MWM_HINT_DECOR_ALL;
}
if (fhint)
if (fhint)
{
if (mwmhints->flags & ECORE_X_MWM_HINTS_FUNCTIONS)
*fhint = mwmhints->functions;
else
*fhint = ECORE_X_MWM_HINT_FUNC_ALL;
}
if (ihint)
if (ihint)
{
if (mwmhints->flags & ECORE_X_MWM_HINTS_INPUT_MODE)
*ihint = mwmhints->inputmode;
@ -97,3 +101,4 @@ ecore_x_mwm_hints_get(Ecore_X_Window win, Ecore_X_MWM_Hint_Func *fhint, Ecore_X_
free(reply);
return ret;
}

File diff suppressed because it is too large Load Diff

View File

@ -18,8 +18,11 @@
* @return New pixmap.
* @ingroup Ecore_X_Pixmap_Group
*/
EAPI Ecore_X_Pixmap
ecore_x_pixmap_new(Ecore_X_Window win, int w, int h, int dep)
EAPI Ecore_X_Pixmap
ecore_x_pixmap_new(Ecore_X_Window win,
int w,
int h,
int dep)
{
Ecore_X_Pixmap pmap;
@ -45,8 +48,8 @@ ecore_x_pixmap_new(Ecore_X_Window win, int w, int h, int dep)
* @param pmap The given pixmap.
* @ingroup Ecore_X_Pixmap_Group
*/
EAPI void
ecore_x_pixmap_free(Ecore_X_Pixmap pmap)
EAPI void
ecore_x_pixmap_free(Ecore_X_Pixmap pmap)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
CHECK_XCB_CONN;
@ -69,8 +72,16 @@ ecore_x_pixmap_free(Ecore_X_Pixmap pmap)
* @param dy The Y position at which to paste the area on @p dest.
* @ingroup Ecore_X_Pixmap_Group
*/
EAPI void
ecore_x_pixmap_paste(Ecore_X_Pixmap pmap, Ecore_X_Drawable dest, Ecore_X_GC gc, int sx, int sy, int w, int h, int dx, int dy)
EAPI void
ecore_x_pixmap_paste(Ecore_X_Pixmap pmap,
Ecore_X_Drawable dest,
Ecore_X_GC gc,
int sx,
int sy,
int w,
int h,
int dx,
int dy)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
CHECK_XCB_CONN;
@ -88,8 +99,12 @@ ecore_x_pixmap_paste(Ecore_X_Pixmap pmap, Ecore_X_Drawable dest, Ecore_X_GC gc,
* @param h Pointer to an integer in which to store the height.
* @ingroup Ecore_X_Pixmap_Group
*/
EAPI void
ecore_x_pixmap_geometry_get(Ecore_X_Pixmap pmap, int *x, int *y, int *w, int *h)
EAPI void
ecore_x_pixmap_geometry_get(Ecore_X_Pixmap pmap,
int *x,
int *y,
int *w,
int *h)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
@ -103,10 +118,11 @@ ecore_x_pixmap_geometry_get(Ecore_X_Pixmap pmap, int *x, int *y, int *w, int *h)
* @return The depth of the pixmap.
* @ingroup Ecore_X_Pixmap_Group
*/
EAPI int
ecore_x_pixmap_depth_get(Ecore_X_Pixmap pmap)
EAPI int
ecore_x_pixmap_depth_get(Ecore_X_Pixmap pmap)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
return ecore_x_drawable_depth_get(pmap);
}

View File

@ -51,7 +51,7 @@ extern int _ecore_xcb_log_dom;
# ifdef CRIT
# undef CRIT
# endif
# define CRIT(...) EINA_LOG_DOM_CRIT(_ecore_xcb_log_dom, __VA_ARGS__)
# define CRIT(...) EINA_LOG_DOM_CRIT(_ecore_xcb_log_dom, __VA_ARGS__)
# ifdef LOGFNS
# include <stdio.h>
@ -72,117 +72,122 @@ extern int _ecore_xcb_log_dom;
# define MAX(a, b) ((a < b) ? b : a)
# endif
#define CHECK_XCB_CONN \
{ \
if (xcb_connection_has_error(_ecore_xcb_conn)) \
{ \
DBG("XCB Connection Has Error !!"); \
_ecore_xcb_io_error_handle(NULL); \
} \
}
#define CHECK_XCB_CONN \
{ \
if (xcb_connection_has_error(_ecore_xcb_conn)) \
{ \
DBG("XCB Connection Has Error !!"); \
_ecore_xcb_io_error_handle(NULL); \
} \
}
/* enums */
typedef enum _Ecore_Xcb_Encoding_Style Ecore_Xcb_Encoding_Style;
enum _Ecore_Xcb_Encoding_Style
enum _Ecore_Xcb_Encoding_Style
{
XcbStringStyle,
XcbCompoundTextStyle,
XcbStringStyle,
XcbCompoundTextStyle,
XcbTextStyle,
XcbStdICCTextStyle,
XcbStdICCTextStyle,
XcbUTF8StringStyle
};
/* structures */
typedef struct _Ecore_X_DND_Source Ecore_X_DND_Source;
typedef struct _Ecore_X_DND_Target Ecore_X_DND_Target;
typedef struct _Ecore_X_Selection_Intern Ecore_X_Selection_Intern;
typedef struct _Ecore_X_DND_Source Ecore_X_DND_Source;
typedef struct _Ecore_X_DND_Target Ecore_X_DND_Target;
typedef struct _Ecore_X_Selection_Intern Ecore_X_Selection_Intern;
typedef struct _Ecore_X_Selection_Converter Ecore_X_Selection_Converter;
typedef struct _Ecore_X_Selection_Parser Ecore_X_Selection_Parser;
typedef struct _Ecore_Xcb_Textproperty Ecore_Xcb_Textproperty;
typedef struct _Ecore_X_Selection_Parser Ecore_X_Selection_Parser;
typedef struct _Ecore_Xcb_Textproperty Ecore_Xcb_Textproperty;
struct _Ecore_X_DND_Source
struct _Ecore_X_DND_Source
{
int version;
int version;
Ecore_X_Window win, dest;
enum
{
ECORE_X_DND_SOURCE_IDLE,
ECORE_X_DND_SOURCE_DRAGGING,
ECORE_X_DND_SOURCE_DROPPED,
ECORE_X_DND_SOURCE_CONVERTING
} state;
enum
{
ECORE_X_DND_SOURCE_IDLE,
ECORE_X_DND_SOURCE_DRAGGING,
ECORE_X_DND_SOURCE_DROPPED,
ECORE_X_DND_SOURCE_CONVERTING
} state;
struct
{
short x, y;
unsigned short width, height;
} rectangle;
struct
{
short x, y;
unsigned short width, height;
} rectangle;
struct
{
Ecore_X_Window window;
int x, y;
} prev;
struct
{
Ecore_X_Window window;
int x, y;
} prev;
Ecore_X_Time time;
Ecore_X_Atom action, accepted_action;
int will_accept, suppress;
int await_status;
int will_accept, suppress;
int await_status;
};
struct _Ecore_X_DND_Target
struct _Ecore_X_DND_Target
{
int version;
int version;
Ecore_X_Window win, source;
enum
{
ECORE_X_DND_TARGET_IDLE,
ECORE_X_DND_TARGET_ENTERED
} state;
enum
{
ECORE_X_DND_TARGET_IDLE,
ECORE_X_DND_TARGET_ENTERED
} state;
struct
{
int x, y;
} pos;
struct
{
int x, y;
} pos;
Ecore_X_Time time;
Ecore_X_Atom action, accepted_action;
int will_accept;
int will_accept;
};
struct _Ecore_X_Selection_Intern
struct _Ecore_X_Selection_Intern
{
Ecore_X_Window win;
Ecore_X_Atom selection;
Ecore_X_Atom selection;
unsigned char *data;
int length;
Ecore_X_Time time;
int length;
Ecore_X_Time time;
};
struct _Ecore_X_Selection_Converter
struct _Ecore_X_Selection_Converter
{
Ecore_X_Atom target;
Eina_Bool (*convert) (char *target, void *data, int size, void **data_ret,
int *size_ret, Ecore_X_Atom *type, int *size_type);
Ecore_X_Atom target;
Eina_Bool (*convert)(char *target,
void *data,
int size,
void **data_ret,
int *size_ret,
Ecore_X_Atom *type,
int *size_type);
Ecore_X_Selection_Converter *next;
};
struct _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;
};
struct _Ecore_Xcb_Textproperty
struct _Ecore_Xcb_Textproperty
{
char *value;
char *value;
Ecore_X_Atom encoding;
unsigned int format, nitems;
};
@ -218,7 +223,9 @@ extern int _ecore_xcb_button_grabs_num;
extern int _ecore_xcb_key_grabs_num;
extern Ecore_X_Window *_ecore_xcb_button_grabs;
extern Ecore_X_Window *_ecore_xcb_key_grabs;
extern Eina_Bool (*_ecore_xcb_window_grab_replay_func)(void *data, int type, void *event);
extern Eina_Bool (*_ecore_xcb_window_grab_replay_func)(void *data,
int type,
void *event);
extern void *_ecore_xcb_window_grab_replay_data;
/* private function prototypes */
@ -239,81 +246,148 @@ void _ecore_xcb_screensaver_finalize(void);
void _ecore_xcb_sync_init(void);
void _ecore_xcb_sync_finalize(void);
void _ecore_xcb_sync_magic_send(int val, Ecore_X_Window win);
void _ecore_xcb_sync_magic_send(int val,
Ecore_X_Window win);
void _ecore_xcb_render_init(void);
void _ecore_xcb_render_finalize(void);
Eina_Bool _ecore_xcb_render_argb_get(void);
Eina_Bool _ecore_xcb_render_anim_get(void);
Eina_Bool _ecore_xcb_render_avail_get(void);
void _ecore_xcb_render_init(void);
void _ecore_xcb_render_finalize(void);
Eina_Bool _ecore_xcb_render_argb_get(void);
Eina_Bool _ecore_xcb_render_anim_get(void);
Eina_Bool _ecore_xcb_render_avail_get(void);
Eina_Bool _ecore_xcb_render_visual_supports_alpha(Ecore_X_Visual visual);
uint32_t _ecore_xcb_render_find_visual_id(int type, Eina_Bool check_alpha);
Ecore_X_Visual *_ecore_xcb_render_visual_get(int visual_id);
Eina_Bool _ecore_xcb_render_visual_supports_alpha(Ecore_X_Visual visual);
uint32_t _ecore_xcb_render_find_visual_id(int type,
Eina_Bool check_alpha);
Ecore_X_Visual *_ecore_xcb_render_visual_get(int visual_id);
void _ecore_xcb_randr_init(void);
void _ecore_xcb_randr_finalize(void);
void _ecore_xcb_randr_init(void);
void _ecore_xcb_randr_finalize(void);
void _ecore_xcb_xfixes_init(void);
void _ecore_xcb_xfixes_finalize(void);
Eina_Bool _ecore_xcb_xfixes_avail_get(void);
void _ecore_xcb_xfixes_init(void);
void _ecore_xcb_xfixes_finalize(void);
Eina_Bool _ecore_xcb_xfixes_avail_get(void);
void _ecore_xcb_damage_init(void);
void _ecore_xcb_damage_finalize(void);
void _ecore_xcb_damage_init(void);
void _ecore_xcb_damage_finalize(void);
void _ecore_xcb_composite_init(void);
void _ecore_xcb_composite_finalize(void);
void _ecore_xcb_composite_init(void);
void _ecore_xcb_composite_finalize(void);
void _ecore_xcb_dpms_init(void);
void _ecore_xcb_dpms_finalize(void);
void _ecore_xcb_dpms_init(void);
void _ecore_xcb_dpms_finalize(void);
void _ecore_xcb_cursor_init(void);
void _ecore_xcb_cursor_finalize(void);
void _ecore_xcb_cursor_init(void);
void _ecore_xcb_cursor_finalize(void);
void _ecore_xcb_xinerama_init(void);
void _ecore_xcb_xinerama_finalize(void);
void _ecore_xcb_xinerama_init(void);
void _ecore_xcb_xinerama_finalize(void);
void _ecore_xcb_dnd_init(void);
void _ecore_xcb_dnd_shutdown(void);
void _ecore_xcb_dnd_init(void);
void _ecore_xcb_dnd_shutdown(void);
Ecore_X_DND_Source *_ecore_xcb_dnd_source_get(void);
Ecore_X_DND_Target *_ecore_xcb_dnd_target_get(void);
void _ecore_xcb_dnd_drag(Ecore_X_Window root, int x, int y);
void _ecore_xcb_dnd_drag(Ecore_X_Window root,
int x,
int y);
void _ecore_xcb_selection_init(void);
void _ecore_xcb_selection_shutdown(void);
void *_ecore_xcb_selection_parse(const char *target, void *data, int size, int format);
char *_ecore_xcb_selection_target_get(Ecore_X_Atom target);
void _ecore_xcb_selection_init(void);
void _ecore_xcb_selection_shutdown(void);
void *_ecore_xcb_selection_parse(const char *target,
void *data,
int size,
int format);
char *_ecore_xcb_selection_target_get(Ecore_X_Atom target);
Ecore_X_Selection_Intern *_ecore_xcb_selection_get(Ecore_X_Atom selection);
# ifdef HAVE_ICONV
Eina_Bool _ecore_xcb_utf8_textlist_to_textproperty(char **list, int count, Ecore_Xcb_Encoding_Style style, Ecore_Xcb_Textproperty *ret);
Eina_Bool _ecore_xcb_utf8_textlist_to_textproperty(char **list,
int count,
Ecore_Xcb_Encoding_Style style,
Ecore_Xcb_Textproperty *ret);
# endif
Eina_Bool _ecore_xcb_mb_textlist_to_textproperty(char **list, int count, Ecore_Xcb_Encoding_Style style, Ecore_Xcb_Textproperty *ret);
Eina_Bool _ecore_xcb_textlist_to_textproperty(const char *type, char **list, int count, Ecore_Xcb_Encoding_Style style, Ecore_Xcb_Textproperty *ret);
Eina_Bool _ecore_xcb_mb_textlist_to_textproperty(char **list,
int count,
Ecore_Xcb_Encoding_Style style,
Ecore_Xcb_Textproperty *ret);
Eina_Bool _ecore_xcb_textlist_to_textproperty(const char *type,
char **list,
int count,
Ecore_Xcb_Encoding_Style style,
Ecore_Xcb_Textproperty *ret);
# ifdef HAVE_ICONV
Eina_Bool _ecore_xcb_utf8_textproperty_to_textlist(const Ecore_Xcb_Textproperty *text_prop, char ***list_ret, int *count_ret);
Eina_Bool _ecore_xcb_utf8_textproperty_to_textlist(const Ecore_Xcb_Textproperty *text_prop,
char ***list_ret,
int *count_ret);
# endif
Eina_Bool _ecore_xcb_mb_textproperty_to_textlist(const Ecore_Xcb_Textproperty *text_prop, char ***list_ret, int *count_ret);
Eina_Bool _ecore_xcb_textproperty_to_textlist(const Ecore_Xcb_Textproperty *text_prop, const char *type, char ***list_ret, int *count_ret);
Eina_Bool _ecore_xcb_mb_textproperty_to_textlist(const Ecore_Xcb_Textproperty *text_prop,
char ***list_ret,
int *count_ret);
Eina_Bool _ecore_xcb_textproperty_to_textlist(const Ecore_Xcb_Textproperty *text_prop,
const char *type,
char ***list_ret,
int *count_ret);
void _ecore_xcb_events_init(void);
void _ecore_xcb_events_shutdown(void);
void _ecore_xcb_events_handle(xcb_generic_event_t *ev);
void _ecore_xcb_events_init(void);
void _ecore_xcb_events_shutdown(void);
void _ecore_xcb_events_handle(xcb_generic_event_t *ev);
Ecore_X_Time _ecore_xcb_events_last_time_get(void);
unsigned int _ecore_xcb_events_modifiers_get(unsigned int state);
void _ecore_xcb_event_mouse_move(uint16_t timestamp, uint16_t modifiers, int16_t x, int16_t y, int16_t root_x, int16_t root_y, xcb_window_t event_win, xcb_window_t win, xcb_window_t root_win, uint8_t same_screen, int dev, double radx, double rady, double pressure, double angle, int16_t mx, int16_t my, int16_t mrx, int16_t mry);
Ecore_Event_Mouse_Button *_ecore_xcb_event_mouse_button(int event, uint16_t timestamp, uint16_t modifiers, xcb_button_t buttons, int16_t x, int16_t y, int16_t root_x, int16_t root_y, xcb_window_t event_win, xcb_window_t win, xcb_window_t root_win, uint8_t same_screen, int dev, double radx, double rady, double pressure, double angle, int16_t mx, int16_t my, int16_t mrx, int16_t mry);
void _ecore_xcb_event_mouse_move(uint16_t timestamp,
uint16_t modifiers,
int16_t x,
int16_t y,
int16_t root_x,
int16_t root_y,
xcb_window_t event_win,
xcb_window_t win,
xcb_window_t root_win,
uint8_t same_screen,
int dev,
double radx,
double rady,
double pressure,
double angle,
int16_t mx,
int16_t my,
int16_t mrx,
int16_t mry);
Ecore_Event_Mouse_Button *_ecore_xcb_event_mouse_button(int event,
uint16_t timestamp,
uint16_t modifiers,
xcb_button_t buttons,
int16_t x,
int16_t y,
int16_t root_x,
int16_t root_y,
xcb_window_t event_win,
xcb_window_t win,
xcb_window_t root_win,
uint8_t same_screen,
int dev,
double radx,
double rady,
double pressure,
double angle,
int16_t mx,
int16_t my,
int16_t mrx,
int16_t mry);
void _ecore_xcb_keymap_init(void);
void _ecore_xcb_keymap_finalize(void);
void _ecore_xcb_keymap_shutdown(void);
void _ecore_xcb_keymap_refresh(xcb_mapping_notify_event_t *event);
xcb_keysym_t _ecore_xcb_keymap_keycode_to_keysym(xcb_keycode_t keycode, int col);
void _ecore_xcb_keymap_init(void);
void _ecore_xcb_keymap_finalize(void);
void _ecore_xcb_keymap_shutdown(void);
void _ecore_xcb_keymap_refresh(xcb_mapping_notify_event_t *event);
xcb_keysym_t _ecore_xcb_keymap_keycode_to_keysym(xcb_keycode_t keycode,
int col);
xcb_keycode_t *_ecore_xcb_keymap_keysym_to_keycode(xcb_keysym_t keysym);
char *_ecore_xcb_keymap_keysym_to_string(xcb_keysym_t keysym);
xcb_keycode_t _ecore_xcb_keymap_string_to_keycode(const char *key);
int _ecore_xcb_keymap_lookup_string(xcb_keycode_t keycode, int state, char *buffer, int bytes, xcb_keysym_t *sym);
char *_ecore_xcb_keymap_keysym_to_string(xcb_keysym_t keysym);
xcb_keycode_t _ecore_xcb_keymap_string_to_keycode(const char *key);
int _ecore_xcb_keymap_lookup_string(xcb_keycode_t keycode,
int state,
char *buffer,
int bytes,
xcb_keysym_t *sym);
void _ecore_xcb_input_init(void);
void _ecore_xcb_input_finalize(void);
@ -324,32 +398,48 @@ void _ecore_xcb_input_handle_event(xcb_generic_event_t *event);
void _ecore_xcb_input_handle_event(xcb_generic_event_t *event __UNUSED__);
# endif
void _ecore_xcb_dri_init(void);
void _ecore_xcb_dri_finalize(void);
void _ecore_xcb_dri_init(void);
void _ecore_xcb_dri_finalize(void);
void _ecore_xcb_xtest_init(void);
void _ecore_xcb_xtest_finalize(void);
void _ecore_xcb_xtest_init(void);
void _ecore_xcb_xtest_finalize(void);
Ecore_X_Window _ecore_xcb_window_root_of_screen_get(int screen);
void _ecore_xcb_window_prop_string_utf8_set(Ecore_X_Window win, Ecore_X_Atom atom, const char *str);
void _ecore_xcb_window_prop_string_utf8_set(Ecore_X_Window win,
Ecore_X_Atom atom,
const char *str);
Ecore_X_Visual _ecore_xcb_window_visual_get(Ecore_X_Window win);
void _ecore_xcb_window_button_grab_remove(Ecore_X_Window win);
void _ecore_xcb_window_key_grab_remove(Ecore_X_Window win);
void _ecore_xcb_window_grab_allow_events(Ecore_X_Window event_win, Ecore_X_Window child_win, int type, void *event, Ecore_X_Time timestamp);
void _ecore_xcb_window_button_grab_remove(Ecore_X_Window win);
void _ecore_xcb_window_key_grab_remove(Ecore_X_Window win);
void _ecore_xcb_window_grab_allow_events(Ecore_X_Window event_win,
Ecore_X_Window child_win,
int type,
void *event,
Ecore_X_Time timestamp);
int _ecore_xcb_netwm_startup_info_begin(Ecore_X_Window win __UNUSED__, uint8_t data __UNUSED__);
int _ecore_xcb_netwm_startup_info(Ecore_X_Window win __UNUSED__, uint8_t data __UNUSED__);
int _ecore_xcb_netwm_startup_info_begin(Ecore_X_Window win __UNUSED__,
uint8_t data __UNUSED__);
int _ecore_xcb_netwm_startup_info(Ecore_X_Window win __UNUSED__,
uint8_t data __UNUSED__);
Ecore_X_Window_State _ecore_xcb_netwm_window_state_get(Ecore_X_Atom atom);
int _ecore_xcb_error_handle(xcb_generic_error_t *err);
int _ecore_xcb_io_error_handle(xcb_generic_error_t *err);
int _ecore_xcb_error_handle(xcb_generic_error_t *err);
int _ecore_xcb_io_error_handle(xcb_generic_error_t *err);
xcb_image_t *_ecore_xcb_image_create_native(int w, int h, xcb_image_format_t format, uint8_t depth, void *base, uint32_t bytes, uint8_t *data);
xcb_image_t *_ecore_xcb_image_create_native(int w,
int h,
xcb_image_format_t format,
uint8_t depth,
void *base,
uint32_t bytes,
uint8_t *data);
void _ecore_xcb_xdefaults_init(void);
void _ecore_xcb_xdefaults_shutdown(void);
char *_ecore_xcb_xdefaults_string_get(const char *prog, const char *param);
int _ecore_xcb_xdefaults_int_get(const char *prog, const char *param);
void _ecore_xcb_xdefaults_init(void);
void _ecore_xcb_xdefaults_shutdown(void);
char *_ecore_xcb_xdefaults_string_get(const char *prog,
const char *param);
int _ecore_xcb_xdefaults_int_get(const char *prog,
const char *param);
void _ecore_xcb_modifiers_get(void);

File diff suppressed because it is too large Load Diff

View File

@ -31,7 +31,8 @@ ecore_x_xregion_free(Ecore_X_XRegion *region)
}
EAPI Eina_Bool
ecore_x_xregion_set(Ecore_X_XRegion *region, Ecore_X_GC gc)
ecore_x_xregion_set(Ecore_X_XRegion *region,
Ecore_X_GC gc)
{
xcb_rectangle_t *rects;
pixman_box16_t *boxes;
@ -63,7 +64,9 @@ ecore_x_xregion_set(Ecore_X_XRegion *region, Ecore_X_GC gc)
}
EAPI void
ecore_x_xregion_translate(Ecore_X_XRegion *region, int x, int y)
ecore_x_xregion_translate(Ecore_X_XRegion *region,
int x,
int y)
{
if (!region) return;
@ -71,34 +74,42 @@ ecore_x_xregion_translate(Ecore_X_XRegion *region, int x, int y)
}
EAPI Eina_Bool
ecore_x_xregion_intersect(Ecore_X_XRegion *dst, Ecore_X_XRegion *r1, Ecore_X_XRegion *r2)
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,
return pixman_region_intersect((pixman_region16_t *)dst,
(pixman_region16_t *)r1,
(pixman_region16_t *)r2);
}
EAPI Eina_Bool
ecore_x_xregion_union(Ecore_X_XRegion *dst, Ecore_X_XRegion *r1, Ecore_X_XRegion *r2)
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,
return pixman_region_union((pixman_region16_t *)dst,
(pixman_region16_t *)r1,
(pixman_region16_t *)r2);
}
EAPI Eina_Bool
ecore_x_xregion_union_rect(Ecore_X_XRegion *dst, Ecore_X_XRegion *src, Ecore_X_Rectangle *rect)
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,
return pixman_region_union_rect((pixman_region16_t *)dst,
(pixman_region16_t *)src,
rect->x, rect->y, rect->width, rect->height);
}
EAPI Eina_Bool
ecore_x_xregion_subtract(Ecore_X_XRegion *dst, Ecore_X_XRegion *rm, Ecore_X_XRegion *rs)
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,
return pixman_region_subtract((pixman_region16_t *)dst,
(pixman_region16_t *)rm,
(pixman_region16_t *)rs);
}
@ -111,16 +122,19 @@ ecore_x_xregion_is_empty(Ecore_X_XRegion *region)
}
EAPI Eina_Bool
ecore_x_xregion_is_equal(Ecore_X_XRegion *r1, Ecore_X_XRegion *r2)
ecore_x_xregion_is_equal(Ecore_X_XRegion *r1,
Ecore_X_XRegion *r2)
{
if ((!r1) || (!r2)) return EINA_FALSE;
return pixman_region_equal((pixman_region16_t *)r1,
return pixman_region_equal((pixman_region16_t *)r1,
(pixman_region16_t *)r2);
}
EAPI Eina_Bool
ecore_x_xregion_point_contain(Ecore_X_XRegion *region, int x, int y)
ecore_x_xregion_point_contain(Ecore_X_XRegion *region,
int x,
int y)
{
if (!region) return EINA_FALSE;
@ -128,7 +142,8 @@ ecore_x_xregion_point_contain(Ecore_X_XRegion *region, int x, int y)
}
EAPI Eina_Bool
ecore_x_xregion_rect_contain(Ecore_X_XRegion *region, Ecore_X_Rectangle *rect)
ecore_x_xregion_rect_contain(Ecore_X_XRegion *region,
Ecore_X_Rectangle *rect)
{
pixman_box16_t box;
@ -141,3 +156,4 @@ ecore_x_xregion_rect_contain(Ecore_X_XRegion *region, Ecore_X_Rectangle *rect)
return pixman_region_contains_rectangle((pixman_region16_t *)region, &box);
}

View File

@ -13,8 +13,8 @@ static Eina_Bool _render_avail = EINA_FALSE;
static Eina_Bool _render_argb = EINA_FALSE;
static Eina_Bool _render_anim = EINA_FALSE;
void
_ecore_xcb_render_init(void)
void
_ecore_xcb_render_init(void)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
@ -23,8 +23,8 @@ _ecore_xcb_render_init(void)
#endif
}
void
_ecore_xcb_render_finalize(void)
void
_ecore_xcb_render_finalize(void)
{
#ifdef ECORE_XCB_RENDER
const xcb_query_extension_reply_t *ext_reply;
@ -34,72 +34,72 @@ _ecore_xcb_render_finalize(void)
#ifdef ECORE_XCB_RENDER
ext_reply = xcb_get_extension_data(_ecore_xcb_conn, &xcb_render_id);
if ((ext_reply) && (ext_reply->present))
if ((ext_reply) && (ext_reply->present))
{
xcb_render_query_version_cookie_t cookie;
xcb_render_query_version_reply_t *reply;
cookie =
xcb_render_query_version_unchecked(_ecore_xcb_conn,
XCB_RENDER_MAJOR_VERSION,
cookie =
xcb_render_query_version_unchecked(_ecore_xcb_conn,
XCB_RENDER_MAJOR_VERSION,
XCB_RENDER_MINOR_VERSION);
reply = xcb_render_query_version_reply(_ecore_xcb_conn, cookie, NULL);
if (reply)
if (reply)
{
// if ((reply->major_version >= XCB_RENDER_MAJOR_VERSION) &&
if (reply->minor_version >= XCB_RENDER_MINOR_VERSION)
{
char *v = NULL;
// if ((reply->major_version >= XCB_RENDER_MAJOR_VERSION) &&
if (reply->minor_version >= XCB_RENDER_MINOR_VERSION)
{
char *v = NULL;
_render_avail = EINA_TRUE;
_ecore_xcb_xdefaults_init();
if ((reply->major_version > 0) || (reply->minor_version >= 5))
{
_render_argb = EINA_TRUE;
v = getenv("XCURSOR_CORE");
if (!v)
v = _ecore_xcb_xdefaults_string_get("Xcursor", "core");
if ((v) && (_ecore_xcb_render_parse_boolean(v)))
_render_argb = EINA_FALSE;
}
if ((_render_argb) &&
((reply->major_version > 0) || (reply->minor_version >= 8)))
{
_render_anim = EINA_TRUE;
v = getenv("XCURSOR_ANIM");
if (!v)
v = _ecore_xcb_xdefaults_string_get("Xcursor", "anim");
if ((v) && (_ecore_xcb_render_parse_boolean(v)))
_render_anim = EINA_FALSE;
}
_ecore_xcb_xdefaults_shutdown();
}
_render_avail = EINA_TRUE;
_ecore_xcb_xdefaults_init();
if ((reply->major_version > 0) || (reply->minor_version >= 5))
{
_render_argb = EINA_TRUE;
v = getenv("XCURSOR_CORE");
if (!v)
v = _ecore_xcb_xdefaults_string_get("Xcursor", "core");
if ((v) && (_ecore_xcb_render_parse_boolean(v)))
_render_argb = EINA_FALSE;
}
if ((_render_argb) &&
((reply->major_version > 0) || (reply->minor_version >= 8)))
{
_render_anim = EINA_TRUE;
v = getenv("XCURSOR_ANIM");
if (!v)
v = _ecore_xcb_xdefaults_string_get("Xcursor", "anim");
if ((v) && (_ecore_xcb_render_parse_boolean(v)))
_render_anim = EINA_FALSE;
}
_ecore_xcb_xdefaults_shutdown();
}
}
free(reply);
}
#endif
}
Eina_Bool
_ecore_xcb_render_avail_get(void)
Eina_Bool
_ecore_xcb_render_avail_get(void)
{
return _render_avail;
}
Eina_Bool
_ecore_xcb_render_argb_get(void)
Eina_Bool
_ecore_xcb_render_argb_get(void)
{
return _render_argb;
}
Eina_Bool
_ecore_xcb_render_anim_get(void)
Eina_Bool
_ecore_xcb_render_anim_get(void)
{
return _render_anim;
}
Eina_Bool
_ecore_xcb_render_visual_supports_alpha(Ecore_X_Visual visual)
Eina_Bool
_ecore_xcb_render_visual_supports_alpha(Ecore_X_Visual visual)
{
Eina_Bool ret = EINA_FALSE;
#ifdef ECORE_XCB_RENDER
@ -117,19 +117,19 @@ _ecore_xcb_render_visual_supports_alpha(Ecore_X_Visual visual)
reply = xcb_render_util_query_formats(_ecore_xcb_conn);
if (!reply) return EINA_FALSE;
vis =
xcb_render_util_find_visual_format(reply,
vis =
xcb_render_util_find_visual_format(reply,
((xcb_visualtype_t *)visual)->visual_id);
if (vis)
if (vis)
{
xcb_render_pictforminfo_t temp;
xcb_render_pictforminfo_t *format;
temp.id = vis->format;
format =
format =
xcb_render_util_find_format(reply, XCB_PICT_FORMAT_ID, &temp, 0);
if ((format->type == XCB_RENDER_PICT_TYPE_DIRECT) &&
if ((format->type == XCB_RENDER_PICT_TYPE_DIRECT) &&
(format->direct.alpha_mask))
ret = EINA_TRUE;
}
@ -139,8 +139,9 @@ _ecore_xcb_render_visual_supports_alpha(Ecore_X_Visual visual)
return ret;
}
uint32_t
_ecore_xcb_render_find_visual_id(int type, Eina_Bool check_alpha)
uint32_t
_ecore_xcb_render_find_visual_id(int type,
Eina_Bool check_alpha)
{
#ifdef ECORE_XCB_RENDER
const xcb_render_query_pict_formats_reply_t *reply;
@ -160,13 +161,13 @@ _ecore_xcb_render_find_visual_id(int type, Eina_Bool check_alpha)
if (!reply) return 0;
for (screens = xcb_render_query_pict_formats_screens_iterator(reply);
screens.rem; xcb_render_pictscreen_next(&screens))
screens.rem; xcb_render_pictscreen_next(&screens))
{
for (depths = xcb_render_pictscreen_depths_iterator(screens.data);
depths.rem; xcb_render_pictdepth_next(&depths))
for (depths = xcb_render_pictscreen_depths_iterator(screens.data);
depths.rem; xcb_render_pictdepth_next(&depths))
{
for (visuals = xcb_render_pictdepth_visuals_iterator(depths.data);
visuals.rem; xcb_render_pictvisual_next(&visuals))
visuals.rem; xcb_render_pictvisual_next(&visuals))
{
xcb_render_pictforminfo_t temp;
xcb_render_pictforminfo_t *format;
@ -174,13 +175,13 @@ _ecore_xcb_render_find_visual_id(int type, Eina_Bool check_alpha)
visual = visuals.data;
temp.id = visual->format;
format =
xcb_render_util_find_format(reply, XCB_PICT_FORMAT_ID,
format =
xcb_render_util_find_format(reply, XCB_PICT_FORMAT_ID,
&temp, 0);
if (!format) continue;
if (format->type == type)
if (format->type == type)
{
if (check_alpha)
if (check_alpha)
{
if (format->direct.alpha_mask)
return visual->visual;
@ -197,8 +198,8 @@ _ecore_xcb_render_find_visual_id(int type, Eina_Bool check_alpha)
}
/* local function prototypes */
static Eina_Bool
_ecore_xcb_render_parse_boolean(char *v)
static Eina_Bool
_ecore_xcb_render_parse_boolean(char *v)
{
char c;
@ -209,7 +210,7 @@ _ecore_xcb_render_parse_boolean(char *v)
return EINA_TRUE;
if ((c == 'f') || (c == 'n') || (c == '0'))
return EINA_FALSE;
if (c == 'o')
if (c == 'o')
{
char d;
@ -221,3 +222,4 @@ _ecore_xcb_render_parse_boolean(char *v)
}
return EINA_FALSE;
}

View File

@ -9,8 +9,8 @@ static Eina_Bool _screensaver_avail = EINA_FALSE;
/* external variables */
int _ecore_xcb_event_screensaver = -1;
void
_ecore_xcb_screensaver_init(void)
void
_ecore_xcb_screensaver_init(void)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
@ -19,8 +19,8 @@ _ecore_xcb_screensaver_init(void)
#endif
}
void
_ecore_xcb_screensaver_finalize(void)
void
_ecore_xcb_screensaver_finalize(void)
{
#ifdef ECORE_XCB_SCREENSAVER
const xcb_query_extension_reply_t *ext_reply;
@ -30,21 +30,21 @@ _ecore_xcb_screensaver_finalize(void)
#ifdef ECORE_XCB_SCREENSAVER
ext_reply = xcb_get_extension_data(_ecore_xcb_conn, &xcb_screensaver_id);
if ((ext_reply) && (ext_reply->present))
if ((ext_reply) && (ext_reply->present))
{
xcb_screensaver_query_version_cookie_t cookie;
xcb_screensaver_query_version_reply_t *reply;
cookie =
xcb_screensaver_query_version_unchecked(_ecore_xcb_conn,
XCB_SCREENSAVER_MAJOR_VERSION,
cookie =
xcb_screensaver_query_version_unchecked(_ecore_xcb_conn,
XCB_SCREENSAVER_MAJOR_VERSION,
XCB_SCREENSAVER_MINOR_VERSION);
reply =
reply =
xcb_screensaver_query_version_reply(_ecore_xcb_conn, cookie, NULL);
if (reply)
if (reply)
{
if ((reply->server_major_version >= XCB_SCREENSAVER_MAJOR_VERSION) &&
(reply->server_minor_version >= XCB_SCREENSAVER_MINOR_VERSION))
if ((reply->server_major_version >= XCB_SCREENSAVER_MAJOR_VERSION) &&
(reply->server_minor_version >= XCB_SCREENSAVER_MINOR_VERSION))
_screensaver_avail = EINA_TRUE;
free(reply);
@ -56,8 +56,8 @@ _ecore_xcb_screensaver_finalize(void)
#endif
}
EAPI int
ecore_x_screensaver_idle_time_get(void)
EAPI int
ecore_x_screensaver_idle_time_get(void)
{
int ret = 0;
#ifdef ECORE_XCB_SCREENSAVER
@ -83,8 +83,11 @@ ecore_x_screensaver_idle_time_get(void)
return ret;
}
EAPI void
ecore_x_screensaver_set(int timeout, int interval, int prefer_blanking, int allow_exposures)
EAPI void
ecore_x_screensaver_set(int timeout,
int interval,
int prefer_blanking,
int allow_exposures)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
CHECK_XCB_CONN;
@ -92,13 +95,13 @@ ecore_x_screensaver_set(int timeout, int interval, int prefer_blanking, int allo
if (!_screensaver_avail) return;
#ifdef ECORE_XCB_SCREENSAVER
xcb_set_screen_saver(_ecore_xcb_conn,
xcb_set_screen_saver(_ecore_xcb_conn,
timeout, interval, prefer_blanking, allow_exposures);
#endif
}
EAPI void
ecore_x_screensaver_timeout_set(int timeout)
EAPI void
ecore_x_screensaver_timeout_set(int timeout)
{
#ifdef ECORE_XCB_SCREENSAVER
xcb_get_screen_saver_cookie_t cookie;
@ -124,8 +127,8 @@ ecore_x_screensaver_timeout_set(int timeout)
#endif
}
EAPI int
ecore_x_screensaver_timeout_get(void)
EAPI int
ecore_x_screensaver_timeout_get(void)
{
int timeout = 0;
#ifdef ECORE_XCB_SCREENSAVER
@ -149,8 +152,8 @@ ecore_x_screensaver_timeout_get(void)
return timeout;
}
EAPI void
ecore_x_screensaver_blank_set(int blank)
EAPI void
ecore_x_screensaver_blank_set(int blank)
{
#ifdef ECORE_XCB_SCREENSAVER
xcb_get_screen_saver_cookie_t cookie;
@ -176,8 +179,8 @@ ecore_x_screensaver_blank_set(int blank)
#endif
}
EAPI int
ecore_x_screensaver_blank_get(void)
EAPI int
ecore_x_screensaver_blank_get(void)
{
int blank = 0;
#ifdef ECORE_XCB_SCREENSAVER
@ -201,8 +204,8 @@ ecore_x_screensaver_blank_get(void)
return blank;
}
EAPI void
ecore_x_screensaver_expose_set(int expose)
EAPI void
ecore_x_screensaver_expose_set(int expose)
{
#ifdef ECORE_XCB_SCREENSAVER
xcb_get_screen_saver_cookie_t cookie;
@ -228,8 +231,8 @@ ecore_x_screensaver_expose_set(int expose)
#endif
}
EAPI int
ecore_x_screensaver_expose_get(void)
EAPI int
ecore_x_screensaver_expose_get(void)
{
int expose = 0;
#ifdef ECORE_XCB_SCREENSAVER
@ -253,8 +256,8 @@ ecore_x_screensaver_expose_get(void)
return expose;
}
EAPI void
ecore_x_screensaver_interval_set(int interval)
EAPI void
ecore_x_screensaver_interval_set(int interval)
{
#ifdef ECORE_XCB_SCREENSAVER
xcb_get_screen_saver_cookie_t cookie;
@ -280,8 +283,8 @@ ecore_x_screensaver_interval_set(int interval)
#endif
}
EAPI int
ecore_x_screensaver_interval_get(void)
EAPI int
ecore_x_screensaver_interval_get(void)
{
int interval = 0;
#ifdef ECORE_XCB_SCREENSAVER
@ -305,8 +308,8 @@ ecore_x_screensaver_interval_get(void)
return interval;
}
EAPI void
ecore_x_screensaver_event_listen_set(Eina_Bool on)
EAPI void
ecore_x_screensaver_event_listen_set(Eina_Bool on)
{
#ifdef ECORE_XCB_SCREENSAVER
Ecore_X_Window root;
@ -320,15 +323,16 @@ ecore_x_screensaver_event_listen_set(Eina_Bool on)
#ifdef ECORE_XCB_SCREENSAVER
root = ((xcb_screen_t *)_ecore_xcb_screen)->root;
if (on)
xcb_screensaver_select_input(_ecore_xcb_conn, root,
XCB_SCREENSAVER_EVENT_NOTIFY_MASK);
xcb_screensaver_select_input(_ecore_xcb_conn, root,
XCB_SCREENSAVER_EVENT_NOTIFY_MASK);
else
xcb_screensaver_select_input(_ecore_xcb_conn, root, 0);
#endif
}
EAPI Eina_Bool
ecore_x_screensaver_event_available_get(void)
EAPI Eina_Bool
ecore_x_screensaver_event_available_get(void)
{
return _screensaver_avail;
}

View File

@ -4,18 +4,38 @@
#define ECORE_XCB_SELECTION_DATA(x) ((Ecore_X_Selection_Data *)(x))
/* local function prototypes */
static Eina_Bool _ecore_xcb_selection_converter_text(char *target, void *data, int size, void **data_ret, int *size_ret, Ecore_X_Atom *type, int *size_type);
static void *_ecore_xcb_selection_parser_text(const char *target __UNUSED__, void *data, int size, int format __UNUSED__);
static void *_ecore_xcb_selection_parser_files(const char *target, void *data, int size, int format __UNUSED__);
static void *_ecore_xcb_selection_parser_targets(const char *target __UNUSED__, void *data, int size, int format __UNUSED__);
static Eina_Bool _ecore_xcb_selection_converter_text(char *target,
void *data,
int size,
void **data_ret,
int *size_ret,
Ecore_X_Atom *type,
int *size_type);
static void *_ecore_xcb_selection_parser_text(const char *target __UNUSED__,
void *data,
int size,
int format __UNUSED__);
static void *_ecore_xcb_selection_parser_files(const char *target,
void *data,
int size,
int format __UNUSED__);
static void *_ecore_xcb_selection_parser_targets(const char *target __UNUSED__,
void *data,
int size,
int format __UNUSED__);
//static int _ecore_xcb_selection_data_free(void *data);
static int _ecore_xcb_selection_data_text_free(void *data);
static int _ecore_xcb_selection_data_targets_free(void *data);
static int _ecore_xcb_selection_data_files_free(void *data);
static int _ecore_xcb_selection_data_default_free(void *data);
static Eina_Bool _ecore_xcb_selection_set(Ecore_X_Window win, const void *data, int size, Ecore_X_Atom selection);
static void _ecore_xcb_selection_request(Ecore_X_Window win, Ecore_X_Atom selection, const char *target);
static int _ecore_xcb_selection_data_text_free(void *data);
static int _ecore_xcb_selection_data_targets_free(void *data);
static int _ecore_xcb_selection_data_files_free(void *data);
static int _ecore_xcb_selection_data_default_free(void *data);
static Eina_Bool _ecore_xcb_selection_set(Ecore_X_Window win,
const void *data,
int size,
Ecore_X_Atom selection);
static void _ecore_xcb_selection_request(Ecore_X_Window win,
Ecore_X_Atom selection,
const char *target);
static Ecore_X_Atom _ecore_xcb_selection_target_atom_get(const char *target);
/* local variables */
@ -24,38 +44,38 @@ static Ecore_X_Selection_Converter *_converters = NULL;
static Ecore_X_Selection_Parser *_parsers = NULL;
/* local functions */
void
_ecore_xcb_selection_init(void)
void
_ecore_xcb_selection_init(void)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
memset(_selections, 0, sizeof(_selections));
/* init converters */
ecore_x_selection_converter_atom_add(ECORE_X_ATOM_TEXT,
_ecore_xcb_selection_converter_text);
ecore_x_selection_converter_atom_add(ECORE_X_ATOM_UTF8_STRING,
_ecore_xcb_selection_converter_text);
ecore_x_selection_converter_atom_add(ECORE_X_ATOM_COMPOUND_TEXT,
_ecore_xcb_selection_converter_text);
ecore_x_selection_converter_atom_add(ECORE_X_ATOM_STRING,
_ecore_xcb_selection_converter_text);
ecore_x_selection_converter_atom_add(ECORE_X_ATOM_TEXT,
_ecore_xcb_selection_converter_text);
ecore_x_selection_converter_atom_add(ECORE_X_ATOM_UTF8_STRING,
_ecore_xcb_selection_converter_text);
ecore_x_selection_converter_atom_add(ECORE_X_ATOM_COMPOUND_TEXT,
_ecore_xcb_selection_converter_text);
ecore_x_selection_converter_atom_add(ECORE_X_ATOM_STRING,
_ecore_xcb_selection_converter_text);
/* init parsers */
ecore_x_selection_parser_add("text/plain",
ecore_x_selection_parser_add("text/plain",
_ecore_xcb_selection_parser_text);
ecore_x_selection_parser_add(ECORE_X_SELECTION_TARGET_UTF8_STRING,
ecore_x_selection_parser_add(ECORE_X_SELECTION_TARGET_UTF8_STRING,
_ecore_xcb_selection_parser_text);
ecore_x_selection_parser_add("text/uri-list",
ecore_x_selection_parser_add("text/uri-list",
_ecore_xcb_selection_parser_files);
ecore_x_selection_parser_add("_NETSCAPE_URL",
ecore_x_selection_parser_add("_NETSCAPE_URL",
_ecore_xcb_selection_parser_files);
ecore_x_selection_parser_add(ECORE_X_SELECTION_TARGET_TARGETS,
ecore_x_selection_parser_add(ECORE_X_SELECTION_TARGET_TARGETS,
_ecore_xcb_selection_parser_targets);
}
void
_ecore_xcb_selection_shutdown(void)
void
_ecore_xcb_selection_shutdown(void)
{
Ecore_X_Selection_Converter *cnv;
Ecore_X_Selection_Parser *prs;
@ -64,7 +84,7 @@ _ecore_xcb_selection_shutdown(void)
/* free selection converters */
cnv = _converters;
while (cnv)
while (cnv)
{
Ecore_X_Selection_Converter *tmp;
@ -76,7 +96,7 @@ _ecore_xcb_selection_shutdown(void)
/* free parsers */
prs = _parsers;
while (prs)
while (prs)
{
Ecore_X_Selection_Parser *tmp;
@ -89,34 +109,40 @@ _ecore_xcb_selection_shutdown(void)
}
/* public functions */
EAPI void
ecore_x_selection_converter_atom_add(Ecore_X_Atom target,
Eina_Bool (*func) (char *target, void *data, int size, void **data_ret, int *size_ret, Ecore_X_Atom *type, int *size_type))
EAPI void
ecore_x_selection_converter_atom_add(Ecore_X_Atom target,
Eina_Bool (*func)(char *target,
void *data,
int size,
void **data_ret,
int *size_ret,
Ecore_X_Atom *type,
int *size_type))
{
Ecore_X_Selection_Converter *cnv;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
cnv = _converters;
if (_converters)
if (_converters)
{
while (1)
while (1)
{
if (cnv->target == target)
if (cnv->target == target)
{
cnv->convert = func;
return;
}
if (cnv->next)
cnv = cnv->next;
else
else
break;
}
cnv->next = calloc(1, sizeof(Ecore_X_Selection_Converter));
if (!cnv->next) return;
cnv = cnv->next;
}
else
else
{
_converters = calloc(1, sizeof(Ecore_X_Selection_Converter));
if (!_converters) return;
@ -126,9 +152,15 @@ ecore_x_selection_converter_atom_add(Ecore_X_Atom target,
cnv->convert = func;
}
EAPI void
ecore_x_selection_converter_add(char *target,
Eina_Bool (*func)(char *target, void *data, int size, void **date_ret, int *size_ret, Ecore_X_Atom *atom_ret, int *ret))
EAPI void
ecore_x_selection_converter_add(char *target,
Eina_Bool (*func)(char *target,
void *data,
int size,
void **date_ret,
int *size_ret,
Ecore_X_Atom *atom_ret,
int *ret))
{
Ecore_X_Atom atarget;
@ -139,8 +171,8 @@ ecore_x_selection_converter_add(char *target,
ecore_x_selection_converter_atom_add(atarget, func);
}
EAPI void
ecore_x_selection_converter_del(char *target)
EAPI void
ecore_x_selection_converter_del(char *target)
{
Ecore_X_Atom atarget;
@ -151,19 +183,19 @@ ecore_x_selection_converter_del(char *target)
ecore_x_selection_converter_atom_del(atarget);
}
EAPI void
ecore_x_selection_converter_atom_del(Ecore_X_Atom target)
EAPI void
ecore_x_selection_converter_atom_del(Ecore_X_Atom target)
{
Ecore_X_Selection_Converter *conv, *pconv = NULL;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
conv = _converters;
while (conv)
while (conv)
{
if (conv->target == target)
if (conv->target == target)
{
if (pconv)
if (pconv)
pconv->next = conv->next;
else
_converters = conv->next;
@ -175,9 +207,9 @@ 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))
{
Ecore_X_Selection_Parser *prs;
@ -185,11 +217,11 @@ ecore_x_selection_parser_add(const char *target,
if (!target) return;
prs = _parsers;
if (prs)
if (prs)
{
while (prs->next)
while (prs->next)
{
if (!strcmp(prs->target, target))
if (!strcmp(prs->target, target))
{
prs->parse = func;
return;
@ -199,7 +231,7 @@ ecore_x_selection_parser_add(const char *target,
prs->next = calloc(1, sizeof(Ecore_X_Selection_Parser));
prs = prs->next;
}
else
else
{
_parsers = calloc(1, sizeof(Ecore_X_Selection_Parser));
prs = _parsers;
@ -208,8 +240,8 @@ ecore_x_selection_parser_add(const char *target,
prs->parse = func;
}
EAPI void
ecore_x_selection_parser_del(const char *target)
EAPI void
ecore_x_selection_parser_del(const char *target)
{
Ecore_X_Selection_Parser *prs, *pprs = NULL;
@ -218,9 +250,9 @@ ecore_x_selection_parser_del(const char *target)
if (!target) return;
prs = _parsers;
while (prs)
while (prs)
{
if (!strcmp(prs->target, target))
if (!strcmp(prs->target, target))
{
if (pprs)
pprs->next = prs->next;
@ -243,12 +275,14 @@ ecore_x_selection_parser_del(const char *target)
* @return Returns 1 if the ownership of the selection was successfully
* claimed, or 0 if unsuccessful.
*/
EAPI Eina_Bool
ecore_x_selection_primary_set(Ecore_X_Window win, const void *data, int size)
EAPI Eina_Bool
ecore_x_selection_primary_set(Ecore_X_Window win,
const void *data,
int size)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
return _ecore_xcb_selection_set(win, data, size,
return _ecore_xcb_selection_set(win, data, size,
ECORE_X_ATOM_SELECTION_PRIMARY);
}
@ -257,17 +291,18 @@ ecore_x_selection_primary_set(Ecore_X_Window win, const void *data, int size)
* @return Returns 1 if the selection was successfully cleared,
* or 0 if unsuccessful.
*/
EAPI Eina_Bool
ecore_x_selection_primary_clear(void)
EAPI Eina_Bool
ecore_x_selection_primary_clear(void)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
return _ecore_xcb_selection_set(XCB_NONE, NULL, 0,
return _ecore_xcb_selection_set(XCB_NONE, NULL, 0,
ECORE_X_ATOM_SELECTION_PRIMARY);
}
EAPI void
ecore_x_selection_primary_request(Ecore_X_Window win, const char *target)
EAPI void
ecore_x_selection_primary_request(Ecore_X_Window win,
const char *target)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
@ -282,12 +317,14 @@ ecore_x_selection_primary_request(Ecore_X_Window win, const char *target)
* @return Returns 1 if the ownership of the selection was successfully
* claimed, or 0 if unsuccessful.
*/
EAPI Eina_Bool
ecore_x_selection_secondary_set(Ecore_X_Window win, const void *data, int size)
EAPI Eina_Bool
ecore_x_selection_secondary_set(Ecore_X_Window win,
const void *data,
int size)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
return _ecore_xcb_selection_set(win, data, size,
return _ecore_xcb_selection_set(win, data, size,
ECORE_X_ATOM_SELECTION_SECONDARY);
}
@ -296,17 +333,18 @@ ecore_x_selection_secondary_set(Ecore_X_Window win, const void *data, int size)
* @return Returns 1 if the selection was successfully cleared,
* or 0 if unsuccessful.
*/
EAPI Eina_Bool
ecore_x_selection_secondary_clear(void)
EAPI Eina_Bool
ecore_x_selection_secondary_clear(void)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
return _ecore_xcb_selection_set(XCB_NONE, NULL, 0,
return _ecore_xcb_selection_set(XCB_NONE, NULL, 0,
ECORE_X_ATOM_SELECTION_SECONDARY);
}
EAPI void
ecore_x_selection_secondary_request(Ecore_X_Window win, const char *target)
EAPI void
ecore_x_selection_secondary_request(Ecore_X_Window win,
const char *target)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
@ -321,12 +359,14 @@ ecore_x_selection_secondary_request(Ecore_X_Window win, const char *target)
* @return Returns 1 if the ownership of the selection was successfully
* claimed, or 0 if unsuccessful.
*/
EAPI Eina_Bool
ecore_x_selection_xdnd_set(Ecore_X_Window win, const void *data, int size)
EAPI Eina_Bool
ecore_x_selection_xdnd_set(Ecore_X_Window win,
const void *data,
int size)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
return _ecore_xcb_selection_set(win, data, size,
return _ecore_xcb_selection_set(win, data, size,
ECORE_X_ATOM_SELECTION_XDND);
}
@ -335,17 +375,18 @@ ecore_x_selection_xdnd_set(Ecore_X_Window win, const void *data, int size)
* @return Returns 1 if the selection was successfully cleared,
* or 0 if unsuccessful.
*/
EAPI Eina_Bool
ecore_x_selection_xdnd_clear(void)
EAPI Eina_Bool
ecore_x_selection_xdnd_clear(void)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
return _ecore_xcb_selection_set(XCB_NONE, NULL, 0,
return _ecore_xcb_selection_set(XCB_NONE, NULL, 0,
ECORE_X_ATOM_SELECTION_XDND);
}
EAPI void
ecore_x_selection_xdnd_request(Ecore_X_Window win, const char *target)
EAPI void
ecore_x_selection_xdnd_request(Ecore_X_Window win,
const char *target)
{
Ecore_X_Atom atom;
Ecore_X_DND_Target *_target;
@ -356,7 +397,7 @@ ecore_x_selection_xdnd_request(Ecore_X_Window win, const char *target)
_target = _ecore_xcb_dnd_target_get();
atom = _ecore_xcb_selection_target_atom_get(target);
xcb_convert_selection(_ecore_xcb_conn, win, ECORE_X_ATOM_SELECTION_XDND,
xcb_convert_selection(_ecore_xcb_conn, win, ECORE_X_ATOM_SELECTION_XDND,
atom, ECORE_X_ATOM_SELECTION_PROP_XDND, _target->time);
}
@ -371,12 +412,14 @@ ecore_x_selection_xdnd_request(Ecore_X_Window win, const char *target)
* Get the converted data from a previous CLIPBOARD selection
* request. The buffer must be freed when done with.
*/
EAPI Eina_Bool
ecore_x_selection_clipboard_set(Ecore_X_Window win, const void *data, int size)
EAPI Eina_Bool
ecore_x_selection_clipboard_set(Ecore_X_Window win,
const void *data,
int size)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
return _ecore_xcb_selection_set(win, data, size,
return _ecore_xcb_selection_set(win, data, size,
ECORE_X_ATOM_SELECTION_CLIPBOARD);
}
@ -385,25 +428,31 @@ ecore_x_selection_clipboard_set(Ecore_X_Window win, const void *data, int size)
* @return Returns 1 if the selection was successfully cleared,
* or 0 if unsuccessful.
*/
EAPI Eina_Bool
ecore_x_selection_clipboard_clear(void)
EAPI Eina_Bool
ecore_x_selection_clipboard_clear(void)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
return _ecore_xcb_selection_set(XCB_NONE, NULL, 0,
return _ecore_xcb_selection_set(XCB_NONE, NULL, 0,
ECORE_X_ATOM_SELECTION_CLIPBOARD);
}
EAPI void
ecore_x_selection_clipboard_request(Ecore_X_Window win, const char *target)
EAPI void
ecore_x_selection_clipboard_request(Ecore_X_Window win,
const char *target)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
_ecore_xcb_selection_request(win, ECORE_X_ATOM_SELECTION_CLIPBOARD, target);
}
EAPI Eina_Bool
ecore_x_selection_convert(Ecore_X_Atom selection, Ecore_X_Atom target, void **data_ret, int *size, Ecore_X_Atom *targtype, int *typesize)
EAPI Eina_Bool
ecore_x_selection_convert(Ecore_X_Atom selection,
Ecore_X_Atom target,
void **data_ret,
int *size,
Ecore_X_Atom *targtype,
int *typesize)
{
Ecore_X_Selection_Intern *sel;
Ecore_X_Selection_Converter *cnv;
@ -415,16 +464,16 @@ ecore_x_selection_convert(Ecore_X_Atom selection, Ecore_X_Atom target, void **da
sel = _ecore_xcb_selection_get(selection);
tgt_str = _ecore_xcb_selection_target_get(target);
for (cnv = _converters; cnv; cnv = cnv->next)
for (cnv = _converters; cnv; cnv = cnv->next)
{
if (cnv->target == target)
if (cnv->target == target)
{
int r = 0;
r = cnv->convert(tgt_str, sel->data, sel->length, &data, size,
r = cnv->convert(tgt_str, sel->data, sel->length, &data, size,
targtype, typesize);
free(tgt_str);
if (r)
if (r)
{
if (data_ret) *data_ret = data;
return r;
@ -437,8 +486,12 @@ ecore_x_selection_convert(Ecore_X_Atom selection, Ecore_X_Atom target, void **da
return EINA_FALSE;
}
EAPI Eina_Bool
ecore_x_selection_notify_send(Ecore_X_Window requestor, Ecore_X_Atom selection, Ecore_X_Atom target, Ecore_X_Atom property, Ecore_X_Time tim)
EAPI Eina_Bool
ecore_x_selection_notify_send(Ecore_X_Window requestor,
Ecore_X_Atom selection,
Ecore_X_Atom target,
Ecore_X_Atom property,
Ecore_X_Time tim)
{
xcb_selection_notify_event_t ev;
@ -454,15 +507,17 @@ ecore_x_selection_notify_send(Ecore_X_Window requestor, Ecore_X_Atom selection,
ev.property = property;
ev.time = tim;
xcb_send_event(_ecore_xcb_conn, 0, requestor,
xcb_send_event(_ecore_xcb_conn, 0, requestor,
XCB_EVENT_MASK_NO_EVENT, (const char *)&ev);
// ecore_x_flush();
return EINA_TRUE;
}
EAPI void
ecore_x_selection_owner_set(Ecore_X_Window win, Ecore_X_Atom atom, Ecore_X_Time tim)
EAPI void
ecore_x_selection_owner_set(Ecore_X_Window win,
Ecore_X_Atom atom,
Ecore_X_Time tim)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
CHECK_XCB_CONN;
@ -470,8 +525,8 @@ ecore_x_selection_owner_set(Ecore_X_Window win, Ecore_X_Atom atom, Ecore_X_Time
xcb_set_selection_owner(_ecore_xcb_conn, win, atom, tim);
}
EAPI Ecore_X_Window
ecore_x_selection_owner_get(Ecore_X_Atom atom)
EAPI Ecore_X_Window
ecore_x_selection_owner_get(Ecore_X_Atom atom)
{
xcb_get_selection_owner_cookie_t cookie;
xcb_get_selection_owner_reply_t *reply;
@ -489,14 +544,17 @@ ecore_x_selection_owner_get(Ecore_X_Atom atom)
}
void *
_ecore_xcb_selection_parse(const char *target, void *data, int size, int format)
_ecore_xcb_selection_parse(const char *target,
void *data,
int size,
int format)
{
Ecore_X_Selection_Parser *prs;
Ecore_X_Selection_Data *sel;
for (prs = _parsers; prs; prs = prs->next)
for (prs = _parsers; prs; prs = prs->next)
{
if (!strcmp(prs->target, target))
if (!strcmp(prs->target, target))
{
sel = prs->parse(target, data, size, format);
if (sel) return sel;
@ -514,7 +572,7 @@ _ecore_xcb_selection_parse(const char *target, void *data, int size, int format)
}
Ecore_X_Selection_Intern *
_ecore_xcb_selection_get(Ecore_X_Atom selection)
_ecore_xcb_selection_get(Ecore_X_Atom selection)
{
if (selection == ECORE_X_ATOM_SELECTION_PRIMARY)
return &_selections[0];
@ -524,13 +582,16 @@ _ecore_xcb_selection_get(Ecore_X_Atom selection)
return &_selections[2];
else if (selection == ECORE_X_ATOM_SELECTION_CLIPBOARD)
return &_selections[3];
else
else
return NULL;
}
/* local functions */
static Eina_Bool
_ecore_xcb_selection_set(Ecore_X_Window win, const void *data, int size, Ecore_X_Atom selection)
static Eina_Bool
_ecore_xcb_selection_set(Ecore_X_Window win,
const void *data,
int size,
Ecore_X_Atom selection)
{
xcb_get_selection_owner_cookie_t cookie;
xcb_get_selection_owner_reply_t *reply;
@ -545,7 +606,7 @@ _ecore_xcb_selection_set(Ecore_X_Window win, const void *data, int size, Ecore_X
reply = xcb_get_selection_owner_reply(_ecore_xcb_conn, cookie, NULL);
if (!reply) return EINA_FALSE;
if (reply->owner != win)
if (reply->owner != win)
{
free(reply);
return EINA_FALSE;
@ -560,10 +621,10 @@ _ecore_xcb_selection_set(Ecore_X_Window win, const void *data, int size, Ecore_X
in = 2;
else if (selection == ECORE_X_ATOM_SELECTION_CLIPBOARD)
in = 3;
else
else
return EINA_FALSE;
if (data)
if (data)
{
unsigned char *buff = NULL;
@ -577,7 +638,7 @@ _ecore_xcb_selection_set(Ecore_X_Window win, const void *data, int size, Ecore_X
memcpy(buff, data, size);
_selections[in].data = buff;
}
else if (_selections[in].data)
else if (_selections[in].data)
{
free(_selections[in].data);
memset(&_selections[in], 0, sizeof(Ecore_X_Selection_Data));
@ -586,8 +647,10 @@ _ecore_xcb_selection_set(Ecore_X_Window win, const void *data, int size, Ecore_X
return EINA_TRUE;
}
static void
_ecore_xcb_selection_request(Ecore_X_Window win, Ecore_X_Atom selection, const char *target)
static void
_ecore_xcb_selection_request(Ecore_X_Window win,
Ecore_X_Atom selection,
const char *target)
{
Ecore_X_Atom atarget, prop;
@ -605,12 +668,18 @@ _ecore_xcb_selection_request(Ecore_X_Window win, Ecore_X_Atom selection, const c
atarget = _ecore_xcb_selection_target_atom_get(target);
xcb_convert_selection(_ecore_xcb_conn, win, selection, atarget, prop,
xcb_convert_selection(_ecore_xcb_conn, win, selection, atarget, prop,
XCB_CURRENT_TIME);
}
static Eina_Bool
_ecore_xcb_selection_converter_text(char *target, void *data, int size, void **data_ret, int *size_ret, Ecore_X_Atom *type __UNUSED__, int *size_type __UNUSED__)
static Eina_Bool
_ecore_xcb_selection_converter_text(char *target,
void *data,
int size,
void **data_ret,
int *size_ret,
Ecore_X_Atom *type __UNUSED__,
int *size_type __UNUSED__)
{
Ecore_Xcb_Encoding_Style style;
Ecore_Xcb_Textproperty ret;
@ -629,7 +698,7 @@ _ecore_xcb_selection_converter_text(char *target, void *data, int size, void **d
style = XcbStringStyle;
else if (!strcmp(target, ECORE_X_SELECTION_TARGET_UTF8_STRING))
style = XcbUTF8StringStyle;
else
else
return EINA_FALSE;
str = alloca(size + 1);
@ -637,7 +706,7 @@ _ecore_xcb_selection_converter_text(char *target, void *data, int size, void **d
str[size] = '\0';
#ifdef HAVE_ICONV
if (_ecore_xcb_utf8_textlist_to_textproperty(&str, 1, style, &ret))
if (_ecore_xcb_utf8_textlist_to_textproperty(&str, 1, style, &ret))
{
int size = 0;
@ -650,7 +719,7 @@ _ecore_xcb_selection_converter_text(char *target, void *data, int size, void **d
return EINA_TRUE;
}
#else
if (_ecore_xcb_mb_textlist_to_textproperty(&str, 1, style, &ret))
if (_ecore_xcb_mb_textlist_to_textproperty(&str, 1, style, &ret))
{
int size = 0;
@ -663,14 +732,17 @@ _ecore_xcb_selection_converter_text(char *target, void *data, int size, void **d
return EINA_TRUE;
}
#endif
else
else
return EINA_TRUE;
return EINA_FALSE;
}
static void *
_ecore_xcb_selection_parser_text(const char *target __UNUSED__, void *data, int size, int format __UNUSED__)
_ecore_xcb_selection_parser_text(const char *target __UNUSED__,
void *data,
int size,
int format __UNUSED__)
{
Ecore_X_Selection_Data_Text *sel;
unsigned char *_data;
@ -683,11 +755,11 @@ _ecore_xcb_selection_parser_text(const char *target __UNUSED__, void *data, int
sel = calloc(1, sizeof(Ecore_X_Selection_Data_Text));
if (!sel) return NULL;
if (_data[size - 1])
if (_data[size - 1])
{
size++;
t = realloc(_data, size);
if (!t)
if (!t)
{
free(sel);
return NULL;
@ -704,7 +776,10 @@ _ecore_xcb_selection_parser_text(const char *target __UNUSED__, void *data, int
}
static void *
_ecore_xcb_selection_parser_files(const char *target, void *data, int size, int format __UNUSED__)
_ecore_xcb_selection_parser_files(const char *target,
void *data,
int size,
int format __UNUSED__)
{
Ecore_X_Selection_Data_Files *sel;
char *_data, *tmp, *t, **t2;
@ -712,7 +787,7 @@ _ecore_xcb_selection_parser_files(const char *target, void *data, int size, int
LOGFN(__FILE__, __LINE__, __FUNCTION__);
if ((strcmp(target, "text/uri-list")) &&
if ((strcmp(target, "text/uri-list")) &&
(strcmp(target, "_NETSCAPE_URL"))) return NULL;
if (!(_data = data)) return NULL;
@ -722,11 +797,11 @@ _ecore_xcb_selection_parser_files(const char *target, void *data, int size, int
ECORE_XCB_SELECTION_DATA(sel)->free = _ecore_xcb_selection_data_files_free;
if (_data[size - 1])
if (_data[size - 1])
{
size++;
t = realloc(_data, size);
if (!t)
if (!t)
{
free(sel);
return NULL;
@ -736,30 +811,30 @@ _ecore_xcb_selection_parser_files(const char *target, void *data, int size, int
}
tmp = malloc(size);
if (!tmp)
if (!tmp)
{
free(sel);
return NULL;
}
while ((is < size) && (_data[is]))
while ((is < size) && (_data[is]))
{
if ((i == 0) && (_data[is] == '#'))
if ((i == 0) && (_data[is] == '#'))
{
for (; ((_data[is]) && (_data[is] != '\n')); is++) ;
}
else
else
{
if ((_data[is] != '\r') && (_data[is] != '\n'))
tmp[i++] = _data[is++];
else
else
{
while ((_data[is] == '\r') || (_data[is] == '\n'))
is++;
tmp[i] = 0;
sel->num_files++;
t2 = realloc(sel->files, sel->num_files * sizeof(char *));
if (t2)
if (t2)
{
sel->files = t2;
sel->files[sel->num_files - 1] = strdup(tmp);
@ -769,12 +844,12 @@ _ecore_xcb_selection_parser_files(const char *target, void *data, int size, int
}
}
}
if (i > 0)
if (i > 0)
{
tmp[i] = 0;
sel->num_files++;
t2 = realloc(sel->files, sel->num_files * sizeof(char *));
if (t2)
if (t2)
{
sel->files = t2;
sel->files[sel->num_files - 1] = strdup(tmp);
@ -790,7 +865,10 @@ _ecore_xcb_selection_parser_files(const char *target, void *data, int size, int
}
static void *
_ecore_xcb_selection_parser_targets(const char *target __UNUSED__, void *data, int size, int format __UNUSED__)
_ecore_xcb_selection_parser_targets(const char *target __UNUSED__,
void *data,
int size,
int format __UNUSED__)
{
Ecore_X_Selection_Data_Targets *sel;
unsigned long *targets;
@ -806,7 +884,7 @@ _ecore_xcb_selection_parser_targets(const char *target __UNUSED__, void *data, i
sel->num_targets = (size - 2);
sel->targets = malloc((size - 2) * sizeof(char *));
if (!sel->targets)
if (!sel->targets)
{
free(sel);
return NULL;
@ -821,11 +899,11 @@ _ecore_xcb_selection_parser_targets(const char *target __UNUSED__, void *data, i
cookie = xcb_get_atom_name_unchecked(_ecore_xcb_conn, targets[i]);
reply = xcb_get_atom_name_reply(_ecore_xcb_conn, cookie, NULL);
if (reply)
if (reply)
{
len = xcb_get_atom_name_name_length(reply);
name = (char *)malloc(sizeof(char) * (len + 1));
if (name)
if (name)
{
memcpy(name, xcb_get_atom_name_name(reply), len);
name[len] = '\0';
@ -835,7 +913,7 @@ _ecore_xcb_selection_parser_targets(const char *target __UNUSED__, void *data, i
}
}
ECORE_XCB_SELECTION_DATA(sel)->free =
ECORE_XCB_SELECTION_DATA(sel)->free =
_ecore_xcb_selection_data_targets_free;
ECORE_XCB_SELECTION_DATA(sel)->content = ECORE_X_SELECTION_CONTENT_TARGETS;
ECORE_XCB_SELECTION_DATA(sel)->length = size;
@ -845,9 +923,9 @@ _ecore_xcb_selection_parser_targets(const char *target __UNUSED__, void *data, i
}
/*
static int
_ecore_xcb_selection_data_free(void *data)
{
static int
_ecore_xcb_selection_data_free(void *data)
{
Ecore_X_Selection_Data *sel;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
@ -856,11 +934,11 @@ _ecore_xcb_selection_data_free(void *data)
if (sel->data) free(sel->data);
free(sel);
return 1;
}
*/
}
*/
static int
_ecore_xcb_selection_data_text_free(void *data)
static int
_ecore_xcb_selection_data_text_free(void *data)
{
Ecore_X_Selection_Data_Text *sel;
@ -872,15 +950,15 @@ _ecore_xcb_selection_data_text_free(void *data)
return 1;
}
static int
_ecore_xcb_selection_data_targets_free(void *data)
static int
_ecore_xcb_selection_data_targets_free(void *data)
{
Ecore_X_Selection_Data_Targets *sel;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
if (!(sel = data)) return 0;
if (sel->targets)
if (sel->targets)
{
int i = 0;
@ -892,15 +970,15 @@ _ecore_xcb_selection_data_targets_free(void *data)
return 1;
}
static int
_ecore_xcb_selection_data_files_free(void *data)
static int
_ecore_xcb_selection_data_files_free(void *data)
{
Ecore_X_Selection_Data_Files *sel;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
if (!(sel = data)) return 0;
if (sel->files)
if (sel->files)
{
int i = 0;
@ -912,8 +990,8 @@ _ecore_xcb_selection_data_files_free(void *data)
return 0;
}
static int
_ecore_xcb_selection_data_default_free(void *data)
static int
_ecore_xcb_selection_data_default_free(void *data)
{
Ecore_X_Selection_Data *sel;
@ -923,8 +1001,8 @@ _ecore_xcb_selection_data_default_free(void *data)
return 1;
}
static Ecore_X_Atom
_ecore_xcb_selection_target_atom_get(const char *target)
static Ecore_X_Atom
_ecore_xcb_selection_target_atom_get(const char *target)
{
Ecore_X_Atom x_target;
@ -945,7 +1023,7 @@ _ecore_xcb_selection_target_atom_get(const char *target)
}
char *
_ecore_xcb_selection_target_get(Ecore_X_Atom target)
_ecore_xcb_selection_target_get(Ecore_X_Atom target)
{
if (target == ECORE_X_ATOM_FILE_NAME)
return strdup(ECORE_X_SELECTION_TARGET_FILENAME);
@ -958,3 +1036,4 @@ _ecore_xcb_selection_target_get(Ecore_X_Atom target)
else
return ecore_x_atom_name_get(target);
}

View File

@ -6,8 +6,8 @@
/* external variables */
int _ecore_xcb_event_shape = -1;
void
_ecore_xcb_shape_init(void)
void
_ecore_xcb_shape_init(void)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
@ -16,8 +16,8 @@ _ecore_xcb_shape_init(void)
#endif
}
void
_ecore_xcb_shape_finalize(void)
void
_ecore_xcb_shape_finalize(void)
{
#ifdef ECORE_XCB_SHAPE
const xcb_query_extension_reply_t *ext_reply;
@ -27,7 +27,7 @@ _ecore_xcb_shape_finalize(void)
#ifdef ECORE_XCB_SHAPE
ext_reply = xcb_get_extension_data(_ecore_xcb_conn, &xcb_shape_id);
if ((ext_reply) && (ext_reply->present))
if ((ext_reply) && (ext_reply->present))
{
xcb_shape_query_version_cookie_t cookie;
xcb_shape_query_version_reply_t *reply;
@ -36,7 +36,7 @@ _ecore_xcb_shape_finalize(void)
_shape_avail = EINA_FALSE;
cookie = xcb_shape_query_version_unchecked(_ecore_xcb_conn);
reply = xcb_shape_query_version_reply(_ecore_xcb_conn, cookie, NULL);
if (reply)
if (reply)
{
_shape_avail = EINA_TRUE;
free(reply);
@ -47,3 +47,4 @@ _ecore_xcb_shape_finalize(void)
}
#endif
}

View File

@ -9,8 +9,8 @@ static Eina_Bool _sync_avail = EINA_FALSE;
/* external variables */
int _ecore_xcb_event_sync = -1;
void
_ecore_xcb_sync_init(void)
void
_ecore_xcb_sync_init(void)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
@ -19,8 +19,8 @@ _ecore_xcb_sync_init(void)
#endif
}
void
_ecore_xcb_sync_finalize(void)
void
_ecore_xcb_sync_finalize(void)
{
#ifdef ECORE_XCB_SYNC
const xcb_query_extension_reply_t *ext_reply;
@ -30,17 +30,17 @@ _ecore_xcb_sync_finalize(void)
#ifdef ECORE_XCB_SYNC
ext_reply = xcb_get_extension_data(_ecore_xcb_conn, &xcb_sync_id);
if ((ext_reply) && (ext_reply->present))
if ((ext_reply) && (ext_reply->present))
{
xcb_sync_initialize_cookie_t cookie;
xcb_sync_initialize_reply_t *reply;
cookie =
xcb_sync_initialize_unchecked(_ecore_xcb_conn,
XCB_SYNC_MAJOR_VERSION,
cookie =
xcb_sync_initialize_unchecked(_ecore_xcb_conn,
XCB_SYNC_MAJOR_VERSION,
XCB_SYNC_MINOR_VERSION);
reply = xcb_sync_initialize_reply(_ecore_xcb_conn, cookie, NULL);
if (reply)
if (reply)
{
if (reply->major_version >= 3) _sync_avail = EINA_TRUE;
free(reply);
@ -52,8 +52,9 @@ _ecore_xcb_sync_finalize(void)
#endif
}
void
_ecore_xcb_sync_magic_send(int val, Ecore_X_Window win)
void
_ecore_xcb_sync_magic_send(int val,
Ecore_X_Window win)
{
xcb_client_message_event_t ev;
@ -68,14 +69,14 @@ _ecore_xcb_sync_magic_send(int val, Ecore_X_Window win)
ev.data.data32[1] = (0x10000000 + val);
ev.data.data32[2] = win;
xcb_send_event(_ecore_xcb_conn, 0, win, XCB_EVENT_MASK_NO_EVENT,
xcb_send_event(_ecore_xcb_conn, 0, win, XCB_EVENT_MASK_NO_EVENT,
(const char *)&ev);
// ecore_x_flush();
}
/* public functions */
EAPI Ecore_X_Sync_Alarm
ecore_x_sync_alarm_new(Ecore_X_Sync_Counter counter)
EAPI Ecore_X_Sync_Alarm
ecore_x_sync_alarm_new(Ecore_X_Sync_Counter counter)
{
#ifdef ECORE_XCB_SYNC
uint32_t list[6], mask;
@ -93,8 +94,8 @@ ecore_x_sync_alarm_new(Ecore_X_Sync_Counter counter)
init.hi = 0;
xcb_sync_set_counter(_ecore_xcb_conn, counter, init);
mask = (XCB_SYNC_CA_COUNTER | XCB_SYNC_CA_VALUE_TYPE |
XCB_SYNC_CA_VALUE | XCB_SYNC_CA_TEST_TYPE |
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);
list[0] = counter;
list[1] = XCB_SYNC_VALUETYPE_ABSOLUTE;
@ -112,8 +113,8 @@ ecore_x_sync_alarm_new(Ecore_X_Sync_Counter counter)
return 0;
}
EAPI Eina_Bool
ecore_x_sync_alarm_free(Ecore_X_Sync_Alarm alarm)
EAPI Eina_Bool
ecore_x_sync_alarm_free(Ecore_X_Sync_Alarm alarm)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
CHECK_XCB_CONN;
@ -129,8 +130,9 @@ ecore_x_sync_alarm_free(Ecore_X_Sync_Alarm alarm)
return EINA_FALSE;
}
EAPI Eina_Bool
ecore_x_sync_counter_query(Ecore_X_Sync_Counter counter, unsigned int *val)
EAPI Eina_Bool
ecore_x_sync_counter_query(Ecore_X_Sync_Counter counter,
unsigned int *val)
{
#ifdef ECORE_XCB_SYNC
xcb_sync_query_counter_cookie_t cookie;
@ -145,7 +147,7 @@ ecore_x_sync_counter_query(Ecore_X_Sync_Counter counter, unsigned int *val)
#ifdef ECORE_XCB_SYNC
cookie = xcb_sync_query_counter_unchecked(_ecore_xcb_conn, counter);
reply = xcb_sync_query_counter_reply(_ecore_xcb_conn, cookie, NULL);
if (reply)
if (reply)
{
if (val) *val = (unsigned int)reply->counter_value.lo;
free(reply);
@ -155,8 +157,9 @@ ecore_x_sync_counter_query(Ecore_X_Sync_Counter counter, unsigned int *val)
return EINA_FALSE;
}
EAPI void
ecore_x_sync_counter_inc(Ecore_X_Sync_Counter counter, int by)
EAPI void
ecore_x_sync_counter_inc(Ecore_X_Sync_Counter counter,
int by)
{
#ifdef ECORE_XCB_SYNC
xcb_sync_int64_t v;
@ -176,8 +179,9 @@ ecore_x_sync_counter_inc(Ecore_X_Sync_Counter counter, int by)
#endif
}
EAPI void
ecore_x_sync_counter_val_wait(Ecore_X_Sync_Counter counter, int val)
EAPI void
ecore_x_sync_counter_val_wait(Ecore_X_Sync_Counter counter,
int val)
{
#ifdef ECORE_XCB_SYNC
xcb_sync_query_counter_cookie_t cookie;
@ -214,8 +218,8 @@ ecore_x_sync_counter_val_wait(Ecore_X_Sync_Counter counter, int val)
#endif
}
EAPI Ecore_X_Sync_Counter
ecore_x_sync_counter_new(int val)
EAPI Ecore_X_Sync_Counter
ecore_x_sync_counter_new(int val)
{
#ifdef ECORE_XCB_SYNC
xcb_sync_counter_t counter;
@ -241,8 +245,8 @@ ecore_x_sync_counter_new(int val)
return 0;
}
EAPI void
ecore_x_sync_counter_free(Ecore_X_Sync_Counter counter)
EAPI void
ecore_x_sync_counter_free(Ecore_X_Sync_Counter counter)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
CHECK_XCB_CONN;
@ -255,8 +259,9 @@ ecore_x_sync_counter_free(Ecore_X_Sync_Counter counter)
#endif
}
EAPI void
ecore_x_sync_counter_set(Ecore_X_Sync_Counter counter, int val)
EAPI void
ecore_x_sync_counter_set(Ecore_X_Sync_Counter counter,
int val)
{
#ifdef ECORE_XCB_SYNC
xcb_sync_int64_t v;
@ -276,8 +281,10 @@ ecore_x_sync_counter_set(Ecore_X_Sync_Counter counter, int val)
#endif
}
EAPI void
ecore_x_sync_counter_2_set(Ecore_X_Sync_Counter counter, int val_hi, unsigned int val_lo)
EAPI void
ecore_x_sync_counter_2_set(Ecore_X_Sync_Counter counter,
int val_hi,
unsigned int val_lo)
{
#ifdef ECORE_XCB_SYNC
xcb_sync_int64_t v;
@ -297,8 +304,10 @@ ecore_x_sync_counter_2_set(Ecore_X_Sync_Counter counter, int val_hi, unsigned in
#endif
}
EAPI Eina_Bool
ecore_x_sync_counter_2_query(Ecore_X_Sync_Counter counter, int *val_hi, unsigned int *val_lo)
EAPI Eina_Bool
ecore_x_sync_counter_2_query(Ecore_X_Sync_Counter counter,
int *val_hi,
unsigned int *val_lo)
{
#ifdef ECORE_XCB_SYNC
xcb_sync_query_counter_cookie_t cookie;
@ -312,8 +321,8 @@ ecore_x_sync_counter_2_query(Ecore_X_Sync_Counter counter, int *val_hi, unsigned
if ((!_sync_avail) || (!counter)) return EINA_FALSE;
#ifdef ECORE_XCB_SYNC
cookie =
xcb_sync_query_counter_unchecked(_ecore_xcb_conn,
cookie =
xcb_sync_query_counter_unchecked(_ecore_xcb_conn,
(xcb_sync_counter_t)counter);
reply = xcb_sync_query_counter_reply(_ecore_xcb_conn, cookie, NULL);
if (!reply) return EINA_FALSE;
@ -326,3 +335,4 @@ ecore_x_sync_counter_2_query(Ecore_X_Sync_Counter counter, int *val_hi, unsigned
return EINA_FALSE;
}

View File

@ -8,40 +8,59 @@
# define CODESET "INVALID"
#endif
static int _ecore_xcb_textlist_get_buffer_size(Eina_Bool is_wide, void *list, int count);
static int _ecore_xcb_textlist_get_wc_len(wchar_t *wstr);
static void *_ecore_xcb_textlist_alloc_list(Eina_Bool is_wide, int count, int nitems);
static void _ecore_xcb_textlist_copy_list(Eina_Bool is_wide, void *text, char **list, int count);
static wchar_t *_ecore_xcb_textlist_copy_wchar(wchar_t *str1, wchar_t *str2);
static int _ecore_xcb_textlist_len_wchar(wchar_t *str);
static int _ecore_xcb_textlist_get_buffer_size(Eina_Bool is_wide,
void *list,
int count);
static int _ecore_xcb_textlist_get_wc_len(wchar_t *wstr);
static void *_ecore_xcb_textlist_alloc_list(Eina_Bool is_wide,
int count,
int nitems);
static void _ecore_xcb_textlist_copy_list(Eina_Bool is_wide,
void *text,
char **list,
int count);
static wchar_t *_ecore_xcb_textlist_copy_wchar(wchar_t *str1,
wchar_t *str2);
static int _ecore_xcb_textlist_len_wchar(wchar_t *str);
#ifdef HAVE_ICONV
Eina_Bool
_ecore_xcb_utf8_textlist_to_textproperty(char **list, int count, Ecore_Xcb_Encoding_Style style, Ecore_Xcb_Textproperty *ret)
Eina_Bool
_ecore_xcb_utf8_textlist_to_textproperty(char **list,
int count,
Ecore_Xcb_Encoding_Style style,
Ecore_Xcb_Textproperty *ret)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
return _ecore_xcb_textlist_to_textproperty("utf8string", list, count,
return _ecore_xcb_textlist_to_textproperty("utf8string", list, count,
style, ret);
}
#endif
Eina_Bool
_ecore_xcb_mb_textlist_to_textproperty(char **list, int count, Ecore_Xcb_Encoding_Style style, Ecore_Xcb_Textproperty *ret)
Eina_Bool
_ecore_xcb_mb_textlist_to_textproperty(char **list,
int count,
Ecore_Xcb_Encoding_Style style,
Ecore_Xcb_Textproperty *ret)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
return _ecore_xcb_textlist_to_textproperty("multiByte", list, count,
return _ecore_xcb_textlist_to_textproperty("multiByte", list, count,
style, ret);
}
/* NB: This Function May Not Be Correct !!!
/* NB: This Function May Not Be Correct !!!
* (as I do not know text conversion, locales, etc, etc very well)
*
*
* Portions were ripped from libX11 XTextListToTextProperty
*/
Eina_Bool
_ecore_xcb_textlist_to_textproperty(const char *type, char **list, int count, Ecore_Xcb_Encoding_Style style, Ecore_Xcb_Textproperty *ret)
Eina_Bool
_ecore_xcb_textlist_to_textproperty(const char *type,
char **list,
int count,
Ecore_Xcb_Encoding_Style style,
Ecore_Xcb_Textproperty *ret)
{
Eina_Bool is_wide = EINA_FALSE;
Ecore_X_Atom encoding;
@ -62,7 +81,7 @@ _ecore_xcb_textlist_to_textproperty(const char *type, char **list, int count, Ec
len = _ecore_xcb_textlist_get_buffer_size(is_wide, list, count);
if (!(buff = (char *)malloc(len * sizeof(char)))) return EINA_FALSE;
from_type = nl_langinfo(CODESET);
switch (style)
switch (style)
{
case XcbStringStyle:
case XcbStdICCTextStyle:
@ -70,25 +89,28 @@ _ecore_xcb_textlist_to_textproperty(const char *type, char **list, int count, Ec
to_type = nl_langinfo(CODESET);
// to_type = "string";
break;
case XcbUTF8StringStyle:
encoding = ECORE_X_ATOM_UTF8_STRING;
to_type = "UTF-8";
break;
case XcbCompoundTextStyle:
encoding = ECORE_X_ATOM_COMPOUND_TEXT;
to_type = nl_langinfo(CODESET);
// to_type = "compoundText";
break;
case XcbTextStyle:
encoding = ECORE_X_ATOM_TEXT;
to_type = nl_langinfo(CODESET);
// to_type = "multiByte";
if (!is_wide)
if (!is_wide)
{
nitems = 0;
mb = (char **)list;
to = buff;
for (i = 0; ((i < count) && (len > 0)); i++)
for (i = 0; ((i < count) && (len > 0)); i++)
{
if (*mb) strcpy(to, *mb);
else *to = '\0';
@ -101,13 +123,14 @@ _ecore_xcb_textlist_to_textproperty(const char *type, char **list, int count, Ec
goto done;
}
break;
default:
free(buff);
return EINA_FALSE;
break;
}
if (count < 1)
if (count < 1)
{
nitems = 0;
goto done;
@ -126,15 +149,15 @@ retry:
to = buff;
to_left = len;
unconv_num = 0;
for (i = 1; to_left > 0; i++)
for (i = 1; to_left > 0; i++)
{
if (is_wide)
if (is_wide)
{
from = (char *)*wc;
from_left = _ecore_xcb_textlist_get_wc_len(*wc);
wc++;
}
else
else
{
from = *mb;
from_left = (*mb ? strlen(*mb) : 0);
@ -145,8 +168,8 @@ retry:
val = iconv(conv, &from, &from_left, &to, &to_left);
#endif
if (val < 0) continue;
if ((val > 0) && (style == XcbStdICCTextStyle) &&
(encoding == ECORE_X_ATOM_STRING))
if ((val > 0) && (style == XcbStdICCTextStyle) &&
(encoding == ECORE_X_ATOM_STRING))
{
#ifdef HAVE_ICONV
iconv_close(conv);
@ -157,7 +180,7 @@ retry:
unconv_num += val;
*to++ = '\0';
to_left --;
to_left--;
if (i >= count) break;
}
@ -168,12 +191,12 @@ retry:
done:
if (nitems <= 0) nitems = 1;
if (!(value = (char *)malloc(nitems * sizeof(char))))
if (!(value = (char *)malloc(nitems * sizeof(char))))
{
free(buff);
return EINA_FALSE;
}
if (nitems == 1)
if (nitems == 1)
*value = 0;
else
memcpy(value, buff, nitems);
@ -189,27 +212,35 @@ done:
}
#ifdef HAVE_ICONV
Eina_Bool
_ecore_xcb_utf8_textproperty_to_textlist(const Ecore_Xcb_Textproperty *text_prop, char ***list_ret, int *count_ret)
Eina_Bool
_ecore_xcb_utf8_textproperty_to_textlist(const Ecore_Xcb_Textproperty *text_prop,
char ***list_ret,
int *count_ret)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
return _ecore_xcb_textproperty_to_textlist(text_prop, "utf8String",
return _ecore_xcb_textproperty_to_textlist(text_prop, "utf8String",
list_ret, count_ret);
}
#endif
Eina_Bool
_ecore_xcb_mb_textproperty_to_textlist(const Ecore_Xcb_Textproperty *text_prop, char ***list_ret, int *count_ret)
Eina_Bool
_ecore_xcb_mb_textproperty_to_textlist(const Ecore_Xcb_Textproperty *text_prop,
char ***list_ret,
int *count_ret)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
return _ecore_xcb_textproperty_to_textlist(text_prop, "multiByte",
return _ecore_xcb_textproperty_to_textlist(text_prop, "multiByte",
list_ret, count_ret);
}
Eina_Bool
_ecore_xcb_textproperty_to_textlist(const Ecore_Xcb_Textproperty *text_prop, const char *type, char ***list_ret, int *count_ret)
Eina_Bool
_ecore_xcb_textproperty_to_textlist(const Ecore_Xcb_Textproperty *text_prop,
const char *type,
char ***list_ret,
int *count_ret)
{
Eina_Bool is_wide = EINA_FALSE;
Eina_Bool do_strcpy = EINA_FALSE;
@ -237,7 +268,7 @@ _ecore_xcb_textproperty_to_textlist(const Ecore_Xcb_Textproperty *text_prop, con
if (is_wide)
len = (text_prop->nitems + 1) * sizeof(wchar_t);
else
else
{
if (!strcmp(type, "utf8String"))
len = text_prop->nitems * 6 + 1;
@ -253,12 +284,12 @@ _ecore_xcb_textproperty_to_textlist(const Ecore_Xcb_Textproperty *text_prop, con
if (!strcmp(from_type, type))
do_strcpy = EINA_TRUE;
else
else
{
#ifdef HAVE_ICONV
conv = iconv_open(type, from_type);
#endif
if (!conv)
if (!conv)
{
free(buff);
return EINA_FALSE;
@ -267,14 +298,14 @@ _ecore_xcb_textproperty_to_textlist(const Ecore_Xcb_Textproperty *text_prop, con
lptr = sptr = text_prop->value;
num = *count_ret = 0;
while (1)
while (1)
{
if ((nitems == 0) || (*sptr == 0))
if ((nitems == 0) || (*sptr == 0))
{
from = lptr;
from_left = sptr - lptr;
lptr = sptr;
if (do_strcpy)
if (do_strcpy)
{
int l = 0;
@ -294,13 +325,13 @@ _ecore_xcb_textproperty_to_textlist(const Ecore_Xcb_Textproperty *text_prop, con
(*count_ret)++;
if (nitems == 0) break;
lptr = ++sptr;
if (is_wide)
if (is_wide)
{
*((wchar_t *)to) = (wchar_t)0;
to += sizeof(wchar_t);
to_left -= sizeof(wchar_t);
}
else
else
{
*((char *)to) = '\0';
to++;
@ -317,20 +348,20 @@ _ecore_xcb_textproperty_to_textlist(const Ecore_Xcb_Textproperty *text_prop, con
if (!do_strcpy) iconv_close(conv);
#endif
if (is_wide)
if (is_wide)
{
*((wchar_t *)to) = (wchar_t)0;
to_left -= sizeof(wchar_t);
}
else
else
{
*((char *)to) = '\0';
to_left--;
}
*list_ret =
*list_ret =
_ecore_xcb_textlist_alloc_list(is_wide, *count_ret, (len - to_left));
if (*list_ret)
if (*list_ret)
_ecore_xcb_textlist_copy_list(is_wide, buff, *list_ret, *count_ret);
free(buff);
@ -338,22 +369,24 @@ _ecore_xcb_textproperty_to_textlist(const Ecore_Xcb_Textproperty *text_prop, con
return EINA_TRUE;
}
static int
_ecore_xcb_textlist_get_buffer_size(Eina_Bool is_wide, void *list, int count)
static int
_ecore_xcb_textlist_get_buffer_size(Eina_Bool is_wide,
void *list,
int count)
{
int len = 0;
char **mb;
wchar_t **wc;
if (!list) return 0;
if (is_wide)
if (is_wide)
{
wc = (wchar_t **)list;
for (; count-- > 0; wc++)
if (*wc) len += _ecore_xcb_textlist_get_wc_len(*wc) + 1;
for (; count-- > 0; wc++)
if (*wc) len += _ecore_xcb_textlist_get_wc_len(*wc) + 1;
len *= 5;
}
else
else
{
mb = (char **)list;
for (; count-- > 0; mb++)
@ -364,8 +397,8 @@ _ecore_xcb_textlist_get_buffer_size(Eina_Bool is_wide, void *list, int count)
return len;
}
static int
_ecore_xcb_textlist_get_wc_len(wchar_t *wstr)
static int
_ecore_xcb_textlist_get_wc_len(wchar_t *wstr)
{
wchar_t *ptr;
@ -373,34 +406,36 @@ _ecore_xcb_textlist_get_wc_len(wchar_t *wstr)
while (*ptr)
ptr++;
return (ptr - wstr);
return ptr - wstr;
}
static void *
_ecore_xcb_textlist_alloc_list(Eina_Bool is_wide, int count, int nitems)
_ecore_xcb_textlist_alloc_list(Eina_Bool is_wide,
int count,
int nitems)
{
if (is_wide)
if (is_wide)
{
wchar_t **list;
list = (wchar_t **)malloc(count * sizeof(wchar_t *));
if (!list) return NULL;
*list = (wchar_t *)malloc(nitems * sizeof(wchar_t));
if (!*list)
if (!*list)
{
free(list);
return NULL;
}
return *list;
}
else
else
{
char **list;
list = (char **)malloc(count * sizeof(char *));
if (!list) return NULL;
*list = (char *)malloc(nitems * sizeof(char));
if (!*list)
if (!*list)
{
free(list);
return NULL;
@ -409,18 +444,21 @@ _ecore_xcb_textlist_alloc_list(Eina_Bool is_wide, int count, int nitems)
}
}
static void
_ecore_xcb_textlist_copy_list(Eina_Bool is_wide, void *text, char **list, int count)
static void
_ecore_xcb_textlist_copy_list(Eina_Bool is_wide,
void *text,
char **list,
int count)
{
int len = 0;
if (is_wide)
if (is_wide)
{
wchar_t *txt, *str, **wlist;
txt = (wchar_t *)text;
wlist = (wchar_t **)list;
for (str = *wlist; count > 0; count--, wlist++)
for (str = *wlist; count > 0; count--, wlist++)
{
_ecore_xcb_textlist_copy_wchar(str, txt);
*wlist = str;
@ -429,13 +467,13 @@ _ecore_xcb_textlist_copy_list(Eina_Bool is_wide, void *text, char **list, int co
txt += len;
}
}
else
else
{
char *txt, *str, **slist;
txt = (char *)text;
slist = (char **)list;
for (str = *slist; count > 0; count--, slist++)
for (str = *slist; count > 0; count--, slist++)
{
strcpy(str, txt);
*slist = str;
@ -447,7 +485,8 @@ _ecore_xcb_textlist_copy_list(Eina_Bool is_wide, void *text, char **list, int co
}
static wchar_t *
_ecore_xcb_textlist_copy_wchar(wchar_t *str1, wchar_t *str2)
_ecore_xcb_textlist_copy_wchar(wchar_t *str1,
wchar_t *str2)
{
wchar_t *tmp;
@ -457,13 +496,14 @@ _ecore_xcb_textlist_copy_wchar(wchar_t *str1, wchar_t *str2)
return tmp;
}
static int
_ecore_xcb_textlist_len_wchar(wchar_t *str)
static int
_ecore_xcb_textlist_len_wchar(wchar_t *str)
{
wchar_t *ptr;
ptr = str;
while (*ptr)
while (*ptr)
ptr++;
return (ptr - str);
return ptr - str;
}

View File

@ -3,7 +3,7 @@
# include <dlfcn.h>
# include <X11/Xlib-xcb.h>
#define ECORE_XCB_VSYNC_DRI2 1
#define ECORE_XCB_VSYNC_DRI2 1
#define DRM_EVENT_CONTEXT_VERSION 2
#ifdef ECORE_XCB_VSYNC_DRI2
@ -26,51 +26,76 @@ typedef enum
typedef struct _drmVBlankReq
{
drmVBlankSeqType type;
unsigned int sequence;
unsigned long signal;
unsigned int sequence;
unsigned long signal;
} drmVBlankReq;
typedef struct _drmVBlankReply
{
drmVBlankSeqType type;
unsigned int sequence;
long tval_sec, tval_usec;
unsigned int sequence;
long tval_sec, tval_usec;
} drmVBlankReply;
typedef union _drmVBlank
{
drmVBlankReq request;
drmVBlankReq request;
drmVBlankReply reply;
} drmVBlank;
typedef struct _drmEventContext
{
int version;
void (*vblank_handler)(int fd, unsigned int sequence, unsigned int tv_sec, unsigned int tv_usec, void *user_data);
void (*page_flip_handler)(int fd, unsigned int sequence, unsigned int tv_sec, unsigned int tv_usec, void *user_data);
void (*vblank_handler)(int fd,
unsigned int sequence,
unsigned int tv_sec,
unsigned int tv_usec,
void *user_data);
void (*page_flip_handler)(int fd,
unsigned int sequence,
unsigned int tv_sec,
unsigned int tv_usec,
void *user_data);
} drmEventContext;
static int (*sym_drmClose) (int fd) = NULL;
static int (*sym_drmGetMagic) (int fd, drm_magic_t * magic) = NULL;
static int (*sym_drmWaitVBlank) (int fd, drmVBlank *vbl) = NULL;
static int (*sym_drmHandleEvent) (int fd, drmEventContext *evctx) = NULL;
static int (*sym_drmClose)(int fd) = NULL;
static int (*sym_drmGetMagic)(int fd,
drm_magic_t *magic) = NULL;
static int (*sym_drmWaitVBlank)(int fd,
drmVBlank *vbl) = NULL;
static int (*sym_drmHandleEvent)(int fd,
drmEventContext *evctx) = NULL;
/* dri */
static Bool (*sym_DRI2QueryExtension) (Display *display, int *eventBase, int *errorBase) = NULL;
static Bool (*sym_DRI2QueryVersion) (Display *display, int *major, int *minor) = NULL;
static Bool (*sym_DRI2Connect) (Display *display, XID window, char **driverName, char **deviceName) = NULL;
static Bool (*sym_DRI2Authenticate) (Display *display, XID window, drm_magic_t magic) = NULL;
static Bool (*sym_DRI2QueryExtension)(Display *display,
int *eventBase,
int *errorBase) = NULL;
static Bool (*sym_DRI2QueryVersion)(Display *display,
int *major,
int *minor) = NULL;
static Bool (*sym_DRI2Connect)(Display *display,
XID window,
char **driverName,
char **deviceName) = NULL;
static Bool (*sym_DRI2Authenticate)(Display *display,
XID window,
drm_magic_t magic) = NULL;
/* local function prototypes */
static Eina_Bool _ecore_xcb_dri_link(void);
static Eina_Bool _ecore_xcb_dri_start(void);
static void _ecore_xcb_dri_shutdown(void);
static void _ecore_xcb_dri_shutdown(void);
static Eina_Bool _ecore_xcb_dri_cb(void *data __UNUSED__, Ecore_Fd_Handler *fdh __UNUSED__);
static void _ecore_xcb_dri_tick_begin(void *data __UNUSED__);
static void _ecore_xcb_dri_tick_end(void *data __UNUSED__);
static void _ecore_xcb_dri_tick_schedule(void);
static void _ecore_xcb_dri_vblank_handler(int fd __UNUSED__, unsigned int frame __UNUSED__, unsigned int sec __UNUSED__, unsigned int usec __UNUSED__, void *data __UNUSED__);
static Eina_Bool _ecore_xcb_dri_cb(void *data __UNUSED__,
Ecore_Fd_Handler *fdh __UNUSED__);
static void _ecore_xcb_dri_tick_begin(void *data __UNUSED__);
static void _ecore_xcb_dri_tick_end(void *data __UNUSED__);
static void _ecore_xcb_dri_tick_schedule(void);
static void _ecore_xcb_dri_vblank_handler(int fd __UNUSED__,
unsigned int frame __UNUSED__,
unsigned int sec __UNUSED__,
unsigned int usec __UNUSED__,
void *data __UNUSED__);
/* local variables */
static Ecore_X_Window _vsync_root = 0;
@ -83,20 +108,20 @@ static void *_dri_lib = NULL;
static drmEventContext _drm_evctx;
#endif
void
_ecore_xcb_dri_init(void)
void
_ecore_xcb_dri_init(void)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
}
void
_ecore_xcb_dri_finalize(void)
void
_ecore_xcb_dri_finalize(void)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
}
EAPI Eina_Bool
ecore_x_vsync_animator_tick_source_set(Ecore_X_Window win)
EAPI Eina_Bool
ecore_x_vsync_animator_tick_source_set(Ecore_X_Window win)
{
#ifdef ECORE_XCB_VSYNC_DRI2
Ecore_X_Window root;
@ -107,18 +132,18 @@ ecore_x_vsync_animator_tick_source_set(Ecore_X_Window win)
#ifdef ECORE_XCB_VSYNC_DRI2
root = ecore_x_window_root_get(win);
if (root != _vsync_root)
if (root != _vsync_root)
{
_vsync_root = root;
if (_vsync_root)
if (_vsync_root)
{
if (!_ecore_xcb_dri_link())
if (!_ecore_xcb_dri_link())
{
ecore_animator_source_set(ECORE_ANIMATOR_SOURCE_TIMER);
return EINA_FALSE;
}
_ecore_xcb_dri_shutdown();
if (!_ecore_xcb_dri_start())
if (!_ecore_xcb_dri_start())
{
_vsync_root = 0;
ecore_animator_source_set(ECORE_ANIMATOR_SOURCE_TIMER);
@ -130,9 +155,9 @@ ecore_x_vsync_animator_tick_source_set(Ecore_X_Window win)
(_ecore_xcb_dri_tick_end, NULL);
ecore_animator_source_set(ECORE_ANIMATOR_SOURCE_CUSTOM);
}
else
else
{
if (_drm_fd >= 0)
if (_drm_fd >= 0)
{
_ecore_xcb_dri_shutdown();
ecore_animator_custom_source_tick_begin_callback_set
@ -152,57 +177,57 @@ ecore_x_vsync_animator_tick_source_set(Ecore_X_Window win)
/* local functions */
#ifdef ECORE_XCB_VSYNC_DRI2
static Eina_Bool
_ecore_xcb_dri_link(void)
static Eina_Bool
_ecore_xcb_dri_link(void)
{
const char *_drm_libs[] =
{
"libdrm.so.2",
"libdrm.so.1",
"libdrm.so.0",
"libdrm.so",
NULL,
};
const char *_dri_libs[] =
{
"libdri2.so.2",
"libdri2.so.1",
"libdri2.so.0",
"libdri2.so",
"libGL.so.4",
"libGL.so.3",
"libGL.so.2",
"libGL.so.1",
"libGL.so.0",
"libGL.so",
NULL,
};
const char *_drm_libs[] =
{
"libdrm.so.2",
"libdrm.so.1",
"libdrm.so.0",
"libdrm.so",
NULL,
};
const char *_dri_libs[] =
{
"libdri2.so.2",
"libdri2.so.1",
"libdri2.so.0",
"libdri2.so",
"libGL.so.4",
"libGL.so.3",
"libGL.so.2",
"libGL.so.1",
"libGL.so.0",
"libGL.so",
NULL,
};
int i = 0, fail = 0;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
# define SYM(lib, xx) \
do { \
sym_## xx = dlsym(lib, #xx); \
if (!(sym_## xx)) { \
fprintf(stderr, "%s\n", dlerror()); \
fail = 1; \
} \
} while (0);
# define SYM(lib, xx) \
do { \
sym_## xx = dlsym(lib, #xx); \
if (!(sym_## xx)) { \
fprintf(stderr, "%s\n", dlerror()); \
fail = 1; \
} \
} while (0);
if (_drm_lib) return EINA_TRUE;
for (i = 0; _drm_libs[i]; i++)
for (i = 0; _drm_libs[i]; i++)
{
_drm_lib = dlopen(_drm_libs[i], (RTLD_LOCAL | RTLD_LAZY));
if (_drm_lib)
if (_drm_lib)
{
fail = 0;
SYM(_drm_lib, drmClose);
SYM(_drm_lib, drmGetMagic);
SYM(_drm_lib, drmWaitVBlank);
SYM(_drm_lib, drmHandleEvent);
if (fail)
if (fail)
{
dlclose(_drm_lib);
_drm_lib = NULL;
@ -212,16 +237,16 @@ _ecore_xcb_dri_link(void)
}
}
if (!_drm_lib) return EINA_FALSE;
for (i = 0; _dri_libs[i]; i++)
for (i = 0; _dri_libs[i]; i++)
{
if ((_dri_lib = dlopen(_dri_libs[i], (RTLD_LOCAL | RTLD_LAZY))))
if ((_dri_lib = dlopen(_dri_libs[i], (RTLD_LOCAL | RTLD_LAZY))))
{
fail = 0;
SYM(_dri_lib, DRI2QueryExtension);
SYM(_dri_lib, DRI2QueryVersion);
SYM(_dri_lib, DRI2Connect);
SYM(_dri_lib, DRI2Authenticate);
if (fail)
if (fail)
{
dlclose(_dri_lib);
_dri_lib = NULL;
@ -230,7 +255,7 @@ _ecore_xcb_dri_link(void)
break;
}
}
if (!_dri_lib)
if (!_dri_lib)
{
dlclose(_drm_lib);
_drm_lib = NULL;
@ -240,8 +265,8 @@ _ecore_xcb_dri_link(void)
return EINA_TRUE;
}
static Eina_Bool
_ecore_xcb_dri_start(void)
static Eina_Bool
_ecore_xcb_dri_start(void)
{
Ecore_X_Display *disp;
int _dri2_event = 0, _dri2_error = 0;
@ -273,9 +298,9 @@ _ecore_xcb_dri_start(void)
_drm_evctx.vblank_handler = _ecore_xcb_dri_vblank_handler;
_drm_evctx.page_flip_handler = NULL;
_drm_fdh = ecore_main_fd_handler_add(_drm_fd, ECORE_FD_READ,
_drm_fdh = ecore_main_fd_handler_add(_drm_fd, ECORE_FD_READ,
_ecore_xcb_dri_cb, NULL, NULL, NULL);
if (!_drm_fdh)
if (!_drm_fdh)
{
close(_drm_fd);
_drm_fd = -1;
@ -285,43 +310,44 @@ _ecore_xcb_dri_start(void)
return EINA_TRUE;
}
static void
_ecore_xcb_dri_shutdown(void)
static void
_ecore_xcb_dri_shutdown(void)
{
if (_drm_fd >= 0)
if (_drm_fd >= 0)
{
close(_drm_fd);
_drm_fd = -1;
}
if (_drm_fdh)
if (_drm_fdh)
{
ecore_main_fd_handler_del(_drm_fdh);
_drm_fdh = NULL;
}
}
static Eina_Bool
_ecore_xcb_dri_cb(void *data __UNUSED__, Ecore_Fd_Handler *fdh __UNUSED__)
static Eina_Bool
_ecore_xcb_dri_cb(void *data __UNUSED__,
Ecore_Fd_Handler *fdh __UNUSED__)
{
sym_drmHandleEvent(_drm_fd, &_drm_evctx);
return ECORE_CALLBACK_RENEW;
}
static void
_ecore_xcb_dri_tick_begin(void *data __UNUSED__)
static void
_ecore_xcb_dri_tick_begin(void *data __UNUSED__)
{
_drm_event_busy = EINA_TRUE;
_ecore_xcb_dri_tick_schedule();
}
static void
_ecore_xcb_dri_tick_end(void *data __UNUSED__)
static void
_ecore_xcb_dri_tick_end(void *data __UNUSED__)
{
_drm_event_busy = EINA_FALSE;
}
static void
_ecore_xcb_dri_tick_schedule(void)
static void
_ecore_xcb_dri_tick_schedule(void)
{
drmVBlank vbl;
@ -335,10 +361,15 @@ _ecore_xcb_dri_tick_schedule(void)
sym_drmWaitVBlank(_drm_fd, &vbl);
}
static void
_ecore_xcb_dri_vblank_handler(int fd __UNUSED__, unsigned int frame __UNUSED__, unsigned int sec __UNUSED__, unsigned int usec __UNUSED__, void *data __UNUSED__)
static void
_ecore_xcb_dri_vblank_handler(int fd __UNUSED__,
unsigned int frame __UNUSED__,
unsigned int sec __UNUSED__,
unsigned int usec __UNUSED__,
void *data __UNUSED__)
{
ecore_animator_custom_tick();
if (_drm_event_busy) _ecore_xcb_dri_tick_schedule();
}
#endif

File diff suppressed because it is too large Load Diff

View File

@ -1,8 +1,11 @@
#include "ecore_xcb_private.h"
#include <xcb/xcb_icccm.h>
EAPI int
ecore_x_window_prop_card32_get(Ecore_X_Window win, Ecore_X_Atom atom, unsigned int *val, unsigned int len)
EAPI int
ecore_x_window_prop_card32_get(Ecore_X_Window win,
Ecore_X_Atom atom,
unsigned int *val,
unsigned int len)
{
xcb_get_property_cookie_t cookie;
xcb_get_property_reply_t *reply;
@ -11,27 +14,27 @@ ecore_x_window_prop_card32_get(Ecore_X_Window win, Ecore_X_Atom atom, unsigned i
LOGFN(__FILE__, __LINE__, __FUNCTION__);
CHECK_XCB_CONN;
cookie = xcb_get_property_unchecked(_ecore_xcb_conn, 0, win, atom,
cookie = xcb_get_property_unchecked(_ecore_xcb_conn, 0, win, atom,
ECORE_X_ATOM_CARDINAL, 0, 0x7fffffff);
reply = xcb_get_property_reply(_ecore_xcb_conn, cookie, NULL);
if (!reply) return -1;
if ((reply->type != ECORE_X_ATOM_CARDINAL) || (reply->format != 32))
if ((reply->type != ECORE_X_ATOM_CARDINAL) || (reply->format != 32))
num = -1;
else if (reply->value_len == 0)
else if (reply->value_len == 0)
num = 0;
else
else
{
if (reply->value_len < len)
if (reply->value_len < len)
len = reply->value_len;
if (val)
if (val)
{
unsigned int i = 0;
unsigned char *v;
v = xcb_get_property_value(reply);
for (i = 0; i < len; i++)
for (i = 0; i < len; i++)
val[i] = ((unsigned long *)v)[i];
num = len;
}
@ -41,14 +44,17 @@ ecore_x_window_prop_card32_get(Ecore_X_Window win, Ecore_X_Atom atom, unsigned i
return num;
}
EAPI void
ecore_x_window_prop_card32_set(Ecore_X_Window win, Ecore_X_Atom atom, unsigned int *val, unsigned int num)
EAPI void
ecore_x_window_prop_card32_set(Ecore_X_Window win,
Ecore_X_Atom atom,
unsigned int *val,
unsigned int num)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
CHECK_XCB_CONN;
#if SIZEOF_INT == SIZEOF_LONG
xcb_change_property(_ecore_xcb_conn, XCB_PROP_MODE_REPLACE, win, atom,
xcb_change_property(_ecore_xcb_conn, XCB_PROP_MODE_REPLACE, win, atom,
ECORE_X_ATOM_CARDINAL, 32, num, (unsigned char *)val);
// ecore_x_flush();
#else
@ -60,15 +66,17 @@ ecore_x_window_prop_card32_set(Ecore_X_Window win, Ecore_X_Atom atom, unsigned i
for (i = 0; i < num; i++)
v2[i] = val[i];
xcb_change_property(_ecore_xcb_conn, XCB_PROP_MODE_REPLACE, win, atom,
xcb_change_property(_ecore_xcb_conn, XCB_PROP_MODE_REPLACE, win, atom,
ECORE_X_ATOM_CARDINAL, 32, num, (unsigned char *)v2);
free(v2);
// ecore_x_flush();
#endif
}
EAPI int
ecore_x_window_prop_card32_list_get(Ecore_X_Window win, Ecore_X_Atom atom, unsigned int **list)
EAPI int
ecore_x_window_prop_card32_list_get(Ecore_X_Window win,
Ecore_X_Atom atom,
unsigned int **list)
{
xcb_get_property_cookie_t cookie;
xcb_get_property_reply_t *reply;
@ -79,7 +87,7 @@ ecore_x_window_prop_card32_list_get(Ecore_X_Window win, Ecore_X_Atom atom, unsig
if (list) *list = NULL;
cookie = xcb_get_property_unchecked(_ecore_xcb_conn, 0, win, atom,
cookie = xcb_get_property_unchecked(_ecore_xcb_conn, 0, win, atom,
XCB_ATOM_CARDINAL, 0, 0x7fffffff);
reply = xcb_get_property_reply(_ecore_xcb_conn, cookie, NULL);
if (!reply) return -1;
@ -88,17 +96,17 @@ ecore_x_window_prop_card32_list_get(Ecore_X_Window win, Ecore_X_Atom atom, unsig
num = -1;
else if ((reply->value_len == 0) || (!xcb_get_property_value(reply)))
num = 0;
else
else
{
num = reply->value_len;
if (list)
if (list)
{
unsigned int *val;
void *data;
int i = 0;
val = malloc(num * sizeof(unsigned int));
if (!val)
if (!val)
{
free(reply);
return num;
@ -114,16 +122,22 @@ ecore_x_window_prop_card32_list_get(Ecore_X_Window win, Ecore_X_Atom atom, unsig
return num;
}
EAPI int
ecore_x_window_prop_atom_get(Ecore_X_Window win, Ecore_X_Atom atom, Ecore_X_Atom *list, unsigned int len)
EAPI int
ecore_x_window_prop_atom_get(Ecore_X_Window win,
Ecore_X_Atom atom,
Ecore_X_Atom *list,
unsigned int len)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
return ecore_x_window_prop_xid_get(win, atom, ECORE_X_ATOM_ATOM, list, len);
}
EAPI void
ecore_x_window_prop_atom_set(Ecore_X_Window win, Ecore_X_Atom atom, Ecore_X_Atom *list, unsigned int num)
EAPI void
ecore_x_window_prop_atom_set(Ecore_X_Window win,
Ecore_X_Atom atom,
Ecore_X_Atom *list,
unsigned int num)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
@ -132,14 +146,18 @@ ecore_x_window_prop_atom_set(Ecore_X_Window win, Ecore_X_Atom atom, Ecore_X_Atom
ecore_x_window_prop_xid_set(win, atom, ECORE_X_ATOM_ATOM, list, num);
}
EAPI void
ecore_x_window_prop_xid_set(Ecore_X_Window win, Ecore_X_Atom atom, Ecore_X_Atom type, Ecore_X_ID *xids, unsigned int num)
EAPI void
ecore_x_window_prop_xid_set(Ecore_X_Window win,
Ecore_X_Atom atom,
Ecore_X_Atom type,
Ecore_X_ID *xids,
unsigned int num)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
CHECK_XCB_CONN;
#if SIZEOF_INT == SIZEOF_LONG
xcb_change_property(_ecore_xcb_conn, XCB_PROP_MODE_REPLACE, win, atom,
xcb_change_property(_ecore_xcb_conn, XCB_PROP_MODE_REPLACE, win, atom,
type, 32, num, (unsigned char *)xids);
// ecore_x_flush();
#else
@ -151,15 +169,19 @@ ecore_x_window_prop_xid_set(Ecore_X_Window win, Ecore_X_Atom atom, Ecore_X_Atom
for (i = 0; i < num; i++)
v2[i] = xids[i];
xcb_change_property(_ecore_xcb_conn, XCB_PROP_MODE_REPLACE, win, atom,
xcb_change_property(_ecore_xcb_conn, XCB_PROP_MODE_REPLACE, win, atom,
type, 32, num, (unsigned char *)v2);
free(v2);
// ecore_x_flush();
#endif
}
EAPI int
ecore_x_window_prop_xid_get(Ecore_X_Window win, Ecore_X_Atom atom, Ecore_X_Atom type, Ecore_X_ID *xids, unsigned int len)
EAPI int
ecore_x_window_prop_xid_get(Ecore_X_Window win,
Ecore_X_Atom atom,
Ecore_X_Atom type,
Ecore_X_ID *xids,
unsigned int len)
{
xcb_get_property_cookie_t cookie;
xcb_get_property_reply_t *reply;
@ -169,16 +191,16 @@ ecore_x_window_prop_xid_get(Ecore_X_Window win, Ecore_X_Atom atom, Ecore_X_Atom
CHECK_XCB_CONN;
num = len;
cookie = xcb_get_property_unchecked(_ecore_xcb_conn, 0, win, atom, type,
cookie = xcb_get_property_unchecked(_ecore_xcb_conn, 0, win, atom, type,
0, 0x7fffffff);
reply = xcb_get_property_reply(_ecore_xcb_conn, cookie, NULL);
if (!reply) return -1;
if ((reply->type != type) || (reply->format != 32))
if ((reply->type != type) || (reply->format != 32))
num = -1;
else if (reply->value_len == 0)
num = 0;
else
else
{
unsigned int i = 0;
unsigned char *v;
@ -197,19 +219,22 @@ ecore_x_window_prop_xid_get(Ecore_X_Window win, Ecore_X_Atom atom, Ecore_X_Atom
return num;
}
EAPI void
ecore_x_window_prop_string_set(Ecore_X_Window win, Ecore_X_Atom type, const char *str)
EAPI void
ecore_x_window_prop_string_set(Ecore_X_Window win,
Ecore_X_Atom type,
const char *str)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
CHECK_XCB_CONN;
xcb_change_property(_ecore_xcb_conn, XCB_PROP_MODE_REPLACE, win, type,
xcb_change_property(_ecore_xcb_conn, XCB_PROP_MODE_REPLACE, win, type,
ECORE_X_ATOM_UTF8_STRING, 8, strlen(str), str);
// ecore_x_flush();
}
EAPI char *
ecore_x_window_prop_string_get(Ecore_X_Window win, Ecore_X_Atom type)
ecore_x_window_prop_string_get(Ecore_X_Window win,
Ecore_X_Atom type)
{
xcb_get_property_cookie_t cookie;
xcb_get_property_reply_t *reply;
@ -219,9 +244,9 @@ ecore_x_window_prop_string_get(Ecore_X_Window win, Ecore_X_Atom type)
LOGFN(__FILE__, __LINE__, __FUNCTION__);
CHECK_XCB_CONN;
cookie =
xcb_get_property_unchecked(_ecore_xcb_conn, 0,
win ? win : ((xcb_screen_t *)_ecore_xcb_screen)->root,
cookie =
xcb_get_property_unchecked(_ecore_xcb_conn, 0,
win ? win : ((xcb_screen_t *)_ecore_xcb_screen)->root,
type, XCB_GET_PROPERTY_TYPE_ANY, 0, 1000000L);
reply = xcb_get_property_reply(_ecore_xcb_conn, cookie, NULL);
if (!reply) return NULL;
@ -231,7 +256,7 @@ ecore_x_window_prop_string_get(Ecore_X_Window win, Ecore_X_Atom type)
memcpy(str, xcb_get_property_value(reply), len);
str[len] = '\0';
if (reply->type != ECORE_X_ATOM_UTF8_STRING)
if (reply->type != ECORE_X_ATOM_UTF8_STRING)
{
Ecore_Xcb_Textproperty prop;
int count = 0;
@ -245,9 +270,9 @@ ecore_x_window_prop_string_get(Ecore_X_Window win, Ecore_X_Atom type)
#ifdef HAVE_ICONV
ret = _ecore_xcb_utf8_textproperty_to_textlist(&prop, &list, &count);
#else
ret = _ecore_xcb_mb_textproperty_to_textlist(&prop, &list, &count);
ret = _ecore_xcb_mb_textproperty_to_textlist(&prop, &list, &count);
#endif
if (ret)
if (ret)
{
if (count > 0)
str = strdup(list[0]);
@ -264,38 +289,47 @@ ecore_x_window_prop_string_get(Ecore_X_Window win, Ecore_X_Atom type)
return str;
}
EAPI int
ecore_x_window_prop_window_get(Ecore_X_Window win, Ecore_X_Atom atom, Ecore_X_Window *list, unsigned int len)
EAPI int
ecore_x_window_prop_window_get(Ecore_X_Window win,
Ecore_X_Atom atom,
Ecore_X_Window *list,
unsigned int len)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
return ecore_x_window_prop_xid_get(win, atom, ECORE_X_ATOM_WINDOW, list, len);
}
EAPI void
ecore_x_window_prop_window_set(Ecore_X_Window win, Ecore_X_Atom atom, Ecore_X_Window *list, unsigned int num)
EAPI void
ecore_x_window_prop_window_set(Ecore_X_Window win,
Ecore_X_Atom atom,
Ecore_X_Window *list,
unsigned int num)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
ecore_x_window_prop_xid_set(win, atom, ECORE_X_ATOM_WINDOW, list, num);
}
EAPI int
ecore_x_window_prop_window_list_get(Ecore_X_Window win, Ecore_X_Atom atom, Ecore_X_Window **plst)
EAPI int
ecore_x_window_prop_window_list_get(Ecore_X_Window win,
Ecore_X_Atom atom,
Ecore_X_Window **plst)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
return ecore_x_window_prop_xid_list_get(win, atom, ECORE_X_ATOM_WINDOW, plst);
}
EAPI Ecore_X_Atom
ecore_x_window_prop_any_type(void)
EAPI Ecore_X_Atom
ecore_x_window_prop_any_type(void)
{
return XCB_ATOM_ANY;
}
EAPI void
ecore_x_window_prop_property_del(Ecore_X_Window win, Ecore_X_Atom property)
EAPI void
ecore_x_window_prop_property_del(Ecore_X_Window win,
Ecore_X_Atom property)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
CHECK_XCB_CONN;
@ -303,8 +337,13 @@ ecore_x_window_prop_property_del(Ecore_X_Window win, Ecore_X_Atom property)
xcb_delete_property(_ecore_xcb_conn, win, property);
}
EAPI void
ecore_x_window_prop_property_set(Ecore_X_Window win, Ecore_X_Atom property, Ecore_X_Atom type, int size, void *data, int num)
EAPI void
ecore_x_window_prop_property_set(Ecore_X_Window win,
Ecore_X_Atom property,
Ecore_X_Atom type,
int size,
void *data,
int num)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
CHECK_XCB_CONN;
@ -312,24 +351,24 @@ ecore_x_window_prop_property_set(Ecore_X_Window win, Ecore_X_Atom property, Ecor
if (win == 0)
win = ((xcb_screen_t *)_ecore_xcb_screen)->root;
if (size != 32)
if (size != 32)
{
xcb_change_property(_ecore_xcb_conn, XCB_PROP_MODE_REPLACE, win,
xcb_change_property(_ecore_xcb_conn, XCB_PROP_MODE_REPLACE, win,
property, type, size, num, (unsigned char *)data);
// ecore_x_flush();
}
else
else
{
unsigned long *dat;
int i = 0, *ptr;
dat = malloc(sizeof(unsigned long) * num);
if (dat)
if (dat)
{
for (ptr = (int *)data, i = 0; i < num; i++)
dat[i] = ptr[i];
xcb_change_property(_ecore_xcb_conn, XCB_PROP_MODE_REPLACE, win,
property, type, size, num,
xcb_change_property(_ecore_xcb_conn, XCB_PROP_MODE_REPLACE, win,
property, type, size, num,
(unsigned char *)dat);
free(dat);
// ecore_x_flush();
@ -337,8 +376,13 @@ ecore_x_window_prop_property_set(Ecore_X_Window win, Ecore_X_Atom property, Ecor
}
}
EAPI int
ecore_x_window_prop_property_get(Ecore_X_Window win, Ecore_X_Atom property, Ecore_X_Atom type, int size, unsigned char **data, int *num)
EAPI int
ecore_x_window_prop_property_get(Ecore_X_Window win,
Ecore_X_Atom property,
Ecore_X_Atom type,
int size,
unsigned char **data,
int *num)
{
xcb_get_property_cookie_t cookie;
xcb_get_property_reply_t *reply;
@ -351,7 +395,7 @@ ecore_x_window_prop_property_get(Ecore_X_Window win, Ecore_X_Atom property, Ecor
if (num) *num = 0;
if (data)
if (data)
*data = NULL;
else
return 0;
@ -359,12 +403,12 @@ ecore_x_window_prop_property_get(Ecore_X_Window win, Ecore_X_Atom property, Ecor
if (win == 0)
win = ((xcb_screen_t *)_ecore_xcb_screen)->root;
cookie =
xcb_get_property_unchecked(_ecore_xcb_conn, 0, win,
cookie =
xcb_get_property_unchecked(_ecore_xcb_conn, 0, win,
property, type, 0, LONG_MAX);
reply = xcb_get_property_reply(_ecore_xcb_conn, cookie, NULL);
if (!reply) return 0;
if ((reply->format != size) || (reply->value_len == 0))
if ((reply->format != size) || (reply->value_len == 0))
{
free(reply);
return 0;
@ -377,16 +421,18 @@ ecore_x_window_prop_property_get(Ecore_X_Window win, Ecore_X_Atom property, Ecor
}
value = xcb_get_property_value(reply);
switch (reply->format)
switch (reply->format)
{
case 8:
for (i = 0; i < reply->value_len; i++)
(*data)[i] = ((unsigned char *)value)[i];
break;
case 16:
for (i = 0; i < reply->value_len; i++)
((unsigned short *)*data)[i] = ((unsigned short *)value)[i];
break;
case 32:
for (i = 0; i < reply->value_len; i++)
((unsigned int *)*data)[i] = ((unsigned long *)value)[i];
@ -399,23 +445,31 @@ ecore_x_window_prop_property_get(Ecore_X_Window win, Ecore_X_Atom property, Ecor
return format;
}
EAPI int
ecore_x_window_prop_atom_list_get(Ecore_X_Window win, Ecore_X_Atom atom, Ecore_X_Atom **list)
EAPI int
ecore_x_window_prop_atom_list_get(Ecore_X_Window win,
Ecore_X_Atom atom,
Ecore_X_Atom **list)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
return ecore_x_window_prop_xid_list_get(win, atom, ECORE_X_ATOM_ATOM, list);
}
EAPI void
ecore_x_window_prop_atom_list_change(Ecore_X_Window win, Ecore_X_Atom atom, Ecore_X_Atom item, int op)
EAPI void
ecore_x_window_prop_atom_list_change(Ecore_X_Window win,
Ecore_X_Atom atom,
Ecore_X_Atom item,
int op)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
ecore_x_window_prop_xid_list_change(win, atom, ECORE_X_ATOM_ATOM, item, op);
}
EAPI int
ecore_x_window_prop_xid_list_get(Ecore_X_Window win, Ecore_X_Atom atom, Ecore_X_Atom type, Ecore_X_ID **xids)
EAPI int
ecore_x_window_prop_xid_list_get(Ecore_X_Window win,
Ecore_X_Atom atom,
Ecore_X_Atom type,
Ecore_X_ID **xids)
{
xcb_get_property_cookie_t cookie;
xcb_get_property_reply_t *reply;
@ -426,7 +480,7 @@ ecore_x_window_prop_xid_list_get(Ecore_X_Window win, Ecore_X_Atom atom, Ecore_X_
if (xids) *xids = NULL;
cookie = xcb_get_property_unchecked(_ecore_xcb_conn, 0, win, atom, type,
cookie = xcb_get_property_unchecked(_ecore_xcb_conn, 0, win, atom, type,
0, 0x7fffffff);
reply = xcb_get_property_reply(_ecore_xcb_conn, cookie, NULL);
if (!reply) return -1;
@ -435,15 +489,15 @@ ecore_x_window_prop_xid_list_get(Ecore_X_Window win, Ecore_X_Atom atom, Ecore_X_
num = -1;
else if ((reply->value_len == 0) || (!xcb_get_property_value(reply)))
num = 0;
else
else
{
Ecore_X_Atom *alst;
void *val;
num = xcb_get_property_value_length(reply);
val = xcb_get_property_value(reply);
alst = malloc(num * sizeof(Ecore_X_ID));
if (alst)
if (alst)
{
int i = 0;
@ -457,8 +511,12 @@ ecore_x_window_prop_xid_list_get(Ecore_X_Window win, Ecore_X_Atom atom, Ecore_X_
return num;
}
EAPI void
ecore_x_window_prop_xid_list_change(Ecore_X_Window win, Ecore_X_Atom atom, Ecore_X_Atom type, Ecore_X_ID item, int op)
EAPI void
ecore_x_window_prop_xid_list_change(Ecore_X_Window win,
Ecore_X_Atom atom,
Ecore_X_Atom type,
Ecore_X_ID item,
int op)
{
Ecore_X_ID *lst;
int i = 0, num = 0;
@ -469,12 +527,12 @@ ecore_x_window_prop_xid_list_change(Ecore_X_Window win, Ecore_X_Atom atom, Ecore
num = ecore_x_window_prop_xid_list_get(win, atom, type, &lst);
if (num < 0) return;
for (i = 0; i < num; i++)
for (i = 0; i < num; i++)
{
if (lst[i] == item) break;
}
if (i < num)
if (i < num)
{
if (op == ECORE_X_PROP_LIST_ADD)
goto done;
@ -482,7 +540,7 @@ ecore_x_window_prop_xid_list_change(Ecore_X_Window win, Ecore_X_Atom atom, Ecore
for (; i < num; i++)
lst[i] = lst[i + 1];
}
else
else
{
if (op == ECORE_X_PROP_LIST_REMOVE)
goto done;
@ -496,8 +554,9 @@ done:
if (lst) free(lst);
}
EAPI Eina_Bool
ecore_x_window_prop_protocol_isset(Ecore_X_Window win, Ecore_X_WM_Protocol protocol)
EAPI Eina_Bool
ecore_x_window_prop_protocol_isset(Ecore_X_Window win,
Ecore_X_WM_Protocol protocol)
{
Eina_Bool ret = EINA_FALSE;
Ecore_X_Atom proto;
@ -517,21 +576,21 @@ ecore_x_window_prop_protocol_isset(Ecore_X_Window win, Ecore_X_WM_Protocol proto
proto = _ecore_xcb_atoms_wm_protocol[protocol];
#ifdef OLD_XCB_VERSION
cookie = xcb_get_wm_protocols_unchecked(_ecore_xcb_conn, win,
cookie = xcb_get_wm_protocols_unchecked(_ecore_xcb_conn, win,
ECORE_X_ATOM_WM_PROTOCOLS);
reply = xcb_get_wm_protocols_reply(_ecore_xcb_conn, cookie, &protos, NULL);
#else
cookie = xcb_icccm_get_wm_protocols_unchecked(_ecore_xcb_conn, win,
cookie = xcb_icccm_get_wm_protocols_unchecked(_ecore_xcb_conn, win,
ECORE_X_ATOM_WM_PROTOCOLS);
reply = xcb_icccm_get_wm_protocols_reply(_ecore_xcb_conn, cookie,
reply = xcb_icccm_get_wm_protocols_reply(_ecore_xcb_conn, cookie,
&protos, NULL);
#endif
if (!reply) return EINA_FALSE;
count = protos.atoms_len;
for (i = 0; i < count; i++)
for (i = 0; i < count; i++)
{
if (protos.atoms[i] == proto)
if (protos.atoms[i] == proto)
{
ret = EINA_TRUE;
break;
@ -547,7 +606,8 @@ ecore_x_window_prop_protocol_isset(Ecore_X_Window win, Ecore_X_WM_Protocol proto
}
EAPI Ecore_X_WM_Protocol *
ecore_x_window_prop_protocol_list_get(Ecore_X_Window win, int *num_ret)
ecore_x_window_prop_protocol_list_get(Ecore_X_Window win,
int *num_ret)
{
#ifdef OLD_XCB_VERSION
xcb_get_wm_protocols_reply_t protos;
@ -567,19 +627,19 @@ ecore_x_window_prop_protocol_list_get(Ecore_X_Window win, int *num_ret)
*num_ret = 0;
#ifdef OLD_XCB_VERSION
cookie = xcb_get_wm_protocols_unchecked(_ecore_xcb_conn, win,
cookie = xcb_get_wm_protocols_unchecked(_ecore_xcb_conn, win,
ECORE_X_ATOM_WM_PROTOCOLS);
reply = xcb_get_wm_protocols_reply(_ecore_xcb_conn, cookie, &protos, NULL);
#else
cookie = xcb_icccm_get_wm_protocols_unchecked(_ecore_xcb_conn, win,
cookie = xcb_icccm_get_wm_protocols_unchecked(_ecore_xcb_conn, win,
ECORE_X_ATOM_WM_PROTOCOLS);
reply = xcb_icccm_get_wm_protocols_reply(_ecore_xcb_conn, cookie,
reply = xcb_icccm_get_wm_protocols_reply(_ecore_xcb_conn, cookie,
&protos, NULL);
#endif
if (!reply) return NULL;
count = protos.atoms_len;
if (count <= 0)
if (count <= 0)
{
#ifdef OLD_XCB_VERSION
xcb_get_wm_protocols_reply_wipe(&protos);
@ -590,7 +650,7 @@ ecore_x_window_prop_protocol_list_get(Ecore_X_Window win, int *num_ret)
}
prot_ret = calloc(1, count * sizeof(Ecore_X_WM_Protocol));
if (!prot_ret)
if (!prot_ret)
{
#ifdef OLD_XCB_VERSION
xcb_get_wm_protocols_reply_wipe(&protos);
@ -600,12 +660,12 @@ ecore_x_window_prop_protocol_list_get(Ecore_X_Window win, int *num_ret)
return NULL;
}
for (i = 0; i < count; i++)
for (i = 0; i < count; i++)
{
Ecore_X_WM_Protocol j;
prot_ret[i] = -1;
for (j = 0; j < ECORE_X_WM_PROTOCOL_NUM; j++)
for (j = 0; j < ECORE_X_WM_PROTOCOL_NUM; j++)
{
if (_ecore_xcb_atoms_wm_protocol[j] == protos.atoms[i])
prot_ret[i] = j;
@ -623,7 +683,8 @@ ecore_x_window_prop_protocol_list_get(Ecore_X_Window win, int *num_ret)
}
EAPI Ecore_X_Atom *
ecore_x_window_prop_list(Ecore_X_Window win, int *num)
ecore_x_window_prop_list(Ecore_X_Window win,
int *num)
{
xcb_list_properties_cookie_t cookie;
xcb_list_properties_reply_t *reply;
@ -641,7 +702,7 @@ ecore_x_window_prop_list(Ecore_X_Window win, int *num)
if (!reply) return NULL;
atoms = (Ecore_X_Atom *)malloc(reply->atoms_len * sizeof(Ecore_X_Atom));
if (!atoms)
if (!atoms)
{
free(reply);
return NULL;
@ -656,3 +717,4 @@ ecore_x_window_prop_list(Ecore_X_Window win, int *num)
return atoms;
}

View File

@ -3,14 +3,20 @@
typedef struct _Shadow Shadow;
struct _Shadow
{
Shadow *parent, **children;
Shadow *parent, **children;
Ecore_X_Window win;
int children_num;
short x, y;
int children_num;
short x, y;
unsigned short w, h;
};
static Eina_Bool _inside_rects(Shadow *s, int x, int y, int bx, int by, Ecore_X_Rectangle *rects, int num);
static Eina_Bool _inside_rects(Shadow *s,
int x,
int y,
int bx,
int by,
Ecore_X_Rectangle *rects,
int num);
//static int shadow_count = 0;
static Shadow **shadow_base = NULL;
@ -167,25 +173,26 @@ _ecore_x_window_tree_shadow_populate(void)
}
/*
static void
_ecore_x_window_tree_shadow_start(void)
{
static void
_ecore_x_window_tree_shadow_start(void)
{
shadow_count++;
if (shadow_count > 1) return;
_ecore_x_window_tree_shadow_populate();
}
}
static void
_ecore_x_window_tree_shadow_stop(void)
{
static void
_ecore_x_window_tree_shadow_stop(void)
{
shadow_count--;
if (shadow_count != 0) return;
_ecore_x_window_tree_shadow_free();
}
*/
}
*/
Shadow *
_ecore_x_window_shadow_tree_find_shadow(Shadow *s, Ecore_X_Window win)
_ecore_x_window_shadow_tree_find_shadow(Shadow *s,
Ecore_X_Window win)
{
Shadow *ss;
int i = 0;
@ -198,8 +205,8 @@ _ecore_x_window_shadow_tree_find_shadow(Shadow *s, Ecore_X_Window win)
{
if (!s->children[i]) continue;
if ((ss =
_ecore_x_window_shadow_tree_find_shadow(s->children[i], win)))
if ((ss =
_ecore_x_window_shadow_tree_find_shadow(s->children[i], win)))
return ss;
}
}
@ -217,15 +224,21 @@ _ecore_x_window_shadow_tree_find(Ecore_X_Window base)
{
if (!shadow_base[i]) continue;
if ((s =
_ecore_x_window_shadow_tree_find_shadow(shadow_base[i], base)))
if ((s =
_ecore_x_window_shadow_tree_find_shadow(shadow_base[i], base)))
return s;
}
return NULL;
}
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_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 child;
Ecore_X_Rectangle *rects;
@ -265,8 +278,8 @@ _ecore_x_window_shadow_tree_at_xy_get_shadow(Shadow *s, int bx, int by, int x, i
onward:
if (!skipit)
{
if ((child =
_ecore_x_window_shadow_tree_at_xy_get_shadow(s->children[i], wx, wy, x, y, skip, skip_num)))
if ((child =
_ecore_x_window_shadow_tree_at_xy_get_shadow(s->children[i], wx, wy, x, y, skip, skip_num)))
return child;
}
}
@ -276,7 +289,13 @@ onward:
}
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_shadow_tree_at_xy_get(Ecore_X_Window base,
int bx,
int by,
int x,
int y,
Ecore_X_Window *skip,
int skip_num)
{
Shadow *s;
@ -292,18 +311,24 @@ _ecore_x_window_shadow_tree_at_xy_get(Ecore_X_Window base, int bx, int by, int x
return _ecore_x_window_shadow_tree_at_xy_get_shadow(s, bx, by, x, y, skip, skip_num);
}
static Eina_Bool
_inside_rects(Shadow *s, int x, int y, int bx, int by, Ecore_X_Rectangle *rects, int num)
static Eina_Bool
_inside_rects(Shadow *s,
int x,
int y,
int bx,
int by,
Ecore_X_Rectangle *rects,
int num)
{
Eina_Bool inside = EINA_FALSE;
int i = 0;
if (!rects) return EINA_FALSE;
for (i = 0; i < num; i++)
for (i = 0; i < num; i++)
{
if ((x >= s->x + bx + rects[i].x) &&
(y >= s->y + by + rects[i].y) &&
(x < (int)(s->x + bx + rects[i].x + rects[i].width)) &&
if ((x >= s->x + bx + rects[i].x) &&
(y >= s->y + by + rects[i].y) &&
(x < (int)(s->x + bx + rects[i].x + rects[i].width)) &&
(y < (int)(s->y + by + rects[i].y + rects[i].height)))
{
inside = EINA_TRUE;
@ -327,7 +352,11 @@ _inside_rects(Shadow *s, int x, int y, int bx, int by, Ecore_X_Rectangle *rects,
* @ingroup Ecore_X_Window_Geometry_Group
*/
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)
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);
}
@ -341,7 +370,8 @@ ecore_x_window_shadow_tree_at_xy_with_skip_get(Ecore_X_Window base, int x, int y
* @ingroup Ecore_X_Window_Geometry_Group
*/
EAPI Ecore_X_Window
ecore_x_window_shadow_parent_get(Ecore_X_Window root __UNUSED__, Ecore_X_Window win)
ecore_x_window_shadow_parent_get(Ecore_X_Window root __UNUSED__,
Ecore_X_Window win)
{
Shadow *s;
int i = 0;
@ -375,3 +405,4 @@ ecore_x_window_shadow_tree_flush(void)
{
_ecore_x_window_tree_shadow_free();
}

View File

@ -17,14 +17,15 @@
* window.
* @ingroup Ecore_X_Window_Shape
*/
EAPI void
ecore_x_window_shape_input_mask_set(Ecore_X_Window win, Ecore_X_Pixmap mask)
EAPI void
ecore_x_window_shape_input_mask_set(Ecore_X_Window win,
Ecore_X_Pixmap mask)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
CHECK_XCB_CONN;
#ifdef ECORE_XCB_SHAPE
xcb_shape_mask(_ecore_xcb_conn, XCB_SHAPE_SO_SET, XCB_SHAPE_SK_INPUT,
xcb_shape_mask(_ecore_xcb_conn, XCB_SHAPE_SO_SET, XCB_SHAPE_SK_INPUT,
win, 0, 0, mask);
// ecore_x_flush();
#else
@ -41,14 +42,15 @@ ecore_x_window_shape_input_mask_set(Ecore_X_Window win, Ecore_X_Pixmap mask)
* window.
* @ingroup Ecore_X_Window_Shape
*/
EAPI void
ecore_x_window_shape_mask_set(Ecore_X_Window win, Ecore_X_Pixmap mask)
EAPI void
ecore_x_window_shape_mask_set(Ecore_X_Window win,
Ecore_X_Pixmap mask)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
CHECK_XCB_CONN;
#ifdef ECORE_XCB_SHAPE
xcb_shape_mask(_ecore_xcb_conn, XCB_SHAPE_SO_SET, XCB_SHAPE_SK_BOUNDING,
xcb_shape_mask(_ecore_xcb_conn, XCB_SHAPE_SO_SET, XCB_SHAPE_SK_BOUNDING,
win, 0, 0, mask);
// ecore_x_flush();
#else
@ -58,14 +60,15 @@ ecore_x_window_shape_mask_set(Ecore_X_Window win, Ecore_X_Pixmap mask)
#endif
}
EAPI void
ecore_x_window_shape_window_set(Ecore_X_Window win, Ecore_X_Window shape_win)
EAPI void
ecore_x_window_shape_window_set(Ecore_X_Window win,
Ecore_X_Window shape_win)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
CHECK_XCB_CONN;
#ifdef ECORE_XCB_SHAPE
xcb_shape_combine(_ecore_xcb_conn, XCB_SHAPE_SO_SET, XCB_SHAPE_SK_BOUNDING,
xcb_shape_combine(_ecore_xcb_conn, XCB_SHAPE_SO_SET, XCB_SHAPE_SK_BOUNDING,
XCB_SHAPE_SK_BOUNDING, win, 0, 0, shape_win);
// ecore_x_flush();
#else
@ -75,14 +78,17 @@ ecore_x_window_shape_window_set(Ecore_X_Window win, Ecore_X_Window shape_win)
#endif
}
EAPI void
ecore_x_window_shape_window_set_xy(Ecore_X_Window win, Ecore_X_Window shape_win, int x, int y)
EAPI void
ecore_x_window_shape_window_set_xy(Ecore_X_Window win,
Ecore_X_Window shape_win,
int x,
int y)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
CHECK_XCB_CONN;
#ifdef ECORE_XCB_SHAPE
xcb_shape_combine(_ecore_xcb_conn, XCB_SHAPE_SO_SET, XCB_SHAPE_SK_BOUNDING,
xcb_shape_combine(_ecore_xcb_conn, XCB_SHAPE_SO_SET, XCB_SHAPE_SK_BOUNDING,
XCB_SHAPE_SK_BOUNDING, win, x, y, shape_win);
// ecore_x_flush();
#else
@ -94,8 +100,12 @@ ecore_x_window_shape_window_set_xy(Ecore_X_Window win, Ecore_X_Window shape_win,
#endif
}
EAPI void
ecore_x_window_shape_rectangle_set(Ecore_X_Window win, int x, int y, int w, int h)
EAPI void
ecore_x_window_shape_rectangle_set(Ecore_X_Window win,
int x,
int y,
int w,
int h)
{
#ifdef ECORE_XCB_SHAPE
xcb_rectangle_t rect;
@ -109,8 +119,8 @@ ecore_x_window_shape_rectangle_set(Ecore_X_Window win, int x, int y, int w, int
rect.y = y;
rect.width = w;
rect.height = h;
xcb_shape_rectangles(_ecore_xcb_conn, XCB_SHAPE_SO_SET,
XCB_SHAPE_SK_BOUNDING, XCB_CLIP_ORDERING_UNSORTED,
xcb_shape_rectangles(_ecore_xcb_conn, XCB_SHAPE_SO_SET,
XCB_SHAPE_SK_BOUNDING, XCB_CLIP_ORDERING_UNSORTED,
win, 0, 0, 1, &rect);
// ecore_x_flush();
#else
@ -123,8 +133,10 @@ ecore_x_window_shape_rectangle_set(Ecore_X_Window win, int x, int y, int w, int
#endif
}
EAPI void
ecore_x_window_shape_rectangles_set(Ecore_X_Window win, Ecore_X_Rectangle *rects, int num)
EAPI void
ecore_x_window_shape_rectangles_set(Ecore_X_Window win,
Ecore_X_Rectangle *rects,
int num)
{
#ifdef ECORE_XCB_SHAPE
xcb_rectangle_t *rect = NULL;
@ -136,14 +148,14 @@ ecore_x_window_shape_rectangles_set(Ecore_X_Window win, Ecore_X_Rectangle *rects
if (!rects) return;
#ifdef ECORE_XCB_SHAPE
if (num > 0)
if (num > 0)
{
int i = 0;
if (!(rect = malloc(sizeof(xcb_rectangle_t) * num)))
return;
for (i = 0; i < num; i++)
for (i = 0; i < num; i++)
{
rect[i].x = rects[i].x;
rect[i].y = rects[i].y;
@ -151,8 +163,8 @@ ecore_x_window_shape_rectangles_set(Ecore_X_Window win, Ecore_X_Rectangle *rects
rect[i].height = rects[i].height;
}
}
xcb_shape_rectangles(_ecore_xcb_conn, XCB_SHAPE_SO_SET,
XCB_SHAPE_SK_BOUNDING, XCB_CLIP_ORDERING_UNSORTED,
xcb_shape_rectangles(_ecore_xcb_conn, XCB_SHAPE_SO_SET,
XCB_SHAPE_SK_BOUNDING, XCB_CLIP_ORDERING_UNSORTED,
win, 0, 0, num, (xcb_rectangle_t *)rect);
if (rect) free(rect);
@ -165,15 +177,16 @@ ecore_x_window_shape_rectangles_set(Ecore_X_Window win, Ecore_X_Rectangle *rects
#endif
}
EAPI void
ecore_x_window_shape_window_add(Ecore_X_Window win, Ecore_X_Window shape_win)
EAPI void
ecore_x_window_shape_window_add(Ecore_X_Window win,
Ecore_X_Window shape_win)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
CHECK_XCB_CONN;
#ifdef ECORE_XCB_SHAPE
xcb_shape_combine(_ecore_xcb_conn, XCB_SHAPE_SO_UNION,
XCB_SHAPE_SK_BOUNDING, XCB_SHAPE_SK_BOUNDING,
xcb_shape_combine(_ecore_xcb_conn, XCB_SHAPE_SO_UNION,
XCB_SHAPE_SK_BOUNDING, XCB_SHAPE_SK_BOUNDING,
win, 0, 0, shape_win);
// ecore_x_flush();
#else
@ -183,15 +196,18 @@ ecore_x_window_shape_window_add(Ecore_X_Window win, Ecore_X_Window shape_win)
#endif
}
EAPI void
ecore_x_window_shape_window_add_xy(Ecore_X_Window win, Ecore_X_Window shape_win, int x, int y)
EAPI void
ecore_x_window_shape_window_add_xy(Ecore_X_Window win,
Ecore_X_Window shape_win,
int x,
int y)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
CHECK_XCB_CONN;
#ifdef ECORE_XCB_SHAPE
xcb_shape_combine(_ecore_xcb_conn, XCB_SHAPE_SO_UNION,
XCB_SHAPE_SK_BOUNDING, XCB_SHAPE_SK_BOUNDING,
xcb_shape_combine(_ecore_xcb_conn, XCB_SHAPE_SO_UNION,
XCB_SHAPE_SK_BOUNDING, XCB_SHAPE_SK_BOUNDING,
win, x, y, shape_win);
// ecore_x_flush();
#else
@ -203,8 +219,12 @@ ecore_x_window_shape_window_add_xy(Ecore_X_Window win, Ecore_X_Window shape_win,
#endif
}
EAPI void
ecore_x_window_shape_rectangle_add(Ecore_X_Window win, int x, int y, int w, int h)
EAPI void
ecore_x_window_shape_rectangle_add(Ecore_X_Window win,
int x,
int y,
int w,
int h)
{
#ifdef ECORE_XCB_SHAPE
xcb_rectangle_t rect;
@ -218,8 +238,8 @@ ecore_x_window_shape_rectangle_add(Ecore_X_Window win, int x, int y, int w, int
rect.y = y;
rect.width = w;
rect.height = h;
xcb_shape_rectangles(_ecore_xcb_conn, XCB_SHAPE_SO_UNION,
XCB_SHAPE_SK_BOUNDING, XCB_CLIP_ORDERING_UNSORTED,
xcb_shape_rectangles(_ecore_xcb_conn, XCB_SHAPE_SO_UNION,
XCB_SHAPE_SK_BOUNDING, XCB_CLIP_ORDERING_UNSORTED,
win, 0, 0, 1, &rect);
// ecore_x_flush();
#else
@ -232,8 +252,12 @@ ecore_x_window_shape_rectangle_add(Ecore_X_Window win, int x, int y, int w, int
#endif
}
EAPI void
ecore_x_window_shape_rectangle_subtract(Ecore_X_Window win, int x, int y, int w, int h)
EAPI void
ecore_x_window_shape_rectangle_subtract(Ecore_X_Window win,
int x,
int y,
int w,
int h)
{
#ifdef ECORE_XCB_SHAPE
xcb_rectangle_t rect;
@ -247,8 +271,8 @@ ecore_x_window_shape_rectangle_subtract(Ecore_X_Window win, int x, int y, int w,
rect.y = y;
rect.width = w;
rect.height = h;
xcb_shape_rectangles(_ecore_xcb_conn, XCB_SHAPE_SO_SUBTRACT,
XCB_SHAPE_SK_BOUNDING, XCB_CLIP_ORDERING_UNSORTED,
xcb_shape_rectangles(_ecore_xcb_conn, XCB_SHAPE_SO_SUBTRACT,
XCB_SHAPE_SK_BOUNDING, XCB_CLIP_ORDERING_UNSORTED,
win, 0, 0, 1, &rect);
// ecore_x_flush();
#else
@ -261,8 +285,12 @@ ecore_x_window_shape_rectangle_subtract(Ecore_X_Window win, int x, int y, int w,
#endif
}
EAPI void
ecore_x_window_shape_rectangle_clip(Ecore_X_Window win, int x, int y, int w, int h)
EAPI void
ecore_x_window_shape_rectangle_clip(Ecore_X_Window win,
int x,
int y,
int w,
int h)
{
#ifdef ECORE_XCB_SHAPE
xcb_rectangle_t rect;
@ -276,8 +304,8 @@ ecore_x_window_shape_rectangle_clip(Ecore_X_Window win, int x, int y, int w, int
rect.y = y;
rect.width = w;
rect.height = h;
xcb_shape_rectangles(_ecore_xcb_conn, XCB_SHAPE_SO_INTERSECT,
XCB_SHAPE_SK_BOUNDING, XCB_CLIP_ORDERING_UNSORTED,
xcb_shape_rectangles(_ecore_xcb_conn, XCB_SHAPE_SO_INTERSECT,
XCB_SHAPE_SK_BOUNDING, XCB_CLIP_ORDERING_UNSORTED,
win, 0, 0, 1, &rect);
// ecore_x_flush();
#else
@ -290,8 +318,10 @@ ecore_x_window_shape_rectangle_clip(Ecore_X_Window win, int x, int y, int w, int
#endif
}
EAPI void
ecore_x_window_shape_rectangles_add(Ecore_X_Window win, Ecore_X_Rectangle *rects, int num)
EAPI void
ecore_x_window_shape_rectangles_add(Ecore_X_Window win,
Ecore_X_Rectangle *rects,
int num)
{
#ifdef ECORE_XCB_SHAPE
xcb_rectangle_t *rect = NULL;
@ -301,14 +331,14 @@ ecore_x_window_shape_rectangles_add(Ecore_X_Window win, Ecore_X_Rectangle *rects
CHECK_XCB_CONN;
#ifdef ECORE_XCB_SHAPE
if (num > 0)
if (num > 0)
{
int i = 0;
if (!(rect = malloc(sizeof(xcb_rectangle_t) * num)))
return;
for (i = 0; i < num; i++)
for (i = 0; i < num; i++)
{
rect[i].x = rects[i].x;
rect[i].y = rects[i].y;
@ -317,8 +347,8 @@ ecore_x_window_shape_rectangles_add(Ecore_X_Window win, Ecore_X_Rectangle *rects
}
}
xcb_shape_rectangles(_ecore_xcb_conn, XCB_SHAPE_SO_UNION,
XCB_SHAPE_SK_BOUNDING, XCB_CLIP_ORDERING_UNSORTED,
xcb_shape_rectangles(_ecore_xcb_conn, XCB_SHAPE_SO_UNION,
XCB_SHAPE_SK_BOUNDING, XCB_CLIP_ORDERING_UNSORTED,
win, 0, 0, num, (xcb_rectangle_t *)&rect);
if (rect) free(rect);
@ -332,7 +362,8 @@ ecore_x_window_shape_rectangles_add(Ecore_X_Window win, Ecore_X_Rectangle *rects
}
EAPI Ecore_X_Rectangle *
ecore_x_window_shape_rectangles_get(Ecore_X_Window win, int *num_ret)
ecore_x_window_shape_rectangles_get(Ecore_X_Window win,
int *num_ret)
{
Ecore_X_Rectangle *rects = NULL;
#ifdef ECORE_XCB_SHAPE
@ -348,13 +379,13 @@ ecore_x_window_shape_rectangles_get(Ecore_X_Window win, int *num_ret)
if (num_ret) *num_ret = 0;
#ifdef ECORE_XCB_SHAPE
cookie =
cookie =
xcb_shape_get_rectangles(_ecore_xcb_conn, win, XCB_SHAPE_SK_BOUNDING);
reply = xcb_shape_get_rectangles_reply(_ecore_xcb_conn, cookie, NULL);
if (!reply) return NULL;
if (num_ret) *num_ret = reply->rectangles_len;
if (reply->rectangles_len < 1)
if (reply->rectangles_len < 1)
{
free(reply);
if (num_ret) *num_ret = 0;
@ -362,14 +393,14 @@ ecore_x_window_shape_rectangles_get(Ecore_X_Window win, int *num_ret)
}
rects = malloc(sizeof(Ecore_X_Rectangle) * reply->rectangles_len);
if (!rects)
if (!rects)
{
free(reply);
if (num_ret) *num_ret = 0;
return NULL;
}
r = xcb_shape_get_rectangles_rectangles(reply);
for (i = 0; i < reply->rectangles_len; i++)
for (i = 0; i < reply->rectangles_len; i++)
{
rects[i].x = r[i].x;
rects[i].y = r[i].y;
@ -386,8 +417,9 @@ ecore_x_window_shape_rectangles_get(Ecore_X_Window win, int *num_ret)
#endif
}
EAPI void
ecore_x_window_shape_events_select(Ecore_X_Window win, Eina_Bool on)
EAPI void
ecore_x_window_shape_events_select(Ecore_X_Window win,
Eina_Bool on)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
CHECK_XCB_CONN;
@ -403,7 +435,8 @@ ecore_x_window_shape_events_select(Ecore_X_Window win, Eina_Bool on)
}
EAPI Ecore_X_Rectangle *
ecore_x_window_shape_input_rectangles_get(Ecore_X_Window win, int *num_ret)
ecore_x_window_shape_input_rectangles_get(Ecore_X_Window win,
int *num_ret)
{
Ecore_X_Rectangle *rects = NULL;
#ifdef ECORE_XCB_SHAPE
@ -419,13 +452,13 @@ ecore_x_window_shape_input_rectangles_get(Ecore_X_Window win, int *num_ret)
if (num_ret) *num_ret = 0;
#ifdef ECORE_XCB_SHAPE
cookie =
cookie =
xcb_shape_get_rectangles(_ecore_xcb_conn, win, XCB_SHAPE_SK_INPUT);
reply = xcb_shape_get_rectangles_reply(_ecore_xcb_conn, cookie, NULL);
if (!reply) return NULL;
if (num_ret) *num_ret = reply->rectangles_len;
if (reply->rectangles_len < 1)
if (reply->rectangles_len < 1)
{
free(reply);
if (num_ret) *num_ret = 0;
@ -433,14 +466,14 @@ ecore_x_window_shape_input_rectangles_get(Ecore_X_Window win, int *num_ret)
}
rects = malloc(sizeof(Ecore_X_Rectangle) * reply->rectangles_len);
if (!rects)
if (!rects)
{
free(reply);
if (num_ret) *num_ret = 0;
return NULL;
}
r = xcb_shape_get_rectangles_rectangles(reply);
for (i = 0; i < reply->rectangles_len; i++)
for (i = 0; i < reply->rectangles_len; i++)
{
rects[i].x = r[i].x;
rects[i].y = r[i].y;
@ -461,7 +494,7 @@ ecore_x_window_shape_input_rectangles_get(Ecore_X_Window win, int *num_ret)
/* get geometry */
cookie = xcb_get_geometry_unchecked(_ecore_xcb_conn, win);
reply = xcb_get_geometry_reply(_ecore_xcb_conn, cookie, NULL);
if (reply)
if (reply)
{
rects[0].x = reply->x;
rects[0].y = reply->y;
@ -474,8 +507,10 @@ ecore_x_window_shape_input_rectangles_get(Ecore_X_Window win, int *num_ret)
#endif
}
EAPI void
ecore_x_window_shape_input_rectangles_set(Ecore_X_Window win, Ecore_X_Rectangle *rects, int num)
EAPI void
ecore_x_window_shape_input_rectangles_set(Ecore_X_Window win,
Ecore_X_Rectangle *rects,
int num)
{
#ifdef ECORE_XCB_SHAPE
xcb_rectangle_t *rect = NULL;
@ -487,14 +522,14 @@ ecore_x_window_shape_input_rectangles_set(Ecore_X_Window win, Ecore_X_Rectangle
if (!rects) return;
#ifdef ECORE_XCB_SHAPE
if (num > 0)
if (num > 0)
{
int i = 0;
if (!(rect = malloc(sizeof(xcb_rectangle_t) * num)))
return;
for (i = 0; i < num; i++)
for (i = 0; i < num; i++)
{
rect[i].x = rects[i].x;
rect[i].y = rects[i].y;
@ -502,8 +537,8 @@ ecore_x_window_shape_input_rectangles_set(Ecore_X_Window win, Ecore_X_Rectangle
rect[i].height = rects[i].height;
}
}
xcb_shape_rectangles(_ecore_xcb_conn, XCB_SHAPE_SO_SET,
XCB_SHAPE_SK_INPUT, XCB_CLIP_ORDERING_UNSORTED,
xcb_shape_rectangles(_ecore_xcb_conn, XCB_SHAPE_SO_SET,
XCB_SHAPE_SK_INPUT, XCB_CLIP_ORDERING_UNSORTED,
win, 0, 0, num, (xcb_rectangle_t *)rect);
if (rect) free(rect);
@ -516,8 +551,12 @@ ecore_x_window_shape_input_rectangles_set(Ecore_X_Window win, Ecore_X_Rectangle
#endif
}
EAPI void
ecore_x_window_shape_input_rectangle_subtract(Ecore_X_Window win, int x, int y, int w, int h)
EAPI void
ecore_x_window_shape_input_rectangle_subtract(Ecore_X_Window win,
int x,
int y,
int w,
int h)
{
#ifdef ECORE_XCB_SHAPE
xcb_rectangle_t rect;
@ -531,8 +570,8 @@ ecore_x_window_shape_input_rectangle_subtract(Ecore_X_Window win, int x, int y,
rect.y = y;
rect.width = w;
rect.height = h;
xcb_shape_rectangles(_ecore_xcb_conn, XCB_SHAPE_SO_SUBTRACT,
XCB_SHAPE_SK_INPUT, XCB_CLIP_ORDERING_UNSORTED,
xcb_shape_rectangles(_ecore_xcb_conn, XCB_SHAPE_SO_SUBTRACT,
XCB_SHAPE_SK_INPUT, XCB_CLIP_ORDERING_UNSORTED,
win, 0, 0, 1, &rect);
// ecore_x_flush();
#else
@ -545,8 +584,12 @@ ecore_x_window_shape_input_rectangle_subtract(Ecore_X_Window win, int x, int y,
#endif
}
EAPI void
ecore_x_window_shape_input_rectangle_add(Ecore_X_Window win, int x, int y, int w, int h)
EAPI void
ecore_x_window_shape_input_rectangle_add(Ecore_X_Window win,
int x,
int y,
int w,
int h)
{
#ifdef ECORE_XCB_SHAPE
xcb_rectangle_t rect;
@ -560,8 +603,8 @@ ecore_x_window_shape_input_rectangle_add(Ecore_X_Window win, int x, int y, int w
rect.y = y;
rect.width = w;
rect.height = h;
xcb_shape_rectangles(_ecore_xcb_conn, XCB_SHAPE_SO_UNION,
XCB_SHAPE_SK_INPUT, XCB_CLIP_ORDERING_UNSORTED,
xcb_shape_rectangles(_ecore_xcb_conn, XCB_SHAPE_SO_UNION,
XCB_SHAPE_SK_INPUT, XCB_CLIP_ORDERING_UNSORTED,
win, 0, 0, 1, &rect);
// ecore_x_flush();
#else
@ -574,8 +617,12 @@ ecore_x_window_shape_input_rectangle_add(Ecore_X_Window win, int x, int y, int w
#endif
}
EAPI void
ecore_x_window_shape_input_rectangle_set(Ecore_X_Window win, int x, int y, int w, int h)
EAPI void
ecore_x_window_shape_input_rectangle_set(Ecore_X_Window win,
int x,
int y,
int w,
int h)
{
#ifdef ECORE_XCB_SHAPE
xcb_rectangle_t rect;
@ -589,8 +636,8 @@ ecore_x_window_shape_input_rectangle_set(Ecore_X_Window win, int x, int y, int w
rect.y = y;
rect.width = w;
rect.height = h;
xcb_shape_rectangles(_ecore_xcb_conn, XCB_SHAPE_SO_SET,
XCB_SHAPE_SK_INPUT, XCB_CLIP_ORDERING_UNSORTED,
xcb_shape_rectangles(_ecore_xcb_conn, XCB_SHAPE_SO_SET,
XCB_SHAPE_SK_INPUT, XCB_CLIP_ORDERING_UNSORTED,
win, 0, 0, 1, &rect);
// ecore_x_flush();
#else
@ -603,14 +650,17 @@ ecore_x_window_shape_input_rectangle_set(Ecore_X_Window win, int x, int y, int w
#endif
}
EAPI void
ecore_x_window_shape_input_window_set_xy(Ecore_X_Window win, Ecore_X_Window shape_win, int x, int y)
EAPI void
ecore_x_window_shape_input_window_set_xy(Ecore_X_Window win,
Ecore_X_Window shape_win,
int x,
int y)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
CHECK_XCB_CONN;
#ifdef ECORE_XCB_SHAPE
xcb_shape_combine(_ecore_xcb_conn, XCB_SHAPE_SO_SET, XCB_SHAPE_SK_INPUT,
xcb_shape_combine(_ecore_xcb_conn, XCB_SHAPE_SO_SET, XCB_SHAPE_SK_INPUT,
XCB_SHAPE_SK_INPUT, win, x, y, shape_win);
// ecore_x_flush();
#else
@ -622,14 +672,17 @@ ecore_x_window_shape_input_window_set_xy(Ecore_X_Window win, Ecore_X_Window shap
#endif
}
EAPI void
ecore_x_window_shape_input_window_add_xy(Ecore_X_Window win, Ecore_X_Window shape_win, int x, int y)
EAPI void
ecore_x_window_shape_input_window_add_xy(Ecore_X_Window win,
Ecore_X_Window shape_win,
int x,
int y)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
CHECK_XCB_CONN;
#ifdef ECORE_XCB_SHAPE
xcb_shape_combine(_ecore_xcb_conn, XCB_SHAPE_SO_UNION, XCB_SHAPE_SK_INPUT,
xcb_shape_combine(_ecore_xcb_conn, XCB_SHAPE_SO_UNION, XCB_SHAPE_SK_INPUT,
XCB_SHAPE_SK_INPUT, win, x, y, shape_win);
// ecore_x_flush();
#else
@ -641,14 +694,15 @@ ecore_x_window_shape_input_window_add_xy(Ecore_X_Window win, Ecore_X_Window shap
#endif
}
EAPI void
ecore_x_window_shape_input_window_set(Ecore_X_Window win, Ecore_X_Window shape_win)
EAPI void
ecore_x_window_shape_input_window_set(Ecore_X_Window win,
Ecore_X_Window shape_win)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
CHECK_XCB_CONN;
#ifdef ECORE_XCB_SHAPE
xcb_shape_combine(_ecore_xcb_conn, XCB_SHAPE_SO_SET, XCB_SHAPE_SK_INPUT,
xcb_shape_combine(_ecore_xcb_conn, XCB_SHAPE_SO_SET, XCB_SHAPE_SK_INPUT,
XCB_SHAPE_SK_INPUT, win, 0, 0, shape_win);
// ecore_x_flush();
#else
@ -658,8 +712,12 @@ ecore_x_window_shape_input_window_set(Ecore_X_Window win, Ecore_X_Window shape_w
#endif
}
EAPI void
ecore_x_window_shape_input_rectangle_clip(Ecore_X_Window win, int x, int y, int w, int h)
EAPI void
ecore_x_window_shape_input_rectangle_clip(Ecore_X_Window win,
int x,
int y,
int w,
int h)
{
#ifdef ECORE_XCB_SHAPE
xcb_rectangle_t rect;
@ -673,8 +731,8 @@ ecore_x_window_shape_input_rectangle_clip(Ecore_X_Window win, int x, int y, int
rect.y = y;
rect.width = w;
rect.height = h;
xcb_shape_rectangles(_ecore_xcb_conn, XCB_SHAPE_SO_INTERSECT,
XCB_SHAPE_SK_INPUT, XCB_CLIP_ORDERING_UNSORTED,
xcb_shape_rectangles(_ecore_xcb_conn, XCB_SHAPE_SO_INTERSECT,
XCB_SHAPE_SK_INPUT, XCB_CLIP_ORDERING_UNSORTED,
win, 0, 0, 1, &rect);
// ecore_x_flush();
#else
@ -687,8 +745,10 @@ ecore_x_window_shape_input_rectangle_clip(Ecore_X_Window win, int x, int y, int
#endif
}
EAPI void
ecore_x_window_shape_input_rectangles_add(Ecore_X_Window win, Ecore_X_Rectangle *rects, int num)
EAPI void
ecore_x_window_shape_input_rectangles_add(Ecore_X_Window win,
Ecore_X_Rectangle *rects,
int num)
{
#ifdef ECORE_XCB_SHAPE
xcb_rectangle_t *rect = NULL;
@ -698,14 +758,14 @@ ecore_x_window_shape_input_rectangles_add(Ecore_X_Window win, Ecore_X_Rectangle
CHECK_XCB_CONN;
#ifdef ECORE_XCB_SHAPE
if (num > 0)
if (num > 0)
{
int i = 0;
if (!(rect = malloc(sizeof(xcb_rectangle_t) * num)))
return;
for (i = 0; i < num; i++)
for (i = 0; i < num; i++)
{
rect[i].x = rects[i].x;
rect[i].y = rects[i].y;
@ -714,8 +774,8 @@ ecore_x_window_shape_input_rectangles_add(Ecore_X_Window win, Ecore_X_Rectangle
}
}
xcb_shape_rectangles(_ecore_xcb_conn, XCB_SHAPE_SO_UNION,
XCB_SHAPE_SK_INPUT, XCB_CLIP_ORDERING_UNSORTED,
xcb_shape_rectangles(_ecore_xcb_conn, XCB_SHAPE_SO_UNION,
XCB_SHAPE_SK_INPUT, XCB_CLIP_ORDERING_UNSORTED,
win, 0, 0, num, (xcb_rectangle_t *)&rect);
if (rect) free(rect);
@ -727,3 +787,4 @@ ecore_x_window_shape_input_rectangles_add(Ecore_X_Window win, Ecore_X_Rectangle
rects = NULL;
#endif
}

View File

@ -2,14 +2,15 @@
#include <fnmatch.h>
/* local function prototypes */
static Eina_Bool _ecore_xcb_xdefaults_glob_match(const char *str, const char *glob);
static Eina_Bool _ecore_xcb_xdefaults_glob_match(const char *str,
const char *glob);
/* local variables */
static Eina_File *_ecore_xcb_xdefaults_file = NULL;
static char *_ecore_xcb_xdefaults_data = NULL;
void
_ecore_xcb_xdefaults_init(void)
void
_ecore_xcb_xdefaults_init(void)
{
char buff[PATH_MAX];
@ -20,24 +21,25 @@ _ecore_xcb_xdefaults_init(void)
{
eina_mmap_safety_enabled_set(EINA_TRUE);
_ecore_xcb_xdefaults_data =
_ecore_xcb_xdefaults_data =
eina_file_map_all(_ecore_xcb_xdefaults_file, EINA_FILE_SEQUENTIAL);
}
}
void
_ecore_xcb_xdefaults_shutdown(void)
void
_ecore_xcb_xdefaults_shutdown(void)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
if (!_ecore_xcb_xdefaults_file) return;
if (_ecore_xcb_xdefaults_data)
if (_ecore_xcb_xdefaults_data)
eina_file_map_free(_ecore_xcb_xdefaults_file, _ecore_xcb_xdefaults_data);
if (_ecore_xcb_xdefaults_file) eina_file_close(_ecore_xcb_xdefaults_file);
}
char *
_ecore_xcb_xdefaults_string_get(const char *prog, const char *param)
_ecore_xcb_xdefaults_string_get(const char *prog,
const char *param)
{
char buff[1024], ret[1024];
char *str = NULL;
@ -51,9 +53,9 @@ _ecore_xcb_xdefaults_string_get(const char *prog, const char *param)
str = _ecore_xcb_xdefaults_data;
ea = eina_str_split_full(str, "\n", -1, &count);
for (i = 0; i < count; i++)
for (i = 0; i < count; i++)
{
if (_ecore_xcb_xdefaults_glob_match(ea[i], buff))
if (_ecore_xcb_xdefaults_glob_match(ea[i], buff))
sscanf(ea[i], "%*[^:]:%*[ ]%s", ret);
}
if ((ea) && (ea[0]))
@ -65,8 +67,9 @@ _ecore_xcb_xdefaults_string_get(const char *prog, const char *param)
return strdup(ret);
}
int
_ecore_xcb_xdefaults_int_get(const char *prog, const char *param)
int
_ecore_xcb_xdefaults_int_get(const char *prog,
const char *param)
{
char buff[1024];
char *str = NULL;
@ -81,9 +84,9 @@ _ecore_xcb_xdefaults_int_get(const char *prog, const char *param)
str = _ecore_xcb_xdefaults_data;
ea = eina_str_split_full(str, "\n", -1, &count);
for (i = 0; i < count; i++)
for (i = 0; i < count; i++)
{
if (_ecore_xcb_xdefaults_glob_match(ea[i], buff))
if (_ecore_xcb_xdefaults_glob_match(ea[i], buff))
sscanf(ea[i], "%*[^:]:%*[ ]%d", &ret);
}
if ((ea) && (ea[0]))
@ -96,11 +99,12 @@ _ecore_xcb_xdefaults_int_get(const char *prog, const char *param)
}
/* local functions */
static Eina_Bool
_ecore_xcb_xdefaults_glob_match(const char *str, const char *glob)
static Eina_Bool
_ecore_xcb_xdefaults_glob_match(const char *str,
const char *glob)
{
if ((!str) || (!glob)) return EINA_FALSE;
if (glob[0] == 0)
if (glob[0] == 0)
{
if (str[0] == 0) return EINA_TRUE;
return EINA_FALSE;
@ -109,3 +113,4 @@ _ecore_xcb_xdefaults_glob_match(const char *str, const char *glob)
if (!fnmatch(glob, str, 0)) return EINA_TRUE;
return EINA_FALSE;
}

View File

@ -4,8 +4,10 @@
# endif
/* local function prototypes */
static xcb_rectangle_t *_ecore_xcb_rect_to_xcb(Ecore_X_Rectangle *rects, int num);
static Ecore_X_Rectangle *_ecore_xcb_rect_to_ecore(xcb_rectangle_t *rects, int num);
static xcb_rectangle_t *_ecore_xcb_rect_to_xcb(Ecore_X_Rectangle *rects,
int num);
static Ecore_X_Rectangle *_ecore_xcb_rect_to_ecore(xcb_rectangle_t *rects,
int num);
/* local variables */
static Eina_Bool _xfixes_avail = EINA_FALSE;
@ -13,8 +15,8 @@ static Eina_Bool _xfixes_avail = EINA_FALSE;
/* external variables */
int _ecore_xcb_event_xfixes = -1;
void
_ecore_xcb_xfixes_init(void)
void
_ecore_xcb_xfixes_init(void)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
@ -23,8 +25,8 @@ _ecore_xcb_xfixes_init(void)
#endif
}
void
_ecore_xcb_xfixes_finalize(void)
void
_ecore_xcb_xfixes_finalize(void)
{
#ifdef ECORE_XCB_XFIXES
const xcb_query_extension_reply_t *ext_reply;
@ -34,29 +36,29 @@ _ecore_xcb_xfixes_finalize(void)
#ifdef ECORE_XCB_XFIXES
ext_reply = xcb_get_extension_data(_ecore_xcb_conn, &xcb_xfixes_id);
if ((ext_reply) && (ext_reply->present))
if ((ext_reply) && (ext_reply->present))
{
xcb_xfixes_query_version_cookie_t cookie;
xcb_xfixes_query_version_reply_t *reply;
cookie =
xcb_xfixes_query_version_unchecked(_ecore_xcb_conn,
XCB_XFIXES_MAJOR_VERSION,
cookie =
xcb_xfixes_query_version_unchecked(_ecore_xcb_conn,
XCB_XFIXES_MAJOR_VERSION,
XCB_XFIXES_MINOR_VERSION);
reply = xcb_xfixes_query_version_reply(_ecore_xcb_conn, cookie, NULL);
if (reply)
if (reply)
{
/* NB: XFixes Extension >= 3 needed for shape stuff.
* for now, I am removing this check so that it matches the
* xlib code closer. If the extension version ends up being
* for now, I am removing this check so that it matches the
* xlib code closer. If the extension version ends up being
* that important, then re-enable this */
/* if (reply->major_version >= 3) */
_xfixes_avail = EINA_TRUE;
free(reply);
/* if (reply->major_version >= 3) */
_xfixes_avail = EINA_TRUE;
free(reply);
}
if (_xfixes_avail)
if (_xfixes_avail)
_ecore_xcb_event_xfixes = ext_reply->first_event;
}
#endif
@ -83,11 +85,11 @@ ecore_x_fixes_selection_notification_request(Ecore_X_Atom selection)
XCB_XFIXES_SELECTION_EVENT_MASK_SELECTION_WINDOW_DESTROY |
XCB_XFIXES_SELECTION_EVENT_MASK_SELECTION_CLIENT_CLOSE);
cookie =
xcb_xfixes_select_selection_input_checked(_ecore_xcb_conn, root,
cookie =
xcb_xfixes_select_selection_input_checked(_ecore_xcb_conn, root,
selection, mask);
err = xcb_request_check(_ecore_xcb_conn, cookie);
if (err)
if (err)
{
free(err);
return EINA_FALSE;
@ -98,8 +100,8 @@ ecore_x_fixes_selection_notification_request(Ecore_X_Atom selection)
return EINA_FALSE;
}
Eina_Bool
_ecore_xcb_xfixes_avail_get(void)
Eina_Bool
_ecore_xcb_xfixes_avail_get(void)
{
return _xfixes_avail;
}
@ -121,8 +123,9 @@ _ecore_xcb_xfixes_avail_get(void)
* becomes the region.
* @ingroup Ecore_X_Fixes_Group
*/
EAPI Ecore_X_Region
ecore_x_region_new(Ecore_X_Rectangle *rects, int num)
EAPI Ecore_X_Region
ecore_x_region_new(Ecore_X_Rectangle *rects,
int num)
{
Ecore_X_Region region = 0;
#ifdef ECORE_XCB_XFIXES
@ -154,8 +157,8 @@ ecore_x_region_new(Ecore_X_Rectangle *rects, int num)
* (which must be of depth 1, else Match error).
* @ingroup Ecore_X_Fixes_Group
*/
EAPI Ecore_X_Region
ecore_x_region_new_from_bitmap(Ecore_X_Pixmap bitmap)
EAPI Ecore_X_Region
ecore_x_region_new_from_bitmap(Ecore_X_Pixmap bitmap)
{
Ecore_X_Region region = 0;
@ -184,8 +187,9 @@ ecore_x_region_new_from_bitmap(Ecore_X_Pixmap bitmap)
* regions.
* @ingroup Ecore_X_Fixes_Group
*/
EAPI Ecore_X_Region
ecore_x_region_new_from_window(Ecore_X_Window win, Ecore_X_Region_Type type)
EAPI Ecore_X_Region
ecore_x_region_new_from_window(Ecore_X_Window win,
Ecore_X_Region_Type type)
{
Ecore_X_Region region = 0;
@ -211,8 +215,8 @@ ecore_x_region_new_from_window(Ecore_X_Window win, Ecore_X_Region_Type type)
* Creates a region initialized from the clip list of @p gc.
* @ingroup Ecore_X_Fixes_Group
*/
EAPI Ecore_X_Region
ecore_x_region_new_from_gc(Ecore_X_GC gc)
EAPI Ecore_X_Region
ecore_x_region_new_from_gc(Ecore_X_GC gc)
{
Ecore_X_Region region = 0;
@ -238,8 +242,8 @@ ecore_x_region_new_from_gc(Ecore_X_GC gc)
* Creates a region initialized from the clip list of @p picture.
* @ingroup Ecore_X_Fixes_Group
*/
EAPI Ecore_X_Region
ecore_x_region_new_from_picture(Ecore_X_Picture picture)
EAPI Ecore_X_Region
ecore_x_region_new_from_picture(Ecore_X_Picture picture)
{
Ecore_X_Region region = 0;
@ -264,8 +268,8 @@ ecore_x_region_new_from_picture(Ecore_X_Picture picture)
* Destroy the specified @p region.
* @ingroup Ecore_X_Fixes_Group
*/
EAPI void
ecore_x_region_free(Ecore_X_Region region)
EAPI void
ecore_x_region_free(Ecore_X_Region region)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
CHECK_XCB_CONN;
@ -288,8 +292,10 @@ ecore_x_region_free(Ecore_X_Region region)
* by the union of the rectangles @p rects.
* @ingroup Ecore_X_Fixes_Group
*/
EAPI void
ecore_x_region_set(Ecore_X_Region region, Ecore_X_Rectangle *rects, int num)
EAPI void
ecore_x_region_set(Ecore_X_Region region,
Ecore_X_Rectangle *rects,
int num)
{
#ifdef ECORE_XCB_XFIXES
xcb_rectangle_t *xrects;
@ -316,8 +322,9 @@ ecore_x_region_set(Ecore_X_Region region, Ecore_X_Rectangle *rects, int num)
* Replace the contents of @p dest with the contents of @p source.
* @ingroup Ecore_X_Fixes_Group
*/
EAPI void
ecore_x_region_copy(Ecore_X_Region dest, Ecore_X_Region source)
EAPI void
ecore_x_region_copy(Ecore_X_Region dest,
Ecore_X_Region source)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
CHECK_XCB_CONN;
@ -341,8 +348,10 @@ ecore_x_region_copy(Ecore_X_Region dest, Ecore_X_Region source)
* @p source2.
* @ingroup Ecore_X_Fixes_Group
*/
EAPI void
ecore_x_region_combine(Ecore_X_Region dest, Ecore_X_Region source1, Ecore_X_Region source2)
EAPI void
ecore_x_region_combine(Ecore_X_Region dest,
Ecore_X_Region source1,
Ecore_X_Region source2)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
CHECK_XCB_CONN;
@ -365,8 +374,10 @@ ecore_x_region_combine(Ecore_X_Region dest, Ecore_X_Region source1, Ecore_X_Regi
* @p source2.
* @ingroup Ecore_X_Fixes_Group
*/
EAPI void
ecore_x_region_intersect(Ecore_X_Region dest, Ecore_X_Region source1, Ecore_X_Region source2)
EAPI void
ecore_x_region_intersect(Ecore_X_Region dest,
Ecore_X_Region source1,
Ecore_X_Region source2)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
CHECK_XCB_CONN;
@ -389,8 +400,10 @@ ecore_x_region_intersect(Ecore_X_Region dest, Ecore_X_Region source1, Ecore_X_Re
* @p source2.
* @ingroup Ecore_X_Fixes_Group
*/
EAPI void
ecore_x_region_subtract(Ecore_X_Region dest, Ecore_X_Region source1, Ecore_X_Region source2)
EAPI void
ecore_x_region_subtract(Ecore_X_Region dest,
Ecore_X_Region source1,
Ecore_X_Region source2)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
CHECK_XCB_CONN;
@ -414,8 +427,10 @@ ecore_x_region_subtract(Ecore_X_Region dest, Ecore_X_Region source1, Ecore_X_Reg
* contents.
* @ingroup Ecore_X_Fixes_Group
*/
EAPI void
ecore_x_region_invert(Ecore_X_Region dest, Ecore_X_Rectangle *bounds, Ecore_X_Region source)
EAPI void
ecore_x_region_invert(Ecore_X_Region dest,
Ecore_X_Rectangle *bounds,
Ecore_X_Region source)
{
#ifdef ECORE_XCB_XFIXES
xcb_rectangle_t xrects;
@ -446,8 +461,10 @@ ecore_x_region_invert(Ecore_X_Region dest, Ecore_X_Rectangle *bounds, Ecore_X_Re
* The @p region is translated by @p dx and @p dy in place.
* @ingroup Ecore_X_Fixes_Group
*/
EAPI void
ecore_x_region_translate(Ecore_X_Region region, int dx, int dy)
EAPI void
ecore_x_region_translate(Ecore_X_Region region,
int dx,
int dy)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
CHECK_XCB_CONN;
@ -468,8 +485,9 @@ ecore_x_region_translate(Ecore_X_Region region, int dx, int dy)
* The extents of the @p source region are placed in @p dest.
* @ingroup Ecore_X_Fixes_Group
*/
EAPI void
ecore_x_region_extents(Ecore_X_Region dest, Ecore_X_Region source)
EAPI void
ecore_x_region_extents(Ecore_X_Region dest,
Ecore_X_Region source)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
CHECK_XCB_CONN;
@ -498,7 +516,9 @@ ecore_x_region_extents(Ecore_X_Region dest, Ecore_X_Region source)
* @ingroup Ecore_X_Fixes_Group
*/
EAPI Ecore_X_Rectangle *
ecore_x_region_fetch(Ecore_X_Region region, int *num, Ecore_X_Rectangle *bounds)
ecore_x_region_fetch(Ecore_X_Region region,
int *num,
Ecore_X_Rectangle *bounds)
{
Ecore_X_Rectangle extents = { 0, 0, 0, 0 };
Ecore_X_Rectangle *rects = NULL;
@ -566,8 +586,13 @@ ecore_x_region_fetch(Ecore_X_Region region, int *num, Ecore_X_Rectangle *bounds)
* @p left, @p right, @p top and @p bottom.
* @ingroup Ecore_X_Fixes_Group
*/
EAPI void
ecore_x_region_expand(Ecore_X_Region dest, Ecore_X_Region source, unsigned int left, unsigned int right, unsigned int top, unsigned int bottom)
EAPI void
ecore_x_region_expand(Ecore_X_Region dest,
Ecore_X_Region source,
unsigned int left,
unsigned int right,
unsigned int top,
unsigned int bottom)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
CHECK_XCB_CONN;
@ -596,8 +621,11 @@ ecore_x_region_expand(Ecore_X_Region dest, Ecore_X_Region source, unsigned int l
* to region have no effect on the gc clip-mask.
* @ingroup Ecore_X_Fixes_Group
*/
EAPI void
ecore_x_region_gc_clip_set(Ecore_X_Region region, Ecore_X_GC gc, int x, int y)
EAPI void
ecore_x_region_gc_clip_set(Ecore_X_Region region,
Ecore_X_GC gc,
int x,
int y)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
CHECK_XCB_CONN;
@ -623,8 +651,12 @@ ecore_x_region_gc_clip_set(Ecore_X_Region region, Ecore_X_GC gc, int x, int y)
* have no effect on the window shape.
* @ingroup Ecore_X_Fixes_Group
*/
EAPI void
ecore_x_region_window_shape_set(Ecore_X_Region region, Ecore_X_Window dest, Ecore_X_Shape_Type type, int x, int y)
EAPI void
ecore_x_region_window_shape_set(Ecore_X_Region region,
Ecore_X_Window dest,
Ecore_X_Shape_Type type,
int x,
int y)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
CHECK_XCB_CONN;
@ -652,8 +684,11 @@ ecore_x_region_window_shape_set(Ecore_X_Region region, Ecore_X_Window dest, Ecor
* to region have no effect on the picture clip-mask.
* @ingroup Ecore_X_Fixes_Group
*/
EAPI void
ecore_x_region_picture_clip_set(Ecore_X_Region region, Ecore_X_Picture picture, int x, int y)
EAPI void
ecore_x_region_picture_clip_set(Ecore_X_Region region,
Ecore_X_Picture picture,
int x,
int y)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
CHECK_XCB_CONN;
@ -668,7 +703,8 @@ ecore_x_region_picture_clip_set(Ecore_X_Region region, Ecore_X_Picture picture,
/* local function prototypes */
static xcb_rectangle_t *
_ecore_xcb_rect_to_xcb(Ecore_X_Rectangle *rects, int num)
_ecore_xcb_rect_to_xcb(Ecore_X_Rectangle *rects,
int num)
{
xcb_rectangle_t *xrect;
int i = 0;
@ -678,7 +714,7 @@ _ecore_xcb_rect_to_xcb(Ecore_X_Rectangle *rects, int num)
xrect = malloc(sizeof(xcb_rectangle_t) * num);
if (!xrect) return NULL;
for (i = 0; i < num; i++)
for (i = 0; i < num; i++)
{
xrect[i].x = rects[i].x;
xrect[i].y = rects[i].y;
@ -690,7 +726,8 @@ _ecore_xcb_rect_to_xcb(Ecore_X_Rectangle *rects, int num)
}
static Ecore_X_Rectangle *
_ecore_xcb_rect_to_ecore(xcb_rectangle_t *rects, int num)
_ecore_xcb_rect_to_ecore(xcb_rectangle_t *rects,
int num)
{
Ecore_X_Rectangle *erect;
int i = 0;
@ -700,7 +737,7 @@ _ecore_xcb_rect_to_ecore(xcb_rectangle_t *rects, int num)
erect = malloc(sizeof(Ecore_X_Rectangle) * num);
if (!erect) return NULL;
for (i = 0; i < num; i++)
for (i = 0; i < num; i++)
{
erect[i].x = rects[i].x;
erect[i].y = rects[i].y;
@ -710,3 +747,4 @@ _ecore_xcb_rect_to_ecore(xcb_rectangle_t *rects, int num)
return erect;
}

View File

@ -7,8 +7,8 @@
static Eina_Bool _xinerama_avail = EINA_FALSE;
static Eina_Bool _xinerama_active = EINA_FALSE;
void
_ecore_xcb_xinerama_init(void)
void
_ecore_xcb_xinerama_init(void)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
@ -17,8 +17,8 @@ _ecore_xcb_xinerama_init(void)
#endif
}
void
_ecore_xcb_xinerama_finalize(void)
void
_ecore_xcb_xinerama_finalize(void)
{
#ifdef ECORE_XCB_XINERAMA
const xcb_query_extension_reply_t *ext_reply;
@ -28,33 +28,33 @@ _ecore_xcb_xinerama_finalize(void)
#ifdef ECORE_XCB_XINERAMA
ext_reply = xcb_get_extension_data(_ecore_xcb_conn, &xcb_xinerama_id);
if ((ext_reply) && (ext_reply->present))
if ((ext_reply) && (ext_reply->present))
{
xcb_xinerama_query_version_cookie_t cookie;
xcb_xinerama_query_version_reply_t *reply;
cookie =
xcb_xinerama_query_version_unchecked(_ecore_xcb_conn,
XCB_XINERAMA_MAJOR_VERSION,
cookie =
xcb_xinerama_query_version_unchecked(_ecore_xcb_conn,
XCB_XINERAMA_MAJOR_VERSION,
XCB_XINERAMA_MINOR_VERSION);
reply =
reply =
xcb_xinerama_query_version_reply(_ecore_xcb_conn, cookie, NULL);
if (reply)
if (reply)
{
_xinerama_avail = EINA_TRUE;
// NB: Do we need to compare version numbers here ?
free(reply);
}
if (_xinerama_avail)
if (_xinerama_avail)
{
xcb_xinerama_is_active_cookie_t acookie;
xcb_xinerama_is_active_reply_t *areply;
acookie = xcb_xinerama_is_active_unchecked(_ecore_xcb_conn);
areply =
areply =
xcb_xinerama_is_active_reply(_ecore_xcb_conn, acookie, NULL);
if (areply)
if (areply)
{
_xinerama_active = areply->state;
free(areply);
@ -64,8 +64,8 @@ _ecore_xcb_xinerama_finalize(void)
#endif
}
EAPI int
ecore_x_xinerama_screen_count_get(void)
EAPI int
ecore_x_xinerama_screen_count_get(void)
{
int count = 0;
#ifdef ECORE_XCB_XINERAMA
@ -80,7 +80,7 @@ ecore_x_xinerama_screen_count_get(void)
#ifdef ECORE_XCB_XINERAMA
cookie = xcb_xinerama_query_screens_unchecked(_ecore_xcb_conn);
reply =
reply =
xcb_xinerama_query_screens_reply(_ecore_xcb_conn, cookie, NULL);
if (!reply) return 0;
count = reply->number;
@ -89,8 +89,12 @@ ecore_x_xinerama_screen_count_get(void)
return count;
}
EAPI Eina_Bool
ecore_x_xinerama_screen_geometry_get(int screen, int *x, int *y, int *w, int *h)
EAPI Eina_Bool
ecore_x_xinerama_screen_geometry_get(int screen,
int *x,
int *y,
int *w,
int *h)
{
#ifdef ECORE_XCB_XINERAMA
xcb_xinerama_query_screens_cookie_t cookie;
@ -110,12 +114,12 @@ ecore_x_xinerama_screen_geometry_get(int screen, int *x, int *y, int *w, int *h)
#ifdef ECORE_XCB_XINERAMA
cookie = xcb_xinerama_query_screens_unchecked(_ecore_xcb_conn);
reply =
reply =
xcb_xinerama_query_screens_reply(_ecore_xcb_conn, cookie, NULL);
if (!reply) return EINA_FALSE;
info = xcb_xinerama_query_screens_screen_info(reply);
if (!info)
if (!info)
{
free(reply);
return EINA_FALSE;
@ -132,3 +136,4 @@ ecore_x_xinerama_screen_geometry_get(int screen, int *x, int *y, int *w, int *h)
return EINA_FALSE;
}

View File

@ -7,8 +7,8 @@
/* local variables */
static Eina_Bool _test_avail = EINA_FALSE;
void
_ecore_xcb_xtest_init(void)
void
_ecore_xcb_xtest_init(void)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
@ -17,8 +17,8 @@ _ecore_xcb_xtest_init(void)
#endif
}
void
_ecore_xcb_xtest_finalize(void)
void
_ecore_xcb_xtest_finalize(void)
{
#ifdef ECORE_XCB_XTEST
const xcb_query_extension_reply_t *ext_reply;
@ -28,16 +28,16 @@ _ecore_xcb_xtest_finalize(void)
#ifdef ECORE_XCB_XTEST
ext_reply = xcb_get_extension_data(_ecore_xcb_conn, &xcb_test_id);
if ((ext_reply) && (ext_reply->present))
if ((ext_reply) && (ext_reply->present))
_test_avail = EINA_TRUE;
#endif
}
EAPI Eina_Bool
EAPI Eina_Bool
#ifdef ECORE_XCB_XTEST
ecore_x_test_fake_key_down(const char *key)
ecore_x_test_fake_key_down(const char *key)
#else
ecore_x_test_fake_key_down(const char *key __UNUSED__)
ecore_x_test_fake_key_down(const char *key __UNUSED__)
#endif
{
#ifdef ECORE_XCB_XTEST
@ -55,12 +55,12 @@ ecore_x_test_fake_key_down(const char *key __UNUSED__)
keycode = _ecore_xcb_keymap_string_to_keycode(key);
if (keycode == XCB_NO_SYMBOL) return EINA_FALSE;
cookie =
xcb_test_fake_input(_ecore_xcb_conn, XCB_KEY_PRESS,
keycode, XCB_CURRENT_TIME,
cookie =
xcb_test_fake_input(_ecore_xcb_conn, XCB_KEY_PRESS,
keycode, XCB_CURRENT_TIME,
((xcb_screen_t *)_ecore_xcb_screen)->root, 0, 0, 0);
err = xcb_request_check(_ecore_xcb_conn, cookie);
if (err)
if (err)
{
free(err);
return EINA_FALSE;
@ -71,11 +71,11 @@ ecore_x_test_fake_key_down(const char *key __UNUSED__)
return EINA_FALSE;
}
EAPI Eina_Bool
EAPI Eina_Bool
#ifdef ECORE_XCB_XTEST
ecore_x_test_fake_key_up(const char *key)
ecore_x_test_fake_key_up(const char *key)
#else
ecore_x_test_fake_key_up(const char *key __UNUSED__)
ecore_x_test_fake_key_up(const char *key __UNUSED__)
#endif
{
#ifdef ECORE_XCB_XTEST
@ -93,12 +93,12 @@ ecore_x_test_fake_key_up(const char *key __UNUSED__)
keycode = _ecore_xcb_keymap_string_to_keycode(key);
if (keycode == XCB_NO_SYMBOL) return EINA_FALSE;
cookie =
xcb_test_fake_input(_ecore_xcb_conn, XCB_KEY_RELEASE,
keycode, XCB_CURRENT_TIME,
cookie =
xcb_test_fake_input(_ecore_xcb_conn, XCB_KEY_RELEASE,
keycode, XCB_CURRENT_TIME,
((xcb_screen_t *)_ecore_xcb_screen)->root, 0, 0, 0);
err = xcb_request_check(_ecore_xcb_conn, cookie);
if (err)
if (err)
{
free(err);
return EINA_FALSE;
@ -109,11 +109,11 @@ ecore_x_test_fake_key_up(const char *key __UNUSED__)
return EINA_FALSE;
}
EAPI Eina_Bool
EAPI Eina_Bool
#ifdef ECORE_XCB_XTEST
ecore_x_test_fake_key_press(const char *key)
ecore_x_test_fake_key_press(const char *key)
#else
ecore_x_test_fake_key_press(const char *key __UNUSED__)
ecore_x_test_fake_key_press(const char *key __UNUSED__)
#endif
{
#ifdef ECORE_XCB_XTEST
@ -133,22 +133,22 @@ ecore_x_test_fake_key_press(const char *key __UNUSED__)
#ifdef ECORE_XCB_XTEST
keycode = _ecore_xcb_keymap_string_to_keycode(key);
keysym = _ecore_xcb_keymap_keycode_to_keysym(keycode, 0);
if (keysym == XCB_NO_SYMBOL)
if (keysym == XCB_NO_SYMBOL)
{
keysym = _ecore_xcb_keymap_keycode_to_keysym(keycode, 1);
if (keysym != XCB_NO_SYMBOL)
shift = EINA_TRUE;
}
if (shift)
if (shift)
{
xcb_keycode_t *keycodes;
int i = 0;
keycodes = _ecore_xcb_keymap_keysym_to_keycode(XK_Shift_L);
while (keycodes[i] != XCB_NO_SYMBOL)
while (keycodes[i] != XCB_NO_SYMBOL)
{
if (keycodes[i] != 0)
if (keycodes[i] != 0)
{
shift_code = keycodes[i];
break;
@ -157,51 +157,51 @@ ecore_x_test_fake_key_press(const char *key __UNUSED__)
}
}
if (shift)
if (shift)
{
cookie =
xcb_test_fake_input(_ecore_xcb_conn, XCB_KEY_PRESS,
shift_code, XCB_CURRENT_TIME,
((xcb_screen_t *)_ecore_xcb_screen)->root,
cookie =
xcb_test_fake_input(_ecore_xcb_conn, XCB_KEY_PRESS,
shift_code, XCB_CURRENT_TIME,
((xcb_screen_t *)_ecore_xcb_screen)->root,
0, 0, 0);
err = xcb_request_check(_ecore_xcb_conn, cookie);
if (err)
if (err)
{
free(err);
return EINA_FALSE;
}
}
cookie =
xcb_test_fake_input(_ecore_xcb_conn, XCB_KEY_PRESS,
keycode, XCB_CURRENT_TIME,
cookie =
xcb_test_fake_input(_ecore_xcb_conn, XCB_KEY_PRESS,
keycode, XCB_CURRENT_TIME,
((xcb_screen_t *)_ecore_xcb_screen)->root, 0, 0, 0);
err = xcb_request_check(_ecore_xcb_conn, cookie);
if (err)
if (err)
{
free(err);
return EINA_FALSE;
}
cookie =
xcb_test_fake_input(_ecore_xcb_conn, XCB_KEY_RELEASE,
keycode, XCB_CURRENT_TIME,
cookie =
xcb_test_fake_input(_ecore_xcb_conn, XCB_KEY_RELEASE,
keycode, XCB_CURRENT_TIME,
((xcb_screen_t *)_ecore_xcb_screen)->root, 0, 0, 0);
err = xcb_request_check(_ecore_xcb_conn, cookie);
if (err)
if (err)
{
free(err);
return EINA_FALSE;
}
if (shift)
if (shift)
{
cookie =
xcb_test_fake_input(_ecore_xcb_conn, XCB_KEY_RELEASE,
shift_code, XCB_CURRENT_TIME,
((xcb_screen_t *)_ecore_xcb_screen)->root,
cookie =
xcb_test_fake_input(_ecore_xcb_conn, XCB_KEY_RELEASE,
shift_code, XCB_CURRENT_TIME,
((xcb_screen_t *)_ecore_xcb_screen)->root,
0, 0, 0);
err = xcb_request_check(_ecore_xcb_conn, cookie);
if (err)
if (err)
{
free(err);
return EINA_FALSE;

File diff suppressed because it is too large Load Diff

View File

@ -16,7 +16,7 @@
# ifdef __cplusplus
extern "C"
# endif /* ifdef __cplusplus */
void * alloca (size_t);
void *alloca(size_t);
#endif /* ifdef HAVE_ALLOCA_H */
#include <string.h>
@ -305,26 +305,28 @@ EAPI Ecore_X_Atom
ecore_x_atom_get(const char *name)
{
if (!_ecore_x_disp)
return 0;
return 0;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
return XInternAtom(_ecore_x_disp, name, False);
} /* ecore_x_atom_get */
EAPI void
ecore_x_atoms_get(const char **names, int num, Ecore_X_Atom *atoms)
ecore_x_atoms_get(const char **names,
int num,
Ecore_X_Atom *atoms)
{
Atom *atoms_int;
int i;
if (!_ecore_x_disp)
return;
return;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
atoms_int = alloca(num * sizeof(Atom));
XInternAtoms(_ecore_x_disp, (char **)names, num, False, atoms_int);
for (i = 0; i < num; i++)
atoms[i] = atoms_int[i];
atoms[i] = atoms_int[i];
} /* ecore_x_atoms_get */
EAPI char *
@ -334,13 +336,13 @@ ecore_x_atom_name_get(Ecore_X_Atom atom)
char *xname;
if (!_ecore_x_disp)
return NULL;
return NULL;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
xname = XGetAtomName(_ecore_x_disp, atom);
if (!xname)
return NULL;
return NULL;
name = strdup(xname);
XFree(xname);

View File

@ -50,12 +50,12 @@ ecore_x_composite_redirect_window(Ecore_X_Window win,
switch(type)
{
case ECORE_X_COMPOSITE_UPDATE_AUTOMATIC:
update = CompositeRedirectAutomatic;
break;
update = CompositeRedirectAutomatic;
break;
case ECORE_X_COMPOSITE_UPDATE_MANUAL:
update = CompositeRedirectManual;
break;
update = CompositeRedirectManual;
break;
} /* switch */
XCompositeRedirectWindow(_ecore_x_disp, win, update);
#endif /* ifdef ECORE_XCOMPOSITE */
@ -72,12 +72,12 @@ ecore_x_composite_redirect_subwindows(Ecore_X_Window win,
switch(type)
{
case ECORE_X_COMPOSITE_UPDATE_AUTOMATIC:
update = CompositeRedirectAutomatic;
break;
update = CompositeRedirectAutomatic;
break;
case ECORE_X_COMPOSITE_UPDATE_MANUAL:
update = CompositeRedirectManual;
break;
update = CompositeRedirectManual;
break;
} /* switch */
XCompositeRedirectSubwindows(_ecore_x_disp, win, update);
#endif /* ifdef ECORE_XCOMPOSITE */
@ -94,12 +94,12 @@ ecore_x_composite_unredirect_window(Ecore_X_Window win,
switch(type)
{
case ECORE_X_COMPOSITE_UPDATE_AUTOMATIC:
update = CompositeRedirectAutomatic;
break;
update = CompositeRedirectAutomatic;
break;
case ECORE_X_COMPOSITE_UPDATE_MANUAL:
update = CompositeRedirectManual;
break;
update = CompositeRedirectManual;
break;
} /* switch */
XCompositeUnredirectWindow(_ecore_x_disp, win, update);
#endif /* ifdef ECORE_XCOMPOSITE */
@ -116,12 +116,12 @@ ecore_x_composite_unredirect_subwindows(Ecore_X_Window win,
switch(type)
{
case ECORE_X_COMPOSITE_UPDATE_AUTOMATIC:
update = CompositeRedirectAutomatic;
break;
update = CompositeRedirectAutomatic;
break;
case ECORE_X_COMPOSITE_UPDATE_MANUAL:
update = CompositeRedirectManual;
break;
update = CompositeRedirectManual;
break;
} /* switch */
XCompositeUnredirectSubwindows(_ecore_x_disp, win, update);
#endif /* ifdef ECORE_XCOMPOSITE */

View File

@ -43,7 +43,7 @@ ecore_x_cursor_new(Ecore_X_Window win,
// 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);
@ -127,23 +127,23 @@ ecore_x_cursor_new(Ecore_X_Window win,
g = (pix[0] >> 8) & 0xff;
b = (pix[0]) & 0xff;
d1 =
((r - fr) * (r - fr)) +
((g - fg) * (g - fg)) +
((b - fb) * (b - fb));
((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));
((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;
v = 1;
else
v = 0;
v = 0;
}
else
v = 0;
v = 0;
XPutPixel(xim, x, y, v);
pix++;
@ -162,9 +162,9 @@ ecore_x_cursor_new(Ecore_X_Window win,
v = (((pix[0] >> 24) & 0xff) * 5) / 256;
if (v > dither[x & 0x1][y & 0x1])
v = 1;
v = 1;
else
v = 0;
v = 0;
XPutPixel(xim, x, y, v);
pix++;

View File

@ -19,9 +19,9 @@ _ecore_x_damage_init(void)
LOGFN(__FILE__, __LINE__, __FUNCTION__);
if (XDamageQueryVersion(_ecore_x_disp, &_damage_major, &_damage_minor))
_damage_available = EINA_TRUE;
_damage_available = EINA_TRUE;
else
_damage_available = EINA_FALSE;
_damage_available = EINA_FALSE;
#else /* ifdef ECORE_XDAMAGE */
_damage_available = EINA_FALSE;
@ -35,7 +35,8 @@ ecore_x_damage_query(void)
} /* ecore_x_damage_query */
EAPI Ecore_X_Damage
ecore_x_damage_new(Ecore_X_Drawable d, Ecore_X_Damage_Report_Level level)
ecore_x_damage_new(Ecore_X_Drawable d,
Ecore_X_Damage_Report_Level level)
{
#ifdef ECORE_XDAMAGE
Ecore_X_Damage damage;

View File

@ -28,7 +28,8 @@ typedef struct _Version_Cache_Item
} Version_Cache_Item;
static Version_Cache_Item *_version_cache = NULL;
static int _version_cache_num = 0, _version_cache_alloc = 0;
static void (*_posupdatecb)(void *, Ecore_X_Xdnd_Position *);
static void (*_posupdatecb)(void *,
Ecore_X_Xdnd_Position *);
static void *_posupdatedata;
void
@ -71,15 +72,15 @@ _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;
@ -87,7 +88,7 @@ _ecore_x_dnd_shutdown(void)
} /* _ecore_x_dnd_shutdown */
static Eina_Bool
_ecore_x_dnd_converter_copy(char *target __UNUSED__,
_ecore_x_dnd_converter_copy(char *target __UNUSED__,
void *data,
int size,
void **data_ret,
@ -100,11 +101,11 @@ _ecore_x_dnd_converter_copy(char *target __UNUSED__,
XICCEncodingStyle style = XTextStyle;
if (!data || !size)
return EINA_FALSE;
return EINA_FALSE;
mystr = calloc(1, size + 1);
if (!mystr)
return EINA_FALSE;
return EINA_FALSE;
memcpy(mystr, data, size);
@ -132,16 +133,17 @@ _ecore_x_dnd_converter_copy(char *target __UNUSED__,
} /* _ecore_x_dnd_converter_copy */
EAPI void
ecore_x_dnd_aware_set(Ecore_X_Window win, Eina_Bool on)
ecore_x_dnd_aware_set(Ecore_X_Window win,
Eina_Bool on)
{
Ecore_X_Atom prop_data = ECORE_X_DND_VERSION;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
if (on)
ecore_x_window_prop_property_set(win, ECORE_X_ATOM_XDND_AWARE,
XA_ATOM, 32, &prop_data, 1);
ecore_x_window_prop_property_set(win, ECORE_X_ATOM_XDND_AWARE,
XA_ATOM, 32, &prop_data, 1);
else
ecore_x_window_prop_property_del(win, ECORE_X_ATOM_XDND_AWARE);
ecore_x_window_prop_property_del(win, ECORE_X_ATOM_XDND_AWARE);
} /* ecore_x_dnd_aware_set */
EAPI int
@ -157,16 +159,16 @@ ecore_x_dnd_version_get(Ecore_X_Window win)
// move and going to and from x multiple times per move is EXPENSIVE
// and slows things down, puts lots of load on x etc.
if (_source->state == ECORE_X_DND_SOURCE_DRAGGING)
if (_version_cache)
{
int i;
if (_version_cache)
{
int i;
for (i = 0; i < _version_cache_num; i++)
{
if (_version_cache[i].win == win)
return _version_cache[i].ver;
}
}
for (i = 0; i < _version_cache_num; i++)
{
if (_version_cache[i].win == win)
return _version_cache[i].ver;
}
}
if (ecore_x_window_prop_property_get(win, ECORE_X_ATOM_XDND_AWARE,
XA_ATOM, 32, &prop_data, &num))
@ -177,7 +179,7 @@ ecore_x_dnd_version_get(Ecore_X_Window win)
{
_version_cache_num++;
if (_version_cache_num > _version_cache_alloc)
_version_cache_alloc += 16;
_version_cache_alloc += 16;
t = realloc(_version_cache,
_version_cache_alloc *
@ -195,7 +197,7 @@ ecore_x_dnd_version_get(Ecore_X_Window win)
{
_version_cache_num++;
if (_version_cache_num > _version_cache_alloc)
_version_cache_alloc += 16;
_version_cache_alloc += 16;
t = realloc(_version_cache, _version_cache_alloc *
sizeof(Version_Cache_Item));
@ -209,7 +211,8 @@ ecore_x_dnd_version_get(Ecore_X_Window win)
} /* ecore_x_dnd_version_get */
EAPI Eina_Bool
ecore_x_dnd_type_isset(Ecore_X_Window win, const char *type)
ecore_x_dnd_type_isset(Ecore_X_Window win,
const char *type)
{
int num, i, ret = EINA_FALSE;
unsigned char *data;
@ -218,7 +221,7 @@ ecore_x_dnd_type_isset(Ecore_X_Window win, const char *type)
LOGFN(__FILE__, __LINE__, __FUNCTION__);
if (!ecore_x_window_prop_property_get(win, ECORE_X_ATOM_XDND_TYPE_LIST,
XA_ATOM, 32, &data, &num))
return ret;
return ret;
atom = ecore_x_atom_get(type);
atoms = (Ecore_X_Atom *)data;
@ -237,7 +240,9 @@ ecore_x_dnd_type_isset(Ecore_X_Window win, const char *type)
} /* ecore_x_dnd_type_isset */
EAPI void
ecore_x_dnd_type_set(Ecore_X_Window win, const char *type, Eina_Bool on)
ecore_x_dnd_type_set(Ecore_X_Window win,
const char *type,
Eina_Bool on)
{
Ecore_X_Atom atom;
Ecore_X_Atom *oldset = NULL, *newset = NULL;
@ -262,12 +267,12 @@ ecore_x_dnd_type_set(Ecore_X_Window win, const char *type, Eina_Bool on)
newset = calloc(num + 1, sizeof(Ecore_X_Atom));
if (!newset)
return;
return;
data = (unsigned char *)newset;
for (i = 0; i < num; i++)
newset[i + 1] = oldset[i];
newset[i + 1] = oldset[i];
/* prepend the new type */
newset[0] = atom;
@ -291,8 +296,8 @@ ecore_x_dnd_type_set(Ecore_X_Window win, const char *type, Eina_Bool on)
data = (unsigned char *)newset;
for (i = 0; i < num; i++)
if (oldset[i] != atom)
newset[j++] = oldset[i];
if (oldset[i] != atom)
newset[j++] = oldset[i];
ecore_x_window_prop_property_set(win, ECORE_X_ATOM_XDND_TYPE_LIST,
XA_ATOM, 32, data, num - 1);
@ -313,12 +318,12 @@ ecore_x_dnd_types_set(Ecore_X_Window win,
LOGFN(__FILE__, __LINE__, __FUNCTION__);
if (!num_types)
ecore_x_window_prop_property_del(win, ECORE_X_ATOM_XDND_TYPE_LIST);
ecore_x_window_prop_property_del(win, ECORE_X_ATOM_XDND_TYPE_LIST);
else
{
newset = calloc(num_types, sizeof(Ecore_X_Atom));
if (!newset)
return;
return;
data = (unsigned char *)newset;
for (i = 0; i < num_types; i++)
@ -343,7 +348,7 @@ ecore_x_dnd_actions_set(Ecore_X_Window win,
LOGFN(__FILE__, __LINE__, __FUNCTION__);
if (!num_actions)
ecore_x_window_prop_property_del(win, ECORE_X_ATOM_XDND_ACTION_LIST);
ecore_x_window_prop_property_del(win, ECORE_X_ATOM_XDND_ACTION_LIST);
else
{
data = (unsigned char *)actions;
@ -373,8 +378,9 @@ ecore_x_dnd_actions_set(Ecore_X_Window win,
*/
EAPI void
ecore_x_dnd_callback_pos_update_set(
void (*cb)(void *, Ecore_X_Xdnd_Position *data),
const void *data)
void (*cb)(void *,
Ecore_X_Xdnd_Position *data),
const void *data)
{
_posupdatecb = cb;
_posupdatedata = (void *)data; /* Discard the const early */
@ -393,15 +399,17 @@ _ecore_x_dnd_target_get(void)
} /* _ecore_x_dnd_target_get */
EAPI Eina_Bool
ecore_x_dnd_begin(Ecore_X_Window source, unsigned char *data, int size)
ecore_x_dnd_begin(Ecore_X_Window source,
unsigned char *data,
int size)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
if (!ecore_x_dnd_version_get(source))
return EINA_FALSE;
return EINA_FALSE;
/* Take ownership of XdndSelection */
if (!ecore_x_selection_xdnd_set(source, data, size))
return EINA_FALSE;
return EINA_FALSE;
if (_version_cache)
{
@ -463,8 +471,8 @@ ecore_x_dnd_drop(void)
else
{
/* Dropping on nothing */
ecore_x_selection_xdnd_clear();
_source->state = ECORE_X_DND_SOURCE_IDLE;
ecore_x_selection_xdnd_clear();
_source->state = ECORE_X_DND_SOURCE_IDLE;
}
ecore_x_window_ignore_set(_source->win, 0);
@ -483,7 +491,7 @@ ecore_x_dnd_send_status(Eina_Bool will_accept,
XEvent xev;
if (_target->state == ECORE_X_DND_TARGET_IDLE)
return;
return;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
memset(&xev, 0, sizeof(XEvent));
@ -499,10 +507,10 @@ ecore_x_dnd_send_status(Eina_Bool will_accept,
xev.xclient.data.l[0] = _target->win;
xev.xclient.data.l[1] = 0;
if (will_accept)
xev.xclient.data.l[1] |= 0x1UL;
xev.xclient.data.l[1] |= 0x1UL;
if (!suppress)
xev.xclient.data.l[1] |= 0x2UL;
xev.xclient.data.l[1] |= 0x2UL;
/* Set rectangle information */
xev.xclient.data.l[2] = rectangle.x;
@ -532,7 +540,7 @@ ecore_x_dnd_send_finished(void)
XEvent xev;
if (_target->state == ECORE_X_DND_TARGET_IDLE)
return;
return;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
xev.xany.type = ClientMessage;
@ -560,7 +568,7 @@ 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 */
EAPI Ecore_X_Atom
@ -570,7 +578,9 @@ ecore_x_dnd_source_action_get(void)
} /* ecore_x_dnd_source_action_get */
void
_ecore_x_dnd_drag(Ecore_X_Window root, int x, int y)
_ecore_x_dnd_drag(Ecore_X_Window root,
int x,
int y)
{
XEvent xev;
Ecore_X_Window win;
@ -579,7 +589,7 @@ _ecore_x_dnd_drag(Ecore_X_Window root, int x, int y)
int num;
if (_source->state != ECORE_X_DND_SOURCE_DRAGGING)
return;
return;
/* Preinitialize XEvent struct */
memset(&xev, 0, sizeof(XEvent));
@ -599,7 +609,7 @@ _ecore_x_dnd_drag(Ecore_X_Window root, int x, int y)
// while ((win) && !(ecore_x_dnd_version_get(win)))
// win = ecore_x_window_parent_get(win);
while ((win) && !(ecore_x_dnd_version_get(win)))
win = ecore_x_window_shadow_parent_get(root, win);
win = ecore_x_window_shadow_parent_get(root, win);
/* Send XdndLeave to current destination window if we have left it */
if ((_source->dest) && (win != _source->dest))
@ -639,16 +649,16 @@ _ecore_x_dnd_drag(Ecore_X_Window root, int x, int y)
xev.xclient.data.l[0] = _source->win;
xev.xclient.data.l[1] = 0;
if (num > 3)
xev.xclient.data.l[1] |= 0x1UL;
xev.xclient.data.l[1] |= 0x1UL;
else
xev.xclient.data.l[1] &= 0xfffffffeUL;
xev.xclient.data.l[1] &= 0xfffffffeUL;
xev.xclient.data.l[1] |= ((unsigned long)_source->version) << 24;
for (i = 2; i < 5; i++)
xev.xclient.data.l[i] = 0;
xev.xclient.data.l[i] = 0;
for (i = 0; i < MIN(num, 3); ++i)
xev.xclient.data.l[i + 2] = types[i];
xev.xclient.data.l[i + 2] = types[i];
XFree(data);
XSendEvent(_ecore_x_disp, win, False, 0, &xev);
_source->await_status = 0;
@ -691,10 +701,6 @@ _ecore_x_dnd_drag(Ecore_X_Window root, int x, int y)
_source->prev.y = y;
_source->prev.window = root;
_source->dest = win;
} /* _ecore_x_dnd_drag */
/* vim:set ts=8 sw=3 sts=3 expandtab cino=>5n-2f0^-2{2(0W1st0 :*/

View File

@ -16,9 +16,9 @@ _ecore_x_dpms_init(void)
_dpms_minor = 0;
if (DPMSGetVersion(_ecore_x_disp, &_dpms_major, &_dpms_minor))
_dpms_available = EINA_TRUE;
_dpms_available = EINA_TRUE;
else
_dpms_available = EINA_FALSE;
_dpms_available = EINA_FALSE;
#else /* ifdef ECORE_XDPMS */
_dpms_available = EINA_FALSE;
@ -89,9 +89,9 @@ ecore_x_dpms_enabled_set(int enabled)
#ifdef ECORE_XDPMS
LOGFN(__FILE__, __LINE__, __FUNCTION__);
if (enabled)
DPMSEnable(_ecore_x_disp);
DPMSEnable(_ecore_x_disp);
else
DPMSDisable(_ecore_x_disp);
DPMSDisable(_ecore_x_disp);
#endif /* ifdef ECORE_XDPMS */
} /* ecore_x_dpms_enabled_set */

View File

@ -12,7 +12,7 @@
/**
* Retrieves the geometry of the given drawable.
* @param d The given drawable.
* @param d The given drawable.
* @param x Pointer to an integer into which the X position is to be stored.
* @param y Pointer to an integer into which the Y position is to be stored.
* @param w Pointer to an integer into which the width is to be stored.
@ -41,16 +41,16 @@ ecore_x_drawable_geometry_get(Ecore_X_Drawable d,
}
if (x)
*x = ret_x;
*x = ret_x;
if (y)
*y = ret_y;
*y = ret_y;
if (w)
*w = (int)ret_w;
*w = (int)ret_w;
if (h)
*h = (int)ret_h;
*h = (int)ret_h;
} /* ecore_x_drawable_geometry_get */
/**
@ -69,7 +69,7 @@ ecore_x_drawable_border_width_get(Ecore_X_Drawable d)
LOGFN(__FILE__, __LINE__, __FUNCTION__);
if (!XGetGeometry(_ecore_x_disp, d, &dummy_win, &dummy_x, &dummy_y,
&dummy_w, &dummy_h, &border_ret, &dummy_depth))
border_ret = 0;
border_ret = 0;
return (int)border_ret;
} /* ecore_x_drawable_border_width_get */
@ -90,7 +90,7 @@ ecore_x_drawable_depth_get(Ecore_X_Drawable d)
LOGFN(__FILE__, __LINE__, __FUNCTION__);
if (!XGetGeometry(_ecore_x_disp, d, &dummy_win, &dummy_x, &dummy_y,
&dummy_w, &dummy_h, &dummy_border, &depth_ret))
depth_ret = 0;
depth_ret = 0;
return (int)depth_ret;
} /* ecore_x_drawable_depth_get */

View File

@ -17,7 +17,11 @@ ecore_x_e_init(void)
} /* ecore_x_e_init */
EAPI void
ecore_x_e_frame_size_set(Ecore_X_Window win, int fl, int fr, int ft, int fb)
ecore_x_e_frame_size_set(Ecore_X_Window win,
int fl,
int fr,
int ft,
int fb)
{
unsigned int frames[4];
@ -30,7 +34,8 @@ ecore_x_e_frame_size_set(Ecore_X_Window win, int fl, int fr, int ft, int fb)
} /* ecore_x_e_frame_size_set */
EAPI void
ecore_x_e_virtual_keyboard_set(Ecore_X_Window win, unsigned int is_keyboard)
ecore_x_e_virtual_keyboard_set(Ecore_X_Window win,
unsigned int is_keyboard)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
ecore_x_window_prop_card32_set(win, ECORE_X_ATOM_E_VIRTUAL_KEYBOARD,
@ -45,7 +50,7 @@ ecore_x_e_virtual_keyboard_get(Ecore_X_Window win)
LOGFN(__FILE__, __LINE__, __FUNCTION__);
if (!ecore_x_window_prop_card32_get(win, ECORE_X_ATOM_E_VIRTUAL_KEYBOARD,
&val, 1))
return EINA_FALSE;
return EINA_FALSE;
return val ? EINA_TRUE : EINA_FALSE;
} /* ecore_x_e_virtual_keyboard_get */
@ -54,49 +59,49 @@ static Ecore_X_Virtual_Keyboard_State
_ecore_x_e_vkbd_state_get(Ecore_X_Atom atom)
{
if (atom == ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_ON)
return ECORE_X_VIRTUAL_KEYBOARD_STATE_ON;
return ECORE_X_VIRTUAL_KEYBOARD_STATE_ON;
if (atom == ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_OFF)
return ECORE_X_VIRTUAL_KEYBOARD_STATE_OFF;
return ECORE_X_VIRTUAL_KEYBOARD_STATE_OFF;
if (atom == ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_ALPHA)
return ECORE_X_VIRTUAL_KEYBOARD_STATE_ALPHA;
return ECORE_X_VIRTUAL_KEYBOARD_STATE_ALPHA;
if (atom == ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_NUMERIC)
return ECORE_X_VIRTUAL_KEYBOARD_STATE_NUMERIC;
return ECORE_X_VIRTUAL_KEYBOARD_STATE_NUMERIC;
if (atom == ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_PIN)
return ECORE_X_VIRTUAL_KEYBOARD_STATE_PIN;
return ECORE_X_VIRTUAL_KEYBOARD_STATE_PIN;
if (atom == ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_PHONE_NUMBER)
return ECORE_X_VIRTUAL_KEYBOARD_STATE_PHONE_NUMBER;
return ECORE_X_VIRTUAL_KEYBOARD_STATE_PHONE_NUMBER;
if (atom == ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_HEX)
return ECORE_X_VIRTUAL_KEYBOARD_STATE_HEX;
return ECORE_X_VIRTUAL_KEYBOARD_STATE_HEX;
if (atom == ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_TERMINAL)
return ECORE_X_VIRTUAL_KEYBOARD_STATE_TERMINAL;
return ECORE_X_VIRTUAL_KEYBOARD_STATE_TERMINAL;
if (atom == ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_PASSWORD)
return ECORE_X_VIRTUAL_KEYBOARD_STATE_PASSWORD;
return ECORE_X_VIRTUAL_KEYBOARD_STATE_PASSWORD;
if (atom == ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_IP)
return ECORE_X_VIRTUAL_KEYBOARD_STATE_IP;
return ECORE_X_VIRTUAL_KEYBOARD_STATE_IP;
if (atom == ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_HOST)
return ECORE_X_VIRTUAL_KEYBOARD_STATE_HOST;
return ECORE_X_VIRTUAL_KEYBOARD_STATE_HOST;
if (atom == ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_FILE)
return ECORE_X_VIRTUAL_KEYBOARD_STATE_FILE;
return ECORE_X_VIRTUAL_KEYBOARD_STATE_FILE;
if (atom == ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_URL)
return ECORE_X_VIRTUAL_KEYBOARD_STATE_URL;
return ECORE_X_VIRTUAL_KEYBOARD_STATE_URL;
if (atom == ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_KEYPAD)
return ECORE_X_VIRTUAL_KEYBOARD_STATE_KEYPAD;
return ECORE_X_VIRTUAL_KEYBOARD_STATE_KEYPAD;
if (atom == ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_J2ME)
return ECORE_X_VIRTUAL_KEYBOARD_STATE_J2ME;
return ECORE_X_VIRTUAL_KEYBOARD_STATE_J2ME;
return ECORE_X_VIRTUAL_KEYBOARD_STATE_UNKNOWN;
} /* _ecore_x_e_vkbd_state_get */
@ -107,49 +112,49 @@ _ecore_x_e_vkbd_atom_get(Ecore_X_Virtual_Keyboard_State state)
switch (state)
{
case ECORE_X_VIRTUAL_KEYBOARD_STATE_OFF:
return ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_OFF;
return ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_OFF;
case ECORE_X_VIRTUAL_KEYBOARD_STATE_ON:
return ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_ON;
return ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_ON;
case ECORE_X_VIRTUAL_KEYBOARD_STATE_ALPHA:
return ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_ALPHA;
return ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_ALPHA;
case ECORE_X_VIRTUAL_KEYBOARD_STATE_NUMERIC:
return ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_NUMERIC;
return ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_NUMERIC;
case ECORE_X_VIRTUAL_KEYBOARD_STATE_PIN:
return ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_PIN;
return ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_PIN;
case ECORE_X_VIRTUAL_KEYBOARD_STATE_PHONE_NUMBER:
return ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_PHONE_NUMBER;
return ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_PHONE_NUMBER;
case ECORE_X_VIRTUAL_KEYBOARD_STATE_HEX:
return ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_HEX;
return ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_HEX;
case ECORE_X_VIRTUAL_KEYBOARD_STATE_TERMINAL:
return ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_TERMINAL;
return ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_TERMINAL;
case ECORE_X_VIRTUAL_KEYBOARD_STATE_PASSWORD:
return ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_PASSWORD;
return ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_PASSWORD;
case ECORE_X_VIRTUAL_KEYBOARD_STATE_IP:
return ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_IP;
return ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_IP;
case ECORE_X_VIRTUAL_KEYBOARD_STATE_HOST:
return ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_HOST;
return ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_HOST;
case ECORE_X_VIRTUAL_KEYBOARD_STATE_FILE:
return ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_FILE;
return ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_FILE;
case ECORE_X_VIRTUAL_KEYBOARD_STATE_URL:
return ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_URL;
return ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_URL;
case ECORE_X_VIRTUAL_KEYBOARD_STATE_KEYPAD:
return ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_KEYPAD;
return ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_KEYPAD;
case ECORE_X_VIRTUAL_KEYBOARD_STATE_J2ME:
return ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_J2ME;
return ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_J2ME;
default: break;
} /* switch */
@ -176,7 +181,7 @@ ecore_x_e_virtual_keyboard_state_get(Ecore_X_Window win)
LOGFN(__FILE__, __LINE__, __FUNCTION__);
if (!ecore_x_window_prop_atom_get(win, ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_STATE,
&atom, 1))
return ECORE_X_VIRTUAL_KEYBOARD_STATE_UNKNOWN;
return ECORE_X_VIRTUAL_KEYBOARD_STATE_UNKNOWN;
return _ecore_x_e_vkbd_state_get(atom);
} /* ecore_x_e_virtual_keyboard_state_get */
@ -198,16 +203,16 @@ _ecore_x_e_illume_atom_get(Ecore_X_Illume_Mode mode)
switch (mode)
{
case ECORE_X_ILLUME_MODE_SINGLE:
return ECORE_X_ATOM_E_ILLUME_MODE_SINGLE;
return ECORE_X_ATOM_E_ILLUME_MODE_SINGLE;
case ECORE_X_ILLUME_MODE_DUAL_TOP:
return ECORE_X_ATOM_E_ILLUME_MODE_DUAL_TOP;
return ECORE_X_ATOM_E_ILLUME_MODE_DUAL_TOP;
case ECORE_X_ILLUME_MODE_DUAL_LEFT:
return ECORE_X_ATOM_E_ILLUME_MODE_DUAL_LEFT;
return ECORE_X_ATOM_E_ILLUME_MODE_DUAL_LEFT;
default:
break;
break;
} /* switch */
return ECORE_X_ILLUME_MODE_UNKNOWN;
} /* _ecore_x_e_illume_atom_get */
@ -216,19 +221,20 @@ static Ecore_X_Illume_Mode
_ecore_x_e_illume_mode_get(Ecore_X_Atom atom)
{
if (atom == ECORE_X_ATOM_E_ILLUME_MODE_SINGLE)
return ECORE_X_ILLUME_MODE_SINGLE;
return ECORE_X_ILLUME_MODE_SINGLE;
if (atom == ECORE_X_ATOM_E_ILLUME_MODE_DUAL_TOP)
return ECORE_X_ILLUME_MODE_DUAL_TOP;
return ECORE_X_ILLUME_MODE_DUAL_TOP;
if (atom == ECORE_X_ATOM_E_ILLUME_MODE_DUAL_LEFT)
return ECORE_X_ILLUME_MODE_DUAL_LEFT;
return ECORE_X_ILLUME_MODE_DUAL_LEFT;
return ECORE_X_ILLUME_MODE_UNKNOWN;
} /* _ecore_x_e_illume_mode_get */
EAPI void
ecore_x_e_illume_zone_set(Ecore_X_Window win, Ecore_X_Window zone)
ecore_x_e_illume_zone_set(Ecore_X_Window win,
Ecore_X_Window zone)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
ecore_x_window_prop_window_set(win, ECORE_X_ATOM_E_ILLUME_ZONE,
@ -243,7 +249,7 @@ ecore_x_e_illume_zone_get(Ecore_X_Window win)
LOGFN(__FILE__, __LINE__, __FUNCTION__);
if (!ecore_x_window_prop_window_get(win, ECORE_X_ATOM_E_ILLUME_ZONE,
&zone, 1))
return 0;
return 0;
return zone;
} /* ecore_x_e_illume_zone_get */
@ -259,7 +265,8 @@ ecore_x_e_illume_zone_list_set(Ecore_X_Window win,
} /* ecore_x_e_illume_zone_list_set */
EAPI void
ecore_x_e_illume_conformant_set(Ecore_X_Window win, unsigned int is_conformant)
ecore_x_e_illume_conformant_set(Ecore_X_Window win,
unsigned int is_conformant)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
ecore_x_window_prop_card32_set(win, ECORE_X_ATOM_E_ILLUME_CONFORMANT,
@ -274,13 +281,14 @@ ecore_x_e_illume_conformant_get(Ecore_X_Window win)
LOGFN(__FILE__, __LINE__, __FUNCTION__);
if (!ecore_x_window_prop_card32_get(win, ECORE_X_ATOM_E_ILLUME_CONFORMANT,
&val, 1))
return EINA_FALSE;
return EINA_FALSE;
return val ? EINA_TRUE : EINA_FALSE;
} /* ecore_x_e_illume_conformant_get */
EAPI void
ecore_x_e_illume_mode_set(Ecore_X_Window win, Ecore_X_Illume_Mode mode)
ecore_x_e_illume_mode_set(Ecore_X_Window win,
Ecore_X_Illume_Mode mode)
{
Ecore_X_Atom atom = 0;
@ -297,13 +305,14 @@ ecore_x_e_illume_mode_get(Ecore_X_Window win)
LOGFN(__FILE__, __LINE__, __FUNCTION__);
if (!ecore_x_window_prop_atom_get(win, ECORE_X_ATOM_E_ILLUME_MODE, &atom, 1))
return ECORE_X_ILLUME_MODE_UNKNOWN;
return ECORE_X_ILLUME_MODE_UNKNOWN;
return _ecore_x_e_illume_mode_get(atom);
} /* ecore_x_e_illume_mode_get */
EAPI void
ecore_x_e_illume_mode_send(Ecore_X_Window win, Ecore_X_Illume_Mode mode)
ecore_x_e_illume_mode_send(Ecore_X_Window win,
Ecore_X_Illume_Mode mode)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
ecore_x_client_message32_send(win, ECORE_X_ATOM_E_ILLUME_MODE,
@ -367,7 +376,8 @@ ecore_x_e_illume_home_del_send(Ecore_X_Window win)
} /* ecore_x_e_illume_home_del_send */
EAPI void
ecore_x_e_illume_drag_set(Ecore_X_Window win, unsigned int drag)
ecore_x_e_illume_drag_set(Ecore_X_Window win,
unsigned int drag)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
ecore_x_window_prop_card32_set(win, ECORE_X_ATOM_E_ILLUME_DRAG, &drag, 1);
@ -380,13 +390,14 @@ ecore_x_e_illume_drag_get(Ecore_X_Window win)
LOGFN(__FILE__, __LINE__, __FUNCTION__);
if (!ecore_x_window_prop_card32_get(win, ECORE_X_ATOM_E_ILLUME_DRAG, &val, 1))
return EINA_FALSE;
return EINA_FALSE;
return val ? EINA_TRUE : EINA_FALSE;
} /* ecore_x_e_illume_drag_get */
EAPI void
ecore_x_e_illume_drag_locked_set(Ecore_X_Window win, unsigned int is_locked)
ecore_x_e_illume_drag_locked_set(Ecore_X_Window win,
unsigned int is_locked)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
ecore_x_window_prop_card32_set(win, ECORE_X_ATOM_E_ILLUME_DRAG_LOCKED,
@ -401,7 +412,7 @@ ecore_x_e_illume_drag_locked_get(Ecore_X_Window win)
LOGFN(__FILE__, __LINE__, __FUNCTION__);
if (!ecore_x_window_prop_card32_get(win, ECORE_X_ATOM_E_ILLUME_DRAG_LOCKED,
&val, 1))
return EINA_FALSE;
return EINA_FALSE;
return val ? EINA_TRUE : EINA_FALSE;
} /* ecore_x_e_illume_drag_locked_get */
@ -454,23 +465,23 @@ ecore_x_e_illume_indicator_geometry_get(Ecore_X_Window win,
LOGFN(__FILE__, __LINE__, __FUNCTION__);
ret =
ecore_x_window_prop_card32_get(win,
ECORE_X_ATOM_E_ILLUME_INDICATOR_GEOMETRY,
geom, 4);
ecore_x_window_prop_card32_get(win,
ECORE_X_ATOM_E_ILLUME_INDICATOR_GEOMETRY,
geom, 4);
if (ret != 4)
return EINA_FALSE;
return EINA_FALSE;
if (x)
*x = geom[0];
*x = geom[0];
if (y)
*y = geom[1];
*y = geom[1];
if (w)
*w = geom[2];
*w = geom[2];
if (h)
*h = geom[3];
*h = geom[3];
return EINA_TRUE;
} /* ecore_x_e_illume_indicator_geometry_get */
@ -505,23 +516,23 @@ ecore_x_e_illume_softkey_geometry_get(Ecore_X_Window win,
LOGFN(__FILE__, __LINE__, __FUNCTION__);
ret =
ecore_x_window_prop_card32_get(win,
ECORE_X_ATOM_E_ILLUME_SOFTKEY_GEOMETRY,
geom, 4);
ecore_x_window_prop_card32_get(win,
ECORE_X_ATOM_E_ILLUME_SOFTKEY_GEOMETRY,
geom, 4);
if (ret != 4)
return EINA_FALSE;
return EINA_FALSE;
if (x)
*x = geom[0];
*x = geom[0];
if (y)
*y = geom[1];
*y = geom[1];
if (w)
*w = geom[2];
*w = geom[2];
if (h)
*h = geom[3];
*h = geom[3];
return EINA_TRUE;
} /* ecore_x_e_illume_softkey_geometry_get */
@ -556,23 +567,23 @@ ecore_x_e_illume_keyboard_geometry_get(Ecore_X_Window win,
LOGFN(__FILE__, __LINE__, __FUNCTION__);
ret =
ecore_x_window_prop_card32_get(win,
ECORE_X_ATOM_E_ILLUME_KEYBOARD_GEOMETRY,
geom, 4);
ecore_x_window_prop_card32_get(win,
ECORE_X_ATOM_E_ILLUME_KEYBOARD_GEOMETRY,
geom, 4);
if (ret != 4)
return EINA_FALSE;
return EINA_FALSE;
if (x)
*x = geom[0];
*x = geom[0];
if (y)
*y = geom[1];
*y = geom[1];
if (w)
*w = geom[2];
*w = geom[2];
if (h)
*h = geom[3];
*h = geom[3];
return EINA_TRUE;
} /* ecore_x_e_illume_keyboard_geometry_get */
@ -583,13 +594,13 @@ _ecore_x_e_quickpanel_atom_get(Ecore_X_Illume_Quickpanel_State state)
switch (state)
{
case ECORE_X_ILLUME_QUICKPANEL_STATE_ON:
return ECORE_X_ATOM_E_ILLUME_QUICKPANEL_ON;
return ECORE_X_ATOM_E_ILLUME_QUICKPANEL_ON;
case ECORE_X_ILLUME_QUICKPANEL_STATE_OFF:
return ECORE_X_ATOM_E_ILLUME_QUICKPANEL_OFF;
return ECORE_X_ATOM_E_ILLUME_QUICKPANEL_OFF;
default:
break;
break;
} /* switch */
return 0;
} /* _ecore_x_e_quickpanel_atom_get */
@ -598,16 +609,17 @@ static Ecore_X_Illume_Quickpanel_State
_ecore_x_e_quickpanel_state_get(Ecore_X_Atom atom)
{
if (atom == ECORE_X_ATOM_E_ILLUME_QUICKPANEL_ON)
return ECORE_X_ILLUME_QUICKPANEL_STATE_ON;
return ECORE_X_ILLUME_QUICKPANEL_STATE_ON;
if (atom == ECORE_X_ATOM_E_ILLUME_QUICKPANEL_OFF)
return ECORE_X_ILLUME_QUICKPANEL_STATE_OFF;
return ECORE_X_ILLUME_QUICKPANEL_STATE_OFF;
return ECORE_X_ILLUME_QUICKPANEL_STATE_UNKNOWN;
} /* _ecore_x_e_quickpanel_state_get */
EAPI void
ecore_x_e_illume_quickpanel_set(Ecore_X_Window win, unsigned int is_quickpanel)
ecore_x_e_illume_quickpanel_set(Ecore_X_Window win,
unsigned int is_quickpanel)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
ecore_x_window_prop_card32_set(win, ECORE_X_ATOM_E_ILLUME_QUICKPANEL,
@ -622,7 +634,7 @@ ecore_x_e_illume_quickpanel_get(Ecore_X_Window win)
LOGFN(__FILE__, __LINE__, __FUNCTION__);
if (!ecore_x_window_prop_card32_get(win, ECORE_X_ATOM_E_ILLUME_QUICKPANEL,
&val, 1))
return EINA_FALSE;
return EINA_FALSE;
return val ? EINA_TRUE : EINA_FALSE;
} /* ecore_x_e_illume_quickpanel_get */
@ -648,7 +660,7 @@ ecore_x_e_illume_quickpanel_state_get(Ecore_X_Window win)
if (!ecore_x_window_prop_atom_get(win,
ECORE_X_ATOM_E_ILLUME_QUICKPANEL_STATE,
&atom, 1))
return ECORE_X_ILLUME_QUICKPANEL_STATE_UNKNOWN;
return ECORE_X_ILLUME_QUICKPANEL_STATE_UNKNOWN;
return _ecore_x_e_quickpanel_state_get(atom);
} /* ecore_x_e_illume_quickpanel_state_get */
@ -693,7 +705,7 @@ ecore_x_e_illume_quickpanel_priority_major_get(Ecore_X_Window win)
if (!ecore_x_window_prop_card32_get(win,
ECORE_X_ATOM_E_ILLUME_QUICKPANEL_PRIORITY_MAJOR,
&val, 1))
return 0;
return 0;
return val;
} /* ecore_x_e_illume_quickpanel_priority_major_get */
@ -717,13 +729,14 @@ ecore_x_e_illume_quickpanel_priority_minor_get(Ecore_X_Window win)
if (!ecore_x_window_prop_card32_get(win,
ECORE_X_ATOM_E_ILLUME_QUICKPANEL_PRIORITY_MINOR,
&val, 1))
return 0;
return 0;
return val;
} /* ecore_x_e_illume_quickpanel_priority_minor_get */
EAPI void
ecore_x_e_illume_quickpanel_zone_set(Ecore_X_Window win, unsigned int zone)
ecore_x_e_illume_quickpanel_zone_set(Ecore_X_Window win,
unsigned int zone)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
ecore_x_window_prop_card32_set(win,
@ -740,7 +753,7 @@ ecore_x_e_illume_quickpanel_zone_get(Ecore_X_Window win)
if (!ecore_x_window_prop_card32_get(win,
ECORE_X_ATOM_E_ILLUME_QUICKPANEL_ZONE,
&val, 1))
return 0;
return 0;
return val;
} /* ecore_x_e_illume_quickpanel_zone_get */
@ -761,10 +774,10 @@ ecore_x_e_comp_sync_counter_set(Ecore_X_Window win,
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
if (counter)
ecore_x_window_prop_xid_set(win, ECORE_X_ATOM_E_COMP_SYNC_COUNTER,
ECORE_X_ATOM_CARDINAL, &counter, 1);
ecore_x_window_prop_xid_set(win, ECORE_X_ATOM_E_COMP_SYNC_COUNTER,
ECORE_X_ATOM_CARDINAL, &counter, 1);
else
ecore_x_window_prop_property_del(win, ECORE_X_ATOM_E_COMP_SYNC_COUNTER);
ecore_x_window_prop_property_del(win, ECORE_X_ATOM_E_COMP_SYNC_COUNTER);
} /* ecore_x_e_comp_sync_counter_set */
EAPI Ecore_X_Sync_Counter
@ -775,24 +788,25 @@ ecore_x_e_comp_sync_counter_get(Ecore_X_Window win)
LOGFN(__FILE__, __LINE__, __FUNCTION__);
ret =
ecore_x_window_prop_xid_get(win,
ECORE_X_ATOM_E_COMP_SYNC_COUNTER,
ECORE_X_ATOM_CARDINAL,
&counter, 1);
ecore_x_window_prop_xid_get(win,
ECORE_X_ATOM_E_COMP_SYNC_COUNTER,
ECORE_X_ATOM_CARDINAL,
&counter, 1);
if (ret != 1)
return 0;
return 0;
return counter;
} /* ecore_x_e_comp_sync_counter_get */
EAPI void
ecore_x_e_comp_sync_draw_done_send(Ecore_X_Window root, Ecore_X_Window win)
ecore_x_e_comp_sync_draw_done_send(Ecore_X_Window root,
Ecore_X_Window win)
{
XEvent xev;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
if (!root)
root = DefaultRootWindow(_ecore_x_disp);
root = DefaultRootWindow(_ecore_x_disp);
xev.xclient.type = ClientMessage;
xev.xclient.display = _ecore_x_disp;
@ -811,13 +825,16 @@ ecore_x_e_comp_sync_draw_done_send(Ecore_X_Window root, Ecore_X_Window win)
} /* ecore_x_e_comp_sync_draw_done_send */
EAPI void
ecore_x_e_comp_sync_draw_size_done_send(Ecore_X_Window root, Ecore_X_Window win, int w, int h)
ecore_x_e_comp_sync_draw_size_done_send(Ecore_X_Window root,
Ecore_X_Window win,
int w,
int h)
{
XEvent xev;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
if (!root)
root = DefaultRootWindow(_ecore_x_disp);
root = DefaultRootWindow(_ecore_x_disp);
xev.xclient.type = ClientMessage;
xev.xclient.display = _ecore_x_disp;
@ -836,18 +853,19 @@ ecore_x_e_comp_sync_draw_size_done_send(Ecore_X_Window root, Ecore_X_Window win,
} /* ecore_x_e_comp_sync_draw_done_send */
EAPI void
ecore_x_e_comp_sync_supported_set(Ecore_X_Window root, Eina_Bool enabled)
ecore_x_e_comp_sync_supported_set(Ecore_X_Window root,
Eina_Bool enabled)
{
Ecore_X_Window win;
if (!root)
root = DefaultRootWindow(_ecore_x_disp);
root = DefaultRootWindow(_ecore_x_disp);
LOGFN(__FILE__, __LINE__, __FUNCTION__);
if (enabled)
{
win = ecore_x_window_new(root, 1, 2, 3, 4);
ecore_x_window_prop_xid_set(win, ECORE_X_ATOM_E_COMP_SYNC_SUPPORTED,
ecore_x_window_prop_xid_set(win, ECORE_X_ATOM_E_COMP_SYNC_SUPPORTED,
ECORE_X_ATOM_WINDOW, &win, 1);
ecore_x_window_prop_xid_set(root, ECORE_X_ATOM_E_COMP_SYNC_SUPPORTED,
ECORE_X_ATOM_WINDOW, &win, 1);
@ -857,15 +875,15 @@ ecore_x_e_comp_sync_supported_set(Ecore_X_Window root, Eina_Bool enabled)
int ret;
ret =
ecore_x_window_prop_xid_get(root,
ECORE_X_ATOM_E_COMP_SYNC_SUPPORTED,
ECORE_X_ATOM_WINDOW,
&win, 1);
ecore_x_window_prop_xid_get(root,
ECORE_X_ATOM_E_COMP_SYNC_SUPPORTED,
ECORE_X_ATOM_WINDOW,
&win, 1);
if ((ret == 1) && (win))
{
ecore_x_window_prop_property_del(
root,
ECORE_X_ATOM_E_COMP_SYNC_SUPPORTED);
root,
ECORE_X_ATOM_E_COMP_SYNC_SUPPORTED);
ecore_x_window_free(win);
}
}
@ -879,22 +897,22 @@ ecore_x_e_comp_sync_supported_get(Ecore_X_Window root)
LOGFN(__FILE__, __LINE__, __FUNCTION__);
if (!root)
root = DefaultRootWindow(_ecore_x_disp);
root = DefaultRootWindow(_ecore_x_disp);
ret =
ecore_x_window_prop_xid_get(root,
ECORE_X_ATOM_E_COMP_SYNC_SUPPORTED,
ECORE_X_ATOM_WINDOW,
&win, 1);
ecore_x_window_prop_xid_get(root,
ECORE_X_ATOM_E_COMP_SYNC_SUPPORTED,
ECORE_X_ATOM_WINDOW,
&win, 1);
if ((ret == 1) && (win))
{
ret =
ecore_x_window_prop_xid_get(win,
ECORE_X_ATOM_E_COMP_SYNC_SUPPORTED,
ECORE_X_ATOM_WINDOW,
&win2, 1);
ecore_x_window_prop_xid_get(win,
ECORE_X_ATOM_E_COMP_SYNC_SUPPORTED,
ECORE_X_ATOM_WINDOW,
&win2, 1);
if ((ret == 1) && (win2 == win))
return EINA_TRUE;
return EINA_TRUE;
}
return EINA_FALSE;
@ -1011,14 +1029,15 @@ ecore_x_e_comp_dump_send(Ecore_X_Window win)
} /* ecore_x_e_comp_dump_send */
EAPI void
ecore_x_e_comp_pixmap_set(Ecore_X_Window win, Ecore_X_Pixmap pixmap)
ecore_x_e_comp_pixmap_set(Ecore_X_Window win,
Ecore_X_Pixmap pixmap)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
if (pixmap)
ecore_x_window_prop_xid_set(win, ECORE_X_ATOM_E_COMP_PIXMAP,
ECORE_X_ATOM_PIXMAP, &pixmap, 1);
ecore_x_window_prop_xid_set(win, ECORE_X_ATOM_E_COMP_PIXMAP,
ECORE_X_ATOM_PIXMAP, &pixmap, 1);
else
ecore_x_window_prop_property_del(win, pixmap);
ecore_x_window_prop_property_del(win, pixmap);
} /* ecore_x_e_comp_pixmap_set */
EAPI Ecore_X_Pixmap
@ -1029,12 +1048,12 @@ ecore_x_e_comp_pixmap_get(Ecore_X_Window win)
LOGFN(__FILE__, __LINE__, __FUNCTION__);
ret =
ecore_x_window_prop_xid_get(win,
ECORE_X_ATOM_E_COMP_PIXMAP,
ECORE_X_ATOM_PIXMAP,
&pixmap, 1);
ecore_x_window_prop_xid_get(win,
ECORE_X_ATOM_E_COMP_PIXMAP,
ECORE_X_ATOM_PIXMAP,
&pixmap, 1);
if (ret != 1)
return 0;
return 0;
return pixmap;
} /* ecore_x_e_comp_pixmap_get */

View File

@ -9,8 +9,9 @@
#include "ecore_x_private.h"
#include "Ecore_X.h"
static int _ecore_x_error_handle(Display *d, XErrorEvent *ev);
static int _ecore_x_io_error_handle(Display *d);
static int _ecore_x_error_handle(Display *d,
XErrorEvent *ev);
static int _ecore_x_io_error_handle(Display *d);
static void (*_error_func)(void *data) = NULL;
static void *_error_data = NULL;
@ -27,7 +28,8 @@ static int _error_code = 0;
* Set the X error handler function
*/
EAPI void
ecore_x_error_handler_set(void (*func)(void *data), const void *data)
ecore_x_error_handler_set(void (*func)(void *data),
const void *data)
{
_error_func = func;
_error_data = (void *)data;
@ -41,7 +43,8 @@ ecore_x_error_handler_set(void (*func)(void *data), const void *data)
* Set the X I/O error handler function
*/
EAPI void
ecore_x_io_error_handler_set(void (*func)(void *data), const void *data)
ecore_x_io_error_handler_set(void (*func)(void *data),
const void *data)
{
_io_error_func = func;
_io_error_data = (void *)data;
@ -79,14 +82,15 @@ _ecore_x_error_handler_init(void)
} /* _ecore_x_error_handler_init */
static int
_ecore_x_error_handle(Display *d, XErrorEvent *ev)
_ecore_x_error_handle(Display *d,
XErrorEvent *ev)
{
if (d == _ecore_x_disp)
{
_error_request_code = ev->request_code;
_error_code = ev->error_code;
if (_error_func)
_error_func(_error_data);
_error_func(_error_data);
}
return 0;
} /* _ecore_x_error_handle */
@ -97,9 +101,9 @@ _ecore_x_io_error_handle(Display *d)
if (d == _ecore_x_disp)
{
if (_io_error_func)
_io_error_func(_io_error_data);
_io_error_func(_io_error_data);
else
exit(-1);
exit(-1);
}
return 0;

File diff suppressed because it is too large Load Diff

View File

@ -27,7 +27,7 @@ _ecore_x_fixes_init(void)
ECORE_X_EVENT_FIXES_SELECTION_NOTIFY = ecore_event_type_new();
}
else
_fixes_available = 0;
_fixes_available = 0;
#else /* ifdef ECORE_XFIXES */
_fixes_available = 0;
@ -37,17 +37,18 @@ _ecore_x_fixes_init(void)
#ifdef ECORE_XFIXES
/* I don't know what to call this function. */
static XRectangle *
_ecore_x_rectangle_ecore_to_x(Ecore_X_Rectangle *rects, int num)
_ecore_x_rectangle_ecore_to_x(Ecore_X_Rectangle *rects,
int num)
{
XRectangle *xrect;
int i;
if (num == 0)
return NULL;
return NULL;
xrect = malloc(sizeof(XRectangle) * num);
if (!xrect)
return NULL;
return NULL;
for (i = 0; i < num; i++)
{
@ -60,17 +61,18 @@ _ecore_x_rectangle_ecore_to_x(Ecore_X_Rectangle *rects, int num)
} /* _ecore_x_rectangle_ecore_to_x */
static Ecore_X_Rectangle *
_ecore_x_rectangle_x_to_ecore(XRectangle *xrect, int num)
_ecore_x_rectangle_x_to_ecore(XRectangle *xrect,
int num)
{
Ecore_X_Rectangle *rects;
int i;
if (num == 0)
return NULL;
return NULL;
rects = malloc(sizeof(Ecore_X_Rectangle) * num);
if (!rects)
return NULL;
return NULL;
for (i = 0; i < num; i++)
{
@ -91,11 +93,11 @@ ecore_x_fixes_selection_notification_request(Ecore_X_Atom selection)
if (_fixes_available)
{
XFixesSelectSelectionInput (_ecore_x_disp,
DefaultRootWindow(_ecore_x_disp),
selection,
XFixesSetSelectionOwnerNotifyMask |
XFixesSelectionWindowDestroyNotifyMask |
XFixesSelectionClientCloseNotifyMask);
DefaultRootWindow(_ecore_x_disp),
selection,
XFixesSetSelectionOwnerNotifyMask |
XFixesSelectionWindowDestroyNotifyMask |
XFixesSelectionClientCloseNotifyMask);
return EINA_TRUE;
}
#endif
@ -103,7 +105,8 @@ ecore_x_fixes_selection_notification_request(Ecore_X_Atom selection)
}
EAPI Ecore_X_Region
ecore_x_region_new(Ecore_X_Rectangle *rects, int num)
ecore_x_region_new(Ecore_X_Rectangle *rects,
int num)
{
#ifdef ECORE_XFIXES
Ecore_X_Region region;
@ -134,7 +137,8 @@ ecore_x_region_new_from_bitmap(Ecore_X_Pixmap bitmap)
} /* ecore_x_region_new_from_bitmap */
EAPI Ecore_X_Region
ecore_x_region_new_from_window(Ecore_X_Window win, Ecore_X_Region_Type type)
ecore_x_region_new_from_window(Ecore_X_Window win,
Ecore_X_Region_Type type)
{
#ifdef ECORE_XFIXES
Ecore_X_Region region;
@ -185,7 +189,9 @@ ecore_x_region_free(Ecore_X_Region region)
} /* ecore_x_region_free */
EAPI void
ecore_x_region_set(Ecore_X_Region region, Ecore_X_Rectangle *rects, int num)
ecore_x_region_set(Ecore_X_Region region,
Ecore_X_Rectangle *rects,
int num)
{
#ifdef ECORE_XFIXES
XRectangle *xrect = _ecore_x_rectangle_ecore_to_x(rects, num);
@ -195,7 +201,8 @@ ecore_x_region_set(Ecore_X_Region region, Ecore_X_Rectangle *rects, int num)
} /* ecore_x_region_set */
EAPI void
ecore_x_region_copy(Ecore_X_Region dest, Ecore_X_Region source)
ecore_x_region_copy(Ecore_X_Region dest,
Ecore_X_Region source)
{
#ifdef ECORE_XFIXES
LOGFN(__FILE__, __LINE__, __FUNCTION__);
@ -254,7 +261,9 @@ ecore_x_region_invert(Ecore_X_Region dest,
} /* ecore_x_region_invert */
EAPI void
ecore_x_region_translate(Ecore_X_Region region, int dx, int dy)
ecore_x_region_translate(Ecore_X_Region region,
int dx,
int dy)
{
#ifdef ECORE_XFIXES
LOGFN(__FILE__, __LINE__, __FUNCTION__);
@ -263,7 +272,8 @@ ecore_x_region_translate(Ecore_X_Region region, int dx, int dy)
} /* ecore_x_region_translate */
EAPI void
ecore_x_region_extents(Ecore_X_Region dest, Ecore_X_Region source)
ecore_x_region_extents(Ecore_X_Region dest,
Ecore_X_Region source)
{
#ifdef ECORE_XFIXES
LOGFN(__FILE__, __LINE__, __FUNCTION__);
@ -272,7 +282,8 @@ ecore_x_region_extents(Ecore_X_Region dest, Ecore_X_Region source)
} /* ecore_x_region_extents */
EAPI Ecore_X_Rectangle *
ecore_x_region_fetch(Ecore_X_Region region, int *num,
ecore_x_region_fetch(Ecore_X_Region region,
int *num,
Ecore_X_Rectangle *bounds){
#ifdef ECORE_XFIXES
Ecore_X_Rectangle *rects;

View File

@ -30,7 +30,7 @@ ecore_x_gc_new(Ecore_X_Drawable draw,
LOGFN(__FILE__, __LINE__, __FUNCTION__);
if (!draw)
draw = DefaultRootWindow(_ecore_x_disp);
draw = DefaultRootWindow(_ecore_x_disp);
memset(&gcv, 0, sizeof (gcv));
@ -39,119 +39,119 @@ ecore_x_gc_new(Ecore_X_Drawable draw,
switch (mask & value_mask)
{
case ECORE_X_GC_VALUE_MASK_FUNCTION:
gcv.function = value_list[idx];
idx++;
break;
gcv.function = value_list[idx];
idx++;
break;
case ECORE_X_GC_VALUE_MASK_PLANE_MASK:
gcv.plane_mask = value_list[idx];
idx++;
break;
gcv.plane_mask = value_list[idx];
idx++;
break;
case ECORE_X_GC_VALUE_MASK_FOREGROUND:
gcv.foreground = value_list[idx];
idx++;
break;
gcv.foreground = value_list[idx];
idx++;
break;
case ECORE_X_GC_VALUE_MASK_BACKGROUND:
gcv.background = value_list[idx];
idx++;
break;
gcv.background = value_list[idx];
idx++;
break;
case ECORE_X_GC_VALUE_MASK_LINE_WIDTH:
gcv.line_width = value_list[idx];
idx++;
break;
gcv.line_width = value_list[idx];
idx++;
break;
case ECORE_X_GC_VALUE_MASK_LINE_STYLE:
gcv.line_style = value_list[idx];
idx++;
break;
gcv.line_style = value_list[idx];
idx++;
break;
case ECORE_X_GC_VALUE_MASK_CAP_STYLE:
gcv.cap_style = value_list[idx];
idx++;
break;
gcv.cap_style = value_list[idx];
idx++;
break;
case ECORE_X_GC_VALUE_MASK_JOIN_STYLE:
gcv.join_style = value_list[idx];
idx++;
break;
gcv.join_style = value_list[idx];
idx++;
break;
case ECORE_X_GC_VALUE_MASK_FILL_STYLE:
gcv.fill_style = value_list[idx];
idx++;
break;
gcv.fill_style = value_list[idx];
idx++;
break;
case ECORE_X_GC_VALUE_MASK_FILL_RULE:
gcv.fill_rule = value_list[idx];
idx++;
break;
gcv.fill_rule = value_list[idx];
idx++;
break;
case ECORE_X_GC_VALUE_MASK_TILE:
gcv.tile = value_list[idx];
idx++;
break;
gcv.tile = value_list[idx];
idx++;
break;
case ECORE_X_GC_VALUE_MASK_STIPPLE:
gcv.stipple = value_list[idx];
idx++;
break;
gcv.stipple = value_list[idx];
idx++;
break;
case ECORE_X_GC_VALUE_MASK_TILE_STIPPLE_ORIGIN_X:
gcv.ts_x_origin = value_list[idx];
idx++;
break;
gcv.ts_x_origin = value_list[idx];
idx++;
break;
case ECORE_X_GC_VALUE_MASK_TILE_STIPPLE_ORIGIN_Y:
gcv.ts_y_origin = value_list[idx];
idx++;
break;
gcv.ts_y_origin = value_list[idx];
idx++;
break;
case ECORE_X_GC_VALUE_MASK_FONT:
gcv.font = value_list[idx];
idx++;
break;
gcv.font = value_list[idx];
idx++;
break;
case ECORE_X_GC_VALUE_MASK_SUBWINDOW_MODE:
gcv.subwindow_mode = value_list[idx];
idx++;
break;
gcv.subwindow_mode = value_list[idx];
idx++;
break;
case ECORE_X_GC_VALUE_MASK_GRAPHICS_EXPOSURES:
gcv.graphics_exposures = value_list[idx];
idx++;
break;
gcv.graphics_exposures = value_list[idx];
idx++;
break;
case ECORE_X_GC_VALUE_MASK_CLIP_ORIGIN_X:
gcv.clip_x_origin = value_list[idx];
idx++;
break;
gcv.clip_x_origin = value_list[idx];
idx++;
break;
case ECORE_X_GC_VALUE_MASK_CLIP_ORIGIN_Y:
gcv.clip_y_origin = value_list[idx];
idx++;
break;
gcv.clip_y_origin = value_list[idx];
idx++;
break;
case ECORE_X_GC_VALUE_MASK_CLIP_MASK:
gcv.clip_mask = value_list[idx];
idx++;
break;
gcv.clip_mask = value_list[idx];
idx++;
break;
case ECORE_X_GC_VALUE_MASK_DASH_OFFSET:
gcv.dash_offset = value_list[idx];
idx++;
break;
gcv.dash_offset = value_list[idx];
idx++;
break;
case ECORE_X_GC_VALUE_MASK_DASH_LIST:
gcv.dashes = value_list[idx];
idx++;
break;
gcv.dashes = value_list[idx];
idx++;
break;
case ECORE_X_GC_VALUE_MASK_ARC_MODE:
gcv.arc_mode = value_list[idx];
idx++;
break;
gcv.arc_mode = value_list[idx];
idx++;
break;
} /* switch */
}

View File

@ -24,17 +24,18 @@ ecore_x_icccm_init(void)
} /* ecore_x_icccm_init */
EAPI void
ecore_x_icccm_state_set(Ecore_X_Window win, Ecore_X_Window_State_Hint state)
ecore_x_icccm_state_set(Ecore_X_Window win,
Ecore_X_Window_State_Hint state)
{
unsigned long c[2];
LOGFN(__FILE__, __LINE__, __FUNCTION__);
if (state == ECORE_X_WINDOW_STATE_HINT_WITHDRAWN)
c[0] = WithdrawnState;
c[0] = WithdrawnState;
else if (state == ECORE_X_WINDOW_STATE_HINT_NORMAL)
c[0] = NormalState;
c[0] = NormalState;
else if (state == ECORE_X_WINDOW_STATE_HINT_ICONIC)
c[0] = IconicState;
c[0] = IconicState;
c[1] = None;
XChangeProperty(_ecore_x_disp, win, ECORE_X_ATOM_WM_STATE,
@ -60,21 +61,22 @@ ecore_x_icccm_state_get(Ecore_X_Window win)
if ((prop_ret) && (num_ret == 2))
{
if (prop_ret[0] == WithdrawnState)
hint = ECORE_X_WINDOW_STATE_HINT_WITHDRAWN;
hint = ECORE_X_WINDOW_STATE_HINT_WITHDRAWN;
else if (prop_ret[0] == NormalState)
hint = ECORE_X_WINDOW_STATE_HINT_NORMAL;
hint = ECORE_X_WINDOW_STATE_HINT_NORMAL;
else if (prop_ret[0] == IconicState)
hint = ECORE_X_WINDOW_STATE_HINT_ICONIC;
hint = ECORE_X_WINDOW_STATE_HINT_ICONIC;
}
if (prop_ret)
XFree(prop_ret);
XFree(prop_ret);
return hint;
} /* ecore_x_icccm_state_get */
EAPI void
ecore_x_icccm_delete_window_send(Ecore_X_Window win, Ecore_X_Time t)
ecore_x_icccm_delete_window_send(Ecore_X_Window win,
Ecore_X_Time t)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
ecore_x_client_message32_send(win, ECORE_X_ATOM_WM_PROTOCOLS,
@ -84,7 +86,8 @@ ecore_x_icccm_delete_window_send(Ecore_X_Window win, Ecore_X_Time t)
} /* ecore_x_icccm_delete_window_send */
EAPI void
ecore_x_icccm_take_focus_send(Ecore_X_Window win, Ecore_X_Time t)
ecore_x_icccm_take_focus_send(Ecore_X_Window win,
Ecore_X_Time t)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
ecore_x_client_message32_send(win, ECORE_X_ATOM_WM_PROTOCOLS,
@ -94,7 +97,8 @@ ecore_x_icccm_take_focus_send(Ecore_X_Window win, Ecore_X_Time t)
} /* ecore_x_icccm_take_focus_send */
EAPI void
ecore_x_icccm_save_yourself_send(Ecore_X_Window win, Ecore_X_Time t)
ecore_x_icccm_save_yourself_send(Ecore_X_Window win,
Ecore_X_Time t)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
ecore_x_client_message32_send(win, ECORE_X_ATOM_WM_PROTOCOLS,
@ -104,7 +108,11 @@ ecore_x_icccm_save_yourself_send(Ecore_X_Window win, Ecore_X_Time t)
} /* ecore_x_icccm_save_yourself_send */
EAPI void
ecore_x_icccm_move_resize_send(Ecore_X_Window win, int x, int y, int w, int h)
ecore_x_icccm_move_resize_send(Ecore_X_Window win,
int x,
int y,
int w,
int h)
{
XEvent ev;
@ -124,30 +132,30 @@ ecore_x_icccm_move_resize_send(Ecore_X_Window win, int x, int y, int w, int h)
} /* ecore_x_icccm_move_resize_send */
EAPI void
ecore_x_icccm_hints_set(Ecore_X_Window win,
Eina_Bool accepts_focus,
ecore_x_icccm_hints_set(Ecore_X_Window win,
Eina_Bool accepts_focus,
Ecore_X_Window_State_Hint initial_state,
Ecore_X_Pixmap icon_pixmap,
Ecore_X_Pixmap icon_mask,
Ecore_X_Window icon_window,
Ecore_X_Window window_group,
Eina_Bool is_urgent)
Ecore_X_Pixmap icon_pixmap,
Ecore_X_Pixmap icon_mask,
Ecore_X_Window icon_window,
Ecore_X_Window window_group,
Eina_Bool is_urgent)
{
XWMHints *hints;
hints = XAllocWMHints();
if (!hints)
return;
return;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
hints->flags = InputHint | StateHint;
hints->input = accepts_focus;
if (initial_state == ECORE_X_WINDOW_STATE_HINT_WITHDRAWN)
hints->initial_state = WithdrawnState;
hints->initial_state = WithdrawnState;
else if (initial_state == ECORE_X_WINDOW_STATE_HINT_NORMAL)
hints->initial_state = NormalState;
hints->initial_state = NormalState;
else if (initial_state == ECORE_X_WINDOW_STATE_HINT_ICONIC)
hints->initial_state = IconicState;
hints->initial_state = IconicState;
if (icon_pixmap != 0)
{
@ -174,45 +182,45 @@ ecore_x_icccm_hints_set(Ecore_X_Window win,
}
if (is_urgent)
hints->flags |= XUrgencyHint;
hints->flags |= XUrgencyHint;
XSetWMHints(_ecore_x_disp, win, hints);
XFree(hints);
} /* ecore_x_icccm_hints_set */
EAPI Eina_Bool
ecore_x_icccm_hints_get(Ecore_X_Window win,
Eina_Bool *accepts_focus,
ecore_x_icccm_hints_get(Ecore_X_Window win,
Eina_Bool *accepts_focus,
Ecore_X_Window_State_Hint *initial_state,
Ecore_X_Pixmap *icon_pixmap,
Ecore_X_Pixmap *icon_mask,
Ecore_X_Window *icon_window,
Ecore_X_Window *window_group,
Eina_Bool *is_urgent)
Ecore_X_Pixmap *icon_pixmap,
Ecore_X_Pixmap *icon_mask,
Ecore_X_Window *icon_window,
Ecore_X_Window *window_group,
Eina_Bool *is_urgent)
{
XWMHints *hints;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
if (accepts_focus)
*accepts_focus = EINA_TRUE;
*accepts_focus = EINA_TRUE;
if (initial_state)
*initial_state = ECORE_X_WINDOW_STATE_HINT_NORMAL;
*initial_state = ECORE_X_WINDOW_STATE_HINT_NORMAL;
if (icon_pixmap)
*icon_pixmap = 0;
*icon_pixmap = 0;
if (icon_mask)
*icon_mask = 0;
*icon_mask = 0;
if (icon_window)
*icon_window = 0;
*icon_window = 0;
if (window_group)
*window_group = 0;
*window_group = 0;
if (is_urgent)
*is_urgent = EINA_FALSE;
*is_urgent = EINA_FALSE;
hints = XGetWMHints(_ecore_x_disp, win);
if (hints)
@ -220,35 +228,35 @@ ecore_x_icccm_hints_get(Ecore_X_Window win,
if ((hints->flags & InputHint) && (accepts_focus))
{
if (hints->input)
*accepts_focus = EINA_TRUE;
*accepts_focus = EINA_TRUE;
else
*accepts_focus = EINA_FALSE;
*accepts_focus = EINA_FALSE;
}
if ((hints->flags & StateHint) && (initial_state))
{
if (hints->initial_state == WithdrawnState)
*initial_state = ECORE_X_WINDOW_STATE_HINT_WITHDRAWN;
*initial_state = ECORE_X_WINDOW_STATE_HINT_WITHDRAWN;
else if (hints->initial_state == NormalState)
*initial_state = ECORE_X_WINDOW_STATE_HINT_NORMAL;
*initial_state = ECORE_X_WINDOW_STATE_HINT_NORMAL;
else if (hints->initial_state == IconicState)
*initial_state = ECORE_X_WINDOW_STATE_HINT_ICONIC;
*initial_state = ECORE_X_WINDOW_STATE_HINT_ICONIC;
}
if ((hints->flags & IconPixmapHint) && (icon_pixmap))
*icon_pixmap = hints->icon_pixmap;
*icon_pixmap = hints->icon_pixmap;
if ((hints->flags & IconMaskHint) && (icon_mask))
*icon_mask = hints->icon_mask;
*icon_mask = hints->icon_mask;
if ((hints->flags & IconWindowHint) && (icon_window))
*icon_window = hints->icon_window;
*icon_window = hints->icon_window;
if ((hints->flags & WindowGroupHint) && (window_group))
*window_group = hints->window_group;
*window_group = hints->window_group;
if ((hints->flags & XUrgencyHint) && (is_urgent))
*is_urgent = EINA_TRUE;
*is_urgent = EINA_TRUE;
XFree(hints);
return EINA_TRUE;
@ -258,25 +266,30 @@ ecore_x_icccm_hints_get(Ecore_X_Window win,
} /* ecore_x_icccm_hints_get */
EAPI void
ecore_x_icccm_size_pos_hints_set(Ecore_X_Window win,
Eina_Bool request_pos,
ecore_x_icccm_size_pos_hints_set(Ecore_X_Window win,
Eina_Bool request_pos,
Ecore_X_Gravity gravity,
int min_w, int min_h,
int max_w, int max_h,
int base_w, int base_h,
int step_x, int step_y,
double min_aspect, double max_aspect)
int min_w,
int min_h,
int max_w,
int max_h,
int base_w,
int base_h,
int step_x,
int step_y,
double min_aspect,
double max_aspect)
{
XSizeHints hint;
long mask;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
if (!XGetWMNormalHints(_ecore_x_disp, win, &hint, &mask))
memset(&hint, 0, sizeof(XSizeHints));
memset(&hint, 0, sizeof(XSizeHints));
hint.flags = 0;
if (request_pos)
hint.flags |= USPosition;
hint.flags |= USPosition;
if (gravity != ECORE_X_GRAVITY_NW)
{
@ -325,14 +338,19 @@ ecore_x_icccm_size_pos_hints_set(Ecore_X_Window win,
} /* ecore_x_icccm_size_pos_hints_set */
EAPI Eina_Bool
ecore_x_icccm_size_pos_hints_get(Ecore_X_Window win,
Eina_Bool *request_pos,
ecore_x_icccm_size_pos_hints_get(Ecore_X_Window win,
Eina_Bool *request_pos,
Ecore_X_Gravity *gravity,
int *min_w, int *min_h,
int *max_w, int *max_h,
int *base_w, int *base_h,
int *step_x, int *step_y,
double *min_aspect, double *max_aspect)
int *min_w,
int *min_h,
int *max_w,
int *max_h,
int *base_w,
int *base_h,
int *step_x,
int *step_y,
double *min_aspect,
double *max_aspect)
{
XSizeHints hint;
long mask;
@ -345,23 +363,23 @@ ecore_x_icccm_size_pos_hints_get(Ecore_X_Window win,
LOGFN(__FILE__, __LINE__, __FUNCTION__);
if (!XGetWMNormalHints(_ecore_x_disp, win, &hint, &mask))
return EINA_FALSE;
return EINA_FALSE;
if ((hint.flags & USPosition) || ((hint.flags & PPosition)))
{
if (request_pos)
*request_pos = EINA_TRUE;
*request_pos = EINA_TRUE;
}
else if (request_pos)
*request_pos = EINA_FALSE;
*request_pos = EINA_FALSE;
if (hint.flags & PWinGravity)
{
if (gravity)
*gravity = hint.win_gravity;
*gravity = hint.win_gravity;
}
else if (gravity)
*gravity = ECORE_X_GRAVITY_NW;
*gravity = ECORE_X_GRAVITY_NW;
if (hint.flags & PMinSize)
{
@ -374,10 +392,10 @@ ecore_x_icccm_size_pos_hints_get(Ecore_X_Window win,
maxw = hint.max_width;
maxh = hint.max_height;
if (maxw < minw)
maxw = minw;
maxw = minw;
if (maxh < minh)
maxh = minh;
maxh = minh;
}
if (hint.flags & PBaseSize)
@ -385,10 +403,10 @@ ecore_x_icccm_size_pos_hints_get(Ecore_X_Window win,
basew = hint.base_width;
baseh = hint.base_height;
if (basew > minw)
minw = basew;
minw = basew;
if (baseh > minh)
minh = baseh;
minh = baseh;
}
if (hint.flags & PResizeInc)
@ -396,88 +414,89 @@ ecore_x_icccm_size_pos_hints_get(Ecore_X_Window win,
stepx = hint.width_inc;
stepy = hint.height_inc;
if (stepx < 1)
stepx = 1;
stepx = 1;
if (stepy < 1)
stepy = 1;
stepy = 1;
}
if (hint.flags & PAspect)
{
if (hint.min_aspect.y > 0)
mina = ((double)hint.min_aspect.x) / ((double)hint.min_aspect.y);
mina = ((double)hint.min_aspect.x) / ((double)hint.min_aspect.y);
if (hint.max_aspect.y > 0)
maxa = ((double)hint.max_aspect.x) / ((double)hint.max_aspect.y);
maxa = ((double)hint.max_aspect.x) / ((double)hint.max_aspect.y);
}
if (min_w)
*min_w = minw;
*min_w = minw;
if (min_h)
*min_h = minh;
*min_h = minh;
if (max_w)
*max_w = maxw;
*max_w = maxw;
if (max_h)
*max_h = maxh;
*max_h = maxh;
if (base_w)
*base_w = basew;
*base_w = basew;
if (base_h)
*base_h = baseh;
*base_h = baseh;
if (step_x)
*step_x = stepx;
*step_x = stepx;
if (step_y)
*step_y = stepy;
*step_y = stepy;
if (min_aspect)
*min_aspect = mina;
*min_aspect = mina;
if (max_aspect)
*max_aspect = maxa;
*max_aspect = maxa;
return EINA_TRUE;
} /* ecore_x_icccm_size_pos_hints_get */
EAPI void
ecore_x_icccm_title_set(Ecore_X_Window win, const char *t)
ecore_x_icccm_title_set(Ecore_X_Window win,
const char *t)
{
char *list[1];
XTextProperty xprop;
int ret;
if (!t)
return;
return;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
xprop.value = NULL;
#ifdef X_HAVE_UTF8_STRING
list[0] = strdup(t);
ret =
Xutf8TextListToTextProperty(_ecore_x_disp, list, 1, XUTF8StringStyle,
&xprop);
Xutf8TextListToTextProperty(_ecore_x_disp, list, 1, XUTF8StringStyle,
&xprop);
#else /* ifdef X_HAVE_UTF8_STRING */
list[0] = strdup(t);
ret =
XmbTextListToTextProperty(_ecore_x_disp, list, 1, XStdICCTextStyle,
&xprop);
XmbTextListToTextProperty(_ecore_x_disp, list, 1, XStdICCTextStyle,
&xprop);
#endif /* ifdef X_HAVE_UTF8_STRING */
if (ret >= Success)
{
XSetWMName(_ecore_x_disp, win, &xprop);
if (xprop.value)
XFree(xprop.value);
XFree(xprop.value);
}
else if (XStringListToTextProperty(list, 1, &xprop) >= Success)
{
XSetWMName(_ecore_x_disp, win, &xprop);
if (xprop.value)
XFree(xprop.value);
XFree(xprop.value);
}
free(list[0]);
@ -500,30 +519,30 @@ ecore_x_icccm_title_get(Ecore_X_Window win)
int ret;
if (xprop.encoding == ECORE_X_ATOM_UTF8_STRING)
t = strdup((char *)xprop.value);
t = strdup((char *)xprop.value);
else
{
/* convert to utf8 */
/* convert to utf8 */
#ifdef X_HAVE_UTF8_STRING
ret = Xutf8TextPropertyToTextList(_ecore_x_disp, &xprop,
&list, &num);
ret = Xutf8TextPropertyToTextList(_ecore_x_disp, &xprop,
&list, &num);
#else /* ifdef X_HAVE_UTF8_STRING */
ret = XmbTextPropertyToTextList(_ecore_x_disp, &xprop,
&list, &num);
ret = XmbTextPropertyToTextList(_ecore_x_disp, &xprop,
&list, &num);
#endif /* ifdef X_HAVE_UTF8_STRING */
if ((ret == XLocaleNotSupported) ||
(ret == XNoMemory) || (ret == XConverterNotFound))
if ((ret == XLocaleNotSupported) ||
(ret == XNoMemory) || (ret == XConverterNotFound))
t = strdup((char *)xprop.value);
else if ((ret >= Success) && (num > 0))
else if ((ret >= Success) && (num > 0))
t = strdup(list[0]);
if (list)
if (list)
XFreeStringList(list);
}
if (xprop.value)
XFree(xprop.value);
XFree(xprop.value);
return t;
}
@ -545,9 +564,9 @@ ecore_x_icccm_protocol_atoms_set(Ecore_X_Window win,
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
if (num > 0)
XSetWMProtocols(_ecore_x_disp, win, (Atom *)(protos), num);
XSetWMProtocols(_ecore_x_disp, win, (Atom *)(protos), num);
else
XDeleteProperty(_ecore_x_disp, win, ECORE_X_ATOM_WM_PROTOCOLS);
XDeleteProperty(_ecore_x_disp, win, ECORE_X_ATOM_WM_PROTOCOLS);
} /* ecore_x_icccm_protocol_atoms_set */
/**
@ -557,9 +576,9 @@ ecore_x_icccm_protocol_atoms_set(Ecore_X_Window win,
* @param on On/Off
*/
EAPI void
ecore_x_icccm_protocol_set(Ecore_X_Window win,
ecore_x_icccm_protocol_set(Ecore_X_Window win,
Ecore_X_WM_Protocol protocol,
Eina_Bool on)
Eina_Bool on)
{
Atom *protos = NULL;
Atom proto;
@ -569,7 +588,7 @@ ecore_x_icccm_protocol_set(Ecore_X_Window win,
/* Check for invalid values */
if (protocol >= ECORE_X_WM_PROTOCOL_NUM)
return;
return;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
proto = _ecore_x_atoms_wm_protocols[protocol];
@ -594,14 +613,14 @@ ecore_x_icccm_protocol_set(Ecore_X_Window win,
Atom *new_protos = NULL;
if (already_set)
goto leave;
goto leave;
new_protos = malloc((protos_count + 1) * sizeof(Atom));
if (!new_protos)
goto leave;
goto leave;
for (i = 0; i < protos_count; i++)
new_protos[i] = protos[i];
new_protos[i] = protos[i];
new_protos[protos_count] = proto;
XSetWMProtocols(_ecore_x_disp, win, new_protos, protos_count + 1);
free(new_protos);
@ -609,7 +628,7 @@ ecore_x_icccm_protocol_set(Ecore_X_Window win,
else
{
if (!already_set)
goto leave;
goto leave;
for (i = 0; i < protos_count; i++)
{
@ -618,13 +637,13 @@ ecore_x_icccm_protocol_set(Ecore_X_Window win,
int j;
for (j = i + 1; j < protos_count; j++)
protos[j - 1] = protos[j];
protos[j - 1] = protos[j];
if (protos_count > 1)
XSetWMProtocols(_ecore_x_disp, win, protos,
protos_count - 1);
XSetWMProtocols(_ecore_x_disp, win, protos,
protos_count - 1);
else
XDeleteProperty(_ecore_x_disp, win,
ECORE_X_ATOM_WM_PROTOCOLS);
XDeleteProperty(_ecore_x_disp, win,
ECORE_X_ATOM_WM_PROTOCOLS);
goto leave;
}
@ -633,7 +652,7 @@ ecore_x_icccm_protocol_set(Ecore_X_Window win,
leave:
if (protos)
XFree(protos);
XFree(protos);
} /* ecore_x_icccm_protocol_set */
/**
@ -643,7 +662,8 @@ leave:
* @return 1 if the protocol is set, else 0.
*/
EAPI Eina_Bool
ecore_x_icccm_protocol_isset(Ecore_X_Window win, Ecore_X_WM_Protocol protocol)
ecore_x_icccm_protocol_isset(Ecore_X_Window win,
Ecore_X_WM_Protocol protocol)
{
Atom proto, *protos = NULL;
int i, protos_count = 0;
@ -651,23 +671,23 @@ ecore_x_icccm_protocol_isset(Ecore_X_Window win, Ecore_X_WM_Protocol protocol)
/* check for invalid values */
if (protocol >= ECORE_X_WM_PROTOCOL_NUM)
return EINA_FALSE;
return EINA_FALSE;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
proto = _ecore_x_atoms_wm_protocols[protocol];
if (!XGetWMProtocols(_ecore_x_disp, win, &protos, &protos_count))
return EINA_FALSE;
return EINA_FALSE;
for (i = 0; i < protos_count; i++)
if (protos[i] == proto)
{
ret = EINA_TRUE;
break;
}
if (protos[i] == proto)
{
ret = EINA_TRUE;
break;
}
if (protos)
XFree(protos);
XFree(protos);
return ret;
} /* ecore_x_icccm_protocol_isset */
@ -681,13 +701,15 @@ ecore_x_icccm_protocol_isset(Ecore_X_Window win, Ecore_X_WM_Protocol protocol)
* Set a window name * class
*/
EAPI void
ecore_x_icccm_name_class_set(Ecore_X_Window win, const char *n, const char *c)
ecore_x_icccm_name_class_set(Ecore_X_Window win,
const char *n,
const char *c)
{
XClassHint *xch;
xch = XAllocClassHint();
if (!xch)
return;
return;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
xch->res_name = (char *)n;
@ -705,28 +727,30 @@ ecore_x_icccm_name_class_set(Ecore_X_Window win, const char *n, const char *c)
* Get a window name * class
*/
EAPI void
ecore_x_icccm_name_class_get(Ecore_X_Window win, char **n, char **c)
ecore_x_icccm_name_class_get(Ecore_X_Window win,
char **n,
char **c)
{
XClassHint xch;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
if (n)
*n = NULL;
*n = NULL;
if (c)
*c = NULL;
*c = NULL;
xch.res_name = NULL;
xch.res_class = NULL;
if (XGetClassHint(_ecore_x_disp, win, &xch))
{
if (n)
if (xch.res_name)
*n = strdup(xch.res_name);
if (xch.res_name)
*n = strdup(xch.res_name);
if (c)
if (xch.res_class)
*c = strdup(xch.res_class);
if (xch.res_class)
*c = strdup(xch.res_class);
XFree(xch.res_name);
XFree(xch.res_class);
@ -758,7 +782,9 @@ ecore_x_icccm_client_machine_get(Ecore_X_Window win)
* @param argv Arguments.
*/
EAPI void
ecore_x_icccm_command_set(Ecore_X_Window win, int argc, char **argv)
ecore_x_icccm_command_set(Ecore_X_Window win,
int argc,
char **argv)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
XSetCommand(_ecore_x_disp, win, argv, argc);
@ -774,31 +800,33 @@ ecore_x_icccm_command_set(Ecore_X_Window win, int argc, char **argv)
* @param argv Arguments.
*/
EAPI void
ecore_x_icccm_command_get(Ecore_X_Window win, int *argc, char ***argv)
ecore_x_icccm_command_get(Ecore_X_Window win,
int *argc,
char ***argv)
{
int i, c;
char **v;
if (argc)
*argc = 0;
*argc = 0;
if (argv)
*argv = NULL;
*argv = NULL;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
if (!XGetCommand(_ecore_x_disp, win, &v, &c))
return;
return;
if (c < 1)
{
if (v)
XFreeStringList(v);
XFreeStringList(v);
return;
}
if (argc)
*argc = c;
*argc = c;
if (argv)
{
@ -807,7 +835,7 @@ ecore_x_icccm_command_get(Ecore_X_Window win, int *argc, char ***argv)
{
XFreeStringList(v);
if (argc)
*argc = 0;
*argc = 0;
return;
}
@ -815,9 +843,9 @@ ecore_x_icccm_command_get(Ecore_X_Window win, int *argc, char ***argv)
for (i = 0; i < c; i++)
{
if (v[i])
(*argv)[i] = strdup(v[i]);
(*argv)[i] = strdup(v[i]);
else
(*argv)[i] = strdup("");
(*argv)[i] = strdup("");
}
}
@ -832,7 +860,8 @@ ecore_x_icccm_command_get(Ecore_X_Window win, int *argc, char ***argv)
* Set a window icon name
*/
EAPI void
ecore_x_icccm_icon_name_set(Ecore_X_Window win, const char *t)
ecore_x_icccm_icon_name_set(Ecore_X_Window win,
const char *t)
{
char *list[1];
XTextProperty xprop;
@ -853,13 +882,13 @@ ecore_x_icccm_icon_name_set(Ecore_X_Window win, const char *t)
{
XSetWMIconName(_ecore_x_disp, win, &xprop);
if (xprop.value)
XFree(xprop.value);
XFree(xprop.value);
}
else if (XStringListToTextProperty(list, 1, &xprop) >= Success)
{
XSetWMIconName(_ecore_x_disp, win, &xprop);
if (xprop.value)
XFree(xprop.value);
XFree(xprop.value);
}
free(list[0]);
@ -889,33 +918,33 @@ ecore_x_icccm_icon_name_get(Ecore_X_Window win)
int ret;
if (xprop.encoding == ECORE_X_ATOM_UTF8_STRING)
t = strdup((char *)xprop.value);
t = strdup((char *)xprop.value);
else
{
/* convert to utf8 */
/* convert to utf8 */
#ifdef X_HAVE_UTF8_STRING
ret = Xutf8TextPropertyToTextList(_ecore_x_disp, &xprop,
&list, &num);
ret = Xutf8TextPropertyToTextList(_ecore_x_disp, &xprop,
&list, &num);
#else /* ifdef X_HAVE_UTF8_STRING */
ret = XmbTextPropertyToTextList(_ecore_x_disp, &xprop,
&list, &num);
ret = XmbTextPropertyToTextList(_ecore_x_disp, &xprop,
&list, &num);
#endif /* ifdef X_HAVE_UTF8_STRING */
if ((ret == XLocaleNotSupported) ||
(ret == XNoMemory) || (ret == XConverterNotFound))
if ((ret == XLocaleNotSupported) ||
(ret == XNoMemory) || (ret == XConverterNotFound))
t = strdup((char *)xprop.value);
else if (ret >= Success)
{
if ((num >= 1) && (list))
else if (ret >= Success)
{
if ((num >= 1) && (list))
t = strdup(list[0]);
if (list)
if (list)
XFreeStringList(list);
}
}
}
if (xprop.value)
XFree(xprop.value);
XFree(xprop.value);
return t;
}
@ -930,7 +959,8 @@ ecore_x_icccm_icon_name_get(Ecore_X_Window win)
* @param subwin The subwindow to be added to the colormap windows list
*/
EAPI void
ecore_x_icccm_colormap_window_set(Ecore_X_Window win, Ecore_X_Window subwin)
ecore_x_icccm_colormap_window_set(Ecore_X_Window win,
Ecore_X_Window subwin)
{
int num = 0, i;
unsigned char *old_data = NULL;
@ -945,7 +975,7 @@ ecore_x_icccm_colormap_window_set(Ecore_X_Window win, Ecore_X_Window subwin)
{
newset = calloc(1, sizeof(Window));
if (!newset)
return;
return;
newset[0] = subwin;
num = 1;
@ -956,14 +986,14 @@ ecore_x_icccm_colormap_window_set(Ecore_X_Window win, Ecore_X_Window subwin)
newset = calloc(num + 1, sizeof(Window));
oldset = (Window *)old_data;
if (!newset)
return;
return;
for (i = 0; i < num; ++i)
{
if (oldset[i] == subwin)
{
if (old_data)
XFree(old_data);
XFree(old_data);
old_data = NULL;
free(newset);
@ -975,7 +1005,7 @@ ecore_x_icccm_colormap_window_set(Ecore_X_Window win, Ecore_X_Window subwin)
newset[num++] = subwin;
if (old_data)
XFree(old_data);
XFree(old_data);
data = (unsigned char *)newset;
}
@ -992,7 +1022,8 @@ ecore_x_icccm_colormap_window_set(Ecore_X_Window win, Ecore_X_Window subwin)
* @param subwin The window to be removed from the colormap window list.
*/
EAPI void
ecore_x_icccm_colormap_window_unset(Ecore_X_Window win, Ecore_X_Window subwin)
ecore_x_icccm_colormap_window_unset(Ecore_X_Window win,
Ecore_X_Window subwin)
{
int num = 0, i, j, k = 0;
unsigned char *old_data = NULL;
@ -1004,7 +1035,7 @@ ecore_x_icccm_colormap_window_unset(Ecore_X_Window win, Ecore_X_Window subwin)
if (!ecore_x_window_prop_property_get(win,
ECORE_X_ATOM_WM_COLORMAP_WINDOWS,
XA_WINDOW, 32, &old_data, &num))
return;
return;
oldset = (Window *)old_data;
for (i = 0; i < num; i++)
@ -1016,7 +1047,7 @@ ecore_x_icccm_colormap_window_unset(Ecore_X_Window win, Ecore_X_Window subwin)
XDeleteProperty(_ecore_x_disp,
win, ECORE_X_ATOM_WM_COLORMAP_WINDOWS);
if (old_data)
XFree(old_data);
XFree(old_data);
old_data = NULL;
return;
@ -1026,18 +1057,18 @@ ecore_x_icccm_colormap_window_unset(Ecore_X_Window win, Ecore_X_Window subwin)
newset = calloc(num - 1, sizeof(Window));
data = (unsigned char *)newset;
for (j = 0; j < num; ++j)
if (oldset[j] != subwin)
newset[k++] = oldset[j];
if (oldset[j] != subwin)
newset[k++] = oldset[j];
ecore_x_window_prop_property_set(
win,
ECORE_X_ATOM_WM_COLORMAP_WINDOWS,
XA_WINDOW,
32,
data,
k);
win,
ECORE_X_ATOM_WM_COLORMAP_WINDOWS,
XA_WINDOW,
32,
data,
k);
if (old_data)
XFree(old_data);
XFree(old_data);
old_data = NULL;
free(newset);
@ -1047,7 +1078,7 @@ ecore_x_icccm_colormap_window_unset(Ecore_X_Window win, Ecore_X_Window subwin)
}
if (old_data)
XFree(old_data);
XFree(old_data);
} /* ecore_x_icccm_colormap_window_unset */
/**
@ -1056,7 +1087,8 @@ ecore_x_icccm_colormap_window_unset(Ecore_X_Window win, Ecore_X_Window subwin)
* @param forwin the toplevel window
*/
EAPI void
ecore_x_icccm_transient_for_set(Ecore_X_Window win, Ecore_X_Window forwin)
ecore_x_icccm_transient_for_set(Ecore_X_Window win,
Ecore_X_Window forwin)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
XSetTransientForHint(_ecore_x_disp, win, forwin);
@ -1085,9 +1117,9 @@ ecore_x_icccm_transient_for_get(Ecore_X_Window win)
LOGFN(__FILE__, __LINE__, __FUNCTION__);
if (XGetTransientForHint(_ecore_x_disp, win, &forwin))
return (Ecore_X_Window)forwin;
return (Ecore_X_Window)forwin;
else
return 0;
return 0;
} /* ecore_x_icccm_transient_for_get */
/**
@ -1096,7 +1128,8 @@ ecore_x_icccm_transient_for_get(Ecore_X_Window win)
* @param role The role string
*/
EAPI void
ecore_x_icccm_window_role_set(Ecore_X_Window win, const char *role)
ecore_x_icccm_window_role_set(Ecore_X_Window win,
const char *role)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
ecore_x_window_prop_string_set(win, ECORE_X_ATOM_WM_WINDOW_ROLE,
@ -1124,7 +1157,8 @@ ecore_x_icccm_window_role_get(Ecore_X_Window win)
* the main window must have this property set to the app's main window.
*/
EAPI void
ecore_x_icccm_client_leader_set(Ecore_X_Window win, Ecore_X_Window l)
ecore_x_icccm_client_leader_set(Ecore_X_Window win,
Ecore_X_Window l)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
ecore_x_window_prop_window_set(win, ECORE_X_ATOM_WM_CLIENT_LEADER,
@ -1143,22 +1177,23 @@ ecore_x_icccm_client_leader_get(Ecore_X_Window win)
LOGFN(__FILE__, __LINE__, __FUNCTION__);
if (ecore_x_window_prop_window_get(win, ECORE_X_ATOM_WM_CLIENT_LEADER,
&l, 1) > 0)
return l;
return l;
return 0;
} /* ecore_x_icccm_client_leader_get */
EAPI void
ecore_x_icccm_iconic_request_send(Ecore_X_Window win, Ecore_X_Window root)
ecore_x_icccm_iconic_request_send(Ecore_X_Window win,
Ecore_X_Window root)
{
XEvent xev;
if (!win)
return;
return;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
if (!root)
root = DefaultRootWindow(_ecore_x_disp);
root = DefaultRootWindow(_ecore_x_disp);
xev.xclient.type = ClientMessage;
xev.xclient.serial = 0;

View File

@ -15,7 +15,8 @@ static int _ecore_x_image_shm_can = -1;
static int _ecore_x_image_err = 0;
static int
_ecore_x_image_error_handler(Display *d __UNUSED__, XErrorEvent *ev __UNUSED__)
_ecore_x_image_error_handler(Display *d __UNUSED__,
XErrorEvent *ev __UNUSED__)
{
_ecore_x_image_err = 1;
return 0;
@ -29,7 +30,7 @@ _ecore_x_image_shm_check(void)
XImage *xim;
if (_ecore_x_image_shm_can != -1)
return;
return;
XSync(_ecore_x_disp, False);
_ecore_x_image_err = 0;
@ -104,13 +105,16 @@ struct _Ecore_X_Image
};
EAPI Ecore_X_Image *
ecore_x_image_new(int w, int h, Ecore_X_Visual vis, int depth)
ecore_x_image_new(int w,
int h,
Ecore_X_Visual vis,
int depth)
{
Ecore_X_Image *im;
im = calloc(1, sizeof(Ecore_X_Image));
if (!im)
return NULL;
return NULL;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
im->w = w;
@ -153,7 +157,7 @@ _ecore_x_image_shm_create(Ecore_X_Image *im)
ZPixmap, NULL, &(im->shminfo),
im->w, im->h);
if (!im->xim)
return;
return;
im->shminfo.shmid = shmget(IPC_PRIVATE,
im->xim->bytes_per_line * im->xim->height,
@ -183,16 +187,22 @@ _ecore_x_image_shm_create(Ecore_X_Image *im)
im->bpl = im->xim->bytes_per_line;
im->rows = im->xim->height;
if (im->xim->bits_per_pixel <= 8)
im->bpp = 1;
im->bpp = 1;
else if (im->xim->bits_per_pixel <= 16)
im->bpp = 2;
im->bpp = 2;
else
im->bpp = 4;
im->bpp = 4;
} /* _ecore_x_image_shm_create */
EAPI Eina_Bool
ecore_x_image_get(Ecore_X_Image *im, Ecore_X_Drawable draw,
int x, int y, int sx, int sy, int w, int h)
ecore_x_image_get(Ecore_X_Image *im,
Ecore_X_Drawable draw,
int x,
int y,
int sx,
int sy,
int w,
int h)
{
Eina_Bool ret = EINA_TRUE;
XErrorHandler ph;
@ -201,10 +211,10 @@ ecore_x_image_get(Ecore_X_Image *im, Ecore_X_Drawable draw,
if (im->shm)
{
if (!im->xim)
_ecore_x_image_shm_create(im);
_ecore_x_image_shm_create(im);
if (!im->xim)
return 0;
return 0;
_ecore_x_image_err = 0;
// optimised path
@ -212,12 +222,12 @@ ecore_x_image_get(Ecore_X_Image *im, Ecore_X_Drawable draw,
if ((sx == 0) && (w == im->w))
{
im->xim->data = (char *)
im->data + (im->xim->bytes_per_line * sy) + (sx * im->bpp);
im->data + (im->xim->bytes_per_line * sy) + (sx * im->bpp);
im->xim->width = w;
im->xim->height = h;
XGrabServer(_ecore_x_disp);
if (!XShmGetImage(_ecore_x_disp, draw, im->xim, x, y, 0xffffffff))
ret = EINA_FALSE;
ret = EINA_FALSE;
XUngrabServer(_ecore_x_disp);
ecore_x_sync();
}
@ -259,7 +269,7 @@ ecore_x_image_get(Ecore_X_Image *im, Ecore_X_Drawable draw,
XSetErrorHandler((XErrorHandler)ph);
if (_ecore_x_image_err)
ret = EINA_FALSE;
ret = EINA_FALSE;
}
else
{
@ -271,15 +281,15 @@ ecore_x_image_get(Ecore_X_Image *im, Ecore_X_Drawable draw,
} /* ecore_x_image_get */
EAPI void
ecore_x_image_put(Ecore_X_Image *im,
ecore_x_image_put(Ecore_X_Image *im,
Ecore_X_Drawable draw,
Ecore_X_GC gc,
int x,
int y,
int sx,
int sy,
int w,
int h)
Ecore_X_GC gc,
int x,
int y,
int sx,
int sy,
int w,
int h)
{
Ecore_X_GC tgc = 0;
@ -299,7 +309,10 @@ ecore_x_image_put(Ecore_X_Image *im,
} /* ecore_x_image_put */
EAPI void *
ecore_x_image_data_get(Ecore_X_Image *im, int *bpl, int *rows, int *bpp)
ecore_x_image_data_get(Ecore_X_Image *im,
int *bpl,
int *rows,
int *bpp)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
if (!im->xim) _ecore_x_image_shm_create(im);
@ -317,10 +330,10 @@ ecore_x_image_is_argb32_get(Ecore_X_Image *im)
if (!im->xim) _ecore_x_image_shm_create(im);
if (((vis->class == TrueColor) ||
(vis->class == DirectColor)) &&
(im->depth >= 24) &&
(vis->red_mask == 0xff0000) &&
(im->depth >= 24) &&
(vis->red_mask == 0xff0000) &&
(vis->green_mask == 0x00ff00) &&
(vis->blue_mask == 0x0000ff))
(vis->blue_mask == 0x0000ff))
{
#ifdef WORDS_BIGENDIAN
if (im->xim->bitmap_bit_order == LSBFirst) return EINA_TRUE;
@ -332,31 +345,36 @@ ecore_x_image_is_argb32_get(Ecore_X_Image *im)
}
EAPI Eina_Bool
ecore_x_image_to_argb_convert(void *src, int sbpp,
int sbpl,
ecore_x_image_to_argb_convert(void *src,
int sbpp,
int sbpl,
Ecore_X_Colormap c,
Ecore_X_Visual v,
int x, int y, int w, int h,
unsigned int *dst,
int dbpl,
int dx, int dy)
Ecore_X_Visual v,
int x,
int y,
int w,
int h,
unsigned int *dst,
int dbpl,
int dx,
int dy)
{
Visual *vis = v;
XColor *cols = NULL;
int n = 0, nret = 0, i, row;
unsigned int pal[256], r, g, b;
enum
{
rgbnone = 0,
rgb565,
bgr565,
rgbx555,
argbx888,
abgrx888,
rgba888x,
bgra888x,
argbx666
};
{
rgbnone = 0,
rgb565,
bgr565,
rgbx555,
argbx888,
abgrx888,
rgba888x,
bgra888x,
argbx666
};
int mode = 0;
sbpp *= 8;
@ -367,65 +385,66 @@ ecore_x_image_to_argb_convert(void *src, int sbpp,
(vis->class == StaticColor) ||
(vis->class == GrayScale) ||
(vis->class == StaticGray)))
{
if (!c) c = DefaultColormap(_ecore_x_disp,
DefaultScreen(_ecore_x_disp));
cols = alloca(n * sizeof(XColor));
for (i = 0; i < n; i++)
{
cols[i].pixel = i;
cols[i].flags = DoRed | DoGreen | DoBlue;
cols[i].red = 0;
cols[i].green = 0;
cols[i].blue = 0;
}
XQueryColors(_ecore_x_disp, c, cols, n);
for (i = 0; i < n; i++)
{
pal[i] = 0xff000000 |
((cols[i].red >> 8) << 16) |
((cols[i].green >> 8) << 8 ) |
((cols[i].blue >> 8) );
}
nret = n;
}
{
if (!c)
c = DefaultColormap(_ecore_x_disp,
DefaultScreen(_ecore_x_disp));
cols = alloca(n * sizeof(XColor));
for (i = 0; i < n; i++)
{
cols[i].pixel = i;
cols[i].flags = DoRed | DoGreen | DoBlue;
cols[i].red = 0;
cols[i].green = 0;
cols[i].blue = 0;
}
XQueryColors(_ecore_x_disp, c, cols, n);
for (i = 0; i < n; i++)
{
pal[i] = 0xff000000 |
((cols[i].red >> 8) << 16) |
((cols[i].green >> 8) << 8) |
((cols[i].blue >> 8));
}
nret = n;
}
else if ((vis->class == TrueColor) ||
(vis->class == DirectColor))
{
if ((vis->red_mask == 0x00ff0000) &&
if ((vis->red_mask == 0x00ff0000) &&
(vis->green_mask == 0x0000ff00) &&
(vis->blue_mask == 0x000000ff))
mode = argbx888;
else if ((vis->red_mask == 0x000000ff) &&
(vis->blue_mask == 0x000000ff))
mode = argbx888;
else if ((vis->red_mask == 0x000000ff) &&
(vis->green_mask == 0x0000ff00) &&
(vis->blue_mask == 0x00ff0000))
mode = abgrx888;
else if ((vis->red_mask == 0xff000000) &&
(vis->blue_mask == 0x00ff0000))
mode = abgrx888;
else if ((vis->red_mask == 0xff000000) &&
(vis->green_mask == 0x00ff0000) &&
(vis->blue_mask == 0x0000ff00))
mode = rgba888x;
else if ((vis->red_mask == 0x0000ff00) &&
(vis->blue_mask == 0x0000ff00))
mode = rgba888x;
else if ((vis->red_mask == 0x0000ff00) &&
(vis->green_mask == 0x00ff0000) &&
(vis->blue_mask == 0xff000000))
mode = bgra888x;
else if ((vis->red_mask == 0x0003f000) &&
(vis->blue_mask == 0xff000000))
mode = bgra888x;
else if ((vis->red_mask == 0x0003f000) &&
(vis->green_mask == 0x00000fc0) &&
(vis->blue_mask == 0x0000003f))
mode = argbx666;
else if ((vis->red_mask == 0x0000f800) &&
(vis->blue_mask == 0x0000003f))
mode = argbx666;
else if ((vis->red_mask == 0x0000f800) &&
(vis->green_mask == 0x000007e0) &&
(vis->blue_mask == 0x0000001f))
mode = rgb565;
else if ((vis->red_mask == 0x0000001f) &&
(vis->blue_mask == 0x0000001f))
mode = rgb565;
else if ((vis->red_mask == 0x0000001f) &&
(vis->green_mask == 0x000007e0) &&
(vis->blue_mask == 0x0000f800))
mode = bgr565;
else if ((vis->red_mask == 0x00007c00) &&
(vis->blue_mask == 0x0000f800))
mode = bgr565;
else if ((vis->red_mask == 0x00007c00) &&
(vis->green_mask == 0x000003e0) &&
(vis->blue_mask == 0x0000001f))
mode = rgbx555;
(vis->blue_mask == 0x0000001f))
mode = rgbx555;
else
return EINA_FALSE;
return EINA_FALSE;
}
for (row = 0; row < h; row++)
{
@ -439,7 +458,7 @@ ecore_x_image_to_argb_convert(void *src, int sbpp,
de = dp + w;
switch (sbpp)
{
case 8:
case 8:
s8 = ((unsigned char *)(((unsigned char *)src) + ((y + row) * sbpl))) + x;
if (nret > 0)
{
@ -450,13 +469,14 @@ ecore_x_image_to_argb_convert(void *src, int sbpp,
}
}
else
return EINA_FALSE;
return EINA_FALSE;
break;
case 16:
case 16:
s16 = ((unsigned short *)(((unsigned char *)src) + ((y + row) * sbpl))) + x;
switch (mode)
{
case rgb565:
case rgb565:
while (dp < de)
{
r = (*s16 & 0xf800) << 8;
@ -469,7 +489,8 @@ ecore_x_image_to_argb_convert(void *src, int sbpp,
s16++; dp++;
}
break;
case bgr565:
case bgr565:
while (dp < de)
{
r = (*s16 & 0x001f) << 19;
@ -482,7 +503,8 @@ ecore_x_image_to_argb_convert(void *src, int sbpp,
s16++; dp++;
}
break;
case rgbx555:
case rgbx555:
while (dp < de)
{
r = (*s16 & 0x7c00) << 9;
@ -495,24 +517,27 @@ ecore_x_image_to_argb_convert(void *src, int sbpp,
s16++; dp++;
}
break;
default:
default:
return EINA_FALSE;
break;
}
break;
case 24:
case 32:
case 24:
case 32:
s32 = ((unsigned int *)(((unsigned char *)src) + ((y + row) * sbpl))) + x;
switch (mode)
{
case argbx888:
case argbx888:
while (dp < de)
{
*dp = 0xff000000 | *s32;
s32++; dp++;
}
break;
case abgrx888:
case abgrx888:
while (dp < de)
{
r = *s32 & 0x000000ff;
@ -522,14 +547,16 @@ ecore_x_image_to_argb_convert(void *src, int sbpp,
s32++; dp++;
}
break;
case rgba888x:
case rgba888x:
while (dp < de)
{
*dp = 0xff000000 | (*s32 >> 8);
s32++; dp++;
}
break;
case bgra888x:
case bgra888x:
while (dp < de)
{
r = *s32 & 0x0000ff00;
@ -539,7 +566,8 @@ ecore_x_image_to_argb_convert(void *src, int sbpp,
s32++; dp++;
}
break;
case argbx666:
case argbx666:
while (dp < de)
{
r = (*s32 & 0x3f000) << 6;
@ -552,16 +580,19 @@ ecore_x_image_to_argb_convert(void *src, int sbpp,
s32++; dp++;
}
break;
default:
default:
return EINA_FALSE;
break;
}
break;
break;
default:
default:
return EINA_FALSE;
break;
}
}
return EINA_TRUE;
}

View File

@ -48,7 +48,7 @@ ecore_x_mwm_hints_get(Ecore_X_Window win,
ECORE_X_ATOM_MOTIF_WM_HINTS,
ECORE_X_ATOM_MOTIF_WM_HINTS,
32, &p, &num))
return EINA_FALSE;
return EINA_FALSE;
mwmhints = (MWMHints *)p;
if (mwmhints)
@ -58,25 +58,25 @@ ecore_x_mwm_hints_get(Ecore_X_Window win,
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 = EINA_TRUE;
@ -89,7 +89,8 @@ ecore_x_mwm_hints_get(Ecore_X_Window win,
} /* ecore_x_mwm_hints_get */
EAPI void
ecore_x_mwm_borderless_set(Ecore_X_Window win, Eina_Bool borderless)
ecore_x_mwm_borderless_set(Ecore_X_Window win,
Eina_Bool borderless)
{
unsigned int data[5] = {0, 0, 0, 0, 0};

File diff suppressed because it is too large Load Diff

View File

@ -25,14 +25,17 @@
* @ingroup Ecore_X_Pixmap_Group
*/
EAPI Ecore_X_Pixmap
ecore_x_pixmap_new(Ecore_X_Window win, int w, int h, int dep)
ecore_x_pixmap_new(Ecore_X_Window win,
int w,
int h,
int dep)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
if (win == 0)
win = DefaultRootWindow(_ecore_x_disp);
win = DefaultRootWindow(_ecore_x_disp);
if (dep == 0)
dep = DefaultDepth(_ecore_x_disp, DefaultScreen(_ecore_x_disp));
dep = DefaultDepth(_ecore_x_disp, DefaultScreen(_ecore_x_disp));
return XCreatePixmap(_ecore_x_disp, win, w, h, dep);
} /* ecore_x_pixmap_new */
@ -68,9 +71,15 @@ ecore_x_pixmap_free(Ecore_X_Pixmap pmap)
* @ingroup Ecore_X_Pixmap_Group
*/
EAPI void
ecore_x_pixmap_paste(Ecore_X_Pixmap pmap, Ecore_X_Drawable dest,
Ecore_X_GC gc, int sx, int sy,
int w, int h, int dx, int dy)
ecore_x_pixmap_paste(Ecore_X_Pixmap pmap,
Ecore_X_Drawable dest,
Ecore_X_GC gc,
int sx,
int sy,
int w,
int h,
int dx,
int dy)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
XCopyArea(_ecore_x_disp, pmap, dest, gc, sx, sy, w, h, dx, dy);
@ -86,11 +95,15 @@ ecore_x_pixmap_paste(Ecore_X_Pixmap pmap, Ecore_X_Drawable dest,
* @ingroup Ecore_X_Pixmap_Group
*/
EAPI void
ecore_x_pixmap_geometry_get(Ecore_X_Pixmap pmap, int *x, int *y, int *w, int *h)
ecore_x_pixmap_geometry_get(Ecore_X_Pixmap pmap,
int *x,
int *y,
int *w,
int *h)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
if (pmap)
ecore_x_drawable_geometry_get(pmap, x, y, w, h);
ecore_x_drawable_geometry_get(pmap, x, y, w, h);
} /* ecore_x_pixmap_geometry_get */
/**

View File

@ -54,7 +54,7 @@
#endif /* ifdef ECORE_XI2 */
#ifndef XK_MISCELLANY
# define XK_MISCELLANY 1
# define XK_MISCELLANY 1
#endif
#include "Ecore.h"
@ -93,7 +93,7 @@ extern int _ecore_xlib_log_dom;
#endif /* ifdef CRIT */
#define CRIT(...) EINA_LOG_DOM_CRIT(_ecore_xlib_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
{
@ -104,18 +104,16 @@ struct _Ecore_X_Selection_Intern
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;
Eina_Bool (*convert)(char *target, void *data, int size,
void **data_ret, int *size_ret,
Ecore_X_Atom *type, int *typeseize);
Eina_Bool (*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
{
@ -202,166 +200,162 @@ extern Ecore_X_Atom _ecore_x_atoms_wm_protocols[ECORE_X_WM_PROTOCOL_NUM];
extern int _ecore_window_grabs_num;
extern Window *_ecore_window_grabs;
extern Eina_Bool (*_ecore_window_grab_replay_func)(void *data, int event_type,
extern Eina_Bool (*_ecore_window_grab_replay_func)(void *data,
int event_type,
void *event);
extern void *_ecore_window_grab_replay_data;
extern Ecore_X_Window _ecore_x_private_win;
void _ecore_x_error_handler_init(void);
void _ecore_x_event_handle_any_event(XEvent *xevent);
void _ecore_x_event_handle_key_press(XEvent *xevent);
void _ecore_x_event_handle_key_release(XEvent *xevent);
void _ecore_x_event_handle_button_press(XEvent *xevent);
void _ecore_x_event_handle_button_release(XEvent *xevent);
void _ecore_x_event_handle_motion_notify(XEvent *xevent);
void _ecore_x_event_handle_enter_notify(XEvent *xevent);
void _ecore_x_event_handle_leave_notify(XEvent *xevent);
void _ecore_x_event_handle_focus_in(XEvent *xevent);
void _ecore_x_event_handle_focus_out(XEvent *xevent);
void _ecore_x_event_handle_keymap_notify(XEvent *xevent);
void _ecore_x_event_handle_expose(XEvent *xevent);
void _ecore_x_event_handle_graphics_expose(XEvent *xevent);
void _ecore_x_event_handle_visibility_notify(
XEvent *xevent);
void _ecore_x_event_handle_create_notify(XEvent *xevent);
void _ecore_x_event_handle_destroy_notify(XEvent *xevent);
void _ecore_x_event_handle_unmap_notify(XEvent *xevent);
void _ecore_x_event_handle_map_notify(XEvent *xevent);
void _ecore_x_event_handle_map_request(XEvent *xevent);
void _ecore_x_event_handle_reparent_notify(XEvent *xevent);
void _ecore_x_event_handle_configure_notify(XEvent *xevent);
void _ecore_x_event_handle_configure_request(
XEvent *xevent);
void _ecore_x_event_handle_gravity_notify(XEvent *xevent);
void _ecore_x_event_handle_resize_request(XEvent *xevent);
void _ecore_x_event_handle_circulate_notify(XEvent *xevent);
void _ecore_x_event_handle_circulate_request(
XEvent *xevent);
void _ecore_x_event_handle_property_notify(XEvent *xevent);
void _ecore_x_event_handle_selection_clear(XEvent *xevent);
void _ecore_x_event_handle_selection_request(
XEvent *xevent);
void _ecore_x_event_handle_selection_notify(XEvent *xevent);
void _ecore_x_event_handle_colormap_notify(XEvent *xevent);
void _ecore_x_event_handle_client_message(XEvent *xevent);
void _ecore_x_event_handle_mapping_notify(XEvent *xevent);
void _ecore_x_event_handle_shape_change(XEvent *xevent);
void _ecore_x_event_handle_screensaver_notify(
XEvent *xevent);
void _ecore_x_event_handle_sync_counter(XEvent *xevent);
void _ecore_x_event_handle_sync_alarm(XEvent *xevent);
void _ecore_x_error_handler_init(void);
void _ecore_x_event_handle_any_event(XEvent *xevent);
void _ecore_x_event_handle_key_press(XEvent *xevent);
void _ecore_x_event_handle_key_release(XEvent *xevent);
void _ecore_x_event_handle_button_press(XEvent *xevent);
void _ecore_x_event_handle_button_release(XEvent *xevent);
void _ecore_x_event_handle_motion_notify(XEvent *xevent);
void _ecore_x_event_handle_enter_notify(XEvent *xevent);
void _ecore_x_event_handle_leave_notify(XEvent *xevent);
void _ecore_x_event_handle_focus_in(XEvent *xevent);
void _ecore_x_event_handle_focus_out(XEvent *xevent);
void _ecore_x_event_handle_keymap_notify(XEvent *xevent);
void _ecore_x_event_handle_expose(XEvent *xevent);
void _ecore_x_event_handle_graphics_expose(XEvent *xevent);
void _ecore_x_event_handle_visibility_notify(XEvent *xevent);
void _ecore_x_event_handle_create_notify(XEvent *xevent);
void _ecore_x_event_handle_destroy_notify(XEvent *xevent);
void _ecore_x_event_handle_unmap_notify(XEvent *xevent);
void _ecore_x_event_handle_map_notify(XEvent *xevent);
void _ecore_x_event_handle_map_request(XEvent *xevent);
void _ecore_x_event_handle_reparent_notify(XEvent *xevent);
void _ecore_x_event_handle_configure_notify(XEvent *xevent);
void _ecore_x_event_handle_configure_request(XEvent *xevent);
void _ecore_x_event_handle_gravity_notify(XEvent *xevent);
void _ecore_x_event_handle_resize_request(XEvent *xevent);
void _ecore_x_event_handle_circulate_notify(XEvent *xevent);
void _ecore_x_event_handle_circulate_request(XEvent *xevent);
void _ecore_x_event_handle_property_notify(XEvent *xevent);
void _ecore_x_event_handle_selection_clear(XEvent *xevent);
void _ecore_x_event_handle_selection_request(XEvent *xevent);
void _ecore_x_event_handle_selection_notify(XEvent *xevent);
void _ecore_x_event_handle_colormap_notify(XEvent *xevent);
void _ecore_x_event_handle_client_message(XEvent *xevent);
void _ecore_x_event_handle_mapping_notify(XEvent *xevent);
void _ecore_x_event_handle_shape_change(XEvent *xevent);
void _ecore_x_event_handle_screensaver_notify(XEvent *xevent);
void _ecore_x_event_handle_sync_counter(XEvent *xevent);
void _ecore_x_event_handle_sync_alarm(XEvent *xevent);
#ifdef ECORE_XRANDR
void _ecore_x_event_handle_randr_change(XEvent *xevent);
void _ecore_x_event_handle_randr_notify(XEvent *xevent);
void _ecore_x_event_handle_randr_change(XEvent *xevent);
void _ecore_x_event_handle_randr_notify(XEvent *xevent);
#endif /* ifdef ECORE_XRANDR */
#ifdef ECORE_XFIXES
void _ecore_x_event_handle_fixes_selection_notify(
XEvent *xevent);
void _ecore_x_event_handle_fixes_selection_notify(XEvent *xevent);
#endif /* ifdef ECORE_XFIXES */
#ifdef ECORE_XDAMAGE
void _ecore_x_event_handle_damage_notify(XEvent *xevent);
void _ecore_x_event_handle_damage_notify(XEvent *xevent);
#endif /* ifdef ECORE_XDAMAGE */
void _ecore_x_event_handle_generic_event(XEvent *xevent);
void _ecore_x_event_handle_generic_event(XEvent *xevent);
void _ecore_x_selection_data_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);
Eina_Bool _ecore_x_selection_set(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,
Ecore_X_Atom *targettype,
int *targetsize);
void * _ecore_x_selection_parse(const char *target,
void *data,
int size,
int format);
void _ecore_x_selection_data_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);
Eina_Bool _ecore_x_selection_set(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,
Ecore_X_Atom *targettype,
int *targetsize);
void *_ecore_x_selection_parse(const char *target,
void *data,
int size,
int format);
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);
/* from dnd */
void _ecore_x_dnd_init(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_shutdown(void);
void _ecore_x_dnd_init(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_shutdown(void);
/* from 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);
/* Fixes * Damage * Composite * DPMS */
void _ecore_x_fixes_init(void);
void _ecore_x_damage_init(void);
void _ecore_x_composite_init(void);
void _ecore_x_dpms_init(void);
void _ecore_x_randr_init(void);
void _ecore_x_fixes_init(void);
void _ecore_x_damage_init(void);
void _ecore_x_composite_init(void);
void _ecore_x_dpms_init(void);
void _ecore_x_randr_init(void);
void _ecore_x_atoms_init(void);
void _ecore_x_atoms_init(void);
extern int _ecore_x_xi2_opcode;
void _ecore_x_events_init(void);
void _ecore_x_events_shutdown(void);
void _ecore_x_events_init(void);
void _ecore_x_events_shutdown(void);
void _ecore_x_input_init(void);
void _ecore_x_input_shutdown(void);
void _ecore_x_input_handler(XEvent *xevent);
void _ecore_x_input_init(void);
void _ecore_x_input_shutdown(void);
void _ecore_x_input_handler(XEvent *xevent);
/* from sync */
void _ecore_mouse_move(unsigned int timestamp,
unsigned int xmodifiers,
int x,
int y,
int x_root,
int y_root,
unsigned int event_window,
unsigned int window,
unsigned int root_win,
int same_screen,
int dev,
double radx,
double rady,
double pressure,
double angle,
double mx,
double my,
double mrx,
double mry);
Ecore_Event_Mouse_Button * _ecore_mouse_button(int event,
unsigned int timestamp,
unsigned int xmodifiers,
unsigned int buttons,
int x,
int y,
int x_root,
int y_root,
unsigned int event_window,
unsigned int window,
unsigned int root_win,
int same_screen,
int dev,
double radx,
double rady,
double pressure,
double angle,
double mx,
double my,
double mrx,
double mry);
void _ecore_mouse_move(unsigned int timestamp,
unsigned int xmodifiers,
int x,
int y,
int x_root,
int y_root,
unsigned int event_window,
unsigned int window,
unsigned int root_win,
int same_screen,
int dev,
double radx,
double rady,
double pressure,
double angle,
double mx,
double my,
double mrx,
double mry);
Ecore_Event_Mouse_Button *_ecore_mouse_button(int event,
unsigned int timestamp,
unsigned int xmodifiers,
unsigned int buttons,
int x,
int y,
int x_root,
int y_root,
unsigned int event_window,
unsigned int window,
unsigned int root_win,
int same_screen,
int dev,
double radx,
double rady,
double pressure,
double angle,
double mx,
double my,
double mrx,
double mry);
void _ecore_x_modifiers_get(void);

View File

@ -9,19 +9,19 @@ static Eina_Bool _randr_available = EINA_FALSE;
#ifdef ECORE_XRANDR
static int _randr_major, _randr_minor;
int _randr_version;
#define RANDR_1_1 ((1 << 16) | 1)
#define RANDR_1_2 ((1 << 16) | 2)
#define RANDR_1_3 ((1 << 16) | 3)
#define RANDR_1_1 ((1 << 16) | 1)
#define RANDR_1_2 ((1 << 16) | 2)
#define RANDR_1_3 ((1 << 16) | 3)
#define RANDR_VALIDATE_ROOT(screen, \
root) ((screen = \
XRRRootToScreen(_ecore_x_disp, \
root)) != -1)
#define RANDR_VALIDATE_ROOT(screen, \
root) ((screen = \
XRRRootToScreen(_ecore_x_disp, \
root)) != -1)
#define Ecore_X_Randr_Unset -1
XRRScreenResources * (*_ecore_x_randr_get_screen_resources)(Display * dpy,
Window window);
XRRScreenResources *(*_ecore_x_randr_get_screen_resources)(Display * dpy,
Window window);
#endif /* ifdef ECORE_XRANDR */
@ -35,17 +35,17 @@ _ecore_x_randr_init(void)
_ecore_x_randr_get_screen_resources = NULL;
if (XRRQueryVersion(_ecore_x_disp, &_randr_major, &_randr_minor))
{
_randr_version = (_randr_major << 16) | _randr_minor;
if (_randr_version >= RANDR_1_3)
_ecore_x_randr_get_screen_resources = XRRGetScreenResourcesCurrent;
else if (_randr_version == RANDR_1_2)
_ecore_x_randr_get_screen_resources = XRRGetScreenResources;
{
_randr_version = (_randr_major << 16) | _randr_minor;
if (_randr_version >= RANDR_1_3)
_ecore_x_randr_get_screen_resources = XRRGetScreenResourcesCurrent;
else if (_randr_version == RANDR_1_2)
_ecore_x_randr_get_screen_resources = XRRGetScreenResources;
_randr_available = EINA_TRUE;
}
_randr_available = EINA_TRUE;
}
else
_randr_available = EINA_FALSE;
_randr_available = EINA_FALSE;
#else
_randr_available = EINA_FALSE;
@ -73,13 +73,13 @@ ecore_x_randr_version_get(void)
#ifdef ECORE_XRANDR
LOGFN(__FILE__, __LINE__, __FUNCTION__);
if (_randr_available)
{
return _randr_version;
}
{
return _randr_version;
}
else
{
return Ecore_X_Randr_Unset;
}
{
return Ecore_X_Randr_Unset;
}
#else
return -1;
#endif
@ -91,11 +91,12 @@ _ecore_x_randr_root_validate(Ecore_X_Window root)
#ifdef ECORE_XRANDR
Ecore_X_Randr_Screen scr = -1;
if (root && RANDR_VALIDATE_ROOT(scr, root))
return EINA_TRUE;
return EINA_TRUE;
else
return EINA_FALSE;
return EINA_FALSE;
#else
return EINA_FALSE;
#endif
}

View File

@ -2,6 +2,6 @@
#define ECORE_X_INLINE_X
Eina_Bool _ecore_x_randr_root_validate(Ecore_X_Window root);
Eina_Bool _ecore_x_randr_output_validate(Ecore_X_Window root,
Ecore_X_Randr_Output
output);
Ecore_X_Randr_Output
output);
#endif

View File

@ -14,16 +14,16 @@
#define RANDR_1_1 ((1 << 16) | 1)
#define RANDR_VALIDATE_ROOT(screen,\
root) ((screen =\
XRRRootToScreen(_ecore_x_disp,\
root)) != -1)
#define RANDR_VALIDATE_ROOT(screen, \
root) ((screen = \
XRRRootToScreen(_ecore_x_disp, \
root)) != -1)
#define RANDR_CHECK_1_1_RET(ret) if(_randr_version < RANDR_1_1) return ret
extern XRRScreenResources * (*_ecore_x_randr_get_screen_resources)(Display *
dpy,
Window
window);
extern XRRScreenResources *(*_ecore_x_randr_get_screen_resources)(Display *
dpy,
Window
window);
extern int _randr_version;
#endif /* ifdef ECORE_XRANDR */
@ -38,8 +38,8 @@ ecore_x_randr_screen_primary_output_orientations_get(Ecore_X_Window root)
LOGFN(__FILE__, __LINE__, __FUNCTION__);
rot =
XRRRotations(_ecore_x_disp, XRRRootToScreen(_ecore_x_disp,
root), &crot);
XRRRotations(_ecore_x_disp, XRRRootToScreen(_ecore_x_disp,
root), &crot);
return rot;
#else /* ifdef ECORE_XRANDR */
return Ecore_X_Randr_None;
@ -56,7 +56,7 @@ ecore_x_randr_screen_primary_output_orientation_get(Ecore_X_Window root)
#ifdef ECORE_XRANDR
Rotation crot = Ecore_X_Randr_None;
XRRRotations(_ecore_x_disp, XRRRootToScreen(_ecore_x_disp,
root), &crot);
root), &crot);
return crot;
#else /* ifdef ECORE_XRANDR */
return Ecore_X_Randr_None;
@ -71,9 +71,9 @@ ecore_x_randr_screen_primary_output_orientation_get(Ecore_X_Window root)
*/
EAPI Eina_Bool
ecore_x_randr_screen_primary_output_orientation_set(
Ecore_X_Window root,
Ecore_X_Randr_Orientation
orientation)
Ecore_X_Window root,
Ecore_X_Randr_Orientation
orientation)
{
#ifdef ECORE_XRANDR
XRRScreenConfiguration *xrr_screen_cfg = NULL;
@ -81,15 +81,15 @@ ecore_x_randr_screen_primary_output_orientation_set(
Rotation crot;
Eina_Bool ret = EINA_FALSE;
if (!(xrr_screen_cfg = XRRGetScreenInfo(_ecore_x_disp, root)))
return EINA_FALSE;
return EINA_FALSE;
sizeid = XRRConfigCurrentConfiguration(xrr_screen_cfg, &crot);
if (!XRRSetScreenConfig(_ecore_x_disp, xrr_screen_cfg, root, sizeid,
orientation, CurrentTime))
ret = EINA_TRUE;
ret = EINA_TRUE;
if (xrr_screen_cfg)
XRRFreeScreenConfigInfo(xrr_screen_cfg);
XRRFreeScreenConfigInfo(xrr_screen_cfg);
return ret;
#else /* ifdef ECORE_XRANDR */
@ -104,7 +104,8 @@ ecore_x_randr_screen_primary_output_orientation_set(
* @return an array of sizes reported as supported by the screen's primary output or - if query failed - NULL
*/
EAPI Ecore_X_Randr_Screen_Size_MM *
ecore_x_randr_screen_primary_output_sizes_get(Ecore_X_Window root, int *num)
ecore_x_randr_screen_primary_output_sizes_get(Ecore_X_Window root,
int *num)
{
#ifdef ECORE_XRANDR
Ecore_X_Randr_Screen_Size_MM *ret = NULL;
@ -113,15 +114,15 @@ ecore_x_randr_screen_primary_output_sizes_get(Ecore_X_Window root, int *num)
/* we don't have to free sizes, because they're hold in a cache inside X*/
sizes =
XRRSizes(_ecore_x_disp, XRRRootToScreen(_ecore_x_disp,
root), &n);
XRRSizes(_ecore_x_disp, XRRRootToScreen(_ecore_x_disp,
root), &n);
if ((!sizes) || (n <= 0)) return NULL;
ret = calloc(n, sizeof(Ecore_X_Randr_Screen_Size_MM));
if (!ret)
return NULL;
return NULL;
if (num)
*num = n;
*num = n;
for (i = 0; i < n; i++)
{
@ -169,24 +170,24 @@ ecore_x_randr_screen_primary_output_current_size_get(Ecore_X_Window root,
idx = XRRConfigCurrentConfiguration(sc, &orientation);
sizes =
XRRSizes(_ecore_x_disp, XRRRootToScreen(_ecore_x_disp,
root), &n);
XRRSizes(_ecore_x_disp, XRRRootToScreen(_ecore_x_disp,
root), &n);
if ((idx < n) && (idx >= 0))
{
if (w)
*w = sizes[idx].width;
*w = sizes[idx].width;
if (h)
*h = sizes[idx].height;
*h = sizes[idx].height;
if (w_mm)
*w_mm = sizes[idx].mwidth;
*w_mm = sizes[idx].mwidth;
if (h_mm)
*h_mm = sizes[idx].mheight;
*h_mm = sizes[idx].mheight;
if (size_index)
*size_index = idx;
*size_index = idx;
}
XRRFreeScreenConfigInfo(sc);
@ -212,8 +213,8 @@ ecore_x_randr_screen_primary_output_size_set(Ecore_X_Window root,
if (size_index >= 0 && _ecore_x_randr_root_validate(root))
{
sizes =
XRRSizes(_ecore_x_disp, XRRRootToScreen(_ecore_x_disp,
root), &nsizes);
XRRSizes(_ecore_x_disp, XRRRootToScreen(_ecore_x_disp,
root), &nsizes);
if (size_index < nsizes)
{
@ -226,7 +227,7 @@ ecore_x_randr_screen_primary_output_size_set(Ecore_X_Window root,
}
if (sc)
XRRFreeScreenConfigInfo(sc);
XRRFreeScreenConfigInfo(sc);
}
}
@ -242,7 +243,7 @@ ecore_x_randr_screen_primary_output_size_set(Ecore_X_Window root,
*/
EAPI Ecore_X_Randr_Refresh_Rate
ecore_x_randr_screen_primary_output_current_refresh_rate_get(
Ecore_X_Window root)
Ecore_X_Window root)
{
#ifdef ECORE_XRANDR
Ecore_X_Randr_Refresh_Rate ret = 0.0;
@ -250,11 +251,11 @@ ecore_x_randr_screen_primary_output_current_refresh_rate_get(
if (!_ecore_x_randr_root_validate(root) ||
!(sc = XRRGetScreenInfo(_ecore_x_disp, root)))
return ret;
return ret;
ret = XRRConfigCurrentRate(sc);
if (sc)
XRRFreeScreenConfigInfo(sc);
XRRFreeScreenConfigInfo(sc);
return ret;
#else /* ifdef ECORE_XRANDR */
@ -304,10 +305,10 @@ ecore_x_randr_screen_primary_output_refresh_rates_get(Ecore_X_Window root,
*/
EAPI Eina_Bool
ecore_x_randr_screen_primary_output_refresh_rate_set(
Ecore_X_Window root,
int size_index,
Ecore_X_Randr_Refresh_Rate
rate)
Ecore_X_Window root,
int size_index,
Ecore_X_Randr_Refresh_Rate
rate)
{
#ifdef ECORE_XRANDR
RANDR_CHECK_1_1_RET(EINA_FALSE);
@ -315,12 +316,12 @@ ecore_x_randr_screen_primary_output_refresh_rate_set(
XRRScreenConfiguration *sc = NULL;
if (!(sc = XRRGetScreenInfo(_ecore_x_disp, root)))
return ret;
return ret;
if (!XRRSetScreenConfigAndRate(_ecore_x_disp, sc,
root, size_index,
RR_Rotate_0, rate, CurrentTime))
ret = EINA_TRUE;
ret = EINA_TRUE;
XRRFreeScreenConfigInfo(sc);
return ret;
@ -328,3 +329,4 @@ ecore_x_randr_screen_primary_output_refresh_rate_set(
return EINA_FALSE;
#endif /* ifdef ECORE_XRANDR */
} /* ecore_x_randr_screen_primary_output_refresh_rate_set */

File diff suppressed because it is too large Load Diff

View File

@ -28,81 +28,82 @@
* - see other TODO's within this file.
*/
#define ECORE_X_RANDR_EDID_VERSION_10 ((1 << 8) | 0)
#define ECORE_X_RANDR_EDID_VERSION_11 ((1 << 8) | 1)
#define ECORE_X_RANDR_EDID_VERSION_12 ((1 << 8) | 2)
#define ECORE_X_RANDR_EDID_VERSION_13 ((1 << 8) | 3)
#define ECORE_X_RANDR_EDID_VERSION_14 ((1 << 8) | 4)
#define ECORE_X_RANDR_EDID_VERSION_10 ((1 << 8) | 0)
#define ECORE_X_RANDR_EDID_VERSION_11 ((1 << 8) | 1)
#define ECORE_X_RANDR_EDID_VERSION_12 ((1 << 8) | 2)
#define ECORE_X_RANDR_EDID_VERSION_13 ((1 << 8) | 3)
#define ECORE_X_RANDR_EDID_VERSION_14 ((1 << 8) | 4)
#define _ECORE_X_RANDR_EDID_OFFSET_MANUFACTURER 0x08
#define _ECORE_X_RANDR_EDID_OFFSET_TYPE 0x14
#define _ECORE_X_RANDR_EDID_OFFSET_VERSION_MAJOR 0x12
#define _ECORE_X_RANDR_EDID_OFFSET_VERSION_MINOR 0x13
#define _ECORE_X_RANDR_EDID_OFFSET_DPMS 0x18
#define _ECORE_X_RANDR_EDID_OFFSET_COLORSPACE 0x18
#define _ECORE_X_RANDR_EDID_OFFSET_DESCRIPTOR_BLOCK 0x36
#define _ECORE_X_RANDR_EDID_OFFSET_DESCRIPTOR_BLOCK_TYPE 3
#define _ECORE_X_RANDR_EDID_OFFSET_DESCRIPTOR_BLOCK_CONTENT 5
#define _ECORE_X_RANDR_EDID_OFFSET_ASPECT_RATIO_PREFERRED 15
#define _ECORE_X_RANDR_EDID_OFFSET_ASPECT_RATIO 14
#define _ECORE_X_RANDR_EDID_OFFSET_MANUFACTURER 0x08
#define _ECORE_X_RANDR_EDID_OFFSET_TYPE 0x14
#define _ECORE_X_RANDR_EDID_OFFSET_VERSION_MAJOR 0x12
#define _ECORE_X_RANDR_EDID_OFFSET_VERSION_MINOR 0x13
#define _ECORE_X_RANDR_EDID_OFFSET_DPMS 0x18
#define _ECORE_X_RANDR_EDID_OFFSET_COLORSPACE 0x18
#define _ECORE_X_RANDR_EDID_OFFSET_DESCRIPTOR_BLOCK 0x36
#define _ECORE_X_RANDR_EDID_OFFSET_DESCRIPTOR_BLOCK_TYPE 3
#define _ECORE_X_RANDR_EDID_OFFSET_DESCRIPTOR_BLOCK_CONTENT 5
#define _ECORE_X_RANDR_EDID_OFFSET_ASPECT_RATIO_PREFERRED 15
#define _ECORE_X_RANDR_EDID_OFFSET_ASPECT_RATIO 14
#define _ECORE_X_RANDR_EDID_MASK_DIGITAL 0x80
#define _ECORE_X_RANDR_EDID_MASK_DIGITAL_INTERFACE 0x0f
#define _ECORE_X_RANDR_EDID_MASK_DIGITAL_TMDS_DFP_10 0x01
#define _ECORE_X_RANDR_EDID_MASK_COLORSCHEME_ANALOGOUS 0x18
#define _ECORE_X_RANDR_EDID_MASK_COLORSCHEME_DIGITAL_YCRCB_444 0x10
#define _ECORE_X_RANDR_EDID_MASK_COLORSCHEME_DIGITAL_YCRCB_422 0x08
#define _ECORE_X_RANDR_EDID_MASK_ASPECT_RATIO_PREFERRED 0xe0
#define _ECORE_X_RANDR_EDID_MASK_DPMS 0xE0
#define _ECORE_X_RANDR_EDID_MASK_DPMS_STANDBY 0x80
#define _ECORE_X_RANDR_EDID_MASK_DPMS_SUSPEND 0x40
#define _ECORE_X_RANDR_EDID_MASK_DPMS_OFF 0x20
#define _ECORE_X_RANDR_EDID_MASK_INTERFACE_TYPE 0x0f
#define _ECORE_X_RANDR_EDID_MASK_ASPECT_RATIO_4_3 0x80
#define _ECORE_X_RANDR_EDID_MASK_ASPECT_RATIO_16_9 0x40
#define _ECORE_X_RANDR_EDID_MASK_ASPECT_RATIO_16_10 0x20
#define _ECORE_X_RANDR_EDID_MASK_ASPECT_RATIO_5_4 0x10
#define _ECORE_X_RANDR_EDID_MASK_ASPECT_RATIO_15_9 0x08
#define _ECORE_X_RANDR_EDID_MASK_DIGITAL 0x80
#define _ECORE_X_RANDR_EDID_MASK_DIGITAL_INTERFACE 0x0f
#define _ECORE_X_RANDR_EDID_MASK_DIGITAL_TMDS_DFP_10 0x01
#define _ECORE_X_RANDR_EDID_MASK_COLORSCHEME_ANALOGOUS 0x18
#define _ECORE_X_RANDR_EDID_MASK_COLORSCHEME_DIGITAL_YCRCB_444 0x10
#define _ECORE_X_RANDR_EDID_MASK_COLORSCHEME_DIGITAL_YCRCB_422 0x08
#define _ECORE_X_RANDR_EDID_MASK_ASPECT_RATIO_PREFERRED 0xe0
#define _ECORE_X_RANDR_EDID_MASK_DPMS 0xE0
#define _ECORE_X_RANDR_EDID_MASK_DPMS_STANDBY 0x80
#define _ECORE_X_RANDR_EDID_MASK_DPMS_SUSPEND 0x40
#define _ECORE_X_RANDR_EDID_MASK_DPMS_OFF 0x20
#define _ECORE_X_RANDR_EDID_MASK_INTERFACE_TYPE 0x0f
#define _ECORE_X_RANDR_EDID_MASK_ASPECT_RATIO_4_3 0x80
#define _ECORE_X_RANDR_EDID_MASK_ASPECT_RATIO_16_9 0x40
#define _ECORE_X_RANDR_EDID_MASK_ASPECT_RATIO_16_10 0x20
#define _ECORE_X_RANDR_EDID_MASK_ASPECT_RATIO_5_4 0x10
#define _ECORE_X_RANDR_EDID_MASK_ASPECT_RATIO_15_9 0x08
#define _ECORE_X_RANDR_EDID_DISPLAY_DESCRIPTOR_BLOCK_CONTENT_LENGTH_MAX 13
typedef enum _Ecore_X_Randr_Edid_Aspect_Ratio_Preferred {
ECORE_X_RANDR_EDID_ASPECT_RATIO_PREFERRED_4_3 = 0x00,
ECORE_X_RANDR_EDID_ASPECT_RATIO_PREFERRED_16_9 = 0x01,
ECORE_X_RANDR_EDID_ASPECT_RATIO_PREFERRED_16_10 = 0x02,
ECORE_X_RANDR_EDID_ASPECT_RATIO_PREFERRED_5_4 = 0x03,
ECORE_X_RANDR_EDID_ASPECT_RATIO_PREFERRED_15_9 = 0x04
ECORE_X_RANDR_EDID_ASPECT_RATIO_PREFERRED_16_9 = 0x01,
ECORE_X_RANDR_EDID_ASPECT_RATIO_PREFERRED_16_10 = 0x02,
ECORE_X_RANDR_EDID_ASPECT_RATIO_PREFERRED_5_4 = 0x03,
ECORE_X_RANDR_EDID_ASPECT_RATIO_PREFERRED_15_9 = 0x04
} Ecore_X_Randr_Edid_Aspect_Ratio_Preferred;
/* Some convenience loops */
#define _ECORE_X_RANDR_EDID_FOR_EACH_EXTENSION_BLOCK(edid, edid_length, extension_block_iter) \
for (extension_block_iter = edid; extension_block_iter < (edid + edid_length); extension_block_iter += 128)
for (extension_block_iter = edid; extension_block_iter < (edid + edid_length); extension_block_iter += 128)
#define _ECORE_X_RANDR_EDID_FOR_EACH_CEA_BLOCK(edid, edid_length, cea_block_iter) \
_ECORE_X_RANDR_EDID_FOR_EACH_EXTENSION_BLOCK(edid, edid_length, cea_block_iter) \
if (cea_block_iter[0] == 0x02)
_ECORE_X_RANDR_EDID_FOR_EACH_EXTENSION_BLOCK(edid, edid_length, cea_block_iter) \
if (cea_block_iter[0] == 0x02)
/* The following macro is to be used with caution as it inherits another loop.
* Therefore using a 'break;' statement will lead to continuation in the
* inherent 'Extension block'-loop.
*/
#define _ECORE_X_RANDR_EDID_FOR_EACH_CEA_DETAILED_BLOCK(edid, edid_length, cea_block_iter, detailed_block_iter) \
_ECORE_X_RANDR_EDID_FOR_EACH_CEA_BLOCK(edid, edid_length, cea_block_iter) \
for (detailed_block_iter = cea_block_iter + cea_block_iter[2]; detailed_block_iter + 18 < cea_block_iter + 127; detailed_block_iter += 18) \
if (detailed_block_iter[0])
#define _ECORE_X_RANDR_EDID_FOR_EACH_CEA_DETAILED_BLOCK(edid, edid_length, cea_block_iter, detailed_block_iter) \
_ECORE_X_RANDR_EDID_FOR_EACH_CEA_BLOCK(edid, edid_length, cea_block_iter) \
for (detailed_block_iter = cea_block_iter + cea_block_iter[2]; detailed_block_iter + 18 < cea_block_iter + 127; detailed_block_iter += 18) \
if (detailed_block_iter[0])
#define _ECORE_X_RANDR_EDID_FOR_EACH_DESCRIPTOR_BLOCK(edid, block) \
for (block = edid + _ECORE_X_RANDR_EDID_OFFSET_DESCRIPTOR_BLOCK; block <= (edid + _ECORE_X_RANDR_EDID_OFFSET_DESCRIPTOR_BLOCK + (3*18)); block += 18)
for (block = edid + _ECORE_X_RANDR_EDID_OFFSET_DESCRIPTOR_BLOCK; block <= (edid + _ECORE_X_RANDR_EDID_OFFSET_DESCRIPTOR_BLOCK + (3 * 18)); block += 18)
#define _ECORE_X_RANDR_EDID_FOR_EACH_NON_PIXEL_DESCRIPTOR_BLOCK(edid, block) \
_ECORE_X_RANDR_EDID_FOR_EACH_DESCRIPTOR_BLOCK(edid, block) \
if ((block[0] == 0) && (block[1] == 0))
_ECORE_X_RANDR_EDID_FOR_EACH_DESCRIPTOR_BLOCK(edid, block) \
if ((block[0] == 0) && (block[1] == 0))
EAPI Eina_Bool
ecore_x_randr_edid_has_valid_header(unsigned char *edid, unsigned long edid_length)
ecore_x_randr_edid_has_valid_header(unsigned char *edid,
unsigned long edid_length)
{
const unsigned char header[] =
{ 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00 };
{ 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00 };
if (!edid) return EINA_FALSE;
if (edid_length < 8) return EINA_FALSE;
if (!memcmp(edid, header, 8)) return EINA_TRUE;
@ -110,36 +111,40 @@ ecore_x_randr_edid_has_valid_header(unsigned char *edid, unsigned long edid_leng
}
EAPI int
ecore_x_randr_edid_version_get(unsigned char *edid, unsigned long edid_length)
ecore_x_randr_edid_version_get(unsigned char *edid,
unsigned long edid_length)
{
if ((edid_length > _ECORE_X_RANDR_EDID_OFFSET_VERSION_MINOR) &&
(ecore_x_randr_edid_has_valid_header(edid, edid_length)))
return ((edid[_ECORE_X_RANDR_EDID_OFFSET_VERSION_MAJOR] << 8) |
edid[_ECORE_X_RANDR_EDID_OFFSET_VERSION_MINOR]);
return (edid[_ECORE_X_RANDR_EDID_OFFSET_VERSION_MAJOR] << 8) |
edid[_ECORE_X_RANDR_EDID_OFFSET_VERSION_MINOR];
return ECORE_X_RANDR_EDID_UNKNOWN_VALUE;
}
EAPI int
ecore_x_randr_edid_manufacturer_model_get(unsigned char *edid, unsigned long edid_length)
ecore_x_randr_edid_manufacturer_model_get(unsigned char *edid,
unsigned long edid_length)
{
if ((edid_length > 0x0b) &&
(ecore_x_randr_edid_has_valid_header(edid, edid_length)))
return (int)(edid[0x0a] + (edid[0x0b] << 8));
return (int)(edid[0x0a] + (edid[0x0b] << 8));
return ECORE_X_RANDR_EDID_UNKNOWN_VALUE;
}
EAPI int
ecore_x_randr_edid_manufacturer_serial_number_get(unsigned char *edid, unsigned long edid_length)
ecore_x_randr_edid_manufacturer_serial_number_get(unsigned char *edid,
unsigned long edid_length)
{
if ((edid_length > 0x0f) &&
(ecore_x_randr_edid_has_valid_header(edid, edid_length)))
return (int)(edid[0x0c] + (edid[0x0d] << 8) +
(edid[0x0e] << 16) + (edid[0x0f] << 24));
return (int)(edid[0x0c] + (edid[0x0d] << 8) +
(edid[0x0e] << 16) + (edid[0x0f] << 24));
return ECORE_X_RANDR_EDID_UNKNOWN_VALUE;
}
EAPI char *
ecore_x_randr_edid_manufacturer_name_get(unsigned char *edid, unsigned long edid_length)
ecore_x_randr_edid_manufacturer_name_get(unsigned char *edid,
unsigned long edid_length)
{
if ((edid_length > (_ECORE_X_RANDR_EDID_OFFSET_MANUFACTURER + 1)) &&
(ecore_x_randr_edid_has_valid_header(edid, edid_length)))
@ -160,72 +165,80 @@ ecore_x_randr_edid_manufacturer_name_get(unsigned char *edid, unsigned long edid
}
EAPI char *
ecore_x_randr_edid_display_name_get(unsigned char *edid, unsigned long edid_length)
ecore_x_randr_edid_display_name_get(unsigned char *edid,
unsigned long edid_length)
{
unsigned char *block = NULL;
int version = ecore_x_randr_edid_version_get(edid, edid_length);
if (version < ECORE_X_RANDR_EDID_VERSION_13) return NULL;
_ECORE_X_RANDR_EDID_FOR_EACH_NON_PIXEL_DESCRIPTOR_BLOCK(edid, block)
{
if (block[_ECORE_X_RANDR_EDID_OFFSET_DESCRIPTOR_BLOCK_TYPE] == 0xfc)
{
char *name, *p;
const char *edid_name;
{
if (block[_ECORE_X_RANDR_EDID_OFFSET_DESCRIPTOR_BLOCK_TYPE] == 0xfc)
{
char *name, *p;
const char *edid_name;
edid_name = (const char *)block + _ECORE_X_RANDR_EDID_OFFSET_DESCRIPTOR_BLOCK_CONTENT;
name = malloc(sizeof(char) * _ECORE_X_RANDR_EDID_DISPLAY_DESCRIPTOR_BLOCK_CONTENT_LENGTH_MAX);
if (!name) return NULL;
strncpy(name, edid_name, (_ECORE_X_RANDR_EDID_DISPLAY_DESCRIPTOR_BLOCK_CONTENT_LENGTH_MAX - 1));
name[_ECORE_X_RANDR_EDID_DISPLAY_DESCRIPTOR_BLOCK_CONTENT_LENGTH_MAX] = 0;
for (p = name; *p; p++)
{
if ((*p < ' ') || (*p > '~')) *p = 0;
}
return name;
}
}
edid_name = (const char *)block + _ECORE_X_RANDR_EDID_OFFSET_DESCRIPTOR_BLOCK_CONTENT;
name = malloc(sizeof(char) * _ECORE_X_RANDR_EDID_DISPLAY_DESCRIPTOR_BLOCK_CONTENT_LENGTH_MAX);
if (!name) return NULL;
strncpy(name, edid_name, (_ECORE_X_RANDR_EDID_DISPLAY_DESCRIPTOR_BLOCK_CONTENT_LENGTH_MAX - 1));
name[_ECORE_X_RANDR_EDID_DISPLAY_DESCRIPTOR_BLOCK_CONTENT_LENGTH_MAX] = 0;
for (p = name; *p; p++)
{
if ((*p < ' ') || (*p > '~')) *p = 0;
}
return name;
}
}
return NULL;
}
EAPI Ecore_X_Randr_Edid_Aspect_Ratio
ecore_x_randr_edid_display_aspect_ratio_preferred_get(unsigned char *edid, unsigned long edid_length)
ecore_x_randr_edid_display_aspect_ratio_preferred_get(unsigned char *edid,
unsigned long edid_length)
{
unsigned char *block = NULL;
int version = ecore_x_randr_edid_version_get(edid, edid_length);
if (version < ECORE_X_RANDR_EDID_VERSION_13) return ECORE_X_RANDR_EDID_UNKNOWN_VALUE;
_ECORE_X_RANDR_EDID_FOR_EACH_NON_PIXEL_DESCRIPTOR_BLOCK(edid, block)
{
if ((block[_ECORE_X_RANDR_EDID_OFFSET_DESCRIPTOR_BLOCK_TYPE] == 0xfd) &&
(block[10] == 0x04))
{
Ecore_X_Randr_Edid_Aspect_Ratio_Preferred preferred_ratio =
(Ecore_X_Randr_Edid_Aspect_Ratio_Preferred)
((block[_ECORE_X_RANDR_EDID_OFFSET_ASPECT_RATIO_PREFERRED] &
_ECORE_X_RANDR_EDID_MASK_ASPECT_RATIO_PREFERRED) >> 5);
switch (preferred_ratio)
{
case ECORE_X_RANDR_EDID_ASPECT_RATIO_PREFERRED_4_3:
return ECORE_X_RANDR_EDID_ASPECT_RATIO_4_3;
case ECORE_X_RANDR_EDID_ASPECT_RATIO_PREFERRED_16_9:
return ECORE_X_RANDR_EDID_ASPECT_RATIO_16_9;
case ECORE_X_RANDR_EDID_ASPECT_RATIO_PREFERRED_16_10:
return ECORE_X_RANDR_EDID_ASPECT_RATIO_16_10;
case ECORE_X_RANDR_EDID_ASPECT_RATIO_PREFERRED_5_4:
return ECORE_X_RANDR_EDID_ASPECT_RATIO_5_4;
case ECORE_X_RANDR_EDID_ASPECT_RATIO_PREFERRED_15_9:
return ECORE_X_RANDR_EDID_ASPECT_RATIO_15_9;
default:
return ECORE_X_RANDR_EDID_UNKNOWN_VALUE;
}
}
}
{
if ((block[_ECORE_X_RANDR_EDID_OFFSET_DESCRIPTOR_BLOCK_TYPE] == 0xfd) &&
(block[10] == 0x04))
{
Ecore_X_Randr_Edid_Aspect_Ratio_Preferred preferred_ratio =
(Ecore_X_Randr_Edid_Aspect_Ratio_Preferred)
((block[_ECORE_X_RANDR_EDID_OFFSET_ASPECT_RATIO_PREFERRED] &
_ECORE_X_RANDR_EDID_MASK_ASPECT_RATIO_PREFERRED) >> 5);
switch (preferred_ratio)
{
case ECORE_X_RANDR_EDID_ASPECT_RATIO_PREFERRED_4_3:
return ECORE_X_RANDR_EDID_ASPECT_RATIO_4_3;
case ECORE_X_RANDR_EDID_ASPECT_RATIO_PREFERRED_16_9:
return ECORE_X_RANDR_EDID_ASPECT_RATIO_16_9;
case ECORE_X_RANDR_EDID_ASPECT_RATIO_PREFERRED_16_10:
return ECORE_X_RANDR_EDID_ASPECT_RATIO_16_10;
case ECORE_X_RANDR_EDID_ASPECT_RATIO_PREFERRED_5_4:
return ECORE_X_RANDR_EDID_ASPECT_RATIO_5_4;
case ECORE_X_RANDR_EDID_ASPECT_RATIO_PREFERRED_15_9:
return ECORE_X_RANDR_EDID_ASPECT_RATIO_15_9;
default:
return ECORE_X_RANDR_EDID_UNKNOWN_VALUE;
}
}
}
return ECORE_X_RANDR_EDID_UNKNOWN_VALUE;
}
EAPI Ecore_X_Randr_Edid_Aspect_Ratio
ecore_x_randr_edid_display_aspect_ratios_get(unsigned char *edid, unsigned long edid_length)
ecore_x_randr_edid_display_aspect_ratios_get(unsigned char *edid,
unsigned long edid_length)
{
Ecore_X_Randr_Edid_Aspect_Ratio ret = ECORE_X_RANDR_EDID_UNKNOWN_VALUE;
unsigned char *block = NULL;
@ -233,91 +246,94 @@ ecore_x_randr_edid_display_aspect_ratios_get(unsigned char *edid, unsigned long
if (version < ECORE_X_RANDR_EDID_VERSION_13) return ECORE_X_RANDR_EDID_UNKNOWN_VALUE;
_ECORE_X_RANDR_EDID_FOR_EACH_NON_PIXEL_DESCRIPTOR_BLOCK(edid, block)
{
if ((block[_ECORE_X_RANDR_EDID_OFFSET_DESCRIPTOR_BLOCK_TYPE] == 0xfd) &&
(block[10] == 0x04))
{
if (block[_ECORE_X_RANDR_EDID_OFFSET_ASPECT_RATIO] & _ECORE_X_RANDR_EDID_MASK_ASPECT_RATIO_4_3)
ret |= ECORE_X_RANDR_EDID_ASPECT_RATIO_4_3;
if (block[_ECORE_X_RANDR_EDID_OFFSET_ASPECT_RATIO] & _ECORE_X_RANDR_EDID_MASK_ASPECT_RATIO_16_9)
ret |= ECORE_X_RANDR_EDID_ASPECT_RATIO_16_9;
if (block[_ECORE_X_RANDR_EDID_OFFSET_ASPECT_RATIO] & _ECORE_X_RANDR_EDID_MASK_ASPECT_RATIO_16_10)
ret |= ECORE_X_RANDR_EDID_ASPECT_RATIO_16_10;
if (block[_ECORE_X_RANDR_EDID_OFFSET_ASPECT_RATIO] & _ECORE_X_RANDR_EDID_MASK_ASPECT_RATIO_5_4)
ret |= ECORE_X_RANDR_EDID_ASPECT_RATIO_5_4;
if (block[_ECORE_X_RANDR_EDID_OFFSET_ASPECT_RATIO] & _ECORE_X_RANDR_EDID_MASK_ASPECT_RATIO_15_9)
ret |= ECORE_X_RANDR_EDID_ASPECT_RATIO_15_9;
}
}
{
if ((block[_ECORE_X_RANDR_EDID_OFFSET_DESCRIPTOR_BLOCK_TYPE] == 0xfd) &&
(block[10] == 0x04))
{
if (block[_ECORE_X_RANDR_EDID_OFFSET_ASPECT_RATIO] & _ECORE_X_RANDR_EDID_MASK_ASPECT_RATIO_4_3)
ret |= ECORE_X_RANDR_EDID_ASPECT_RATIO_4_3;
if (block[_ECORE_X_RANDR_EDID_OFFSET_ASPECT_RATIO] & _ECORE_X_RANDR_EDID_MASK_ASPECT_RATIO_16_9)
ret |= ECORE_X_RANDR_EDID_ASPECT_RATIO_16_9;
if (block[_ECORE_X_RANDR_EDID_OFFSET_ASPECT_RATIO] & _ECORE_X_RANDR_EDID_MASK_ASPECT_RATIO_16_10)
ret |= ECORE_X_RANDR_EDID_ASPECT_RATIO_16_10;
if (block[_ECORE_X_RANDR_EDID_OFFSET_ASPECT_RATIO] & _ECORE_X_RANDR_EDID_MASK_ASPECT_RATIO_5_4)
ret |= ECORE_X_RANDR_EDID_ASPECT_RATIO_5_4;
if (block[_ECORE_X_RANDR_EDID_OFFSET_ASPECT_RATIO] & _ECORE_X_RANDR_EDID_MASK_ASPECT_RATIO_15_9)
ret |= ECORE_X_RANDR_EDID_ASPECT_RATIO_15_9;
}
}
return ret;
}
EAPI char *
ecore_x_randr_edid_display_ascii_get(unsigned char *edid, unsigned long edid_length)
ecore_x_randr_edid_display_ascii_get(unsigned char *edid,
unsigned long edid_length)
{
unsigned char *block = NULL;
int version = ecore_x_randr_edid_version_get(edid, edid_length);
if (version < ECORE_X_RANDR_EDID_VERSION_13) return NULL;
_ECORE_X_RANDR_EDID_FOR_EACH_NON_PIXEL_DESCRIPTOR_BLOCK(edid, block)
{
if (block[_ECORE_X_RANDR_EDID_OFFSET_DESCRIPTOR_BLOCK_TYPE] == 0xfe)
{
char *ascii, *p;
const char *edid_ascii = (const char*)block +
_ECORE_X_RANDR_EDID_OFFSET_DESCRIPTOR_BLOCK_CONTENT;
/*
* TODO: Two of these in a row, in the third and fourth slots,
* seems to be specified by SPWG: http://www.spwg.org/
*/
ascii = malloc(sizeof(char) * _ECORE_X_RANDR_EDID_DISPLAY_DESCRIPTOR_BLOCK_CONTENT_LENGTH_MAX);
if (!ascii) return NULL;
strncpy(ascii, edid_ascii, (_ECORE_X_RANDR_EDID_DISPLAY_DESCRIPTOR_BLOCK_CONTENT_LENGTH_MAX - 1));
ascii[_ECORE_X_RANDR_EDID_DISPLAY_DESCRIPTOR_BLOCK_CONTENT_LENGTH_MAX] = 0;
for (p = ascii; *p; p++)
{
if ((*p < ' ') || (*p > '~')) *p = 0;
}
return ascii;
}
}
{
if (block[_ECORE_X_RANDR_EDID_OFFSET_DESCRIPTOR_BLOCK_TYPE] == 0xfe)
{
char *ascii, *p;
const char *edid_ascii = (const char *)block +
_ECORE_X_RANDR_EDID_OFFSET_DESCRIPTOR_BLOCK_CONTENT;
/*
* TODO: Two of these in a row, in the third and fourth slots,
* seems to be specified by SPWG: http://www.spwg.org/
*/
ascii = malloc(sizeof(char) * _ECORE_X_RANDR_EDID_DISPLAY_DESCRIPTOR_BLOCK_CONTENT_LENGTH_MAX);
if (!ascii) return NULL;
strncpy(ascii, edid_ascii, (_ECORE_X_RANDR_EDID_DISPLAY_DESCRIPTOR_BLOCK_CONTENT_LENGTH_MAX - 1));
ascii[_ECORE_X_RANDR_EDID_DISPLAY_DESCRIPTOR_BLOCK_CONTENT_LENGTH_MAX] = 0;
for (p = ascii; *p; p++)
{
if ((*p < ' ') || (*p > '~')) *p = 0;
}
return ascii;
}
}
return NULL;
}
EAPI char *
ecore_x_randr_edid_display_serial_get(unsigned char *edid, unsigned long edid_length)
ecore_x_randr_edid_display_serial_get(unsigned char *edid,
unsigned long edid_length)
{
unsigned char *block = NULL;
int version = ecore_x_randr_edid_version_get(edid, edid_length);
if (version < ECORE_X_RANDR_EDID_VERSION_13) return NULL;
_ECORE_X_RANDR_EDID_FOR_EACH_NON_PIXEL_DESCRIPTOR_BLOCK(edid, block)
{
if (block[_ECORE_X_RANDR_EDID_OFFSET_DESCRIPTOR_BLOCK_TYPE] == 0xff)
{
char *serial, *p;
const char *edid_serial = (const char*)block +
_ECORE_X_RANDR_EDID_OFFSET_DESCRIPTOR_BLOCK_CONTENT;
/*
* TODO: Two of these in a row, in the third and fourth slots,
* seems to be specified by SPWG: http://www.spwg.org/
*/
serial = malloc(sizeof(char) * _ECORE_X_RANDR_EDID_DISPLAY_DESCRIPTOR_BLOCK_CONTENT_LENGTH_MAX);
if (!serial) return NULL;
strncpy(serial, edid_serial, (_ECORE_X_RANDR_EDID_DISPLAY_DESCRIPTOR_BLOCK_CONTENT_LENGTH_MAX - 1));
serial[_ECORE_X_RANDR_EDID_DISPLAY_DESCRIPTOR_BLOCK_CONTENT_LENGTH_MAX] = 0;
for (p = serial; *p; p++)
{
if ((*p < ' ') || (*p > '~')) *p = 0;
}
return serial;
}
}
{
if (block[_ECORE_X_RANDR_EDID_OFFSET_DESCRIPTOR_BLOCK_TYPE] == 0xff)
{
char *serial, *p;
const char *edid_serial = (const char *)block +
_ECORE_X_RANDR_EDID_OFFSET_DESCRIPTOR_BLOCK_CONTENT;
/*
* TODO: Two of these in a row, in the third and fourth slots,
* seems to be specified by SPWG: http://www.spwg.org/
*/
serial = malloc(sizeof(char) * _ECORE_X_RANDR_EDID_DISPLAY_DESCRIPTOR_BLOCK_CONTENT_LENGTH_MAX);
if (!serial) return NULL;
strncpy(serial, edid_serial, (_ECORE_X_RANDR_EDID_DISPLAY_DESCRIPTOR_BLOCK_CONTENT_LENGTH_MAX - 1));
serial[_ECORE_X_RANDR_EDID_DISPLAY_DESCRIPTOR_BLOCK_CONTENT_LENGTH_MAX] = 0;
for (p = serial; *p; p++)
{
if ((*p < ' ') || (*p > '~')) *p = 0;
}
return serial;
}
}
return NULL;
}
EAPI Eina_Bool
ecore_x_randr_edid_info_has_valid_checksum(unsigned char *edid, unsigned long edid_length)
ecore_x_randr_edid_info_has_valid_checksum(unsigned char *edid,
unsigned long edid_length)
{
unsigned char *cea_block_iter = NULL;
char sum = 0;
@ -333,71 +349,77 @@ ecore_x_randr_edid_info_has_valid_checksum(unsigned char *edid, unsigned long ed
/* Check the cea extension blocks */
_ECORE_X_RANDR_EDID_FOR_EACH_CEA_BLOCK(edid, edid_length, cea_block_iter)
{
for (i = 0, sum = 0; i < 128; i++) sum += cea_block_iter[i];
}
{
for (i = 0, sum = 0; i < 128; i++) sum += cea_block_iter[i];
}
if (sum) return EINA_FALSE;
return EINA_TRUE;
}
EAPI Eina_Bool
ecore_x_randr_edid_dpms_available_get(unsigned char *edid, unsigned long edid_length)
ecore_x_randr_edid_dpms_available_get(unsigned char *edid,
unsigned long edid_length)
{
int version = ecore_x_randr_edid_version_get(edid, edid_length);
if (version < ECORE_X_RANDR_EDID_VERSION_13) return EINA_FALSE;
return (!!(edid[_ECORE_X_RANDR_EDID_OFFSET_DPMS] &
_ECORE_X_RANDR_EDID_MASK_DPMS));
return !!(edid[_ECORE_X_RANDR_EDID_OFFSET_DPMS] &
_ECORE_X_RANDR_EDID_MASK_DPMS);
}
EAPI Eina_Bool
ecore_x_randr_edid_dpms_standby_available_get(unsigned char *edid, unsigned long edid_length)
ecore_x_randr_edid_dpms_standby_available_get(unsigned char *edid,
unsigned long edid_length)
{
int version = ecore_x_randr_edid_version_get(edid, edid_length);
if (version < ECORE_X_RANDR_EDID_VERSION_13) return EINA_FALSE;
if (edid[_ECORE_X_RANDR_EDID_OFFSET_DPMS] & _ECORE_X_RANDR_EDID_MASK_DPMS)
return (!!(edid[_ECORE_X_RANDR_EDID_OFFSET_DPMS] &
_ECORE_X_RANDR_EDID_MASK_DPMS_STANDBY));
return !!(edid[_ECORE_X_RANDR_EDID_OFFSET_DPMS] &
_ECORE_X_RANDR_EDID_MASK_DPMS_STANDBY);
return EINA_FALSE;
}
EAPI Eina_Bool
ecore_x_randr_edid_dpms_suspend_available_get(unsigned char *edid, unsigned long edid_length)
ecore_x_randr_edid_dpms_suspend_available_get(unsigned char *edid,
unsigned long edid_length)
{
int version = ecore_x_randr_edid_version_get(edid, edid_length);
if (version < ECORE_X_RANDR_EDID_VERSION_13) return EINA_FALSE;
if (edid[_ECORE_X_RANDR_EDID_OFFSET_DPMS] & _ECORE_X_RANDR_EDID_MASK_DPMS)
return (!!(edid[_ECORE_X_RANDR_EDID_OFFSET_DPMS] &
_ECORE_X_RANDR_EDID_MASK_DPMS_SUSPEND));
return !!(edid[_ECORE_X_RANDR_EDID_OFFSET_DPMS] &
_ECORE_X_RANDR_EDID_MASK_DPMS_SUSPEND);
return EINA_FALSE;
}
EAPI Eina_Bool
ecore_x_randr_edid_dpms_off_available_get(unsigned char *edid, unsigned long edid_length)
ecore_x_randr_edid_dpms_off_available_get(unsigned char *edid,
unsigned long edid_length)
{
int version = ecore_x_randr_edid_version_get(edid, edid_length);
if (version < ECORE_X_RANDR_EDID_VERSION_13) return EINA_FALSE;
if (edid[_ECORE_X_RANDR_EDID_OFFSET_DPMS] & _ECORE_X_RANDR_EDID_MASK_DPMS)
return (!!(edid[_ECORE_X_RANDR_EDID_OFFSET_DPMS] &
_ECORE_X_RANDR_EDID_MASK_DPMS_OFF));
return !!(edid[_ECORE_X_RANDR_EDID_OFFSET_DPMS] &
_ECORE_X_RANDR_EDID_MASK_DPMS_OFF);
return EINA_FALSE;
}
EAPI Eina_Bool
ecore_x_randr_edid_display_type_digital_get(unsigned char *edid, unsigned long edid_length)
ecore_x_randr_edid_display_type_digital_get(unsigned char *edid,
unsigned long edid_length)
{
int version = ecore_x_randr_edid_version_get(edid, edid_length);
if (version < ECORE_X_RANDR_EDID_VERSION_13) return EINA_FALSE;
return (!!(edid[_ECORE_X_RANDR_EDID_OFFSET_TYPE] &
_ECORE_X_RANDR_EDID_MASK_DIGITAL));
return !!(edid[_ECORE_X_RANDR_EDID_OFFSET_TYPE] &
_ECORE_X_RANDR_EDID_MASK_DIGITAL);
}
EAPI Ecore_X_Randr_Edid_Display_Colorscheme
ecore_x_randr_edid_display_colorscheme_get(unsigned char *edid, unsigned long edid_length)
ecore_x_randr_edid_display_colorscheme_get(unsigned char *edid,
unsigned long edid_length)
{
Ecore_X_Randr_Edid_Display_Colorscheme colorscheme = ECORE_X_RANDR_EDID_UNKNOWN_VALUE;
int version = ecore_x_randr_edid_version_get(edid, edid_length);
@ -408,26 +430,28 @@ ecore_x_randr_edid_display_colorscheme_get(unsigned char *edid, unsigned long ed
colorscheme = ECORE_X_RANDR_EDID_DISPLAY_COLORSCHEME_COLOR_RGB_4_4_4;
if (edid[_ECORE_X_RANDR_EDID_OFFSET_COLORSPACE] &
_ECORE_X_RANDR_EDID_MASK_COLORSCHEME_DIGITAL_YCRCB_444)
colorscheme |= ECORE_X_RANDR_EDID_DISPLAY_COLORSCHEME_COLOR_RGB_YCRCB_4_4_4;
colorscheme |= ECORE_X_RANDR_EDID_DISPLAY_COLORSCHEME_COLOR_RGB_YCRCB_4_4_4;
if (edid[_ECORE_X_RANDR_EDID_OFFSET_COLORSPACE] &
_ECORE_X_RANDR_EDID_MASK_COLORSCHEME_DIGITAL_YCRCB_422)
colorscheme |= ECORE_X_RANDR_EDID_DISPLAY_COLORSCHEME_COLOR_RGB_YCRCB_4_2_2;
colorscheme |= ECORE_X_RANDR_EDID_DISPLAY_COLORSCHEME_COLOR_RGB_YCRCB_4_2_2;
}
else
colorscheme = edid[_ECORE_X_RANDR_EDID_OFFSET_COLORSPACE] & _ECORE_X_RANDR_EDID_MASK_COLORSCHEME_ANALOGOUS;
colorscheme = edid[_ECORE_X_RANDR_EDID_OFFSET_COLORSPACE] & _ECORE_X_RANDR_EDID_MASK_COLORSCHEME_ANALOGOUS;
return colorscheme;
}
EAPI Ecore_X_Randr_Edid_Display_Interface_Type
ecore_x_randr_edid_display_interface_type_get(unsigned char *edid, unsigned long edid_length)
ecore_x_randr_edid_display_interface_type_get(unsigned char *edid,
unsigned long edid_length)
{
Ecore_X_Randr_Edid_Display_Interface_Type type = ECORE_X_RANDR_EDID_UNKNOWN_VALUE;
int version = ecore_x_randr_edid_version_get(edid, edid_length);
if (version < ECORE_X_RANDR_EDID_VERSION_13) return type;
type = edid[_ECORE_X_RANDR_EDID_OFFSET_TYPE] &
_ECORE_X_RANDR_EDID_MASK_INTERFACE_TYPE;
_ECORE_X_RANDR_EDID_MASK_INTERFACE_TYPE;
if (type > ECORE_X_RANDR_EDID_DISPLAY_INTERFACE_DISPLAY_PORT)
type = ECORE_X_RANDR_EDID_UNKNOWN_VALUE;
type = ECORE_X_RANDR_EDID_UNKNOWN_VALUE;
return type;
}

View File

@ -9,18 +9,18 @@
#include "ecore_x_private.h"
#include "ecore_x_randr.h"
#define Ecore_X_Randr_None 0
#define Ecore_X_Randr_None 0
#define Ecore_X_Randr_Unset -1
#ifdef ECORE_XRANDR
#define RANDR_1_3 ((1 << 16) | 3)
#define RANDR_1_3 ((1 << 16) | 3)
#define RANDR_CHECK_1_3_RET(ret) if(_randr_version < RANDR_1_3) return ret
extern XRRScreenResources * (*_ecore_x_randr_get_screen_resources)(Display *
dpy,
Window
window);
extern XRRScreenResources *(*_ecore_x_randr_get_screen_resources)(Display *
dpy,
Window
window);
extern int _randr_version;
#endif
@ -34,7 +34,7 @@ ecore_x_randr_primary_output_get(Ecore_X_Window root)
#ifdef ECORE_XRANDR
RANDR_CHECK_1_3_RET(Ecore_X_Randr_None);
if (!_ecore_x_randr_root_validate(root))
return Ecore_X_Randr_None;
return Ecore_X_Randr_None;
return XRRGetOutputPrimary(_ecore_x_disp, root);
#else
@ -47,7 +47,7 @@ ecore_x_randr_primary_output_get(Ecore_X_Window root)
* @param output that should be set as given root window's screen primary output
*/
EAPI void
ecore_x_randr_primary_output_set(Ecore_X_Window root,
ecore_x_randr_primary_output_set(Ecore_X_Window root,
Ecore_X_Randr_Output output)
{
#ifdef ECORE_XRANDR
@ -60,3 +60,4 @@ ecore_x_randr_primary_output_set(Ecore_X_Window root,
#endif
}

View File

@ -39,24 +39,27 @@ ecore_x_xregion_free(Ecore_X_XRegion *region)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
if (!region)
return;
return;
XDestroyRegion((Region)region);
} /* ecore_x_xregion_free */
EAPI Eina_Bool
ecore_x_xregion_set(Ecore_X_XRegion *region, Ecore_X_GC gc)
ecore_x_xregion_set(Ecore_X_XRegion *region,
Ecore_X_GC gc)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
return XSetRegion(_ecore_x_disp, gc, (Region)region) ? EINA_TRUE : EINA_FALSE;
} /* ecore_x_xregion_set */
EAPI void
ecore_x_xregion_translate(Ecore_X_XRegion *region, int x, int y)
ecore_x_xregion_translate(Ecore_X_XRegion *region,
int x,
int y)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
if (!region)
return;
return;
/* return value not used */
XOffsetRegion((Region)region, x, y);
@ -109,37 +112,41 @@ EAPI Eina_Bool
ecore_x_xregion_is_empty(Ecore_X_XRegion *region)
{
if (!region)
return EINA_TRUE;
return EINA_TRUE;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
return XEmptyRegion((Region)region) ? EINA_TRUE : EINA_FALSE;
} /* ecore_x_xregion_is_empty */
EAPI Eina_Bool
ecore_x_xregion_is_equal(Ecore_X_XRegion *r1, Ecore_X_XRegion *r2)
ecore_x_xregion_is_equal(Ecore_X_XRegion *r1,
Ecore_X_XRegion *r2)
{
if (!r1 || !r2)
return EINA_FALSE;
return EINA_FALSE;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
return XEqualRegion((Region)r1, (Region)r1) ? EINA_TRUE : EINA_FALSE;
} /* ecore_x_xregion_is_equal */
EAPI Eina_Bool
ecore_x_xregion_point_contain(Ecore_X_XRegion *region, int x, int y)
ecore_x_xregion_point_contain(Ecore_X_XRegion *region,
int x,
int y)
{
if (!region)
return EINA_FALSE;
return EINA_FALSE;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
return XPointInRegion((Region)region, x, y) ? EINA_TRUE : EINA_FALSE;
} /* ecore_x_xregion_point_contain */
EAPI Eina_Bool
ecore_x_xregion_rect_contain(Ecore_X_XRegion *region, Ecore_X_Rectangle *rect)
ecore_x_xregion_rect_contain(Ecore_X_XRegion *region,
Ecore_X_Rectangle *rect)
{
if (!region || !rect)
return EINA_FALSE;
return EINA_FALSE;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
return XRectInRegion((Region)region,

View File

@ -17,7 +17,7 @@ EAPI Eina_Bool
ecore_x_screensaver_event_available_get(void)
{
if (_screensaver_available >= 0)
return _screensaver_available;
return _screensaver_available;
#ifdef ECORE_XSS
int _screensaver_major, _screensaver_minor;
@ -28,9 +28,9 @@ ecore_x_screensaver_event_available_get(void)
if (XScreenSaverQueryVersion(_ecore_x_disp, &_screensaver_major,
&_screensaver_minor))
_screensaver_available = 1;
_screensaver_available = 1;
else
_screensaver_available = 0;
_screensaver_available = 0;
#else /* ifdef ECORE_XSS */
_screensaver_available = 0;
@ -49,7 +49,7 @@ ecore_x_screensaver_idle_time_get(void)
xss = XScreenSaverAllocInfo();
XScreenSaverQueryInfo(_ecore_x_disp,
RootWindow(_ecore_x_disp, DefaultScreen(
_ecore_x_disp)), xss);
_ecore_x_disp)), xss);
idle = xss->idle / 1000;
XFree(xss);
@ -162,9 +162,9 @@ ecore_x_screensaver_event_listen_set(Eina_Bool on)
LOGFN(__FILE__, __LINE__, __FUNCTION__);
root = DefaultRootWindow(_ecore_x_disp);
if (on)
XScreenSaverSelectInput(_ecore_x_disp, root, ScreenSaverNotifyMask);
XScreenSaverSelectInput(_ecore_x_disp, root, ScreenSaverNotifyMask);
else
XScreenSaverSelectInput(_ecore_x_disp, root, 0);
XScreenSaverSelectInput(_ecore_x_disp, root, 0);
#else
return;
on = EINA_FALSE;

View File

@ -16,28 +16,28 @@ static Ecore_X_Selection_Converter *converters = NULL;
static Ecore_X_Selection_Parser *parsers = NULL;
static Eina_Bool _ecore_x_selection_converter_text(char *target,
void *data,
int size,
void **data_ret,
int *size_ret,
Ecore_X_Atom *tprop,
int *);
static int _ecore_x_selection_data_default_free(void *data);
static void * _ecore_x_selection_parser_files(const char *target,
void *data,
int size,
int format);
static int _ecore_x_selection_data_files_free(void *data);
static void * _ecore_x_selection_parser_text(const char *target,
void *data,
int size,
int format);
static int _ecore_x_selection_data_text_free(void *data);
static void * _ecore_x_selection_parser_targets(const char *target,
void *data,
int size,
int format);
static int _ecore_x_selection_data_targets_free(void *data);
void *data,
int size,
void **data_ret,
int *size_ret,
Ecore_X_Atom *tprop,
int *);
static int _ecore_x_selection_data_default_free(void *data);
static void *_ecore_x_selection_parser_files(const char *target,
void *data,
int size,
int format);
static int _ecore_x_selection_data_files_free(void *data);
static void *_ecore_x_selection_parser_text(const char *target,
void *data,
int size,
int format);
static int _ecore_x_selection_data_text_free(void *data);
static void *_ecore_x_selection_parser_targets(const char *target,
void *data,
int size,
int format);
static int _ecore_x_selection_data_targets_free(void *data);
#define ECORE_X_SELECTION_DATA(x) ((Ecore_X_Selection_Data *)(x))
@ -45,31 +45,31 @@ void
_ecore_x_selection_data_init(void)
{
/* Initialize global data */
memset(selections, 0, sizeof(selections));
memset(selections, 0, sizeof(selections));
/* Initialize converters */
ecore_x_selection_converter_atom_add(ECORE_X_ATOM_TEXT,
_ecore_x_selection_converter_text);
/* Initialize converters */
ecore_x_selection_converter_atom_add(ECORE_X_ATOM_TEXT,
_ecore_x_selection_converter_text);
#ifdef X_HAVE_UTF8_STRING
ecore_x_selection_converter_atom_add(ECORE_X_ATOM_UTF8_STRING,
_ecore_x_selection_converter_text);
ecore_x_selection_converter_atom_add(ECORE_X_ATOM_UTF8_STRING,
_ecore_x_selection_converter_text);
#endif /* ifdef X_HAVE_UTF8_STRING */
ecore_x_selection_converter_atom_add(ECORE_X_ATOM_COMPOUND_TEXT,
_ecore_x_selection_converter_text);
ecore_x_selection_converter_atom_add(ECORE_X_ATOM_STRING,
_ecore_x_selection_converter_text);
ecore_x_selection_converter_atom_add(ECORE_X_ATOM_COMPOUND_TEXT,
_ecore_x_selection_converter_text);
ecore_x_selection_converter_atom_add(ECORE_X_ATOM_STRING,
_ecore_x_selection_converter_text);
/* Initialize parsers */
ecore_x_selection_parser_add("text/plain",
_ecore_x_selection_parser_text);
ecore_x_selection_parser_add(ECORE_X_SELECTION_TARGET_UTF8_STRING,
_ecore_x_selection_parser_text);
ecore_x_selection_parser_add("text/uri-list",
_ecore_x_selection_parser_files);
ecore_x_selection_parser_add("_NETSCAPE_URL",
_ecore_x_selection_parser_files);
ecore_x_selection_parser_add(ECORE_X_SELECTION_TARGET_TARGETS,
_ecore_x_selection_parser_targets);
/* Initialize parsers */
ecore_x_selection_parser_add("text/plain",
_ecore_x_selection_parser_text);
ecore_x_selection_parser_add(ECORE_X_SELECTION_TARGET_UTF8_STRING,
_ecore_x_selection_parser_text);
ecore_x_selection_parser_add("text/uri-list",
_ecore_x_selection_parser_files);
ecore_x_selection_parser_add("_NETSCAPE_URL",
_ecore_x_selection_parser_files);
ecore_x_selection_parser_add(ECORE_X_SELECTION_TARGET_TARGETS,
_ecore_x_selection_parser_targets);
} /* _ecore_x_selection_data_init */
void
@ -108,15 +108,15 @@ Ecore_X_Selection_Intern *
_ecore_x_selection_get(Ecore_X_Atom selection)
{
if (selection == ECORE_X_ATOM_SELECTION_PRIMARY)
return &selections[0];
return &selections[0];
else if (selection == ECORE_X_ATOM_SELECTION_SECONDARY)
return &selections[1];
return &selections[1];
else if (selection == ECORE_X_ATOM_SELECTION_XDND)
return &selections[2];
return &selections[2];
else if (selection == ECORE_X_ATOM_SELECTION_CLIPBOARD)
return &selections[3];
return &selections[3];
else
return NULL;
return NULL;
} /* _ecore_x_selection_get */
Eina_Bool
@ -130,18 +130,18 @@ _ecore_x_selection_set(Window w,
XSetSelectionOwner(_ecore_x_disp, selection, w, _ecore_x_event_last_time);
if (XGetSelectionOwner(_ecore_x_disp, selection) != w)
return EINA_FALSE;
return EINA_FALSE;
if (selection == ECORE_X_ATOM_SELECTION_PRIMARY)
in = 0;
in = 0;
else if (selection == ECORE_X_ATOM_SELECTION_SECONDARY)
in = 1;
in = 1;
else if (selection == ECORE_X_ATOM_SELECTION_XDND)
in = 2;
in = 2;
else if (selection == ECORE_X_ATOM_SELECTION_CLIPBOARD)
in = 3;
in = 3;
else
return EINA_FALSE;
return EINA_FALSE;
if (data)
{
@ -173,7 +173,9 @@ _ecore_x_selection_set(Window w,
* claimed, or 0 if unsuccessful.
*/
EAPI Eina_Bool
ecore_x_selection_primary_set(Ecore_X_Window w, const void *data, int size)
ecore_x_selection_primary_set(Ecore_X_Window w,
const void *data,
int size)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
return _ecore_x_selection_set(w, data, size, ECORE_X_ATOM_SELECTION_PRIMARY);
@ -201,7 +203,9 @@ ecore_x_selection_primary_clear(void)
* claimed, or 0 if unsuccessful.
*/
EAPI Eina_Bool
ecore_x_selection_secondary_set(Ecore_X_Window w, const void *data, int size)
ecore_x_selection_secondary_set(Ecore_X_Window w,
const void *data,
int size)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
return _ecore_x_selection_set(w,
@ -235,7 +239,9 @@ ecore_x_selection_secondary_clear(void)
* claimed, or 0 if unsuccessful.
*/
EAPI Eina_Bool
ecore_x_selection_xdnd_set(Ecore_X_Window w, const void *data, int size)
ecore_x_selection_xdnd_set(Ecore_X_Window w,
const void *data,
int size)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
return _ecore_x_selection_set(w, data, size, ECORE_X_ATOM_SELECTION_XDND);
@ -266,7 +272,9 @@ ecore_x_selection_xdnd_clear(void)
* request. The buffer must be freed when done with.
*/
EAPI Eina_Bool
ecore_x_selection_clipboard_set(Ecore_X_Window w, const void *data, int size)
ecore_x_selection_clipboard_set(Ecore_X_Window w,
const void *data,
int size)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
return _ecore_x_selection_set(w,
@ -297,17 +305,17 @@ _ecore_x_selection_target_atom_get(const char *target)
Ecore_X_Atom x_target;
if (!strcmp(target, ECORE_X_SELECTION_TARGET_TEXT))
x_target = ECORE_X_ATOM_TEXT;
x_target = ECORE_X_ATOM_TEXT;
else if (!strcmp(target, ECORE_X_SELECTION_TARGET_COMPOUND_TEXT))
x_target = ECORE_X_ATOM_COMPOUND_TEXT;
x_target = ECORE_X_ATOM_COMPOUND_TEXT;
else if (!strcmp(target, ECORE_X_SELECTION_TARGET_STRING))
x_target = ECORE_X_ATOM_STRING;
x_target = ECORE_X_ATOM_STRING;
else if (!strcmp(target, ECORE_X_SELECTION_TARGET_UTF8_STRING))
x_target = ECORE_X_ATOM_UTF8_STRING;
x_target = ECORE_X_ATOM_UTF8_STRING;
else if (!strcmp(target, ECORE_X_SELECTION_TARGET_FILENAME))
x_target = ECORE_X_ATOM_FILE_NAME;
x_target = ECORE_X_ATOM_FILE_NAME;
else
x_target = ecore_x_atom_get(target);
x_target = ecore_x_atom_get(target);
return x_target;
} /* _ecore_x_selection_target_atom_get */
@ -317,16 +325,16 @@ _ecore_x_selection_target_get(Ecore_X_Atom target)
{
/* FIXME: Should not return mem allocated with strdup or X mixed,
* one should use free to free, the other XFree */
if (target == ECORE_X_ATOM_FILE_NAME)
return strdup(ECORE_X_SELECTION_TARGET_FILENAME);
else if (target == ECORE_X_ATOM_STRING)
return strdup(ECORE_X_SELECTION_TARGET_STRING);
else if (target == ECORE_X_ATOM_UTF8_STRING)
return strdup(ECORE_X_SELECTION_TARGET_UTF8_STRING);
else if (target == ECORE_X_ATOM_TEXT)
return strdup(ECORE_X_SELECTION_TARGET_TEXT);
else
return XGetAtomName(_ecore_x_disp, target);
if (target == ECORE_X_ATOM_FILE_NAME)
return strdup(ECORE_X_SELECTION_TARGET_FILENAME);
else if (target == ECORE_X_ATOM_STRING)
return strdup(ECORE_X_SELECTION_TARGET_STRING);
else if (target == ECORE_X_ATOM_UTF8_STRING)
return strdup(ECORE_X_SELECTION_TARGET_UTF8_STRING);
else if (target == ECORE_X_ATOM_TEXT)
return strdup(ECORE_X_SELECTION_TARGET_TEXT);
else
return XGetAtomName(_ecore_x_disp, target);
} /* _ecore_x_selection_target_get */
static void
@ -339,34 +347,37 @@ _ecore_x_selection_request(Ecore_X_Window w,
target = _ecore_x_selection_target_atom_get(target_str);
if (selection == ECORE_X_ATOM_SELECTION_PRIMARY)
prop = ECORE_X_ATOM_SELECTION_PROP_PRIMARY;
prop = ECORE_X_ATOM_SELECTION_PROP_PRIMARY;
else if (selection == ECORE_X_ATOM_SELECTION_SECONDARY)
prop = ECORE_X_ATOM_SELECTION_PROP_SECONDARY;
prop = ECORE_X_ATOM_SELECTION_PROP_SECONDARY;
else if (selection == ECORE_X_ATOM_SELECTION_CLIPBOARD)
prop = ECORE_X_ATOM_SELECTION_PROP_CLIPBOARD;
prop = ECORE_X_ATOM_SELECTION_PROP_CLIPBOARD;
else
return;
return;
XConvertSelection(_ecore_x_disp, selection, target, prop,
w, CurrentTime);
} /* _ecore_x_selection_request */
EAPI void
ecore_x_selection_primary_request(Ecore_X_Window w, const char *target)
ecore_x_selection_primary_request(Ecore_X_Window w,
const char *target)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
_ecore_x_selection_request(w, ECORE_X_ATOM_SELECTION_PRIMARY, target);
} /* ecore_x_selection_primary_request */
EAPI void
ecore_x_selection_secondary_request(Ecore_X_Window w, const char *target)
ecore_x_selection_secondary_request(Ecore_X_Window w,
const char *target)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
_ecore_x_selection_request(w, ECORE_X_ATOM_SELECTION_SECONDARY, target);
} /* ecore_x_selection_secondary_request */
EAPI void
ecore_x_selection_xdnd_request(Ecore_X_Window w, const char *target)
ecore_x_selection_xdnd_request(Ecore_X_Window w,
const char *target)
{
Ecore_X_Atom atom;
Ecore_X_DND_Target *_target;
@ -380,21 +391,22 @@ ecore_x_selection_xdnd_request(Ecore_X_Window w, const char *target)
} /* ecore_x_selection_xdnd_request */
EAPI void
ecore_x_selection_clipboard_request(Ecore_X_Window w, const char *target)
ecore_x_selection_clipboard_request(Ecore_X_Window w,
const char *target)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
_ecore_x_selection_request(w, ECORE_X_ATOM_SELECTION_CLIPBOARD, target);
} /* ecore_x_selection_clipboard_request */
EAPI void
ecore_x_selection_converter_atom_add(Ecore_X_Atom target,
Eina_Bool (*func)(char *target,
void *data,
int size,
void **data_ret,
int *size_ret,
Ecore_X_Atom *ttype,
int *tsize))
ecore_x_selection_converter_atom_add(Ecore_X_Atom target,
Eina_Bool (*func)(char *target,
void *data,
int size,
void **data_ret,
int *size_ret,
Ecore_X_Atom *ttype,
int *tsize))
{
Ecore_X_Selection_Converter *cnv;
@ -411,9 +423,9 @@ ecore_x_selection_converter_atom_add(Ecore_X_Atom target,
}
if (cnv->next)
cnv = cnv->next;
cnv = cnv->next;
else
break;
break;
}
cnv->next = calloc(1, sizeof(Ecore_X_Selection_Converter));
@ -432,19 +444,19 @@ ecore_x_selection_converter_atom_add(Ecore_X_Atom target,
} /* ecore_x_selection_converter_atom_add */
EAPI void
ecore_x_selection_converter_add(char *target,
Eina_Bool (*func)(char *target,
void *data,
int size,
void **data_ret,
int *size_ret,
Ecore_X_Atom *,
int *))
ecore_x_selection_converter_add(char *target,
Eina_Bool (*func)(char *target,
void *data,
int size,
void **data_ret,
int *size_ret,
Ecore_X_Atom *,
int *))
{
Ecore_X_Atom x_target;
if (!func || !target)
return;
return;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
x_target = _ecore_x_selection_target_atom_get(target);
@ -466,7 +478,7 @@ ecore_x_selection_converter_atom_del(Ecore_X_Atom target)
if (cnv->target == target)
{
if (prev_cnv)
prev_cnv->next = cnv->next;
prev_cnv->next = cnv->next;
else
{
converters = cnv->next; /* This was the first converter */
@ -488,7 +500,7 @@ ecore_x_selection_converter_del(char *target)
Ecore_X_Atom x_target;
if (!target)
return;
return;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
x_target = _ecore_x_selection_target_atom_get(target);
@ -517,7 +529,7 @@ ecore_x_selection_notify_send(Ecore_X_Window requestor,
xnotify.serial = 0;
xev.xselection = xnotify;
return ((XSendEvent(_ecore_x_disp, requestor, False, 0, &xev) > 0) ? EINA_TRUE : EINA_FALSE);
return (XSendEvent(_ecore_x_disp, requestor, False, 0, &xev) > 0) ? EINA_TRUE : EINA_FALSE;
} /* ecore_x_selection_notify_send */
/* Locate and run conversion callback for specified selection target */
@ -552,7 +564,7 @@ ecore_x_selection_convert(Ecore_X_Atom selection,
return r;
}
else
return EINA_FALSE;
return EINA_FALSE;
}
}
@ -584,22 +596,22 @@ _ecore_x_selection_converter_text(char *target,
XICCEncodingStyle style;
if (!data || !size)
return EINA_FALSE;
return EINA_FALSE;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
if (!strcmp(target, ECORE_X_SELECTION_TARGET_TEXT))
style = XTextStyle;
style = XTextStyle;
else if (!strcmp(target, ECORE_X_SELECTION_TARGET_COMPOUND_TEXT))
style = XCompoundTextStyle;
style = XCompoundTextStyle;
else if (!strcmp(target, ECORE_X_SELECTION_TARGET_STRING))
style = XStringStyle;
style = XStringStyle;
#ifdef X_HAVE_UTF8_STRING
else if (!strcmp(target, ECORE_X_SELECTION_TARGET_UTF8_STRING))
style = XUTF8StringStyle;
style = XUTF8StringStyle;
#endif /* ifdef X_HAVE_UTF8_STRING */
else
return EINA_FALSE;
return EINA_FALSE;
mystr = alloca(size + 1);
memcpy(mystr, data, size);
@ -650,7 +662,7 @@ ecore_x_selection_parser_add(const char *target,
Ecore_X_Selection_Parser *prs;
if (!target)
return;
return;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
prs = parsers;
@ -688,7 +700,7 @@ ecore_x_selection_parser_del(const char *target)
Ecore_X_Selection_Parser *prs, *prev_prs;
if (!target)
return;
return;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
prev_prs = NULL;
@ -699,7 +711,7 @@ ecore_x_selection_parser_del(const char *target)
if (!strcmp(prs->target, target))
{
if (prev_prs)
prev_prs->next = prs->next;
prev_prs->next = prs->next;
else
{
parsers = prs->next; /* This was the first parser */
@ -723,29 +735,34 @@ ecore_x_selection_parser_del(const char *target)
* @param time Specifies the time
* @since 1.1.0
*/
EAPI void
ecore_x_selection_owner_set(Ecore_X_Window win, Ecore_X_Atom atom, Ecore_X_Time tim)
EAPI void
ecore_x_selection_owner_set(Ecore_X_Window win,
Ecore_X_Atom atom,
Ecore_X_Time tim)
{
XSetSelectionOwner(_ecore_x_disp, atom, win, tim);
}
/**
* Return the window that currently owns the specified selection.
*
*
* @param atom The specified selection atom.
*
*
* @return The window that currently owns the specified selection.
* @since 1.1.0
*/
EAPI Ecore_X_Window
ecore_x_selection_owner_get(Ecore_X_Atom atom)
EAPI Ecore_X_Window
ecore_x_selection_owner_get(Ecore_X_Atom atom)
{
return XGetSelectionOwner(_ecore_x_disp, atom);
}
/* Locate and run conversion callback for specified selection target */
void *
_ecore_x_selection_parse(const char *target, void *data, int size, int format)
_ecore_x_selection_parse(const char *target,
void *data,
int size,
int format)
{
Ecore_X_Selection_Parser *prs;
Ecore_X_Selection_Data *sel;
@ -755,7 +772,7 @@ _ecore_x_selection_parse(const char *target, void *data, int size, int format)
if (!strcmp(prs->target, target))
{
sel = prs->parse(target, data, size, format);
if (sel) return sel;
if (sel) return sel;
}
}
@ -784,7 +801,7 @@ static void *
_ecore_x_selection_parser_files(const char *target,
void *_data,
int size,
int format __UNUSED__)
int format __UNUSED__)
{
Ecore_X_Selection_Data_Files *sel;
char *t, *data = _data;
@ -794,7 +811,7 @@ _ecore_x_selection_parser_files(const char *target,
if (strcmp(target, "text/uri-list") &&
strcmp(target, "_NETSCAPE_URL"))
return NULL;
return NULL;
sel = calloc(1, sizeof(Ecore_X_Selection_Data_Files));
if (!sel) return NULL;
@ -803,15 +820,15 @@ _ecore_x_selection_parser_files(const char *target,
if (data[size - 1])
{
/* Isn't nul terminated */
size++;
t = realloc(data, size);
if (!t)
{
free(sel);
return NULL;
}
data = t;
data[size - 1] = 0;
size++;
t = realloc(data, size);
if (!t)
{
free(sel);
return NULL;
}
data = t;
data[size - 1] = 0;
}
tmp = malloc(size);
@ -825,12 +842,12 @@ _ecore_x_selection_parser_files(const char *target,
while ((is < size) && (data[is]))
{
if ((i == 0) && (data[is] == '#'))
for (; ((data[is]) && (data[is] != '\n')); is++) ;
for (; ((data[is]) && (data[is] != '\n')); is++) ;
else
{
if ((data[is] != '\r') &&
(data[is] != '\n'))
tmp[i++] = data[is++];
tmp[i++] = data[is++];
else
{
while ((data[is] == '\r') || (data[is] == '\n')) is++;
@ -878,7 +895,7 @@ _ecore_x_selection_data_files_free(void *data)
if (sel->files)
{
for (i = 0; i < sel->num_files; i++)
free(sel->files[i]);
free(sel->files[i]);
free(sel->files);
}
@ -888,9 +905,9 @@ _ecore_x_selection_data_files_free(void *data)
static void *
_ecore_x_selection_parser_text(const char *target __UNUSED__,
void *_data,
int size,
int format __UNUSED__)
void *_data,
int size,
int format __UNUSED__)
{
Ecore_X_Selection_Data_Text *sel;
unsigned char *data = _data;
@ -901,15 +918,15 @@ _ecore_x_selection_parser_text(const char *target __UNUSED__,
if (data[size - 1])
{
/* Isn't nul terminated */
size++;
t = realloc(data, size);
if (!t)
{
free(sel);
return NULL;
}
data = t;
data[size - 1] = 0;
size++;
t = realloc(data, size);
if (!t)
{
free(sel);
return NULL;
}
data = t;
data[size - 1] = 0;
}
sel->text = (char *)data;
@ -933,9 +950,9 @@ _ecore_x_selection_data_text_free(void *data)
static void *
_ecore_x_selection_parser_targets(const char *target __UNUSED__,
void *data,
int size,
int format __UNUSED__)
void *data,
int size,
int format __UNUSED__)
{
Ecore_X_Selection_Data_Targets *sel;
unsigned long *targets;
@ -953,7 +970,7 @@ _ecore_x_selection_parser_targets(const char *target __UNUSED__,
return NULL;
}
for (i = 2; i < size; i++)
sel->targets[i - 2] = XGetAtomName(_ecore_x_disp, targets[i]);
sel->targets[i - 2] = XGetAtomName(_ecore_x_disp, targets[i]);
ECORE_X_SELECTION_DATA(sel)->free = _ecore_x_selection_data_targets_free;
ECORE_X_SELECTION_DATA(sel)->content = ECORE_X_SELECTION_CONTENT_TARGETS;
@ -973,7 +990,7 @@ _ecore_x_selection_data_targets_free(void *data)
if (sel->targets)
{
for (i = 0; i < sel->num_targets; i++)
XFree(sel->targets[i]);
XFree(sel->targets[i]);
free(sel->targets);
}

View File

@ -27,7 +27,7 @@ ecore_x_sync_alarm_new(Ecore_X_Sync_Counter counter)
XSyncIntToValue(&values.trigger.wait_value, 1);
values.trigger.test_type = XSyncPositiveComparison;
XSyncIntToValue(&values.delta, 1);
XSyncIntToValue(&values.delta, 1);
values.events = True;
@ -52,7 +52,8 @@ ecore_x_sync_alarm_free(Ecore_X_Sync_Alarm alarm)
} /* ecore_x_sync_alarm_free */
EAPI Eina_Bool
ecore_x_sync_counter_query(Ecore_X_Sync_Counter counter, unsigned int *val)
ecore_x_sync_counter_query(Ecore_X_Sync_Counter counter,
unsigned int *val)
{
XSyncValue value;
@ -86,7 +87,8 @@ ecore_x_sync_counter_free(Ecore_X_Sync_Counter counter)
} /* ecore_x_sync_counter_free */
EAPI void
ecore_x_sync_counter_inc(Ecore_X_Sync_Counter counter, int by)
ecore_x_sync_counter_inc(Ecore_X_Sync_Counter counter,
int by)
{
XSyncValue v;
@ -96,14 +98,15 @@ ecore_x_sync_counter_inc(Ecore_X_Sync_Counter counter, int by)
} /* ecore_x_sync_counter_inc */
EAPI void
ecore_x_sync_counter_val_wait(Ecore_X_Sync_Counter counter, int val)
ecore_x_sync_counter_val_wait(Ecore_X_Sync_Counter counter,
int val)
{
XSyncWaitCondition cond;
XSyncValue v, v2;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
XSyncQueryCounter(_ecore_x_disp, counter, &v);
XSyncIntToValue(&v, val);
XSyncIntToValue(&v, val);
XSyncIntToValue(&v2, val + 1);
cond.trigger.counter = counter;
cond.trigger.value_type = XSyncAbsolute;
@ -115,7 +118,8 @@ ecore_x_sync_counter_val_wait(Ecore_X_Sync_Counter counter, int val)
} /* ecore_x_sync_counter_val_wait */
EAPI void
ecore_x_sync_counter_set(Ecore_X_Sync_Counter counter, int val)
ecore_x_sync_counter_set(Ecore_X_Sync_Counter counter,
int val)
{
XSyncValue v;
@ -125,7 +129,9 @@ ecore_x_sync_counter_set(Ecore_X_Sync_Counter counter, int val)
}
EAPI void
ecore_x_sync_counter_2_set(Ecore_X_Sync_Counter counter, int val_hi, unsigned int val_lo)
ecore_x_sync_counter_2_set(Ecore_X_Sync_Counter counter,
int val_hi,
unsigned int val_lo)
{
XSyncValue v;
@ -135,7 +141,9 @@ ecore_x_sync_counter_2_set(Ecore_X_Sync_Counter counter, int val_hi, unsigned in
}
EAPI Eina_Bool
ecore_x_sync_counter_2_query(Ecore_X_Sync_Counter counter, int *val_hi, unsigned int *val_lo)
ecore_x_sync_counter_2_query(Ecore_X_Sync_Counter counter,
int *val_hi,
unsigned int *val_lo)
{
XSyncValue value;

View File

@ -25,18 +25,18 @@ ecore_x_test_fake_key_down(const char *key __UNUSED__)
LOGFN(__FILE__, __LINE__, __FUNCTION__);
if (!strncmp(key, "Keycode-", 8))
keycode = atoi(key + 8);
keycode = atoi(key + 8);
else
{
keysym = XStringToKeysym(key);
if (keysym == NoSymbol)
return EINA_FALSE;
return EINA_FALSE;
keycode = XKeysymToKeycode(_ecore_x_disp, keysym);
}
if (keycode == 0)
return EINA_FALSE;
return EINA_FALSE;
return XTestFakeKeyEvent(_ecore_x_disp, keycode, 1, 0) ? EINA_TRUE : EINA_FALSE;
#else /* ifdef ECORE_XTEST */
@ -57,18 +57,18 @@ ecore_x_test_fake_key_up(const char *key __UNUSED__)
LOGFN(__FILE__, __LINE__, __FUNCTION__);
if (!strncmp(key, "Keycode-", 8))
keycode = atoi(key + 8);
keycode = atoi(key + 8);
else
{
keysym = XStringToKeysym(key);
if (keysym == NoSymbol)
return EINA_FALSE;
return EINA_FALSE;
keycode = XKeysymToKeycode(_ecore_x_disp, keysym);
}
if (keycode == 0)
return EINA_FALSE;
return EINA_FALSE;
return XTestFakeKeyEvent(_ecore_x_disp, keycode, 0, 0) ? EINA_TRUE : EINA_FALSE;
#else /* ifdef ECORE_XTEST */
@ -90,23 +90,23 @@ ecore_x_test_fake_key_press(const char *key __UNUSED__)
LOGFN(__FILE__, __LINE__, __FUNCTION__);
if (!strncmp(key, "Keycode-", 8))
keycode = atoi(key + 8);
keycode = atoi(key + 8);
else
{
keysym = XStringToKeysym(key);
if (keysym == NoSymbol)
return EINA_FALSE;
return EINA_FALSE;
keycode = XKeysymToKeycode(_ecore_x_disp, keysym);
if (XKeycodeToKeysym(_ecore_x_disp, keycode, 0) != keysym)
{
if (XKeycodeToKeysym(_ecore_x_disp, keycode, 1) == keysym)
shift = 1;
shift = 1;
else
keycode = 0;
keycode = 0;
}
else
shift = 0;
shift = 0;
}
if (keycode == 0)
@ -132,14 +132,14 @@ ecore_x_test_fake_key_press(const char *key __UNUSED__)
}
if (shift)
XTestFakeKeyEvent(_ecore_x_disp,
XKeysymToKeycode(_ecore_x_disp, XK_Shift_L), 1, 0);
XTestFakeKeyEvent(_ecore_x_disp,
XKeysymToKeycode(_ecore_x_disp, XK_Shift_L), 1, 0);
XTestFakeKeyEvent(_ecore_x_disp, keycode, 1, 0);
XTestFakeKeyEvent(_ecore_x_disp, keycode, 0, 0);
if (shift)
XTestFakeKeyEvent(_ecore_x_disp,
XKeysymToKeycode(_ecore_x_disp, XK_Shift_L), 0, 0);
XTestFakeKeyEvent(_ecore_x_disp,
XKeysymToKeycode(_ecore_x_disp, XK_Shift_L), 0, 0);
return EINA_TRUE;
#else /* ifdef ECORE_XTEST */

View File

@ -25,13 +25,13 @@ typedef unsigned int drm_magic_t;
typedef enum
{
DRM_VBLANK_ABSOLUTE = 0x00000000,
DRM_VBLANK_RELATIVE = 0x00000001,
DRM_VBLANK_EVENT = 0x04000000,
DRM_VBLANK_FLIP = 0x08000000,
DRM_VBLANK_NEXTONMISS = 0x10000000,
DRM_VBLANK_SECONDARY = 0x20000000,
DRM_VBLANK_SIGNAL = 0x40000000
DRM_VBLANK_ABSOLUTE = 0x00000000,
DRM_VBLANK_RELATIVE = 0x00000001,
DRM_VBLANK_EVENT = 0x04000000,
DRM_VBLANK_FLIP = 0x08000000,
DRM_VBLANK_NEXTONMISS = 0x10000000,
DRM_VBLANK_SECONDARY = 0x20000000,
DRM_VBLANK_SIGNAL = 0x40000000
}
drmVBlankSeqType;
@ -61,48 +61,67 @@ typedef union _drmVBlank
typedef struct _drmEventContext
{
int version;
void (*vblank_handler)(int fd, unsigned int sequence, unsigned int tv_sec, unsigned int tv_usec, void *user_data);
void (*page_flip_handler)(int fd, unsigned int sequence, unsigned int tv_sec, unsigned int tv_usec, void *user_data);
void (*vblank_handler)(int fd,
unsigned int sequence,
unsigned int tv_sec,
unsigned int tv_usec,
void *user_data);
void (*page_flip_handler)(int fd,
unsigned int sequence,
unsigned int tv_sec,
unsigned int tv_usec,
void *user_data);
} drmEventContext;
static int (*sym_drmClose) (int fd) = NULL;
static int (*sym_drmGetMagic) (int fd, drm_magic_t * magic) = NULL;
static int (*sym_drmWaitVBlank) (int fd, drmVBlank *vbl) = NULL;
static int (*sym_drmHandleEvent) (int fd, drmEventContext *evctx) = NULL;
static int (*sym_drmClose)(int fd) = NULL;
static int (*sym_drmGetMagic)(int fd,
drm_magic_t *magic) = NULL;
static int (*sym_drmWaitVBlank)(int fd,
drmVBlank *vbl) = NULL;
static int (*sym_drmHandleEvent)(int fd,
drmEventContext *evctx) = NULL;
//// dri
static Bool (*sym_DRI2QueryExtension) (Display *display, int *eventBase, int *errorBase) = NULL;
static Bool (*sym_DRI2QueryVersion) (Display *display, int *major, int *minor) = NULL;
static Bool (*sym_DRI2Connect) (Display *display, XID window, char **driverName, char **deviceName) = NULL;
static Bool (*sym_DRI2Authenticate) (Display *display, XID window, drm_magic_t magic) = NULL;
static Bool (*sym_DRI2QueryExtension)(Display *display,
int *eventBase,
int *errorBase) = NULL;
static Bool (*sym_DRI2QueryVersion)(Display *display,
int *major,
int *minor) = NULL;
static Bool (*sym_DRI2Connect)(Display *display,
XID window,
char **driverName,
char **deviceName) = NULL;
static Bool (*sym_DRI2Authenticate)(Display *display,
XID window,
drm_magic_t magic) = NULL;
//// dri/drm data needed
static int dri2_event = 0;
static int dri2_error = 0;
static int dri2_major = 0;
static int dri2_minor = 0;
static char *device_name = 0;
static char *driver_name = 0;
static drm_magic_t drm_magic;
static int dri2_event = 0;
static int dri2_error = 0;
static int dri2_major = 0;
static int dri2_minor = 0;
static char *device_name = 0;
static char *driver_name = 0;
static drm_magic_t drm_magic;
static int drm_fd = -1;
static int drm_event_is_busy = 0;
static int drm_animators_interval = 1;
static drmEventContext drm_evctx;
static int drm_fd = -1;
static int drm_event_is_busy = 0;
static int drm_animators_interval = 1;
static drmEventContext drm_evctx;
static Ecore_Fd_Handler *dri_drm_fdh = NULL;
static void *dri_lib = NULL;
static void *drm_lib = NULL;
static void *dri_lib = NULL;
static void *drm_lib = NULL;
static Window dri_drm_vsync_root = 0;
static Window dri_drm_vsync_root = 0;
static void
_dri_drm_tick_schedule(void)
{
drmVBlank vbl;
vbl.request.type = DRM_VBLANK_RELATIVE | DRM_VBLANK_EVENT;
vbl.request.sequence = drm_animators_interval;
vbl.request.signal = 0;
@ -123,16 +142,19 @@ _dri_drm_tick_end(void *data __UNUSED__)
}
static void
_dri_drm_vblank_handler(int fd __UNUSED__, unsigned int frame __UNUSED__,
unsigned int sec __UNUSED__,
unsigned int usec __UNUSED__, void *data __UNUSED__)
_dri_drm_vblank_handler(int fd __UNUSED__,
unsigned int frame __UNUSED__,
unsigned int sec __UNUSED__,
unsigned int usec __UNUSED__,
void *data __UNUSED__)
{
ecore_animator_custom_tick();
if (drm_event_is_busy) _dri_drm_tick_schedule();
}
static Eina_Bool
_dri_drm_cb(void *data __UNUSED__, Ecore_Fd_Handler *fd_handler __UNUSED__)
_dri_drm_cb(void *data __UNUSED__,
Ecore_Fd_Handler *fd_handler __UNUSED__)
{
sym_drmHandleEvent(drm_fd, &drm_evctx);
return ECORE_CALLBACK_RENEW;
@ -146,36 +168,36 @@ static int
_dri_drm_link(void)
{
const char *drm_libs[] =
{
"libdrm.so.2",
"libdrm.so.1",
"libdrm.so.0",
"libdrm.so",
NULL,
};
{
"libdrm.so.2",
"libdrm.so.1",
"libdrm.so.0",
"libdrm.so",
NULL,
};
const char *dri_libs[] =
{
"libdri2.so.2",
"libdri2.so.1",
"libdri2.so.0",
"libdri2.so",
"libGL.so.4",
"libGL.so.3",
"libGL.so.2",
"libGL.so.1",
"libGL.so.0",
"libGL.so",
NULL,
};
{
"libdri2.so.2",
"libdri2.so.1",
"libdri2.so.0",
"libdri2.so",
"libGL.so.4",
"libGL.so.3",
"libGL.so.2",
"libGL.so.1",
"libGL.so.0",
"libGL.so",
NULL,
};
int i, fail;
#define SYM(lib, xx) \
do { \
sym_ ## xx = dlsym(lib, #xx); \
if (!(sym_ ## xx)) { \
fprintf(stderr, "%s\n", dlerror()); \
fail = 1; \
} \
} while (0)
#define SYM(lib, xx) \
do { \
sym_ ## xx = dlsym(lib, #xx); \
if (!(sym_ ## xx)) { \
fprintf(stderr, "%s\n", dlerror()); \
fail = 1; \
} \
} while (0)
if (dri_lib) return 1;
for (i = 0; drm_libs[i]; i++)
@ -227,16 +249,16 @@ static int
_dri_drm_init(void)
{
if (!sym_DRI2QueryExtension(_ecore_x_disp, &dri2_event, &dri2_error))
return 0;
return 0;
if (!sym_DRI2QueryVersion(_ecore_x_disp, &dri2_major, &dri2_minor))
return 0;
return 0;
if (dri2_major < 2)
return 0;
return 0;
if (!sym_DRI2Connect(_ecore_x_disp, dri_drm_vsync_root, &driver_name, &device_name))
return 0;
return 0;
drm_fd = open(device_name, O_RDWR);
if (drm_fd < 0)
return 0;
return 0;
sym_drmGetMagic(drm_fd, &drm_magic);
if (!sym_DRI2Authenticate(_ecore_x_disp, dri_drm_vsync_root, drm_magic))
{
@ -248,8 +270,8 @@ _dri_drm_init(void)
drm_evctx.version = DRM_EVENT_CONTEXT_VERSION;
drm_evctx.vblank_handler = _dri_drm_vblank_handler;
drm_evctx.page_flip_handler = NULL;
dri_drm_fdh = ecore_main_fd_handler_add(drm_fd, ECORE_FD_READ,
dri_drm_fdh = ecore_main_fd_handler_add(drm_fd, ECORE_FD_READ,
_dri_drm_cb, NULL, NULL, NULL);
if (!dri_drm_fdh)
{
@ -274,6 +296,7 @@ _dri_drm_shutdown(void)
dri_drm_fdh = NULL;
}
}
#endif
EAPI Eina_Bool
@ -281,7 +304,7 @@ ecore_x_vsync_animator_tick_source_set(Ecore_X_Window win)
{
#ifdef ECORE_X_VSYNC_DRI2
Ecore_X_Window root;
root = ecore_x_window_root_get(win);
if (root != dri_drm_vsync_root)
{
@ -301,9 +324,9 @@ ecore_x_vsync_animator_tick_source_set(Ecore_X_Window win)
return EINA_FALSE;
}
ecore_animator_custom_source_tick_begin_callback_set
(_dri_drm_tick_begin, NULL);
(_dri_drm_tick_begin, NULL);
ecore_animator_custom_source_tick_end_callback_set
(_dri_drm_tick_end, NULL);
(_dri_drm_tick_end, NULL);
ecore_animator_source_set(ECORE_ANIMATOR_SOURCE_CUSTOM);
}
else
@ -312,9 +335,9 @@ ecore_x_vsync_animator_tick_source_set(Ecore_X_Window win)
{
_dri_drm_shutdown();
ecore_animator_custom_source_tick_begin_callback_set
(NULL, NULL);
(NULL, NULL);
ecore_animator_custom_source_tick_end_callback_set
(NULL, NULL);
(NULL, NULL);
ecore_animator_source_set(ECORE_ANIMATOR_SOURCE_TIMER);
}
}
@ -323,5 +346,6 @@ ecore_x_vsync_animator_tick_source_set(Ecore_X_Window win)
#else
return EINA_FALSE;
win = 0;
#endif
#endif
}

File diff suppressed because it is too large Load Diff

View File

@ -12,16 +12,18 @@
#include <inttypes.h>
#include <limits.h>
#define _ATOM_SET_CARD32(win, atom, p_val, cnt)\
XChangeProperty(_ecore_x_disp, win, atom, XA_CARDINAL, 32, PropModeReplace,\
(unsigned char *)p_val, cnt)
#define _ATOM_SET_CARD32(win, atom, p_val, cnt) \
XChangeProperty(_ecore_x_disp, win, atom, XA_CARDINAL, 32, PropModeReplace, \
(unsigned char *)p_val, cnt)
/*
* 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 num)
ecore_x_window_prop_card32_set(Ecore_X_Window win,
Ecore_X_Atom atom,
unsigned int *val,
unsigned int num)
{
#if SIZEOF_INT == SIZEOF_LONG
_ATOM_SET_CARD32(win, atom, val, num);
@ -32,10 +34,10 @@ ecore_x_window_prop_card32_set(Ecore_X_Window win, Ecore_X_Atom atom,
LOGFN(__FILE__, __LINE__, __FUNCTION__);
v2 = malloc(num * sizeof(long));
if (!v2)
return;
return;
for (i = 0; i < num; i++)
v2[i] = val[i];
v2[i] = val[i];
_ATOM_SET_CARD32(win, atom, v2, num);
free(v2);
#endif /* if SIZEOF_INT == SIZEOF_LONG */
@ -50,8 +52,10 @@ ecore_x_window_prop_card32_set(Ecore_X_Window win, Ecore_X_Atom atom,
* Note: Return value 0 means that the property exists but has no elements.
*/
EAPI int
ecore_x_window_prop_card32_get(Ecore_X_Window win, Ecore_X_Atom atom,
unsigned int *val, unsigned int len)
ecore_x_window_prop_card32_get(Ecore_X_Window win,
Ecore_X_Atom atom,
unsigned int *val,
unsigned int len)
{
unsigned char *prop_ret;
Atom type_ret;
@ -65,24 +69,24 @@ ecore_x_window_prop_card32_get(Ecore_X_Window win, Ecore_X_Atom atom,
if (XGetWindowProperty(_ecore_x_disp, win, atom, 0, 0x7fffffff, False,
XA_CARDINAL, &type_ret, &format_ret, &num_ret,
&bytes_after, &prop_ret) != Success)
return -1;
return -1;
if (type_ret != XA_CARDINAL || format_ret != 32)
num = -1;
num = -1;
else if (num_ret == 0 || !prop_ret)
num = 0;
num = 0;
else
{
if (num_ret < len)
len = num_ret;
len = num_ret;
for (i = 0; i < len; i++)
val[i] = ((unsigned long *)prop_ret)[i];
val[i] = ((unsigned long *)prop_ret)[i];
num = len;
}
if (prop_ret)
XFree(prop_ret);
XFree(prop_ret);
return num;
} /* ecore_x_window_prop_card32_get */
@ -95,7 +99,8 @@ ecore_x_window_prop_card32_get(Ecore_X_Window win, Ecore_X_Atom atom,
* Note: Return value 0 means that the property exists but has no elements.
*/
EAPI int
ecore_x_window_prop_card32_list_get(Ecore_X_Window win, Ecore_X_Atom atom,
ecore_x_window_prop_card32_list_get(Ecore_X_Window win,
Ecore_X_Atom atom,
unsigned int **plst)
{
unsigned char *prop_ret;
@ -111,23 +116,23 @@ ecore_x_window_prop_card32_list_get(Ecore_X_Window win, Ecore_X_Atom atom,
if (XGetWindowProperty(_ecore_x_disp, win, atom, 0, 0x7fffffff, False,
XA_CARDINAL, &type_ret, &format_ret, &num_ret,
&bytes_after, &prop_ret) != Success)
return -1;
return -1;
if (type_ret != XA_CARDINAL || format_ret != 32)
num = -1;
num = -1;
else if (num_ret == 0 || !prop_ret)
num = 0;
num = 0;
else
{
val = malloc(num_ret * sizeof(unsigned int));
for (i = 0; i < num_ret; i++)
val[i] = ((unsigned long *)prop_ret)[i];
val[i] = ((unsigned long *)prop_ret)[i];
num = num_ret;
*plst = val;
}
if (prop_ret)
XFree(prop_ret);
XFree(prop_ret);
return num;
} /* ecore_x_window_prop_card32_list_get */
@ -136,9 +141,11 @@ ecore_x_window_prop_card32_list_get(Ecore_X_Window win, Ecore_X_Atom atom,
* Set X ID (array) property
*/
EAPI void
ecore_x_window_prop_xid_set(Ecore_X_Window win, Ecore_X_Atom atom,
Ecore_X_Atom type, Ecore_X_ID *lst,
unsigned int num)
ecore_x_window_prop_xid_set(Ecore_X_Window win,
Ecore_X_Atom atom,
Ecore_X_Atom type,
Ecore_X_ID *lst,
unsigned int num)
{
#if SIZEOF_INT == SIZEOF_LONG
XChangeProperty(_ecore_x_disp, win, atom, type, 32, PropModeReplace,
@ -150,10 +157,10 @@ ecore_x_window_prop_xid_set(Ecore_X_Window win, Ecore_X_Atom atom,
LOGFN(__FILE__, __LINE__, __FUNCTION__);
pl = malloc(num * sizeof(long));
if (!pl)
return;
return;
for (i = 0; i < num; i++)
pl[i] = lst[i];
pl[i] = lst[i];
XChangeProperty(_ecore_x_disp, win, atom, type, 32, PropModeReplace,
(unsigned char *)pl, num);
free(pl);
@ -169,9 +176,11 @@ ecore_x_window_prop_xid_set(Ecore_X_Window win, Ecore_X_Atom atom,
* Note: Return value 0 means that the property exists but has no elements.
*/
EAPI int
ecore_x_window_prop_xid_get(Ecore_X_Window win, Ecore_X_Atom atom,
Ecore_X_Atom type, Ecore_X_ID *lst,
unsigned int len)
ecore_x_window_prop_xid_get(Ecore_X_Window win,
Ecore_X_Atom atom,
Ecore_X_Atom type,
Ecore_X_ID *lst,
unsigned int len)
{
unsigned char *prop_ret;
Atom type_ret;
@ -185,24 +194,24 @@ ecore_x_window_prop_xid_get(Ecore_X_Window win, Ecore_X_Atom atom,
if (XGetWindowProperty(_ecore_x_disp, win, atom, 0, 0x7fffffff, False,
type, &type_ret, &format_ret, &num_ret,
&bytes_after, &prop_ret) != Success)
return -1;
return -1;
if (type_ret != type || format_ret != 32)
num = -1;
num = -1;
else if (num_ret == 0 || !prop_ret)
num = 0;
num = 0;
else
{
if (num_ret < len)
len = num_ret;
len = num_ret;
for (i = 0; i < len; i++)
lst[i] = ((unsigned long *)prop_ret)[i];
lst[i] = ((unsigned long *)prop_ret)[i];
num = len;
}
if (prop_ret)
XFree(prop_ret);
XFree(prop_ret);
return num;
} /* ecore_x_window_prop_xid_get */
@ -216,8 +225,10 @@ ecore_x_window_prop_xid_get(Ecore_X_Window win, Ecore_X_Atom atom,
* Note: Return value 0 means that the property exists but has no elements.
*/
EAPI int
ecore_x_window_prop_xid_list_get(Ecore_X_Window win, Ecore_X_Atom atom,
Ecore_X_Atom type, Ecore_X_ID **val)
ecore_x_window_prop_xid_list_get(Ecore_X_Window win,
Ecore_X_Atom atom,
Ecore_X_Atom type,
Ecore_X_ID **val)
{
unsigned char *prop_ret;
Atom type_ret;
@ -233,23 +244,23 @@ ecore_x_window_prop_xid_list_get(Ecore_X_Window win, Ecore_X_Atom atom,
if (XGetWindowProperty(_ecore_x_disp, win, atom, 0, 0x7fffffff, False,
type, &type_ret, &format_ret, &num_ret,
&bytes_after, &prop_ret) != Success)
return -1;
return -1;
if (type_ret != type || format_ret != 32)
num = -1;
num = -1;
else if (num_ret == 0 || !prop_ret)
num = 0;
num = 0;
else
{
alst = malloc(num_ret * sizeof(Ecore_X_ID));
for (i = 0; i < num_ret; i++)
alst[i] = ((unsigned long *)prop_ret)[i];
alst[i] = ((unsigned long *)prop_ret)[i];
num = num_ret;
*val = alst;
}
if (prop_ret)
XFree(prop_ret);
XFree(prop_ret);
return num;
} /* ecore_x_window_prop_xid_list_get */
@ -258,8 +269,11 @@ ecore_x_window_prop_xid_list_get(Ecore_X_Window win, Ecore_X_Atom atom,
* Remove/add/toggle X ID list item.
*/
EAPI void
ecore_x_window_prop_xid_list_change(Ecore_X_Window win, Ecore_X_Atom atom,
Ecore_X_Atom type, Ecore_X_ID item, int op)
ecore_x_window_prop_xid_list_change(Ecore_X_Window win,
Ecore_X_Atom atom,
Ecore_X_Atom type,
Ecore_X_ID item,
int op)
{
Ecore_X_ID *lst;
int i, num;
@ -275,43 +289,45 @@ ecore_x_window_prop_xid_list_change(Ecore_X_Window win, Ecore_X_Atom atom,
for (i = 0; i < num; i++)
{
if (lst[i] == item)
break;
break;
}
if (i < num)
{
/* Was in list */
if (op == ECORE_X_PROP_LIST_ADD)
if (op == ECORE_X_PROP_LIST_ADD)
goto done; /* Remove it */
num--;
for (; i < num; i++)
num--;
for (; i < num; i++)
lst[i] = lst[i + 1];
}
else
{
/* Was not in list */
if (op == ECORE_X_PROP_LIST_REMOVE)
if (op == ECORE_X_PROP_LIST_REMOVE)
goto done; /* Add it */
num++;
lst = realloc(lst, num * sizeof(Ecore_X_ID));
lst[i] = item;
num++;
lst = realloc(lst, num * sizeof(Ecore_X_ID));
lst[i] = item;
}
ecore_x_window_prop_xid_set(win, atom, type, lst, num);
done:
if (lst)
free(lst);
free(lst);
} /* ecore_x_window_prop_xid_list_change */
/*
* Set Atom (array) property
*/
EAPI void
ecore_x_window_prop_atom_set(Ecore_X_Window win, Ecore_X_Atom atom,
Ecore_X_Atom *lst, unsigned int num)
ecore_x_window_prop_atom_set(Ecore_X_Window win,
Ecore_X_Atom atom,
Ecore_X_Atom *lst,
unsigned int num)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
ecore_x_window_prop_xid_set(win, atom, XA_ATOM, lst, num);
@ -326,8 +342,10 @@ ecore_x_window_prop_atom_set(Ecore_X_Window win, Ecore_X_Atom atom,
* Note: Return value 0 means that the property exists but has no elements.
*/
EAPI int
ecore_x_window_prop_atom_get(Ecore_X_Window win, Ecore_X_Atom atom,
Ecore_X_Atom *lst, unsigned int len)
ecore_x_window_prop_atom_get(Ecore_X_Window win,
Ecore_X_Atom atom,
Ecore_X_Atom *lst,
unsigned int len)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
return ecore_x_window_prop_xid_get(win, atom, XA_ATOM, lst, len);
@ -342,7 +360,8 @@ ecore_x_window_prop_atom_get(Ecore_X_Window win, Ecore_X_Atom atom,
* Note: Return value 0 means that the property exists but has no elements.
*/
EAPI int
ecore_x_window_prop_atom_list_get(Ecore_X_Window win, Ecore_X_Atom atom,
ecore_x_window_prop_atom_list_get(Ecore_X_Window win,
Ecore_X_Atom atom,
Ecore_X_Atom **plst)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
@ -353,8 +372,10 @@ ecore_x_window_prop_atom_list_get(Ecore_X_Window win, Ecore_X_Atom atom,
* Remove/add/toggle atom list item.
*/
EAPI void
ecore_x_window_prop_atom_list_change(Ecore_X_Window win, Ecore_X_Atom atom,
Ecore_X_Atom item, int op)
ecore_x_window_prop_atom_list_change(Ecore_X_Window win,
Ecore_X_Atom atom,
Ecore_X_Atom item,
int op)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
ecore_x_window_prop_xid_list_change(win, atom, XA_ATOM, item, op);
@ -364,8 +385,10 @@ ecore_x_window_prop_atom_list_change(Ecore_X_Window win, Ecore_X_Atom atom,
* Set Window (array) property
*/
EAPI void
ecore_x_window_prop_window_set(Ecore_X_Window win, Ecore_X_Atom atom,
Ecore_X_Window *lst, unsigned int num)
ecore_x_window_prop_window_set(Ecore_X_Window win,
Ecore_X_Atom atom,
Ecore_X_Window *lst,
unsigned int num)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
ecore_x_window_prop_xid_set(win, atom, XA_WINDOW, lst, num);
@ -380,8 +403,10 @@ ecore_x_window_prop_window_set(Ecore_X_Window win, Ecore_X_Atom atom,
* Note: Return value 0 means that the property exists but has no elements.
*/
EAPI int
ecore_x_window_prop_window_get(Ecore_X_Window win, Ecore_X_Atom atom,
Ecore_X_Window *lst, unsigned int len)
ecore_x_window_prop_window_get(Ecore_X_Window win,
Ecore_X_Atom atom,
Ecore_X_Window *lst,
unsigned int len)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
return ecore_x_window_prop_xid_get(win, atom, XA_WINDOW, lst, len);
@ -396,7 +421,8 @@ ecore_x_window_prop_window_get(Ecore_X_Window win, Ecore_X_Atom atom,
* Note: Return value 0 means that the property exists but has no elements.
*/
EAPI int
ecore_x_window_prop_window_list_get(Ecore_X_Window win, Ecore_X_Atom atom,
ecore_x_window_prop_window_list_get(Ecore_X_Window win,
Ecore_X_Atom atom,
Ecore_X_Window **plst)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
@ -429,17 +455,17 @@ ecore_x_window_prop_property_set(Ecore_X_Window win,
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
if (win == 0)
win = DefaultRootWindow(_ecore_x_disp);
win = DefaultRootWindow(_ecore_x_disp);
if (size != 32)
XChangeProperty(_ecore_x_disp,
win,
property,
type,
size,
PropModeReplace,
(unsigned char *)data,
number);
XChangeProperty(_ecore_x_disp,
win,
property,
type,
size,
PropModeReplace,
(unsigned char *)data,
number);
else
{
unsigned long *dat;
@ -465,7 +491,7 @@ EAPI int
ecore_x_window_prop_property_get(Ecore_X_Window win,
Ecore_X_Atom property,
Ecore_X_Atom type,
int size __UNUSED__,
int size __UNUSED__,
unsigned char **data,
int *num)
{
@ -476,23 +502,23 @@ ecore_x_window_prop_property_get(Ecore_X_Window win,
/* make sure these are initialized */
if (num)
*num = 0;
*num = 0;
if (data)
*data = NULL;
*data = NULL;
else /* we can't store the retrieved data, so just return */
return 0;
return 0;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
if (!win)
win = DefaultRootWindow(_ecore_x_disp);
win = DefaultRootWindow(_ecore_x_disp);
ret = XGetWindowProperty(_ecore_x_disp, win, property, 0, LONG_MAX,
False, type, &type_ret, &size_ret,
&num_ret, &bytes, &prop_ret);
if (ret != Success)
return 0;
return 0;
if (!num_ret)
{
@ -508,38 +534,40 @@ ecore_x_window_prop_property_get(Ecore_X_Window win,
switch (size_ret) {
case 8:
for (i = 0; i < num_ret; i++)
(*data)[i] = prop_ret[i];
break;
for (i = 0; i < num_ret; i++)
(*data)[i] = prop_ret[i];
break;
case 16:
for (i = 0; i < num_ret; i++)
((unsigned short *)*data)[i] = ((unsigned short *)prop_ret)[i];
break;
for (i = 0; i < num_ret; i++)
((unsigned short *)*data)[i] = ((unsigned short *)prop_ret)[i];
break;
case 32:
for (i = 0; i < num_ret; i++)
((unsigned int *)*data)[i] = ((unsigned long *)prop_ret)[i];
break;
for (i = 0; i < num_ret; i++)
((unsigned int *)*data)[i] = ((unsigned long *)prop_ret)[i];
break;
} /* switch */
XFree(prop_ret);
if (num)
*num = num_ret;
*num = num_ret;
return size_ret;
} /* ecore_x_window_prop_property_get */
EAPI void
ecore_x_window_prop_property_del(Ecore_X_Window win, Ecore_X_Atom property)
ecore_x_window_prop_property_del(Ecore_X_Window win,
Ecore_X_Atom property)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
XDeleteProperty(_ecore_x_disp, win, property);
} /* ecore_x_window_prop_property_del */
EAPI Ecore_X_Atom *
ecore_x_window_prop_list(Ecore_X_Window win, int *num_ret)
ecore_x_window_prop_list(Ecore_X_Window win,
int *num_ret)
{
Ecore_X_Atom *atoms;
Atom *atom_ret;
@ -547,18 +575,18 @@ ecore_x_window_prop_list(Ecore_X_Window win, int *num_ret)
LOGFN(__FILE__, __LINE__, __FUNCTION__);
if (num_ret)
*num_ret = 0;
*num_ret = 0;
atom_ret = XListProperties(_ecore_x_disp, win, &num);
if (!atom_ret)
return NULL;
return NULL;
atoms = malloc(num * sizeof(Ecore_X_Atom));
if (atoms)
{
for (i = 0; i < num; i++) atoms[i] = atom_ret[i];
if (num_ret)
*num_ret = num;
*num_ret = num;
}
XFree(atom_ret);
@ -582,7 +610,7 @@ ecore_x_window_prop_string_set(Ecore_X_Window win,
LOGFN(__FILE__, __LINE__, __FUNCTION__);
if (win == 0)
win = DefaultRootWindow(_ecore_x_disp);
win = DefaultRootWindow(_ecore_x_disp);
xtp.value = (unsigned char *)str;
xtp.format = 8;
@ -599,14 +627,15 @@ ecore_x_window_prop_string_set(Ecore_X_Window win,
* Return window string property of a window. String must be free'd when done.
*/
EAPI char *
ecore_x_window_prop_string_get(Ecore_X_Window win, Ecore_X_Atom type)
ecore_x_window_prop_string_get(Ecore_X_Window win,
Ecore_X_Atom type)
{
XTextProperty xtp;
char *str = NULL;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
if (win == 0)
win = DefaultRootWindow(_ecore_x_disp);
win = DefaultRootWindow(_ecore_x_disp);
if (XGetTextProperty(_ecore_x_disp, win, &xtp, type))
{
@ -615,7 +644,7 @@ ecore_x_window_prop_string_get(Ecore_X_Window win, Ecore_X_Atom type)
Status s;
if (xtp.encoding == ECORE_X_ATOM_UTF8_STRING)
str = strdup((char *)xtp.value);
str = strdup((char *)xtp.value);
else
{
#ifdef X_HAVE_UTF8_STRING
@ -627,12 +656,12 @@ ecore_x_window_prop_string_get(Ecore_X_Window win, Ecore_X_Atom type)
#endif /* ifdef X_HAVE_UTF8_STRING */
if ((s == XLocaleNotSupported) ||
(s == XNoMemory) || (s == XConverterNotFound))
str = strdup((char *)xtp.value);
str = strdup((char *)xtp.value);
else if ((s >= Success) && (items > 0))
str = strdup(list[0]);
str = strdup(list[0]);
if (list)
XFreeStringList(list);
XFreeStringList(list);
}
XFree(xtp.value);
@ -651,20 +680,20 @@ ecore_x_window_prop_protocol_isset(Ecore_X_Window win,
/* check for invalid values */
if (protocol >= ECORE_X_WM_PROTOCOL_NUM)
return EINA_FALSE;
return EINA_FALSE;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
proto = _ecore_x_atoms_wm_protocols[protocol];
if (!XGetWMProtocols(_ecore_x_disp, win, &protos, &protos_count))
return ret;
return ret;
for (i = 0; i < protos_count; i++)
if (protos[i] == proto)
{
ret = EINA_TRUE;
break;
}
if (protos[i] == proto)
{
ret = EINA_TRUE;
break;
}
XFree(protos);
@ -677,7 +706,8 @@ ecore_x_window_prop_protocol_isset(Ecore_X_Window win,
* FIXME: To be fixed.
*/
EAPI Ecore_X_WM_Protocol *
ecore_x_window_prop_protocol_list_get(Ecore_X_Window win, int *num_ret)
ecore_x_window_prop_protocol_list_get(Ecore_X_Window win,
int *num_ret)
{
Atom *protos = NULL;
int i, protos_count = 0;
@ -685,10 +715,10 @@ ecore_x_window_prop_protocol_list_get(Ecore_X_Window win, int *num_ret)
LOGFN(__FILE__, __LINE__, __FUNCTION__);
if (!XGetWMProtocols(_ecore_x_disp, win, &protos, &protos_count))
return NULL;
return NULL;
if ((!protos) || (protos_count <= 0))
return NULL;
return NULL;
prot_ret = calloc(1, protos_count * sizeof(Ecore_X_WM_Protocol));
if (!prot_ret)
@ -705,7 +735,7 @@ ecore_x_window_prop_protocol_list_get(Ecore_X_Window win, int *num_ret)
for (j = 0; j < ECORE_X_WM_PROTOCOL_NUM; j++)
{
if (_ecore_x_atoms_wm_protocols[j] == protos[i])
prot_ret[i] = j;
prot_ret[i] = j;
}
}
XFree(protos);

View File

@ -23,7 +23,8 @@
* @ingroup Ecore_X_Window_Shape
*/
EAPI void
ecore_x_window_shape_mask_set(Ecore_X_Window win, Ecore_X_Pixmap mask)
ecore_x_window_shape_mask_set(Ecore_X_Window win,
Ecore_X_Pixmap mask)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
XShapeCombineMask(_ecore_x_disp, win, ShapeBounding, 0, 0, mask, ShapeSet);
@ -37,11 +38,12 @@ ecore_x_window_shape_mask_set(Ecore_X_Window win, Ecore_X_Pixmap mask)
* @ingroup Ecore_X_Window_Shape
*/
EAPI void
ecore_x_window_shape_input_mask_set(Ecore_X_Window win, Ecore_X_Pixmap mask)
ecore_x_window_shape_input_mask_set(Ecore_X_Window win,
Ecore_X_Pixmap mask)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
#ifdef ShapeInput
XShapeCombineMask(_ecore_x_disp, win, ShapeInput, 0, 0, mask, ShapeSet);
XShapeCombineMask(_ecore_x_disp, win, ShapeInput, 0, 0, mask, ShapeSet);
#else /* ifdef ShapeInput */
return;
win = mask = 0;
@ -49,7 +51,8 @@ ecore_x_window_shape_input_mask_set(Ecore_X_Window win, Ecore_X_Pixmap mask)
} /* ecore_x_window_shape_input_mask_set */
EAPI void
ecore_x_window_shape_window_set(Ecore_X_Window win, Ecore_X_Window shape_win)
ecore_x_window_shape_window_set(Ecore_X_Window win,
Ecore_X_Window shape_win)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
XShapeCombineShape(_ecore_x_disp,
@ -310,7 +313,8 @@ ecore_x_window_shape_input_rectangle_subtract(Ecore_X_Window win,
} /* ecore_x_window_shape_input_rectangle_subtract */
EAPI void
ecore_x_window_shape_window_add(Ecore_X_Window win, Ecore_X_Window shape_win)
ecore_x_window_shape_window_add(Ecore_X_Window win,
Ecore_X_Window shape_win)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
XShapeCombineShape(_ecore_x_disp,
@ -546,7 +550,8 @@ ecore_x_window_shape_input_rectangles_add(Ecore_X_Window win,
} /* ecore_x_window_shape_input_rectangles_add */
EAPI Ecore_X_Rectangle *
ecore_x_window_shape_rectangles_get(Ecore_X_Window win, int *num_ret)
ecore_x_window_shape_rectangles_get(Ecore_X_Window win,
int *num_ret)
{
XRectangle *rect;
Ecore_X_Rectangle *rects = NULL;
@ -583,7 +588,8 @@ ecore_x_window_shape_rectangles_get(Ecore_X_Window win, int *num_ret)
} /* ecore_x_window_shape_rectangles_get */
EAPI Ecore_X_Rectangle *
ecore_x_window_shape_input_rectangles_get(Ecore_X_Window win, int *num_ret)
ecore_x_window_shape_input_rectangles_get(Ecore_X_Window win,
int *num_ret)
{
Ecore_X_Rectangle *rects = NULL;
#ifdef ShapeInput
@ -622,7 +628,7 @@ ecore_x_window_shape_input_rectangles_get(Ecore_X_Window win, int *num_ret)
// have to return fake shape input rect of size of window
Window dw;
unsigned int di;
if (num_ret) *num_ret = 0;
rects = malloc(sizeof(Ecore_X_Rectangle));
if (!rects) return NULL;
@ -640,11 +646,13 @@ ecore_x_window_shape_input_rectangles_get(Ecore_X_Window win, int *num_ret)
} /* ecore_x_window_shape_input_rectangles_get */
EAPI void
ecore_x_window_shape_events_select(Ecore_X_Window win, Eina_Bool on)
ecore_x_window_shape_events_select(Ecore_X_Window win,
Eina_Bool on)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
if (on)
XShapeSelectInput(_ecore_x_disp, win, ShapeNotifyMask);
XShapeSelectInput(_ecore_x_disp, win, ShapeNotifyMask);
else
XShapeSelectInput(_ecore_x_disp, win, 0);
XShapeSelectInput(_ecore_x_disp, win, 0);
} /* ecore_x_window_shape_events_select */

View File

@ -76,7 +76,7 @@ _ecore_x_input_handler(XEvent *xevent)
for (i = 0; i < _ecore_x_xi2_num; i++)
{
XIDeviceInfo *dev = &(_ecore_x_xi2_devs[i]);
if (devid == dev->deviceid)
{
if (dev->use == XIMasterPointer) return;
@ -88,117 +88,120 @@ _ecore_x_input_handler(XEvent *xevent)
switch (xevent->xcookie.evtype)
{
case XI_Motion:
_ecore_mouse_move
(evd->time,
0, // state
evd->event_x, evd->event_y,
evd->root_x, evd->root_y,
evd->event,
(evd->child ? evd->child : evd->event),
evd->root,
1, // same_screen
devid, 1, 1,
1.0, // pressure
0.0, // angle
evd->event_x, evd->event_y,
evd->root_x, evd->root_y);
break;
_ecore_mouse_move
(evd->time,
0, // state
evd->event_x, evd->event_y,
evd->root_x, evd->root_y,
evd->event,
(evd->child ? evd->child : evd->event),
evd->root,
1, // same_screen
devid, 1, 1,
1.0, // pressure
0.0, // angle
evd->event_x, evd->event_y,
evd->root_x, evd->root_y);
break;
case XI_ButtonPress:
_ecore_mouse_button
(ECORE_EVENT_MOUSE_BUTTON_DOWN,
evd->time,
0, // state
0, // button
evd->event_x, evd->event_y,
evd->root_x, evd->root_y,
evd->event,
(evd->child ? evd->child : evd->event),
evd->root,
1, // same_screen
devid, 1, 1,
1.0, // pressure
0.0, // angle
evd->event_x, evd->event_y,
evd->root_x, evd->root_y);
break;
_ecore_mouse_button
(ECORE_EVENT_MOUSE_BUTTON_DOWN,
evd->time,
0, // state
0, // button
evd->event_x, evd->event_y,
evd->root_x, evd->root_y,
evd->event,
(evd->child ? evd->child : evd->event),
evd->root,
1, // same_screen
devid, 1, 1,
1.0, // pressure
0.0, // angle
evd->event_x, evd->event_y,
evd->root_x, evd->root_y);
break;
case XI_ButtonRelease:
_ecore_mouse_button
(ECORE_EVENT_MOUSE_BUTTON_UP,
evd->time,
0, // state
0, // button
evd->event_x, evd->event_y,
evd->root_x, evd->root_y,
evd->event,
(evd->child ? evd->child : evd->event),
evd->root,
1, // same_screen
devid, 1, 1,
1.0, // pressure
0.0, // angle
evd->event_x, evd->event_y,
evd->root_x, evd->root_y);
break;
#ifdef XI_TouchUpdate
case XI_TouchUpdate:
_ecore_mouse_move
(evd->time,
0, // state
evd->event_x, evd->event_y,
evd->root_x, evd->root_y,
evd->event,
(evd->child ? evd->child : evd->event),
evd->root,
1, // same_screen
devid, 1, 1,
1.0, // pressure
0.0, // angle
evd->event_x, evd->event_y,
evd->root_x, evd->root_y);
_ecore_mouse_button
(ECORE_EVENT_MOUSE_BUTTON_UP,
evd->time,
0, // state
0, // button
evd->event_x, evd->event_y,
evd->root_x, evd->root_y,
evd->event,
(evd->child ? evd->child : evd->event),
evd->root,
1, // same_screen
devid, 1, 1,
1.0, // pressure
0.0, // angle
evd->event_x, evd->event_y,
evd->root_x, evd->root_y);
break;
#ifdef XI_TouchUpdate
case XI_TouchUpdate:
_ecore_mouse_move
(evd->time,
0, // state
evd->event_x, evd->event_y,
evd->root_x, evd->root_y,
evd->event,
(evd->child ? evd->child : evd->event),
evd->root,
1, // same_screen
devid, 1, 1,
1.0, // pressure
0.0, // angle
evd->event_x, evd->event_y,
evd->root_x, evd->root_y);
break;
#endif
#ifdef XI_TouchBegin
case XI_TouchBegin:
_ecore_mouse_button
(ECORE_EVENT_MOUSE_BUTTON_DOWN,
evd->time,
0, // state
0, // button
evd->event_x, evd->event_y,
evd->root_x, evd->root_y,
evd->event,
(evd->child ? evd->child : evd->event),
evd->root,
1, // same_screen
devid, 1, 1,
1.0, // pressure
0.0, // angle
evd->event_x, evd->event_y,
evd->root_x, evd->root_y);
_ecore_mouse_button
(ECORE_EVENT_MOUSE_BUTTON_DOWN,
evd->time,
0, // state
0, // button
evd->event_x, evd->event_y,
evd->root_x, evd->root_y,
evd->event,
(evd->child ? evd->child : evd->event),
evd->root,
1, // same_screen
devid, 1, 1,
1.0, // pressure
0.0, // angle
evd->event_x, evd->event_y,
evd->root_x, evd->root_y);
break;
#endif
#ifdef XI_TouchEnd
case XI_TouchEnd:
_ecore_mouse_button
(ECORE_EVENT_MOUSE_BUTTON_UP,
evd->time,
0, // state
0, // button
evd->event_x, evd->event_y,
evd->root_x, evd->root_y,
evd->event,
(evd->child ? evd->child : evd->event),
evd->root,
1, // same_screen
devid, 1, 1,
1.0, // pressure
0.0, // angle
evd->event_x, evd->event_y,
evd->root_x, evd->root_y);
_ecore_mouse_button
(ECORE_EVENT_MOUSE_BUTTON_UP,
evd->time,
0, // state
0, // button
evd->event_x, evd->event_y,
evd->root_x, evd->root_y,
evd->event,
(evd->child ? evd->child : evd->event),
evd->root,
1, // same_screen
devid, 1, 1,
1.0, // pressure
0.0, // angle
evd->event_x, evd->event_y,
evd->root_x, evd->root_y);
break;
#endif
default:
break;
@ -214,7 +217,7 @@ ecore_x_input_multi_select(Ecore_X_Window win)
Eina_Bool find = EINA_FALSE;
if (!_ecore_x_xi2_devs)
return 0;
return 0;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
for (i = 0; i < _ecore_x_xi2_num; i++)
@ -239,18 +242,18 @@ ecore_x_input_multi_select(Ecore_X_Window win)
{
XIDeviceInfo *atdev = NULL;
int j;
for (j = 0; j < _ecore_x_xi2_num; j++)
{
if (_ecore_x_xi2_devs[j].deviceid == dev->attachment)
atdev = &(_ecore_x_xi2_devs[j]);
atdev = &(_ecore_x_xi2_devs[j]);
}
if (((atdev) && (atdev->use != XIMasterPointer)) ||
(!atdev))
{
XIEventMask eventmask;
unsigned char mask[4] = { 0 };
eventmask.deviceid = dev->deviceid;
eventmask.mask_len = sizeof(mask);
eventmask.mask = mask;
@ -259,13 +262,13 @@ ecore_x_input_multi_select(Ecore_X_Window win)
XISetMask(mask, XI_Motion);
# ifdef XI_TouchUpdate
XISetMask(mask, XI_TouchUpdate);
# endif
# endif
# ifdef XI_TouchBegin
XISetMask(mask, XI_TouchBegin);
# endif
# endif
# ifdef XI_TouchEnd
XISetMask(mask, XI_TouchEnd);
# endif
# endif
XISelectEvents(_ecore_x_disp, win, &eventmask, 1);
find = EINA_TRUE;
}

View File

@ -24,14 +24,14 @@ ecore_x_xinerama_screen_count_get(void)
LOGFN(__FILE__, __LINE__, __FUNCTION__);
if (_xin_info)
XFree(_xin_info);
XFree(_xin_info);
_xin_info = NULL;
if (XineramaQueryExtension(_ecore_x_disp, &event_base, &error_base))
{
_xin_info = XineramaQueryScreens(_ecore_x_disp, &_xin_scr_num);
if (_xin_info)
return _xin_scr_num;
return _xin_scr_num;
}
#endif /* ifdef ECORE_XINERAMA */
@ -39,7 +39,11 @@ ecore_x_xinerama_screen_count_get(void)
} /* ecore_x_xinerama_screen_count_get */
EAPI Eina_Bool
ecore_x_xinerama_screen_geometry_get(int screen, int *x, int *y, int *w, int *h)
ecore_x_xinerama_screen_geometry_get(int screen,
int *x,
int *y,
int *w,
int *h)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
#ifdef ECORE_XINERAMA
@ -52,16 +56,16 @@ ecore_x_xinerama_screen_geometry_get(int screen, int *x, int *y, int *w, int *h)
if (_xin_info[i].screen_number == screen)
{
if (x)
*x = _xin_info[i].x_org;
*x = _xin_info[i].x_org;
if (y)
*y = _xin_info[i].y_org;
*y = _xin_info[i].y_org;
if (w)
*w = _xin_info[i].width;
*w = _xin_info[i].width;
if (h)
*h = _xin_info[i].height;
*h = _xin_info[i].height;
return EINA_TRUE;
}
@ -70,16 +74,16 @@ ecore_x_xinerama_screen_geometry_get(int screen, int *x, int *y, int *w, int *h)
#endif /* ifdef ECORE_XINERAMA */
if (x)
*x = 0;
*x = 0;
if (y)
*y = 0;
*y = 0;
if (w)
*w = DisplayWidth(_ecore_x_disp, 0);
*w = DisplayWidth(_ecore_x_disp, 0);
if (h)
*h = DisplayHeight(_ecore_x_disp, 0);
*h = DisplayHeight(_ecore_x_disp, 0);
return EINA_FALSE;
screen = 0;