diff options
author | David Walter Seikel | 2013-01-13 17:29:19 +1000 |
---|---|---|
committer | David Walter Seikel | 2013-01-13 17:29:19 +1000 |
commit | 07274513e984f0b5544586c74508ccd16e7dcafa (patch) | |
tree | b32ff2a9136fbc1a4a6a0ed1e4d79cde0f5f16d9 /libraries/ecore/src/lib/ecore_evas/ecore_evas_x.c | |
parent | Added Irrlicht 1.8, but without all the Windows binaries. (diff) | |
download | SledjHamr-07274513e984f0b5544586c74508ccd16e7dcafa.zip SledjHamr-07274513e984f0b5544586c74508ccd16e7dcafa.tar.gz SledjHamr-07274513e984f0b5544586c74508ccd16e7dcafa.tar.bz2 SledjHamr-07274513e984f0b5544586c74508ccd16e7dcafa.tar.xz |
Remove EFL, since it's been released now.
Diffstat (limited to '')
-rw-r--r-- | libraries/ecore/src/lib/ecore_evas/ecore_evas_x.c | 4445 |
1 files changed, 0 insertions, 4445 deletions
diff --git a/libraries/ecore/src/lib/ecore_evas/ecore_evas_x.c b/libraries/ecore/src/lib/ecore_evas/ecore_evas_x.c deleted file mode 100644 index 6dd13de..0000000 --- a/libraries/ecore/src/lib/ecore_evas/ecore_evas_x.c +++ /dev/null | |||
@@ -1,4445 +0,0 @@ | |||
1 | #ifdef HAVE_CONFIG_H | ||
2 | # include <config.h> | ||
3 | #endif | ||
4 | |||
5 | #include <stdlib.h> | ||
6 | #include <string.h> | ||
7 | |||
8 | #include <Eina.h> | ||
9 | #include <Ecore.h> | ||
10 | |||
11 | #include "ecore_evas_private.h" | ||
12 | #include "Ecore_Evas.h" | ||
13 | |||
14 | #ifdef BUILD_ECORE_EVAS_X11 | ||
15 | static int _ecore_evas_init_count = 0; | ||
16 | |||
17 | static Ecore_Event_Handler *ecore_evas_event_handlers[13]; | ||
18 | |||
19 | static int leader_ref = 0; | ||
20 | static Ecore_X_Window leader_win = 0; | ||
21 | |||
22 | static void | ||
23 | _ecore_evas_x_hints_update(Ecore_Evas *ee) | ||
24 | { | ||
25 | ecore_x_icccm_hints_set | ||
26 | (ee->prop.window, | ||
27 | !ee->prop.focus_skip /* accepts_focus */, | ||
28 | ee->prop.iconified ? ECORE_X_WINDOW_STATE_HINT_ICONIC : | ||
29 | ee->prop.withdrawn ? ECORE_X_WINDOW_STATE_HINT_WITHDRAWN : | ||
30 | ECORE_X_WINDOW_STATE_HINT_NORMAL /* initial_state */, | ||
31 | 0 /* icon_pixmap */, | ||
32 | 0 /* icon_mask */, | ||
33 | 0 /* icon_window */, | ||
34 | ee->prop.group_ee_win /* window_group */, | ||
35 | ee->prop.urgent /* is_urgent */); | ||
36 | } | ||
37 | |||
38 | static void | ||
39 | _ecore_evas_x_group_leader_set(Ecore_Evas *ee) | ||
40 | { | ||
41 | leader_ref++; | ||
42 | if (leader_ref == 1) | ||
43 | { | ||
44 | char *id = NULL; | ||
45 | |||
46 | leader_win = | ||
47 | ecore_x_window_override_new(ee->engine.x.win_root, 1234, 5678, 1, 2); | ||
48 | ecore_x_window_defaults_set(leader_win); | ||
49 | if ((id = getenv("DESKTOP_STARTUP_ID"))) | ||
50 | ecore_x_netwm_startup_id_set(leader_win,id); | ||
51 | ecore_x_icccm_client_leader_set(leader_win, leader_win); | ||
52 | } | ||
53 | ee->engine.x.leader = leader_win; | ||
54 | ecore_x_icccm_client_leader_set(ee->prop.window, leader_win); | ||
55 | } | ||
56 | |||
57 | static void | ||
58 | _ecore_evas_x_group_leader_unset(Ecore_Evas *ee) | ||
59 | { | ||
60 | ecore_x_window_prop_property_del(ee->prop.window, | ||
61 | ECORE_X_ATOM_WM_CLIENT_LEADER); | ||
62 | if (ee->engine.x.leader == leader_win) | ||
63 | { | ||
64 | leader_ref--; | ||
65 | if (leader_ref <= 0) | ||
66 | { | ||
67 | ecore_x_window_free(leader_win); | ||
68 | leader_win = 0; | ||
69 | } | ||
70 | ee->engine.x.leader = 0; | ||
71 | } | ||
72 | } | ||
73 | |||
74 | static void | ||
75 | _ecore_evas_x_group_leader_update(Ecore_Evas *ee) | ||
76 | { | ||
77 | if (ee->engine.x.leader) | ||
78 | ecore_x_icccm_client_leader_set(ee->prop.window, ee->engine.x.leader); | ||
79 | } | ||
80 | |||
81 | static void | ||
82 | _ecore_evas_x_protocols_set(Ecore_Evas *ee) | ||
83 | { | ||
84 | Ecore_X_Atom protos[3]; | ||
85 | unsigned int num = 0, tmp = 0; | ||
86 | |||
87 | if (ee->func.fn_delete_request) | ||
88 | protos[num++] = ECORE_X_ATOM_WM_DELETE_WINDOW; | ||
89 | protos[num++] = ECORE_X_ATOM_NET_WM_PING; | ||
90 | protos[num++] = ECORE_X_ATOM_NET_WM_SYNC_REQUEST; | ||
91 | ecore_x_icccm_protocol_atoms_set(ee->prop.window, protos, num); | ||
92 | |||
93 | if (!ee->engine.x.netwm_sync_counter) | ||
94 | ee->engine.x.netwm_sync_counter = ecore_x_sync_counter_new(0); | ||
95 | |||
96 | tmp = ee->engine.x.netwm_sync_counter; | ||
97 | ecore_x_window_prop_card32_set(ee->prop.window, | ||
98 | ECORE_X_ATOM_NET_WM_SYNC_REQUEST_COUNTER, | ||
99 | &tmp, 1); | ||
100 | } | ||
101 | |||
102 | static void | ||
103 | _ecore_evas_x_sync_set(Ecore_Evas *ee) | ||
104 | { | ||
105 | if (((ee->should_be_visible) || (ee->visible)) && | ||
106 | ((ecore_x_e_comp_sync_supported_get(ee->engine.x.win_root)) && | ||
107 | (!ee->no_comp_sync) && (_ecore_evas_app_comp_sync))) | ||
108 | { | ||
109 | if (!ee->engine.x.sync_counter) | ||
110 | ee->engine.x.sync_counter = ecore_x_sync_counter_new(0); | ||
111 | } | ||
112 | else | ||
113 | { | ||
114 | if (ee->engine.x.sync_counter) | ||
115 | ecore_x_sync_counter_free(ee->engine.x.sync_counter); | ||
116 | ee->engine.x.sync_counter = 0; | ||
117 | } | ||
118 | ecore_x_e_comp_sync_counter_set(ee->prop.window, ee->engine.x.sync_counter); | ||
119 | } | ||
120 | |||
121 | static void | ||
122 | _ecore_evas_x_sync_clear(Ecore_Evas *ee) | ||
123 | { | ||
124 | if (!ee->engine.x.sync_counter) return; | ||
125 | ecore_x_sync_counter_free(ee->engine.x.sync_counter); | ||
126 | ee->engine.x.sync_counter = 0; | ||
127 | } | ||
128 | |||
129 | # ifdef BUILD_ECORE_EVAS_OPENGL_X11 | ||
130 | static Ecore_X_Window | ||
131 | _ecore_evas_x_gl_window_new(Ecore_Evas *ee, Ecore_X_Window parent, int x, int y, int w, int h, int override, int argb, const int *opt) | ||
132 | { | ||
133 | Evas_Engine_Info_GL_X11 *einfo; | ||
134 | Ecore_X_Window win; | ||
135 | |||
136 | einfo = (Evas_Engine_Info_GL_X11 *)evas_engine_info_get(ee->evas); | ||
137 | if (einfo) | ||
138 | { | ||
139 | int screen; | ||
140 | |||
141 | if (opt) | ||
142 | { | ||
143 | int op; | ||
144 | |||
145 | for (op = 0; opt[op]; op++) | ||
146 | { | ||
147 | if (opt[op] == ECORE_EVAS_GL_X11_OPT_INDIRECT) | ||
148 | { | ||
149 | op++; | ||
150 | einfo->indirect = opt[op]; | ||
151 | } | ||
152 | else if (opt[op] == ECORE_EVAS_GL_X11_OPT_VSYNC) | ||
153 | { | ||
154 | op++; | ||
155 | einfo->vsync = opt[op]; | ||
156 | } | ||
157 | } | ||
158 | } | ||
159 | |||
160 | /* FIXME: this is inefficient as its 1 or more round trips */ | ||
161 | screen = ecore_x_screen_index_get(ecore_x_default_screen_get()); | ||
162 | if (ecore_x_screen_count_get() > 1) | ||
163 | { | ||
164 | Ecore_X_Window *roots; | ||
165 | int num, i; | ||
166 | |||
167 | num = 0; | ||
168 | roots = ecore_x_window_root_list(&num); | ||
169 | if (roots) | ||
170 | { | ||
171 | Ecore_X_Window root; | ||
172 | |||
173 | root = ecore_x_window_root_get(parent); | ||
174 | for (i = 0; i < num; i++) | ||
175 | { | ||
176 | if (root == roots[i]) | ||
177 | { | ||
178 | screen = i; | ||
179 | break; | ||
180 | } | ||
181 | } | ||
182 | free(roots); | ||
183 | } | ||
184 | } | ||
185 | |||
186 | einfo->info.display = ecore_x_display_get(); | ||
187 | einfo->info.screen = screen; | ||
188 | |||
189 | einfo->info.destination_alpha = argb; | ||
190 | |||
191 | einfo->info.visual = einfo->func.best_visual_get(einfo); | ||
192 | einfo->info.colormap = einfo->func.best_colormap_get(einfo); | ||
193 | einfo->info.depth = einfo->func.best_depth_get(einfo); | ||
194 | |||
195 | if ((!einfo->info.visual) || | ||
196 | (!einfo->info.colormap) || (!einfo->info.depth)) | ||
197 | { | ||
198 | WRN("OpenGL X11 init engine '%s' failed - no visual, colormap or depth.", ee->driver); | ||
199 | if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) | ||
200 | { | ||
201 | ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); | ||
202 | return 0; | ||
203 | } | ||
204 | } | ||
205 | |||
206 | if (argb) | ||
207 | { | ||
208 | if (override) | ||
209 | win = ecore_x_window_override_argb_new(parent, x, y, w, h); | ||
210 | else | ||
211 | win = ecore_x_window_argb_new(parent, x, y, w, h); | ||
212 | } | ||
213 | else | ||
214 | { | ||
215 | if (override) | ||
216 | win = ecore_x_window_override_new(parent, x, y, w, h); | ||
217 | else | ||
218 | win = ecore_x_window_new(parent, x, y, w, h); | ||
219 | } | ||
220 | |||
221 | ecore_x_window_pixel_gravity_set(win, ECORE_X_GRAVITY_FORGET); | ||
222 | |||
223 | /* attr.backing_store = NotUseful; */ | ||
224 | /* attr.override_redirect = override; */ | ||
225 | /* attr.colormap = einfo->info.colormap; */ | ||
226 | /* attr.border_pixel = 0; */ | ||
227 | /* attr.background_pixmap = None; */ | ||
228 | /* attr.event_mask = */ | ||
229 | /* KeyPressMask | KeyReleaseMask | */ | ||
230 | /* ExposureMask | ButtonPressMask | ButtonReleaseMask | */ | ||
231 | /* EnterWindowMask | LeaveWindowMask | */ | ||
232 | /* PointerMotionMask | StructureNotifyMask | VisibilityChangeMask | */ | ||
233 | /* FocusChangeMask | PropertyChangeMask | ColormapChangeMask; */ | ||
234 | /* attr.bit_gravity = ForgetGravity; */ | ||
235 | |||
236 | /* win = */ | ||
237 | /* XCreateWindow(einfo->info.display, parent, x, y, w, h, 0, */ | ||
238 | /* einfo->info.depth, InputOutput, einfo->info.visual, */ | ||
239 | /* CWBackingStore | CWColormap | CWBackPixmap | */ | ||
240 | /* CWBorderPixel | CWBitGravity | CWEventMask | */ | ||
241 | /* CWOverrideRedirect, &attr); */ | ||
242 | |||
243 | einfo->info.drawable = win; | ||
244 | |||
245 | if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) | ||
246 | { | ||
247 | ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); | ||
248 | ecore_x_window_free(win); | ||
249 | return 0; | ||
250 | } | ||
251 | } | ||
252 | else | ||
253 | win = 0; | ||
254 | |||
255 | return win; | ||
256 | } | ||
257 | #endif | ||
258 | |||
259 | static int | ||
260 | _ecore_evas_x_render(Ecore_Evas *ee) | ||
261 | { | ||
262 | int rend = 0; | ||
263 | Eina_List *updates = NULL; | ||
264 | Eina_List *ll; | ||
265 | Ecore_Evas *ee2; | ||
266 | |||
267 | if ((!ee->no_comp_sync) && (_ecore_evas_app_comp_sync) && | ||
268 | (ee->engine.x.sync_counter) && (!ee->engine.x.sync_began) && | ||
269 | (!ee->engine.x.sync_cancel)) | ||
270 | return 0; | ||
271 | |||
272 | EINA_LIST_FOREACH(ee->sub_ecore_evas, ll, ee2) | ||
273 | { | ||
274 | if (ee2->func.fn_pre_render) ee2->func.fn_pre_render(ee2); | ||
275 | if (ee2->engine.func->fn_render) | ||
276 | rend |= ee2->engine.func->fn_render(ee2); | ||
277 | if (ee2->func.fn_post_render) ee2->func.fn_post_render(ee2); | ||
278 | } | ||
279 | |||
280 | if (ee->func.fn_pre_render) ee->func.fn_pre_render(ee); | ||
281 | updates = evas_render_updates(ee->evas); | ||
282 | if (ee->prop.avoid_damage) | ||
283 | { | ||
284 | if (ee->engine.x.using_bg_pixmap) | ||
285 | { | ||
286 | if (updates) | ||
287 | { | ||
288 | Eina_List *l = NULL; | ||
289 | Eina_Rectangle *r; | ||
290 | |||
291 | EINA_LIST_FOREACH(updates, l, r) | ||
292 | ecore_x_window_area_clear(ee->prop.window, | ||
293 | r->x, r->y, r->w, r->h); | ||
294 | if (ee->shaped) | ||
295 | { | ||
296 | #ifdef EVAS_FRAME_QUEUING | ||
297 | evas_sync(ee->evas); | ||
298 | #endif | ||
299 | ecore_x_window_shape_mask_set(ee->prop.window, | ||
300 | ee->engine.x.mask); | ||
301 | } | ||
302 | if (ee->alpha) | ||
303 | { | ||
304 | #ifdef EVAS_FRAME_QUEUING | ||
305 | /* wait until ee->engine.x.mask being updated */ | ||
306 | // evas_sync(ee->evas); | ||
307 | #endif | ||
308 | // ecore_x_window_shape_input_mask_set(ee->prop.window, ee->engine.x.mask); | ||
309 | } | ||
310 | evas_render_updates_free(updates); | ||
311 | _ecore_evas_idle_timeout_update(ee); | ||
312 | rend = 1; | ||
313 | } | ||
314 | } | ||
315 | else | ||
316 | { | ||
317 | if (updates) | ||
318 | { | ||
319 | Eina_List *l = NULL; | ||
320 | Eina_Rectangle *r; | ||
321 | |||
322 | EINA_LIST_FOREACH(updates, l, r) | ||
323 | { | ||
324 | Ecore_X_Rectangle rect; | ||
325 | Ecore_X_XRegion *tmpr; | ||
326 | |||
327 | if (!ee->engine.x.damages) | ||
328 | ee->engine.x.damages = ecore_x_xregion_new(); | ||
329 | tmpr = ecore_x_xregion_new(); | ||
330 | if (ee->rotation == 0) | ||
331 | { | ||
332 | rect.x = r->x; | ||
333 | rect.y = r->y; | ||
334 | rect.width = r->w; | ||
335 | rect.height = r->h; | ||
336 | } | ||
337 | else if (ee->rotation == 90) | ||
338 | { | ||
339 | rect.x = r->y; | ||
340 | rect.y = ee->h - r->x - r->w; | ||
341 | rect.width = r->h; | ||
342 | rect.height = r->w; | ||
343 | } | ||
344 | else if (ee->rotation == 180) | ||
345 | { | ||
346 | rect.x = ee->w - r->x - r->w; | ||
347 | rect.y = ee->h - r->y - r->h; | ||
348 | rect.width = r->w; | ||
349 | rect.height = r->h; | ||
350 | } | ||
351 | else if (ee->rotation == 270) | ||
352 | { | ||
353 | rect.x = ee->w - r->y - r->h; | ||
354 | rect.y = r->x; | ||
355 | rect.width = r->h; | ||
356 | rect.height = r->w; | ||
357 | } | ||
358 | ecore_x_xregion_union_rect(tmpr, ee->engine.x.damages, | ||
359 | &rect); | ||
360 | ecore_x_xregion_free(ee->engine.x.damages); | ||
361 | ee->engine.x.damages = tmpr; | ||
362 | } | ||
363 | if (ee->engine.x.damages) | ||
364 | { | ||
365 | /* if we have a damage pixmap - we can avoid exposures by | ||
366 | * disabling them just for setting the mask */ | ||
367 | ecore_x_event_mask_set(ee->prop.window, | ||
368 | ECORE_X_EVENT_MASK_KEY_DOWN | | ||
369 | ECORE_X_EVENT_MASK_KEY_UP | | ||
370 | ECORE_X_EVENT_MASK_MOUSE_DOWN | | ||
371 | ECORE_X_EVENT_MASK_MOUSE_UP | | ||
372 | ECORE_X_EVENT_MASK_MOUSE_IN | | ||
373 | ECORE_X_EVENT_MASK_MOUSE_OUT | | ||
374 | ECORE_X_EVENT_MASK_MOUSE_MOVE | | ||
375 | // ECORE_X_EVENT_MASK_WINDOW_DAMAGE | | ||
376 | ECORE_X_EVENT_MASK_WINDOW_VISIBILITY | | ||
377 | ECORE_X_EVENT_MASK_WINDOW_CONFIGURE | | ||
378 | ECORE_X_EVENT_MASK_WINDOW_FOCUS_CHANGE | | ||
379 | ECORE_X_EVENT_MASK_WINDOW_PROPERTY | | ||
380 | ECORE_X_EVENT_MASK_WINDOW_COLORMAP | ||
381 | ); | ||
382 | if (ee->shaped) | ||
383 | ecore_x_window_shape_mask_set(ee->prop.window, | ||
384 | ee->engine.x.mask); | ||
385 | /* and re-enable them again */ | ||
386 | ecore_x_event_mask_set(ee->prop.window, | ||
387 | ECORE_X_EVENT_MASK_KEY_DOWN | | ||
388 | ECORE_X_EVENT_MASK_KEY_UP | | ||
389 | ECORE_X_EVENT_MASK_MOUSE_DOWN | | ||
390 | ECORE_X_EVENT_MASK_MOUSE_UP | | ||
391 | ECORE_X_EVENT_MASK_MOUSE_IN | | ||
392 | ECORE_X_EVENT_MASK_MOUSE_OUT | | ||
393 | ECORE_X_EVENT_MASK_MOUSE_MOVE | | ||
394 | ECORE_X_EVENT_MASK_WINDOW_DAMAGE | | ||
395 | ECORE_X_EVENT_MASK_WINDOW_VISIBILITY | | ||
396 | ECORE_X_EVENT_MASK_WINDOW_CONFIGURE | | ||
397 | ECORE_X_EVENT_MASK_WINDOW_FOCUS_CHANGE | | ||
398 | ECORE_X_EVENT_MASK_WINDOW_PROPERTY | | ||
399 | ECORE_X_EVENT_MASK_WINDOW_COLORMAP | ||
400 | ); | ||
401 | ecore_x_xregion_set(ee->engine.x.damages, ee->engine.x.gc); | ||
402 | ecore_x_pixmap_paste(ee->engine.x.pmap, ee->prop.window, | ||
403 | ee->engine.x.gc, 0, 0, ee->w, ee->h, | ||
404 | 0, 0); | ||
405 | ecore_x_xregion_free(ee->engine.x.damages); | ||
406 | ee->engine.x.damages = NULL; | ||
407 | } | ||
408 | evas_render_updates_free(updates); | ||
409 | _ecore_evas_idle_timeout_update(ee); | ||
410 | rend = 1; | ||
411 | } | ||
412 | } | ||
413 | } | ||
414 | else if (((ee->visible) && (ee->draw_ok)) || | ||
415 | ((ee->should_be_visible) && (ee->prop.fullscreen)) || | ||
416 | ((ee->should_be_visible) && (ee->prop.override))) | ||
417 | { | ||
418 | if (updates) | ||
419 | { | ||
420 | if (ee->shaped) | ||
421 | { | ||
422 | #ifdef EVAS_FRAME_QUEUING | ||
423 | evas_sync(ee->evas); | ||
424 | #endif | ||
425 | ecore_x_window_shape_mask_set(ee->prop.window, | ||
426 | ee->engine.x.mask); | ||
427 | } | ||
428 | if (ee->alpha) | ||
429 | { | ||
430 | #ifdef EVAS_FRAME_QUEUING | ||
431 | /* wait until ee->engine.x.mask being updated */ | ||
432 | // evas_sync(ee->evas); | ||
433 | #endif | ||
434 | // ecore_x_window_shape_input_mask_set(ee->prop.window, ee->engine.x.mask); | ||
435 | } | ||
436 | evas_render_updates_free(updates); | ||
437 | _ecore_evas_idle_timeout_update(ee); | ||
438 | rend = 1; | ||
439 | } | ||
440 | } | ||
441 | else | ||
442 | evas_norender(ee->evas); | ||
443 | if (ee->func.fn_post_render) ee->func.fn_post_render(ee); | ||
444 | /* | ||
445 | if (rend) | ||
446 | { | ||
447 | static int frames = 0; | ||
448 | static double t0 = 0.0; | ||
449 | double t, td; | ||
450 | |||
451 | t = ecore_time_get(); | ||
452 | frames++; | ||
453 | if ((t - t0) > 1.0) | ||
454 | { | ||
455 | td = t - t0; | ||
456 | printf("FPS: %3.3f\n", (double)frames / td); | ||
457 | frames = 0; | ||
458 | t0 = t; | ||
459 | } | ||
460 | } | ||
461 | */ | ||
462 | |||
463 | return rend; | ||
464 | } | ||
465 | |||
466 | static void | ||
467 | _ecore_evas_x_resize_shape(Ecore_Evas *ee) | ||
468 | { | ||
469 | if (!strcmp(ee->driver, "software_x11")) | ||
470 | { | ||
471 | #ifdef BUILD_ECORE_EVAS_SOFTWARE_X11 | ||
472 | Evas_Engine_Info_Software_X11 *einfo; | ||
473 | |||
474 | einfo = (Evas_Engine_Info_Software_X11 *)evas_engine_info_get(ee->evas); | ||
475 | if (einfo) | ||
476 | { | ||
477 | unsigned int foreground; | ||
478 | Ecore_X_GC gc; | ||
479 | |||
480 | if (ee->engine.x.mask) ecore_x_pixmap_free(ee->engine.x.mask); | ||
481 | ee->engine.x.mask = ecore_x_pixmap_new(ee->prop.window, ee->w, ee->h, 1); | ||
482 | foreground = 0; | ||
483 | gc = ecore_x_gc_new(ee->engine.x.mask, | ||
484 | ECORE_X_GC_VALUE_MASK_FOREGROUND, | ||
485 | &foreground); | ||
486 | ecore_x_drawable_rectangle_fill(ee->engine.x.mask, gc, | ||
487 | 0, 0, ee->w, ee->h); | ||
488 | ecore_x_gc_free(gc); | ||
489 | einfo->info.mask = ee->engine.x.mask; | ||
490 | if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) | ||
491 | { | ||
492 | ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); | ||
493 | } | ||
494 | evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h); | ||
495 | } | ||
496 | #endif /* BUILD_ECORE_EVAS_SOFTWARE_X11 */ | ||
497 | } | ||
498 | else if (!strcmp(ee->driver, "software_16_x11")) | ||
499 | { | ||
500 | #if BUILD_ECORE_EVAS_SOFTWARE_16_X11 | ||
501 | # if 0 /* XXX no shaped window support for software_16_x11 */ | ||
502 | Evas_Engine_Info_Software_16_X11 *einfo; | ||
503 | |||
504 | einfo = (Evas_Engine_Info_Software_16_X11 *)evas_engine_info_get(ee->evas); | ||
505 | if (einfo) | ||
506 | { | ||
507 | if (ee->engine.x.mask) ecore_x_pixmap_free(ee->engine.x.mask); | ||
508 | ee->engine.x.mask = ecore_x_pixmap_new(ee->prop.window, ee->w, ee->h, 1); | ||
509 | einfo->info.mask = ee->engine.x.mask; | ||
510 | if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) | ||
511 | { | ||
512 | ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); | ||
513 | } | ||
514 | evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h); | ||
515 | } | ||
516 | # endif /* XXX no shaped window support for software_16_x11 */ | ||
517 | #endif /* BUILD_ECORE_EVAS_SOFTWARE_16_X11 */ | ||
518 | } | ||
519 | if (!strcmp(ee->driver, "software_8_x11")) | ||
520 | { | ||
521 | #if defined (BUILD_ECORE_EVAS_SOFTWARE_8_X11) | ||
522 | Evas_Engine_Info_Software_8_X11 *einfo; | ||
523 | |||
524 | einfo = (Evas_Engine_Info_Software_8_X11 *)evas_engine_info_get(ee->evas); | ||
525 | if (einfo) | ||
526 | { | ||
527 | unsigned int foreground; | ||
528 | Ecore_X_GC gc; | ||
529 | |||
530 | if (ee->engine.x.mask) ecore_x_pixmap_free(ee->engine.x.mask); | ||
531 | ee->engine.x.mask = ecore_x_pixmap_new(ee->prop.window, ee->w, ee->h, 1); | ||
532 | foreground = 0; | ||
533 | gc = ecore_x_gc_new(ee->engine.x.mask, | ||
534 | ECORE_X_GC_VALUE_MASK_FOREGROUND, | ||
535 | &foreground); | ||
536 | ecore_x_drawable_rectangle_fill(ee->engine.x.mask, gc, | ||
537 | 0, 0, ee->w, ee->h); | ||
538 | ecore_x_gc_free(gc); | ||
539 | einfo->info.mask = ee->engine.x.mask; | ||
540 | if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) | ||
541 | { | ||
542 | ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); | ||
543 | } | ||
544 | evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h); | ||
545 | } | ||
546 | #endif /* BUILD_ECORE_EVAS_SOFTWARE_8_X11 */ | ||
547 | } | ||
548 | } | ||
549 | |||
550 | /* TODO: we need to make this work for all the states, not just sticky */ | ||
551 | static Eina_Bool | ||
552 | _ecore_evas_x_event_property_change(void *data __UNUSED__, int type __UNUSED__, void *event) | ||
553 | { | ||
554 | Ecore_Evas *ee; | ||
555 | Ecore_X_Event_Window_Property *e; | ||
556 | int state_change = 0; | ||
557 | |||
558 | e = event; | ||
559 | ee = ecore_event_window_match(e->win); | ||
560 | if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON; /* pass on event */ | ||
561 | if (e->win != ee->prop.window) return ECORE_CALLBACK_PASS_ON; | ||
562 | if (e->atom == ECORE_X_ATOM_NET_WM_STATE) | ||
563 | { | ||
564 | unsigned int i, num; | ||
565 | Ecore_X_Window_State *state; | ||
566 | struct { | ||
567 | struct { | ||
568 | unsigned char modal : 1; | ||
569 | unsigned char sticky : 1; | ||
570 | unsigned char maximized_v : 1; | ||
571 | unsigned char maximized_h : 1; | ||
572 | unsigned char shaded : 1; | ||
573 | unsigned char skip_taskbar : 1; | ||
574 | unsigned char skip_pager : 1; | ||
575 | unsigned char fullscreen : 1; | ||
576 | unsigned char above : 1; | ||
577 | unsigned char below : 1; | ||
578 | } x; | ||
579 | struct { | ||
580 | char modal : 1; | ||
581 | char maximized : 1; | ||
582 | char sticky : 1; | ||
583 | char fullscreen : 1; | ||
584 | char focus_skip : 1; | ||
585 | } prop; | ||
586 | } prev; | ||
587 | |||
588 | prev.x.modal = ee->engine.x.state.modal; | ||
589 | prev.x.sticky = ee->engine.x.state.sticky; | ||
590 | prev.x.maximized_v = ee->engine.x.state.maximized_v; | ||
591 | prev.x.maximized_h = ee->engine.x.state.maximized_h; | ||
592 | prev.x.shaded = ee->engine.x.state.shaded; | ||
593 | prev.x.skip_taskbar = ee->engine.x.state.skip_taskbar; | ||
594 | prev.x.skip_pager = ee->engine.x.state.skip_pager; | ||
595 | prev.x.fullscreen = ee->engine.x.state.fullscreen; | ||
596 | prev.x.above = ee->engine.x.state.above; | ||
597 | prev.x.below = ee->engine.x.state.below; | ||
598 | |||
599 | prev.prop.modal = ee->prop.modal; | ||
600 | prev.prop.maximized = ee->prop.maximized; | ||
601 | prev.prop.sticky = ee->prop.sticky; | ||
602 | prev.prop.fullscreen = ee->prop.fullscreen; | ||
603 | prev.prop.focus_skip = ee->prop.focus_skip; | ||
604 | |||
605 | ee->engine.x.state.modal = 0; | ||
606 | ee->engine.x.state.sticky = 0; | ||
607 | ee->engine.x.state.maximized_v = 0; | ||
608 | ee->engine.x.state.maximized_h = 0; | ||
609 | ee->engine.x.state.shaded = 0; | ||
610 | ee->engine.x.state.skip_taskbar = 0; | ||
611 | ee->engine.x.state.skip_pager = 0; | ||
612 | ee->engine.x.state.fullscreen = 0; | ||
613 | ee->engine.x.state.above = 0; | ||
614 | ee->engine.x.state.below = 0; | ||
615 | |||
616 | ee->prop.modal = 0; | ||
617 | ee->prop.maximized = 0; | ||
618 | ee->prop.sticky = 0; | ||
619 | ee->prop.fullscreen = 0; | ||
620 | ee->prop.focus_skip = 0; | ||
621 | |||
622 | ecore_x_netwm_window_state_get(e->win, &state, &num); | ||
623 | if (state) | ||
624 | { | ||
625 | for (i = 0; i < num; i++) | ||
626 | { | ||
627 | switch (state[i]) | ||
628 | { | ||
629 | case ECORE_X_WINDOW_STATE_MODAL: | ||
630 | ee->engine.x.state.modal = 1; | ||
631 | ee->prop.modal = 1; | ||
632 | break; | ||
633 | case ECORE_X_WINDOW_STATE_STICKY: | ||
634 | ee->prop.sticky = 1; | ||
635 | ee->engine.x.state.sticky = 1; | ||
636 | break; | ||
637 | case ECORE_X_WINDOW_STATE_MAXIMIZED_VERT: | ||
638 | ee->engine.x.state.maximized_v = 1; | ||
639 | ee->prop.maximized = 1; | ||
640 | break; | ||
641 | case ECORE_X_WINDOW_STATE_MAXIMIZED_HORZ: | ||
642 | ee->engine.x.state.maximized_h = 1; | ||
643 | ee->prop.maximized = 1; | ||
644 | break; | ||
645 | case ECORE_X_WINDOW_STATE_SHADED: | ||
646 | ee->engine.x.state.shaded = 1; | ||
647 | break; | ||
648 | case ECORE_X_WINDOW_STATE_SKIP_TASKBAR: | ||
649 | ee->engine.x.state.skip_taskbar = 1; | ||
650 | ee->prop.focus_skip = 1; | ||
651 | break; | ||
652 | case ECORE_X_WINDOW_STATE_SKIP_PAGER: | ||
653 | ee->engine.x.state.skip_pager = 1; | ||
654 | ee->prop.focus_skip = 1; | ||
655 | break; | ||
656 | case ECORE_X_WINDOW_STATE_FULLSCREEN: | ||
657 | ee->prop.fullscreen = 1; | ||
658 | ee->engine.x.state.fullscreen = 1; | ||
659 | break; | ||
660 | case ECORE_X_WINDOW_STATE_ABOVE: | ||
661 | ee->engine.x.state.above = 1; | ||
662 | break; | ||
663 | case ECORE_X_WINDOW_STATE_BELOW: | ||
664 | ee->engine.x.state.below = 1; | ||
665 | break; | ||
666 | default: | ||
667 | break; | ||
668 | } | ||
669 | } | ||
670 | free(state); | ||
671 | } | ||
672 | if ( | ||
673 | // (prev.x.modal != ee->engine.x.state.modal) || | ||
674 | (prev.x.sticky != ee->engine.x.state.sticky) || | ||
675 | (prev.x.maximized_v != ee->engine.x.state.maximized_v) || | ||
676 | (prev.x.maximized_h != ee->engine.x.state.maximized_h) || | ||
677 | // (prev.x.shaded != ee->engine.x.state.shaded) || | ||
678 | // (prev.x.skip_taskbar != ee->engine.x.state.skip_taskbar) || | ||
679 | // (prev.x.skip_pager != ee->engine.x.state.skip_pager) || | ||
680 | (prev.x.fullscreen != ee->engine.x.state.fullscreen) || | ||
681 | // (prev.x.above != ee->engine.x.state.above) || | ||
682 | // (prev.x.below != ee->engine.x.state.below) || | ||
683 | // (prev.prop.modal != ee->prop.modal) || | ||
684 | (prev.prop.maximized != ee->prop.maximized) || | ||
685 | (prev.prop.sticky != ee->prop.sticky) || | ||
686 | (prev.prop.fullscreen != ee->prop.fullscreen) || | ||
687 | (prev.prop.focus_skip != ee->prop.focus_skip)) | ||
688 | state_change = 1; | ||
689 | } | ||
690 | else if (e->atom == ECORE_X_ATOM_WM_STATE) | ||
691 | { | ||
692 | Ecore_X_Window_State_Hint state; | ||
693 | |||
694 | // handle WM_STATE changes | ||
695 | state = ecore_x_icccm_state_get(e->win); | ||
696 | switch (state) | ||
697 | { | ||
698 | case ECORE_X_WINDOW_STATE_HINT_WITHDRAWN: | ||
699 | if ((!ee->prop.withdrawn) || (ee->prop.iconified)) | ||
700 | { | ||
701 | state_change = 1; | ||
702 | ee->prop.withdrawn = 1; | ||
703 | ee->prop.iconified = 0; | ||
704 | } | ||
705 | break; | ||
706 | case ECORE_X_WINDOW_STATE_HINT_ICONIC: | ||
707 | if ((!ee->prop.iconified) || (ee->prop.withdrawn)) | ||
708 | { | ||
709 | state_change = 1; | ||
710 | ee->prop.iconified = 1; | ||
711 | ee->prop.withdrawn = 0; | ||
712 | } | ||
713 | break; | ||
714 | case ECORE_X_WINDOW_STATE_HINT_NORMAL: | ||
715 | if ((ee->prop.iconified) || (ee->prop.withdrawn)) | ||
716 | { | ||
717 | state_change = 1; | ||
718 | ee->prop.iconified = 0; | ||
719 | ee->prop.withdrawn = 0; | ||
720 | } | ||
721 | break; | ||
722 | default: | ||
723 | break; | ||
724 | } | ||
725 | } | ||
726 | if (state_change) | ||
727 | { | ||
728 | if (ee->func.fn_state_change) ee->func.fn_state_change(ee); | ||
729 | } | ||
730 | |||
731 | return ECORE_CALLBACK_PASS_ON; | ||
732 | } | ||
733 | |||
734 | static Eina_Bool | ||
735 | _ecore_evas_x_event_visibility_change(void *data __UNUSED__, int type __UNUSED__, void *event) | ||
736 | { | ||
737 | Ecore_Evas *ee; | ||
738 | Ecore_X_Event_Window_Visibility_Change *e; | ||
739 | |||
740 | e = event; | ||
741 | ee = ecore_event_window_match(e->win); | ||
742 | if (!ee) return ECORE_CALLBACK_PASS_ON; /* pass on event */ | ||
743 | if (e->win != ee->prop.window) return ECORE_CALLBACK_PASS_ON; | ||
744 | // printf("VIS CHANGE OBSCURED: %p %i\n", ee, e->fully_obscured); | ||
745 | if (e->fully_obscured) | ||
746 | { | ||
747 | /* FIXME: round trip */ | ||
748 | if (!ecore_x_screen_is_composited(ee->engine.x.screen_num)) | ||
749 | ee->draw_ok = 0; | ||
750 | } | ||
751 | else | ||
752 | ee->draw_ok = 1; | ||
753 | return ECORE_CALLBACK_PASS_ON; | ||
754 | } | ||
755 | |||
756 | static Eina_Bool | ||
757 | _ecore_evas_x_event_client_message(void *data __UNUSED__, int type __UNUSED__, void *event) | ||
758 | { | ||
759 | Ecore_Evas *ee; | ||
760 | Ecore_X_Event_Client_Message *e; | ||
761 | |||
762 | e = event; | ||
763 | if (e->format != 32) return ECORE_CALLBACK_PASS_ON; | ||
764 | if (e->message_type == ECORE_X_ATOM_E_COMP_SYNC_BEGIN) | ||
765 | { | ||
766 | ee = ecore_event_window_match(e->data.l[0]); | ||
767 | if (!ee) return ECORE_CALLBACK_PASS_ON; /* pass on event */ | ||
768 | if (e->data.l[0] != (long)ee->prop.window) | ||
769 | return ECORE_CALLBACK_PASS_ON; | ||
770 | if (!ee->engine.x.sync_began) | ||
771 | { | ||
772 | // qeue a damage + draw. work around an event re-ordering thing. | ||
773 | evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h); | ||
774 | } | ||
775 | ee->engine.x.sync_began = 1; | ||
776 | ee->engine.x.sync_cancel = 0; | ||
777 | } | ||
778 | else if (e->message_type == ECORE_X_ATOM_E_COMP_SYNC_END) | ||
779 | { | ||
780 | ee = ecore_event_window_match(e->data.l[0]); | ||
781 | if (!ee) return ECORE_CALLBACK_PASS_ON; /* pass on event */ | ||
782 | if (e->data.l[0] != (long)ee->prop.window) | ||
783 | return ECORE_CALLBACK_PASS_ON; | ||
784 | ee->engine.x.sync_began = 0; | ||
785 | ee->engine.x.sync_cancel = 0; | ||
786 | } | ||
787 | else if (e->message_type == ECORE_X_ATOM_E_COMP_SYNC_CANCEL) | ||
788 | { | ||
789 | ee = ecore_event_window_match(e->data.l[0]); | ||
790 | if (!ee) return ECORE_CALLBACK_PASS_ON; /* pass on event */ | ||
791 | if (e->data.l[0] != (long)ee->prop.window) | ||
792 | return ECORE_CALLBACK_PASS_ON; | ||
793 | ee->engine.x.sync_began = 0; | ||
794 | ee->engine.x.sync_cancel = 1; | ||
795 | } | ||
796 | else if ((e->message_type == ECORE_X_ATOM_WM_PROTOCOLS) && | ||
797 | (e->data.l[0] == (int)ECORE_X_ATOM_NET_WM_SYNC_REQUEST)) | ||
798 | { | ||
799 | ee = ecore_event_window_match(e->win); | ||
800 | if (!ee) return ECORE_CALLBACK_PASS_ON; /* pass on event */ | ||
801 | ee->engine.x.netwm_sync_val_lo = (unsigned int)e->data.l[2]; | ||
802 | ee->engine.x.netwm_sync_val_hi = (int)e->data.l[3]; | ||
803 | ee->engine.x.netwm_sync_set = 1; | ||
804 | } | ||
805 | return ECORE_CALLBACK_PASS_ON; | ||
806 | } | ||
807 | |||
808 | static Eina_Bool | ||
809 | _ecore_evas_x_event_mouse_in(void *data __UNUSED__, int type __UNUSED__, void *event) | ||
810 | { | ||
811 | Ecore_Evas *ee; | ||
812 | Ecore_X_Event_Mouse_In *e; | ||
813 | |||
814 | e = event; | ||
815 | ee = ecore_event_window_match(e->win); | ||
816 | if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON; /* pass on event */ | ||
817 | if (e->win != ee->prop.window) return ECORE_CALLBACK_PASS_ON; | ||
818 | /* { */ | ||
819 | /* time_t t; */ | ||
820 | /* char *ct; */ | ||
821 | |||
822 | /* const char *modes[] = { */ | ||
823 | /* "MODE_NORMAL", */ | ||
824 | /* "MODE_WHILE_GRABBED", */ | ||
825 | /* "MODE_GRAB", */ | ||
826 | /* "MODE_UNGRAB" */ | ||
827 | /* }; */ | ||
828 | /* const char *details[] = { */ | ||
829 | /* "DETAIL_ANCESTOR", */ | ||
830 | /* "DETAIL_VIRTUAL", */ | ||
831 | /* "DETAIL_INFERIOR", */ | ||
832 | /* "DETAIL_NON_LINEAR", */ | ||
833 | /* "DETAIL_NON_LINEAR_VIRTUAL", */ | ||
834 | /* "DETAIL_POINTER", */ | ||
835 | /* "DETAIL_POINTER_ROOT", */ | ||
836 | /* "DETAIL_DETAIL_NONE" */ | ||
837 | /* }; */ | ||
838 | /* t = time(NULL); */ | ||
839 | /* ct = ctime(&t); */ | ||
840 | /* ct[strlen(ct) - 1] = 0; */ | ||
841 | /* printf("@@ ->IN 0x%x 0x%x %s md=%s dt=%s\n", */ | ||
842 | /* e->win, e->event_win, */ | ||
843 | /* ct, */ | ||
844 | /* modes[e->mode], */ | ||
845 | /* details[e->detail]); */ | ||
846 | /* } */ | ||
847 | // disable. causes more problems than it fixes | ||
848 | // if ((e->mode == ECORE_X_EVENT_MODE_GRAB) || | ||
849 | // (e->mode == ECORE_X_EVENT_MODE_UNGRAB)) | ||
850 | // return 0; | ||
851 | /* if (e->mode != ECORE_X_EVENT_MODE_NORMAL) return 0; */ | ||
852 | if (!ee->in) | ||
853 | { | ||
854 | if (ee->func.fn_mouse_in) ee->func.fn_mouse_in(ee); | ||
855 | ecore_event_evas_modifier_lock_update(ee->evas, e->modifiers); | ||
856 | evas_event_feed_mouse_in(ee->evas, e->time, NULL); | ||
857 | _ecore_evas_mouse_move_process(ee, e->x, e->y, e->time); | ||
858 | ee->in = EINA_TRUE; | ||
859 | } | ||
860 | return ECORE_CALLBACK_PASS_ON; | ||
861 | } | ||
862 | |||
863 | static Eina_Bool | ||
864 | _ecore_evas_x_event_mouse_out(void *data __UNUSED__, int type __UNUSED__, void *event) | ||
865 | { | ||
866 | Ecore_Evas *ee; | ||
867 | Ecore_X_Event_Mouse_Out *e; | ||
868 | |||
869 | e = event; | ||
870 | ee = ecore_event_window_match(e->win); | ||
871 | if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON; | ||
872 | /* pass on event */ | ||
873 | if (e->win != ee->prop.window) return ECORE_CALLBACK_PASS_ON; | ||
874 | /* { */ | ||
875 | /* time_t t; */ | ||
876 | /* char *ct; */ | ||
877 | |||
878 | /* const char *modes[] = { */ | ||
879 | /* "MODE_NORMAL", */ | ||
880 | /* "MODE_WHILE_GRABBED", */ | ||
881 | /* "MODE_GRAB", */ | ||
882 | /* "MODE_UNGRAB" */ | ||
883 | /* }; */ | ||
884 | /* const char *details[] = { */ | ||
885 | /* "DETAIL_ANCESTOR", */ | ||
886 | /* "DETAIL_VIRTUAL", */ | ||
887 | /* "DETAIL_INFERIOR", */ | ||
888 | /* "DETAIL_NON_LINEAR", */ | ||
889 | /* "DETAIL_NON_LINEAR_VIRTUAL", */ | ||
890 | /* "DETAIL_POINTER", */ | ||
891 | /* "DETAIL_POINTER_ROOT", */ | ||
892 | /* "DETAIL_DETAIL_NONE" */ | ||
893 | /* }; */ | ||
894 | /* t = time(NULL); */ | ||
895 | /* ct = ctime(&t); */ | ||
896 | /* ct[strlen(ct) - 1] = 0; */ | ||
897 | /* printf("@@ ->OUT 0x%x 0x%x %s md=%s dt=%s\n", */ | ||
898 | /* e->win, e->event_win, */ | ||
899 | /* ct, */ | ||
900 | /* modes[e->mode], */ | ||
901 | /* details[e->detail]); */ | ||
902 | /* } */ | ||
903 | // disable. causes more problems than it fixes | ||
904 | // if ((e->mode == ECORE_X_EVENT_MODE_GRAB) || | ||
905 | // (e->mode == ECORE_X_EVENT_MODE_UNGRAB)) | ||
906 | // return 0; | ||
907 | /* if (e->mode != ECORE_X_EVENT_MODE_NORMAL) return 0; */ | ||
908 | // printf("OUT: ee->in=%i, e->mode=%i, e->detail=%i, dount_count=%i\n", | ||
909 | // ee->in, e->mode, e->detail, evas_event_down_count_get(ee->evas)); | ||
910 | if (ee->in) | ||
911 | { | ||
912 | if ((evas_event_down_count_get(ee->evas) > 0) && | ||
913 | (!((e->mode == ECORE_X_EVENT_MODE_GRAB) && | ||
914 | (e->detail == ECORE_X_EVENT_DETAIL_NON_LINEAR)))) | ||
915 | return ECORE_CALLBACK_PASS_ON; | ||
916 | ecore_event_evas_modifier_lock_update(ee->evas, e->modifiers); | ||
917 | _ecore_evas_mouse_move_process(ee, e->x, e->y, e->time); | ||
918 | if (e->mode == ECORE_X_EVENT_MODE_GRAB) | ||
919 | evas_event_feed_mouse_cancel(ee->evas, e->time, NULL); | ||
920 | evas_event_feed_mouse_out(ee->evas, e->time, NULL); | ||
921 | if (ee->func.fn_mouse_out) ee->func.fn_mouse_out(ee); | ||
922 | if (ee->prop.cursor.object) evas_object_hide(ee->prop.cursor.object); | ||
923 | ee->in = EINA_FALSE; | ||
924 | } | ||
925 | return ECORE_CALLBACK_PASS_ON; | ||
926 | } | ||
927 | |||
928 | static Eina_Bool | ||
929 | _ecore_evas_x_event_window_focus_in(void *data __UNUSED__, int type __UNUSED__, void *event) | ||
930 | { | ||
931 | Ecore_Evas *ee; | ||
932 | Ecore_X_Event_Window_Focus_In *e; | ||
933 | |||
934 | e = event; | ||
935 | ee = ecore_event_window_match(e->win); | ||
936 | if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON; /* pass on event */ | ||
937 | if (e->win != ee->prop.window) return ECORE_CALLBACK_PASS_ON; | ||
938 | //xx// filtering with these doesnt help | ||
939 | //xx// if (e->mode == ECORE_X_EVENT_MODE_UNGRAB) return ECORE_CALLBACK_PASS_ON; | ||
940 | ee->prop.focused = 1; | ||
941 | evas_focus_in(ee->evas); | ||
942 | if (ee->func.fn_focus_in) ee->func.fn_focus_in(ee); | ||
943 | return ECORE_CALLBACK_PASS_ON; | ||
944 | } | ||
945 | |||
946 | static Eina_Bool | ||
947 | _ecore_evas_x_event_window_focus_out(void *data __UNUSED__, int type __UNUSED__, void *event) | ||
948 | { | ||
949 | Ecore_Evas *ee; | ||
950 | Ecore_X_Event_Window_Focus_Out *e; | ||
951 | |||
952 | e = event; | ||
953 | ee = ecore_event_window_match(e->win); | ||
954 | if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON; /* pass on event */ | ||
955 | if (e->win != ee->prop.window) return ECORE_CALLBACK_PASS_ON; | ||
956 | //xx// filtering with these doesnt help | ||
957 | //xx// if (e->mode == ECORE_X_EVENT_MODE_GRAB) return ECORE_CALLBACK_PASS_ON; | ||
958 | |||
959 | // if (ee->prop.fullscreen) | ||
960 | // ecore_x_window_focus(ee->prop.window); | ||
961 | evas_focus_out(ee->evas); | ||
962 | ee->prop.focused = 0; | ||
963 | if (ee->func.fn_focus_out) ee->func.fn_focus_out(ee); | ||
964 | return ECORE_CALLBACK_PASS_ON; | ||
965 | } | ||
966 | |||
967 | static Eina_Bool | ||
968 | _ecore_evas_x_event_window_damage(void *data __UNUSED__, int type __UNUSED__, void *event) | ||
969 | { | ||
970 | Ecore_Evas *ee; | ||
971 | Ecore_X_Event_Window_Damage *e; | ||
972 | |||
973 | e = event; | ||
974 | ee = ecore_event_window_match(e->win); | ||
975 | if (!ee) return ECORE_CALLBACK_PASS_ON; /* pass on event */ | ||
976 | if (e->win != ee->prop.window) return ECORE_CALLBACK_PASS_ON; | ||
977 | if (ee->engine.x.using_bg_pixmap) return ECORE_CALLBACK_PASS_ON; | ||
978 | // printf("EXPOSE %p [%i] %i %i %ix%i\n", ee, ee->prop.avoid_damage, e->x, e->y, e->w, e->h); | ||
979 | if (ee->prop.avoid_damage) | ||
980 | { | ||
981 | Ecore_X_Rectangle rect; | ||
982 | Ecore_X_XRegion *tmpr; | ||
983 | |||
984 | if (!ee->engine.x.damages) | ||
985 | ee->engine.x.damages = ecore_x_xregion_new(); | ||
986 | tmpr = ecore_x_xregion_new(); | ||
987 | rect.x = e->x; | ||
988 | rect.y = e->y; | ||
989 | rect.width = e->w; | ||
990 | rect.height = e->h; | ||
991 | ecore_x_xregion_union_rect(tmpr, ee->engine.x.damages, &rect); | ||
992 | ecore_x_xregion_free(ee->engine.x.damages); | ||
993 | ee->engine.x.damages = tmpr; | ||
994 | /* no - this breaks things badly. disable. Ecore_X_Rectangle != XRectangle - see | ||
995 | * the typedefs in x's headers and ecore_x's. also same with Region - it's a pointer in x - not an X ID | ||
996 | Ecore_X_Rectangle rect; | ||
997 | Ecore_X_XRegion *tmpr; | ||
998 | |||
999 | if (!ee->engine.x.damages) ee->engine.x.damages = ecore_x_xregion_new(); | ||
1000 | tmpr = ecore_x_xregion_new(); | ||
1001 | rect.x = e->x; | ||
1002 | rect.y = e->y; | ||
1003 | rect.width = e->w; | ||
1004 | rect.height = e->h; | ||
1005 | ecore_x_xregion_union_rect(tmpr, ee->engine.x.damages, &rect); | ||
1006 | ecore_x_xregion_free(ee->engine.x.damages); | ||
1007 | ee->engine.x.damages = tmpr; | ||
1008 | */ | ||
1009 | } | ||
1010 | else | ||
1011 | { | ||
1012 | if (ee->rotation == 0) | ||
1013 | evas_damage_rectangle_add(ee->evas, e->x, e->y, e->w, e->h); | ||
1014 | else if (ee->rotation == 90) | ||
1015 | evas_damage_rectangle_add(ee->evas, | ||
1016 | ee->h - e->y - e->h, e->x, e->h, e->w); | ||
1017 | else if (ee->rotation == 180) | ||
1018 | evas_damage_rectangle_add(ee->evas, ee->w - e->x - e->w, | ||
1019 | ee->h - e->y - e->h, e->w, e->h); | ||
1020 | else if (ee->rotation == 270) | ||
1021 | evas_damage_rectangle_add(ee->evas, e->y, ee->w - e->x - e->w, | ||
1022 | e->h, e->w); | ||
1023 | } | ||
1024 | return ECORE_CALLBACK_PASS_ON; | ||
1025 | } | ||
1026 | |||
1027 | static Eina_Bool | ||
1028 | _ecore_evas_x_event_window_destroy(void *data __UNUSED__, int type __UNUSED__, void *event) | ||
1029 | { | ||
1030 | Ecore_Evas *ee; | ||
1031 | Ecore_X_Event_Window_Destroy *e; | ||
1032 | |||
1033 | e = event; | ||
1034 | ee = ecore_event_window_match(e->win); | ||
1035 | if (!ee) return ECORE_CALLBACK_PASS_ON; /* pass on event */ | ||
1036 | if (e->win != ee->prop.window) return ECORE_CALLBACK_PASS_ON; | ||
1037 | if (ee->func.fn_destroy) ee->func.fn_destroy(ee); | ||
1038 | _ecore_evas_x_sync_clear(ee); | ||
1039 | ecore_evas_free(ee); | ||
1040 | return ECORE_CALLBACK_PASS_ON; | ||
1041 | } | ||
1042 | |||
1043 | static Eina_Bool | ||
1044 | _ecore_evas_x_event_window_configure(void *data __UNUSED__, int type __UNUSED__, void *event) | ||
1045 | { | ||
1046 | Ecore_Evas *ee; | ||
1047 | Ecore_X_Event_Window_Configure *e; | ||
1048 | |||
1049 | e = event; | ||
1050 | ee = ecore_event_window_match(e->win); | ||
1051 | if (!ee) return ECORE_CALLBACK_PASS_ON; /* pass on event */ | ||
1052 | if (e->win != ee->prop.window) return ECORE_CALLBACK_PASS_ON; | ||
1053 | if (ee->engine.x.direct_resize) return ECORE_CALLBACK_PASS_ON; | ||
1054 | |||
1055 | ee->engine.x.configure_coming = 0; | ||
1056 | if ((e->from_wm) || (ee->prop.override)) | ||
1057 | { | ||
1058 | if ((ee->x != e->x) || (ee->y != e->y)) | ||
1059 | { | ||
1060 | ee->x = e->x; | ||
1061 | ee->y = e->y; | ||
1062 | ee->req.x = ee->x; | ||
1063 | ee->req.y = ee->y; | ||
1064 | if (ee->func.fn_move) ee->func.fn_move(ee); | ||
1065 | } | ||
1066 | } | ||
1067 | if ((ee->w != e->w) || (ee->h != e->h)) | ||
1068 | { | ||
1069 | ee->w = e->w; | ||
1070 | ee->h = e->h; | ||
1071 | ee->req.w = ee->w; | ||
1072 | ee->req.h = ee->h; | ||
1073 | if ((ee->rotation == 90) || (ee->rotation == 270)) | ||
1074 | { | ||
1075 | evas_output_size_set(ee->evas, ee->h, ee->w); | ||
1076 | evas_output_viewport_set(ee->evas, 0, 0, ee->h, ee->w); | ||
1077 | } | ||
1078 | else | ||
1079 | { | ||
1080 | evas_output_size_set(ee->evas, ee->w, ee->h); | ||
1081 | evas_output_viewport_set(ee->evas, 0, 0, ee->w, ee->h); | ||
1082 | } | ||
1083 | if (ee->prop.avoid_damage) | ||
1084 | { | ||
1085 | int pdam; | ||
1086 | |||
1087 | pdam = ecore_evas_avoid_damage_get(ee); | ||
1088 | ecore_evas_avoid_damage_set(ee, 0); | ||
1089 | ecore_evas_avoid_damage_set(ee, pdam); | ||
1090 | } | ||
1091 | if ((ee->shaped) || (ee->alpha)) | ||
1092 | _ecore_evas_x_resize_shape(ee); | ||
1093 | if ((ee->expecting_resize.w > 0) && (ee->expecting_resize.h > 0)) | ||
1094 | { | ||
1095 | if ((ee->expecting_resize.w == ee->w) && | ||
1096 | (ee->expecting_resize.h == ee->h)) | ||
1097 | _ecore_evas_mouse_move_process(ee, ee->mouse.x, ee->mouse.y, | ||
1098 | ecore_x_current_time_get()); | ||
1099 | ee->expecting_resize.w = 0; | ||
1100 | ee->expecting_resize.h = 0; | ||
1101 | } | ||
1102 | if (ee->func.fn_resize) ee->func.fn_resize(ee); | ||
1103 | } | ||
1104 | return ECORE_CALLBACK_PASS_ON; | ||
1105 | } | ||
1106 | |||
1107 | static Eina_Bool | ||
1108 | _ecore_evas_x_event_window_delete_request(void *data __UNUSED__, int type __UNUSED__, void *event) | ||
1109 | { | ||
1110 | Ecore_Evas *ee; | ||
1111 | Ecore_X_Event_Window_Delete_Request *e; | ||
1112 | |||
1113 | e = event; | ||
1114 | ee = ecore_event_window_match(e->win); | ||
1115 | if (!ee) return ECORE_CALLBACK_PASS_ON; /* pass on event */ | ||
1116 | if (e->win != ee->prop.window) return ECORE_CALLBACK_PASS_ON; | ||
1117 | if (ee->func.fn_delete_request) ee->func.fn_delete_request(ee); | ||
1118 | return ECORE_CALLBACK_PASS_ON; | ||
1119 | } | ||
1120 | |||
1121 | static Eina_Bool | ||
1122 | _ecore_evas_x_event_window_show(void *data __UNUSED__, int type __UNUSED__, void *event) | ||
1123 | { | ||
1124 | Ecore_Evas *ee; | ||
1125 | Ecore_X_Event_Window_Show *e; | ||
1126 | static int first_map_bug = -1; | ||
1127 | |||
1128 | e = event; | ||
1129 | ee = ecore_event_window_match(e->win); | ||
1130 | if (!ee) return ECORE_CALLBACK_PASS_ON; /* pass on event */ | ||
1131 | if (e->win != ee->prop.window) return ECORE_CALLBACK_PASS_ON; | ||
1132 | if (first_map_bug < 0) | ||
1133 | { | ||
1134 | char *bug = NULL; | ||
1135 | |||
1136 | if ((bug = getenv("ECORE_EVAS_GL_FIRST_MAP_BUG"))) | ||
1137 | first_map_bug = atoi(bug); | ||
1138 | else | ||
1139 | first_map_bug = 0; | ||
1140 | } | ||
1141 | if ((first_map_bug) && (!strcmp(ee->driver, "opengl_x11"))) | ||
1142 | evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h); | ||
1143 | if (ee->visible) return ECORE_CALLBACK_PASS_ON; | ||
1144 | // if (ee->visible) return ECORE_CALLBACK_DONE; | ||
1145 | // printf("SHOW EVENT %p\n", ee); | ||
1146 | ee->visible = 1; | ||
1147 | if (ee->func.fn_show) ee->func.fn_show(ee); | ||
1148 | return ECORE_CALLBACK_PASS_ON; | ||
1149 | } | ||
1150 | |||
1151 | static Eina_Bool | ||
1152 | _ecore_evas_x_event_window_hide(void *data __UNUSED__, int type __UNUSED__, void *event) | ||
1153 | { | ||
1154 | Ecore_Evas *ee; | ||
1155 | Ecore_X_Event_Window_Hide *e; | ||
1156 | |||
1157 | e = event; | ||
1158 | ee = ecore_event_window_match(e->win); | ||
1159 | if (!ee) return ECORE_CALLBACK_PASS_ON; /* pass on event */ | ||
1160 | if (e->win != ee->prop.window) return ECORE_CALLBACK_PASS_ON; | ||
1161 | if (ee->in) | ||
1162 | { | ||
1163 | evas_event_feed_mouse_cancel(ee->evas, e->time, NULL); | ||
1164 | evas_event_feed_mouse_out(ee->evas, e->time, NULL); | ||
1165 | if (ee->func.fn_mouse_out) ee->func.fn_mouse_out(ee); | ||
1166 | if (ee->prop.cursor.object) evas_object_hide(ee->prop.cursor.object); | ||
1167 | ee->in = EINA_FALSE; | ||
1168 | } | ||
1169 | if (!ee->visible) return ECORE_CALLBACK_PASS_ON; | ||
1170 | // if (!ee->visible) return ECORE_CALLBACK_DONE; | ||
1171 | // printf("HIDE EVENT %p\n", ee); | ||
1172 | ee->visible = 0; | ||
1173 | if (ee->func.fn_hide) ee->func.fn_hide(ee); | ||
1174 | return ECORE_CALLBACK_PASS_ON; | ||
1175 | } | ||
1176 | |||
1177 | /* FIXME, should be in idler */ | ||
1178 | /* FIXME, round trip */ | ||
1179 | static void | ||
1180 | _ecore_evas_x_size_pos_hints_update(Ecore_Evas *ee) | ||
1181 | { | ||
1182 | ecore_x_icccm_size_pos_hints_set(ee->prop.window, | ||
1183 | ee->prop.request_pos /*request_pos */, | ||
1184 | ECORE_X_GRAVITY_NW /* gravity */, | ||
1185 | ee->prop.min.w /* min_w */, | ||
1186 | ee->prop.min.h /* min_h */, | ||
1187 | ee->prop.max.w /* max_w */, | ||
1188 | ee->prop.max.h /* max_h */, | ||
1189 | ee->prop.base.w /* base_w */, | ||
1190 | ee->prop.base.h /* base_h */, | ||
1191 | ee->prop.step.w /* step_x */, | ||
1192 | ee->prop.step.h /* step_y */, | ||
1193 | ee->prop.aspect /* min_aspect */, | ||
1194 | ee->prop.aspect /* max_aspect */); | ||
1195 | } | ||
1196 | |||
1197 | /* FIXME, should be in idler */ | ||
1198 | static void | ||
1199 | _ecore_evas_x_state_update(Ecore_Evas *ee) | ||
1200 | { | ||
1201 | Ecore_X_Window_State state[10]; | ||
1202 | int num = 0; | ||
1203 | |||
1204 | if (ee->prop.modal) | ||
1205 | state[num++] = ECORE_X_WINDOW_STATE_MODAL; | ||
1206 | if (ee->prop.sticky) | ||
1207 | state[num++] = ECORE_X_WINDOW_STATE_STICKY; | ||
1208 | if (ee->prop.maximized) | ||
1209 | state[num++] = ECORE_X_WINDOW_STATE_MAXIMIZED_VERT; | ||
1210 | if (ee->prop.maximized) | ||
1211 | state[num++] = ECORE_X_WINDOW_STATE_MAXIMIZED_HORZ; | ||
1212 | // if (bd->client.netwm.state.shaded) | ||
1213 | // state[num++] = ECORE_X_WINDOW_STATE_SHADED; | ||
1214 | if (ee->prop.focus_skip) | ||
1215 | state[num++] = ECORE_X_WINDOW_STATE_SKIP_TASKBAR; | ||
1216 | if (ee->prop.focus_skip) | ||
1217 | state[num++] = ECORE_X_WINDOW_STATE_SKIP_PAGER; | ||
1218 | // if (bd->client.netwm.state.hidden) | ||
1219 | // state[num++] = ECORE_X_WINDOW_STATE_HIDDEN; | ||
1220 | if (ee->engine.x.state.fullscreen) | ||
1221 | state[num++] = ECORE_X_WINDOW_STATE_FULLSCREEN; | ||
1222 | if (ee->engine.x.state.above) | ||
1223 | state[num++] = ECORE_X_WINDOW_STATE_ABOVE; | ||
1224 | if (ee->engine.x.state.below) | ||
1225 | state[num++] = ECORE_X_WINDOW_STATE_BELOW; | ||
1226 | if (ee->prop.demand_attention) | ||
1227 | state[num++] = ECORE_X_WINDOW_STATE_DEMANDS_ATTENTION; | ||
1228 | |||
1229 | ecore_x_netwm_window_state_set(ee->prop.window, state, num); | ||
1230 | } | ||
1231 | |||
1232 | static void | ||
1233 | _ecore_evas_x_layer_update(Ecore_Evas *ee) | ||
1234 | { | ||
1235 | if (ee->should_be_visible) | ||
1236 | { | ||
1237 | /* We need to send a netwm request to the wm */ | ||
1238 | /* FIXME: Do we have to remove old state before adding new? */ | ||
1239 | if (ee->prop.layer < 3) | ||
1240 | { | ||
1241 | if (ee->engine.x.state.above) | ||
1242 | { | ||
1243 | ee->engine.x.state.above = 0; | ||
1244 | ecore_x_netwm_state_request_send(ee->prop.window, | ||
1245 | ee->engine.x.win_root, | ||
1246 | ECORE_X_WINDOW_STATE_ABOVE, -1, 0); | ||
1247 | } | ||
1248 | if (!ee->engine.x.state.below) | ||
1249 | { | ||
1250 | ee->engine.x.state.below = 1; | ||
1251 | ecore_x_netwm_state_request_send(ee->prop.window, | ||
1252 | ee->engine.x.win_root, | ||
1253 | ECORE_X_WINDOW_STATE_BELOW, -1, 1); | ||
1254 | } | ||
1255 | } | ||
1256 | else if (ee->prop.layer > 5) | ||
1257 | { | ||
1258 | if (ee->engine.x.state.below) | ||
1259 | { | ||
1260 | ee->engine.x.state.below = 0; | ||
1261 | ecore_x_netwm_state_request_send(ee->prop.window, | ||
1262 | ee->engine.x.win_root, | ||
1263 | ECORE_X_WINDOW_STATE_BELOW, -1, 0); | ||
1264 | } | ||
1265 | if (!ee->engine.x.state.above) | ||
1266 | { | ||
1267 | ee->engine.x.state.above = 1; | ||
1268 | ecore_x_netwm_state_request_send(ee->prop.window, | ||
1269 | ee->engine.x.win_root, | ||
1270 | ECORE_X_WINDOW_STATE_ABOVE, -1, 1); | ||
1271 | } | ||
1272 | } | ||
1273 | else | ||
1274 | { | ||
1275 | if (ee->engine.x.state.below) | ||
1276 | { | ||
1277 | ee->engine.x.state.below = 0; | ||
1278 | ecore_x_netwm_state_request_send(ee->prop.window, | ||
1279 | ee->engine.x.win_root, | ||
1280 | ECORE_X_WINDOW_STATE_BELOW, -1, 0); | ||
1281 | } | ||
1282 | if (ee->engine.x.state.above) | ||
1283 | { | ||
1284 | ee->engine.x.state.above = 0; | ||
1285 | ecore_x_netwm_state_request_send(ee->prop.window, | ||
1286 | ee->engine.x.win_root, | ||
1287 | ECORE_X_WINDOW_STATE_ABOVE, -1, 0); | ||
1288 | } | ||
1289 | } | ||
1290 | } | ||
1291 | else | ||
1292 | { | ||
1293 | /* Just set the state */ | ||
1294 | if (ee->prop.layer < 3) | ||
1295 | { | ||
1296 | if ((ee->engine.x.state.above) || (!ee->engine.x.state.below)) | ||
1297 | { | ||
1298 | ee->engine.x.state.above = 0; | ||
1299 | ee->engine.x.state.below = 1; | ||
1300 | _ecore_evas_x_state_update(ee); | ||
1301 | } | ||
1302 | } | ||
1303 | else if (ee->prop.layer > 5) | ||
1304 | { | ||
1305 | if ((!ee->engine.x.state.above) || (ee->engine.x.state.below)) | ||
1306 | { | ||
1307 | ee->engine.x.state.above = 1; | ||
1308 | ee->engine.x.state.below = 0; | ||
1309 | _ecore_evas_x_state_update(ee); | ||
1310 | } | ||
1311 | } | ||
1312 | else | ||
1313 | { | ||
1314 | if ((ee->engine.x.state.above) || (ee->engine.x.state.below)) | ||
1315 | { | ||
1316 | ee->engine.x.state.above = 0; | ||
1317 | ee->engine.x.state.below = 0; | ||
1318 | _ecore_evas_x_state_update(ee); | ||
1319 | } | ||
1320 | } | ||
1321 | } | ||
1322 | /* FIXME: Set gnome layer */ | ||
1323 | } | ||
1324 | |||
1325 | static int | ||
1326 | _ecore_evas_x_init(void) | ||
1327 | { | ||
1328 | _ecore_evas_init_count++; | ||
1329 | if (_ecore_evas_init_count > 1) return _ecore_evas_init_count; | ||
1330 | ecore_evas_event_handlers[0] = | ||
1331 | ecore_event_handler_add(ECORE_X_EVENT_MOUSE_IN, | ||
1332 | _ecore_evas_x_event_mouse_in, NULL); | ||
1333 | ecore_evas_event_handlers[1] = | ||
1334 | ecore_event_handler_add(ECORE_X_EVENT_MOUSE_OUT, | ||
1335 | _ecore_evas_x_event_mouse_out, NULL); | ||
1336 | ecore_evas_event_handlers[2] = | ||
1337 | ecore_event_handler_add(ECORE_X_EVENT_WINDOW_FOCUS_IN, | ||
1338 | _ecore_evas_x_event_window_focus_in, NULL); | ||
1339 | ecore_evas_event_handlers[3] = | ||
1340 | ecore_event_handler_add(ECORE_X_EVENT_WINDOW_FOCUS_OUT, | ||
1341 | _ecore_evas_x_event_window_focus_out, NULL); | ||
1342 | ecore_evas_event_handlers[4] = | ||
1343 | ecore_event_handler_add(ECORE_X_EVENT_WINDOW_DAMAGE, | ||
1344 | _ecore_evas_x_event_window_damage, NULL); | ||
1345 | ecore_evas_event_handlers[5] = | ||
1346 | ecore_event_handler_add(ECORE_X_EVENT_WINDOW_DESTROY, | ||
1347 | _ecore_evas_x_event_window_destroy, NULL); | ||
1348 | ecore_evas_event_handlers[6] = | ||
1349 | ecore_event_handler_add(ECORE_X_EVENT_WINDOW_CONFIGURE, | ||
1350 | _ecore_evas_x_event_window_configure, NULL); | ||
1351 | ecore_evas_event_handlers[7] = | ||
1352 | ecore_event_handler_add(ECORE_X_EVENT_WINDOW_DELETE_REQUEST, | ||
1353 | _ecore_evas_x_event_window_delete_request, NULL); | ||
1354 | ecore_evas_event_handlers[8] = | ||
1355 | ecore_event_handler_add(ECORE_X_EVENT_WINDOW_SHOW, | ||
1356 | _ecore_evas_x_event_window_show, NULL); | ||
1357 | ecore_evas_event_handlers[9] = | ||
1358 | ecore_event_handler_add(ECORE_X_EVENT_WINDOW_HIDE, | ||
1359 | _ecore_evas_x_event_window_hide, NULL); | ||
1360 | ecore_evas_event_handlers[10] = | ||
1361 | ecore_event_handler_add(ECORE_X_EVENT_WINDOW_PROPERTY, | ||
1362 | _ecore_evas_x_event_property_change, NULL); | ||
1363 | ecore_evas_event_handlers[11] = | ||
1364 | ecore_event_handler_add(ECORE_X_EVENT_WINDOW_VISIBILITY_CHANGE, | ||
1365 | _ecore_evas_x_event_visibility_change, NULL); | ||
1366 | ecore_evas_event_handlers[12] = | ||
1367 | ecore_event_handler_add(ECORE_X_EVENT_CLIENT_MESSAGE, | ||
1368 | _ecore_evas_x_event_client_message, NULL); | ||
1369 | ecore_event_evas_init(); | ||
1370 | return _ecore_evas_init_count; | ||
1371 | } | ||
1372 | |||
1373 | static void | ||
1374 | _ecore_evas_x_free(Ecore_Evas *ee) | ||
1375 | { | ||
1376 | _ecore_evas_x_group_leader_unset(ee); | ||
1377 | _ecore_evas_x_sync_set(ee); | ||
1378 | if (ee->engine.x.win_shaped_input) | ||
1379 | ecore_x_window_free(ee->engine.x.win_shaped_input); | ||
1380 | ecore_x_window_free(ee->prop.window); | ||
1381 | if (ee->engine.x.pmap) ecore_x_pixmap_free(ee->engine.x.pmap); | ||
1382 | if (ee->engine.x.mask) ecore_x_pixmap_free(ee->engine.x.mask); | ||
1383 | if (ee->engine.x.gc) ecore_x_gc_free(ee->engine.x.gc); | ||
1384 | if (ee->engine.x.damages) ecore_x_xregion_free(ee->engine.x.damages); | ||
1385 | ee->engine.x.pmap = 0; | ||
1386 | ee->engine.x.mask = 0; | ||
1387 | ee->engine.x.gc = 0; | ||
1388 | ee->engine.x.damages = NULL; | ||
1389 | ecore_event_window_unregister(ee->prop.window); | ||
1390 | while (ee->engine.x.win_extra) | ||
1391 | { | ||
1392 | Ecore_X_Window *winp; | ||
1393 | |||
1394 | winp = ee->engine.x.win_extra->data; | ||
1395 | ee->engine.x.win_extra = | ||
1396 | eina_list_remove_list(ee->engine.x.win_extra, ee->engine.x.win_extra); | ||
1397 | ecore_event_window_unregister(*winp); | ||
1398 | free(winp); | ||
1399 | } | ||
1400 | _ecore_evas_x_shutdown(); | ||
1401 | ecore_x_shutdown(); | ||
1402 | } | ||
1403 | |||
1404 | static void | ||
1405 | _ecore_evas_x_callback_delete_request_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func) | ||
1406 | { | ||
1407 | ee->func.fn_delete_request = func; | ||
1408 | _ecore_evas_x_protocols_set(ee); | ||
1409 | _ecore_evas_x_sync_set(ee); | ||
1410 | } | ||
1411 | |||
1412 | static void | ||
1413 | _ecore_evas_x_move(Ecore_Evas *ee, int x, int y) | ||
1414 | { | ||
1415 | ee->req.x = x; | ||
1416 | ee->req.y = y; | ||
1417 | if (ee->engine.x.direct_resize) | ||
1418 | { | ||
1419 | if (!ee->engine.x.managed) | ||
1420 | { | ||
1421 | if ((x != ee->x) || (y != ee->y)) | ||
1422 | { | ||
1423 | ee->x = x; | ||
1424 | ee->y = y; | ||
1425 | ecore_x_window_move(ee->prop.window, x, y); | ||
1426 | if (!ee->should_be_visible) | ||
1427 | { | ||
1428 | /* We need to request pos */ | ||
1429 | ee->prop.request_pos = 1; | ||
1430 | _ecore_evas_x_size_pos_hints_update(ee); | ||
1431 | } | ||
1432 | if (ee->func.fn_move) ee->func.fn_move(ee); | ||
1433 | } | ||
1434 | } | ||
1435 | } | ||
1436 | else | ||
1437 | { | ||
1438 | if (((ee->x != x) || (ee->y != y)) || | ||
1439 | (ee->engine.x.configure_coming)) | ||
1440 | { | ||
1441 | ee->engine.x.configure_coming = 1; | ||
1442 | if (!ee->engine.x.managed) | ||
1443 | { | ||
1444 | ee->x = x; | ||
1445 | ee->y = y; | ||
1446 | } | ||
1447 | ecore_x_window_move(ee->prop.window, x, y); | ||
1448 | } | ||
1449 | if (!ee->should_be_visible) | ||
1450 | { | ||
1451 | /* We need to request pos */ | ||
1452 | ee->prop.request_pos = 1; | ||
1453 | _ecore_evas_x_size_pos_hints_update(ee); | ||
1454 | } | ||
1455 | } | ||
1456 | } | ||
1457 | |||
1458 | static void | ||
1459 | _ecore_evas_x_managed_move(Ecore_Evas *ee, int x, int y) | ||
1460 | { | ||
1461 | ee->req.x = x; | ||
1462 | ee->req.y = y; | ||
1463 | if (ee->engine.x.direct_resize) | ||
1464 | { | ||
1465 | ee->engine.x.managed = 1; | ||
1466 | if ((x != ee->x) || (y != ee->y)) | ||
1467 | { | ||
1468 | ee->x = x; | ||
1469 | ee->y = y; | ||
1470 | if (ee->func.fn_move) ee->func.fn_move(ee); | ||
1471 | } | ||
1472 | } | ||
1473 | } | ||
1474 | |||
1475 | static void | ||
1476 | _ecore_evas_x_resize(Ecore_Evas *ee, int w, int h) | ||
1477 | { | ||
1478 | ee->req.w = w; | ||
1479 | ee->req.h = h; | ||
1480 | if (ee->engine.x.direct_resize) | ||
1481 | { | ||
1482 | if ((ee->w != w) || (ee->h != h)) | ||
1483 | { | ||
1484 | ee->w = w; | ||
1485 | ee->h = h; | ||
1486 | ecore_x_window_resize(ee->prop.window, w, h); | ||
1487 | if ((ee->rotation == 90) || (ee->rotation == 270)) | ||
1488 | { | ||
1489 | evas_output_size_set(ee->evas, ee->h, ee->w); | ||
1490 | evas_output_viewport_set(ee->evas, 0, 0, ee->h, ee->w); | ||
1491 | } | ||
1492 | else | ||
1493 | { | ||
1494 | evas_output_size_set(ee->evas, ee->w, ee->h); | ||
1495 | evas_output_viewport_set(ee->evas, 0, 0, ee->w, ee->h); | ||
1496 | } | ||
1497 | if (ee->prop.avoid_damage) | ||
1498 | { | ||
1499 | int pdam; | ||
1500 | |||
1501 | pdam = ecore_evas_avoid_damage_get(ee); | ||
1502 | ecore_evas_avoid_damage_set(ee, 0); | ||
1503 | ecore_evas_avoid_damage_set(ee, pdam); | ||
1504 | } | ||
1505 | if ((ee->shaped) || (ee->alpha)) | ||
1506 | _ecore_evas_x_resize_shape(ee); | ||
1507 | if (ee->func.fn_resize) ee->func.fn_resize(ee); | ||
1508 | } | ||
1509 | } | ||
1510 | else if (((ee->w != w) || (ee->h != h)) || | ||
1511 | (ee->engine.x.configure_coming)) | ||
1512 | { | ||
1513 | ee->engine.x.configure_coming = 1; | ||
1514 | ecore_x_window_resize(ee->prop.window, w, h); | ||
1515 | } | ||
1516 | } | ||
1517 | |||
1518 | static void | ||
1519 | _ecore_evas_x_move_resize(Ecore_Evas *ee, int x, int y, int w, int h) | ||
1520 | { | ||
1521 | ee->req.x = x; | ||
1522 | ee->req.y = y; | ||
1523 | ee->req.w = w; | ||
1524 | ee->req.h = h; | ||
1525 | if (ee->engine.x.direct_resize) | ||
1526 | { | ||
1527 | if ((ee->w != w) || (ee->h != h) || (x != ee->x) || (y != ee->y)) | ||
1528 | { | ||
1529 | int change_size = 0, change_pos = 0; | ||
1530 | |||
1531 | if ((ee->w != w) || (ee->h != h)) change_size = 1; | ||
1532 | if (!ee->engine.x.managed) | ||
1533 | { | ||
1534 | if ((x != ee->x) || (y != ee->y)) change_pos = 1; | ||
1535 | } | ||
1536 | ecore_x_window_move_resize(ee->prop.window, x, y, w, h); | ||
1537 | if (!ee->engine.x.managed) | ||
1538 | { | ||
1539 | ee->x = x; | ||
1540 | ee->y = y; | ||
1541 | } | ||
1542 | ee->w = w; | ||
1543 | ee->h = h; | ||
1544 | if ((ee->rotation == 90) || (ee->rotation == 270)) | ||
1545 | { | ||
1546 | evas_output_size_set(ee->evas, ee->h, ee->w); | ||
1547 | evas_output_viewport_set(ee->evas, 0, 0, ee->h, ee->w); | ||
1548 | } | ||
1549 | else | ||
1550 | { | ||
1551 | evas_output_size_set(ee->evas, ee->w, ee->h); | ||
1552 | evas_output_viewport_set(ee->evas, 0, 0, ee->w, ee->h); | ||
1553 | } | ||
1554 | if (ee->prop.avoid_damage) | ||
1555 | { | ||
1556 | int pdam; | ||
1557 | |||
1558 | pdam = ecore_evas_avoid_damage_get(ee); | ||
1559 | ecore_evas_avoid_damage_set(ee, 0); | ||
1560 | ecore_evas_avoid_damage_set(ee, pdam); | ||
1561 | } | ||
1562 | if ((ee->shaped) || (ee->alpha)) | ||
1563 | _ecore_evas_x_resize_shape(ee); | ||
1564 | if (change_pos) | ||
1565 | { | ||
1566 | if (ee->func.fn_move) ee->func.fn_move(ee); | ||
1567 | } | ||
1568 | if (change_size) | ||
1569 | { | ||
1570 | if (ee->func.fn_resize) ee->func.fn_resize(ee); | ||
1571 | } | ||
1572 | } | ||
1573 | } | ||
1574 | else if (((ee->w != w) || (ee->h != h) || (ee->x != x) || (ee->y != y)) || | ||
1575 | (ee->engine.x.configure_coming)) | ||
1576 | { | ||
1577 | ee->engine.x.configure_coming = 1; | ||
1578 | ecore_x_window_move_resize(ee->prop.window, x, y, w, h); | ||
1579 | if (!ee->engine.x.managed) | ||
1580 | { | ||
1581 | ee->x = x; | ||
1582 | ee->y = y; | ||
1583 | } | ||
1584 | } | ||
1585 | } | ||
1586 | |||
1587 | static void | ||
1588 | _ecore_evas_x_rotation_set_internal(Ecore_Evas *ee, int rotation, int resize, | ||
1589 | Evas_Engine_Info *einfo) | ||
1590 | { | ||
1591 | int rot_dif; | ||
1592 | |||
1593 | rot_dif = ee->rotation - rotation; | ||
1594 | if (rot_dif < 0) rot_dif = -rot_dif; | ||
1595 | |||
1596 | if (rot_dif != 180) | ||
1597 | { | ||
1598 | int minw, minh, maxw, maxh, basew, baseh, stepw, steph; | ||
1599 | |||
1600 | if (!evas_engine_info_set(ee->evas, einfo)) | ||
1601 | { | ||
1602 | ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); | ||
1603 | } | ||
1604 | |||
1605 | if (!resize) | ||
1606 | { | ||
1607 | ee->engine.x.configure_coming = 1; | ||
1608 | if (!ee->prop.fullscreen) | ||
1609 | { | ||
1610 | ecore_x_window_resize(ee->prop.window, ee->req.h, ee->req.w); | ||
1611 | ee->expecting_resize.w = ee->h; | ||
1612 | ee->expecting_resize.h = ee->w; | ||
1613 | } | ||
1614 | else | ||
1615 | { | ||
1616 | int w, h; | ||
1617 | |||
1618 | ecore_x_window_size_get(ee->prop.window, &w, &h); | ||
1619 | ecore_x_window_resize(ee->prop.window, h, w); | ||
1620 | if ((rotation == 0) || (rotation == 180)) | ||
1621 | { | ||
1622 | evas_output_size_set(ee->evas, ee->req.w, ee->req.h); | ||
1623 | evas_output_viewport_set(ee->evas, 0, 0, ee->req.w, ee->req.h); | ||
1624 | } | ||
1625 | else | ||
1626 | { | ||
1627 | evas_output_size_set(ee->evas, ee->req.h, ee->req.w); | ||
1628 | evas_output_viewport_set(ee->evas, 0, 0, ee->req.h, ee->req.w); | ||
1629 | } | ||
1630 | if (ee->func.fn_resize) ee->func.fn_resize(ee); | ||
1631 | } | ||
1632 | if ((ee->rotation == 90) || (ee->rotation == 270)) | ||
1633 | evas_damage_rectangle_add(ee->evas, 0, 0, ee->req.h, ee->req.w); | ||
1634 | else | ||
1635 | evas_damage_rectangle_add(ee->evas, 0, 0, ee->req.w, ee->req.h); | ||
1636 | } | ||
1637 | else | ||
1638 | { | ||
1639 | /* int w, h; */ | ||
1640 | |||
1641 | /* ecore_x_window_size_get(ee->prop.window, &w, &h); */ | ||
1642 | if ((rotation == 0) || (rotation == 180)) | ||
1643 | { | ||
1644 | evas_output_size_set(ee->evas, ee->w, ee->h); | ||
1645 | evas_output_viewport_set(ee->evas, 0, 0, ee->w, ee->h); | ||
1646 | } | ||
1647 | else | ||
1648 | { | ||
1649 | evas_output_size_set(ee->evas, ee->h, ee->w); | ||
1650 | evas_output_viewport_set(ee->evas, 0, 0, ee->h, ee->w); | ||
1651 | } | ||
1652 | if (ee->func.fn_resize) ee->func.fn_resize(ee); | ||
1653 | if ((ee->rotation == 90) || (ee->rotation == 270)) | ||
1654 | evas_damage_rectangle_add(ee->evas, 0, 0, ee->h, ee->w); | ||
1655 | else | ||
1656 | evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h); | ||
1657 | } | ||
1658 | ecore_evas_size_min_get(ee, &minw, &minh); | ||
1659 | ecore_evas_size_max_get(ee, &maxw, &maxh); | ||
1660 | ecore_evas_size_base_get(ee, &basew, &baseh); | ||
1661 | ecore_evas_size_step_get(ee, &stepw, &steph); | ||
1662 | ee->rotation = rotation; | ||
1663 | ecore_evas_size_min_set(ee, minh, minw); | ||
1664 | ecore_evas_size_max_set(ee, maxh, maxw); | ||
1665 | ecore_evas_size_base_set(ee, baseh, basew); | ||
1666 | ecore_evas_size_step_set(ee, steph, stepw); | ||
1667 | _ecore_evas_mouse_move_process(ee, ee->mouse.x, ee->mouse.y, | ||
1668 | ecore_x_current_time_get()); | ||
1669 | } | ||
1670 | else | ||
1671 | { | ||
1672 | if (!evas_engine_info_set(ee->evas, einfo)) | ||
1673 | { | ||
1674 | ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); | ||
1675 | } | ||
1676 | ee->rotation = rotation; | ||
1677 | _ecore_evas_mouse_move_process(ee, ee->mouse.x, ee->mouse.y, | ||
1678 | ecore_x_current_time_get()); | ||
1679 | if (ee->func.fn_resize) ee->func.fn_resize(ee); | ||
1680 | |||
1681 | if ((ee->rotation == 90) || (ee->rotation == 270)) | ||
1682 | evas_damage_rectangle_add(ee->evas, 0, 0, ee->h, ee->w); | ||
1683 | else | ||
1684 | evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h); | ||
1685 | } | ||
1686 | } | ||
1687 | |||
1688 | static void | ||
1689 | _ecore_evas_x_rotation_set(Ecore_Evas *ee, int rotation, int resize) | ||
1690 | { | ||
1691 | int angles[2]; | ||
1692 | angles[0] = rotation; | ||
1693 | angles[1] = ee->rotation; | ||
1694 | |||
1695 | if (ee->rotation == rotation) return; | ||
1696 | if (!strcmp(ee->driver, "opengl_x11")) | ||
1697 | { | ||
1698 | #ifdef BUILD_ECORE_EVAS_OPENGL_X11 | ||
1699 | Evas_Engine_Info_GL_X11 *einfo; | ||
1700 | |||
1701 | einfo = (Evas_Engine_Info_GL_X11 *)evas_engine_info_get(ee->evas); | ||
1702 | if (!einfo) return; | ||
1703 | einfo->info.rotation = rotation; | ||
1704 | _ecore_evas_x_rotation_set_internal(ee, rotation, resize, | ||
1705 | (Evas_Engine_Info *)einfo); | ||
1706 | ecore_x_window_prop_property_set(ee->prop.window, | ||
1707 | ECORE_X_ATOM_E_ILLUME_ROTATE_WINDOW_ANGLE, | ||
1708 | ECORE_X_ATOM_CARDINAL, 32, &angles, 2); | ||
1709 | #endif /* BUILD_ECORE_EVAS_OPENGL_X11 */ | ||
1710 | } | ||
1711 | else if (!strcmp(ee->driver, "software_x11")) | ||
1712 | { | ||
1713 | #ifdef BUILD_ECORE_EVAS_SOFTWARE_X11 | ||
1714 | Evas_Engine_Info_Software_X11 *einfo; | ||
1715 | |||
1716 | einfo = (Evas_Engine_Info_Software_X11 *)evas_engine_info_get(ee->evas); | ||
1717 | if (!einfo) return; | ||
1718 | einfo->info.rotation = rotation; | ||
1719 | _ecore_evas_x_rotation_set_internal(ee, rotation, resize, | ||
1720 | (Evas_Engine_Info *)einfo); | ||
1721 | ecore_x_window_prop_property_set(ee->prop.window, | ||
1722 | ECORE_X_ATOM_E_ILLUME_ROTATE_WINDOW_ANGLE, | ||
1723 | ECORE_X_ATOM_CARDINAL, 32, &angles, 2); | ||
1724 | #endif /* BUILD_ECORE_EVAS_SOFTWARE_X11 */ | ||
1725 | } | ||
1726 | else if (!strcmp(ee->driver, "software_16_x11")) | ||
1727 | { | ||
1728 | #if BUILD_ECORE_EVAS_SOFTWARE_16_X11 | ||
1729 | Evas_Engine_Info_Software_16_X11 *einfo; | ||
1730 | |||
1731 | einfo = (Evas_Engine_Info_Software_16_X11 *)evas_engine_info_get(ee->evas); | ||
1732 | if (!einfo) return; | ||
1733 | einfo->info.rotation = rotation; | ||
1734 | _ecore_evas_x_rotation_set_internal(ee, rotation, resize, | ||
1735 | (Evas_Engine_Info *)einfo); | ||
1736 | ecore_x_window_prop_property_set(ee->prop.window, | ||
1737 | ECORE_X_ATOM_E_ILLUME_ROTATE_WINDOW_ANGLE, | ||
1738 | ECORE_X_ATOM_CARDINAL, 32, &angles, 2); | ||
1739 | #endif /* BUILD_ECORE_EVAS_SOFTWARE_16_X11 */ | ||
1740 | } | ||
1741 | else if (!strcmp(ee->driver, "software_8_x11")) | ||
1742 | { | ||
1743 | #if BUILD_ECORE_EVAS_SOFTWARE_8_X11 | ||
1744 | Evas_Engine_Info_Software_8_X11 *einfo; | ||
1745 | |||
1746 | einfo = (Evas_Engine_Info_Software_8_X11 *)evas_engine_info_get(ee->evas); | ||
1747 | if (!einfo) return; | ||
1748 | einfo->info.rotation = rotation; | ||
1749 | _ecore_evas_x_rotation_set_internal(ee, rotation, resize, | ||
1750 | (Evas_Engine_Info *)einfo); | ||
1751 | ecore_x_window_prop_property_set(ee->prop.window, | ||
1752 | ECORE_X_ATOM_E_ILLUME_ROTATE_WINDOW_ANGLE, | ||
1753 | ECORE_X_ATOM_CARDINAL, 32, &angles, 2); | ||
1754 | #endif /* BUILD_ECORE_EVAS_SOFTWARE_8_X11 */ | ||
1755 | } | ||
1756 | } | ||
1757 | |||
1758 | static void | ||
1759 | _ecore_evas_x_shaped_set(Ecore_Evas *ee, int shaped) | ||
1760 | { | ||
1761 | if ((ee->shaped == shaped)) return; | ||
1762 | if (!strcmp(ee->driver, "opengl_x11")) return; | ||
1763 | if (!strcmp(ee->driver, "software_x11")) | ||
1764 | { | ||
1765 | #ifdef BUILD_ECORE_EVAS_SOFTWARE_X11 | ||
1766 | Evas_Engine_Info_Software_X11 *einfo; | ||
1767 | |||
1768 | einfo = (Evas_Engine_Info_Software_X11 *)evas_engine_info_get(ee->evas); | ||
1769 | ee->shaped = shaped; | ||
1770 | if (einfo) | ||
1771 | { | ||
1772 | if (ee->shaped) | ||
1773 | { | ||
1774 | unsigned int foreground; | ||
1775 | Ecore_X_GC gc; | ||
1776 | |||
1777 | if (!ee->engine.x.mask) | ||
1778 | ee->engine.x.mask = ecore_x_pixmap_new(ee->prop.window, ee->w, ee->h, 1); | ||
1779 | foreground = 0; | ||
1780 | gc = ecore_x_gc_new(ee->engine.x.mask, | ||
1781 | ECORE_X_GC_VALUE_MASK_FOREGROUND, | ||
1782 | &foreground); | ||
1783 | ecore_x_drawable_rectangle_fill(ee->engine.x.mask, gc, | ||
1784 | 0, 0, ee->w, ee->h); | ||
1785 | ecore_x_gc_free(gc); | ||
1786 | einfo->info.mask = ee->engine.x.mask; | ||
1787 | if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) | ||
1788 | { | ||
1789 | ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); | ||
1790 | } | ||
1791 | evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h); | ||
1792 | ecore_x_window_shape_input_mask_set(ee->prop.window, 0); | ||
1793 | } | ||
1794 | else | ||
1795 | { | ||
1796 | if (ee->engine.x.mask) ecore_x_pixmap_free(ee->engine.x.mask); | ||
1797 | ee->engine.x.mask = 0; | ||
1798 | einfo->info.mask = 0; | ||
1799 | if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) | ||
1800 | { | ||
1801 | ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); | ||
1802 | } | ||
1803 | ecore_x_window_shape_mask_set(ee->prop.window, 0); | ||
1804 | ecore_x_window_shape_input_mask_set(ee->prop.window, 0); | ||
1805 | } | ||
1806 | } | ||
1807 | #endif /* BUILD_ECORE_EVAS_SOFTWARE_X11 */ | ||
1808 | } | ||
1809 | else if (!strcmp(ee->driver, "software_16_x11")) | ||
1810 | { | ||
1811 | #if BUILD_ECORE_EVAS_SOFTWARE_16_X11 | ||
1812 | # if 0 /* XXX no shaped window support for software_16_x11 */ | ||
1813 | Evas_Engine_Info_Software_16_X11 *einfo; | ||
1814 | |||
1815 | einfo = (Evas_Engine_Info_Software_16_X11 *)evas_engine_info_get(ee->evas); | ||
1816 | ee->shaped = shaped; | ||
1817 | if (einfo) | ||
1818 | { | ||
1819 | if (ee->shaped) | ||
1820 | { | ||
1821 | ee->engine.x.mask = | ||
1822 | ecore_x_pixmap_new(ee->prop.window, ee->w, ee->h, 1); | ||
1823 | einfo->info.mask = ee->engine.x.mask; | ||
1824 | if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) | ||
1825 | { | ||
1826 | ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); | ||
1827 | } | ||
1828 | evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h); | ||
1829 | } | ||
1830 | else | ||
1831 | { | ||
1832 | if (ee->engine.x.mask) ecore_x_pixmap_free(ee->engine.x.mask); | ||
1833 | ee->engine.x.mask = 0; | ||
1834 | einfo->info.mask = 0; | ||
1835 | if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) | ||
1836 | { | ||
1837 | ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); | ||
1838 | } | ||
1839 | ecore_x_window_shape_mask_set(ee->prop.window, 0); | ||
1840 | } | ||
1841 | } | ||
1842 | # endif /* XXX no shaped window support for software_16_x11 */ | ||
1843 | #endif /* BUILD_ECORE_EVAS_SOFTWARE_16_X11 */ | ||
1844 | } | ||
1845 | if (!strcmp(ee->driver, "software_8_x11")) | ||
1846 | { | ||
1847 | #if defined (BUILD_ECORE_EVAS_SOFTWARE_8_X11) | ||
1848 | Evas_Engine_Info_Software_8_X11 *einfo; | ||
1849 | |||
1850 | einfo = (Evas_Engine_Info_Software_8_X11 *)evas_engine_info_get(ee->evas); | ||
1851 | ee->shaped = shaped; | ||
1852 | if (einfo) | ||
1853 | { | ||
1854 | if (ee->shaped) | ||
1855 | { | ||
1856 | unsigned int foreground; | ||
1857 | Ecore_X_GC gc; | ||
1858 | |||
1859 | if (!ee->engine.x.mask) | ||
1860 | ee->engine.x.mask = ecore_x_pixmap_new(ee->prop.window, ee->w, ee->h, 1); | ||
1861 | foreground = 0; | ||
1862 | gc = ecore_x_gc_new(ee->engine.x.mask, | ||
1863 | ECORE_X_GC_VALUE_MASK_FOREGROUND, | ||
1864 | &foreground); | ||
1865 | ecore_x_drawable_rectangle_fill(ee->engine.x.mask, gc, | ||
1866 | 0, 0, ee->w, ee->h); | ||
1867 | ecore_x_gc_free(gc); | ||
1868 | einfo->info.mask = ee->engine.x.mask; | ||
1869 | if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) | ||
1870 | { | ||
1871 | ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); | ||
1872 | } | ||
1873 | evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h); | ||
1874 | ecore_x_window_shape_input_mask_set(ee->prop.window, 0); | ||
1875 | } | ||
1876 | else | ||
1877 | { | ||
1878 | if (ee->engine.x.mask) ecore_x_pixmap_free(ee->engine.x.mask); | ||
1879 | ee->engine.x.mask = 0; | ||
1880 | einfo->info.mask = 0; | ||
1881 | if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) | ||
1882 | { | ||
1883 | ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); | ||
1884 | } | ||
1885 | ecore_x_window_shape_mask_set(ee->prop.window, 0); | ||
1886 | ecore_x_window_shape_input_mask_set(ee->prop.window, 0); | ||
1887 | } | ||
1888 | } | ||
1889 | #endif /* BUILD_ECORE_EVAS_SOFTWARE_8_X11 */ | ||
1890 | } | ||
1891 | } | ||
1892 | |||
1893 | /* FIXME, round trip */ | ||
1894 | static void | ||
1895 | _ecore_evas_x_alpha_set(Ecore_Evas *ee, int alpha) | ||
1896 | { | ||
1897 | Ecore_X_Window_Attributes att; | ||
1898 | char *id = NULL; | ||
1899 | |||
1900 | if ((ee->alpha == alpha)) return; | ||
1901 | |||
1902 | if (!strcmp(ee->driver, "software_x11")) | ||
1903 | { | ||
1904 | #ifdef BUILD_ECORE_EVAS_SOFTWARE_X11 | ||
1905 | Evas_Engine_Info_Software_X11 *einfo; | ||
1906 | |||
1907 | einfo = (Evas_Engine_Info_Software_X11 *)evas_engine_info_get(ee->evas); | ||
1908 | if (!einfo) return; | ||
1909 | |||
1910 | if (!ecore_x_composite_query()) return; | ||
1911 | |||
1912 | ee->shaped = 0; | ||
1913 | ee->alpha = alpha; | ||
1914 | ecore_x_window_free(ee->prop.window); | ||
1915 | ecore_event_window_unregister(ee->prop.window); | ||
1916 | if (ee->alpha) | ||
1917 | { | ||
1918 | if (ee->prop.override) | ||
1919 | ee->prop.window = ecore_x_window_override_argb_new(ee->engine.x.win_root, ee->req.x, ee->req.y, ee->req.w, ee->req.h); | ||
1920 | else | ||
1921 | ee->prop.window = ecore_x_window_argb_new(ee->engine.x.win_root, ee->req.x, ee->req.y, ee->req.w, ee->req.h); | ||
1922 | if (!ee->engine.x.mask) | ||
1923 | ee->engine.x.mask = ecore_x_pixmap_new(ee->prop.window, ee->req.w, ee->req.h, 1); | ||
1924 | } | ||
1925 | else | ||
1926 | { | ||
1927 | if (ee->prop.override) | ||
1928 | ee->prop.window = ecore_x_window_override_new(ee->engine.x.win_root, ee->req.x, ee->req.y, ee->req.w, ee->req.h); | ||
1929 | else | ||
1930 | ee->prop.window = ecore_x_window_new(ee->engine.x.win_root, ee->req.x, ee->req.y, ee->req.w, ee->req.h); | ||
1931 | if (ee->engine.x.mask) ecore_x_pixmap_free(ee->engine.x.mask); | ||
1932 | ee->engine.x.mask = 0; | ||
1933 | ecore_x_window_shape_input_mask_set(ee->prop.window, 0); | ||
1934 | } | ||
1935 | |||
1936 | einfo->info.destination_alpha = alpha; | ||
1937 | |||
1938 | ecore_x_window_attributes_get(ee->prop.window, &att); | ||
1939 | einfo->info.visual = att.visual; | ||
1940 | einfo->info.colormap = att.colormap; | ||
1941 | einfo->info.depth = att.depth; | ||
1942 | |||
1943 | // if (ee->engine.x.mask) ecore_x_pixmap_free(ee->engine.x.mask); | ||
1944 | // ee->engine.x.mask = 0; | ||
1945 | einfo->info.mask = ee->engine.x.mask; | ||
1946 | einfo->info.drawable = ee->prop.window; | ||
1947 | if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) | ||
1948 | { | ||
1949 | ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); | ||
1950 | } | ||
1951 | evas_damage_rectangle_add(ee->evas, 0, 0, ee->req.w, ee->req.h); | ||
1952 | ecore_x_window_shape_mask_set(ee->prop.window, 0); | ||
1953 | ecore_x_input_multi_select(ee->prop.window); | ||
1954 | ecore_event_window_register(ee->prop.window, ee, ee->evas, | ||
1955 | (Ecore_Event_Mouse_Move_Cb)_ecore_evas_mouse_move_process, | ||
1956 | (Ecore_Event_Multi_Move_Cb)_ecore_evas_mouse_multi_move_process, | ||
1957 | (Ecore_Event_Multi_Down_Cb)_ecore_evas_mouse_multi_down_process, | ||
1958 | (Ecore_Event_Multi_Up_Cb)_ecore_evas_mouse_multi_up_process); | ||
1959 | if (ee->prop.borderless) | ||
1960 | ecore_x_mwm_borderless_set(ee->prop.window, ee->prop.borderless); | ||
1961 | if (ee->visible) ecore_x_window_show(ee->prop.window); | ||
1962 | if (ee->prop.focused) ecore_x_window_focus(ee->prop.window); | ||
1963 | if (ee->prop.title) | ||
1964 | { | ||
1965 | ecore_x_icccm_title_set(ee->prop.window, ee->prop.title); | ||
1966 | ecore_x_netwm_name_set(ee->prop.window, ee->prop.title); | ||
1967 | } | ||
1968 | _ecore_evas_x_hints_update(ee); | ||
1969 | _ecore_evas_x_group_leader_update(ee); | ||
1970 | ecore_x_window_defaults_set(ee->prop.window); | ||
1971 | _ecore_evas_x_protocols_set(ee); | ||
1972 | _ecore_evas_x_sync_set(ee); | ||
1973 | #endif /* BUILD_ECORE_EVAS_SOFTWARE_X11 */ | ||
1974 | if ((id = getenv("DESKTOP_STARTUP_ID"))) | ||
1975 | { | ||
1976 | ecore_x_netwm_startup_id_set(ee->prop.window, id); | ||
1977 | /* NB: on linux this may simply empty the env as opposed to completely | ||
1978 | * unset it to being empty - unsure as solartis libc crashes looking | ||
1979 | * for the '=' char */ | ||
1980 | // putenv((char*)"DESKTOP_STARTUP_ID="); | ||
1981 | } | ||
1982 | } | ||
1983 | else if (!strcmp(ee->driver, "opengl_x11")) | ||
1984 | { | ||
1985 | #ifdef BUILD_ECORE_EVAS_OPENGL_X11 | ||
1986 | Evas_Engine_Info_GL_X11 *einfo; | ||
1987 | |||
1988 | einfo = (Evas_Engine_Info_GL_X11 *)evas_engine_info_get(ee->evas); | ||
1989 | if (!einfo) return; | ||
1990 | |||
1991 | if (!ecore_x_composite_query()) return; | ||
1992 | |||
1993 | ee->shaped = 0; | ||
1994 | ee->alpha = alpha; | ||
1995 | ecore_x_window_free(ee->prop.window); | ||
1996 | ecore_event_window_unregister(ee->prop.window); | ||
1997 | ee->prop.window = 0; | ||
1998 | |||
1999 | einfo->info.destination_alpha = alpha; | ||
2000 | |||
2001 | if (ee->engine.x.win_root != 0) | ||
2002 | { | ||
2003 | /* FIXME: round trip in ecore_x_window_argb_get */ | ||
2004 | if (ecore_x_window_argb_get(ee->engine.x.win_root)) | ||
2005 | { | ||
2006 | ee->prop.window = | ||
2007 | _ecore_evas_x_gl_window_new(ee, ee->engine.x.win_root, | ||
2008 | ee->req.x, ee->req.y, | ||
2009 | ee->req.w, ee->req.h, | ||
2010 | ee->prop.override, 1, NULL); | ||
2011 | } | ||
2012 | else | ||
2013 | { | ||
2014 | ee->prop.window = | ||
2015 | _ecore_evas_x_gl_window_new(ee, ee->engine.x.win_root, | ||
2016 | ee->req.x, ee->req.y, | ||
2017 | ee->req.w, ee->req.h, | ||
2018 | ee->prop.override, ee->alpha, | ||
2019 | NULL); | ||
2020 | } | ||
2021 | } | ||
2022 | else | ||
2023 | { | ||
2024 | ee->prop.window = | ||
2025 | _ecore_evas_x_gl_window_new(ee, ee->engine.x.win_root, | ||
2026 | ee->req.x, ee->req.y, | ||
2027 | ee->req.w, ee->req.h, | ||
2028 | ee->prop.override, ee->alpha, NULL); | ||
2029 | } | ||
2030 | |||
2031 | if (!ee->prop.window) return; | ||
2032 | /* | ||
2033 | if (ee->alpha) | ||
2034 | { | ||
2035 | if (ee->prop.override) | ||
2036 | ee->prop.window = ecore_x_window_override_argb_new(ee->engine.x.win_root, ee->req.x, ee->req.y, ee->req.w, ee->req.h); | ||
2037 | else | ||
2038 | ee->prop.window = ecore_x_window_argb_new(ee->engine.x.win_root, ee->req.x, ee->req.y, ee->req.w, ee->req.h); | ||
2039 | if (!ee->engine.x.mask) | ||
2040 | ee->engine.x.mask = ecore_x_pixmap_new(ee->prop.window, ee->req.w, ee->req.h, 1); | ||
2041 | } | ||
2042 | else | ||
2043 | { | ||
2044 | if (ee->prop.override) | ||
2045 | ee->prop.window = ecore_x_window_override_new(ee->engine.x.win_root, ee->req.x, ee->req.y, ee->req.w, ee->req.h); | ||
2046 | else | ||
2047 | ee->prop.window = ecore_x_window_new(ee->engine.x.win_root, ee->req.x, ee->req.y, ee->req.w, ee->req.h); | ||
2048 | if (ee->engine.x.mask) ecore_x_pixmap_free(ee->engine.x.mask); | ||
2049 | ee->engine.x.mask = 0; | ||
2050 | ecore_x_window_shape_input_mask_set(ee->prop.window, 0); | ||
2051 | } | ||
2052 | */ | ||
2053 | |||
2054 | ecore_x_window_attributes_get(ee->prop.window, &att); | ||
2055 | einfo->info.visual = att.visual; | ||
2056 | einfo->info.colormap = att.colormap; | ||
2057 | einfo->info.depth = att.depth; | ||
2058 | |||
2059 | // if (ee->engine.x.mask) ecore_x_pixmap_free(ee->engine.x.mask); | ||
2060 | // ee->engine.x.mask = 0; | ||
2061 | // einfo->info.mask = ee->engine.x.mask; | ||
2062 | einfo->info.drawable = ee->prop.window; | ||
2063 | if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) | ||
2064 | { | ||
2065 | ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); | ||
2066 | } | ||
2067 | evas_damage_rectangle_add(ee->evas, 0, 0, ee->req.w, ee->req.h); | ||
2068 | // ecore_x_window_shape_mask_set(ee->prop.window, 0); | ||
2069 | ecore_x_input_multi_select(ee->prop.window); | ||
2070 | ecore_event_window_register(ee->prop.window, ee, ee->evas, | ||
2071 | (Ecore_Event_Mouse_Move_Cb)_ecore_evas_mouse_move_process, | ||
2072 | (Ecore_Event_Multi_Move_Cb)_ecore_evas_mouse_multi_move_process, | ||
2073 | (Ecore_Event_Multi_Down_Cb)_ecore_evas_mouse_multi_down_process, | ||
2074 | (Ecore_Event_Multi_Up_Cb)_ecore_evas_mouse_multi_up_process); | ||
2075 | if (ee->prop.borderless) | ||
2076 | ecore_x_mwm_borderless_set(ee->prop.window, ee->prop.borderless); | ||
2077 | if (ee->visible) ecore_x_window_show(ee->prop.window); | ||
2078 | if (ee->prop.focused) ecore_x_window_focus(ee->prop.window); | ||
2079 | if (ee->prop.title) | ||
2080 | { | ||
2081 | ecore_x_icccm_title_set(ee->prop.window, ee->prop.title); | ||
2082 | ecore_x_netwm_name_set(ee->prop.window, ee->prop.title); | ||
2083 | } | ||
2084 | _ecore_evas_x_hints_update(ee); | ||
2085 | _ecore_evas_x_group_leader_update(ee); | ||
2086 | ecore_x_window_defaults_set(ee->prop.window); | ||
2087 | _ecore_evas_x_protocols_set(ee); | ||
2088 | _ecore_evas_x_sync_set(ee); | ||
2089 | #endif /* BUILD_ECORE_EVAS_OPENGL_X11 */ | ||
2090 | if ((id = getenv("DESKTOP_STARTUP_ID"))) | ||
2091 | { | ||
2092 | ecore_x_netwm_startup_id_set(ee->prop.window, id); | ||
2093 | /* NB: on linux this may simply empty the env as opposed to completely | ||
2094 | * unset it to being empty - unsure as solartis libc crashes looking | ||
2095 | * for the '=' char */ | ||
2096 | // putenv((char*)"DESKTOP_STARTUP_ID="); | ||
2097 | } | ||
2098 | } | ||
2099 | else if (!strcmp(ee->driver, "software_16_x11")) | ||
2100 | { | ||
2101 | #if BUILD_ECORE_EVAS_SOFTWARE_16_X11 | ||
2102 | Evas_Engine_Info_Software_16_X11 *einfo; | ||
2103 | |||
2104 | einfo = (Evas_Engine_Info_Software_16_X11 *)evas_engine_info_get(ee->evas); | ||
2105 | if (!einfo) return; | ||
2106 | |||
2107 | ee->shaped = 0; | ||
2108 | ee->alpha = alpha; | ||
2109 | ecore_x_window_free(ee->prop.window); | ||
2110 | ecore_event_window_unregister(ee->prop.window); | ||
2111 | if (ee->alpha) | ||
2112 | { | ||
2113 | if (ee->prop.override) | ||
2114 | ee->prop.window = ecore_x_window_override_argb_new(ee->engine.x.win_root, ee->req.x, ee->req.y, ee->req.w, ee->req.h); | ||
2115 | else | ||
2116 | ee->prop.window = ecore_x_window_argb_new(ee->engine.x.win_root, ee->req.x, ee->req.y, ee->req.w, ee->req.h); | ||
2117 | if (!ee->engine.x.mask) | ||
2118 | ee->engine.x.mask = ecore_x_pixmap_new(ee->prop.window, ee->req.w, ee->req.h, 1); | ||
2119 | } | ||
2120 | else | ||
2121 | { | ||
2122 | if (ee->prop.override) | ||
2123 | ee->prop.window = ecore_x_window_override_new(ee->engine.x.win_root, ee->req.x, ee->req.y, ee->req.w, ee->req.h); | ||
2124 | else | ||
2125 | ee->prop.window = ecore_x_window_new(ee->engine.x.win_root, ee->req.x, ee->req.y, ee->req.w, ee->req.h); | ||
2126 | if (ee->engine.x.mask) ecore_x_pixmap_free(ee->engine.x.mask); | ||
2127 | ee->engine.x.mask = 0; | ||
2128 | ecore_x_window_shape_input_mask_set(ee->prop.window, 0); | ||
2129 | } | ||
2130 | |||
2131 | # if 0 /* XXX no alpha window support for software_16_x11 */ | ||
2132 | einfo->info.destination_alpha = alpha; | ||
2133 | # endif /* XXX no alpha window support for software_16_x11 */ | ||
2134 | |||
2135 | # if 0 /* XXX no shaped window support for software_16_x11 */ | ||
2136 | // if (ee->engine.x.mask) ecore_x_pixmap_free(ee->engine.x.mask); | ||
2137 | // ee->engine.x.mask = 0; | ||
2138 | einfo->info.mask = ee->engine.x.mask; | ||
2139 | # endif /* XXX no shaped window support for software_16_x11 */ | ||
2140 | |||
2141 | einfo->info.drawable = ee->prop.window; | ||
2142 | if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) | ||
2143 | { | ||
2144 | ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); | ||
2145 | } | ||
2146 | evas_damage_rectangle_add(ee->evas, 0, 0, ee->req.w, ee->req.h); | ||
2147 | ecore_x_window_shape_mask_set(ee->prop.window, 0); | ||
2148 | ecore_x_input_multi_select(ee->prop.window); | ||
2149 | ecore_event_window_register(ee->prop.window, ee, ee->evas, | ||
2150 | (Ecore_Event_Mouse_Move_Cb)_ecore_evas_mouse_move_process, | ||
2151 | (Ecore_Event_Multi_Move_Cb)_ecore_evas_mouse_multi_move_process, | ||
2152 | (Ecore_Event_Multi_Down_Cb)_ecore_evas_mouse_multi_down_process, | ||
2153 | (Ecore_Event_Multi_Up_Cb)_ecore_evas_mouse_multi_up_process); | ||
2154 | if (ee->prop.borderless) | ||
2155 | ecore_x_mwm_borderless_set(ee->prop.window, ee->prop.borderless); | ||
2156 | if (ee->visible) ecore_x_window_show(ee->prop.window); | ||
2157 | if (ee->prop.focused) ecore_x_window_focus(ee->prop.window); | ||
2158 | if (ee->prop.title) | ||
2159 | { | ||
2160 | ecore_x_icccm_title_set(ee->prop.window, ee->prop.title); | ||
2161 | ecore_x_netwm_name_set(ee->prop.window, ee->prop.title); | ||
2162 | } | ||
2163 | _ecore_evas_x_hints_update(ee); | ||
2164 | _ecore_evas_x_group_leader_update(ee); | ||
2165 | ecore_x_window_defaults_set(ee->prop.window); | ||
2166 | _ecore_evas_x_protocols_set(ee); | ||
2167 | _ecore_evas_x_sync_set(ee); | ||
2168 | #endif /* BUILD_ECORE_EVAS_SOFTWARE_16_X11 */ | ||
2169 | if ((id = getenv("DESKTOP_STARTUP_ID"))) | ||
2170 | { | ||
2171 | ecore_x_netwm_startup_id_set(ee->prop.window, id); | ||
2172 | /* NB: on linux this may simply empty the env as opposed to completely | ||
2173 | * unset it to being empty - unsure as solartis libc crashes looking | ||
2174 | * for the '=' char */ | ||
2175 | // putenv((char*)"DESKTOP_STARTUP_ID="); | ||
2176 | } | ||
2177 | } | ||
2178 | else if (!strcmp(ee->driver, "software_8_x11")) | ||
2179 | { | ||
2180 | #if defined (BUILD_ECORE_EVAS_SOFTWARE_8_X11) | ||
2181 | Evas_Engine_Info_Software_8_X11 *einfo; | ||
2182 | |||
2183 | einfo = (Evas_Engine_Info_Software_8_X11 *)evas_engine_info_get(ee->evas); | ||
2184 | if (!einfo) return; | ||
2185 | |||
2186 | ee->shaped = 0; | ||
2187 | ee->alpha = alpha; | ||
2188 | ecore_x_window_free(ee->prop.window); | ||
2189 | ecore_event_window_unregister(ee->prop.window); | ||
2190 | if (ee->alpha) | ||
2191 | { | ||
2192 | if (ee->prop.override) | ||
2193 | ee->prop.window = ecore_x_window_override_argb_new(ee->engine.x.win_root, ee->req.x, ee->req.y, ee->req.w, ee->req.h); | ||
2194 | else | ||
2195 | ee->prop.window = ecore_x_window_argb_new(ee->engine.x.win_root, ee->req.x, ee->req.y, ee->req.w, ee->req.h); | ||
2196 | if (!ee->engine.x.mask) | ||
2197 | ee->engine.x.mask = ecore_x_pixmap_new(ee->prop.window, ee->req.w, ee->req.h, 1); | ||
2198 | } | ||
2199 | else | ||
2200 | { | ||
2201 | if (ee->prop.override) | ||
2202 | ee->prop.window = ecore_x_window_override_new(ee->engine.x.win_root, ee->req.x, ee->req.y, ee->req.w, ee->req.h); | ||
2203 | else | ||
2204 | ee->prop.window = ecore_x_window_new(ee->engine.x.win_root, ee->req.x, ee->req.y, ee->req.w, ee->req.h); | ||
2205 | if (ee->engine.x.mask) ecore_x_pixmap_free(ee->engine.x.mask); | ||
2206 | ee->engine.x.mask = 0; | ||
2207 | ecore_x_window_shape_input_mask_set(ee->prop.window, 0); | ||
2208 | } | ||
2209 | |||
2210 | einfo->info.destination_alpha = alpha; | ||
2211 | |||
2212 | ecore_x_window_attributes_get(ee->prop.window, &att); | ||
2213 | einfo->info.visual = att.visual; | ||
2214 | einfo->info.colormap = att.colormap; | ||
2215 | einfo->info.depth = att.depth; | ||
2216 | |||
2217 | // if (ee->engine.x.mask) ecore_x_pixmap_free(ee->engine.x.mask); | ||
2218 | // ee->engine.x.mask = 0; | ||
2219 | einfo->info.mask = ee->engine.x.mask; | ||
2220 | einfo->info.drawable = ee->prop.window; | ||
2221 | if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) | ||
2222 | { | ||
2223 | ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); | ||
2224 | } | ||
2225 | evas_damage_rectangle_add(ee->evas, 0, 0, ee->req.w, ee->req.h); | ||
2226 | ecore_x_window_shape_mask_set(ee->prop.window, 0); | ||
2227 | ecore_x_input_multi_select(ee->prop.window); | ||
2228 | ecore_event_window_register(ee->prop.window, ee, ee->evas, | ||
2229 | (Ecore_Event_Mouse_Move_Cb)_ecore_evas_mouse_move_process, | ||
2230 | (Ecore_Event_Multi_Move_Cb)_ecore_evas_mouse_multi_move_process, | ||
2231 | (Ecore_Event_Multi_Down_Cb)_ecore_evas_mouse_multi_down_process, | ||
2232 | (Ecore_Event_Multi_Up_Cb)_ecore_evas_mouse_multi_up_process); | ||
2233 | if (ee->prop.borderless) | ||
2234 | ecore_x_mwm_borderless_set(ee->prop.window, ee->prop.borderless); | ||
2235 | if (ee->visible) ecore_x_window_show(ee->prop.window); | ||
2236 | if (ee->prop.focused) ecore_x_window_focus(ee->prop.window); | ||
2237 | if (ee->prop.title) | ||
2238 | { | ||
2239 | ecore_x_icccm_title_set(ee->prop.window, ee->prop.title); | ||
2240 | ecore_x_netwm_name_set(ee->prop.window, ee->prop.title); | ||
2241 | } | ||
2242 | _ecore_evas_x_hints_update(ee); | ||
2243 | _ecore_evas_x_group_leader_update(ee); | ||
2244 | ecore_x_window_defaults_set(ee->prop.window); | ||
2245 | _ecore_evas_x_protocols_set(ee); | ||
2246 | _ecore_evas_x_sync_set(ee); | ||
2247 | |||
2248 | if ((id = getenv("DESKTOP_STARTUP_ID"))) | ||
2249 | { | ||
2250 | ecore_x_netwm_startup_id_set(ee->prop.window, id); | ||
2251 | /* NB: on linux this may simply empty the env as opposed to completely | ||
2252 | * unset it to being empty - unsure as solartis libc crashes looking | ||
2253 | * for the '=' char */ | ||
2254 | // putenv((char*)"DESKTOP_STARTUP_ID="); | ||
2255 | } | ||
2256 | #endif /* BUILD_ECORE_EVAS_SOFTWARE_8_X11 */ | ||
2257 | } | ||
2258 | } | ||
2259 | |||
2260 | static void | ||
2261 | _ecore_evas_x_transparent_set(Ecore_Evas *ee, int transparent) | ||
2262 | { | ||
2263 | if ((ee->transparent == transparent)) return; | ||
2264 | |||
2265 | if (!strcmp(ee->driver, "software_x11")) | ||
2266 | { | ||
2267 | #ifdef BUILD_ECORE_EVAS_SOFTWARE_X11 | ||
2268 | Evas_Engine_Info_Software_X11 *einfo; | ||
2269 | |||
2270 | einfo = (Evas_Engine_Info_Software_X11 *)evas_engine_info_get(ee->evas); | ||
2271 | if (!einfo) return; | ||
2272 | |||
2273 | ee->transparent = transparent; | ||
2274 | einfo->info.destination_alpha = transparent; | ||
2275 | if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) | ||
2276 | { | ||
2277 | ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); | ||
2278 | } | ||
2279 | evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h); | ||
2280 | #endif | ||
2281 | } | ||
2282 | } | ||
2283 | |||
2284 | static void | ||
2285 | _ecore_evas_x_window_group_set(Ecore_Evas *ee, const Ecore_Evas *group_ee) | ||
2286 | { | ||
2287 | if (ee->prop.group_ee == group_ee) return; | ||
2288 | |||
2289 | ee->prop.group_ee = (Ecore_Evas *)group_ee; | ||
2290 | if (ee->prop.group_ee) | ||
2291 | ee->prop.group_ee_win = group_ee->prop.window; | ||
2292 | else | ||
2293 | ee->prop.group_ee_win = 0; | ||
2294 | _ecore_evas_x_hints_update(ee); | ||
2295 | } | ||
2296 | |||
2297 | static void | ||
2298 | _ecore_evas_x_aspect_set(Ecore_Evas *ee, double aspect) | ||
2299 | { | ||
2300 | if (ee->prop.aspect == aspect) return; | ||
2301 | |||
2302 | ee->prop.aspect = aspect; | ||
2303 | _ecore_evas_x_size_pos_hints_update(ee); | ||
2304 | // netwm state | ||
2305 | // if (ee->should_be_visible) | ||
2306 | // ecore_x_netwm_state_request_send(ee->prop.window, ee->engine.x.win_root, | ||
2307 | // ECORE_X_WINDOW_STATE_STICKY, -1, sticky); | ||
2308 | // else | ||
2309 | // _ecore_evas_x_state_update(ee); | ||
2310 | } | ||
2311 | |||
2312 | static void | ||
2313 | _ecore_evas_x_urgent_set(Ecore_Evas *ee, int urgent) | ||
2314 | { | ||
2315 | if (ee->prop.urgent == urgent) return; | ||
2316 | |||
2317 | ee->prop.urgent = urgent; | ||
2318 | _ecore_evas_x_hints_update(ee); | ||
2319 | } | ||
2320 | |||
2321 | static void | ||
2322 | _ecore_evas_x_modal_set(Ecore_Evas *ee, int modal) | ||
2323 | { | ||
2324 | if (ee->prop.modal == modal) return; | ||
2325 | |||
2326 | ee->prop.modal = modal; | ||
2327 | if (ee->should_be_visible) | ||
2328 | ecore_x_netwm_state_request_send(ee->prop.window, ee->engine.x.win_root, | ||
2329 | ECORE_X_WINDOW_STATE_MODAL, -1, modal); | ||
2330 | else | ||
2331 | _ecore_evas_x_state_update(ee); | ||
2332 | } | ||
2333 | |||
2334 | static void | ||
2335 | _ecore_evas_x_demand_attention_set(Ecore_Evas *ee, int demand) | ||
2336 | { | ||
2337 | if (ee->prop.demand_attention == demand) return; | ||
2338 | |||
2339 | ee->prop.demand_attention = demand; | ||
2340 | if (ee->should_be_visible) | ||
2341 | ecore_x_netwm_state_request_send(ee->prop.window, ee->engine.x.win_root, | ||
2342 | ECORE_X_WINDOW_STATE_DEMANDS_ATTENTION, -1, demand); | ||
2343 | else | ||
2344 | _ecore_evas_x_state_update(ee); | ||
2345 | } | ||
2346 | |||
2347 | static void | ||
2348 | _ecore_evas_x_focus_skip_set(Ecore_Evas *ee, int skip) | ||
2349 | { | ||
2350 | if (ee->prop.focus_skip == skip) return; | ||
2351 | |||
2352 | ee->prop.focus_skip = skip; | ||
2353 | if (ee->should_be_visible) | ||
2354 | { | ||
2355 | ecore_x_netwm_state_request_send(ee->prop.window, ee->engine.x.win_root, | ||
2356 | ECORE_X_WINDOW_STATE_SKIP_TASKBAR, -1, skip); | ||
2357 | ecore_x_netwm_state_request_send(ee->prop.window, ee->engine.x.win_root, | ||
2358 | ECORE_X_WINDOW_STATE_SKIP_PAGER, -1, skip); | ||
2359 | } | ||
2360 | else | ||
2361 | _ecore_evas_x_state_update(ee); | ||
2362 | _ecore_evas_x_hints_update(ee); | ||
2363 | } | ||
2364 | |||
2365 | #endif /* BUILD_ECORE_EVAS_X11 */ | ||
2366 | |||
2367 | #ifdef BUILD_ECORE_EVAS_X11 | ||
2368 | static void | ||
2369 | _ecore_evas_x_show(Ecore_Evas *ee) | ||
2370 | { | ||
2371 | ee->should_be_visible = 1; | ||
2372 | if (ee->prop.avoid_damage) | ||
2373 | _ecore_evas_x_render(ee); | ||
2374 | _ecore_evas_x_sync_set(ee); | ||
2375 | ecore_x_window_show(ee->prop.window); | ||
2376 | if (ee->prop.fullscreen) | ||
2377 | ecore_x_window_focus(ee->prop.window); | ||
2378 | } | ||
2379 | |||
2380 | static void | ||
2381 | _ecore_evas_x_hide(Ecore_Evas *ee) | ||
2382 | { | ||
2383 | ecore_x_window_hide(ee->prop.window); | ||
2384 | ee->should_be_visible = 0; | ||
2385 | _ecore_evas_x_sync_set(ee); | ||
2386 | } | ||
2387 | |||
2388 | static void | ||
2389 | _ecore_evas_x_raise(Ecore_Evas *ee) | ||
2390 | { | ||
2391 | ecore_x_window_raise(ee->prop.window); | ||
2392 | } | ||
2393 | |||
2394 | static void | ||
2395 | _ecore_evas_x_lower(Ecore_Evas *ee) | ||
2396 | { | ||
2397 | ecore_x_window_lower(ee->prop.window); | ||
2398 | } | ||
2399 | |||
2400 | static void | ||
2401 | _ecore_evas_x_activate(Ecore_Evas *ee) | ||
2402 | { | ||
2403 | ecore_x_netwm_client_active_request(ee->engine.x.win_root, | ||
2404 | ee->prop.window, 2, 0); | ||
2405 | } | ||
2406 | |||
2407 | static void | ||
2408 | _ecore_evas_x_title_set(Ecore_Evas *ee, const char *t) | ||
2409 | { | ||
2410 | if (ee->prop.title) free(ee->prop.title); | ||
2411 | ee->prop.title = NULL; | ||
2412 | if (t) ee->prop.title = strdup(t); | ||
2413 | ecore_x_icccm_title_set(ee->prop.window, ee->prop.title); | ||
2414 | ecore_x_netwm_name_set(ee->prop.window, ee->prop.title); | ||
2415 | } | ||
2416 | |||
2417 | static void | ||
2418 | _ecore_evas_x_name_class_set(Ecore_Evas *ee, const char *n, const char *c) | ||
2419 | { | ||
2420 | if (ee->prop.name) free(ee->prop.name); | ||
2421 | if (ee->prop.clas) free(ee->prop.clas); | ||
2422 | ee->prop.name = NULL; | ||
2423 | ee->prop.clas = NULL; | ||
2424 | if (n) ee->prop.name = strdup(n); | ||
2425 | if (c) ee->prop.clas = strdup(c); | ||
2426 | ecore_x_icccm_name_class_set(ee->prop.window, ee->prop.name, ee->prop.clas); | ||
2427 | } | ||
2428 | |||
2429 | static void | ||
2430 | _ecore_evas_x_size_min_set(Ecore_Evas *ee, int w, int h) | ||
2431 | { | ||
2432 | if (w < 0) w = 0; | ||
2433 | if (h < 0) h = 0; | ||
2434 | if ((ee->prop.min.w == w) && (ee->prop.min.h == h)) return; | ||
2435 | ee->prop.min.w = w; | ||
2436 | ee->prop.min.h = h; | ||
2437 | _ecore_evas_x_size_pos_hints_update(ee); | ||
2438 | } | ||
2439 | |||
2440 | static void | ||
2441 | _ecore_evas_x_size_max_set(Ecore_Evas *ee, int w, int h) | ||
2442 | { | ||
2443 | if (w < 0) w = 0; | ||
2444 | if (h < 0) h = 0; | ||
2445 | if ((ee->prop.max.w == w) && (ee->prop.max.h == h)) return; | ||
2446 | ee->prop.max.w = w; | ||
2447 | ee->prop.max.h = h; | ||
2448 | _ecore_evas_x_size_pos_hints_update(ee); | ||
2449 | } | ||
2450 | |||
2451 | static void | ||
2452 | _ecore_evas_x_size_base_set(Ecore_Evas *ee, int w, int h) | ||
2453 | { | ||
2454 | if (w < 0) w = 0; | ||
2455 | if (h < 0) h = 0; | ||
2456 | if ((ee->prop.base.w == w) && (ee->prop.base.h == h)) return; | ||
2457 | ee->prop.base.w = w; | ||
2458 | ee->prop.base.h = h; | ||
2459 | _ecore_evas_x_size_pos_hints_update(ee); | ||
2460 | } | ||
2461 | |||
2462 | static void | ||
2463 | _ecore_evas_x_size_step_set(Ecore_Evas *ee, int w, int h) | ||
2464 | { | ||
2465 | if (w < 1) w = 1; | ||
2466 | if (h < 1) h = 1; | ||
2467 | if ((ee->prop.step.w == w) && (ee->prop.step.h == h)) return; | ||
2468 | ee->prop.step.w = w; | ||
2469 | ee->prop.step.h = h; | ||
2470 | _ecore_evas_x_size_pos_hints_update(ee); | ||
2471 | } | ||
2472 | |||
2473 | static void | ||
2474 | _ecore_evas_object_cursor_del(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) | ||
2475 | { | ||
2476 | Ecore_Evas *ee; | ||
2477 | |||
2478 | ee = data; | ||
2479 | if (ee) ee->prop.cursor.object = NULL; | ||
2480 | } | ||
2481 | |||
2482 | static void | ||
2483 | _ecore_evas_x_object_cursor_set(Ecore_Evas *ee, Evas_Object *obj, int layer, int hot_x, int hot_y) | ||
2484 | { | ||
2485 | int x, y; | ||
2486 | |||
2487 | if (ee->prop.cursor.object) evas_object_del(ee->prop.cursor.object); | ||
2488 | |||
2489 | if (!obj) | ||
2490 | { | ||
2491 | ee->prop.cursor.object = NULL; | ||
2492 | ee->prop.cursor.layer = 0; | ||
2493 | ee->prop.cursor.hot.x = 0; | ||
2494 | ee->prop.cursor.hot.y = 0; | ||
2495 | ecore_x_window_cursor_show(ee->prop.window, 1); | ||
2496 | return; | ||
2497 | } | ||
2498 | |||
2499 | ee->prop.cursor.object = obj; | ||
2500 | ee->prop.cursor.layer = layer; | ||
2501 | ee->prop.cursor.hot.x = hot_x; | ||
2502 | ee->prop.cursor.hot.y = hot_y; | ||
2503 | |||
2504 | ecore_x_window_cursor_show(ee->prop.window, 0); | ||
2505 | |||
2506 | evas_pointer_output_xy_get(ee->evas, &x, &y); | ||
2507 | evas_object_layer_set(ee->prop.cursor.object, ee->prop.cursor.layer); | ||
2508 | evas_object_move(ee->prop.cursor.object, | ||
2509 | x - ee->prop.cursor.hot.x, | ||
2510 | y - ee->prop.cursor.hot.y); | ||
2511 | evas_object_pass_events_set(ee->prop.cursor.object, 1); | ||
2512 | if (evas_pointer_inside_get(ee->evas)) | ||
2513 | evas_object_show(ee->prop.cursor.object); | ||
2514 | |||
2515 | evas_object_event_callback_add(obj, EVAS_CALLBACK_DEL, _ecore_evas_object_cursor_del, ee); | ||
2516 | } | ||
2517 | |||
2518 | /* | ||
2519 | * @param ee | ||
2520 | * @param layer If < 3, @a ee will be put below all other windows. | ||
2521 | * If > 5, @a ee will be "always-on-top" | ||
2522 | * If = 4, @a ee will be put in the default layer. | ||
2523 | * Acceptable values range from 1 to 255 (0 reserved for | ||
2524 | * desktop windows) | ||
2525 | */ | ||
2526 | static void | ||
2527 | _ecore_evas_x_layer_set(Ecore_Evas *ee, int layer) | ||
2528 | { | ||
2529 | if (ee->prop.layer == layer) return; | ||
2530 | |||
2531 | /* FIXME: Should this logic be here? */ | ||
2532 | if (layer < 1) | ||
2533 | layer = 1; | ||
2534 | else if (layer > 255) | ||
2535 | layer = 255; | ||
2536 | |||
2537 | ee->prop.layer = layer; | ||
2538 | _ecore_evas_x_layer_update(ee); | ||
2539 | } | ||
2540 | |||
2541 | static void | ||
2542 | _ecore_evas_x_focus_set(Ecore_Evas *ee, int on __UNUSED__) | ||
2543 | { | ||
2544 | ecore_x_window_focus(ee->prop.window); | ||
2545 | } | ||
2546 | |||
2547 | static void | ||
2548 | _ecore_evas_x_iconified_set(Ecore_Evas *ee, int on) | ||
2549 | { | ||
2550 | if (ee->prop.iconified == on) return; | ||
2551 | ee->prop.iconified = on; | ||
2552 | _ecore_evas_x_hints_update(ee); | ||
2553 | if (on) | ||
2554 | ecore_x_icccm_iconic_request_send(ee->prop.window, ee->engine.x.win_root); | ||
2555 | else | ||
2556 | ecore_evas_show(ee); | ||
2557 | } | ||
2558 | |||
2559 | static void | ||
2560 | _ecore_evas_x_borderless_set(Ecore_Evas *ee, int on) | ||
2561 | { | ||
2562 | if (ee->prop.borderless == on) return; | ||
2563 | ee->prop.borderless = on; | ||
2564 | ecore_x_mwm_borderless_set(ee->prop.window, ee->prop.borderless); | ||
2565 | } | ||
2566 | |||
2567 | /* FIXME: This function changes the initial state of the ee | ||
2568 | * whilest the iconic function changes the current state! */ | ||
2569 | static void | ||
2570 | _ecore_evas_x_withdrawn_set(Ecore_Evas *ee, int withdrawn) | ||
2571 | { | ||
2572 | if (ee->prop.withdrawn == withdrawn) return; | ||
2573 | ee->prop.withdrawn = withdrawn; | ||
2574 | _ecore_evas_x_hints_update(ee); | ||
2575 | } | ||
2576 | |||
2577 | static void | ||
2578 | _ecore_evas_x_sticky_set(Ecore_Evas *ee, int sticky) | ||
2579 | { | ||
2580 | if (ee->prop.sticky == sticky) return; | ||
2581 | |||
2582 | /* We dont want to set prop.sticky here as it will cause | ||
2583 | * the sticky callback not to get called. Its set on the | ||
2584 | * property change event. | ||
2585 | * ee->prop.sticky = sticky; | ||
2586 | */ | ||
2587 | ee->engine.x.state.sticky = sticky; | ||
2588 | if (ee->should_be_visible) | ||
2589 | ecore_x_netwm_state_request_send(ee->prop.window, ee->engine.x.win_root, | ||
2590 | ECORE_X_WINDOW_STATE_STICKY, -1, sticky); | ||
2591 | else | ||
2592 | _ecore_evas_x_state_update(ee); | ||
2593 | } | ||
2594 | |||
2595 | static void | ||
2596 | _ecore_evas_x_ignore_events_set(Ecore_Evas *ee, int ignore) | ||
2597 | { | ||
2598 | if (ee->ignore_events == ignore) return; | ||
2599 | |||
2600 | ee->ignore_events = ignore; | ||
2601 | if (ee->prop.window) | ||
2602 | ecore_x_window_ignore_set(ee->prop.window, ignore); | ||
2603 | } | ||
2604 | |||
2605 | /* | ||
2606 | static void | ||
2607 | _ecore_evas_x_reinit_win(Ecore_Evas *ee) | ||
2608 | { | ||
2609 | if (!strcmp(ee->driver, "software_x11")) | ||
2610 | { | ||
2611 | #ifdef BUILD_ECORE_EVAS_X11 | ||
2612 | Evas_Engine_Info_Software_X11 *einfo; | ||
2613 | |||
2614 | einfo = (Evas_Engine_Info_Software_X11 *)evas_engine_info_get(ee->evas); | ||
2615 | if (einfo) | ||
2616 | { | ||
2617 | einfo->info.drawable = ee->prop.window; | ||
2618 | evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo); | ||
2619 | } | ||
2620 | #endif | ||
2621 | } | ||
2622 | else if (!strcmp(ee->driver, "opengl_x11")) | ||
2623 | { | ||
2624 | #ifdef BUILD_ECORE_EVAS_OPENGL_X11 | ||
2625 | Evas_Engine_Info_GL_X11 *einfo; | ||
2626 | |||
2627 | einfo = (Evas_Engine_Info_GL_X11 *)evas_engine_info_get(ee->evas); | ||
2628 | if (einfo) | ||
2629 | { | ||
2630 | einfo->info.drawable = ee->prop.window; | ||
2631 | evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo); | ||
2632 | } | ||
2633 | #endif | ||
2634 | } | ||
2635 | } | ||
2636 | */ | ||
2637 | |||
2638 | static void | ||
2639 | _ecore_evas_x_override_set(Ecore_Evas *ee, int on) | ||
2640 | { | ||
2641 | if (ee->prop.override == on) return; | ||
2642 | if (ee->should_be_visible) ecore_x_window_hide(ee->prop.window); | ||
2643 | ecore_x_window_override_set(ee->prop.window, on); | ||
2644 | if (ee->should_be_visible) ecore_x_window_show(ee->prop.window); | ||
2645 | if (ee->prop.focused) ecore_x_window_focus(ee->prop.window); | ||
2646 | ee->prop.override = on; | ||
2647 | } | ||
2648 | |||
2649 | static void | ||
2650 | _ecore_evas_x_fullscreen_set(Ecore_Evas *ee, int on) | ||
2651 | { | ||
2652 | if (ee->prop.fullscreen == on) return; | ||
2653 | |||
2654 | /* FIXME: Detect if WM is EWMH compliant and handle properly if not, | ||
2655 | * i.e. reposition, resize, and change borderless hint */ | ||
2656 | ee->engine.x.state.fullscreen = on; | ||
2657 | if (ee->should_be_visible) | ||
2658 | ecore_x_netwm_state_request_send(ee->prop.window, ee->engine.x.win_root, | ||
2659 | ECORE_X_WINDOW_STATE_FULLSCREEN, -1, on); | ||
2660 | else | ||
2661 | _ecore_evas_x_state_update(ee); | ||
2662 | } | ||
2663 | |||
2664 | static void | ||
2665 | _ecore_evas_x_avoid_damage_set(Ecore_Evas *ee, int on) | ||
2666 | { | ||
2667 | if (ee->prop.avoid_damage == on) return; | ||
2668 | if (!strcmp(ee->driver, "opengl_x11")) return; | ||
2669 | |||
2670 | if (!strcmp(ee->driver, "software_x11")) | ||
2671 | { | ||
2672 | #ifdef BUILD_ECORE_EVAS_SOFTWARE_X11 | ||
2673 | Evas_Engine_Info_Software_X11 *einfo; | ||
2674 | |||
2675 | ee->prop.avoid_damage = on; | ||
2676 | einfo = (Evas_Engine_Info_Software_X11 *)evas_engine_info_get(ee->evas); | ||
2677 | if (einfo) | ||
2678 | { | ||
2679 | if (ee->prop.avoid_damage) | ||
2680 | { | ||
2681 | ee->engine.x.pmap = ecore_x_pixmap_new(ee->prop.window, ee->w, ee->h, einfo->info.depth); | ||
2682 | ee->engine.x.gc = ecore_x_gc_new(ee->engine.x.pmap, 0, NULL); | ||
2683 | einfo->info.drawable = ee->engine.x.pmap; | ||
2684 | if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) | ||
2685 | { | ||
2686 | ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); | ||
2687 | } | ||
2688 | if ((ee->rotation == 90) || (ee->rotation == 270)) | ||
2689 | evas_damage_rectangle_add(ee->evas, 0, 0, ee->h, ee->w); | ||
2690 | else | ||
2691 | evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h); | ||
2692 | if (ee->prop.avoid_damage == ECORE_EVAS_AVOID_DAMAGE_BUILT_IN) | ||
2693 | { | ||
2694 | ee->engine.x.using_bg_pixmap = 1; | ||
2695 | ecore_x_window_pixmap_set(ee->prop.window, ee->engine.x.pmap); | ||
2696 | ecore_x_window_area_expose(ee->prop.window, 0, 0, ee->w, ee->h); | ||
2697 | } | ||
2698 | if (ee->engine.x.direct_resize) | ||
2699 | { | ||
2700 | /* Turn this off for now | ||
2701 | ee->engine.x.using_bg_pixmap = 1; | ||
2702 | ecore_x_window_pixmap_set(ee->prop.window, ee->engine.x.pmap); | ||
2703 | */ | ||
2704 | } | ||
2705 | } | ||
2706 | else | ||
2707 | { | ||
2708 | if (ee->engine.x.pmap) ecore_x_pixmap_free(ee->engine.x.pmap); | ||
2709 | if (ee->engine.x.gc) ecore_x_gc_free(ee->engine.x.gc); | ||
2710 | if (ee->engine.x.using_bg_pixmap) | ||
2711 | { | ||
2712 | ecore_x_window_pixmap_set(ee->prop.window, 0); | ||
2713 | ee->engine.x.using_bg_pixmap = 0; | ||
2714 | ecore_x_window_area_expose(ee->prop.window, 0, 0, ee->w, ee->h); | ||
2715 | } | ||
2716 | ee->engine.x.pmap = 0; | ||
2717 | ee->engine.x.gc = 0; | ||
2718 | einfo->info.drawable = ee->prop.window; | ||
2719 | if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) | ||
2720 | { | ||
2721 | ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); | ||
2722 | } | ||
2723 | } | ||
2724 | } | ||
2725 | #endif /* BUILD_ECORE_EVAS_SOFTWARE_X11 */ | ||
2726 | } | ||
2727 | else if (!strcmp(ee->driver, "software_16_x11")) | ||
2728 | { | ||
2729 | #if BUILD_ECORE_EVAS_SOFTWARE_16_X11 | ||
2730 | Evas_Engine_Info_Software_16_X11 *einfo; | ||
2731 | |||
2732 | ee->prop.avoid_damage = on; | ||
2733 | einfo = (Evas_Engine_Info_Software_16_X11 *)evas_engine_info_get(ee->evas); | ||
2734 | if (einfo) | ||
2735 | { | ||
2736 | if (ee->prop.avoid_damage) | ||
2737 | { | ||
2738 | ee->engine.x.pmap = ecore_x_pixmap_new(ee->prop.window, ee->w, ee->h, 16); | ||
2739 | ee->engine.x.gc = ecore_x_gc_new(ee->engine.x.pmap, 0, NULL); | ||
2740 | einfo->info.drawable = ee->engine.x.pmap; | ||
2741 | if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) | ||
2742 | { | ||
2743 | ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); | ||
2744 | } | ||
2745 | if ((ee->rotation == 90) || (ee->rotation == 270)) | ||
2746 | evas_damage_rectangle_add(ee->evas, 0, 0, ee->h, ee->w); | ||
2747 | else | ||
2748 | evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h); | ||
2749 | if (ee->engine.x.direct_resize) | ||
2750 | { | ||
2751 | /* Turn this off for now | ||
2752 | ee->engine.x.using_bg_pixmap = 1; | ||
2753 | ecore_x_window_pixmap_set(ee->prop.window, ee->engine.x.pmap); | ||
2754 | */ | ||
2755 | } | ||
2756 | } | ||
2757 | else | ||
2758 | { | ||
2759 | if (ee->engine.x.pmap) ecore_x_pixmap_free(ee->engine.x.pmap); | ||
2760 | if (ee->engine.x.gc) ecore_x_gc_free(ee->engine.x.gc); | ||
2761 | if (ee->engine.x.using_bg_pixmap) | ||
2762 | { | ||
2763 | ecore_x_window_pixmap_set(ee->prop.window, 0); | ||
2764 | ee->engine.x.using_bg_pixmap = 0; | ||
2765 | } | ||
2766 | ee->engine.x.pmap = 0; | ||
2767 | ee->engine.x.gc = 0; | ||
2768 | einfo->info.drawable = ee->prop.window; | ||
2769 | if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) | ||
2770 | { | ||
2771 | ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); | ||
2772 | } | ||
2773 | } | ||
2774 | } | ||
2775 | #endif /* BUILD_ECORE_EVAS_SOFTWARE_16_X11 */ | ||
2776 | } | ||
2777 | else if (!strcmp(ee->driver, "software_8_x11")) | ||
2778 | { | ||
2779 | #if BUILD_ECORE_EVAS_SOFTWARE_8_X11 | ||
2780 | Evas_Engine_Info_Software_8_X11 *einfo; | ||
2781 | |||
2782 | ee->prop.avoid_damage = on; | ||
2783 | einfo = (Evas_Engine_Info_Software_8_X11 *)evas_engine_info_get(ee->evas); | ||
2784 | if (einfo) | ||
2785 | { | ||
2786 | if (ee->prop.avoid_damage) | ||
2787 | { | ||
2788 | ee->engine.x.pmap = ecore_x_pixmap_new(ee->prop.window, ee->w, ee->h, einfo->info.depth); | ||
2789 | ee->engine.x.gc = ecore_x_gc_new(ee->engine.x.pmap, 0, NULL); | ||
2790 | einfo->info.drawable = ee->engine.x.pmap; | ||
2791 | if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) | ||
2792 | { | ||
2793 | ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); | ||
2794 | } | ||
2795 | if ((ee->rotation == 90) || (ee->rotation == 270)) | ||
2796 | evas_damage_rectangle_add(ee->evas, 0, 0, ee->h, ee->w); | ||
2797 | else | ||
2798 | evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h); | ||
2799 | if (ee->prop.avoid_damage == ECORE_EVAS_AVOID_DAMAGE_BUILT_IN) | ||
2800 | { | ||
2801 | ee->engine.x.using_bg_pixmap = 1; | ||
2802 | ecore_x_window_pixmap_set(ee->prop.window, ee->engine.x.pmap); | ||
2803 | ecore_x_window_area_expose(ee->prop.window, 0, 0, ee->w, ee->h); | ||
2804 | } | ||
2805 | if (ee->engine.x.direct_resize) | ||
2806 | { | ||
2807 | /* Turn this off for now | ||
2808 | ee->engine.x.using_bg_pixmap = 1; | ||
2809 | ecore_x_window_pixmap_set(ee->prop.window, ee->engine.x.pmap); | ||
2810 | */ | ||
2811 | } | ||
2812 | } | ||
2813 | else | ||
2814 | { | ||
2815 | if (ee->engine.x.pmap) ecore_x_pixmap_free(ee->engine.x.pmap); | ||
2816 | if (ee->engine.x.gc) ecore_x_gc_free(ee->engine.x.gc); | ||
2817 | if (ee->engine.x.using_bg_pixmap) | ||
2818 | { | ||
2819 | ecore_x_window_pixmap_set(ee->prop.window, 0); | ||
2820 | ee->engine.x.using_bg_pixmap = 0; | ||
2821 | ecore_x_window_area_expose(ee->prop.window, 0, 0, ee->w, ee->h); | ||
2822 | } | ||
2823 | ee->engine.x.pmap = 0; | ||
2824 | ee->engine.x.gc = 0; | ||
2825 | einfo->info.drawable = ee->prop.window; | ||
2826 | if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) | ||
2827 | { | ||
2828 | ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); | ||
2829 | } | ||
2830 | } | ||
2831 | } | ||
2832 | #endif /* BUILD_ECORE_EVAS_SOFTWARE_8_X11 */ | ||
2833 | } | ||
2834 | } | ||
2835 | |||
2836 | static void | ||
2837 | _ecore_evas_x_screen_geometry_get(const Ecore_Evas *ee __UNUSED__, int *x, int *y, int *w, int *h) | ||
2838 | { | ||
2839 | if (x) *x = 0; | ||
2840 | if (y) *y = 0; | ||
2841 | ecore_x_screen_size_get(ecore_x_default_screen_get(), w, h); | ||
2842 | } | ||
2843 | |||
2844 | int | ||
2845 | _ecore_evas_x_shutdown(void) | ||
2846 | { | ||
2847 | _ecore_evas_init_count--; | ||
2848 | if (_ecore_evas_init_count == 0) | ||
2849 | { | ||
2850 | unsigned int i; | ||
2851 | |||
2852 | for (i = 0; i < sizeof(ecore_evas_event_handlers) / sizeof(Ecore_Event_Handler*); i++) | ||
2853 | { | ||
2854 | if (ecore_evas_event_handlers[i]) | ||
2855 | ecore_event_handler_del(ecore_evas_event_handlers[i]); | ||
2856 | } | ||
2857 | ecore_event_evas_shutdown(); | ||
2858 | } | ||
2859 | if (_ecore_evas_init_count < 0) _ecore_evas_init_count = 0; | ||
2860 | return _ecore_evas_init_count; | ||
2861 | } | ||
2862 | |||
2863 | static Ecore_Evas_Engine_Func _ecore_x_engine_func = | ||
2864 | { | ||
2865 | _ecore_evas_x_free, | ||
2866 | NULL, | ||
2867 | NULL, | ||
2868 | NULL, | ||
2869 | NULL, | ||
2870 | _ecore_evas_x_callback_delete_request_set, | ||
2871 | NULL, | ||
2872 | NULL, | ||
2873 | NULL, | ||
2874 | NULL, | ||
2875 | NULL, | ||
2876 | NULL, | ||
2877 | NULL, | ||
2878 | NULL, | ||
2879 | NULL, | ||
2880 | _ecore_evas_x_move, | ||
2881 | _ecore_evas_x_managed_move, | ||
2882 | _ecore_evas_x_resize, | ||
2883 | _ecore_evas_x_move_resize, | ||
2884 | _ecore_evas_x_rotation_set, | ||
2885 | _ecore_evas_x_shaped_set, | ||
2886 | _ecore_evas_x_show, | ||
2887 | _ecore_evas_x_hide, | ||
2888 | _ecore_evas_x_raise, | ||
2889 | _ecore_evas_x_lower, | ||
2890 | _ecore_evas_x_activate, | ||
2891 | _ecore_evas_x_title_set, | ||
2892 | _ecore_evas_x_name_class_set, | ||
2893 | _ecore_evas_x_size_min_set, | ||
2894 | _ecore_evas_x_size_max_set, | ||
2895 | _ecore_evas_x_size_base_set, | ||
2896 | _ecore_evas_x_size_step_set, | ||
2897 | _ecore_evas_x_object_cursor_set, | ||
2898 | _ecore_evas_x_layer_set, | ||
2899 | _ecore_evas_x_focus_set, | ||
2900 | _ecore_evas_x_iconified_set, | ||
2901 | _ecore_evas_x_borderless_set, | ||
2902 | _ecore_evas_x_override_set, | ||
2903 | NULL, | ||
2904 | _ecore_evas_x_fullscreen_set, | ||
2905 | _ecore_evas_x_avoid_damage_set, | ||
2906 | _ecore_evas_x_withdrawn_set, | ||
2907 | _ecore_evas_x_sticky_set, | ||
2908 | _ecore_evas_x_ignore_events_set, | ||
2909 | _ecore_evas_x_alpha_set, | ||
2910 | _ecore_evas_x_transparent_set, | ||
2911 | |||
2912 | _ecore_evas_x_window_group_set, | ||
2913 | _ecore_evas_x_aspect_set, | ||
2914 | _ecore_evas_x_urgent_set, | ||
2915 | _ecore_evas_x_modal_set, | ||
2916 | _ecore_evas_x_demand_attention_set, | ||
2917 | _ecore_evas_x_focus_skip_set, | ||
2918 | |||
2919 | NULL, // render | ||
2920 | _ecore_evas_x_screen_geometry_get | ||
2921 | }; | ||
2922 | #endif /* BUILD_ECORE_EVAS_X11 */ | ||
2923 | |||
2924 | /* | ||
2925 | * FIXME: there are some round trips. Especially, we can split | ||
2926 | * ecore_x_init in 2 functions and suppress some round trips. | ||
2927 | */ | ||
2928 | |||
2929 | #if defined (BUILD_ECORE_EVAS_SOFTWARE_X11) || defined (BUILD_ECORE_EVAS_OPENGL_X11) || defined (BUILD_ECORE_EVAS_SOFTWARE_16_X11) || defined (BUILD_ECORE_EVAS_SOFTWARE_8_X11) | ||
2930 | static void | ||
2931 | _ecore_evas_x_flush_pre(void *data, Evas *e __UNUSED__, void *event_info __UNUSED__) | ||
2932 | { | ||
2933 | Ecore_Evas *ee = data; | ||
2934 | |||
2935 | if (ee->no_comp_sync) return; | ||
2936 | if (!_ecore_evas_app_comp_sync) return; | ||
2937 | if (ee->engine.x.sync_counter) | ||
2938 | { | ||
2939 | if (ee->engine.x.sync_began) | ||
2940 | { | ||
2941 | ee->engine.x.sync_val++; | ||
2942 | if (!ee->engine.x.sync_cancel) | ||
2943 | { | ||
2944 | if (!ee->semi_sync) | ||
2945 | ecore_x_sync_counter_val_wait(ee->engine.x.sync_counter, | ||
2946 | ee->engine.x.sync_val); | ||
2947 | } | ||
2948 | } | ||
2949 | } | ||
2950 | } | ||
2951 | |||
2952 | static void | ||
2953 | _ecore_evas_x_flush_post(void *data, Evas *e __UNUSED__, void *event_info __UNUSED__) | ||
2954 | { | ||
2955 | Ecore_Evas *ee = data; | ||
2956 | |||
2957 | if ((!ee->no_comp_sync) && (_ecore_evas_app_comp_sync)) | ||
2958 | { | ||
2959 | if (ee->engine.x.sync_counter) | ||
2960 | { | ||
2961 | if (ee->engine.x.sync_began) | ||
2962 | { | ||
2963 | if (!ee->engine.x.sync_cancel) | ||
2964 | { | ||
2965 | ecore_x_e_comp_sync_draw_size_done_send | ||
2966 | (ee->engine.x.win_root, ee->prop.window, ee->w, ee->h); | ||
2967 | } | ||
2968 | } | ||
2969 | } | ||
2970 | } | ||
2971 | if (ee->engine.x.netwm_sync_set) | ||
2972 | { | ||
2973 | ecore_x_sync_counter_2_set(ee->engine.x.netwm_sync_counter, | ||
2974 | ee->engine.x.netwm_sync_val_hi, | ||
2975 | ee->engine.x.netwm_sync_val_lo); | ||
2976 | ee->engine.x.netwm_sync_set = 0; | ||
2977 | } | ||
2978 | } | ||
2979 | #endif | ||
2980 | |||
2981 | /** | ||
2982 | * To be documented. | ||
2983 | * | ||
2984 | * FIXME: To be fixed. | ||
2985 | */ | ||
2986 | #ifdef BUILD_ECORE_EVAS_SOFTWARE_X11 | ||
2987 | EAPI Ecore_Evas * | ||
2988 | ecore_evas_software_x11_new(const char *disp_name, Ecore_X_Window parent, | ||
2989 | int x, int y, int w, int h) | ||
2990 | { | ||
2991 | Evas_Engine_Info_Software_X11 *einfo; | ||
2992 | Ecore_Evas *ee; | ||
2993 | int argb = 0, rmethod; | ||
2994 | static int redraw_debug = -1; | ||
2995 | char *id = NULL; | ||
2996 | |||
2997 | rmethod = evas_render_method_lookup("software_x11"); | ||
2998 | if (!rmethod) return NULL; | ||
2999 | if (!ecore_x_init(disp_name)) return NULL; | ||
3000 | ee = calloc(1, sizeof(Ecore_Evas)); | ||
3001 | if (!ee) return NULL; | ||
3002 | |||
3003 | ECORE_MAGIC_SET(ee, ECORE_MAGIC_EVAS); | ||
3004 | |||
3005 | _ecore_evas_x_init(); | ||
3006 | |||
3007 | ee->engine.func = (Ecore_Evas_Engine_Func *)&_ecore_x_engine_func; | ||
3008 | |||
3009 | ee->driver = "software_x11"; | ||
3010 | if (disp_name) ee->name = strdup(disp_name); | ||
3011 | |||
3012 | if (w < 1) w = 1; | ||
3013 | if (h < 1) h = 1; | ||
3014 | ee->x = x; | ||
3015 | ee->y = y; | ||
3016 | ee->w = w; | ||
3017 | ee->h = h; | ||
3018 | ee->req.x = ee->x; | ||
3019 | ee->req.y = ee->y; | ||
3020 | ee->req.w = ee->w; | ||
3021 | ee->req.h = ee->h; | ||
3022 | |||
3023 | ee->prop.max.w = 32767; | ||
3024 | ee->prop.max.h = 32767; | ||
3025 | ee->prop.layer = 4; | ||
3026 | ee->prop.request_pos = 0; | ||
3027 | ee->prop.sticky = 0; | ||
3028 | ee->engine.x.state.sticky = 0; | ||
3029 | |||
3030 | /* init evas here */ | ||
3031 | ee->evas = evas_new(); | ||
3032 | evas_event_callback_add(ee->evas, EVAS_CALLBACK_RENDER_FLUSH_PRE, | ||
3033 | _ecore_evas_x_flush_pre, ee); | ||
3034 | evas_event_callback_add(ee->evas, EVAS_CALLBACK_RENDER_FLUSH_POST, | ||
3035 | _ecore_evas_x_flush_post, ee); | ||
3036 | evas_data_attach_set(ee->evas, ee); | ||
3037 | evas_output_method_set(ee->evas, rmethod); | ||
3038 | evas_output_size_set(ee->evas, w, h); | ||
3039 | evas_output_viewport_set(ee->evas, 0, 0, w, h); | ||
3040 | |||
3041 | ee->engine.x.win_root = parent; | ||
3042 | ee->engine.x.screen_num = 0; | ||
3043 | |||
3044 | if (parent != 0) | ||
3045 | { | ||
3046 | ee->engine.x.screen_num = 1; /* FIXME: get real scren # */ | ||
3047 | /* FIXME: round trip in ecore_x_window_argb_get */ | ||
3048 | if (ecore_x_window_argb_get(parent)) | ||
3049 | { | ||
3050 | ee->prop.window = ecore_x_window_argb_new(parent, x, y, w, h); | ||
3051 | argb = 1; | ||
3052 | } | ||
3053 | else | ||
3054 | ee->prop.window = ecore_x_window_new(parent, x, y, w, h); | ||
3055 | } | ||
3056 | else | ||
3057 | ee->prop.window = ecore_x_window_new(parent, x, y, w, h); | ||
3058 | if ((id = getenv("DESKTOP_STARTUP_ID"))) | ||
3059 | { | ||
3060 | ecore_x_netwm_startup_id_set(ee->prop.window, id); | ||
3061 | /* NB: on linux this may simply empty the env as opposed to completely | ||
3062 | * unset it to being empty - unsure as solartis libc crashes looking | ||
3063 | * for the '=' char */ | ||
3064 | // putenv((char*)"DESKTOP_STARTUP_ID="); | ||
3065 | } | ||
3066 | einfo = (Evas_Engine_Info_Software_X11 *)evas_engine_info_get(ee->evas); | ||
3067 | if (einfo) | ||
3068 | { | ||
3069 | Ecore_X_Screen *screen; | ||
3070 | |||
3071 | /* FIXME: this is inefficient as its 1 or more round trips */ | ||
3072 | screen = ecore_x_default_screen_get(); | ||
3073 | if (ecore_x_screen_count_get() > 1) | ||
3074 | { | ||
3075 | Ecore_X_Window *roots; | ||
3076 | int num, i; | ||
3077 | |||
3078 | num = 0; | ||
3079 | roots = ecore_x_window_root_list(&num); | ||
3080 | if (roots) | ||
3081 | { | ||
3082 | Ecore_X_Window root; | ||
3083 | |||
3084 | root = ecore_x_window_root_get(parent); | ||
3085 | for (i = 0; i < num; i++) | ||
3086 | { | ||
3087 | if (root == roots[i]) | ||
3088 | { | ||
3089 | screen = ecore_x_screen_get(i); | ||
3090 | break; | ||
3091 | } | ||
3092 | } | ||
3093 | free(roots); | ||
3094 | } | ||
3095 | } | ||
3096 | |||
3097 | einfo->info.destination_alpha = argb; | ||
3098 | |||
3099 | if (redraw_debug < 0) | ||
3100 | { | ||
3101 | if (getenv("REDRAW_DEBUG")) | ||
3102 | redraw_debug = atoi(getenv("REDRAW_DEBUG")); | ||
3103 | else | ||
3104 | redraw_debug = 0; | ||
3105 | } | ||
3106 | |||
3107 | # ifdef BUILD_ECORE_EVAS_SOFTWARE_XCB | ||
3108 | einfo->info.backend = EVAS_ENGINE_INFO_SOFTWARE_X11_BACKEND_XCB; | ||
3109 | einfo->info.connection = ecore_x_connection_get(); | ||
3110 | einfo->info.screen = screen; | ||
3111 | # else | ||
3112 | einfo->info.backend = EVAS_ENGINE_INFO_SOFTWARE_X11_BACKEND_XLIB; | ||
3113 | einfo->info.connection = ecore_x_display_get(); | ||
3114 | einfo->info.screen = NULL; | ||
3115 | # endif | ||
3116 | einfo->info.drawable = ee->prop.window; | ||
3117 | |||
3118 | # ifdef EVAS_FRAME_QUEUING | ||
3119 | { | ||
3120 | char *render_mode; | ||
3121 | |||
3122 | render_mode = getenv("EVAS_RENDER_MODE"); | ||
3123 | if ((render_mode) && (!strcmp(render_mode, "non-blocking"))) | ||
3124 | einfo->render_mode = EVAS_RENDER_MODE_NONBLOCKING; | ||
3125 | } | ||
3126 | # endif | ||
3127 | |||
3128 | if (argb) | ||
3129 | { | ||
3130 | Ecore_X_Window_Attributes at; | ||
3131 | |||
3132 | ecore_x_window_attributes_get(ee->prop.window, &at); | ||
3133 | einfo->info.visual = at.visual; | ||
3134 | einfo->info.colormap = at.colormap; | ||
3135 | einfo->info.depth = at.depth; | ||
3136 | einfo->info.destination_alpha = 1; | ||
3137 | } | ||
3138 | else | ||
3139 | { | ||
3140 | einfo->info.visual = | ||
3141 | ecore_x_default_visual_get(einfo->info.connection, screen); | ||
3142 | einfo->info.colormap = | ||
3143 | ecore_x_default_colormap_get(einfo->info.connection, screen); | ||
3144 | einfo->info.depth = | ||
3145 | ecore_x_default_depth_get(einfo->info.connection, screen); | ||
3146 | einfo->info.destination_alpha = 0; | ||
3147 | } | ||
3148 | |||
3149 | einfo->info.rotation = 0; | ||
3150 | einfo->info.debug = redraw_debug; | ||
3151 | if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) | ||
3152 | { | ||
3153 | ERR("evas_engine_info_set() init engine '%s' failed.", ee->driver); | ||
3154 | ecore_evas_free(ee); | ||
3155 | return NULL; | ||
3156 | } | ||
3157 | } | ||
3158 | |||
3159 | _ecore_evas_x_hints_update(ee); | ||
3160 | _ecore_evas_x_group_leader_set(ee); | ||
3161 | ecore_x_window_defaults_set(ee->prop.window); | ||
3162 | _ecore_evas_x_protocols_set(ee); | ||
3163 | _ecore_evas_x_sync_set(ee); | ||
3164 | |||
3165 | ee->engine.func->fn_render = _ecore_evas_x_render; | ||
3166 | _ecore_evas_register(ee); | ||
3167 | ecore_x_input_multi_select(ee->prop.window); | ||
3168 | ecore_event_window_register(ee->prop.window, ee, ee->evas, | ||
3169 | (Ecore_Event_Mouse_Move_Cb)_ecore_evas_mouse_move_process, | ||
3170 | (Ecore_Event_Multi_Move_Cb)_ecore_evas_mouse_multi_move_process, | ||
3171 | (Ecore_Event_Multi_Down_Cb)_ecore_evas_mouse_multi_down_process, | ||
3172 | (Ecore_Event_Multi_Up_Cb)_ecore_evas_mouse_multi_up_process); | ||
3173 | return ee; | ||
3174 | } | ||
3175 | #else | ||
3176 | EAPI Ecore_Evas * | ||
3177 | ecore_evas_software_x11_new(const char *disp_name __UNUSED__, Ecore_X_Window parent __UNUSED__, | ||
3178 | int x __UNUSED__, int y __UNUSED__, int w __UNUSED__, int h __UNUSED__) | ||
3179 | { | ||
3180 | return NULL; | ||
3181 | } | ||
3182 | #endif | ||
3183 | |||
3184 | /** | ||
3185 | * To be documented. | ||
3186 | * | ||
3187 | * FIXME: To be fixed. | ||
3188 | */ | ||
3189 | #ifdef BUILD_ECORE_EVAS_SOFTWARE_X11 | ||
3190 | EAPI Ecore_X_Window | ||
3191 | ecore_evas_software_x11_window_get(const Ecore_Evas *ee) | ||
3192 | { | ||
3193 | return (Ecore_X_Window) ecore_evas_window_get(ee); | ||
3194 | } | ||
3195 | #else | ||
3196 | EAPI Ecore_X_Window | ||
3197 | ecore_evas_software_x11_window_get(const Ecore_Evas *ee __UNUSED__) | ||
3198 | { | ||
3199 | return 0; | ||
3200 | } | ||
3201 | #endif | ||
3202 | |||
3203 | /** | ||
3204 | * To be documented. | ||
3205 | * | ||
3206 | * FIXME: To be fixed. | ||
3207 | */ | ||
3208 | #ifdef BUILD_ECORE_EVAS_SOFTWARE_X11 | ||
3209 | EAPI void | ||
3210 | ecore_evas_software_x11_direct_resize_set(Ecore_Evas *ee, Eina_Bool on) | ||
3211 | { | ||
3212 | ee->engine.x.direct_resize = on; | ||
3213 | if (ee->prop.avoid_damage) | ||
3214 | { | ||
3215 | if (ee->engine.x.direct_resize) | ||
3216 | { | ||
3217 | /* turn this off for now | ||
3218 | ee->engine.x.using_bg_pixmap = 1; | ||
3219 | ecore_x_window_pixmap_set(ee->prop.window, ee->engine.x.pmap); | ||
3220 | */ | ||
3221 | } | ||
3222 | else | ||
3223 | { | ||
3224 | /* turn this off too- bg pixmap is controlled by avoid damage directly | ||
3225 | ee->engine.x.using_bg_pixmap = 0; | ||
3226 | ecore_x_window_pixmap_set(ee->prop.window, 0); | ||
3227 | ecore_x_window_area_expose(ee->prop.window, 0, 0, ee->w, ee->h); | ||
3228 | */ | ||
3229 | } | ||
3230 | } | ||
3231 | } | ||
3232 | #else | ||
3233 | EAPI void | ||
3234 | ecore_evas_software_x11_direct_resize_set(Ecore_Evas *ee __UNUSED__, Eina_Bool on __UNUSED__) | ||
3235 | { | ||
3236 | } | ||
3237 | #endif | ||
3238 | |||
3239 | /** | ||
3240 | * To be documented. | ||
3241 | * | ||
3242 | * FIXME: To be fixed. | ||
3243 | */ | ||
3244 | #ifdef BUILD_ECORE_EVAS_SOFTWARE_X11 | ||
3245 | EAPI Eina_Bool | ||
3246 | ecore_evas_software_x11_direct_resize_get(const Ecore_Evas *ee) | ||
3247 | { | ||
3248 | return ee->engine.x.direct_resize; | ||
3249 | } | ||
3250 | #else | ||
3251 | EAPI Eina_Bool | ||
3252 | ecore_evas_software_x11_direct_resize_get(const Ecore_Evas *ee __UNUSED__) | ||
3253 | { | ||
3254 | return 0; | ||
3255 | } | ||
3256 | #endif | ||
3257 | |||
3258 | /** | ||
3259 | * To be documented. | ||
3260 | * | ||
3261 | * FIXME: To be fixed. | ||
3262 | */ | ||
3263 | #ifdef BUILD_ECORE_EVAS_SOFTWARE_X11 | ||
3264 | EAPI void | ||
3265 | ecore_evas_software_x11_extra_event_window_add(Ecore_Evas *ee, Ecore_X_Window win) | ||
3266 | { | ||
3267 | Ecore_X_Window *winp; | ||
3268 | |||
3269 | winp = malloc(sizeof(Ecore_X_Window)); | ||
3270 | if (winp) | ||
3271 | { | ||
3272 | *winp = win; | ||
3273 | ee->engine.x.win_extra = eina_list_append(ee->engine.x.win_extra, winp); | ||
3274 | ecore_x_input_multi_select(win); | ||
3275 | ecore_event_window_register(win, ee, ee->evas, | ||
3276 | (Ecore_Event_Mouse_Move_Cb)_ecore_evas_mouse_move_process, | ||
3277 | (Ecore_Event_Multi_Move_Cb)_ecore_evas_mouse_multi_move_process, | ||
3278 | (Ecore_Event_Multi_Down_Cb)_ecore_evas_mouse_multi_down_process, | ||
3279 | (Ecore_Event_Multi_Up_Cb)_ecore_evas_mouse_multi_up_process); | ||
3280 | } | ||
3281 | } | ||
3282 | #else | ||
3283 | EAPI void | ||
3284 | ecore_evas_software_x11_extra_event_window_add(Ecore_Evas *ee __UNUSED__, Ecore_X_Window win __UNUSED__) | ||
3285 | { | ||
3286 | } | ||
3287 | #endif | ||
3288 | |||
3289 | /** | ||
3290 | * To be documented. | ||
3291 | * | ||
3292 | * FIXME: To be fixed. | ||
3293 | */ | ||
3294 | #ifdef BUILD_ECORE_EVAS_OPENGL_X11 | ||
3295 | EAPI Ecore_Evas * | ||
3296 | ecore_evas_gl_x11_new(const char *disp_name, Ecore_X_Window parent, | ||
3297 | int x, int y, int w, int h) | ||
3298 | { | ||
3299 | return ecore_evas_gl_x11_options_new(disp_name, parent, x, y, w, h, NULL); | ||
3300 | } | ||
3301 | |||
3302 | EAPI Ecore_Evas * | ||
3303 | ecore_evas_gl_x11_options_new(const char *disp_name, Ecore_X_Window parent, | ||
3304 | int x, int y, int w, int h, const int *opt) | ||
3305 | { | ||
3306 | Ecore_Evas *ee; | ||
3307 | int rmethod; | ||
3308 | char *id = NULL; | ||
3309 | |||
3310 | rmethod = evas_render_method_lookup("gl_x11"); | ||
3311 | if (!rmethod) return NULL; | ||
3312 | if (!ecore_x_init(disp_name)) return NULL; | ||
3313 | ee = calloc(1, sizeof(Ecore_Evas)); | ||
3314 | if (!ee) return NULL; | ||
3315 | |||
3316 | ECORE_MAGIC_SET(ee, ECORE_MAGIC_EVAS); | ||
3317 | |||
3318 | _ecore_evas_x_init(); | ||
3319 | |||
3320 | ee->engine.func = (Ecore_Evas_Engine_Func *)&_ecore_x_engine_func; | ||
3321 | |||
3322 | ee->driver = "opengl_x11"; | ||
3323 | if (!getenv("ECORE_EVAS_COMP_NOSEMISYNC")) | ||
3324 | ee->semi_sync = 1; // gl engine doesn't need to sync - its whole swaps | ||
3325 | // ee->no_comp_sync = 1; // gl engine doesn't need to sync - its whole swaps | ||
3326 | if (disp_name) ee->name = strdup(disp_name); | ||
3327 | |||
3328 | if (w < 1) w = 1; | ||
3329 | if (h < 1) h = 1; | ||
3330 | ee->x = x; | ||
3331 | ee->y = y; | ||
3332 | ee->w = w; | ||
3333 | ee->h = h; | ||
3334 | ee->req.x = ee->x; | ||
3335 | ee->req.y = ee->y; | ||
3336 | ee->req.w = ee->w; | ||
3337 | ee->req.h = ee->h; | ||
3338 | |||
3339 | ee->prop.max.w = 32767; | ||
3340 | ee->prop.max.h = 32767; | ||
3341 | ee->prop.layer = 4; | ||
3342 | ee->prop.request_pos = 0; | ||
3343 | ee->prop.sticky = 0; | ||
3344 | ee->engine.x.state.sticky = 0; | ||
3345 | |||
3346 | /* init evas here */ | ||
3347 | ee->evas = evas_new(); | ||
3348 | evas_event_callback_add(ee->evas, EVAS_CALLBACK_RENDER_FLUSH_PRE, _ecore_evas_x_flush_pre, ee); | ||
3349 | evas_event_callback_add(ee->evas, EVAS_CALLBACK_RENDER_FLUSH_POST, _ecore_evas_x_flush_post, ee); | ||
3350 | evas_data_attach_set(ee->evas, ee); | ||
3351 | evas_output_method_set(ee->evas, rmethod); | ||
3352 | evas_output_size_set(ee->evas, w, h); | ||
3353 | evas_output_viewport_set(ee->evas, 0, 0, w, h); | ||
3354 | |||
3355 | if (parent == 0) parent = DefaultRootWindow(ecore_x_display_get()); | ||
3356 | ee->engine.x.win_root = parent; | ||
3357 | |||
3358 | if (ee->engine.x.win_root != 0) | ||
3359 | { | ||
3360 | ee->engine.x.screen_num = 1; /* FIXME: get real scren # */ | ||
3361 | /* FIXME: round trip in ecore_x_window_argb_get */ | ||
3362 | if (ecore_x_window_argb_get(ee->engine.x.win_root)) | ||
3363 | { | ||
3364 | ee->prop.window = _ecore_evas_x_gl_window_new | ||
3365 | (ee, ee->engine.x.win_root, x, y, w, h, 0, 1, opt); | ||
3366 | } | ||
3367 | else | ||
3368 | ee->prop.window = _ecore_evas_x_gl_window_new | ||
3369 | (ee, ee->engine.x.win_root, x, y, w, h, 0, 0, opt); | ||
3370 | } | ||
3371 | else | ||
3372 | ee->prop.window = _ecore_evas_x_gl_window_new | ||
3373 | (ee, ee->engine.x.win_root, x, y, w, h, 0, 0, opt); | ||
3374 | if (!ee->prop.window) | ||
3375 | { | ||
3376 | ERR("evas_engine_info_set() init engine '%s' failed.", ee->driver); | ||
3377 | ecore_evas_free(ee); | ||
3378 | return NULL; | ||
3379 | } | ||
3380 | if ((id = getenv("DESKTOP_STARTUP_ID"))) | ||
3381 | { | ||
3382 | ecore_x_netwm_startup_id_set(ee->prop.window, id); | ||
3383 | /* NB: on linux this may simply empty the env as opposed to completely | ||
3384 | * unset it to being empty - unsure as solartis libc crashes looking | ||
3385 | * for the '=' char */ | ||
3386 | // putenv((char*)"DESKTOP_STARTUP_ID="); | ||
3387 | } | ||
3388 | |||
3389 | _ecore_evas_x_hints_update(ee); | ||
3390 | _ecore_evas_x_group_leader_set(ee); | ||
3391 | ecore_x_window_defaults_set(ee->prop.window); | ||
3392 | _ecore_evas_x_protocols_set(ee); | ||
3393 | _ecore_evas_x_sync_set(ee); | ||
3394 | |||
3395 | ee->engine.func->fn_render = _ecore_evas_x_render; | ||
3396 | _ecore_evas_register(ee); | ||
3397 | ecore_x_input_multi_select(ee->prop.window); | ||
3398 | ecore_event_window_register(ee->prop.window, ee, ee->evas, | ||
3399 | (Ecore_Event_Mouse_Move_Cb)_ecore_evas_mouse_move_process, | ||
3400 | (Ecore_Event_Multi_Move_Cb)_ecore_evas_mouse_multi_move_process, | ||
3401 | (Ecore_Event_Multi_Down_Cb)_ecore_evas_mouse_multi_down_process, | ||
3402 | (Ecore_Event_Multi_Up_Cb)_ecore_evas_mouse_multi_up_process); | ||
3403 | |||
3404 | return ee; | ||
3405 | } | ||
3406 | #else | ||
3407 | EAPI Ecore_Evas * | ||
3408 | ecore_evas_gl_x11_new(const char *disp_name __UNUSED__, Ecore_X_Window parent __UNUSED__, | ||
3409 | int x __UNUSED__, int y __UNUSED__, int w __UNUSED__, int h __UNUSED__) | ||
3410 | { | ||
3411 | return NULL; | ||
3412 | } | ||
3413 | EAPI Ecore_Evas * | ||
3414 | ecore_evas_gl_x11_options_new(const char *disp_name __UNUSED__, Ecore_X_Window parent __UNUSED__, | ||
3415 | int x __UNUSED__, int y __UNUSED__, int w __UNUSED__, int h __UNUSED__, const int *opt __UNUSED__) | ||
3416 | { | ||
3417 | return NULL; | ||
3418 | } | ||
3419 | #endif /* ! BUILD_ECORE_EVAS_OPENGL_X11 */ | ||
3420 | |||
3421 | /** | ||
3422 | * To be documented. | ||
3423 | * | ||
3424 | * FIXME: To be fixed. | ||
3425 | */ | ||
3426 | #ifdef BUILD_ECORE_EVAS_OPENGL_X11 | ||
3427 | EAPI Ecore_X_Window | ||
3428 | ecore_evas_gl_x11_window_get(const Ecore_Evas *ee) | ||
3429 | { | ||
3430 | return (Ecore_X_Window) ecore_evas_window_get(ee); | ||
3431 | } | ||
3432 | #else | ||
3433 | EAPI Ecore_X_Window | ||
3434 | ecore_evas_gl_x11_window_get(const Ecore_Evas *ee __UNUSED__) | ||
3435 | { | ||
3436 | return 0; | ||
3437 | } | ||
3438 | #endif /* ! BUILD_ECORE_EVAS_OPENGL_X11 */ | ||
3439 | |||
3440 | /** | ||
3441 | * To be documented. | ||
3442 | * | ||
3443 | * FIXME: To be fixed. | ||
3444 | */ | ||
3445 | #ifdef BUILD_ECORE_EVAS_OPENGL_X11 | ||
3446 | EAPI void | ||
3447 | ecore_evas_gl_x11_direct_resize_set(Ecore_Evas *ee, Eina_Bool on) | ||
3448 | { | ||
3449 | ee->engine.x.direct_resize = on; | ||
3450 | } | ||
3451 | #else | ||
3452 | EAPI void | ||
3453 | ecore_evas_gl_x11_direct_resize_set(Ecore_Evas *ee __UNUSED__, Eina_Bool on __UNUSED__) | ||
3454 | { | ||
3455 | } | ||
3456 | #endif /* ! BUILD_ECORE_EVAS_OPENGL_X11 */ | ||
3457 | |||
3458 | /** | ||
3459 | * To be documented. | ||
3460 | * | ||
3461 | * FIXME: To be fixed. | ||
3462 | */ | ||
3463 | #ifdef BUILD_ECORE_EVAS_OPENGL_X11 | ||
3464 | EAPI Eina_Bool | ||
3465 | ecore_evas_gl_x11_direct_resize_get(const Ecore_Evas *ee) | ||
3466 | { | ||
3467 | return ee->engine.x.direct_resize; | ||
3468 | } | ||
3469 | #else | ||
3470 | EAPI Eina_Bool | ||
3471 | ecore_evas_gl_x11_direct_resize_get(const Ecore_Evas *ee __UNUSED__) | ||
3472 | { | ||
3473 | return 0; | ||
3474 | } | ||
3475 | #endif /* ! BUILD_ECORE_EVAS_OPENGL_X11 */ | ||
3476 | |||
3477 | /** | ||
3478 | * To be documented. | ||
3479 | * | ||
3480 | * FIXME: To be fixed. | ||
3481 | */ | ||
3482 | #ifdef BUILD_ECORE_EVAS_OPENGL_X11 | ||
3483 | EAPI void | ||
3484 | ecore_evas_gl_x11_extra_event_window_add(Ecore_Evas *ee, Ecore_X_Window win) | ||
3485 | { | ||
3486 | ecore_evas_software_x11_extra_event_window_add(ee, win); | ||
3487 | } | ||
3488 | #else | ||
3489 | EAPI void | ||
3490 | ecore_evas_gl_x11_extra_event_window_add(Ecore_Evas *ee __UNUSED__, Ecore_X_Window win __UNUSED__) | ||
3491 | { | ||
3492 | } | ||
3493 | #endif /* ! BUILD_ECORE_EVAS_OPENGL_X11 */ | ||
3494 | |||
3495 | /** | ||
3496 | * To be documented. | ||
3497 | * | ||
3498 | * FIXME: To be fixed. | ||
3499 | */ | ||
3500 | #ifdef BUILD_ECORE_EVAS_OPENGL_X11 | ||
3501 | EAPI void | ||
3502 | ecore_evas_gl_x11_pre_post_swap_callback_set(const Ecore_Evas *ee, void *data, void (*pre_cb) (void *data, Evas *e), void (*post_cb) (void *data, Evas *e)) | ||
3503 | { | ||
3504 | Evas_Engine_Info_GL_X11 *einfo; | ||
3505 | |||
3506 | if (!(!strcmp(ee->driver, "opengl_x11"))) return; | ||
3507 | |||
3508 | einfo = (Evas_Engine_Info_GL_X11 *)evas_engine_info_get(ee->evas); | ||
3509 | if (einfo) | ||
3510 | { | ||
3511 | einfo->callback.pre_swap = pre_cb; | ||
3512 | einfo->callback.post_swap = post_cb; | ||
3513 | einfo->callback.data = data; | ||
3514 | if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) | ||
3515 | { | ||
3516 | ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); | ||
3517 | } | ||
3518 | } | ||
3519 | } | ||
3520 | #else | ||
3521 | EAPI void | ||
3522 | ecore_evas_gl_x11_pre_post_swap_callback_set(const Ecore_Evas *ee __UNUSED__, void *data __UNUSED__, void (*pre_cb) (void *data, Evas *e) __UNUSED__, void (*post_cb) (void *data, Evas *e) __UNUSED__) | ||
3523 | { | ||
3524 | return; | ||
3525 | } | ||
3526 | #endif /* ! BUILD_ECORE_EVAS_OPENGL_X11 */ | ||
3527 | |||
3528 | /** | ||
3529 | * To be documented. | ||
3530 | * | ||
3531 | * FIXME: To be fixed or maybe removed rather? | ||
3532 | */ | ||
3533 | EAPI Ecore_Evas * | ||
3534 | ecore_evas_xrender_x11_new(const char *disp_name __UNUSED__, Ecore_X_Window parent __UNUSED__, | ||
3535 | int x __UNUSED__, int y __UNUSED__, int w __UNUSED__, int h __UNUSED__) | ||
3536 | { | ||
3537 | return NULL; | ||
3538 | } | ||
3539 | |||
3540 | /** | ||
3541 | * To be documented. | ||
3542 | * | ||
3543 | * FIXME: To be fixed or maybe removed rather? | ||
3544 | */ | ||
3545 | EAPI Ecore_X_Window | ||
3546 | ecore_evas_xrender_x11_window_get(const Ecore_Evas *ee __UNUSED__) | ||
3547 | { | ||
3548 | return 0; | ||
3549 | } | ||
3550 | |||
3551 | /** | ||
3552 | * To be documented. | ||
3553 | * | ||
3554 | * FIXME: To be fixed. | ||
3555 | */ | ||
3556 | EAPI void | ||
3557 | ecore_evas_xrender_x11_direct_resize_set(Ecore_Evas *ee __UNUSED__, Eina_Bool on __UNUSED__) | ||
3558 | { | ||
3559 | } | ||
3560 | |||
3561 | /** | ||
3562 | * To be documented. | ||
3563 | * | ||
3564 | * FIXME: To be fixed. | ||
3565 | */ | ||
3566 | EAPI Eina_Bool | ||
3567 | ecore_evas_xrender_x11_direct_resize_get(const Ecore_Evas *ee __UNUSED__) | ||
3568 | { | ||
3569 | return 0; | ||
3570 | } | ||
3571 | |||
3572 | /** | ||
3573 | * To be documented. | ||
3574 | * | ||
3575 | * FIXME: To be fixed. | ||
3576 | */ | ||
3577 | EAPI void | ||
3578 | ecore_evas_xrender_x11_extra_event_window_add(Ecore_Evas *ee __UNUSED__, Ecore_X_Window win __UNUSED__) | ||
3579 | { | ||
3580 | } | ||
3581 | |||
3582 | /** | ||
3583 | * To be documented. | ||
3584 | * | ||
3585 | * FIXME: To be fixed. | ||
3586 | */ | ||
3587 | #if BUILD_ECORE_EVAS_SOFTWARE_16_X11 | ||
3588 | EAPI Ecore_Evas * | ||
3589 | ecore_evas_software_x11_16_new(const char *disp_name, Ecore_X_Window parent, | ||
3590 | int x, int y, int w, int h) | ||
3591 | { | ||
3592 | Evas_Engine_Info_Software_16_X11 *einfo; | ||
3593 | Ecore_Evas *ee; | ||
3594 | int rmethod; | ||
3595 | static int redraw_debug = -1; | ||
3596 | |||
3597 | rmethod = evas_render_method_lookup("software_16_x11"); | ||
3598 | if (!rmethod) return NULL; | ||
3599 | if (!ecore_x_init(disp_name)) return NULL; | ||
3600 | ee = calloc(1, sizeof(Ecore_Evas)); | ||
3601 | if (!ee) return NULL; | ||
3602 | |||
3603 | ECORE_MAGIC_SET(ee, ECORE_MAGIC_EVAS); | ||
3604 | |||
3605 | _ecore_evas_x_init(); | ||
3606 | |||
3607 | ee->engine.func = (Ecore_Evas_Engine_Func *)&_ecore_x_engine_func; | ||
3608 | |||
3609 | ee->driver = "software_16_x11"; | ||
3610 | if (disp_name) ee->name = strdup(disp_name); | ||
3611 | |||
3612 | if (w < 1) w = 1; | ||
3613 | if (h < 1) h = 1; | ||
3614 | ee->x = x; | ||
3615 | ee->y = y; | ||
3616 | ee->w = w; | ||
3617 | ee->h = h; | ||
3618 | ee->req.x = ee->x; | ||
3619 | ee->req.y = ee->y; | ||
3620 | ee->req.w = ee->w; | ||
3621 | ee->req.h = ee->h; | ||
3622 | |||
3623 | ee->prop.max.w = 32767; | ||
3624 | ee->prop.max.h = 32767; | ||
3625 | ee->prop.layer = 4; | ||
3626 | ee->prop.request_pos = 0; | ||
3627 | ee->prop.sticky = 0; | ||
3628 | ee->engine.x.state.sticky = 0; | ||
3629 | |||
3630 | /* init evas here */ | ||
3631 | ee->evas = evas_new(); | ||
3632 | evas_event_callback_add(ee->evas, EVAS_CALLBACK_RENDER_FLUSH_PRE, _ecore_evas_x_flush_pre, ee); | ||
3633 | evas_event_callback_add(ee->evas, EVAS_CALLBACK_RENDER_FLUSH_POST, _ecore_evas_x_flush_post, ee); | ||
3634 | evas_data_attach_set(ee->evas, ee); | ||
3635 | evas_output_method_set(ee->evas, rmethod); | ||
3636 | evas_output_size_set(ee->evas, w, h); | ||
3637 | evas_output_viewport_set(ee->evas, 0, 0, w, h); | ||
3638 | |||
3639 | ee->engine.x.win_root = parent; | ||
3640 | if (parent != 0) | ||
3641 | { | ||
3642 | /* FIXME: round trip in ecore_x_window_argb_get */ | ||
3643 | if (ecore_x_window_argb_get(parent)) | ||
3644 | { | ||
3645 | ee->prop.window = ecore_x_window_argb_new(parent, x, y, w, h); | ||
3646 | } | ||
3647 | else | ||
3648 | ee->prop.window = ecore_x_window_new(parent, x, y, w, h); | ||
3649 | } | ||
3650 | else | ||
3651 | ee->prop.window = ecore_x_window_new(parent, x, y, w, h); | ||
3652 | if (getenv("DESKTOP_STARTUP_ID")) | ||
3653 | { | ||
3654 | ecore_x_netwm_startup_id_set(ee->prop.window, | ||
3655 | getenv("DESKTOP_STARTUP_ID")); | ||
3656 | /* NB: on linux this may simply empty the env as opposed to completely | ||
3657 | * unset it to being empty - unsure as solartis libc crashes looking | ||
3658 | * for the '=' char */ | ||
3659 | // putenv((char*)"DESKTOP_STARTUP_ID="); | ||
3660 | } | ||
3661 | einfo = (Evas_Engine_Info_Software_16_X11 *)evas_engine_info_get(ee->evas); | ||
3662 | |||
3663 | if (einfo) | ||
3664 | { | ||
3665 | if (ScreenCount(ecore_x_display_get()) > 1) | ||
3666 | { | ||
3667 | Ecore_X_Window *roots; | ||
3668 | int num, i; | ||
3669 | |||
3670 | num = 0; | ||
3671 | roots = ecore_x_window_root_list(&num); | ||
3672 | if (roots) | ||
3673 | { | ||
3674 | XWindowAttributes at; | ||
3675 | |||
3676 | if (XGetWindowAttributes(ecore_x_display_get(), | ||
3677 | parent, &at)) | ||
3678 | { | ||
3679 | for (i = 0; i < num; i++) | ||
3680 | { | ||
3681 | if (at.root == roots[i]) | ||
3682 | break; | ||
3683 | } | ||
3684 | } | ||
3685 | free(roots); | ||
3686 | } | ||
3687 | } | ||
3688 | |||
3689 | if (redraw_debug < 0) | ||
3690 | { | ||
3691 | if (getenv("REDRAW_DEBUG")) | ||
3692 | redraw_debug = atoi(getenv("REDRAW_DEBUG")); | ||
3693 | else | ||
3694 | redraw_debug = 0; | ||
3695 | } | ||
3696 | einfo->info.display = ecore_x_display_get(); | ||
3697 | einfo->info.drawable = ee->prop.window; | ||
3698 | |||
3699 | if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) | ||
3700 | { | ||
3701 | ERR("evas_engine_info_set() init engine '%s' failed.", ee->driver); | ||
3702 | ecore_evas_free(ee); | ||
3703 | return NULL; | ||
3704 | } | ||
3705 | } | ||
3706 | else | ||
3707 | { | ||
3708 | ERR("evas_engine_info_set() init engine '%s' failed.", ee->driver); | ||
3709 | ecore_evas_free(ee); | ||
3710 | return NULL; | ||
3711 | } | ||
3712 | |||
3713 | _ecore_evas_x_hints_update(ee); | ||
3714 | _ecore_evas_x_group_leader_set(ee); | ||
3715 | ecore_x_window_defaults_set(ee->prop.window); | ||
3716 | _ecore_evas_x_protocols_set(ee); | ||
3717 | _ecore_evas_x_sync_set(ee); | ||
3718 | |||
3719 | ee->engine.func->fn_render = _ecore_evas_x_render; | ||
3720 | _ecore_evas_register(ee); | ||
3721 | ecore_x_input_multi_select(ee->prop.window); | ||
3722 | ecore_event_window_register(ee->prop.window, ee, ee->evas, | ||
3723 | (Ecore_Event_Mouse_Move_Cb)_ecore_evas_mouse_move_process, | ||
3724 | (Ecore_Event_Multi_Move_Cb)_ecore_evas_mouse_multi_move_process, | ||
3725 | (Ecore_Event_Multi_Down_Cb)_ecore_evas_mouse_multi_down_process, | ||
3726 | (Ecore_Event_Multi_Up_Cb)_ecore_evas_mouse_multi_up_process); | ||
3727 | return ee; | ||
3728 | } | ||
3729 | #else | ||
3730 | EAPI Ecore_Evas * | ||
3731 | ecore_evas_software_x11_16_new(const char *disp_name __UNUSED__, Ecore_X_Window parent __UNUSED__, | ||
3732 | int x __UNUSED__, int y __UNUSED__, int w __UNUSED__, int h __UNUSED__) | ||
3733 | { | ||
3734 | return NULL; | ||
3735 | } | ||
3736 | #endif /* ! BUILD_ECORE_EVAS_SOFTWARE_16_X11 */ | ||
3737 | |||
3738 | /** | ||
3739 | * To be documented. | ||
3740 | * | ||
3741 | * FIXME: To be fixed. | ||
3742 | */ | ||
3743 | #if BUILD_ECORE_EVAS_SOFTWARE_16_X11 | ||
3744 | EAPI Ecore_X_Window | ||
3745 | ecore_evas_software_x11_16_window_get(const Ecore_Evas *ee) | ||
3746 | { | ||
3747 | return (Ecore_X_Window) ecore_evas_window_get(ee); | ||
3748 | } | ||
3749 | #else | ||
3750 | EAPI Ecore_X_Window | ||
3751 | ecore_evas_software_x11_16_window_get(const Ecore_Evas *ee __UNUSED__) | ||
3752 | { | ||
3753 | return 0; | ||
3754 | } | ||
3755 | #endif /* ! BUILD_ECORE_EVAS_SOFTWARE_16_X11 */ | ||
3756 | |||
3757 | /** | ||
3758 | * To be documented. | ||
3759 | * | ||
3760 | * FIXME: To be fixed. | ||
3761 | */ | ||
3762 | #if BUILD_ECORE_EVAS_SOFTWARE_16_X11 | ||
3763 | EAPI void | ||
3764 | ecore_evas_software_x11_16_direct_resize_set(Ecore_Evas *ee, Eina_Bool on) | ||
3765 | { | ||
3766 | ee->engine.x.direct_resize = on; | ||
3767 | if (ee->prop.avoid_damage) | ||
3768 | { | ||
3769 | if (ee->engine.x.direct_resize) | ||
3770 | { | ||
3771 | /* turn this off for now | ||
3772 | ee->engine.x.using_bg_pixmap = 1; | ||
3773 | ecore_x_window_pixmap_set(ee->prop.window, ee->engine.x.pmap); | ||
3774 | */ | ||
3775 | } | ||
3776 | else | ||
3777 | { | ||
3778 | /* turn this off too- bg pixmap is controlled by avoid damage directly | ||
3779 | ee->engine.x.using_bg_pixmap = 0; | ||
3780 | ecore_x_window_pixmap_set(ee->prop.window, 0); | ||
3781 | ecore_x_window_area_expose(ee->prop.window, 0, 0, ee->w, ee->h); | ||
3782 | */ | ||
3783 | } | ||
3784 | } | ||
3785 | } | ||
3786 | #else | ||
3787 | EAPI void | ||
3788 | ecore_evas_software_x11_16_direct_resize_set(Ecore_Evas *ee __UNUSED__, Eina_Bool on __UNUSED__) | ||
3789 | { | ||
3790 | } | ||
3791 | #endif /* ! BUILD_ECORE_EVAS_SOFTWARE_16_X11 */ | ||
3792 | |||
3793 | /** | ||
3794 | * To be documented. | ||
3795 | * | ||
3796 | * FIXME: To be fixed. | ||
3797 | */ | ||
3798 | #if BUILD_ECORE_EVAS_SOFTWARE_16_X11 | ||
3799 | EAPI Eina_Bool | ||
3800 | ecore_evas_software_x11_16_direct_resize_get(const Ecore_Evas *ee) | ||
3801 | { | ||
3802 | return ee->engine.x.direct_resize; | ||
3803 | } | ||
3804 | #else | ||
3805 | EAPI Eina_Bool | ||
3806 | ecore_evas_software_x11_16_direct_resize_get(const Ecore_Evas *ee __UNUSED__) | ||
3807 | { | ||
3808 | return 0; | ||
3809 | } | ||
3810 | #endif /* ! BUILD_ECORE_EVAS_SOFTWARE_16_X11 */ | ||
3811 | |||
3812 | /** | ||
3813 | * To be documented. | ||
3814 | * | ||
3815 | * FIXME: To be fixed. | ||
3816 | */ | ||
3817 | #if BUILD_ECORE_EVAS_SOFTWARE_16_X11 | ||
3818 | EAPI void | ||
3819 | ecore_evas_software_x11_16_extra_event_window_add(Ecore_Evas *ee, Ecore_X_Window win) | ||
3820 | { | ||
3821 | Ecore_X_Window *winp; | ||
3822 | |||
3823 | winp = malloc(sizeof(Ecore_X_Window)); | ||
3824 | if (winp) | ||
3825 | { | ||
3826 | *winp = win; | ||
3827 | ee->engine.x.win_extra = eina_list_append(ee->engine.x.win_extra, winp); | ||
3828 | ecore_x_input_multi_select(win); | ||
3829 | ecore_event_window_register(win, ee, ee->evas, | ||
3830 | (Ecore_Event_Mouse_Move_Cb)_ecore_evas_mouse_move_process, | ||
3831 | (Ecore_Event_Multi_Move_Cb)_ecore_evas_mouse_multi_move_process, | ||
3832 | (Ecore_Event_Multi_Down_Cb)_ecore_evas_mouse_multi_down_process, | ||
3833 | (Ecore_Event_Multi_Up_Cb)_ecore_evas_mouse_multi_up_process); | ||
3834 | } | ||
3835 | } | ||
3836 | #else | ||
3837 | EAPI void | ||
3838 | ecore_evas_software_x11_16_extra_event_window_add(Ecore_Evas *ee __UNUSED__, Ecore_X_Window win __UNUSED__) | ||
3839 | { | ||
3840 | } | ||
3841 | #endif /* ! BUILD_ECORE_EVAS_SOFTWARE_16_X11 */ | ||
3842 | |||
3843 | |||
3844 | /** | ||
3845 | * To be documented. | ||
3846 | * | ||
3847 | * FIXME: To be fixed. | ||
3848 | */ | ||
3849 | EAPI Ecore_Evas * | ||
3850 | ecore_evas_software_x11_8_new(const char *disp_name, Ecore_X_Window parent, | ||
3851 | int x, int y, int w, int h) | ||
3852 | { | ||
3853 | #if defined (BUILD_ECORE_EVAS_SOFTWARE_8_X11) | ||
3854 | Evas_Engine_Info_Software_8_X11 *einfo; | ||
3855 | Ecore_Evas *ee; | ||
3856 | int argb = 0; | ||
3857 | int rmethod; | ||
3858 | static int redraw_debug = -1; | ||
3859 | |||
3860 | rmethod = evas_render_method_lookup("software_8_x11"); | ||
3861 | if (!rmethod) return NULL; | ||
3862 | if (!ecore_x_init(disp_name)) return NULL; | ||
3863 | ee = calloc(1, sizeof(Ecore_Evas)); | ||
3864 | if (!ee) return NULL; | ||
3865 | |||
3866 | ECORE_MAGIC_SET(ee, ECORE_MAGIC_EVAS); | ||
3867 | |||
3868 | _ecore_evas_x_init(); | ||
3869 | |||
3870 | ee->engine.func = (Ecore_Evas_Engine_Func *)&_ecore_x_engine_func; | ||
3871 | |||
3872 | ee->driver = "software_8_x11"; | ||
3873 | if (disp_name) ee->name = strdup(disp_name); | ||
3874 | |||
3875 | if (w < 1) w = 1; | ||
3876 | if (h < 1) h = 1; | ||
3877 | ee->x = x; | ||
3878 | ee->y = y; | ||
3879 | ee->w = w; | ||
3880 | ee->h = h; | ||
3881 | ee->req.x = ee->x; | ||
3882 | ee->req.y = ee->y; | ||
3883 | ee->req.w = ee->w; | ||
3884 | ee->req.h = ee->h; | ||
3885 | |||
3886 | ee->prop.max.w = 32767; | ||
3887 | ee->prop.max.h = 32767; | ||
3888 | ee->prop.layer = 4; | ||
3889 | ee->prop.request_pos = 0; | ||
3890 | ee->prop.sticky = 0; | ||
3891 | ee->engine.x.state.sticky = 0; | ||
3892 | |||
3893 | /* init evas here */ | ||
3894 | ee->evas = evas_new(); | ||
3895 | evas_event_callback_add(ee->evas, EVAS_CALLBACK_RENDER_FLUSH_PRE, _ecore_evas_x_flush_pre, ee); | ||
3896 | evas_event_callback_add(ee->evas, EVAS_CALLBACK_RENDER_FLUSH_POST, _ecore_evas_x_flush_post, ee); | ||
3897 | evas_data_attach_set(ee->evas, ee); | ||
3898 | evas_output_method_set(ee->evas, rmethod); | ||
3899 | evas_output_size_set(ee->evas, w, h); | ||
3900 | evas_output_viewport_set(ee->evas, 0, 0, w, h); | ||
3901 | |||
3902 | ee->engine.x.win_root = parent; | ||
3903 | // if (parent != 0) | ||
3904 | // { | ||
3905 | // /* FIXME: round trip in ecore_x_window_argb_get */ | ||
3906 | // if (ecore_x_window_argb_get(parent)) | ||
3907 | // { | ||
3908 | // ee->engine.x.win = ecore_x_window_argb_new(parent, x, y, w, h); | ||
3909 | // argb = 1; | ||
3910 | // } | ||
3911 | // else | ||
3912 | // ee->engine.x.win = ecore_x_window_new(parent, x, y, w, h); | ||
3913 | // } | ||
3914 | // else | ||
3915 | ee->prop.window = ecore_x_window_new(parent, x, y, w, h); | ||
3916 | if (getenv("DESKTOP_STARTUP_ID")) | ||
3917 | { | ||
3918 | ecore_x_netwm_startup_id_set(ee->prop.window, | ||
3919 | getenv("DESKTOP_STARTUP_ID")); | ||
3920 | /* NB: on linux this may simply empty the env as opposed to completely | ||
3921 | * unset it to being empty - unsure as solartis libc crashes looking | ||
3922 | * for the '=' char */ | ||
3923 | // putenv((char*)"DESKTOP_STARTUP_ID="); | ||
3924 | } | ||
3925 | einfo = (Evas_Engine_Info_Software_8_X11 *)evas_engine_info_get(ee->evas); | ||
3926 | if (einfo) | ||
3927 | { | ||
3928 | xcb_screen_iterator_t iter; | ||
3929 | xcb_screen_t *screen; | ||
3930 | |||
3931 | /* FIXME: this is inefficient as its a round trip */ | ||
3932 | //einfo->info.backend = 1; | ||
3933 | screen = ecore_x_default_screen_get(); | ||
3934 | iter = xcb_setup_roots_iterator (xcb_get_setup (ecore_x_connection_get())); | ||
3935 | if (iter.rem > 1) | ||
3936 | { | ||
3937 | xcb_get_geometry_cookie_t cookie; | ||
3938 | xcb_get_geometry_reply_t *reply; | ||
3939 | Ecore_X_Window *roots; | ||
3940 | int num; | ||
3941 | uint8_t i; | ||
3942 | |||
3943 | num = 0; | ||
3944 | cookie = xcb_get_geometry_unchecked(ecore_x_connection_get(), parent); | ||
3945 | roots = ecore_x_window_root_list(&num); | ||
3946 | if (roots) | ||
3947 | { | ||
3948 | reply = xcb_get_geometry_reply(ecore_x_connection_get(), cookie, NULL); | ||
3949 | |||
3950 | if (reply) | ||
3951 | { | ||
3952 | for (i = 0; i < num; xcb_screen_next (&iter), i++) | ||
3953 | { | ||
3954 | if (reply->root == roots[i]) | ||
3955 | { | ||
3956 | screen = iter.data; | ||
3957 | break; | ||
3958 | } | ||
3959 | } | ||
3960 | free(reply); | ||
3961 | } | ||
3962 | free(roots); | ||
3963 | } | ||
3964 | else | ||
3965 | { | ||
3966 | reply = xcb_get_geometry_reply(ecore_x_connection_get(), cookie, NULL); | ||
3967 | if (reply) free(reply); | ||
3968 | } | ||
3969 | } | ||
3970 | |||
3971 | if (redraw_debug < 0) | ||
3972 | { | ||
3973 | if (getenv("REDRAW_DEBUG")) | ||
3974 | redraw_debug = atoi(getenv("REDRAW_DEBUG")); | ||
3975 | else | ||
3976 | redraw_debug = 0; | ||
3977 | } | ||
3978 | einfo->info.connection = ecore_x_connection_get(); | ||
3979 | einfo->info.screen = screen; | ||
3980 | einfo->info.drawable = ee->prop.window; | ||
3981 | if (argb) | ||
3982 | { | ||
3983 | /* FIXME: round trip */ | ||
3984 | xcb_get_geometry_cookie_t cookie_geom; | ||
3985 | xcb_get_window_attributes_cookie_t cookie_attr; | ||
3986 | xcb_get_geometry_reply_t *reply_geom; | ||
3987 | xcb_get_window_attributes_reply_t *reply_attr; | ||
3988 | |||
3989 | cookie_geom = xcb_get_geometry_unchecked(ecore_x_connection_get(), ee->prop.window); | ||
3990 | cookie_attr = xcb_get_window_attributes_unchecked(ecore_x_connection_get(), ee->prop.window); | ||
3991 | |||
3992 | reply_geom = xcb_get_geometry_reply(ecore_x_connection_get(), cookie_geom, NULL); | ||
3993 | reply_attr = xcb_get_window_attributes_reply(ecore_x_connection_get(), cookie_attr, NULL); | ||
3994 | if (reply_attr && reply_geom) | ||
3995 | { | ||
3996 | einfo->info.visual = xcb_visualtype_get(ecore_x_default_screen_get(), reply_attr->visual); | ||
3997 | einfo->info.colormap = reply_attr->colormap; | ||
3998 | einfo->info.depth = reply_geom->depth; | ||
3999 | einfo->info.destination_alpha = 1; | ||
4000 | free(reply_geom); | ||
4001 | free(reply_attr); | ||
4002 | } | ||
4003 | } | ||
4004 | else | ||
4005 | { | ||
4006 | xcb_screen_t *screen; | ||
4007 | |||
4008 | screen = ecore_x_default_screen_get(); | ||
4009 | einfo->info.visual = xcb_visualtype_get(screen, screen->root_visual); | ||
4010 | einfo->info.colormap = screen->default_colormap; | ||
4011 | einfo->info.depth = screen->root_depth; | ||
4012 | einfo->info.destination_alpha = 0; | ||
4013 | } | ||
4014 | einfo->info.rotation = 0; | ||
4015 | einfo->info.debug = redraw_debug; | ||
4016 | if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) | ||
4017 | { | ||
4018 | ERR("evas_engine_info_set() init engine '%s' failed.", ee->driver); | ||
4019 | ecore_evas_free(ee); | ||
4020 | return NULL; | ||
4021 | } | ||
4022 | } | ||
4023 | else | ||
4024 | { | ||
4025 | ERR("evas_engine_info_set() init engine '%s' failed.", ee->driver); | ||
4026 | ecore_evas_free(ee); | ||
4027 | return NULL; | ||
4028 | } | ||
4029 | |||
4030 | _ecore_evas_x_hints_update(ee); | ||
4031 | _ecore_evas_x_group_leader_set(ee); | ||
4032 | ecore_x_window_defaults_set(ee->prop.window); | ||
4033 | _ecore_evas_x_protocols_set(ee); | ||
4034 | _ecore_evas_x_sync_set(ee); | ||
4035 | |||
4036 | ee->engine.func->fn_render = _ecore_evas_x_render; | ||
4037 | _ecore_evas_register(ee); | ||
4038 | ecore_x_input_multi_select(ee->prop.window); | ||
4039 | ecore_event_window_register(ee->prop.window, ee, ee->evas, | ||
4040 | (Ecore_Event_Mouse_Move_Cb)_ecore_evas_mouse_move_process, | ||
4041 | (Ecore_Event_Multi_Move_Cb)_ecore_evas_mouse_multi_move_process, | ||
4042 | (Ecore_Event_Multi_Down_Cb)_ecore_evas_mouse_multi_down_process, | ||
4043 | (Ecore_Event_Multi_Up_Cb)_ecore_evas_mouse_multi_up_process); | ||
4044 | |||
4045 | return ee; | ||
4046 | #else | ||
4047 | return NULL; | ||
4048 | (void)(disp_name); | ||
4049 | (void)(parent); | ||
4050 | (void)(x); | ||
4051 | (void)(y); | ||
4052 | (void)(w); | ||
4053 | (void)(h); | ||
4054 | #endif /* ! BUILD_ECORE_EVAS_SOFTWARE_8_X11 */ | ||
4055 | } | ||
4056 | |||
4057 | /** | ||
4058 | * To be documented. | ||
4059 | * | ||
4060 | * FIXME: To be fixed. | ||
4061 | */ | ||
4062 | EAPI Ecore_X_Window | ||
4063 | ecore_evas_software_x11_8_window_get(const Ecore_Evas *ee) | ||
4064 | { | ||
4065 | #if defined (BUILD_ECORE_EVAS_SOFTWARE_8_X11) | ||
4066 | return (Ecore_X_Window) ecore_evas_window_get(ee); | ||
4067 | #else | ||
4068 | return 0; | ||
4069 | (void)(ee); | ||
4070 | #endif | ||
4071 | } | ||
4072 | |||
4073 | /** | ||
4074 | * To be documented. | ||
4075 | * | ||
4076 | * FIXME: To be fixed. | ||
4077 | */ | ||
4078 | EAPI Ecore_X_Window | ||
4079 | ecore_evas_software_x11_8_subwindow_get(const Ecore_Evas *ee) | ||
4080 | { | ||
4081 | #if defined (BUILD_ECORE_EVAS_SOFTWARE_8_X11) | ||
4082 | return (Ecore_X_Window) ecore_evas_window_get(ee); | ||
4083 | #else | ||
4084 | return 0; | ||
4085 | (void)(ee); | ||
4086 | #endif | ||
4087 | } | ||
4088 | |||
4089 | /** | ||
4090 | * To be documented. | ||
4091 | * | ||
4092 | * FIXME: To be fixed. | ||
4093 | */ | ||
4094 | EAPI void | ||
4095 | ecore_evas_software_x11_8_direct_resize_set(Ecore_Evas *ee, Eina_Bool on) | ||
4096 | { | ||
4097 | #if defined (BUILD_ECORE_EVAS_SOFTWARE_8_X11) | ||
4098 | ee->engine.x.direct_resize = on; | ||
4099 | if (ee->prop.avoid_damage) | ||
4100 | { | ||
4101 | if (ee->engine.x.direct_resize) | ||
4102 | { | ||
4103 | /* turn this off for now | ||
4104 | ee->engine.x.using_bg_pixmap = 1; | ||
4105 | ecore_x_window_pixmap_set(ee->engine.x.win, ee->engine.x.pmap); | ||
4106 | */ | ||
4107 | } | ||
4108 | else | ||
4109 | { | ||
4110 | /* turn this off too- bg pixmap is controlled by avoid damage directly | ||
4111 | ee->engine.x.using_bg_pixmap = 0; | ||
4112 | ecore_x_window_pixmap_set(ee->engine.x.win, 0); | ||
4113 | ecore_x_window_area_expose(ee->engine.x.win, 0, 0, ee->w, ee->h); | ||
4114 | */ | ||
4115 | } | ||
4116 | } | ||
4117 | #else | ||
4118 | return; | ||
4119 | (void)(ee); | ||
4120 | (void)(on); | ||
4121 | #endif | ||
4122 | } | ||
4123 | |||
4124 | /** | ||
4125 | * To be documented. | ||
4126 | * | ||
4127 | * FIXME: To be fixed. | ||
4128 | */ | ||
4129 | EAPI Eina_Bool | ||
4130 | ecore_evas_software_x11_8_direct_resize_get(const Ecore_Evas *ee) | ||
4131 | { | ||
4132 | #if defined (BUILD_ECORE_EVAS_SOFTWARE_8_X11) | ||
4133 | return ee->engine.x.direct_resize; | ||
4134 | #else | ||
4135 | return 0; | ||
4136 | (void)(ee); | ||
4137 | #endif | ||
4138 | } | ||
4139 | |||
4140 | /** | ||
4141 | * To be documented. | ||
4142 | * | ||
4143 | * FIXME: To be fixed. | ||
4144 | */ | ||
4145 | EAPI void | ||
4146 | ecore_evas_software_x11_8_extra_event_window_add(Ecore_Evas *ee, Ecore_X_Window win) | ||
4147 | { | ||
4148 | #if defined (BUILD_ECORE_EVAS_SOFTWARE_8_X11) | ||
4149 | Ecore_X_Window *winp; | ||
4150 | |||
4151 | winp = malloc(sizeof(Ecore_X_Window)); | ||
4152 | if (winp) | ||
4153 | { | ||
4154 | *winp = win; | ||
4155 | ee->engine.x.win_extra = eina_list_append(ee->engine.x.win_extra, winp); | ||
4156 | ecore_x_input_multi_select(win); | ||
4157 | ecore_event_window_register(win, ee, ee->evas, | ||
4158 | (Ecore_Event_Mouse_Move_Cb)_ecore_evas_mouse_move_process, | ||
4159 | (Ecore_Event_Multi_Move_Cb)_ecore_evas_mouse_multi_move_process, | ||
4160 | (Ecore_Event_Multi_Down_Cb)_ecore_evas_mouse_multi_down_process, | ||
4161 | (Ecore_Event_Multi_Up_Cb)_ecore_evas_mouse_multi_up_process); | ||
4162 | } | ||
4163 | #else | ||
4164 | return; | ||
4165 | (void)(ee); | ||
4166 | (void)(win); | ||
4167 | #endif | ||
4168 | } | ||
4169 | |||
4170 | EAPI void | ||
4171 | ecore_evas_x11_leader_set(Ecore_Evas *ee, Ecore_X_Window win) | ||
4172 | { | ||
4173 | #ifdef BUILD_ECORE_EVAS_X11 | ||
4174 | _ecore_evas_x_group_leader_unset(ee); | ||
4175 | ee->engine.x.leader = win; | ||
4176 | _ecore_evas_x_group_leader_update(ee); | ||
4177 | #else | ||
4178 | return; | ||
4179 | ee = NULL; | ||
4180 | win = 0; | ||
4181 | #endif | ||
4182 | } | ||
4183 | |||
4184 | EAPI Ecore_X_Window | ||
4185 | ecore_evas_x11_leader_get(Ecore_Evas *ee) | ||
4186 | { | ||
4187 | #ifdef BUILD_ECORE_EVAS_X11 | ||
4188 | return ee->engine.x.leader; | ||
4189 | #else | ||
4190 | return 0; | ||
4191 | ee = NULL; | ||
4192 | #endif | ||
4193 | } | ||
4194 | |||
4195 | EAPI void | ||
4196 | ecore_evas_x11_leader_default_set(Ecore_Evas *ee) | ||
4197 | { | ||
4198 | #ifdef BUILD_ECORE_EVAS_X11 | ||
4199 | _ecore_evas_x_group_leader_unset(ee); | ||
4200 | _ecore_evas_x_group_leader_set(ee); | ||
4201 | #else | ||
4202 | return; | ||
4203 | ee = NULL; | ||
4204 | #endif | ||
4205 | } | ||
4206 | |||
4207 | #ifdef BUILD_ECORE_EVAS_X11 | ||
4208 | static Eina_Bool | ||
4209 | _ecore_evas_x11_convert_rectangle_with_angle(Ecore_Evas *ee, Ecore_X_Rectangle *dst_rect, Ecore_X_Rectangle *src_rect) | ||
4210 | { | ||
4211 | if ((!src_rect) || (!dst_rect)) return 0; | ||
4212 | |||
4213 | if (ee->rotation == 0) | ||
4214 | { | ||
4215 | dst_rect->x = src_rect->x; | ||
4216 | dst_rect->y = src_rect->y; | ||
4217 | dst_rect->width = src_rect->width; | ||
4218 | dst_rect->height = src_rect->height; | ||
4219 | } | ||
4220 | else if (ee->rotation == 90) | ||
4221 | { | ||
4222 | dst_rect->x = src_rect->y; | ||
4223 | dst_rect->y = ee->req.h - src_rect->x - src_rect->width; | ||
4224 | dst_rect->width = src_rect->height; | ||
4225 | dst_rect->height = src_rect->width; | ||
4226 | } | ||
4227 | else if (ee->rotation == 180) | ||
4228 | { | ||
4229 | dst_rect->x = ee->req.w - src_rect->x - src_rect->width; | ||
4230 | dst_rect->y = ee->req.h - src_rect->y - src_rect->height; | ||
4231 | dst_rect->width = src_rect->width; | ||
4232 | dst_rect->height = src_rect->height; | ||
4233 | } | ||
4234 | else if (ee->rotation == 270) | ||
4235 | { | ||
4236 | dst_rect->x = ee->req.w - src_rect->y - src_rect->height; | ||
4237 | dst_rect->y = src_rect->x; | ||
4238 | dst_rect->width = src_rect->height; | ||
4239 | dst_rect->height = src_rect->width; | ||
4240 | } | ||
4241 | else | ||
4242 | { | ||
4243 | return 0; | ||
4244 | } | ||
4245 | |||
4246 | return 1; | ||
4247 | } | ||
4248 | #endif | ||
4249 | |||
4250 | EAPI void | ||
4251 | ecore_evas_x11_shape_input_rectangle_set(Ecore_Evas *ee, int x, int y, int w, int h) | ||
4252 | { | ||
4253 | #ifdef BUILD_ECORE_EVAS_X11 | ||
4254 | Eina_Bool ret; | ||
4255 | Ecore_X_Rectangle src_rect; | ||
4256 | Ecore_X_Rectangle dst_rect; | ||
4257 | |||
4258 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
4259 | { | ||
4260 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
4261 | "ecore_evas_x11_shape_input_rectangle_set"); | ||
4262 | return; | ||
4263 | } | ||
4264 | |||
4265 | src_rect.x = x; | ||
4266 | src_rect.y = y; | ||
4267 | src_rect.width = w; | ||
4268 | src_rect.height = h; | ||
4269 | |||
4270 | dst_rect.x = 0; | ||
4271 | dst_rect.y = 0; | ||
4272 | dst_rect.width = 0; | ||
4273 | dst_rect.height = 0; | ||
4274 | |||
4275 | ret = _ecore_evas_x11_convert_rectangle_with_angle(ee, &dst_rect, &src_rect); | ||
4276 | |||
4277 | if (!ee->engine.x.win_shaped_input) | ||
4278 | ee->engine.x.win_shaped_input = ecore_x_window_override_new(ee->engine.x.win_root, | ||
4279 | 0, 0, 1, 1); | ||
4280 | |||
4281 | if (ret) | ||
4282 | ecore_x_window_shape_input_rectangle_set(ee->engine.x.win_shaped_input, | ||
4283 | dst_rect.x, dst_rect.y, | ||
4284 | dst_rect.width, dst_rect.height); | ||
4285 | #else | ||
4286 | return; | ||
4287 | ee = NULL; | ||
4288 | x = 0; | ||
4289 | y = 0; | ||
4290 | w = 0; | ||
4291 | h = 0; | ||
4292 | #endif | ||
4293 | } | ||
4294 | |||
4295 | EAPI void | ||
4296 | ecore_evas_x11_shape_input_rectangle_add(Ecore_Evas *ee, int x, int y, int w, int h) | ||
4297 | { | ||
4298 | #ifdef BUILD_ECORE_EVAS_X11 | ||
4299 | Eina_Bool ret; | ||
4300 | Ecore_X_Rectangle src_rect; | ||
4301 | Ecore_X_Rectangle dst_rect; | ||
4302 | |||
4303 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
4304 | { | ||
4305 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
4306 | "ecore_evas_x11_shape_input_rectangle_add"); | ||
4307 | return; | ||
4308 | } | ||
4309 | |||
4310 | src_rect.x = x; | ||
4311 | src_rect.y = y; | ||
4312 | src_rect.width = w; | ||
4313 | src_rect.height = h; | ||
4314 | |||
4315 | dst_rect.x = 0; | ||
4316 | dst_rect.y = 0; | ||
4317 | dst_rect.width = 0; | ||
4318 | dst_rect.height = 0; | ||
4319 | |||
4320 | ret = _ecore_evas_x11_convert_rectangle_with_angle(ee, &dst_rect, &src_rect); | ||
4321 | |||
4322 | if (!ee->engine.x.win_shaped_input) | ||
4323 | ee->engine.x.win_shaped_input = ecore_x_window_override_new(ee->engine.x.win_root, | ||
4324 | 0, 0, 1, 1); | ||
4325 | |||
4326 | if (ret) | ||
4327 | ecore_x_window_shape_input_rectangle_add(ee->engine.x.win_shaped_input, | ||
4328 | dst_rect.x, dst_rect.y, | ||
4329 | dst_rect.width, dst_rect.height); | ||
4330 | #else | ||
4331 | return; | ||
4332 | ee = NULL; | ||
4333 | x = 0; | ||
4334 | y = 0; | ||
4335 | w = 0; | ||
4336 | h = 0; | ||
4337 | #endif | ||
4338 | } | ||
4339 | |||
4340 | EAPI void | ||
4341 | ecore_evas_x11_shape_input_rectangle_subtract(Ecore_Evas *ee, int x, int y, int w, int h) | ||
4342 | { | ||
4343 | #ifdef BUILD_ECORE_EVAS_X11 | ||
4344 | Eina_Bool ret; | ||
4345 | Ecore_X_Rectangle src_rect; | ||
4346 | Ecore_X_Rectangle dst_rect; | ||
4347 | |||
4348 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
4349 | { | ||
4350 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
4351 | "ecore_evas_x11_shape_input_rectangle_subtract"); | ||
4352 | return; | ||
4353 | } | ||
4354 | |||
4355 | src_rect.x = x; | ||
4356 | src_rect.y = y; | ||
4357 | src_rect.width = w; | ||
4358 | src_rect.height = h; | ||
4359 | |||
4360 | dst_rect.x = 0; | ||
4361 | dst_rect.y = 0; | ||
4362 | dst_rect.width = 0; | ||
4363 | dst_rect.height = 0; | ||
4364 | |||
4365 | ret = _ecore_evas_x11_convert_rectangle_with_angle(ee, &dst_rect, &src_rect); | ||
4366 | |||
4367 | if (!ee->engine.x.win_shaped_input) | ||
4368 | ee->engine.x.win_shaped_input = ecore_x_window_override_new(ee->engine.x.win_root, | ||
4369 | 0, 0, 1, 1); | ||
4370 | |||
4371 | if (ret) | ||
4372 | ecore_x_window_shape_input_rectangle_subtract(ee->engine.x.win_shaped_input, | ||
4373 | dst_rect.x, dst_rect.y, | ||
4374 | dst_rect.width, dst_rect.height); | ||
4375 | #else | ||
4376 | return; | ||
4377 | ee = NULL; | ||
4378 | x = 0; | ||
4379 | y = 0; | ||
4380 | w = 0; | ||
4381 | h = 0; | ||
4382 | #endif | ||
4383 | } | ||
4384 | |||
4385 | EAPI void | ||
4386 | ecore_evas_x11_shape_input_empty(Ecore_Evas *ee) | ||
4387 | { | ||
4388 | #ifdef BUILD_ECORE_EVAS_X11 | ||
4389 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
4390 | { | ||
4391 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
4392 | "ecore_evas_x11_shape_input_empty"); | ||
4393 | return; | ||
4394 | } | ||
4395 | |||
4396 | if (!ee->engine.x.win_shaped_input) | ||
4397 | ee->engine.x.win_shaped_input = ecore_x_window_override_new(ee->engine.x.win_root, 0, 0, 1, 1); | ||
4398 | |||
4399 | ecore_x_window_shape_input_rectangle_set(ee->engine.x.win_shaped_input, 0, 0, 0, 0); | ||
4400 | #else | ||
4401 | return; | ||
4402 | ee = NULL; | ||
4403 | #endif | ||
4404 | } | ||
4405 | |||
4406 | EAPI void | ||
4407 | ecore_evas_x11_shape_input_reset(Ecore_Evas *ee) | ||
4408 | { | ||
4409 | #ifdef BUILD_ECORE_EVAS_X11 | ||
4410 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
4411 | { | ||
4412 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
4413 | "ecore_evas_x11_shape_input_reset"); | ||
4414 | return; | ||
4415 | } | ||
4416 | |||
4417 | if (!ee->engine.x.win_shaped_input) | ||
4418 | ee->engine.x.win_shaped_input = ecore_x_window_override_new(ee->engine.x.win_root, 0, 0, 1, 1); | ||
4419 | |||
4420 | ecore_x_window_shape_input_rectangle_set(ee->engine.x.win_shaped_input, 0, 0, 65535, 65535); | ||
4421 | #else | ||
4422 | return; | ||
4423 | ee = NULL; | ||
4424 | #endif | ||
4425 | } | ||
4426 | |||
4427 | EAPI void | ||
4428 | ecore_evas_x11_shape_input_apply(Ecore_Evas *ee) | ||
4429 | { | ||
4430 | #ifdef BUILD_ECORE_EVAS_X11 | ||
4431 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
4432 | { | ||
4433 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
4434 | "ecore_evas_x11_shape_input_apply"); | ||
4435 | return; | ||
4436 | } | ||
4437 | |||
4438 | if (!ee->engine.x.win_shaped_input) return; | ||
4439 | |||
4440 | ecore_x_window_shape_input_window_set(ee->prop.window, ee->engine.x.win_shaped_input); | ||
4441 | #else | ||
4442 | return; | ||
4443 | ee = NULL; | ||
4444 | #endif | ||
4445 | } | ||