forked from enlightenment/efl
ecore-xcb: Fix XCB to be usable again
Summary: Well mostly, it seems there is an issue with multi-key events and enlightenment. Let's merge this first before opening a ticket. Reviewers: devilhorns Subscribers: cedric, jpeg Differential Revision: https://phab.enlightenment.org/D4017 @fix
This commit is contained in:
parent
0554d2ef12
commit
109d040e3d
|
@ -33,17 +33,8 @@ double _ecore_xcb_double_click_time = 0.25;
|
||||||
* Functions that start and shut down the Ecore X Library.
|
* Functions that start and shut down the Ecore X Library.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
static int
|
||||||
* Initialize the X display connection to the given display.
|
_ecore_x_init(const char *name, Ecore_X_Display *display)
|
||||||
*
|
|
||||||
* @param name Display target name. If @c NULL, the default display is
|
|
||||||
* assumed.
|
|
||||||
* @return The number of times the library has been initialized without
|
|
||||||
* being shut down. 0 is returned if an error occurs.
|
|
||||||
* @ingroup Ecore_X_Init_Group
|
|
||||||
*/
|
|
||||||
EAPI int
|
|
||||||
ecore_x_init(const char *name)
|
|
||||||
{
|
{
|
||||||
char *gl = NULL;
|
char *gl = NULL;
|
||||||
uint32_t mask, list[1];
|
uint32_t mask, list[1];
|
||||||
|
@ -168,7 +159,7 @@ ecore_x_init(const char *name)
|
||||||
#ifdef EVAS_FRAME_QUEUING
|
#ifdef EVAS_FRAME_QUEUING
|
||||||
if (_real_threads) _real_threads();
|
if (_real_threads) _real_threads();
|
||||||
#endif
|
#endif
|
||||||
_ecore_xcb_display = _real_display(name);
|
_ecore_xcb_display = display ? display : _real_display(name);
|
||||||
if (!_ecore_xcb_display)
|
if (!_ecore_xcb_display)
|
||||||
{
|
{
|
||||||
ERR("Could not open Display via XLib");
|
ERR("Could not open Display via XLib");
|
||||||
|
@ -288,6 +279,28 @@ ecore_x_init(const char *name)
|
||||||
return _ecore_xcb_init_count;
|
return _ecore_xcb_init_count;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initialize the X display connection to the given display.
|
||||||
|
*
|
||||||
|
* @param name Display target name. If @c NULL, the default display is
|
||||||
|
* assumed.
|
||||||
|
* @return The number of times the library has been initialized without
|
||||||
|
* being shut down. 0 is returned if an error occurs.
|
||||||
|
* @ingroup Ecore_X_Init_Group
|
||||||
|
*/
|
||||||
|
EAPI int
|
||||||
|
ecore_x_init(const char *name)
|
||||||
|
{
|
||||||
|
return _ecore_x_init(name, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
EAPI int
|
||||||
|
ecore_x_init_from_display(Ecore_X_Display *display)
|
||||||
|
{
|
||||||
|
EINA_SAFETY_ON_NULL_RETURN_VAL(display, 0);
|
||||||
|
return _ecore_x_init(NULL, display);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Shuts down the Ecore X library.
|
* Shuts down the Ecore X library.
|
||||||
*
|
*
|
||||||
|
|
|
@ -302,13 +302,13 @@ ecore_x_icccm_name_class_set(Ecore_X_Window win,
|
||||||
const char *class)
|
const char *class)
|
||||||
{
|
{
|
||||||
char *class_string, *s;
|
char *class_string, *s;
|
||||||
int length_name, length_class;
|
int length_name, length_class = 0;
|
||||||
|
|
||||||
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
||||||
CHECK_XCB_CONN;
|
CHECK_XCB_CONN;
|
||||||
|
|
||||||
length_name = strlen(name);
|
if (name) length_name = strlen(name);
|
||||||
length_class = strlen(class);
|
if (class) length_class = strlen(class);
|
||||||
class_string =
|
class_string =
|
||||||
(char *)malloc(sizeof(char) * (length_name + length_class + 2));
|
(char *)malloc(sizeof(char) * (length_name + length_class + 2));
|
||||||
if (!class_string) return;
|
if (!class_string) return;
|
||||||
|
|
|
@ -75,7 +75,7 @@ extern int _ecore_xcb_log_dom;
|
||||||
|
|
||||||
#define CHECK_XCB_CONN \
|
#define CHECK_XCB_CONN \
|
||||||
{ \
|
{ \
|
||||||
if (xcb_connection_has_error(_ecore_xcb_conn)) \
|
if (!_ecore_xcb_conn || xcb_connection_has_error(_ecore_xcb_conn)) \
|
||||||
{ \
|
{ \
|
||||||
DBG("XCB Connection Has Error !!"); \
|
DBG("XCB Connection Has Error !!"); \
|
||||||
_ecore_xcb_io_error_handle(NULL); \
|
_ecore_xcb_io_error_handle(NULL); \
|
||||||
|
|
|
@ -55,6 +55,11 @@
|
||||||
_ECORE_X_RANDR_EDID_FOR_EACH_DESCRIPTOR_BLOCK(edid, block) \
|
_ECORE_X_RANDR_EDID_FOR_EACH_DESCRIPTOR_BLOCK(edid, block) \
|
||||||
if ((block[0] == 0) && (block[1] == 0))
|
if ((block[0] == 0) && (block[1] == 0))
|
||||||
|
|
||||||
|
#ifdef ECORE_XCB_RANDR
|
||||||
|
# define RANDR_VALIDATE_ROOT(screen, root) \
|
||||||
|
((screen = _ecore_xcb_randr_root_to_screen(root)) != -1)
|
||||||
|
#endif
|
||||||
|
|
||||||
/* local function prototypes */
|
/* local function prototypes */
|
||||||
static Eina_Bool _ecore_xcb_randr_output_validate(Ecore_X_Window root,
|
static Eina_Bool _ecore_xcb_randr_output_validate(Ecore_X_Window root,
|
||||||
Ecore_X_Randr_Output output);
|
Ecore_X_Randr_Output output);
|
||||||
|
@ -189,8 +194,6 @@ _ecore_xcb_randr_root_validate(Ecore_X_Window root EINA_UNUSED)
|
||||||
{
|
{
|
||||||
#ifdef ECORE_XCB_RANDR
|
#ifdef ECORE_XCB_RANDR
|
||||||
Ecore_X_Randr_Screen scr = -1;
|
Ecore_X_Randr_Screen scr = -1;
|
||||||
# define RANDR_VALIDATE_ROOT(screen, root) \
|
|
||||||
((screen == _ecore_xcb_randr_root_to_screen(root)) != -1)
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
||||||
|
@ -2601,8 +2604,6 @@ ecore_x_randr_screen_current_size_get(Ecore_X_Window root,
|
||||||
#ifdef ECORE_XCB_RANDR
|
#ifdef ECORE_XCB_RANDR
|
||||||
Ecore_X_Randr_Screen scr = 0;
|
Ecore_X_Randr_Screen scr = 0;
|
||||||
xcb_screen_t *s;
|
xcb_screen_t *s;
|
||||||
# define RANDR_VALIDATE_ROOT(screen, root) \
|
|
||||||
((screen == _ecore_xcb_randr_root_to_screen(root)) != -1)
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
||||||
|
@ -2647,8 +2648,6 @@ ecore_x_randr_screen_current_size_set(Ecore_X_Window root,
|
||||||
Ecore_X_Randr_Screen scr;
|
Ecore_X_Randr_Screen scr;
|
||||||
int wc = 0, hc = 0, w_mm_c = 0, h_mm_c = 0;
|
int wc = 0, hc = 0, w_mm_c = 0, h_mm_c = 0;
|
||||||
int mw = 0, mh = 0, xw = 0, xh = 0;
|
int mw = 0, mh = 0, xw = 0, xh = 0;
|
||||||
# define RANDR_VALIDATE_ROOT(screen, root) \
|
|
||||||
((screen == _ecore_xcb_randr_root_to_screen(root)) != -1)
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
||||||
|
@ -4040,14 +4039,16 @@ _ecore_xcb_randr_12_output_name_get(Ecore_X_Window root,
|
||||||
uint8_t *nbuf;
|
uint8_t *nbuf;
|
||||||
|
|
||||||
nbuf = xcb_randr_get_output_info_name(oreply);
|
nbuf = xcb_randr_get_output_info_name(oreply);
|
||||||
nbuf += oreply->name_len;
|
|
||||||
|
|
||||||
if (len) *len = oreply->name_len;
|
if (len) *len = oreply->name_len;
|
||||||
if (oreply->name_len > 0)
|
if (oreply->name_len > 0)
|
||||||
{
|
{
|
||||||
ret = malloc(oreply->name_len + 1);
|
ret = malloc(oreply->name_len + 1);
|
||||||
if (ret)
|
if (ret)
|
||||||
memcpy(ret, nbuf, oreply->name_len + 1);
|
{
|
||||||
|
memcpy(ret, nbuf, oreply->name_len + 1);
|
||||||
|
ret[oreply->name_len] = '\0';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
free(oreply);
|
free(oreply);
|
||||||
|
@ -4083,14 +4084,16 @@ _ecore_xcb_randr_13_output_name_get(Ecore_X_Window root,
|
||||||
uint8_t *nbuf;
|
uint8_t *nbuf;
|
||||||
|
|
||||||
nbuf = xcb_randr_get_output_info_name(oreply);
|
nbuf = xcb_randr_get_output_info_name(oreply);
|
||||||
nbuf += oreply->name_len;
|
|
||||||
|
|
||||||
if (len) *len = oreply->name_len;
|
if (len) *len = oreply->name_len;
|
||||||
if (oreply->name_len > 0)
|
if (oreply->name_len > 0)
|
||||||
{
|
{
|
||||||
ret = malloc(oreply->name_len + 1);
|
ret = malloc(oreply->name_len + 1);
|
||||||
if (ret)
|
if (ret)
|
||||||
memcpy(ret, nbuf, oreply->name_len + 1);
|
{
|
||||||
|
memcpy(ret, nbuf, oreply->name_len + 1);
|
||||||
|
ret[oreply->name_len] = '\0';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
free(oreply);
|
free(oreply);
|
||||||
|
|
Loading…
Reference in New Issue