2 * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
12 #include <Ecore_Input.h>
13 #include <Ecore_Input_Evas.h>
14 #ifdef BUILD_ECORE_EVAS_X11
16 # include <Ecore_X_Atoms.h>
19 #include "ecore_evas_private.h"
20 #include "Ecore_Evas.h"
22 #ifdef BUILD_ECORE_EVAS_X11
23 static int _ecore_evas_init_count = 0;
25 static Ecore_Event_Handler *ecore_evas_event_handlers[13];
28 _ecore_evas_x_protocols_set(Ecore_Evas *ee)
30 Ecore_X_Atom protos[10];
33 if (ee->func.fn_delete_request)
34 protos[num++] = ECORE_X_ATOM_WM_DELETE_WINDOW;
35 protos[num++] = ECORE_X_ATOM_NET_WM_PING;
36 ecore_x_icccm_protocol_atoms_set(ee->prop.window, protos, num);
40 _ecore_evas_x_sync_set(Ecore_Evas *ee)
42 if ((ecore_x_e_comp_sync_supported_get(ee->engine.x.win_root)) &&
43 (!ee->no_comp_sync) && (_ecore_evas_app_comp_sync))
45 if (!ee->engine.x.sync_counter)
46 ee->engine.x.sync_counter = ecore_x_sync_counter_new(0);
50 if (ee->engine.x.sync_counter)
51 ecore_x_sync_counter_free(ee->engine.x.sync_counter);
52 ee->engine.x.sync_counter = 0;
54 ecore_x_e_comp_sync_counter_set(ee->prop.window, ee->engine.x.sync_counter);
58 _ecore_evas_x_sync_clear(Ecore_Evas *ee)
60 if (!ee->engine.x.sync_counter) return;
61 ecore_x_sync_counter_free(ee->engine.x.sync_counter);
62 ee->engine.x.sync_counter = 0;
65 #ifdef HAVE_ECORE_X_XCB
66 static xcb_visualtype_t *
67 xcb_visualtype_get(xcb_screen_t *screen, xcb_visualid_t visual)
69 xcb_depth_iterator_t iter_depth;
71 if (!screen) return NULL;
73 iter_depth = xcb_screen_allowed_depths_iterator(screen);
74 for (; iter_depth.rem; xcb_depth_next (&iter_depth))
76 xcb_visualtype_iterator_t iter_vis;
78 iter_vis = xcb_depth_visuals_iterator(iter_depth.data);
79 for (; iter_vis.rem; --screen, xcb_visualtype_next (&iter_vis))
81 if (visual == iter_vis.data->visual_id)
88 #endif /* HAVE_ECORE_X_XCB */
90 #ifdef BUILD_ECORE_EVAS_OPENGL_X11
91 # ifdef HAVE_ECORE_X_XCB
95 _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)
97 Evas_Engine_Info_GL_X11 *einfo;
100 einfo = (Evas_Engine_Info_GL_X11 *)evas_engine_info_get(ee->evas);
103 XSetWindowAttributes attr;
110 for (op = 0; opt[op]; op++)
112 if (opt[op] == ECORE_EVAS_GL_X11_OPT_INDIRECT)
115 einfo->indirect = opt[op];
120 /* FIXME: this is inefficient as its 1 or more round trips */
121 screen = DefaultScreen(ecore_x_display_get());
122 if (ScreenCount(ecore_x_display_get()) > 1)
124 Ecore_X_Window *roots;
128 roots = ecore_x_window_root_list(&num);
131 XWindowAttributes at;
133 if (XGetWindowAttributes(ecore_x_display_get(),
136 for (i = 0; i < num; i++)
138 if (at.root == roots[i])
148 einfo->info.display = ecore_x_display_get();
149 einfo->info.screen = screen;
151 einfo->info.destination_alpha = argb;
153 einfo->info.visual = einfo->func.best_visual_get(einfo);
154 einfo->info.colormap = einfo->func.best_colormap_get(einfo);
155 einfo->info.depth = einfo->func.best_depth_get(einfo);
158 if ((!einfo->info.visual) ||
159 (!einfo->info.colormap) ||
160 (!einfo->info.depth))
162 WRN("OpenGL X11 init engine '%s' failed - no visual, colormap or depth.", ee->driver);
163 evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo);
167 attr.backing_store = NotUseful;
168 attr.override_redirect = override;
169 attr.colormap = einfo->info.colormap;
170 attr.border_pixel = 0;
171 attr.background_pixmap = None;
173 KeyPressMask | KeyReleaseMask |
174 ExposureMask | ButtonPressMask | ButtonReleaseMask |
175 EnterWindowMask | LeaveWindowMask |
176 PointerMotionMask | StructureNotifyMask | VisibilityChangeMask |
177 FocusChangeMask | PropertyChangeMask | ColormapChangeMask;
178 attr.bit_gravity = ForgetGravity;
181 XCreateWindow(einfo->info.display, parent, x, y, w, h, 0,
182 einfo->info.depth, InputOutput, einfo->info.visual,
183 CWBackingStore | CWColormap | CWBackPixmap |
184 CWBorderPixel | CWBitGravity | CWEventMask |
185 CWOverrideRedirect, &attr);
186 einfo->info.drawable = win;
188 if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo))
190 WRN("evas_engine_info_set() init engine '%s' failed.", ee->driver);
191 XDestroyWindow(einfo->info.display, win);
194 ecore_x_window_defaults_set(win);
195 _ecore_evas_x_protocols_set(ee);
196 _ecore_evas_x_sync_set(ee);
204 #endif /* HAVE_ECORE_X_XCB */
208 _ecore_evas_x_render(Ecore_Evas *ee)
211 Eina_List *updates, *l;
213 #ifdef BUILD_ECORE_EVAS_SOFTWARE_BUFFER
217 if ((!ee->no_comp_sync) && (_ecore_evas_app_comp_sync) &&
218 (ee->engine.x.sync_counter) && (!ee->engine.x.sync_began) &&
219 (!ee->engine.x.sync_cancel))
222 EINA_LIST_FOREACH(ee->sub_ecore_evas, ll, ee2)
224 if (ee2->func.fn_pre_render) ee2->func.fn_pre_render(ee2);
225 rend |= _ecore_evas_buffer_render(ee2);
226 if (ee2->func.fn_post_render) ee2->func.fn_post_render(ee2);
229 if (ee->func.fn_pre_render) ee->func.fn_pre_render(ee);
230 if (ee->prop.avoid_damage)
232 updates = evas_render_updates(ee->evas);
233 if (ee->engine.x.using_bg_pixmap)
237 EINA_LIST_FOREACH(updates, l, r)
238 ecore_x_window_area_clear(ee->prop.window, r->x, r->y, r->w, r->h);
239 if ((ee->shaped) && (updates))
240 ecore_x_window_shape_mask_set(ee->prop.window, ee->engine.x.mask);
241 // if ((ee->alpha) && (updates))
242 // ecore_x_window_shape_input_mask_set(ee->prop.window, ee->engine.x.mask);
243 evas_render_updates_free(updates);
244 _ecore_evas_idle_timeout_update(ee);
250 EINA_LIST_FOREACH(updates, l, r)
252 Ecore_X_Rectangle rect;
253 Ecore_X_XRegion *tmpr;
255 if (!ee->engine.x.damages)
256 ee->engine.x.damages = ecore_x_xregion_new();
257 tmpr = ecore_x_xregion_new();
258 if (ee->rotation == 0)
265 else if (ee->rotation == 90)
268 rect.y = ee->h - r->x - r->w;
272 else if (ee->rotation == 180)
274 rect.x = ee->w - r->x - r->w;
275 rect.y = ee->h - r->y - r->h;
279 else if (ee->rotation == 270)
281 rect.x = ee->w - r->y - r->h;
286 ecore_x_xregion_union_rect(tmpr, ee->engine.x.damages, &rect);
287 ecore_x_xregion_free(ee->engine.x.damages);
288 ee->engine.x.damages = tmpr;
290 if (ee->engine.x.damages)
292 /* if we have a damage pixmap - we can avoid exposures by
293 * disabling them just for setting the mask */
294 ecore_x_event_mask_set(ee->prop.window,
295 ECORE_X_EVENT_MASK_KEY_DOWN |
296 ECORE_X_EVENT_MASK_KEY_UP |
297 ECORE_X_EVENT_MASK_MOUSE_DOWN |
298 ECORE_X_EVENT_MASK_MOUSE_UP |
299 ECORE_X_EVENT_MASK_MOUSE_IN |
300 ECORE_X_EVENT_MASK_MOUSE_OUT |
301 ECORE_X_EVENT_MASK_MOUSE_MOVE |
302 // ECORE_X_EVENT_MASK_WINDOW_DAMAGE |
303 ECORE_X_EVENT_MASK_WINDOW_VISIBILITY |
304 ECORE_X_EVENT_MASK_WINDOW_CONFIGURE |
305 ECORE_X_EVENT_MASK_WINDOW_FOCUS_CHANGE |
306 ECORE_X_EVENT_MASK_WINDOW_PROPERTY |
307 ECORE_X_EVENT_MASK_WINDOW_COLORMAP
309 if ((ee->shaped) && (updates))
310 ecore_x_window_shape_mask_set(ee->prop.window, ee->engine.x.mask);
311 /* and re-enable them again */
312 ecore_x_event_mask_set(ee->prop.window,
313 ECORE_X_EVENT_MASK_KEY_DOWN |
314 ECORE_X_EVENT_MASK_KEY_UP |
315 ECORE_X_EVENT_MASK_MOUSE_DOWN |
316 ECORE_X_EVENT_MASK_MOUSE_UP |
317 ECORE_X_EVENT_MASK_MOUSE_IN |
318 ECORE_X_EVENT_MASK_MOUSE_OUT |
319 ECORE_X_EVENT_MASK_MOUSE_MOVE |
320 ECORE_X_EVENT_MASK_WINDOW_DAMAGE |
321 ECORE_X_EVENT_MASK_WINDOW_VISIBILITY |
322 ECORE_X_EVENT_MASK_WINDOW_CONFIGURE |
323 ECORE_X_EVENT_MASK_WINDOW_FOCUS_CHANGE |
324 ECORE_X_EVENT_MASK_WINDOW_PROPERTY |
325 ECORE_X_EVENT_MASK_WINDOW_COLORMAP
327 ecore_x_xregion_set(ee->engine.x.damages, ee->engine.x.gc);
328 /* debug rendering */
330 XSetForeground(ecore_x_display_get(), ee->engine.x.gc, rand());
331 XFillRectangle(ecore_x_display_get(), ee->prop.window, ee->engine.x.gc,
333 XSync(ecore_x_display_get(), False);
335 XSync(ecore_x_display_get(), False);
337 ecore_x_pixmap_paste(ee->engine.x.pmap, ee->prop.window, ee->engine.x.gc,
338 0, 0, ee->w, ee->h, 0, 0);
339 ecore_x_xregion_free(ee->engine.x.damages);
340 ee->engine.x.damages = NULL;
344 evas_render_updates_free(updates);
345 _ecore_evas_idle_timeout_update(ee);
350 else if (((ee->visible) && (ee->draw_ok)) ||
351 ((ee->should_be_visible) && (ee->prop.fullscreen)) ||
352 ((ee->should_be_visible) && (ee->prop.override)))
355 updates = evas_render_updates(ee->evas);
359 ecore_x_window_shape_mask_set(ee->prop.window, ee->engine.x.mask);
361 // ecore_x_window_shape_input_mask_set(ee->prop.window, ee->engine.x.mask);
362 evas_render_updates_free(updates);
363 _ecore_evas_idle_timeout_update(ee);
368 evas_norender(ee->evas);
369 if (ee->func.fn_post_render) ee->func.fn_post_render(ee);
373 static int frames = 0;
374 static double t0 = 0.0;
377 t = ecore_time_get();
382 printf("FPS: %3.3f\n", (double)frames / td);
392 _ecore_evas_x_resize_shape(Ecore_Evas *ee)
394 if (!strcmp(ee->driver, "software_x11"))
396 #ifdef BUILD_ECORE_EVAS_SOFTWARE_X11
397 Evas_Engine_Info_Software_X11 *einfo;
399 einfo = (Evas_Engine_Info_Software_X11 *)evas_engine_info_get(ee->evas);
402 unsigned int foreground;
405 if (ee->engine.x.mask) ecore_x_pixmap_free(ee->engine.x.mask);
406 ee->engine.x.mask = ecore_x_pixmap_new(ee->prop.window, ee->w, ee->h, 1);
408 gc = ecore_x_gc_new(ee->engine.x.mask,
409 ECORE_X_GC_VALUE_MASK_FOREGROUND,
411 ecore_x_drawable_rectangle_fill(ee->engine.x.mask, gc,
414 einfo->info.mask = ee->engine.x.mask;
415 if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo))
417 ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver);
419 evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h);
421 #endif /* BUILD_ECORE_EVAS_SOFTWARE_X11 */
423 else if (!strcmp(ee->driver, "xrender_x11"))
425 #if defined (BUILD_ECORE_EVAS_XRENDER_X11) || defined (BUILD_ECORE_EVAS_XRENDER_XCB)
426 Evas_Engine_Info_XRender_X11 *einfo;
428 einfo = (Evas_Engine_Info_XRender_X11 *)evas_engine_info_get(ee->evas);
431 unsigned int foreground;
434 if (ee->engine.x.mask) ecore_x_pixmap_free(ee->engine.x.mask);
435 ee->engine.x.mask = ecore_x_pixmap_new(ee->prop.window, ee->w, ee->h, 1);
437 gc = ecore_x_gc_new(ee->engine.x.mask,
438 ECORE_X_GC_VALUE_MASK_FOREGROUND,
440 ecore_x_drawable_rectangle_fill(ee->engine.x.mask, gc,
443 einfo->info.mask = ee->engine.x.mask;
444 if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo))
446 ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver);
448 evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h);
451 #endif /* BUILD_ECORE_EVAS_XRENDER_X11 || BUILD_ECORE_EVAS_XRENDER_XCB */
453 else if (!strcmp(ee->driver, "software_16_x11"))
455 #if BUILD_ECORE_EVAS_SOFTWARE_16_X11
456 # if 0 /* XXX no shaped window support for software_16_x11 */
457 Evas_Engine_Info_Software_16_X11 *einfo;
459 einfo = (Evas_Engine_Info_Software_16_X11 *)evas_engine_info_get(ee->evas);
462 if (ee->engine.x.mask) ecore_x_pixmap_free(ee->engine.x.mask);
463 ee->engine.x.mask = ecore_x_pixmap_new(ee->prop.window, ee->w, ee->h, 1);
464 einfo->info.mask = ee->engine.x.mask;
465 if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo))
467 ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver);
469 evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h);
471 # endif /* XXX no shaped window support for software_16_x11 */
472 #endif /* BUILD_ECORE_EVAS_SOFTWARE_16_X11 */
476 /* TODO: we need to make this work for all the states, not just sticky */
478 _ecore_evas_x_event_property_change(void *data __UNUSED__, int type __UNUSED__, void *event)
481 Ecore_X_Event_Window_Property *e;
484 ee = ecore_event_window_match(e->win);
485 if ((!ee) || (ee->ignore_events)) return 1; /* pass on event */
486 if (e->win != ee->prop.window) return 1;
487 if (e->atom == ECORE_X_ATOM_NET_WM_STATE)
490 Ecore_X_Window_State *state;
493 #ifdef HAVE_ECORE_X_XCB
494 ecore_x_netwm_window_state_get_prefetch(e->win);
495 #endif /* HAVE_ECORE_X_XCB */
498 /* TODO: we need to move those to the end, with if statements */
499 ee->engine.x.state.modal = 0;
500 ee->engine.x.state.maximized_v = 0;
501 ee->engine.x.state.maximized_h = 0;
502 ee->engine.x.state.shaded = 0;
503 ee->engine.x.state.skip_taskbar = 0;
504 ee->engine.x.state.skip_pager = 0;
505 ee->prop.fullscreen = 0;
506 ee->engine.x.state.fullscreen = 0;
507 ee->engine.x.state.above = 0;
508 ee->engine.x.state.below = 0;
510 #ifdef HAVE_ECORE_X_XCB
511 ecore_x_netwm_window_state_get_fetch();
512 #endif /* HAVE_ECORE_X_XCB */
513 ecore_x_netwm_window_state_get(e->win, &state, &num);
516 for (i = 0; i < num; i++)
520 case ECORE_X_WINDOW_STATE_MODAL:
521 ee->engine.x.state.modal = 1;
523 case ECORE_X_WINDOW_STATE_STICKY:
524 if (ee->prop.sticky && ee->engine.x.state.sticky)
529 ee->engine.x.state.sticky = 1;
530 if (ee->func.fn_sticky) ee->func.fn_sticky(ee);
532 case ECORE_X_WINDOW_STATE_MAXIMIZED_VERT:
533 ee->engine.x.state.maximized_v = 1;
535 case ECORE_X_WINDOW_STATE_MAXIMIZED_HORZ:
536 ee->engine.x.state.maximized_h = 1;
538 case ECORE_X_WINDOW_STATE_SHADED:
539 ee->engine.x.state.shaded = 1;
541 case ECORE_X_WINDOW_STATE_SKIP_TASKBAR:
542 ee->engine.x.state.skip_taskbar = 1;
544 case ECORE_X_WINDOW_STATE_SKIP_PAGER:
545 ee->engine.x.state.skip_pager = 1;
547 case ECORE_X_WINDOW_STATE_FULLSCREEN:
548 ee->prop.fullscreen = 1;
549 ee->engine.x.state.fullscreen = 1;
551 case ECORE_X_WINDOW_STATE_ABOVE:
552 ee->engine.x.state.above = 1;
554 case ECORE_X_WINDOW_STATE_BELOW:
555 ee->engine.x.state.below = 1;
563 #ifdef HAVE_ECORE_X_XCB
564 ecore_xcb_reply_free();
565 #endif /* HAVE_ECORE_X_XCB */
567 if (ee->prop.sticky && !sticky)
570 ee->engine.x.state.sticky = 0;
571 if (ee->func.fn_unsticky) ee->func.fn_unsticky(ee);
579 _ecore_evas_x_event_visibility_change(void *data __UNUSED__, int type __UNUSED__, void *event)
582 Ecore_X_Event_Window_Visibility_Change *e;
585 ee = ecore_event_window_match(e->win);
586 if (!ee) return 1; /* pass on event */
587 if (e->win != ee->prop.window) return 1;
588 // printf("VIS CHANGE OBSCURED: %p %i\n", ee, e->fully_obscured);
589 if (e->fully_obscured)
591 /* FIXME: round trip */
592 if (!ecore_x_screen_is_composited(ee->engine.x.screen_num))
595 else ee->draw_ok = 1;
600 _ecore_evas_x_event_client_message(void *data __UNUSED__, int type __UNUSED__, void *event)
603 Ecore_X_Event_Client_Message *e;
606 if (e->format != 32) return 1;
607 if (e->message_type == ECORE_X_ATOM_E_COMP_SYNC_BEGIN)
609 ee = ecore_event_window_match(e->data.l[0]);
610 if (!ee) return 1; /* pass on event */
611 if (e->data.l[0] != (long)ee->prop.window) return 1;
612 ee->engine.x.sync_began = 1;
613 ee->engine.x.sync_cancel = 0;
615 else if (e->message_type == ECORE_X_ATOM_E_COMP_SYNC_END)
617 ee = ecore_event_window_match(e->data.l[0]);
618 if (!ee) return 1; /* pass on event */
619 if (e->data.l[0] != (long)ee->prop.window) return 1;
620 ee->engine.x.sync_began = 0;
621 ee->engine.x.sync_cancel = 0;
623 else if (e->message_type == ECORE_X_ATOM_E_COMP_SYNC_CANCEL)
625 ee = ecore_event_window_match(e->data.l[0]);
626 if (!ee) return 1; /* pass on event */
627 if (e->data.l[0] != (long)ee->prop.window) return 1;
628 ee->engine.x.sync_began = 0;
629 ee->engine.x.sync_cancel = 1;
635 _ecore_evas_x_event_mouse_in(void *data __UNUSED__, int type __UNUSED__, void *event)
638 Ecore_X_Event_Mouse_In *e;
641 ee = ecore_event_window_match(e->win);
642 if ((!ee) || (ee->ignore_events)) return 1; /* pass on event */
643 if (e->win != ee->prop.window) return 1;
648 /* const char *modes[] = { */
650 /* "MODE_WHILE_GRABBED", */
654 /* const char *details[] = { */
655 /* "DETAIL_ANCESTOR", */
656 /* "DETAIL_VIRTUAL", */
657 /* "DETAIL_INFERIOR", */
658 /* "DETAIL_NON_LINEAR", */
659 /* "DETAIL_NON_LINEAR_VIRTUAL", */
660 /* "DETAIL_POINTER", */
661 /* "DETAIL_POINTER_ROOT", */
662 /* "DETAIL_DETAIL_NONE" */
664 /* t = time(NULL); */
665 /* ct = ctime(&t); */
666 /* ct[strlen(ct) - 1] = 0; */
667 /* printf("@@ ->IN 0x%x 0x%x %s md=%s dt=%s\n", */
668 /* e->win, e->event_win, */
670 /* modes[e->mode], */
671 /* details[e->detail]); */
673 // disable. causes mroe problems than it fixes
674 // if ((e->mode == ECORE_X_EVENT_MODE_GRAB) ||
675 // (e->mode == ECORE_X_EVENT_MODE_UNGRAB))
677 /* if (e->mode != ECORE_X_EVENT_MODE_NORMAL) return 0; */
678 if (ee->func.fn_mouse_in) ee->func.fn_mouse_in(ee);
679 ecore_event_evas_modifier_lock_update(ee->evas, e->modifiers);
680 evas_event_feed_mouse_in(ee->evas, e->time, NULL);
681 _ecore_evas_mouse_move_process(ee, e->x, e->y, e->time);
686 _ecore_evas_x_event_mouse_out(void *data __UNUSED__, int type __UNUSED__, void *event)
689 Ecore_X_Event_Mouse_Out *e;
692 ee = ecore_event_window_match(e->win);
693 if ((!ee) || (ee->ignore_events)) return 1;
695 if (e->win != ee->prop.window) return 1;
700 /* const char *modes[] = { */
702 /* "MODE_WHILE_GRABBED", */
706 /* const char *details[] = { */
707 /* "DETAIL_ANCESTOR", */
708 /* "DETAIL_VIRTUAL", */
709 /* "DETAIL_INFERIOR", */
710 /* "DETAIL_NON_LINEAR", */
711 /* "DETAIL_NON_LINEAR_VIRTUAL", */
712 /* "DETAIL_POINTER", */
713 /* "DETAIL_POINTER_ROOT", */
714 /* "DETAIL_DETAIL_NONE" */
716 /* t = time(NULL); */
717 /* ct = ctime(&t); */
718 /* ct[strlen(ct) - 1] = 0; */
719 /* printf("@@ ->OUT 0x%x 0x%x %s md=%s dt=%s\n", */
720 /* e->win, e->event_win, */
722 /* modes[e->mode], */
723 /* details[e->detail]); */
725 // disable. causes more problems than it fixes
726 // if ((e->mode == ECORE_X_EVENT_MODE_GRAB) ||
727 // (e->mode == ECORE_X_EVENT_MODE_UNGRAB))
729 /* if (e->mode != ECORE_X_EVENT_MODE_NORMAL) return 0; */
730 ecore_event_evas_modifier_lock_update(ee->evas, e->modifiers);
731 _ecore_evas_mouse_move_process(ee, e->x, e->y, e->time);
732 if (e->mode == ECORE_X_EVENT_MODE_GRAB)
733 evas_event_feed_mouse_cancel(ee->evas, e->time, NULL);
734 evas_event_feed_mouse_out(ee->evas, e->time, NULL);
735 if (ee->func.fn_mouse_out) ee->func.fn_mouse_out(ee);
736 if (ee->prop.cursor.object) evas_object_hide(ee->prop.cursor.object);
741 _ecore_evas_x_event_window_focus_in(void *data __UNUSED__, int type __UNUSED__, void *event)
744 Ecore_X_Event_Window_Focus_In *e;
747 ee = ecore_event_window_match(e->win);
748 if ((!ee) || (ee->ignore_events)) return 1; /* pass on event */
749 if (e->win != ee->prop.window) return 1;
750 if (e->mode == ECORE_X_EVENT_MODE_UNGRAB) return 1;
751 ee->prop.focused = 1;
752 evas_focus_in(ee->evas);
753 if (ee->func.fn_focus_in) ee->func.fn_focus_in(ee);
758 _ecore_evas_x_event_window_focus_out(void *data __UNUSED__, int type __UNUSED__, void *event)
761 Ecore_X_Event_Window_Focus_Out *e;
764 ee = ecore_event_window_match(e->win);
765 if ((!ee) || (ee->ignore_events)) return 1; /* pass on event */
766 if (e->win != ee->prop.window) return 1;
767 if (e->mode == ECORE_X_EVENT_MODE_GRAB) return 1;
768 // if (ee->prop.fullscreen)
769 // ecore_x_window_focus(ee->prop.window);
770 evas_focus_out(ee->evas);
771 ee->prop.focused = 0;
772 if (ee->func.fn_focus_out) ee->func.fn_focus_out(ee);
777 _ecore_evas_x_event_window_damage(void *data __UNUSED__, int type __UNUSED__, void *event)
780 Ecore_X_Event_Window_Damage *e;
783 ee = ecore_event_window_match(e->win);
784 if (!ee) return 1; /* pass on event */
785 if (e->win != ee->prop.window) return 1;
786 if (ee->engine.x.using_bg_pixmap) return 1;
787 // printf("EXPOSE %p [%i] %i %i %ix%i\n", ee, ee->prop.avoid_damage, e->x, e->y, e->w, e->h);
788 if (ee->prop.avoid_damage)
790 Ecore_X_Rectangle rect;
791 Ecore_X_XRegion *tmpr;
793 if (!ee->engine.x.damages) ee->engine.x.damages = ecore_x_xregion_new();
794 tmpr = ecore_x_xregion_new();
799 ecore_x_xregion_union_rect(tmpr, ee->engine.x.damages, &rect);
800 ecore_x_xregion_free(ee->engine.x.damages);
801 ee->engine.x.damages = tmpr;
802 /* no - this breaks things badly. disable. Ecore_X_Rectangle != XRectangle - see
803 * the typedefs in x's headers and ecore_x's. also same with Region - it's a pointer in x - not an X ID
804 Ecore_X_Rectangle rect;
805 Ecore_X_XRegion *tmpr;
807 if (!ee->engine.x.damages) ee->engine.x.damages = ecore_x_xregion_new();
808 tmpr = ecore_x_xregion_new();
813 ecore_x_xregion_union_rect(tmpr, ee->engine.x.damages, &rect);
814 ecore_x_xregion_free(ee->engine.x.damages);
815 ee->engine.x.damages = tmpr;
820 if (ee->rotation == 0)
821 evas_damage_rectangle_add(ee->evas,
825 else if (ee->rotation == 90)
826 evas_damage_rectangle_add(ee->evas,
830 else if (ee->rotation == 180)
831 evas_damage_rectangle_add(ee->evas,
835 else if (ee->rotation == 270)
836 evas_damage_rectangle_add(ee->evas,
845 _ecore_evas_x_event_window_destroy(void *data __UNUSED__, int type __UNUSED__, void *event)
848 Ecore_X_Event_Window_Destroy *e;
851 ee = ecore_event_window_match(e->win);
852 if (!ee) return 1; /* pass on event */
853 if (e->win != ee->prop.window) return 1;
854 if (ee->func.fn_destroy) ee->func.fn_destroy(ee);
855 _ecore_evas_x_sync_clear(ee);
861 _ecore_evas_x_event_window_configure(void *data __UNUSED__, int type __UNUSED__, void *event)
864 Ecore_X_Event_Window_Configure *e;
867 ee = ecore_event_window_match(e->win);
868 if (!ee) return 1; /* pass on event */
869 if (e->win != ee->prop.window) return 1;
870 if (ee->engine.x.direct_resize) return 1;
872 if ((e->from_wm) || (ee->prop.override))
874 if ((ee->x != e->x) || (ee->y != e->y))
880 if (ee->func.fn_move) ee->func.fn_move(ee);
883 if ((ee->w != e->w) || (ee->h != e->h))
889 if ((ee->rotation == 90) || (ee->rotation == 270))
891 evas_output_size_set(ee->evas, ee->h, ee->w);
892 evas_output_viewport_set(ee->evas, 0, 0, ee->h, ee->w);
896 evas_output_size_set(ee->evas, ee->w, ee->h);
897 evas_output_viewport_set(ee->evas, 0, 0, ee->w, ee->h);
899 if (ee->prop.avoid_damage)
903 pdam = ecore_evas_avoid_damage_get(ee);
904 ecore_evas_avoid_damage_set(ee, 0);
905 ecore_evas_avoid_damage_set(ee, pdam);
907 if ((ee->shaped) || (ee->alpha))
908 _ecore_evas_x_resize_shape(ee);
909 if ((ee->expecting_resize.w > 0) &&
910 (ee->expecting_resize.h > 0))
912 if ((ee->expecting_resize.w == ee->w) &&
913 (ee->expecting_resize.h == ee->h))
914 _ecore_evas_mouse_move_process(ee, ee->mouse.x, ee->mouse.y,
915 ecore_x_current_time_get());
916 ee->expecting_resize.w = 0;
917 ee->expecting_resize.h = 0;
919 if (ee->func.fn_resize) ee->func.fn_resize(ee);
925 _ecore_evas_x_event_window_delete_request(void *data __UNUSED__, int type __UNUSED__, void *event)
928 Ecore_X_Event_Window_Delete_Request *e;
931 ee = ecore_event_window_match(e->win);
932 if (!ee) return 1; /* pass on event */
933 if (e->win != ee->prop.window) return 1;
934 if (ee->func.fn_delete_request) ee->func.fn_delete_request(ee);
939 _ecore_evas_x_event_window_show(void *data __UNUSED__, int type __UNUSED__, void *event)
942 Ecore_X_Event_Window_Show *e;
945 ee = ecore_event_window_match(e->win);
946 if (!ee) return 1; /* pass on event */
947 if (e->win != ee->prop.window) return 1;
948 if (ee->visible) return 0; /* dont pass it on */
949 // printf("SHOW EVENT %p\n", ee);
951 if (ee->func.fn_show) ee->func.fn_show(ee);
956 _ecore_evas_x_event_window_hide(void *data __UNUSED__, int type __UNUSED__, void *event)
959 Ecore_X_Event_Window_Hide *e;
962 ee = ecore_event_window_match(e->win);
963 if (!ee) return 1; /* pass on event */
964 if (e->win != ee->prop.window) return 1;
965 if (!ee->visible) return 0; /* dont pass it on */
966 // printf("HIDE EVENT %p\n", ee);
968 if (ee->func.fn_hide) ee->func.fn_hide(ee);
972 /* FIXME, should be in idler */
973 /* FIXME, round trip */
975 _ecore_evas_x_size_pos_hints_update(Ecore_Evas *ee)
977 # ifdef HAVE_ECORE_X_XCB
978 ecore_x_icccm_size_pos_hints_get_prefetch(ee->prop.window);
979 ecore_x_icccm_size_pos_hints_get_fetch();
980 # endif /* HAVE_ECORE_X_XCB */
981 ecore_x_icccm_size_pos_hints_set(ee->prop.window,
982 ee->prop.request_pos /*request_pos */,
983 ECORE_X_GRAVITY_NW /* gravity */,
984 ee->prop.min.w /* min_w */,
985 ee->prop.min.h /* min_h */,
986 ee->prop.max.w /* max_w */,
987 ee->prop.max.h /* max_h */,
988 ee->prop.base.w /* base_w */,
989 ee->prop.base.h /* base_h */,
990 ee->prop.step.w /* step_x */,
991 ee->prop.step.h /* step_y */,
994 # ifdef HAVE_ECORE_X_XCB
995 ecore_xcb_reply_free();
996 # endif /* HAVE_ECORE_X_XCB */
999 /* FIXME, should be in idler */
1001 _ecore_evas_x_state_update(Ecore_Evas *ee)
1003 Ecore_X_Window_State state[10];
1009 if (bd->client.netwm.state.modal)
1010 state[num++] = ECORE_X_WINDOW_STATE_MODAL;
1012 if (ee->engine.x.state.sticky)
1013 state[num++] = ECORE_X_WINDOW_STATE_STICKY;
1015 if (bd->client.netwm.state.maximized_v)
1016 state[num++] = ECORE_X_WINDOW_STATE_MAXIMIZED_VERT;
1017 if (bd->client.netwm.state.maximized_h)
1018 state[num++] = ECORE_X_WINDOW_STATE_MAXIMIZED_HORZ;
1019 if (bd->client.netwm.state.shaded)
1020 state[num++] = ECORE_X_WINDOW_STATE_SHADED;
1021 if (bd->client.netwm.state.skip_taskbar)
1022 state[num++] = ECORE_X_WINDOW_STATE_SKIP_TASKBAR;
1023 if (bd->client.netwm.state.skip_pager)
1024 state[num++] = ECORE_X_WINDOW_STATE_SKIP_PAGER;
1025 if (bd->client.netwm.state.hidden)
1026 state[num++] = ECORE_X_WINDOW_STATE_HIDDEN;
1028 if (ee->engine.x.state.fullscreen)
1029 state[num++] = ECORE_X_WINDOW_STATE_FULLSCREEN;
1030 if (ee->engine.x.state.above)
1031 state[num++] = ECORE_X_WINDOW_STATE_ABOVE;
1032 if (ee->engine.x.state.below)
1033 state[num++] = ECORE_X_WINDOW_STATE_BELOW;
1035 ecore_x_netwm_window_state_set(ee->prop.window, state, num);
1039 _ecore_evas_x_layer_update(Ecore_Evas *ee)
1041 if (ee->should_be_visible)
1043 /* We need to send a netwm request to the wm */
1044 /* FIXME: Do we have to remove old state before adding new? */
1045 if (ee->prop.layer < 3)
1047 if (ee->engine.x.state.above)
1049 ee->engine.x.state.above = 0;
1050 ecore_x_netwm_state_request_send(ee->prop.window,
1051 ee->engine.x.win_root,
1052 ECORE_X_WINDOW_STATE_ABOVE, -1, 0);
1054 if (!ee->engine.x.state.below)
1056 ee->engine.x.state.below = 1;
1057 ecore_x_netwm_state_request_send(ee->prop.window,
1058 ee->engine.x.win_root,
1059 ECORE_X_WINDOW_STATE_BELOW, -1, 1);
1062 else if (ee->prop.layer > 5)
1064 if (ee->engine.x.state.below)
1066 ee->engine.x.state.below = 0;
1067 ecore_x_netwm_state_request_send(ee->prop.window,
1068 ee->engine.x.win_root,
1069 ECORE_X_WINDOW_STATE_BELOW, -1, 0);
1071 if (!ee->engine.x.state.above)
1073 ee->engine.x.state.above = 1;
1074 ecore_x_netwm_state_request_send(ee->prop.window,
1075 ee->engine.x.win_root,
1076 ECORE_X_WINDOW_STATE_ABOVE, -1, 1);
1081 if (ee->engine.x.state.below)
1083 ee->engine.x.state.below = 0;
1084 ecore_x_netwm_state_request_send(ee->prop.window,
1085 ee->engine.x.win_root,
1086 ECORE_X_WINDOW_STATE_BELOW, -1, 0);
1088 if (ee->engine.x.state.above)
1090 ee->engine.x.state.above = 0;
1091 ecore_x_netwm_state_request_send(ee->prop.window,
1092 ee->engine.x.win_root,
1093 ECORE_X_WINDOW_STATE_ABOVE, -1, 0);
1099 /* Just set the state */
1100 if (ee->prop.layer < 3)
1102 if ((ee->engine.x.state.above) || (!ee->engine.x.state.below))
1104 ee->engine.x.state.above = 0;
1105 ee->engine.x.state.below = 1;
1106 _ecore_evas_x_state_update(ee);
1109 else if (ee->prop.layer > 5)
1111 if ((!ee->engine.x.state.above) || (ee->engine.x.state.below))
1113 ee->engine.x.state.above = 1;
1114 ee->engine.x.state.below = 0;
1115 _ecore_evas_x_state_update(ee);
1120 if ((ee->engine.x.state.above) || (ee->engine.x.state.below))
1122 ee->engine.x.state.above = 0;
1123 ee->engine.x.state.below = 0;
1124 _ecore_evas_x_state_update(ee);
1128 /* FIXME: Set gnome layer */
1132 _ecore_evas_x_init(void)
1134 _ecore_evas_init_count++;
1135 if (_ecore_evas_init_count > 1) return _ecore_evas_init_count;
1136 ecore_evas_event_handlers[0] = ecore_event_handler_add(ECORE_X_EVENT_MOUSE_IN, _ecore_evas_x_event_mouse_in, NULL);
1137 ecore_evas_event_handlers[1] = ecore_event_handler_add(ECORE_X_EVENT_MOUSE_OUT, _ecore_evas_x_event_mouse_out, NULL);
1138 ecore_evas_event_handlers[2] = ecore_event_handler_add(ECORE_X_EVENT_WINDOW_FOCUS_IN, _ecore_evas_x_event_window_focus_in, NULL);
1139 ecore_evas_event_handlers[3] = ecore_event_handler_add(ECORE_X_EVENT_WINDOW_FOCUS_OUT, _ecore_evas_x_event_window_focus_out, NULL);
1140 ecore_evas_event_handlers[4] = ecore_event_handler_add(ECORE_X_EVENT_WINDOW_DAMAGE, _ecore_evas_x_event_window_damage, NULL);
1141 ecore_evas_event_handlers[5] = ecore_event_handler_add(ECORE_X_EVENT_WINDOW_DESTROY, _ecore_evas_x_event_window_destroy, NULL);
1142 ecore_evas_event_handlers[6] = ecore_event_handler_add(ECORE_X_EVENT_WINDOW_CONFIGURE, _ecore_evas_x_event_window_configure, NULL);
1143 ecore_evas_event_handlers[7] = ecore_event_handler_add(ECORE_X_EVENT_WINDOW_DELETE_REQUEST, _ecore_evas_x_event_window_delete_request, NULL);
1144 ecore_evas_event_handlers[8] = ecore_event_handler_add(ECORE_X_EVENT_WINDOW_SHOW, _ecore_evas_x_event_window_show, NULL);
1145 ecore_evas_event_handlers[9] = ecore_event_handler_add(ECORE_X_EVENT_WINDOW_HIDE, _ecore_evas_x_event_window_hide, NULL);
1146 ecore_evas_event_handlers[10] = ecore_event_handler_add(ECORE_X_EVENT_WINDOW_PROPERTY, _ecore_evas_x_event_property_change, NULL);
1147 ecore_evas_event_handlers[11] = ecore_event_handler_add(ECORE_X_EVENT_WINDOW_VISIBILITY_CHANGE, _ecore_evas_x_event_visibility_change, NULL);
1148 ecore_evas_event_handlers[12] = ecore_event_handler_add(ECORE_X_EVENT_CLIENT_MESSAGE, _ecore_evas_x_event_client_message, NULL);
1149 ecore_event_evas_init();
1150 return _ecore_evas_init_count;
1154 _ecore_evas_x_free(Ecore_Evas *ee)
1156 _ecore_evas_x_sync_set(ee);
1157 ecore_x_window_free(ee->prop.window);
1158 if (ee->engine.x.pmap) ecore_x_pixmap_free(ee->engine.x.pmap);
1159 if (ee->engine.x.mask) ecore_x_pixmap_free(ee->engine.x.mask);
1160 if (ee->engine.x.gc) ecore_x_gc_free(ee->engine.x.gc);
1161 if (ee->engine.x.damages) ecore_x_xregion_free(ee->engine.x.damages);
1162 ee->engine.x.pmap = 0;
1163 ee->engine.x.mask = 0;
1164 ee->engine.x.gc = 0;
1165 ee->engine.x.damages = NULL;
1166 ecore_event_window_unregister(ee->prop.window);
1167 while (ee->engine.x.win_extra)
1169 Ecore_X_Window *winp;
1171 winp = ee->engine.x.win_extra->data;
1172 ee->engine.x.win_extra = eina_list_remove_list(ee->engine.x.win_extra, ee->engine.x.win_extra);
1173 ecore_event_window_unregister(*winp);
1176 _ecore_evas_x_shutdown();
1181 _ecore_evas_x_callback_delete_request_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee))
1183 ee->func.fn_delete_request = func;
1184 _ecore_evas_x_protocols_set(ee);
1185 _ecore_evas_x_sync_set(ee);
1189 _ecore_evas_x_move(Ecore_Evas *ee, int x, int y)
1193 if (ee->engine.x.direct_resize)
1195 if (!ee->engine.x.managed)
1197 if ((x != ee->x) || (y != ee->y))
1201 ecore_x_window_move(ee->prop.window, x, y);
1202 if (!ee->should_be_visible)
1204 /* We need to request pos */
1205 ee->prop.request_pos = 1;
1206 _ecore_evas_x_size_pos_hints_update(ee);
1208 if (ee->func.fn_move) ee->func.fn_move(ee);
1214 ecore_x_window_move(ee->prop.window, x, y);
1215 if (!ee->should_be_visible)
1217 /* We need to request pos */
1218 ee->prop.request_pos = 1;
1219 _ecore_evas_x_size_pos_hints_update(ee);
1221 if (!ee->engine.x.managed)
1230 _ecore_evas_x_managed_move(Ecore_Evas *ee, int x, int y)
1234 if (ee->engine.x.direct_resize)
1236 ee->engine.x.managed = 1;
1237 if ((x != ee->x) || (y != ee->y))
1241 if (ee->func.fn_move) ee->func.fn_move(ee);
1247 _ecore_evas_x_resize(Ecore_Evas *ee, int w, int h)
1251 if (ee->engine.x.direct_resize)
1253 if ((ee->w != w) || (ee->h != h))
1255 ecore_x_window_resize(ee->prop.window, w, h);
1258 if ((ee->rotation == 90) || (ee->rotation == 270))
1260 evas_output_size_set(ee->evas, ee->h, ee->w);
1261 evas_output_viewport_set(ee->evas, 0, 0, ee->h, ee->w);
1265 evas_output_size_set(ee->evas, ee->w, ee->h);
1266 evas_output_viewport_set(ee->evas, 0, 0, ee->w, ee->h);
1268 if (ee->prop.avoid_damage)
1272 pdam = ecore_evas_avoid_damage_get(ee);
1273 ecore_evas_avoid_damage_set(ee, 0);
1274 ecore_evas_avoid_damage_set(ee, pdam);
1276 if ((ee->shaped) || (ee->alpha))
1277 _ecore_evas_x_resize_shape(ee);
1278 if (ee->func.fn_resize) ee->func.fn_resize(ee);
1282 ecore_x_window_resize(ee->prop.window, w, h);
1286 _ecore_evas_x_move_resize(Ecore_Evas *ee, int x, int y, int w, int h)
1292 if (ee->engine.x.direct_resize)
1294 if ((ee->w != w) || (ee->h != h) || (x != ee->x) || (y != ee->y))
1296 int change_size = 0, change_pos = 0;
1298 if ((ee->w != w) || (ee->h != h)) change_size = 1;
1299 if (!ee->engine.x.managed)
1301 if ((x != ee->x) || (y != ee->y)) change_pos = 1;
1303 ecore_x_window_move_resize(ee->prop.window, x, y, w, h);
1304 if (!ee->engine.x.managed)
1311 if ((ee->rotation == 90) || (ee->rotation == 270))
1313 evas_output_size_set(ee->evas, ee->h, ee->w);
1314 evas_output_viewport_set(ee->evas, 0, 0, ee->h, ee->w);
1318 evas_output_size_set(ee->evas, ee->w, ee->h);
1319 evas_output_viewport_set(ee->evas, 0, 0, ee->w, ee->h);
1321 if (ee->prop.avoid_damage)
1325 pdam = ecore_evas_avoid_damage_get(ee);
1326 ecore_evas_avoid_damage_set(ee, 0);
1327 ecore_evas_avoid_damage_set(ee, pdam);
1329 if ((ee->shaped) || (ee->alpha))
1330 _ecore_evas_x_resize_shape(ee);
1333 if (ee->func.fn_move) ee->func.fn_move(ee);
1337 if (ee->func.fn_resize) ee->func.fn_resize(ee);
1343 ecore_x_window_move_resize(ee->prop.window, x, y, w, h);
1344 if (!ee->engine.x.managed)
1353 _ecore_evas_x_rotation_set_internal(Ecore_Evas *ee, int rotation, int resize,
1354 Evas_Engine_Info *einfo)
1358 rot_dif = ee->rotation - rotation;
1359 if (rot_dif < 0) rot_dif = -rot_dif;
1363 int minw, minh, maxw, maxh, basew, baseh, stepw, steph;
1365 if (!evas_engine_info_set(ee->evas, einfo))
1367 ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver);
1372 if (!ee->prop.fullscreen)
1374 ecore_x_window_resize(ee->prop.window, ee->req.h, ee->req.w);
1375 ee->expecting_resize.w = ee->h;
1376 ee->expecting_resize.h = ee->w;
1382 ecore_x_window_size_get(ee->prop.window, &w, &h);
1383 ecore_x_window_resize(ee->prop.window, h, w);
1384 if ((rotation == 0) || (rotation == 180))
1386 evas_output_size_set(ee->evas, ee->req.w, ee->req.h);
1387 evas_output_viewport_set(ee->evas, 0, 0, ee->req.w, ee->req.h);
1391 evas_output_size_set(ee->evas, ee->req.h, ee->req.w);
1392 evas_output_viewport_set(ee->evas, 0, 0, ee->req.h, ee->req.w);
1394 if (ee->func.fn_resize) ee->func.fn_resize(ee);
1396 if ((ee->rotation == 90) || (ee->rotation == 270))
1397 evas_damage_rectangle_add(ee->evas, 0, 0, ee->req.h, ee->req.w);
1399 evas_damage_rectangle_add(ee->evas, 0, 0, ee->req.w, ee->req.h);
1405 ecore_x_window_size_get(ee->prop.window, &w, &h);
1406 if ((rotation == 0) || (rotation == 180))
1408 evas_output_size_set(ee->evas, ee->w, ee->h);
1409 evas_output_viewport_set(ee->evas, 0, 0, ee->w, ee->h);
1413 evas_output_size_set(ee->evas, ee->h, ee->w);
1414 evas_output_viewport_set(ee->evas, 0, 0, ee->h, ee->w);
1416 if (ee->func.fn_resize) ee->func.fn_resize(ee);
1417 if ((ee->rotation == 90) || (ee->rotation == 270))
1418 evas_damage_rectangle_add(ee->evas, 0, 0, ee->h, ee->w);
1420 evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h);
1422 ecore_evas_size_min_get(ee, &minw, &minh);
1423 ecore_evas_size_max_get(ee, &maxw, &maxh);
1424 ecore_evas_size_base_get(ee, &basew, &baseh);
1425 ecore_evas_size_step_get(ee, &stepw, &steph);
1426 ee->rotation = rotation;
1427 ecore_evas_size_min_set(ee, minh, minw);
1428 ecore_evas_size_max_set(ee, maxh, maxw);
1429 ecore_evas_size_base_set(ee, baseh, basew);
1430 ecore_evas_size_step_set(ee, steph, stepw);
1431 _ecore_evas_mouse_move_process(ee, ee->mouse.x, ee->mouse.y,
1432 ecore_x_current_time_get());
1436 if (!evas_engine_info_set(ee->evas, einfo))
1438 ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver);
1440 ee->rotation = rotation;
1441 _ecore_evas_mouse_move_process(ee, ee->mouse.x, ee->mouse.y,
1442 ecore_x_current_time_get());
1443 if (ee->func.fn_resize) ee->func.fn_resize(ee);
1445 if ((ee->rotation == 90) || (ee->rotation == 270))
1446 evas_damage_rectangle_add(ee->evas, 0, 0, ee->h, ee->w);
1448 evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h);
1453 _ecore_evas_x_rotation_set(Ecore_Evas *ee, int rotation, int resize)
1455 if (ee->rotation == rotation) return;
1456 if (!strcmp(ee->driver, "xrender_x11")) return;
1457 if (!strcmp(ee->driver, "opengl_x11"))
1459 #ifdef BUILD_ECORE_EVAS_OPENGL_X11
1460 Evas_Engine_Info_GL_X11 *einfo;
1462 einfo = (Evas_Engine_Info_GL_X11 *)evas_engine_info_get(ee->evas);
1464 einfo->info.rotation = rotation;
1465 _ecore_evas_x_rotation_set_internal
1466 (ee, rotation, resize, (Evas_Engine_Info *)einfo);
1467 #endif /* BUILD_ECORE_EVAS_OPENGL_X11 */
1469 else if (!strcmp(ee->driver, "software_x11"))
1471 #ifdef BUILD_ECORE_EVAS_SOFTWARE_X11
1472 Evas_Engine_Info_Software_X11 *einfo;
1474 einfo = (Evas_Engine_Info_Software_X11 *)evas_engine_info_get(ee->evas);
1476 einfo->info.rotation = rotation;
1477 _ecore_evas_x_rotation_set_internal
1478 (ee, rotation, resize, (Evas_Engine_Info *)einfo);
1479 #endif /* BUILD_ECORE_EVAS_SOFTWARE_X11 */
1481 else if (!strcmp(ee->driver, "software_16_x11"))
1483 #if BUILD_ECORE_EVAS_SOFTWARE_16_X11
1484 Evas_Engine_Info_Software_16_X11 *einfo;
1486 einfo = (Evas_Engine_Info_Software_16_X11 *)evas_engine_info_get(ee->evas);
1488 einfo->info.rotation = rotation;
1489 _ecore_evas_x_rotation_set_internal
1490 (ee, rotation, resize, (Evas_Engine_Info *)einfo);
1491 #endif /* BUILD_ECORE_EVAS_SOFTWARE_16_X11 */
1496 _ecore_evas_x_shaped_set(Ecore_Evas *ee, int shaped)
1498 if (((ee->shaped) && (shaped)) || ((!ee->shaped) && (!shaped)))
1500 if (!strcmp(ee->driver, "opengl_x11")) return;
1501 if (!strcmp(ee->driver, "software_x11"))
1503 #ifdef BUILD_ECORE_EVAS_SOFTWARE_X11
1504 Evas_Engine_Info_Software_X11 *einfo;
1506 einfo = (Evas_Engine_Info_Software_X11 *)evas_engine_info_get(ee->evas);
1507 ee->shaped = shaped;
1512 unsigned int foreground;
1515 if (!ee->engine.x.mask)
1516 ee->engine.x.mask = ecore_x_pixmap_new(ee->prop.window, ee->w, ee->h, 1);
1518 gc = ecore_x_gc_new(ee->engine.x.mask,
1519 ECORE_X_GC_VALUE_MASK_FOREGROUND,
1521 ecore_x_drawable_rectangle_fill(ee->engine.x.mask, gc,
1522 0, 0, ee->w, ee->h);
1523 ecore_x_gc_free(gc);
1524 einfo->info.mask = ee->engine.x.mask;
1525 if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo))
1527 ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver);
1529 evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h);
1530 ecore_x_window_shape_input_mask_set(ee->prop.window, 0);
1534 if (ee->engine.x.mask) ecore_x_pixmap_free(ee->engine.x.mask);
1535 ee->engine.x.mask = 0;
1536 einfo->info.mask = 0;
1537 evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo);
1538 ecore_x_window_shape_mask_set(ee->prop.window, 0);
1539 ecore_x_window_shape_input_mask_set(ee->prop.window, 0);
1542 #endif /* BUILD_ECORE_EVAS_SOFTWARE_X11 */
1544 else if (!strcmp(ee->driver, "xrender_x11"))
1546 #if defined (BUILD_ECORE_EVAS_XRENDER_X11) || defined (BUILD_ECORE_EVAS_XRENDER_XCB)
1547 Evas_Engine_Info_XRender_X11 *einfo;
1549 ee->shaped = shaped;
1550 einfo = (Evas_Engine_Info_XRender_X11 *)evas_engine_info_get(ee->evas);
1555 unsigned int foreground;
1558 if (!ee->engine.x.mask)
1559 ee->engine.x.mask = ecore_x_pixmap_new(ee->prop.window, ee->w, ee->h, 1);
1561 gc = ecore_x_gc_new(ee->engine.x.mask,
1562 ECORE_X_GC_VALUE_MASK_FOREGROUND,
1564 ecore_x_drawable_rectangle_fill(ee->engine.x.mask, gc,
1565 0, 0, ee->w, ee->h);
1566 ecore_x_gc_free(gc);
1567 einfo->info.mask = ee->engine.x.mask;
1568 if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo))
1570 ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver);
1572 evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h);
1573 ecore_x_window_shape_input_mask_set(ee->prop.window, 0);
1577 if (ee->engine.x.mask) ecore_x_pixmap_free(ee->engine.x.mask);
1578 ee->engine.x.mask = 0;
1579 einfo->info.mask = 0;
1580 if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo))
1582 ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver);
1584 ecore_x_window_shape_mask_set(ee->prop.window, 0);
1585 ecore_x_window_shape_input_mask_set(ee->prop.window, 0);
1588 #endif /* BUILD_ECORE_EVAS_XRENDER_X11 || BUILD_ECORE_EVAS_XRENDER_XCB */
1590 else if (!strcmp(ee->driver, "software_16_x11"))
1592 #if BUILD_ECORE_EVAS_SOFTWARE_16_X11
1593 # if 0 /* XXX no shaped window support for software_16_x11 */
1594 Evas_Engine_Info_Software_16_X11 *einfo;
1596 einfo = (Evas_Engine_Info_Software_16_X11 *)evas_engine_info_get(ee->evas);
1597 ee->shaped = shaped;
1605 ee->engine.x.mask = ecore_x_pixmap_new(ee->prop.window, ee->w, ee->h, 1);
1606 einfo->info.mask = ee->engine.x.mask;
1607 if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo))
1609 ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver);
1611 evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h);
1615 if (ee->engine.x.mask) ecore_x_pixmap_free(ee->engine.x.mask);
1616 ee->engine.x.mask = 0;
1617 einfo->info.mask = 0;
1618 if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo))
1620 ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver);
1622 ecore_x_window_shape_mask_set(ee->prop.window, 0);
1625 # endif /* XXX no shaped window support for software_16_x11 */
1626 #endif /* BUILD_ECORE_EVAS_SOFTWARE_16_X11 */
1631 /* FIXME, round trip */
1633 _ecore_evas_x_alpha_set(Ecore_Evas *ee, int alpha)
1635 # ifdef HAVE_ECORE_X_XCB
1636 xcb_get_geometry_cookie_t cookie_geom;
1637 xcb_get_window_attributes_cookie_t cookie_attr;
1638 xcb_get_geometry_reply_t *reply_geom;
1639 xcb_get_window_attributes_reply_t *reply_attr;
1641 XWindowAttributes att;
1642 #endif /* ! HAVE_ECORE_X_XCB */
1644 if (((ee->alpha) && (alpha)) || ((!ee->alpha) && (!alpha)))
1647 if (!strcmp(ee->driver, "software_x11"))
1649 #ifdef BUILD_ECORE_EVAS_SOFTWARE_X11
1650 Evas_Engine_Info_Software_X11 *einfo;
1652 einfo = (Evas_Engine_Info_Software_X11 *)evas_engine_info_get(ee->evas);
1655 if (!ecore_x_composite_query()) return;
1659 ecore_x_window_free(ee->prop.window);
1660 ecore_event_window_unregister(ee->prop.window);
1663 if (ee->prop.override)
1664 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);
1666 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);
1667 if (!ee->engine.x.mask)
1668 ee->engine.x.mask = ecore_x_pixmap_new(ee->prop.window, ee->req.w, ee->req.h, 1);
1672 if (ee->prop.override)
1673 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);
1675 ee->prop.window = ecore_x_window_new(ee->engine.x.win_root, ee->req.x, ee->req.y, ee->req.w, ee->req.h);
1676 if (ee->engine.x.mask) ecore_x_pixmap_free(ee->engine.x.mask);
1677 ee->engine.x.mask = 0;
1678 ecore_x_window_shape_input_mask_set(ee->prop.window, 0);
1681 einfo->info.destination_alpha = alpha;
1683 # ifdef BUILD_ECORE_EVAS_SOFTWARE_XCB
1684 cookie_geom = xcb_get_geometry_unchecked(ecore_x_connection_get(), ee->prop.window);
1685 cookie_attr = xcb_get_window_attributes_unchecked(ecore_x_connection_get(), ee->prop.window);
1687 reply_geom = xcb_get_geometry_reply(ecore_x_connection_get(), cookie_geom, NULL);
1688 reply_attr = xcb_get_window_attributes_reply(ecore_x_connection_get(), cookie_attr, NULL);
1689 einfo->info.visual = xcb_visualtype_get(ecore_x_default_screen_get(), reply_attr->visual);
1690 einfo->info.colormap = reply_attr->colormap;
1691 einfo->info.depth = reply_geom->depth;
1695 XGetWindowAttributes(ecore_x_display_get(), ee->prop.window, &att);
1696 einfo->info.visual = att.visual;
1697 einfo->info.colormap = att.colormap;
1698 einfo->info.depth = att.depth;
1699 # endif /* ! BUILD_ECORE_EVAS_SOFTWARE_XCB */
1701 // if (ee->engine.x.mask) ecore_x_pixmap_free(ee->engine.x.mask);
1702 // ee->engine.x.mask = 0;
1703 einfo->info.mask = ee->engine.x.mask;
1704 einfo->info.drawable = ee->prop.window;
1705 if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo))
1707 ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver);
1709 evas_damage_rectangle_add(ee->evas, 0, 0, ee->req.w, ee->req.h);
1710 ecore_x_window_shape_mask_set(ee->prop.window, 0);
1711 ecore_x_input_multi_select(ee->prop.window);
1712 ecore_event_window_register(ee->prop.window, ee, ee->evas, (Ecore_Event_Mouse_Move_Cb) _ecore_evas_mouse_move_process);
1713 if (ee->prop.borderless)
1714 ecore_x_mwm_borderless_set(ee->prop.window, ee->prop.borderless);
1715 if (ee->visible) ecore_x_window_show(ee->prop.window);
1716 if (ee->prop.focused) ecore_x_window_focus(ee->prop.window);
1719 ecore_x_icccm_title_set(ee->prop.window, ee->prop.title);
1720 ecore_x_netwm_name_set(ee->prop.window, ee->prop.title);
1722 ecore_x_icccm_hints_set(ee->prop.window,
1723 1 /* accepts_focus */,
1724 ECORE_X_WINDOW_STATE_HINT_NORMAL /* initial_state */,
1725 0 /* icon_pixmap */,
1727 0 /* icon_window */,
1728 0 /* window_group */,
1730 _ecore_evas_x_protocols_set(ee);
1731 _ecore_evas_x_sync_set(ee);
1732 #endif /* BUILD_ECORE_EVAS_SOFTWARE_X11 */
1733 if (getenv("DESKTOP_STARTUP_ID"))
1735 ecore_x_netwm_startup_id_set(ee->prop.window,
1736 getenv("DESKTOP_STARTUP_ID"));
1737 /* NB: on linux this may simply empty the env as opposed to completely
1738 * unset it to being empty - unsure as solartis libc crashes looking
1739 * for the '=' char */
1740 // putenv((char*)"DESKTOP_STARTUP_ID=");
1743 else if (!strcmp(ee->driver, "opengl_x11"))
1745 #ifdef BUILD_ECORE_EVAS_OPENGL_X11
1746 Evas_Engine_Info_GL_X11 *einfo;
1748 einfo = (Evas_Engine_Info_GL_X11 *)evas_engine_info_get(ee->evas);
1751 if (!ecore_x_composite_query()) return;
1755 ecore_x_window_free(ee->prop.window);
1756 ecore_event_window_unregister(ee->prop.window);
1757 ee->prop.window = 0;
1759 einfo->info.destination_alpha = alpha;
1761 if (ee->engine.x.win_root != 0)
1763 /* FIXME: round trip in ecore_x_window_argb_get */
1764 if (ecore_x_window_argb_get(ee->engine.x.win_root))
1766 ee->prop.window = _ecore_evas_x_gl_window_new
1767 (ee, ee->engine.x.win_root,
1768 ee->req.x, ee->req.y, ee->req.w, ee->req.h,
1769 ee->prop.override, 1, NULL);
1772 ee->prop.window = _ecore_evas_x_gl_window_new
1773 (ee, ee->engine.x.win_root,
1774 ee->req.x, ee->req.y, ee->req.w, ee->req.h,
1775 ee->prop.override, ee->alpha, NULL);
1778 ee->prop.window = _ecore_evas_x_gl_window_new
1779 (ee, ee->engine.x.win_root,
1780 ee->req.x, ee->req.y, ee->req.w, ee->req.h,
1781 ee->prop.override, ee->alpha, NULL);
1782 if (!ee->prop.window)
1789 if (ee->prop.override)
1790 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);
1792 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);
1793 if (!ee->engine.x.mask)
1794 ee->engine.x.mask = ecore_x_pixmap_new(ee->prop.window, ee->req.w, ee->req.h, 1);
1798 if (ee->prop.override)
1799 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);
1801 ee->prop.window = ecore_x_window_new(ee->engine.x.win_root, ee->req.x, ee->req.y, ee->req.w, ee->req.h);
1802 if (ee->engine.x.mask) ecore_x_pixmap_free(ee->engine.x.mask);
1803 ee->engine.x.mask = 0;
1804 ecore_x_window_shape_input_mask_set(ee->prop.window, 0);
1808 XGetWindowAttributes(ecore_x_display_get(), ee->prop.window, &att);
1809 einfo->info.visual = att.visual;
1810 einfo->info.colormap = att.colormap;
1811 einfo->info.depth = att.depth;
1813 // if (ee->engine.x.mask) ecore_x_pixmap_free(ee->engine.x.mask);
1814 // ee->engine.x.mask = 0;
1815 // einfo->info.mask = ee->engine.x.mask;
1816 einfo->info.drawable = ee->prop.window;
1817 if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo))
1819 ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver);
1821 evas_damage_rectangle_add(ee->evas, 0, 0, ee->req.w, ee->req.h);
1822 // ecore_x_window_shape_mask_set(ee->prop.window, 0);
1823 ecore_x_input_multi_select(ee->prop.window);
1824 ecore_event_window_register(ee->prop.window, ee, ee->evas, (Ecore_Event_Mouse_Move_Cb) _ecore_evas_mouse_move_process);
1825 if (ee->prop.borderless)
1826 ecore_x_mwm_borderless_set(ee->prop.window, ee->prop.borderless);
1827 if (ee->visible) ecore_x_window_show(ee->prop.window);
1828 if (ee->prop.focused) ecore_x_window_focus(ee->prop.window);
1831 ecore_x_icccm_title_set(ee->prop.window, ee->prop.title);
1832 ecore_x_netwm_name_set(ee->prop.window, ee->prop.title);
1834 ecore_x_icccm_hints_set(ee->prop.window,
1835 1 /* accepts_focus */,
1836 ECORE_X_WINDOW_STATE_HINT_NORMAL /* initial_state */,
1837 0 /* icon_pixmap */,
1839 0 /* icon_window */,
1840 0 /* window_group */,
1842 _ecore_evas_x_protocols_set(ee);
1843 _ecore_evas_x_sync_set(ee);
1844 #endif /* BUILD_ECORE_EVAS_OPENGL_X11 */
1845 if (getenv("DESKTOP_STARTUP_ID"))
1847 ecore_x_netwm_startup_id_set(ee->prop.window,
1848 getenv("DESKTOP_STARTUP_ID"));
1849 /* NB: on linux this may simply empty the env as opposed to completely
1850 * unset it to being empty - unsure as solartis libc crashes looking
1851 * for the '=' char */
1852 // putenv((char*)"DESKTOP_STARTUP_ID=");
1855 else if (!strcmp(ee->driver, "xrender_x11"))
1857 #if defined (BUILD_ECORE_EVAS_XRENDER_X11) || defined (BUILD_ECORE_EVAS_XRENDER_XCB)
1858 Evas_Engine_Info_XRender_X11 *einfo;
1860 einfo = (Evas_Engine_Info_XRender_X11 *)evas_engine_info_get(ee->evas);
1862 if (!ecore_x_composite_query()) return;
1866 ecore_x_window_free(ee->prop.window);
1867 ecore_event_window_unregister(ee->prop.window);
1870 if (ee->prop.override)
1871 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);
1873 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);
1874 if (!ee->engine.x.mask)
1875 ee->engine.x.mask = ecore_x_pixmap_new(ee->prop.window, ee->req.w, ee->req.h, 1);
1879 if (ee->prop.override)
1880 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);
1882 ee->prop.window = ecore_x_window_new(ee->engine.x.win_root, ee->req.x, ee->req.y, ee->req.w, ee->req.h);
1883 if (ee->engine.x.mask) ecore_x_pixmap_free(ee->engine.x.mask);
1884 ee->engine.x.mask = 0;
1885 ecore_x_window_shape_input_mask_set(ee->prop.window, 0);
1888 einfo->info.destination_alpha = alpha;
1890 # ifdef BUILD_ECORE_EVAS_XRENDER_XCB
1891 cookie_attr = xcb_get_window_attributes_unchecked(ecore_x_connection_get(), ee->prop.window);
1892 reply_attr = xcb_get_window_attributes_reply(ecore_x_connection_get(), cookie_attr, NULL);
1894 einfo->info.visual = reply_attr->visual;
1897 XGetWindowAttributes(ecore_x_display_get(), ee->prop.window, &att);
1898 einfo->info.visual = att.visual;
1899 # endif /* ! BUILD_ECORE_EVAS_XRENDER_XCB */
1901 // if (ee->engine.x.mask) ecore_x_pixmap_free(ee->engine.x.mask);
1902 // ee->engine.x.mask = 0;
1903 einfo->info.mask = ee->engine.x.mask;
1904 einfo->info.drawable = ee->prop.window;
1905 if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo))
1907 ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver);
1909 evas_damage_rectangle_add(ee->evas, 0, 0, ee->req.w, ee->req.h);
1910 ecore_x_window_shape_mask_set(ee->prop.window, 0);
1911 ecore_x_input_multi_select(ee->prop.window);
1912 ecore_event_window_register(ee->prop.window, ee, ee->evas, (Ecore_Event_Mouse_Move_Cb) _ecore_evas_mouse_move_process);
1913 if (ee->prop.borderless)
1914 ecore_x_mwm_borderless_set(ee->prop.window, ee->prop.borderless);
1915 if (ee->visible) ecore_x_window_show(ee->prop.window);
1916 if (ee->prop.focused) ecore_x_window_focus(ee->prop.window);
1919 ecore_x_icccm_title_set(ee->prop.window, ee->prop.title);
1920 ecore_x_netwm_name_set(ee->prop.window, ee->prop.title);
1922 ecore_x_icccm_hints_set(ee->prop.window,
1923 1 /* accepts_focus */,
1924 ECORE_X_WINDOW_STATE_HINT_NORMAL /* initial_state */,
1925 0 /* icon_pixmap */,
1927 0 /* icon_window */,
1928 0 /* window_group */,
1930 _ecore_evas_x_protocols_set(ee);
1931 _ecore_evas_x_sync_set(ee);
1932 #endif /* BUILD_ECORE_EVAS_XRENDER_X11 || BUILD_ECORE_EVAS_XRENDER_XCB */
1933 if (getenv("DESKTOP_STARTUP_ID"))
1935 ecore_x_netwm_startup_id_set(ee->prop.window,
1936 getenv("DESKTOP_STARTUP_ID"));
1937 /* NB: on linux this may simply empty the env as opposed to completely
1938 * unset it to being empty - unsure as solartis libc crashes looking
1939 * for the '=' char */
1940 // putenv((char*)"DESKTOP_STARTUP_ID=");
1943 else if (!strcmp(ee->driver, "software_16_x11"))
1945 #if BUILD_ECORE_EVAS_SOFTWARE_16_X11
1946 Evas_Engine_Info_Software_16_X11 *einfo;
1948 einfo = (Evas_Engine_Info_Software_16_X11 *)evas_engine_info_get(ee->evas);
1953 ecore_x_window_free(ee->prop.window);
1954 ecore_event_window_unregister(ee->prop.window);
1957 if (ee->prop.override)
1958 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);
1960 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);
1961 if (!ee->engine.x.mask)
1962 ee->engine.x.mask = ecore_x_pixmap_new(ee->prop.window, ee->req.w, ee->req.h, 1);
1966 if (ee->prop.override)
1967 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);
1969 ee->prop.window = ecore_x_window_new(ee->engine.x.win_root, ee->req.x, ee->req.y, ee->req.w, ee->req.h);
1970 if (ee->engine.x.mask) ecore_x_pixmap_free(ee->engine.x.mask);
1971 ee->engine.x.mask = 0;
1972 ecore_x_window_shape_input_mask_set(ee->prop.window, 0);
1975 # if 0 /* XXX no alpha window support for software_16_x11 */
1976 einfo->info.destination_alpha = alpha;
1977 # endif /* XXX no alpha window support for software_16_x11 */
1979 # if 0 /* XXX no shaped window support for software_16_x11 */
1980 // if (ee->engine.x.mask) ecore_x_pixmap_free(ee->engine.x.mask);
1981 // ee->engine.x.mask = 0;
1982 einfo->info.mask = ee->engine.x.mask;
1983 # endif /* XXX no shaped window support for software_16_x11 */
1985 einfo->info.drawable = ee->prop.window;
1986 if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo))
1988 ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver);
1990 evas_damage_rectangle_add(ee->evas, 0, 0, ee->req.w, ee->req.h);
1991 ecore_x_window_shape_mask_set(ee->prop.window, 0);
1992 ecore_x_input_multi_select(ee->prop.window);
1993 ecore_event_window_register(ee->prop.window, ee, ee->evas, (Ecore_Event_Mouse_Move_Cb) _ecore_evas_mouse_move_process);
1994 if (ee->prop.borderless)
1995 ecore_x_mwm_borderless_set(ee->prop.window, ee->prop.borderless);
1996 if (ee->visible) ecore_x_window_show(ee->prop.window);
1997 if (ee->prop.focused) ecore_x_window_focus(ee->prop.window);
2000 ecore_x_icccm_title_set(ee->prop.window, ee->prop.title);
2001 ecore_x_netwm_name_set(ee->prop.window, ee->prop.title);
2003 ecore_x_icccm_hints_set(ee->prop.window,
2004 1 /* accepts_focus */,
2005 ECORE_X_WINDOW_STATE_HINT_NORMAL /* initial_state */,
2006 0 /* icon_pixmap */,
2008 0 /* icon_window */,
2009 0 /* window_group */,
2011 _ecore_evas_x_protocols_set(ee);
2012 _ecore_evas_x_sync_set(ee);
2013 #endif /* BUILD_ECORE_EVAS_SOFTWARE_16_X11 */
2014 if (getenv("DESKTOP_STARTUP_ID"))
2016 ecore_x_netwm_startup_id_set(ee->prop.window,
2017 getenv("DESKTOP_STARTUP_ID"));
2018 /* NB: on linux this may simply empty the env as opposed to completely
2019 * unset it to being empty - unsure as solartis libc crashes looking
2020 * for the '=' char */
2021 // putenv((char*)"DESKTOP_STARTUP_ID=");
2027 _ecore_evas_x_transparent_set(Ecore_Evas *ee, int transparent)
2029 if (((ee->transparent) && (transparent)) ||
2030 ((!ee->transparent) && (!transparent)))
2033 if (!strcmp(ee->driver, "software_x11"))
2035 #ifdef BUILD_ECORE_EVAS_SOFTWARE_X11
2036 Evas_Engine_Info_Software_X11 *einfo;
2038 einfo = (Evas_Engine_Info_Software_X11 *)evas_engine_info_get(ee->evas);
2041 ee->transparent = transparent;
2042 einfo->info.destination_alpha = transparent;
2043 if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo))
2045 ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver);
2047 evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h);
2051 #endif /* BUILD_ECORE_EVAS_X11 */
2053 #ifdef BUILD_ECORE_EVAS_X11
2055 _ecore_evas_x_show(Ecore_Evas *ee)
2057 ee->should_be_visible = 1;
2058 if (ee->prop.avoid_damage)
2059 _ecore_evas_x_render(ee);
2060 ecore_x_window_show(ee->prop.window);
2061 if (ee->prop.fullscreen)
2062 ecore_x_window_focus(ee->prop.window);
2066 _ecore_evas_x_hide(Ecore_Evas *ee)
2068 ecore_x_window_hide(ee->prop.window);
2069 ee->should_be_visible = 0;
2073 _ecore_evas_x_raise(Ecore_Evas *ee)
2075 if (!ee->prop.fullscreen)
2076 ecore_x_window_raise(ee->prop.window);
2078 ecore_x_window_raise(ee->prop.window);
2082 _ecore_evas_x_lower(Ecore_Evas *ee)
2084 if (!ee->prop.fullscreen)
2085 ecore_x_window_lower(ee->prop.window);
2087 ecore_x_window_lower(ee->prop.window);
2091 _ecore_evas_x_activate(Ecore_Evas *ee)
2093 ecore_x_netwm_client_active_request(ee->engine.x.win_root,
2094 ee->prop.window, 2, 0);
2098 _ecore_evas_x_title_set(Ecore_Evas *ee, const char *t)
2100 if (ee->prop.title) free(ee->prop.title);
2101 ee->prop.title = NULL;
2102 if (t) ee->prop.title = strdup(t);
2103 ecore_x_icccm_title_set(ee->prop.window, ee->prop.title);
2104 ecore_x_netwm_name_set(ee->prop.window, ee->prop.title);
2108 _ecore_evas_x_name_class_set(Ecore_Evas *ee, const char *n, const char *c)
2110 if (ee->prop.name) free(ee->prop.name);
2111 if (ee->prop.clas) free(ee->prop.clas);
2112 ee->prop.name = NULL;
2113 ee->prop.clas = NULL;
2114 if (n) ee->prop.name = strdup(n);
2115 if (c) ee->prop.clas = strdup(c);
2116 ecore_x_icccm_name_class_set(ee->prop.window, ee->prop.name, ee->prop.clas);
2120 _ecore_evas_x_size_min_set(Ecore_Evas *ee, int w, int h)
2124 if ((ee->prop.min.w == w) && (ee->prop.min.h == h)) return;
2127 _ecore_evas_x_size_pos_hints_update(ee);
2131 _ecore_evas_x_size_max_set(Ecore_Evas *ee, int w, int h)
2135 if ((ee->prop.max.w == w) && (ee->prop.max.h == h)) return;
2138 _ecore_evas_x_size_pos_hints_update(ee);
2142 _ecore_evas_x_size_base_set(Ecore_Evas *ee, int w, int h)
2146 if ((ee->prop.base.w == w) && (ee->prop.base.h == h)) return;
2147 ee->prop.base.w = w;
2148 ee->prop.base.h = h;
2149 _ecore_evas_x_size_pos_hints_update(ee);
2153 _ecore_evas_x_size_step_set(Ecore_Evas *ee, int w, int h)
2157 if ((ee->prop.step.w == w) && (ee->prop.step.h == h)) return;
2158 ee->prop.step.w = w;
2159 ee->prop.step.h = h;
2160 _ecore_evas_x_size_pos_hints_update(ee);
2164 _ecore_evas_object_cursor_del(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
2170 ee->prop.cursor.object = NULL;
2174 _ecore_evas_x_object_cursor_set(Ecore_Evas *ee, Evas_Object *obj, int layer, int hot_x, int hot_y)
2178 if (ee->prop.cursor.object) evas_object_del(ee->prop.cursor.object);
2182 ee->prop.cursor.object = NULL;
2183 ee->prop.cursor.layer = 0;
2184 ee->prop.cursor.hot.x = 0;
2185 ee->prop.cursor.hot.y = 0;
2186 ecore_x_window_cursor_show(ee->prop.window, 1);
2190 ee->prop.cursor.object = obj;
2191 ee->prop.cursor.layer = layer;
2192 ee->prop.cursor.hot.x = hot_x;
2193 ee->prop.cursor.hot.y = hot_y;
2195 ecore_x_window_cursor_show(ee->prop.window, 0);
2197 evas_pointer_output_xy_get(ee->evas, &x, &y);
2198 evas_object_layer_set(ee->prop.cursor.object, ee->prop.cursor.layer);
2199 evas_object_move(ee->prop.cursor.object,
2200 x - ee->prop.cursor.hot.x,
2201 y - ee->prop.cursor.hot.y);
2202 evas_object_pass_events_set(ee->prop.cursor.object, 1);
2203 if (evas_pointer_inside_get(ee->evas))
2204 evas_object_show(ee->prop.cursor.object);
2206 evas_object_event_callback_add(obj, EVAS_CALLBACK_DEL, _ecore_evas_object_cursor_del, ee);
2211 * @param layer If < 3, @a ee will be put below all other windows.
2212 * If > 5, @a ee will be "always-on-top"
2213 * If = 4, @a ee will be put in the default layer.
2214 * Acceptable values range from 1 to 255 (0 reserved for
2218 _ecore_evas_x_layer_set(Ecore_Evas *ee, int layer)
2220 if (ee->prop.layer == layer) return;
2222 /* FIXME: Should this logic be here? */
2225 else if (layer > 255)
2228 ee->prop.layer = layer;
2229 _ecore_evas_x_layer_update(ee);
2233 _ecore_evas_x_focus_set(Ecore_Evas *ee, int on __UNUSED__)
2235 ecore_x_window_focus(ee->prop.window);
2239 _ecore_evas_x_iconified_set(Ecore_Evas *ee, int on)
2241 // if (((ee->prop.iconified) && (on)) ||
2242 // ((!ee->prop.iconified) && (!on))) return;
2243 ee->prop.iconified = on;
2246 ecore_x_icccm_hints_set(ee->prop.window,
2247 1 /* accepts_focus */,
2248 ECORE_X_WINDOW_STATE_HINT_ICONIC /* initial_state */,
2249 0 /* icon_pixmap */,
2251 0 /* icon_window */,
2252 0 /* window_group */,
2254 ecore_x_icccm_iconic_request_send(ee->prop.window, ee->engine.x.win_root);
2258 ecore_x_icccm_hints_set(ee->prop.window,
2259 1 /* accepts_focus */,
2260 ECORE_X_WINDOW_STATE_HINT_NORMAL /* initial_state */,
2261 0 /* icon_pixmap */,
2263 0 /* icon_window */,
2264 0 /* window_group */,
2266 ecore_evas_show(ee);
2271 _ecore_evas_x_borderless_set(Ecore_Evas *ee, int on)
2273 if (((ee->prop.borderless) && (on)) ||
2274 ((!ee->prop.borderless) && (!on))) return;
2275 ee->prop.borderless = on;
2276 ecore_x_mwm_borderless_set(ee->prop.window, ee->prop.borderless);
2279 /* FIXME: This function changes the initial state of the ee
2280 * whilest the iconic function changes the current state! */
2282 _ecore_evas_x_withdrawn_set(Ecore_Evas *ee, int withdrawn)
2284 Ecore_X_Window_State_Hint hint;
2286 if ((ee->prop.withdrawn && withdrawn) ||
2287 (!ee->prop.withdrawn && !withdrawn)) return;
2289 ee->prop.withdrawn = withdrawn;
2291 hint = ECORE_X_WINDOW_STATE_HINT_WITHDRAWN;
2293 hint = ECORE_X_WINDOW_STATE_HINT_NORMAL;
2295 ecore_x_icccm_hints_set(ee->prop.window,
2296 1 /* accepts_focus */,
2297 hint /* initial_state */,
2298 0 /* icon_pixmap */,
2300 0 /* icon_window */,
2301 0 /* window_group */,
2306 _ecore_evas_x_sticky_set(Ecore_Evas *ee, int sticky)
2308 if ((ee->prop.sticky && sticky) ||
2309 (!ee->prop.sticky && !sticky)) return;
2311 /* We dont want to set prop.sticky here as it will cause
2312 * the sticky callback not to get called. Its set on the
2313 * property change event.
2314 * ee->prop.sticky = sticky;
2316 ee->engine.x.state.sticky = sticky;
2317 if (ee->should_be_visible)
2318 ecore_x_netwm_state_request_send(ee->prop.window, ee->engine.x.win_root,
2319 ECORE_X_WINDOW_STATE_STICKY, -1, sticky);
2321 _ecore_evas_x_state_update(ee);
2325 _ecore_evas_x_ignore_events_set(Ecore_Evas *ee, int ignore)
2327 if ((ee->ignore_events && ignore) ||
2328 (!ee->ignore_events && !ignore)) return;
2332 ee->ignore_events = 1;
2333 if (ee->prop.window)
2334 ecore_x_window_ignore_set(ee->prop.window, 1);
2338 ee->ignore_events = 0;
2339 if (ee->prop.window)
2340 ecore_x_window_ignore_set(ee->prop.window, 0);
2346 _ecore_evas_x_reinit_win(Ecore_Evas *ee)
2348 if (!strcmp(ee->driver, "software_x11"))
2350 #ifdef BUILD_ECORE_EVAS_X11
2351 Evas_Engine_Info_Software_X11 *einfo;
2353 einfo = (Evas_Engine_Info_Software_X11 *)evas_engine_info_get(ee->evas);
2356 einfo->info.drawable = ee->prop.window;
2357 evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo);
2361 else if (!strcmp(ee->driver, "xrender_x11"))
2363 #ifdef BUILD_ECORE_EVAS_XRENDER_X11
2364 Evas_Engine_Info_XRender_X11 *einfo;
2366 einfo = (Evas_Engine_Info_XRender_X11 *)evas_engine_info_get(ee->evas);
2369 einfo->info.drawable = ee->prop.window;
2370 evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo);
2374 else if (!strcmp(ee->driver, "opengl_x11"))
2376 #ifdef BUILD_ECORE_EVAS_OPENGL_X11
2377 Evas_Engine_Info_GL_X11 *einfo;
2379 einfo = (Evas_Engine_Info_GL_X11 *)evas_engine_info_get(ee->evas);
2382 einfo->info.drawable = ee->prop.window;
2383 evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo);
2391 _ecore_evas_x_override_set(Ecore_Evas *ee, int on)
2393 if (((ee->prop.override) && (on)) ||
2394 ((!ee->prop.override) && (!on))) return;
2395 ecore_x_window_hide(ee->prop.window);
2396 ecore_x_window_override_set(ee->prop.window, on);
2397 if (ee->visible) ecore_x_window_show(ee->prop.window);
2398 if (ee->prop.focused) ecore_x_window_focus(ee->prop.window);
2399 ee->prop.override = on;
2403 _ecore_evas_x_fullscreen_set(Ecore_Evas *ee, int on)
2405 if ((ee->prop.fullscreen && on) ||
2406 (!ee->prop.fullscreen && !on)) return;
2408 /* FIXME: Detect if WM is EWMH compliant and handle properly if not,
2409 * i.e. reposition, resize, and change borderless hint */
2410 ee->engine.x.state.fullscreen = on;
2411 if (ee->should_be_visible)
2412 ecore_x_netwm_state_request_send(ee->prop.window, ee->engine.x.win_root,
2413 ECORE_X_WINDOW_STATE_FULLSCREEN, -1, on);
2415 _ecore_evas_x_state_update(ee);
2419 _ecore_evas_x_avoid_damage_set(Ecore_Evas *ee, int on)
2421 if (ee->prop.avoid_damage == on) return;
2422 if (!strcmp(ee->driver, "opengl_x11")) return;
2423 if (!strcmp(ee->driver, "xrender_x11")) return;
2425 if (!strcmp(ee->driver, "software_x11"))
2427 #ifdef BUILD_ECORE_EVAS_SOFTWARE_X11
2428 Evas_Engine_Info_Software_X11 *einfo;
2430 ee->prop.avoid_damage = on;
2431 einfo = (Evas_Engine_Info_Software_X11 *)evas_engine_info_get(ee->evas);
2434 if (ee->prop.avoid_damage)
2436 ee->engine.x.pmap = ecore_x_pixmap_new(ee->prop.window, ee->w, ee->h, einfo->info.depth);
2437 ee->engine.x.gc = ecore_x_gc_new(ee->engine.x.pmap, 0, NULL);
2438 einfo->info.drawable = ee->engine.x.pmap;
2439 if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo))
2441 ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver);
2443 if ((ee->rotation == 90) || (ee->rotation == 270))
2444 evas_damage_rectangle_add(ee->evas, 0, 0, ee->h, ee->w);
2446 evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h);
2447 if (ee->prop.avoid_damage == ECORE_EVAS_AVOID_DAMAGE_BUILT_IN)
2449 ee->engine.x.using_bg_pixmap = 1;
2450 ecore_x_window_pixmap_set(ee->prop.window, ee->engine.x.pmap);
2451 ecore_x_window_area_expose(ee->prop.window, 0, 0, ee->w, ee->h);
2453 if (ee->engine.x.direct_resize)
2455 /* Turn this off for now
2456 ee->engine.x.using_bg_pixmap = 1;
2457 ecore_x_window_pixmap_set(ee->prop.window, ee->engine.x.pmap);
2463 if (ee->engine.x.pmap) ecore_x_pixmap_free(ee->engine.x.pmap);
2464 if (ee->engine.x.gc) ecore_x_gc_free(ee->engine.x.gc);
2465 if (ee->engine.x.using_bg_pixmap)
2467 ecore_x_window_pixmap_set(ee->prop.window, 0);
2468 ee->engine.x.using_bg_pixmap = 0;
2469 ecore_x_window_area_expose(ee->prop.window, 0, 0, ee->w, ee->h);
2471 ee->engine.x.pmap = 0;
2472 ee->engine.x.gc = 0;
2473 einfo->info.drawable = ee->prop.window;
2474 if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo))
2476 ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver);
2480 #endif /* BUILD_ECORE_EVAS_SOFTWARE_X11 */
2482 else if (!strcmp(ee->driver, "software_16_x11"))
2484 #if BUILD_ECORE_EVAS_SOFTWARE_16_X11
2485 Evas_Engine_Info_Software_16_X11 *einfo;
2486 ee->prop.avoid_damage = on;
2488 einfo = (Evas_Engine_Info_Software_16_X11 *)evas_engine_info_get(ee->evas);
2491 if (ee->prop.avoid_damage)
2493 ee->engine.x.pmap = ecore_x_pixmap_new(ee->prop.window, ee->w, ee->h, 16);
2494 ee->engine.x.gc = ecore_x_gc_new(ee->engine.x.pmap, 0, NULL);
2495 einfo->info.drawable = ee->engine.x.pmap;
2496 if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo))
2498 ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver);
2500 if ((ee->rotation == 90) || (ee->rotation == 270))
2501 evas_damage_rectangle_add(ee->evas, 0, 0, ee->h, ee->w);
2503 evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h);
2504 if (ee->engine.x.direct_resize)
2506 /* Turn this off for now
2507 ee->engine.x.using_bg_pixmap = 1;
2508 ecore_x_window_pixmap_set(ee->prop.window, ee->engine.x.pmap);
2514 if (ee->engine.x.pmap) ecore_x_pixmap_free(ee->engine.x.pmap);
2515 if (ee->engine.x.gc) ecore_x_gc_free(ee->engine.x.gc);
2516 if (ee->engine.x.using_bg_pixmap)
2518 ecore_x_window_pixmap_set(ee->prop.window, 0);
2519 ee->engine.x.using_bg_pixmap = 0;
2521 ee->engine.x.pmap = 0;
2522 ee->engine.x.gc = 0;
2523 einfo->info.drawable = ee->prop.window;
2524 if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo))
2526 ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver);
2530 #endif /* BUILD_ECORE_EVAS_SOFTWARE_16_X11 */
2535 _ecore_evas_x_shutdown(void)
2537 _ecore_evas_init_count--;
2538 if (_ecore_evas_init_count == 0)
2542 for (i = 0; i < sizeof(ecore_evas_event_handlers) / sizeof(Ecore_Event_Handler*); i++)
2544 if (ecore_evas_event_handlers[i])
2545 ecore_event_handler_del(ecore_evas_event_handlers[i]);
2547 ecore_event_evas_shutdown();
2549 if (_ecore_evas_init_count < 0) _ecore_evas_init_count = 0;
2550 return _ecore_evas_init_count;
2553 static Ecore_Evas_Engine_Func _ecore_x_engine_func =
2560 _ecore_evas_x_callback_delete_request_set,
2571 _ecore_evas_x_managed_move,
2572 _ecore_evas_x_resize,
2573 _ecore_evas_x_move_resize,
2574 _ecore_evas_x_rotation_set,
2575 _ecore_evas_x_shaped_set,
2578 _ecore_evas_x_raise,
2579 _ecore_evas_x_lower,
2580 _ecore_evas_x_activate,
2581 _ecore_evas_x_title_set,
2582 _ecore_evas_x_name_class_set,
2583 _ecore_evas_x_size_min_set,
2584 _ecore_evas_x_size_max_set,
2585 _ecore_evas_x_size_base_set,
2586 _ecore_evas_x_size_step_set,
2587 _ecore_evas_x_object_cursor_set,
2588 _ecore_evas_x_layer_set,
2589 _ecore_evas_x_focus_set,
2590 _ecore_evas_x_iconified_set,
2591 _ecore_evas_x_borderless_set,
2592 _ecore_evas_x_override_set,
2594 _ecore_evas_x_fullscreen_set,
2595 _ecore_evas_x_avoid_damage_set,
2596 _ecore_evas_x_withdrawn_set,
2597 _ecore_evas_x_sticky_set,
2598 _ecore_evas_x_ignore_events_set,
2599 _ecore_evas_x_alpha_set,
2600 _ecore_evas_x_transparent_set,
2604 #endif /* BUILD_ECORE_EVAS_X11 */
2607 * FIXME: there are some round trips. Especially, we can split
2608 * ecore_x_init in 2 functions and supress some round trips.
2611 #if defined (BUILD_ECORE_EVAS_SOFTWARE_X11) || defined (BUILD_ECORE_EVAS_OPENGL_X11) || defined (BUILD_ECORE_EVAS_XRENDER_X11) || defined (BUILD_ECORE_EVAS_XRENDER_XCB) || defined (BUILD_ECORE_EVAS_SOFTWARE_16_X11)
2613 _ecore_evas_x_flush_pre(void *data, Evas *e __UNUSED__, void *event_info __UNUSED__)
2615 Ecore_Evas *ee = data;
2617 if (ee->no_comp_sync) return;
2618 if (!_ecore_evas_app_comp_sync) return;
2619 if (ee->engine.x.sync_counter)
2621 if (ee->engine.x.sync_began)
2623 ee->engine.x.sync_val++;
2624 if (!ee->engine.x.sync_cancel)
2626 ecore_x_sync_counter_val_wait(ee->engine.x.sync_counter,
2627 ee->engine.x.sync_val);
2634 _ecore_evas_x_flush_post(void *data, Evas *e __UNUSED__, void *event_info __UNUSED__)
2636 Ecore_Evas *ee = data;
2638 if (ee->no_comp_sync) return;
2639 if (!_ecore_evas_app_comp_sync) return;
2640 if (ee->engine.x.sync_counter)
2642 if (ee->engine.x.sync_began)
2644 if (!ee->engine.x.sync_cancel)
2646 ecore_x_e_comp_sync_draw_done_send(ee->engine.x.win_root,
2657 * FIXME: To be fixed.
2659 #ifdef BUILD_ECORE_EVAS_SOFTWARE_X11
2661 ecore_evas_software_x11_new(const char *disp_name, Ecore_X_Window parent,
2662 int x, int y, int w, int h)
2664 Evas_Engine_Info_Software_X11 *einfo;
2668 static int redraw_debug = -1;
2670 rmethod = evas_render_method_lookup("software_x11");
2671 if (!rmethod) return NULL;
2672 if (!ecore_x_init(disp_name)) return NULL;
2673 ee = calloc(1, sizeof(Ecore_Evas));
2674 if (!ee) return NULL;
2676 ECORE_MAGIC_SET(ee, ECORE_MAGIC_EVAS);
2678 _ecore_evas_x_init();
2680 ee->engine.func = (Ecore_Evas_Engine_Func *)&_ecore_x_engine_func;
2682 ee->driver = "software_x11";
2683 if (disp_name) ee->name = strdup(disp_name);
2696 ee->prop.max.w = 32767;
2697 ee->prop.max.h = 32767;
2699 ee->prop.request_pos = 0;
2700 ee->prop.sticky = 0;
2701 ee->engine.x.state.sticky = 0;
2703 /* init evas here */
2704 ee->evas = evas_new();
2705 evas_event_callback_add(ee->evas, EVAS_CALLBACK_RENDER_FLUSH_PRE, _ecore_evas_x_flush_pre, ee);
2706 evas_event_callback_add(ee->evas, EVAS_CALLBACK_RENDER_FLUSH_POST, _ecore_evas_x_flush_post, ee);
2707 evas_data_attach_set(ee->evas, ee);
2708 evas_output_method_set(ee->evas, rmethod);
2709 evas_output_size_set(ee->evas, w, h);
2710 evas_output_viewport_set(ee->evas, 0, 0, w, h);
2712 ee->engine.x.win_root = parent;
2713 ee->engine.x.screen_num = 0;
2717 ee->engine.x.screen_num = 1; /* FIXME: get real scren # */
2718 /* FIXME: round trip in ecore_x_window_argb_get */
2719 if (ecore_x_window_argb_get(parent))
2721 ee->prop.window = ecore_x_window_argb_new(parent, x, y, w, h);
2725 ee->prop.window = ecore_x_window_new(parent, x, y, w, h);
2728 ee->prop.window = ecore_x_window_new(parent, x, y, w, h);
2729 if (getenv("DESKTOP_STARTUP_ID"))
2731 ecore_x_netwm_startup_id_set(ee->prop.window,
2732 getenv("DESKTOP_STARTUP_ID"));
2733 /* NB: on linux this may simply empty the env as opposed to completely
2734 * unset it to being empty - unsure as solartis libc crashes looking
2735 * for the '=' char */
2736 // putenv((char*)"DESKTOP_STARTUP_ID=");
2738 einfo = (Evas_Engine_Info_Software_X11 *)evas_engine_info_get(ee->evas);
2741 # ifdef BUILD_ECORE_EVAS_SOFTWARE_XCB
2742 xcb_screen_iterator_t iter;
2743 xcb_screen_t *screen;
2746 # endif /* ! BUILD_ECORE_EVAS_SOFTWARE_XCB */
2748 /* FIXME: this is inefficient as its a round trip */
2749 # ifdef BUILD_ECORE_EVAS_SOFTWARE_XCB
2750 screen = ecore_x_default_screen_get();
2751 iter = xcb_setup_roots_iterator (xcb_get_setup (ecore_x_connection_get()));
2754 xcb_get_geometry_cookie_t cookie;
2755 xcb_get_geometry_reply_t *reply;
2756 Ecore_X_Window *roots;
2761 cookie = xcb_get_geometry_unchecked(ecore_x_connection_get(), parent);
2762 roots = ecore_x_window_root_list(&num);
2765 reply = xcb_get_geometry_reply(ecore_x_connection_get(), cookie, NULL);
2769 for (i = 0; i < num; xcb_screen_next (&iter), i++)
2771 if (reply->root == roots[i])
2783 reply = xcb_get_geometry_reply(ecore_x_connection_get(), cookie, NULL);
2784 if (reply) free(reply);
2788 screen = DefaultScreen(ecore_x_display_get());
2789 if (ScreenCount(ecore_x_display_get()) > 1)
2791 Ecore_X_Window *roots;
2795 roots = ecore_x_window_root_list(&num);
2798 XWindowAttributes at;
2800 if (XGetWindowAttributes(ecore_x_display_get(),
2803 for (i = 0; i < num; i++)
2805 if (at.root == roots[i])
2815 # endif /* ! BUILD_ECORE_EVAS_SOFTWARE_XCB */
2817 if (redraw_debug < 0)
2819 if (getenv("REDRAW_DEBUG"))
2820 redraw_debug = atoi(getenv("REDRAW_DEBUG"));
2824 # ifdef BUILD_ECORE_EVAS_SOFTWARE_XCB
2825 einfo->info.backend = EVAS_ENGINE_INFO_SOFTWARE_X11_BACKEND_XCB;
2826 einfo->info.connection = ecore_x_connection_get();
2827 einfo->info.screen = screen;
2829 einfo->info.backend = EVAS_ENGINE_INFO_SOFTWARE_X11_BACKEND_XLIB;
2830 einfo->info.connection = ecore_x_display_get();
2831 einfo->info.screen = NULL;
2832 # endif /* ! BUILD_ECORE_EVAS_SOFTWARE_XCB */
2833 einfo->info.drawable = ee->prop.window;
2836 /* FIXME: round trip */
2837 # ifdef BUILD_ECORE_EVAS_SOFTWARE_XCB
2838 xcb_get_geometry_cookie_t cookie_geom;
2839 xcb_get_window_attributes_cookie_t cookie_attr;
2840 xcb_get_geometry_reply_t *reply_geom;
2841 xcb_get_window_attributes_reply_t *reply_attr;
2843 cookie_geom = xcb_get_geometry_unchecked(ecore_x_connection_get(), ee->prop.window);
2844 cookie_attr = xcb_get_window_attributes_unchecked(ecore_x_connection_get(), ee->prop.window);
2846 reply_geom = xcb_get_geometry_reply(ecore_x_connection_get(), cookie_geom, NULL);
2847 reply_attr = xcb_get_window_attributes_reply(ecore_x_connection_get(), cookie_attr, NULL);
2848 if (reply_attr && reply_geom)
2850 einfo->info.visual = xcb_visualtype_get(ecore_x_default_screen_get(), reply_attr->visual);
2851 einfo->info.colormap = reply_attr->colormap;
2852 einfo->info.depth = reply_geom->depth;
2853 einfo->info.destination_alpha = 1;
2858 XWindowAttributes at;
2860 if (XGetWindowAttributes(ecore_x_display_get(), ee->prop.window,
2863 einfo->info.visual = at.visual;
2864 einfo->info.colormap = at.colormap;
2865 einfo->info.depth = at.depth;
2866 einfo->info.destination_alpha = 1;
2868 # endif /* ! BUILD_ECORE_EVAS_SOFTWARE_XCB */
2872 # ifdef BUILD_ECORE_EVAS_SOFTWARE_XCB
2873 xcb_screen_t *screen;
2875 screen = ecore_x_default_screen_get();
2876 einfo->info.visual = xcb_visualtype_get(screen, screen->root_visual);
2877 einfo->info.colormap = screen->default_colormap;
2878 einfo->info.depth = screen->root_depth;
2880 einfo->info.visual = DefaultVisual(ecore_x_display_get(), screen);
2881 einfo->info.colormap = DefaultColormap(ecore_x_display_get(), screen);
2882 einfo->info.depth = DefaultDepth(ecore_x_display_get(), screen);
2883 # endif /* ! BUILD_ECORE_EVAS_SOFTWARE_XCB */
2884 einfo->info.destination_alpha = 0;
2886 einfo->info.rotation = 0;
2887 einfo->info.debug = redraw_debug;
2888 if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo))
2890 WRN("evas_engine_info_set() init engine '%s' failed.", ee->driver);
2891 ecore_evas_free(ee);
2895 ecore_x_icccm_hints_set(ee->prop.window,
2896 1 /* accepts_focus */,
2897 ECORE_X_WINDOW_STATE_HINT_NORMAL /* initial_state */,
2898 0 /* icon_pixmap */,
2900 0 /* icon_window */,
2901 0 /* window_group */,
2904 ee->engine.func->fn_render = _ecore_evas_x_render;
2905 _ecore_evas_register(ee);
2906 ecore_x_input_multi_select(ee->prop.window);
2907 ecore_event_window_register(ee->prop.window, ee, ee->evas, (Ecore_Event_Mouse_Move_Cb) _ecore_evas_mouse_move_process);
2912 ecore_evas_software_x11_new(const char *disp_name __UNUSED__, Ecore_X_Window parent __UNUSED__,
2913 int x __UNUSED__, int y __UNUSED__, int w __UNUSED__, int h __UNUSED__)
2922 * FIXME: To be fixed.
2924 #ifdef BUILD_ECORE_EVAS_SOFTWARE_X11
2926 ecore_evas_software_x11_window_get(const Ecore_Evas *ee)
2928 return (Ecore_X_Window) ecore_evas_window_get(ee);
2932 ecore_evas_software_x11_window_get(const Ecore_Evas *ee __UNUSED__)
2941 * FIXME: To be fixed.
2943 #ifdef BUILD_ECORE_EVAS_SOFTWARE_X11
2945 ecore_evas_software_x11_direct_resize_set(Ecore_Evas *ee, int on)
2947 ee->engine.x.direct_resize = on;
2948 if (ee->prop.avoid_damage)
2950 if (ee->engine.x.direct_resize)
2952 /* turn this off for now
2953 ee->engine.x.using_bg_pixmap = 1;
2954 ecore_x_window_pixmap_set(ee->prop.window, ee->engine.x.pmap);
2959 /* turn this off too- bg pixmap is controlled by avoid damage directly
2960 ee->engine.x.using_bg_pixmap = 0;
2961 ecore_x_window_pixmap_set(ee->prop.window, 0);
2962 ecore_x_window_area_expose(ee->prop.window, 0, 0, ee->w, ee->h);
2969 ecore_evas_software_x11_direct_resize_set(Ecore_Evas *ee __UNUSED__, int on __UNUSED__)
2977 * FIXME: To be fixed.
2979 #ifdef BUILD_ECORE_EVAS_SOFTWARE_X11
2981 ecore_evas_software_x11_direct_resize_get(const Ecore_Evas *ee)
2983 return ee->engine.x.direct_resize;
2987 ecore_evas_software_x11_direct_resize_get(const Ecore_Evas *ee __UNUSED__)
2996 * FIXME: To be fixed.
2998 #ifdef BUILD_ECORE_EVAS_SOFTWARE_X11
3000 ecore_evas_software_x11_extra_event_window_add(Ecore_Evas *ee, Ecore_X_Window win)
3002 Ecore_X_Window *winp;
3004 winp = malloc(sizeof(Ecore_X_Window));
3008 ee->engine.x.win_extra = eina_list_append(ee->engine.x.win_extra, winp);
3009 ecore_x_input_multi_select(win);
3010 ecore_event_window_register(win, ee, ee->evas, (Ecore_Event_Mouse_Move_Cb) _ecore_evas_mouse_move_process);
3015 ecore_evas_software_x11_extra_event_window_add(Ecore_Evas *ee __UNUSED__, Ecore_X_Window win __UNUSED__)
3023 * FIXME: To be fixed.
3025 #ifdef BUILD_ECORE_EVAS_OPENGL_X11
3027 ecore_evas_gl_x11_new(const char *disp_name, Ecore_X_Window parent,
3028 int x, int y, int w, int h)
3030 return ecore_evas_gl_x11_options_new(disp_name, parent, x, y, w, h, NULL);
3033 ecore_evas_gl_x11_options_new(const char *disp_name, Ecore_X_Window parent,
3034 int x, int y, int w, int h, const int *opt)
3036 # ifdef HAVE_ECORE_X_XCB
3037 Ecore_Evas *ee = NULL;
3042 rmethod = evas_render_method_lookup("gl_x11");
3043 if (!rmethod) return NULL;
3044 if (!ecore_x_init(disp_name)) return NULL;
3045 ee = calloc(1, sizeof(Ecore_Evas));
3046 if (!ee) return NULL;
3048 ECORE_MAGIC_SET(ee, ECORE_MAGIC_EVAS);
3050 _ecore_evas_x_init();
3052 ee->engine.func = (Ecore_Evas_Engine_Func *)&_ecore_x_engine_func;
3054 ee->driver = "opengl_x11";
3055 if (disp_name) ee->name = strdup(disp_name);
3068 ee->prop.max.w = 32767;
3069 ee->prop.max.h = 32767;
3071 ee->prop.request_pos = 0;
3072 ee->prop.sticky = 0;
3073 ee->engine.x.state.sticky = 0;
3075 /* init evas here */
3076 ee->evas = evas_new();
3077 evas_event_callback_add(ee->evas, EVAS_CALLBACK_RENDER_FLUSH_PRE, _ecore_evas_x_flush_pre, ee);
3078 evas_event_callback_add(ee->evas, EVAS_CALLBACK_RENDER_FLUSH_POST, _ecore_evas_x_flush_post, ee);
3079 evas_data_attach_set(ee->evas, ee);
3080 evas_output_method_set(ee->evas, rmethod);
3081 evas_output_size_set(ee->evas, w, h);
3082 evas_output_viewport_set(ee->evas, 0, 0, w, h);
3084 if (parent == 0) parent = DefaultRootWindow(ecore_x_display_get());
3085 ee->engine.x.win_root = parent;
3087 if (ee->engine.x.win_root != 0)
3089 ee->engine.x.screen_num = 1; /* FIXME: get real scren # */
3090 /* FIXME: round trip in ecore_x_window_argb_get */
3091 if (ecore_x_window_argb_get(ee->engine.x.win_root))
3093 ee->prop.window = _ecore_evas_x_gl_window_new
3094 (ee, ee->engine.x.win_root, x, y, w, h, 0, 1, opt);
3097 ee->prop.window = _ecore_evas_x_gl_window_new
3098 (ee, ee->engine.x.win_root, x, y, w, h, 0, 0, opt);
3101 ee->prop.window = _ecore_evas_x_gl_window_new
3102 (ee, ee->engine.x.win_root, x, y, w, h, 0, 0, opt);
3103 if (!ee->prop.window)
3105 ecore_evas_free(ee);
3108 if (getenv("DESKTOP_STARTUP_ID"))
3110 ecore_x_netwm_startup_id_set(ee->prop.window,
3111 getenv("DESKTOP_STARTUP_ID"));
3112 /* NB: on linux this may simply empty the env as opposed to completely
3113 * unset it to being empty - unsure as solartis libc crashes looking
3114 * for the '=' char */
3115 // putenv((char*)"DESKTOP_STARTUP_ID=");
3118 ecore_x_icccm_hints_set(ee->prop.window,
3119 1 /* accepts_focus */,
3120 ECORE_X_WINDOW_STATE_HINT_NORMAL /* initial_state */,
3121 0 /* icon_pixmap */,
3123 0 /* icon_window */,
3124 0 /* window_group */,
3127 ee->engine.func->fn_render = _ecore_evas_x_render;
3128 _ecore_evas_register(ee);
3129 ecore_x_input_multi_select(ee->prop.window);
3130 ecore_event_window_register(ee->prop.window, ee, ee->evas, (Ecore_Event_Mouse_Move_Cb) _ecore_evas_mouse_move_process);
3131 # endif /* HAVE_ECORE_X_XCB */
3137 ecore_evas_gl_x11_new(const char *disp_name __UNUSED__, Ecore_X_Window parent __UNUSED__,
3138 int x __UNUSED__, int y __UNUSED__, int w __UNUSED__, int h __UNUSED__)
3143 ecore_evas_gl_x11_options_new(const char *disp_name, Ecore_X_Window parent,
3144 int x, int y, int w, int h, const int *opt)
3148 #endif /* ! BUILD_ECORE_EVAS_OPENGL_X11 */
3153 * FIXME: To be fixed.
3155 #ifdef BUILD_ECORE_EVAS_OPENGL_X11
3157 ecore_evas_gl_x11_window_get(const Ecore_Evas *ee)
3159 return (Ecore_X_Window) ecore_evas_window_get(ee);
3163 ecore_evas_gl_x11_window_get(const Ecore_Evas *ee __UNUSED__)
3167 #endif /* ! BUILD_ECORE_EVAS_OPENGL_X11 */
3172 * FIXME: To be fixed.
3174 #ifdef BUILD_ECORE_EVAS_OPENGL_X11
3176 ecore_evas_gl_x11_direct_resize_set(Ecore_Evas *ee, int on)
3178 ee->engine.x.direct_resize = on;
3182 ecore_evas_gl_x11_direct_resize_set(Ecore_Evas *ee __UNUSED__, int on __UNUSED__)
3185 #endif /* ! BUILD_ECORE_EVAS_OPENGL_X11 */
3190 * FIXME: To be fixed.
3192 #ifdef BUILD_ECORE_EVAS_OPENGL_X11
3194 ecore_evas_gl_x11_direct_resize_get(const Ecore_Evas *ee)
3196 return ee->engine.x.direct_resize;
3200 ecore_evas_gl_x11_direct_resize_get(const Ecore_Evas *ee __UNUSED__)
3204 #endif /* ! BUILD_ECORE_EVAS_OPENGL_X11 */
3209 * FIXME: To be fixed.
3211 #ifdef BUILD_ECORE_EVAS_OPENGL_X11
3213 ecore_evas_gl_x11_extra_event_window_add(Ecore_Evas *ee, Ecore_X_Window win)
3215 ecore_evas_software_x11_extra_event_window_add(ee, win);
3219 ecore_evas_gl_x11_extra_event_window_add(Ecore_Evas *ee __UNUSED__, Ecore_X_Window win __UNUSED__)
3222 #endif /* ! BUILD_ECORE_EVAS_OPENGL_X11 */
3227 * FIXME: To be fixed.
3229 #ifdef BUILD_ECORE_EVAS_OPENGL_X11
3231 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))
3233 Evas_Engine_Info_GL_X11 *einfo;
3235 if (!(!strcmp(ee->driver, "opengl_x11"))) return;
3237 einfo = (Evas_Engine_Info_GL_X11 *)evas_engine_info_get(ee->evas);
3240 einfo->callback.pre_swap = pre_cb;
3241 einfo->callback.pre_swap = post_cb;
3242 einfo->callback.data = data;
3243 if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo))
3245 ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver);
3251 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))
3255 #endif /* ! BUILD_ECORE_EVAS_OPENGL_X11 */
3260 * FIXME: To be fixed.
3262 #if defined (BUILD_ECORE_EVAS_XRENDER_X11) || defined (BUILD_ECORE_EVAS_XRENDER_XCB)
3264 ecore_evas_xrender_x11_new(const char *disp_name, Ecore_X_Window parent,
3265 int x, int y, int w, int h)
3267 Evas_Engine_Info_XRender_X11 *einfo;
3271 rmethod = evas_render_method_lookup("xrender_x11");
3272 if (!rmethod) return NULL;
3273 if (!ecore_x_init(disp_name)) return NULL;
3274 ee = calloc(1, sizeof(Ecore_Evas));
3275 if (!ee) return NULL;
3277 ECORE_MAGIC_SET(ee, ECORE_MAGIC_EVAS);
3279 _ecore_evas_x_init();
3281 ee->engine.func = (Ecore_Evas_Engine_Func *)&_ecore_x_engine_func;
3283 ee->driver = "xrender_x11";
3284 if (disp_name) ee->name = strdup(disp_name);
3297 ee->prop.max.w = 32767;
3298 ee->prop.max.h = 32767;
3300 ee->prop.request_pos = 0;
3301 ee->prop.sticky = 0;
3302 ee->engine.x.state.sticky = 0;
3304 /* init evas here */
3305 ee->evas = evas_new();
3306 evas_event_callback_add(ee->evas, EVAS_CALLBACK_RENDER_FLUSH_PRE, _ecore_evas_x_flush_pre, ee);
3307 evas_event_callback_add(ee->evas, EVAS_CALLBACK_RENDER_FLUSH_POST, _ecore_evas_x_flush_post, ee);
3308 evas_data_attach_set(ee->evas, ee);
3309 evas_output_method_set(ee->evas, rmethod);
3310 evas_output_size_set(ee->evas, w, h);
3311 evas_output_viewport_set(ee->evas, 0, 0, w, h);
3313 ee->engine.x.win_root = parent;
3314 ee->prop.window = ecore_x_window_new(parent, x, y, w, h);
3315 if (getenv("DESKTOP_STARTUP_ID"))
3317 ecore_x_netwm_startup_id_set(ee->prop.window,
3318 getenv("DESKTOP_STARTUP_ID"));
3319 /* NB: on linux this may simply empty the env as opposed to completely
3320 * unset it to being empty - unsure as solartis libc crashes looking
3321 * for the '=' char */
3322 // putenv((char*)"DESKTOP_STARTUP_ID=");
3324 einfo = (Evas_Engine_Info_XRender_X11 *)evas_engine_info_get(ee->evas);
3327 # ifdef BUILD_ECORE_EVAS_XRENDER_XCB
3328 xcb_screen_iterator_t iter;
3329 xcb_screen_t *screen;
3331 /* FIXME: this is inefficient as its a round trip */
3332 screen = ecore_x_default_screen_get();
3333 iter = xcb_setup_roots_iterator (xcb_get_setup (ecore_x_connection_get()));
3336 xcb_get_geometry_cookie_t cookie;
3337 xcb_get_geometry_reply_t *reply;
3338 Ecore_X_Window *roots;
3343 cookie = xcb_get_geometry_unchecked(ecore_x_connection_get(), parent);
3344 roots = ecore_x_window_root_list(&num);
3347 reply = xcb_get_geometry_reply(ecore_x_connection_get(), cookie, NULL);
3351 for (i = 0; i < num; xcb_screen_next (&iter), i++)
3353 if (reply->root == roots[i])
3365 reply = xcb_get_geometry_reply(ecore_x_connection_get(), cookie, NULL);
3366 if (reply) free(reply);
3369 einfo->info.backend = EVAS_ENGINE_INFO_XRENDER_BACKEND_XCB;
3370 einfo->info.connection = ecore_x_connection_get();
3371 einfo->info.screen = screen;
3372 einfo->info.visual = screen->root_visual;
3373 # elif BUILD_ECORE_EVAS_XRENDER_X11
3376 /* FIXME: this is inefficient as its a round trip */
3377 screen = DefaultScreen(ecore_x_display_get());
3378 if (ScreenCount(ecore_x_display_get()) > 1)
3380 Ecore_X_Window *roots;
3384 roots = ecore_x_window_root_list(&num);
3387 XWindowAttributes at;
3389 if (XGetWindowAttributes(ecore_x_display_get(),
3392 for (i = 0; i < num; i++)
3394 if (at.root == roots[i])
3404 einfo->info.backend = EVAS_ENGINE_INFO_XRENDER_BACKEND_XLIB;
3405 einfo->info.connection = ecore_x_display_get();
3406 einfo->info.screen = NULL;
3407 einfo->info.visual = DefaultVisual(ecore_x_display_get(), screen);
3408 # endif /* BUILD_ECORE_EVAS_XRENDER_(XCB|X11) */
3409 einfo->info.drawable = ee->prop.window;
3410 if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo))
3412 WRN("evas_engine_info_set() init engine '%s' failed.", ee->driver);
3413 ecore_evas_free(ee);
3418 ecore_x_icccm_hints_set(ee->prop.window,
3419 1 /* accepts_focus */,
3420 ECORE_X_WINDOW_STATE_HINT_NORMAL /* initial_state */,
3421 0 /* icon_pixmap */,
3423 0 /* icon_window */,
3424 0 /* window_group */,
3427 ee->engine.func->fn_render = _ecore_evas_x_render;
3428 _ecore_evas_register(ee);
3429 ecore_x_input_multi_select(ee->prop.window);
3430 ecore_event_window_register(ee->prop.window, ee, ee->evas, (Ecore_Event_Mouse_Move_Cb) _ecore_evas_mouse_move_process);
3435 ecore_evas_xrender_x11_new(const char *disp_name __UNUSED__, Ecore_X_Window parent __UNUSED__,
3436 int x __UNUSED__, int y __UNUSED__, int w __UNUSED__, int h __UNUSED__)
3440 #endif /* ! BUILD_ECORE_EVAS_XRENDER_X11 && ! BUILD_ECORE_EVAS_XRENDER_XCB */
3445 * FIXME: To be fixed.
3447 #if defined (BUILD_ECORE_EVAS_XRENDER_X11) || defined (BUILD_ECORE_EVAS_XRENDER_XCB)
3449 ecore_evas_xrender_x11_window_get(const Ecore_Evas *ee)
3451 return (Ecore_X_Window) ecore_evas_window_get(ee);
3455 ecore_evas_xrender_x11_window_get(const Ecore_Evas *ee __UNUSED__)
3459 #endif /* ! BUILD_ECORE_EVAS_XRENDER_X11 && ! BUILD_ECORE_EVAS_XRENDER_XCB */
3464 * FIXME: To be fixed.
3466 #if defined (BUILD_ECORE_EVAS_XRENDER_X11) || defined (BUILD_ECORE_EVAS_XRENDER_XCB)
3468 ecore_evas_xrender_x11_direct_resize_set(Ecore_Evas *ee, int on)
3470 ee->engine.x.direct_resize = on;
3474 ecore_evas_xrender_x11_direct_resize_set(Ecore_Evas *ee __UNUSED__, int on __UNUSED__)
3477 #endif /* ! BUILD_ECORE_EVAS_XRENDER_X11 && ! BUILD_ECORE_EVAS_XRENDER_XCB */
3482 * FIXME: To be fixed.
3484 #if defined (BUILD_ECORE_EVAS_XRENDER_X11) || defined (BUILD_ECORE_EVAS_XRENDER_XCB)
3486 ecore_evas_xrender_x11_direct_resize_get(const Ecore_Evas *ee)
3488 return ee->engine.x.direct_resize;
3492 ecore_evas_xrender_x11_direct_resize_get(const Ecore_Evas *ee __UNUSED__)
3496 #endif /* ! BUILD_ECORE_EVAS_XRENDER_X11 && ! BUILD_ECORE_EVAS_XRENDER_XCB */
3501 * FIXME: To be fixed.
3503 #if defined (BUILD_ECORE_EVAS_XRENDER_X11) || defined (BUILD_ECORE_EVAS_XRENDER_XCB)
3505 ecore_evas_xrender_x11_extra_event_window_add(Ecore_Evas *ee, Ecore_X_Window win)
3507 ecore_evas_software_x11_extra_event_window_add(ee, win);
3511 ecore_evas_xrender_x11_extra_event_window_add(Ecore_Evas *ee __UNUSED__, Ecore_X_Window win __UNUSED__)
3514 #endif /* ! BUILD_ECORE_EVAS_XRENDER_X11 && ! BUILD_ECORE_EVAS_XRENDER_XCB */
3519 * FIXME: To be fixed.
3521 #if BUILD_ECORE_EVAS_SOFTWARE_16_X11
3523 ecore_evas_software_x11_16_new(const char *disp_name, Ecore_X_Window parent,
3524 int x, int y, int w, int h)
3526 Evas_Engine_Info_Software_16_X11 *einfo;
3529 static int redraw_debug = -1;
3531 rmethod = evas_render_method_lookup("software_16_x11");
3532 if (!rmethod) return NULL;
3533 if (!ecore_x_init(disp_name)) return NULL;
3534 ee = calloc(1, sizeof(Ecore_Evas));
3535 if (!ee) return NULL;
3537 ECORE_MAGIC_SET(ee, ECORE_MAGIC_EVAS);
3539 _ecore_evas_x_init();
3541 ee->engine.func = (Ecore_Evas_Engine_Func *)&_ecore_x_engine_func;
3543 ee->driver = "software_16_x11";
3544 if (disp_name) ee->name = strdup(disp_name);
3557 ee->prop.max.w = 32767;
3558 ee->prop.max.h = 32767;
3560 ee->prop.request_pos = 0;
3561 ee->prop.sticky = 0;
3562 ee->engine.x.state.sticky = 0;
3564 /* init evas here */
3565 ee->evas = evas_new();
3566 evas_event_callback_add(ee->evas, EVAS_CALLBACK_RENDER_FLUSH_PRE, _ecore_evas_x_flush_pre, ee);
3567 evas_event_callback_add(ee->evas, EVAS_CALLBACK_RENDER_FLUSH_POST, _ecore_evas_x_flush_post, ee);
3568 evas_data_attach_set(ee->evas, ee);
3569 evas_output_method_set(ee->evas, rmethod);
3570 evas_output_size_set(ee->evas, w, h);
3571 evas_output_viewport_set(ee->evas, 0, 0, w, h);
3573 ee->engine.x.win_root = parent;
3576 /* FIXME: round trip in ecore_x_window_argb_get */
3577 if (ecore_x_window_argb_get(parent))
3579 ee->prop.window = ecore_x_window_argb_new(parent, x, y, w, h);
3582 ee->prop.window = ecore_x_window_new(parent, x, y, w, h);
3585 ee->prop.window = ecore_x_window_new(parent, x, y, w, h);
3586 if (getenv("DESKTOP_STARTUP_ID"))
3588 ecore_x_netwm_startup_id_set(ee->prop.window,
3589 getenv("DESKTOP_STARTUP_ID"));
3590 /* NB: on linux this may simply empty the env as opposed to completely
3591 * unset it to being empty - unsure as solartis libc crashes looking
3592 * for the '=' char */
3593 // putenv((char*)"DESKTOP_STARTUP_ID=");
3595 einfo = (Evas_Engine_Info_Software_16_X11 *)evas_engine_info_get(ee->evas);
3599 if (ScreenCount(ecore_x_display_get()) > 1)
3601 Ecore_X_Window *roots;
3605 roots = ecore_x_window_root_list(&num);
3608 XWindowAttributes at;
3610 if (XGetWindowAttributes(ecore_x_display_get(),
3613 for (i = 0; i < num; i++)
3615 if (at.root == roots[i])
3623 if (redraw_debug < 0)
3625 if (getenv("REDRAW_DEBUG"))
3626 redraw_debug = atoi(getenv("REDRAW_DEBUG"));
3630 einfo->info.display = ecore_x_display_get();
3631 einfo->info.drawable = ee->prop.window;
3633 if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo))
3635 WRN("evas_engine_info_set() init engine '%s' failed.", ee->driver);
3636 ecore_evas_free(ee);
3641 ecore_x_icccm_hints_set(ee->prop.window,
3642 1 /* accepts_focus */,
3643 ECORE_X_WINDOW_STATE_HINT_NORMAL /* initial_state */,
3644 0 /* icon_pixmap */,
3646 0 /* icon_window */,
3647 0 /* window_group */,
3650 ee->engine.func->fn_render = _ecore_evas_x_render;
3651 _ecore_evas_register(ee);
3652 ecore_x_input_multi_select(ee->prop.window);
3653 ecore_event_window_register(ee->prop.window, ee, ee->evas, (Ecore_Event_Mouse_Move_Cb) _ecore_evas_mouse_move_process);
3658 ecore_evas_software_x11_16_new(const char *disp_name __UNUSED__, Ecore_X_Window parent __UNUSED__,
3659 int x __UNUSED__, int y __UNUSED__, int w __UNUSED__, int h __UNUSED__)
3663 #endif /* ! BUILD_ECORE_EVAS_SOFTWARE_16_X11 */
3668 * FIXME: To be fixed.
3670 #if BUILD_ECORE_EVAS_SOFTWARE_16_X11
3672 ecore_evas_software_x11_16_window_get(const Ecore_Evas *ee)
3674 return (Ecore_X_Window) ecore_evas_window_get(ee);
3678 ecore_evas_software_x11_16_window_get(const Ecore_Evas *ee __UNUSED__)
3682 #endif /* ! BUILD_ECORE_EVAS_SOFTWARE_16_X11 */
3687 * FIXME: To be fixed.
3689 #if BUILD_ECORE_EVAS_SOFTWARE_16_X11
3691 ecore_evas_software_x11_16_direct_resize_set(Ecore_Evas *ee, int on)
3693 ee->engine.x.direct_resize = on;
3694 if (ee->prop.avoid_damage)
3696 if (ee->engine.x.direct_resize)
3698 /* turn this off for now
3699 ee->engine.x.using_bg_pixmap = 1;
3700 ecore_x_window_pixmap_set(ee->prop.window, ee->engine.x.pmap);
3705 /* turn this off too- bg pixmap is controlled by avoid damage directly
3706 ee->engine.x.using_bg_pixmap = 0;
3707 ecore_x_window_pixmap_set(ee->prop.window, 0);
3708 ecore_x_window_area_expose(ee->prop.window, 0, 0, ee->w, ee->h);
3715 ecore_evas_software_x11_16_direct_resize_set(Ecore_Evas *ee __UNUSED__, int on __UNUSED__)
3718 #endif /* ! BUILD_ECORE_EVAS_SOFTWARE_16_X11 */
3723 * FIXME: To be fixed.
3725 #if BUILD_ECORE_EVAS_SOFTWARE_16_X11
3727 ecore_evas_software_x11_16_direct_resize_get(const Ecore_Evas *ee)
3729 return ee->engine.x.direct_resize;
3733 ecore_evas_software_x11_16_direct_resize_get(const Ecore_Evas *ee __UNUSED__)
3737 #endif /* ! BUILD_ECORE_EVAS_SOFTWARE_16_X11 */
3742 * FIXME: To be fixed.
3744 #if BUILD_ECORE_EVAS_SOFTWARE_16_X11
3746 ecore_evas_software_x11_16_extra_event_window_add(Ecore_Evas *ee, Ecore_X_Window win)
3748 Ecore_X_Window *winp;
3750 winp = malloc(sizeof(Ecore_X_Window));
3754 ee->engine.x.win_extra = eina_list_append(ee->engine.x.win_extra, winp);
3755 ecore_x_input_multi_select(win);
3756 ecore_event_window_register(win, ee, ee->evas, (Ecore_Event_Mouse_Move_Cb) _ecore_evas_mouse_move_process);
3761 ecore_evas_software_x11_16_extra_event_window_add(Ecore_Evas *ee __UNUSED__, Ecore_X_Window win __UNUSED__)
3764 #endif /* ! BUILD_ECORE_EVAS_SOFTWARE_16_X11 */