summaryrefslogtreecommitdiff
path: root/src/lib/ecore_x
diff options
context:
space:
mode:
authorBenjamin Jacobs <benj@spam.thsi.be>2016-06-06 15:46:00 -0400
committerChris Michael <cpmichael@osg.samsung.com>2016-06-06 15:46:24 -0400
commit109d040e3d4a2ffa7c13d56f0f759974f6c6a231 (patch)
tree4ab0ef2beb7dd3173c6e03a865edde0c1d4315d7 /src/lib/ecore_x
parent0554d2ef124000c19fd3d87fab85d9f74ebd872e (diff)
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
Diffstat (limited to 'src/lib/ecore_x')
-rw-r--r--src/lib/ecore_x/xcb/ecore_xcb.c37
-rw-r--r--src/lib/ecore_x/xcb/ecore_xcb_icccm.c6
-rw-r--r--src/lib/ecore_x/xcb/ecore_xcb_private.h2
-rw-r--r--src/lib/ecore_x/xcb/ecore_xcb_randr.c23
4 files changed, 42 insertions, 26 deletions
diff --git a/src/lib/ecore_x/xcb/ecore_xcb.c b/src/lib/ecore_x/xcb/ecore_xcb.c
index 11306c4ece..15107fb10d 100644
--- a/src/lib/ecore_x/xcb/ecore_xcb.c
+++ b/src/lib/ecore_x/xcb/ecore_xcb.c
@@ -33,17 +33,8 @@ double _ecore_xcb_double_click_time = 0.25;
33 * Functions that start and shut down the Ecore X Library. 33 * Functions that start and shut down the Ecore X Library.
34 */ 34 */
35 35
36/** 36static int
37 * Initialize the X display connection to the given display. 37_ecore_x_init(const char *name, Ecore_X_Display *display)
38 *
39 * @param name Display target name. If @c NULL, the default display is
40 * assumed.
41 * @return The number of times the library has been initialized without
42 * being shut down. 0 is returned if an error occurs.
43 * @ingroup Ecore_X_Init_Group
44 */
45EAPI int
46ecore_x_init(const char *name)
47{ 38{
48 char *gl = NULL; 39 char *gl = NULL;
49 uint32_t mask, list[1]; 40 uint32_t mask, list[1];
@@ -168,7 +159,7 @@ ecore_x_init(const char *name)
168#ifdef EVAS_FRAME_QUEUING 159#ifdef EVAS_FRAME_QUEUING
169 if (_real_threads) _real_threads(); 160 if (_real_threads) _real_threads();
170#endif 161#endif
171 _ecore_xcb_display = _real_display(name); 162 _ecore_xcb_display = display ? display : _real_display(name);
172 if (!_ecore_xcb_display) 163 if (!_ecore_xcb_display)
173 { 164 {
174 ERR("Could not open Display via XLib"); 165 ERR("Could not open Display via XLib");
@@ -289,6 +280,28 @@ ecore_x_init(const char *name)
289} 280}
290 281
291/** 282/**
283 * Initialize the X display connection to the given display.
284 *
285 * @param name Display target name. If @c NULL, the default display is
286 * assumed.
287 * @return The number of times the library has been initialized without
288 * being shut down. 0 is returned if an error occurs.
289 * @ingroup Ecore_X_Init_Group
290 */
291EAPI int
292ecore_x_init(const char *name)
293{
294 return _ecore_x_init(name, NULL);
295}
296
297EAPI int
298ecore_x_init_from_display(Ecore_X_Display *display)
299{
300 EINA_SAFETY_ON_NULL_RETURN_VAL(display, 0);
301 return _ecore_x_init(NULL, display);
302}
303
304/**
292 * Shuts down the Ecore X library. 305 * Shuts down the Ecore X library.
293 * 306 *
294 * In shutting down the library, the X display connection is terminated 307 * In shutting down the library, the X display connection is terminated
diff --git a/src/lib/ecore_x/xcb/ecore_xcb_icccm.c b/src/lib/ecore_x/xcb/ecore_xcb_icccm.c
index 5a36b4e5aa..76d721500f 100644
--- a/src/lib/ecore_x/xcb/ecore_xcb_icccm.c
+++ b/src/lib/ecore_x/xcb/ecore_xcb_icccm.c
@@ -302,13 +302,13 @@ ecore_x_icccm_name_class_set(Ecore_X_Window win,
302 const char *class) 302 const char *class)
303{ 303{
304 char *class_string, *s; 304 char *class_string, *s;
305 int length_name, length_class; 305 int length_name, length_class = 0;
306 306
307 LOGFN(__FILE__, __LINE__, __FUNCTION__); 307 LOGFN(__FILE__, __LINE__, __FUNCTION__);
308 CHECK_XCB_CONN; 308 CHECK_XCB_CONN;
309 309
310 length_name = strlen(name); 310 if (name) length_name = strlen(name);
311 length_class = strlen(class); 311 if (class) length_class = strlen(class);
312 class_string = 312 class_string =
313 (char *)malloc(sizeof(char) * (length_name + length_class + 2)); 313 (char *)malloc(sizeof(char) * (length_name + length_class + 2));
314 if (!class_string) return; 314 if (!class_string) return;
diff --git a/src/lib/ecore_x/xcb/ecore_xcb_private.h b/src/lib/ecore_x/xcb/ecore_xcb_private.h
index d6bb743934..f56ecac943 100644
--- a/src/lib/ecore_x/xcb/ecore_xcb_private.h
+++ b/src/lib/ecore_x/xcb/ecore_xcb_private.h
@@ -75,7 +75,7 @@ extern int _ecore_xcb_log_dom;
75 75
76#define CHECK_XCB_CONN \ 76#define CHECK_XCB_CONN \
77 { \ 77 { \
78 if (xcb_connection_has_error(_ecore_xcb_conn)) \ 78 if (!_ecore_xcb_conn || xcb_connection_has_error(_ecore_xcb_conn)) \
79 { \ 79 { \
80 DBG("XCB Connection Has Error !!"); \ 80 DBG("XCB Connection Has Error !!"); \
81 _ecore_xcb_io_error_handle(NULL); \ 81 _ecore_xcb_io_error_handle(NULL); \
diff --git a/src/lib/ecore_x/xcb/ecore_xcb_randr.c b/src/lib/ecore_x/xcb/ecore_xcb_randr.c
index 2b44fc3b31..74ae2f8aec 100644
--- a/src/lib/ecore_x/xcb/ecore_xcb_randr.c
+++ b/src/lib/ecore_x/xcb/ecore_xcb_randr.c
@@ -55,6 +55,11 @@
55 _ECORE_X_RANDR_EDID_FOR_EACH_DESCRIPTOR_BLOCK(edid, block) \ 55 _ECORE_X_RANDR_EDID_FOR_EACH_DESCRIPTOR_BLOCK(edid, block) \
56 if ((block[0] == 0) && (block[1] == 0)) 56 if ((block[0] == 0) && (block[1] == 0))
57 57
58#ifdef ECORE_XCB_RANDR
59# define RANDR_VALIDATE_ROOT(screen, root) \
60 ((screen = _ecore_xcb_randr_root_to_screen(root)) != -1)
61#endif
62
58/* local function prototypes */ 63/* local function prototypes */
59static Eina_Bool _ecore_xcb_randr_output_validate(Ecore_X_Window root, 64static Eina_Bool _ecore_xcb_randr_output_validate(Ecore_X_Window root,
60 Ecore_X_Randr_Output output); 65 Ecore_X_Randr_Output output);
@@ -189,8 +194,6 @@ _ecore_xcb_randr_root_validate(Ecore_X_Window root EINA_UNUSED)
189{ 194{
190#ifdef ECORE_XCB_RANDR 195#ifdef ECORE_XCB_RANDR
191 Ecore_X_Randr_Screen scr = -1; 196 Ecore_X_Randr_Screen scr = -1;
192# define RANDR_VALIDATE_ROOT(screen, root) \
193 ((screen == _ecore_xcb_randr_root_to_screen(root)) != -1)
194#endif 197#endif
195 198
196 LOGFN(__FILE__, __LINE__, __FUNCTION__); 199 LOGFN(__FILE__, __LINE__, __FUNCTION__);
@@ -2601,8 +2604,6 @@ ecore_x_randr_screen_current_size_get(Ecore_X_Window root,
2601#ifdef ECORE_XCB_RANDR 2604#ifdef ECORE_XCB_RANDR
2602 Ecore_X_Randr_Screen scr = 0; 2605 Ecore_X_Randr_Screen scr = 0;
2603 xcb_screen_t *s; 2606 xcb_screen_t *s;
2604# define RANDR_VALIDATE_ROOT(screen, root) \
2605 ((screen == _ecore_xcb_randr_root_to_screen(root)) != -1)
2606#endif 2607#endif
2607 2608
2608 LOGFN(__FILE__, __LINE__, __FUNCTION__); 2609 LOGFN(__FILE__, __LINE__, __FUNCTION__);
@@ -2647,8 +2648,6 @@ ecore_x_randr_screen_current_size_set(Ecore_X_Window root,
2647 Ecore_X_Randr_Screen scr; 2648 Ecore_X_Randr_Screen scr;
2648 int wc = 0, hc = 0, w_mm_c = 0, h_mm_c = 0; 2649 int wc = 0, hc = 0, w_mm_c = 0, h_mm_c = 0;
2649 int mw = 0, mh = 0, xw = 0, xh = 0; 2650 int mw = 0, mh = 0, xw = 0, xh = 0;
2650# define RANDR_VALIDATE_ROOT(screen, root) \
2651 ((screen == _ecore_xcb_randr_root_to_screen(root)) != -1)
2652#endif 2651#endif
2653 2652
2654 LOGFN(__FILE__, __LINE__, __FUNCTION__); 2653 LOGFN(__FILE__, __LINE__, __FUNCTION__);
@@ -4040,14 +4039,16 @@ _ecore_xcb_randr_12_output_name_get(Ecore_X_Window root,
4040 uint8_t *nbuf; 4039 uint8_t *nbuf;
4041 4040
4042 nbuf = xcb_randr_get_output_info_name(oreply); 4041 nbuf = xcb_randr_get_output_info_name(oreply);
4043 nbuf += oreply->name_len;
4044 4042
4045 if (len) *len = oreply->name_len; 4043 if (len) *len = oreply->name_len;
4046 if (oreply->name_len > 0) 4044 if (oreply->name_len > 0)
4047 { 4045 {
4048 ret = malloc(oreply->name_len + 1); 4046 ret = malloc(oreply->name_len + 1);
4049 if (ret) 4047 if (ret)
4050 memcpy(ret, nbuf, oreply->name_len + 1); 4048 {
4049 memcpy(ret, nbuf, oreply->name_len + 1);
4050 ret[oreply->name_len] = '\0';
4051 }
4051 } 4052 }
4052 4053
4053 free(oreply); 4054 free(oreply);
@@ -4083,14 +4084,16 @@ _ecore_xcb_randr_13_output_name_get(Ecore_X_Window root,
4083 uint8_t *nbuf; 4084 uint8_t *nbuf;
4084 4085
4085 nbuf = xcb_randr_get_output_info_name(oreply); 4086 nbuf = xcb_randr_get_output_info_name(oreply);
4086 nbuf += oreply->name_len;
4087 4087
4088 if (len) *len = oreply->name_len; 4088 if (len) *len = oreply->name_len;
4089 if (oreply->name_len > 0) 4089 if (oreply->name_len > 0)
4090 { 4090 {
4091 ret = malloc(oreply->name_len + 1); 4091 ret = malloc(oreply->name_len + 1);
4092 if (ret) 4092 if (ret)
4093 memcpy(ret, nbuf, oreply->name_len + 1); 4093 {
4094 memcpy(ret, nbuf, oreply->name_len + 1);
4095 ret[oreply->name_len] = '\0';
4096 }
4094 } 4097 }
4095 4098
4096 free(oreply); 4099 free(oreply);