2 #include "ecore_evas_private.h"
3 #include "Ecore_Evas.h"
5 #ifdef BUILD_ECORE_EVAS_X11
6 static int _ecore_evas_init_count = 0;
8 static Ecore_Event_Handler *ecore_evas_event_handlers[13];
10 static int leader_ref = 0;
11 static Ecore_X_Window leader_win = 0;
14 _ecore_evas_x_group_leader_set(Ecore_Evas *ee)
22 ecore_x_window_override_new(ee->engine.x.win_root, 1234, 5678, 1, 2);
23 ecore_x_window_defaults_set(leader_win);
24 if ((id = getenv("DESKTOP_STARTUP_ID")))
25 ecore_x_netwm_startup_id_set(leader_win,id);
26 ecore_x_icccm_client_leader_set(leader_win, leader_win);
28 ee->engine.x.leader = leader_win;
29 ecore_x_icccm_client_leader_set(ee->prop.window, leader_win);
33 _ecore_evas_x_group_leader_unset(Ecore_Evas *ee)
35 ecore_x_window_prop_property_del(ee->prop.window,
36 ECORE_X_ATOM_WM_CLIENT_LEADER);
37 if (ee->engine.x.leader == leader_win)
42 ecore_x_window_free(leader_win);
45 ee->engine.x.leader = 0;
50 _ecore_evas_x_group_leader_update(Ecore_Evas *ee)
52 if (ee->engine.x.leader)
53 ecore_x_icccm_client_leader_set(ee->prop.window, ee->engine.x.leader);
57 _ecore_evas_x_protocols_set(Ecore_Evas *ee)
59 Ecore_X_Atom protos[10];
60 unsigned int num = 0, tmp = 0;
62 if (ee->func.fn_delete_request)
63 protos[num++] = ECORE_X_ATOM_WM_DELETE_WINDOW;
64 protos[num++] = ECORE_X_ATOM_NET_WM_PING;
65 protos[num++] = ECORE_X_ATOM_NET_WM_SYNC_REQUEST;
66 ecore_x_icccm_protocol_atoms_set(ee->prop.window, protos, num);
68 if (!ee->engine.x.netwm_sync_counter)
69 ee->engine.x.netwm_sync_counter = ecore_x_sync_counter_new(0);
71 tmp = ee->engine.x.netwm_sync_counter;
72 ecore_x_window_prop_card32_set(ee->prop.window,
73 ECORE_X_ATOM_NET_WM_SYNC_REQUEST_COUNTER,
78 _ecore_evas_x_sync_set(Ecore_Evas *ee)
80 if (((ee->should_be_visible) || (ee->visible)) &&
81 ((ecore_x_e_comp_sync_supported_get(ee->engine.x.win_root)) &&
82 (!ee->no_comp_sync) && (_ecore_evas_app_comp_sync)))
84 if (!ee->engine.x.sync_counter)
85 ee->engine.x.sync_counter = ecore_x_sync_counter_new(0);
89 if (ee->engine.x.sync_counter)
90 ecore_x_sync_counter_free(ee->engine.x.sync_counter);
91 ee->engine.x.sync_counter = 0;
93 ecore_x_e_comp_sync_counter_set(ee->prop.window, ee->engine.x.sync_counter);
97 _ecore_evas_x_sync_clear(Ecore_Evas *ee)
99 if (!ee->engine.x.sync_counter) return;
100 ecore_x_sync_counter_free(ee->engine.x.sync_counter);
101 ee->engine.x.sync_counter = 0;
104 # ifdef BUILD_ECORE_EVAS_OPENGL_X11
105 static Ecore_X_Window
106 _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)
108 Evas_Engine_Info_GL_X11 *einfo;
111 einfo = (Evas_Engine_Info_GL_X11 *)evas_engine_info_get(ee->evas);
120 for (op = 0; opt[op]; op++)
122 if (opt[op] == ECORE_EVAS_GL_X11_OPT_INDIRECT)
125 einfo->indirect = opt[op];
127 else if (opt[op] == ECORE_EVAS_GL_X11_OPT_VSYNC)
130 einfo->vsync = opt[op];
135 /* FIXME: this is inefficient as its 1 or more round trips */
136 screen = ecore_x_screen_index_get(ecore_x_default_screen_get());
137 if (ecore_x_screen_count_get() > 1)
139 Ecore_X_Window *roots;
143 roots = ecore_x_window_root_list(&num);
148 root = ecore_x_window_root_get(parent);
149 for (i = 0; i < num; i++)
151 if (root == roots[i])
161 einfo->info.display = ecore_x_display_get();
162 einfo->info.screen = screen;
164 einfo->info.destination_alpha = argb;
166 einfo->info.visual = einfo->func.best_visual_get(einfo);
167 einfo->info.colormap = einfo->func.best_colormap_get(einfo);
168 einfo->info.depth = einfo->func.best_depth_get(einfo);
170 if ((!einfo->info.visual) ||
171 (!einfo->info.colormap) || (!einfo->info.depth))
173 WRN("OpenGL X11 init engine '%s' failed - no visual, colormap or depth.", ee->driver);
174 if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo))
176 ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver);
184 win = ecore_x_window_override_argb_new(parent, x, y, w, h);
186 win = ecore_x_window_argb_new(parent, x, y, w, h);
191 win = ecore_x_window_override_new(parent, x, y, w, h);
193 win = ecore_x_window_new(parent, x, y, w, h);
196 ecore_x_window_pixel_gravity_set(win, ECORE_X_GRAVITY_FORGET);
198 /* attr.backing_store = NotUseful; */
199 /* attr.override_redirect = override; */
200 /* attr.colormap = einfo->info.colormap; */
201 /* attr.border_pixel = 0; */
202 /* attr.background_pixmap = None; */
203 /* attr.event_mask = */
204 /* KeyPressMask | KeyReleaseMask | */
205 /* ExposureMask | ButtonPressMask | ButtonReleaseMask | */
206 /* EnterWindowMask | LeaveWindowMask | */
207 /* PointerMotionMask | StructureNotifyMask | VisibilityChangeMask | */
208 /* FocusChangeMask | PropertyChangeMask | ColormapChangeMask; */
209 /* attr.bit_gravity = ForgetGravity; */
212 /* XCreateWindow(einfo->info.display, parent, x, y, w, h, 0, */
213 /* einfo->info.depth, InputOutput, einfo->info.visual, */
214 /* CWBackingStore | CWColormap | CWBackPixmap | */
215 /* CWBorderPixel | CWBitGravity | CWEventMask | */
216 /* CWOverrideRedirect, &attr); */
218 einfo->info.drawable = win;
220 if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo))
222 ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver);
223 ecore_x_window_free(win);
235 _ecore_evas_x_render(Ecore_Evas *ee)
238 Eina_List *updates, *l;
240 #ifdef BUILD_ECORE_EVAS_SOFTWARE_BUFFER
244 if ((!ee->no_comp_sync) && (_ecore_evas_app_comp_sync) &&
245 (ee->engine.x.sync_counter) && (!ee->engine.x.sync_began) &&
246 (!ee->engine.x.sync_cancel))
249 EINA_LIST_FOREACH(ee->sub_ecore_evas, ll, ee2)
251 if (ee2->func.fn_pre_render) ee2->func.fn_pre_render(ee2);
252 rend |= _ecore_evas_buffer_render(ee2);
253 if (ee2->func.fn_post_render) ee2->func.fn_post_render(ee2);
256 if (ee->func.fn_pre_render) ee->func.fn_pre_render(ee);
257 if (ee->prop.avoid_damage)
259 updates = evas_render_updates(ee->evas);
260 if (ee->engine.x.using_bg_pixmap)
264 EINA_LIST_FOREACH(updates, l, r)
265 ecore_x_window_area_clear(ee->prop.window, r->x, r->y, r->w, r->h);
266 if ((ee->shaped) && (updates))
268 #ifdef EVAS_FRAME_QUEUING
269 /* wait until ee->engine.x.mask being updated */
272 ecore_x_window_shape_mask_set(ee->prop.window, ee->engine.x.mask);
274 if ((ee->alpha) && (updates))
276 #ifdef EVAS_FRAME_QUEUING
277 /* wait until ee->engine.x.mask being updated */
278 // evas_sync(ee->evas);
280 // ecore_x_window_shape_input_mask_set(ee->prop.window, ee->engine.x.mask);
282 evas_render_updates_free(updates);
283 _ecore_evas_idle_timeout_update(ee);
289 EINA_LIST_FOREACH(updates, l, r)
291 Ecore_X_Rectangle rect;
292 Ecore_X_XRegion *tmpr;
294 if (!ee->engine.x.damages)
295 ee->engine.x.damages = ecore_x_xregion_new();
296 tmpr = ecore_x_xregion_new();
297 if (ee->rotation == 0)
304 else if (ee->rotation == 90)
307 rect.y = ee->h - r->x - r->w;
311 else if (ee->rotation == 180)
313 rect.x = ee->w - r->x - r->w;
314 rect.y = ee->h - r->y - r->h;
318 else if (ee->rotation == 270)
320 rect.x = ee->w - r->y - r->h;
325 ecore_x_xregion_union_rect(tmpr, ee->engine.x.damages, &rect);
326 ecore_x_xregion_free(ee->engine.x.damages);
327 ee->engine.x.damages = tmpr;
329 if (ee->engine.x.damages)
331 /* if we have a damage pixmap - we can avoid exposures by
332 * disabling them just for setting the mask */
333 ecore_x_event_mask_set(ee->prop.window,
334 ECORE_X_EVENT_MASK_KEY_DOWN |
335 ECORE_X_EVENT_MASK_KEY_UP |
336 ECORE_X_EVENT_MASK_MOUSE_DOWN |
337 ECORE_X_EVENT_MASK_MOUSE_UP |
338 ECORE_X_EVENT_MASK_MOUSE_IN |
339 ECORE_X_EVENT_MASK_MOUSE_OUT |
340 ECORE_X_EVENT_MASK_MOUSE_MOVE |
341 // ECORE_X_EVENT_MASK_WINDOW_DAMAGE |
342 ECORE_X_EVENT_MASK_WINDOW_VISIBILITY |
343 ECORE_X_EVENT_MASK_WINDOW_CONFIGURE |
344 ECORE_X_EVENT_MASK_WINDOW_FOCUS_CHANGE |
345 ECORE_X_EVENT_MASK_WINDOW_PROPERTY |
346 ECORE_X_EVENT_MASK_WINDOW_COLORMAP
348 if ((ee->shaped) && (updates))
349 ecore_x_window_shape_mask_set(ee->prop.window,
351 /* and re-enable them again */
352 ecore_x_event_mask_set(ee->prop.window,
353 ECORE_X_EVENT_MASK_KEY_DOWN |
354 ECORE_X_EVENT_MASK_KEY_UP |
355 ECORE_X_EVENT_MASK_MOUSE_DOWN |
356 ECORE_X_EVENT_MASK_MOUSE_UP |
357 ECORE_X_EVENT_MASK_MOUSE_IN |
358 ECORE_X_EVENT_MASK_MOUSE_OUT |
359 ECORE_X_EVENT_MASK_MOUSE_MOVE |
360 ECORE_X_EVENT_MASK_WINDOW_DAMAGE |
361 ECORE_X_EVENT_MASK_WINDOW_VISIBILITY |
362 ECORE_X_EVENT_MASK_WINDOW_CONFIGURE |
363 ECORE_X_EVENT_MASK_WINDOW_FOCUS_CHANGE |
364 ECORE_X_EVENT_MASK_WINDOW_PROPERTY |
365 ECORE_X_EVENT_MASK_WINDOW_COLORMAP
367 ecore_x_xregion_set(ee->engine.x.damages, ee->engine.x.gc);
369 /* debug rendering */
371 XSetForeground(ecore_x_display_get(), ee->engine.x.gc, rand());
372 XFillRectangle(ecore_x_display_get(), ee->prop.window, ee->engine.x.gc,
374 XSync(ecore_x_display_get(), False);
376 XSync(ecore_x_display_get(), False);
379 ecore_x_pixmap_paste(ee->engine.x.pmap, ee->prop.window,
380 ee->engine.x.gc, 0, 0, ee->w, ee->h,
382 ecore_x_xregion_free(ee->engine.x.damages);
383 ee->engine.x.damages = NULL;
387 evas_render_updates_free(updates);
388 _ecore_evas_idle_timeout_update(ee);
393 else if (((ee->visible) && (ee->draw_ok)) ||
394 ((ee->should_be_visible) && (ee->prop.fullscreen)) ||
395 ((ee->should_be_visible) && (ee->prop.override)))
397 updates = evas_render_updates(ee->evas);
402 #ifdef EVAS_FRAME_QUEUING
403 /* wait until ee->engine.x.mask being updated */
406 ecore_x_window_shape_mask_set(ee->prop.window, ee->engine.x.mask);
410 #ifdef EVAS_FRAME_QUEUING
411 /* wait until ee->engine.x.mask being updated */
412 // evas_sync(ee->evas);
414 // ecore_x_window_shape_input_mask_set(ee->prop.window, ee->engine.x.mask);
416 evas_render_updates_free(updates);
417 _ecore_evas_idle_timeout_update(ee);
422 evas_norender(ee->evas);
423 if (ee->func.fn_post_render) ee->func.fn_post_render(ee);
427 static int frames = 0;
428 static double t0 = 0.0;
431 t = ecore_time_get();
436 printf("FPS: %3.3f\n", (double)frames / td);
446 _ecore_evas_x_resize_shape(Ecore_Evas *ee)
448 if (!strcmp(ee->driver, "software_x11"))
450 #ifdef BUILD_ECORE_EVAS_SOFTWARE_X11
451 Evas_Engine_Info_Software_X11 *einfo;
453 einfo = (Evas_Engine_Info_Software_X11 *)evas_engine_info_get(ee->evas);
456 unsigned int foreground;
459 if (ee->engine.x.mask) ecore_x_pixmap_free(ee->engine.x.mask);
460 ee->engine.x.mask = ecore_x_pixmap_new(ee->prop.window, ee->w, ee->h, 1);
462 gc = ecore_x_gc_new(ee->engine.x.mask,
463 ECORE_X_GC_VALUE_MASK_FOREGROUND,
465 ecore_x_drawable_rectangle_fill(ee->engine.x.mask, gc,
468 einfo->info.mask = ee->engine.x.mask;
469 if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo))
471 ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver);
473 evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h);
475 #endif /* BUILD_ECORE_EVAS_SOFTWARE_X11 */
477 else if (!strcmp(ee->driver, "software_16_x11"))
479 #if BUILD_ECORE_EVAS_SOFTWARE_16_X11
480 # if 0 /* XXX no shaped window support for software_16_x11 */
481 Evas_Engine_Info_Software_16_X11 *einfo;
483 einfo = (Evas_Engine_Info_Software_16_X11 *)evas_engine_info_get(ee->evas);
486 if (ee->engine.x.mask) ecore_x_pixmap_free(ee->engine.x.mask);
487 ee->engine.x.mask = ecore_x_pixmap_new(ee->prop.window, ee->w, ee->h, 1);
488 einfo->info.mask = ee->engine.x.mask;
489 if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo))
491 ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver);
493 evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h);
495 # endif /* XXX no shaped window support for software_16_x11 */
496 #endif /* BUILD_ECORE_EVAS_SOFTWARE_16_X11 */
498 if (!strcmp(ee->driver, "software_8_x11"))
500 #if defined (BUILD_ECORE_EVAS_SOFTWARE_8_X11)
501 Evas_Engine_Info_Software_8_X11 *einfo;
503 einfo = (Evas_Engine_Info_Software_8_X11 *)evas_engine_info_get(ee->evas);
506 unsigned int foreground;
509 if (ee->engine.x.mask) ecore_x_pixmap_free(ee->engine.x.mask);
510 ee->engine.x.mask = ecore_x_pixmap_new(ee->prop.window, ee->w, ee->h, 1);
512 gc = ecore_x_gc_new(ee->engine.x.mask,
513 ECORE_X_GC_VALUE_MASK_FOREGROUND,
515 ecore_x_drawable_rectangle_fill(ee->engine.x.mask, gc,
518 einfo->info.mask = ee->engine.x.mask;
519 if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo))
521 ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver);
523 evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h);
525 #endif /* BUILD_ECORE_EVAS_SOFTWARE_8_X11 */
529 /* TODO: we need to make this work for all the states, not just sticky */
531 _ecore_evas_x_event_property_change(void *data __UNUSED__, int type __UNUSED__, void *event)
534 Ecore_X_Event_Window_Property *e;
537 ee = ecore_event_window_match(e->win);
538 if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON; /* pass on event */
539 if (e->win != ee->prop.window) return ECORE_CALLBACK_PASS_ON;
540 if (e->atom == ECORE_X_ATOM_NET_WM_STATE)
543 Ecore_X_Window_State *state;
546 /* TODO: we need to move those to the end, with if statements */
547 ee->engine.x.state.modal = 0;
548 ee->engine.x.state.maximized_v = 0;
549 ee->engine.x.state.maximized_h = 0;
550 ee->engine.x.state.shaded = 0;
551 ee->engine.x.state.skip_taskbar = 0;
552 ee->engine.x.state.skip_pager = 0;
553 ee->prop.fullscreen = 0;
554 ee->engine.x.state.fullscreen = 0;
555 ee->engine.x.state.above = 0;
556 ee->engine.x.state.below = 0;
558 ecore_x_netwm_window_state_get(e->win, &state, &num);
561 for (i = 0; i < num; i++)
565 case ECORE_X_WINDOW_STATE_MODAL:
566 ee->engine.x.state.modal = 1;
568 case ECORE_X_WINDOW_STATE_STICKY:
569 if (ee->prop.sticky && ee->engine.x.state.sticky)
574 ee->engine.x.state.sticky = 1;
575 if (ee->func.fn_sticky) ee->func.fn_sticky(ee);
577 case ECORE_X_WINDOW_STATE_MAXIMIZED_VERT:
578 ee->engine.x.state.maximized_v = 1;
580 case ECORE_X_WINDOW_STATE_MAXIMIZED_HORZ:
581 ee->engine.x.state.maximized_h = 1;
583 case ECORE_X_WINDOW_STATE_SHADED:
584 ee->engine.x.state.shaded = 1;
586 case ECORE_X_WINDOW_STATE_SKIP_TASKBAR:
587 ee->engine.x.state.skip_taskbar = 1;
589 case ECORE_X_WINDOW_STATE_SKIP_PAGER:
590 ee->engine.x.state.skip_pager = 1;
592 case ECORE_X_WINDOW_STATE_FULLSCREEN:
593 ee->prop.fullscreen = 1;
594 ee->engine.x.state.fullscreen = 1;
596 case ECORE_X_WINDOW_STATE_ABOVE:
597 ee->engine.x.state.above = 1;
599 case ECORE_X_WINDOW_STATE_BELOW:
600 ee->engine.x.state.below = 1;
609 if ((ee->prop.sticky) && (!sticky))
612 ee->engine.x.state.sticky = 0;
613 if (ee->func.fn_unsticky) ee->func.fn_unsticky(ee);
617 return ECORE_CALLBACK_PASS_ON;
621 _ecore_evas_x_event_visibility_change(void *data __UNUSED__, int type __UNUSED__, void *event)
624 Ecore_X_Event_Window_Visibility_Change *e;
627 ee = ecore_event_window_match(e->win);
628 if (!ee) return ECORE_CALLBACK_PASS_ON; /* pass on event */
629 if (e->win != ee->prop.window) return ECORE_CALLBACK_PASS_ON;
630 // printf("VIS CHANGE OBSCURED: %p %i\n", ee, e->fully_obscured);
631 if (e->fully_obscured)
633 /* FIXME: round trip */
634 if (!ecore_x_screen_is_composited(ee->engine.x.screen_num))
639 return ECORE_CALLBACK_PASS_ON;
643 _ecore_evas_x_event_client_message(void *data __UNUSED__, int type __UNUSED__, void *event)
646 Ecore_X_Event_Client_Message *e;
649 if (e->format != 32) return ECORE_CALLBACK_PASS_ON;
650 if (e->message_type == ECORE_X_ATOM_E_COMP_SYNC_BEGIN)
652 ee = ecore_event_window_match(e->data.l[0]);
653 if (!ee) return ECORE_CALLBACK_PASS_ON; /* pass on event */
654 if (e->data.l[0] != (long)ee->prop.window)
655 return ECORE_CALLBACK_PASS_ON;
656 if (!ee->engine.x.sync_began)
658 // qeue a damage + draw. work around an event re-ordering thing.
659 evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h);
661 ee->engine.x.sync_began = 1;
662 ee->engine.x.sync_cancel = 0;
664 else if (e->message_type == ECORE_X_ATOM_E_COMP_SYNC_END)
666 ee = ecore_event_window_match(e->data.l[0]);
667 if (!ee) return ECORE_CALLBACK_PASS_ON; /* pass on event */
668 if (e->data.l[0] != (long)ee->prop.window)
669 return ECORE_CALLBACK_PASS_ON;
670 ee->engine.x.sync_began = 0;
671 ee->engine.x.sync_cancel = 0;
673 else if (e->message_type == ECORE_X_ATOM_E_COMP_SYNC_CANCEL)
675 ee = ecore_event_window_match(e->data.l[0]);
676 if (!ee) return ECORE_CALLBACK_PASS_ON; /* pass on event */
677 if (e->data.l[0] != (long)ee->prop.window)
678 return ECORE_CALLBACK_PASS_ON;
679 ee->engine.x.sync_began = 0;
680 ee->engine.x.sync_cancel = 1;
682 else if ((e->message_type == ECORE_X_ATOM_WM_PROTOCOLS) &&
683 (e->data.l[0] == (int)ECORE_X_ATOM_NET_WM_SYNC_REQUEST))
685 ee = ecore_event_window_match(e->win);
686 if (!ee) return ECORE_CALLBACK_PASS_ON; /* pass on event */
687 ee->engine.x.netwm_sync_val_lo = (unsigned int)e->data.l[2];
688 ee->engine.x.netwm_sync_val_hi = (int)e->data.l[3];
689 ee->engine.x.netwm_sync_set = 1;
691 return ECORE_CALLBACK_PASS_ON;
695 _ecore_evas_x_event_mouse_in(void *data __UNUSED__, int type __UNUSED__, void *event)
698 Ecore_X_Event_Mouse_In *e;
701 ee = ecore_event_window_match(e->win);
702 if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON; /* pass on event */
703 if (e->win != ee->prop.window) return ECORE_CALLBACK_PASS_ON;
708 /* const char *modes[] = { */
710 /* "MODE_WHILE_GRABBED", */
714 /* const char *details[] = { */
715 /* "DETAIL_ANCESTOR", */
716 /* "DETAIL_VIRTUAL", */
717 /* "DETAIL_INFERIOR", */
718 /* "DETAIL_NON_LINEAR", */
719 /* "DETAIL_NON_LINEAR_VIRTUAL", */
720 /* "DETAIL_POINTER", */
721 /* "DETAIL_POINTER_ROOT", */
722 /* "DETAIL_DETAIL_NONE" */
724 /* t = time(NULL); */
725 /* ct = ctime(&t); */
726 /* ct[strlen(ct) - 1] = 0; */
727 /* printf("@@ ->IN 0x%x 0x%x %s md=%s dt=%s\n", */
728 /* e->win, e->event_win, */
730 /* modes[e->mode], */
731 /* details[e->detail]); */
733 // disable. causes more problems than it fixes
734 // if ((e->mode == ECORE_X_EVENT_MODE_GRAB) ||
735 // (e->mode == ECORE_X_EVENT_MODE_UNGRAB))
737 /* if (e->mode != ECORE_X_EVENT_MODE_NORMAL) return 0; */
738 if (ee->func.fn_mouse_in) ee->func.fn_mouse_in(ee);
739 ecore_event_evas_modifier_lock_update(ee->evas, e->modifiers);
740 evas_event_feed_mouse_in(ee->evas, e->time, NULL);
741 _ecore_evas_mouse_move_process(ee, e->x, e->y, e->time);
742 return ECORE_CALLBACK_PASS_ON;
746 _ecore_evas_x_event_mouse_out(void *data __UNUSED__, int type __UNUSED__, void *event)
749 Ecore_X_Event_Mouse_Out *e;
752 ee = ecore_event_window_match(e->win);
753 if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON;
755 if (e->win != ee->prop.window) return ECORE_CALLBACK_PASS_ON;
760 /* const char *modes[] = { */
762 /* "MODE_WHILE_GRABBED", */
766 /* const char *details[] = { */
767 /* "DETAIL_ANCESTOR", */
768 /* "DETAIL_VIRTUAL", */
769 /* "DETAIL_INFERIOR", */
770 /* "DETAIL_NON_LINEAR", */
771 /* "DETAIL_NON_LINEAR_VIRTUAL", */
772 /* "DETAIL_POINTER", */
773 /* "DETAIL_POINTER_ROOT", */
774 /* "DETAIL_DETAIL_NONE" */
776 /* t = time(NULL); */
777 /* ct = ctime(&t); */
778 /* ct[strlen(ct) - 1] = 0; */
779 /* printf("@@ ->OUT 0x%x 0x%x %s md=%s dt=%s\n", */
780 /* e->win, e->event_win, */
782 /* modes[e->mode], */
783 /* details[e->detail]); */
785 // disable. causes more problems than it fixes
786 // if ((e->mode == ECORE_X_EVENT_MODE_GRAB) ||
787 // (e->mode == ECORE_X_EVENT_MODE_UNGRAB))
789 /* if (e->mode != ECORE_X_EVENT_MODE_NORMAL) return 0; */
790 ecore_event_evas_modifier_lock_update(ee->evas, e->modifiers);
791 _ecore_evas_mouse_move_process(ee, e->x, e->y, e->time);
792 if (e->mode == ECORE_X_EVENT_MODE_GRAB)
793 evas_event_feed_mouse_cancel(ee->evas, e->time, NULL);
794 evas_event_feed_mouse_out(ee->evas, e->time, NULL);
795 if (ee->func.fn_mouse_out) ee->func.fn_mouse_out(ee);
796 if (ee->prop.cursor.object) evas_object_hide(ee->prop.cursor.object);
797 return ECORE_CALLBACK_PASS_ON;
801 _ecore_evas_x_event_window_focus_in(void *data __UNUSED__, int type __UNUSED__, void *event)
804 Ecore_X_Event_Window_Focus_In *e;
807 ee = ecore_event_window_match(e->win);
808 if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON; /* pass on event */
809 if (e->win != ee->prop.window) return ECORE_CALLBACK_PASS_ON;
810 if (e->mode == ECORE_X_EVENT_MODE_UNGRAB) return ECORE_CALLBACK_PASS_ON;
811 ee->prop.focused = 1;
812 evas_focus_in(ee->evas);
813 if (ee->func.fn_focus_in) ee->func.fn_focus_in(ee);
814 return ECORE_CALLBACK_PASS_ON;
818 _ecore_evas_x_event_window_focus_out(void *data __UNUSED__, int type __UNUSED__, void *event)
821 Ecore_X_Event_Window_Focus_Out *e;
824 ee = ecore_event_window_match(e->win);
825 if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON; /* pass on event */
826 if (e->win != ee->prop.window) return ECORE_CALLBACK_PASS_ON;
827 if (e->mode == ECORE_X_EVENT_MODE_GRAB) return ECORE_CALLBACK_PASS_ON;
828 // if (ee->prop.fullscreen)
829 // ecore_x_window_focus(ee->prop.window);
830 evas_focus_out(ee->evas);
831 ee->prop.focused = 0;
832 if (ee->func.fn_focus_out) ee->func.fn_focus_out(ee);
833 return ECORE_CALLBACK_PASS_ON;
837 _ecore_evas_x_event_window_damage(void *data __UNUSED__, int type __UNUSED__, void *event)
840 Ecore_X_Event_Window_Damage *e;
843 ee = ecore_event_window_match(e->win);
844 if (!ee) return ECORE_CALLBACK_PASS_ON; /* pass on event */
845 if (e->win != ee->prop.window) return ECORE_CALLBACK_PASS_ON;
846 if (ee->engine.x.using_bg_pixmap) return ECORE_CALLBACK_PASS_ON;
847 // printf("EXPOSE %p [%i] %i %i %ix%i\n", ee, ee->prop.avoid_damage, e->x, e->y, e->w, e->h);
848 if (ee->prop.avoid_damage)
850 Ecore_X_Rectangle rect;
851 Ecore_X_XRegion *tmpr;
853 if (!ee->engine.x.damages)
854 ee->engine.x.damages = ecore_x_xregion_new();
855 tmpr = ecore_x_xregion_new();
860 ecore_x_xregion_union_rect(tmpr, ee->engine.x.damages, &rect);
861 ecore_x_xregion_free(ee->engine.x.damages);
862 ee->engine.x.damages = tmpr;
863 /* no - this breaks things badly. disable. Ecore_X_Rectangle != XRectangle - see
864 * the typedefs in x's headers and ecore_x's. also same with Region - it's a pointer in x - not an X ID
865 Ecore_X_Rectangle rect;
866 Ecore_X_XRegion *tmpr;
868 if (!ee->engine.x.damages) ee->engine.x.damages = ecore_x_xregion_new();
869 tmpr = ecore_x_xregion_new();
874 ecore_x_xregion_union_rect(tmpr, ee->engine.x.damages, &rect);
875 ecore_x_xregion_free(ee->engine.x.damages);
876 ee->engine.x.damages = tmpr;
881 if (ee->rotation == 0)
882 evas_damage_rectangle_add(ee->evas, e->x, e->y, e->w, e->h);
883 else if (ee->rotation == 90)
884 evas_damage_rectangle_add(ee->evas,
885 ee->h - e->y - e->h, e->x, e->h, e->w);
886 else if (ee->rotation == 180)
887 evas_damage_rectangle_add(ee->evas, ee->w - e->x - e->w,
888 ee->h - e->y - e->h, e->w, e->h);
889 else if (ee->rotation == 270)
890 evas_damage_rectangle_add(ee->evas, e->y, ee->w - e->x - e->w,
893 return ECORE_CALLBACK_PASS_ON;
897 _ecore_evas_x_event_window_destroy(void *data __UNUSED__, int type __UNUSED__, void *event)
900 Ecore_X_Event_Window_Destroy *e;
903 ee = ecore_event_window_match(e->win);
904 if (!ee) return ECORE_CALLBACK_PASS_ON; /* pass on event */
905 if (e->win != ee->prop.window) return ECORE_CALLBACK_PASS_ON;
906 if (ee->func.fn_destroy) ee->func.fn_destroy(ee);
907 _ecore_evas_x_sync_clear(ee);
909 return ECORE_CALLBACK_PASS_ON;
913 _ecore_evas_x_event_window_configure(void *data __UNUSED__, int type __UNUSED__, void *event)
916 Ecore_X_Event_Window_Configure *e;
919 ee = ecore_event_window_match(e->win);
920 if (!ee) return ECORE_CALLBACK_PASS_ON; /* pass on event */
921 if (e->win != ee->prop.window) return ECORE_CALLBACK_PASS_ON;
922 if (ee->engine.x.direct_resize) return ECORE_CALLBACK_PASS_ON;
924 if ((e->from_wm) || (ee->prop.override))
926 if ((ee->x != e->x) || (ee->y != e->y))
932 if (ee->func.fn_move) ee->func.fn_move(ee);
935 if ((ee->w != e->w) || (ee->h != e->h))
941 if ((ee->rotation == 90) || (ee->rotation == 270))
943 evas_output_size_set(ee->evas, ee->h, ee->w);
944 evas_output_viewport_set(ee->evas, 0, 0, ee->h, ee->w);
948 evas_output_size_set(ee->evas, ee->w, ee->h);
949 evas_output_viewport_set(ee->evas, 0, 0, ee->w, ee->h);
951 if (ee->prop.avoid_damage)
955 pdam = ecore_evas_avoid_damage_get(ee);
956 ecore_evas_avoid_damage_set(ee, 0);
957 ecore_evas_avoid_damage_set(ee, pdam);
959 if ((ee->shaped) || (ee->alpha))
960 _ecore_evas_x_resize_shape(ee);
961 if ((ee->expecting_resize.w > 0) && (ee->expecting_resize.h > 0))
963 if ((ee->expecting_resize.w == ee->w) &&
964 (ee->expecting_resize.h == ee->h))
965 _ecore_evas_mouse_move_process(ee, ee->mouse.x, ee->mouse.y,
966 ecore_x_current_time_get());
967 ee->expecting_resize.w = 0;
968 ee->expecting_resize.h = 0;
970 if (ee->func.fn_resize) ee->func.fn_resize(ee);
972 return ECORE_CALLBACK_PASS_ON;
976 _ecore_evas_x_event_window_delete_request(void *data __UNUSED__, int type __UNUSED__, void *event)
979 Ecore_X_Event_Window_Delete_Request *e;
982 ee = ecore_event_window_match(e->win);
983 if (!ee) return ECORE_CALLBACK_PASS_ON; /* pass on event */
984 if (e->win != ee->prop.window) return ECORE_CALLBACK_PASS_ON;
985 if (ee->func.fn_delete_request) ee->func.fn_delete_request(ee);
986 return ECORE_CALLBACK_PASS_ON;
990 _ecore_evas_x_event_window_show(void *data __UNUSED__, int type __UNUSED__, void *event)
993 Ecore_X_Event_Window_Show *e;
994 static int first_map_bug = -1;
997 ee = ecore_event_window_match(e->win);
998 if (!ee) return ECORE_CALLBACK_PASS_ON; /* pass on event */
999 if (e->win != ee->prop.window) return ECORE_CALLBACK_PASS_ON;
1000 /* some GL drivers are doing buffer copy in a separate thread.
1001 * we need to check whether GL driver sends SYNC_DRAW_DONE msg afger copying
1002 * that are required in order to exactly render. - added by gl77.lee
1004 if (ee->gl_sync_draw_done < 0)
1006 if (getenv("ECORE_EVAS_GL_SYNC_DRAW_DONE"))
1007 ee->gl_sync_draw_done = atoi(getenv("ECORE_EVAS_GL_SYNC_DRAW_DONE"));
1009 ee->gl_sync_draw_done = 0;
1011 if (first_map_bug < 0)
1015 if ((bug = getenv("ECORE_EVAS_GL_FIRST_MAP_BUG")))
1016 first_map_bug = atoi(bug);
1020 if ((first_map_bug) && (!strcmp(ee->driver, "opengl_x11")))
1021 evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h);
1022 if (ee->visible) return ECORE_CALLBACK_DONE;
1023 // printf("SHOW EVENT %p\n", ee);
1025 if (ee->func.fn_show) ee->func.fn_show(ee);
1026 return ECORE_CALLBACK_PASS_ON;
1030 _ecore_evas_x_event_window_hide(void *data __UNUSED__, int type __UNUSED__, void *event)
1033 Ecore_X_Event_Window_Hide *e;
1036 ee = ecore_event_window_match(e->win);
1037 if (!ee) return ECORE_CALLBACK_PASS_ON; /* pass on event */
1038 if (e->win != ee->prop.window) return ECORE_CALLBACK_PASS_ON;
1039 if (!ee->visible) return ECORE_CALLBACK_DONE;
1040 // printf("HIDE EVENT %p\n", ee);
1042 if (ee->func.fn_hide) ee->func.fn_hide(ee);
1043 return ECORE_CALLBACK_PASS_ON;
1046 /* FIXME, should be in idler */
1047 /* FIXME, round trip */
1049 _ecore_evas_x_size_pos_hints_update(Ecore_Evas *ee)
1051 ecore_x_icccm_size_pos_hints_set(ee->prop.window,
1052 ee->prop.request_pos /*request_pos */,
1053 ECORE_X_GRAVITY_NW /* gravity */,
1054 ee->prop.min.w /* min_w */,
1055 ee->prop.min.h /* min_h */,
1056 ee->prop.max.w /* max_w */,
1057 ee->prop.max.h /* max_h */,
1058 ee->prop.base.w /* base_w */,
1059 ee->prop.base.h /* base_h */,
1060 ee->prop.step.w /* step_x */,
1061 ee->prop.step.h /* step_y */,
1063 0 /* max_aspect */);
1066 /* FIXME, should be in idler */
1068 _ecore_evas_x_state_update(Ecore_Evas *ee)
1070 Ecore_X_Window_State state[10];
1074 if (bd->client.netwm.state.modal)
1075 state[num++] = ECORE_X_WINDOW_STATE_MODAL;
1077 if (ee->engine.x.state.sticky)
1078 state[num++] = ECORE_X_WINDOW_STATE_STICKY;
1080 if (bd->client.netwm.state.maximized_v)
1081 state[num++] = ECORE_X_WINDOW_STATE_MAXIMIZED_VERT;
1082 if (bd->client.netwm.state.maximized_h)
1083 state[num++] = ECORE_X_WINDOW_STATE_MAXIMIZED_HORZ;
1084 if (bd->client.netwm.state.shaded)
1085 state[num++] = ECORE_X_WINDOW_STATE_SHADED;
1086 if (bd->client.netwm.state.skip_taskbar)
1087 state[num++] = ECORE_X_WINDOW_STATE_SKIP_TASKBAR;
1088 if (bd->client.netwm.state.skip_pager)
1089 state[num++] = ECORE_X_WINDOW_STATE_SKIP_PAGER;
1090 if (bd->client.netwm.state.hidden)
1091 state[num++] = ECORE_X_WINDOW_STATE_HIDDEN;
1093 if (ee->engine.x.state.fullscreen)
1094 state[num++] = ECORE_X_WINDOW_STATE_FULLSCREEN;
1095 if (ee->engine.x.state.above)
1096 state[num++] = ECORE_X_WINDOW_STATE_ABOVE;
1097 if (ee->engine.x.state.below)
1098 state[num++] = ECORE_X_WINDOW_STATE_BELOW;
1100 ecore_x_netwm_window_state_set(ee->prop.window, state, num);
1104 _ecore_evas_x_layer_update(Ecore_Evas *ee)
1106 if (ee->should_be_visible)
1108 /* We need to send a netwm request to the wm */
1109 /* FIXME: Do we have to remove old state before adding new? */
1110 if (ee->prop.layer < 3)
1112 if (ee->engine.x.state.above)
1114 ee->engine.x.state.above = 0;
1115 ecore_x_netwm_state_request_send(ee->prop.window,
1116 ee->engine.x.win_root,
1117 ECORE_X_WINDOW_STATE_ABOVE, -1, 0);
1119 if (!ee->engine.x.state.below)
1121 ee->engine.x.state.below = 1;
1122 ecore_x_netwm_state_request_send(ee->prop.window,
1123 ee->engine.x.win_root,
1124 ECORE_X_WINDOW_STATE_BELOW, -1, 1);
1127 else if (ee->prop.layer > 5)
1129 if (ee->engine.x.state.below)
1131 ee->engine.x.state.below = 0;
1132 ecore_x_netwm_state_request_send(ee->prop.window,
1133 ee->engine.x.win_root,
1134 ECORE_X_WINDOW_STATE_BELOW, -1, 0);
1136 if (!ee->engine.x.state.above)
1138 ee->engine.x.state.above = 1;
1139 ecore_x_netwm_state_request_send(ee->prop.window,
1140 ee->engine.x.win_root,
1141 ECORE_X_WINDOW_STATE_ABOVE, -1, 1);
1146 if (ee->engine.x.state.below)
1148 ee->engine.x.state.below = 0;
1149 ecore_x_netwm_state_request_send(ee->prop.window,
1150 ee->engine.x.win_root,
1151 ECORE_X_WINDOW_STATE_BELOW, -1, 0);
1153 if (ee->engine.x.state.above)
1155 ee->engine.x.state.above = 0;
1156 ecore_x_netwm_state_request_send(ee->prop.window,
1157 ee->engine.x.win_root,
1158 ECORE_X_WINDOW_STATE_ABOVE, -1, 0);
1164 /* Just set the state */
1165 if (ee->prop.layer < 3)
1167 if ((ee->engine.x.state.above) || (!ee->engine.x.state.below))
1169 ee->engine.x.state.above = 0;
1170 ee->engine.x.state.below = 1;
1171 _ecore_evas_x_state_update(ee);
1174 else if (ee->prop.layer > 5)
1176 if ((!ee->engine.x.state.above) || (ee->engine.x.state.below))
1178 ee->engine.x.state.above = 1;
1179 ee->engine.x.state.below = 0;
1180 _ecore_evas_x_state_update(ee);
1185 if ((ee->engine.x.state.above) || (ee->engine.x.state.below))
1187 ee->engine.x.state.above = 0;
1188 ee->engine.x.state.below = 0;
1189 _ecore_evas_x_state_update(ee);
1193 /* FIXME: Set gnome layer */
1197 _ecore_evas_x_init(void)
1199 _ecore_evas_init_count++;
1200 if (_ecore_evas_init_count > 1) return _ecore_evas_init_count;
1201 ecore_evas_event_handlers[0] =
1202 ecore_event_handler_add(ECORE_X_EVENT_MOUSE_IN,
1203 _ecore_evas_x_event_mouse_in, NULL);
1204 ecore_evas_event_handlers[1] =
1205 ecore_event_handler_add(ECORE_X_EVENT_MOUSE_OUT,
1206 _ecore_evas_x_event_mouse_out, NULL);
1207 ecore_evas_event_handlers[2] =
1208 ecore_event_handler_add(ECORE_X_EVENT_WINDOW_FOCUS_IN,
1209 _ecore_evas_x_event_window_focus_in, NULL);
1210 ecore_evas_event_handlers[3] =
1211 ecore_event_handler_add(ECORE_X_EVENT_WINDOW_FOCUS_OUT,
1212 _ecore_evas_x_event_window_focus_out, NULL);
1213 ecore_evas_event_handlers[4] =
1214 ecore_event_handler_add(ECORE_X_EVENT_WINDOW_DAMAGE,
1215 _ecore_evas_x_event_window_damage, NULL);
1216 ecore_evas_event_handlers[5] =
1217 ecore_event_handler_add(ECORE_X_EVENT_WINDOW_DESTROY,
1218 _ecore_evas_x_event_window_destroy, NULL);
1219 ecore_evas_event_handlers[6] =
1220 ecore_event_handler_add(ECORE_X_EVENT_WINDOW_CONFIGURE,
1221 _ecore_evas_x_event_window_configure, NULL);
1222 ecore_evas_event_handlers[7] =
1223 ecore_event_handler_add(ECORE_X_EVENT_WINDOW_DELETE_REQUEST,
1224 _ecore_evas_x_event_window_delete_request, NULL);
1225 ecore_evas_event_handlers[8] =
1226 ecore_event_handler_add(ECORE_X_EVENT_WINDOW_SHOW,
1227 _ecore_evas_x_event_window_show, NULL);
1228 ecore_evas_event_handlers[9] =
1229 ecore_event_handler_add(ECORE_X_EVENT_WINDOW_HIDE,
1230 _ecore_evas_x_event_window_hide, NULL);
1231 ecore_evas_event_handlers[10] =
1232 ecore_event_handler_add(ECORE_X_EVENT_WINDOW_PROPERTY,
1233 _ecore_evas_x_event_property_change, NULL);
1234 ecore_evas_event_handlers[11] =
1235 ecore_event_handler_add(ECORE_X_EVENT_WINDOW_VISIBILITY_CHANGE,
1236 _ecore_evas_x_event_visibility_change, NULL);
1237 ecore_evas_event_handlers[12] =
1238 ecore_event_handler_add(ECORE_X_EVENT_CLIENT_MESSAGE,
1239 _ecore_evas_x_event_client_message, NULL);
1240 ecore_event_evas_init();
1241 return _ecore_evas_init_count;
1245 _ecore_evas_x_free(Ecore_Evas *ee)
1247 _ecore_evas_x_group_leader_unset(ee);
1248 _ecore_evas_x_sync_set(ee);
1249 if (ee->engine.x.win_shaped_input)
1250 ecore_x_window_free(ee->engine.x.win_shaped_input);
1251 ecore_x_window_free(ee->prop.window);
1252 if (ee->engine.x.pmap) ecore_x_pixmap_free(ee->engine.x.pmap);
1253 if (ee->engine.x.mask) ecore_x_pixmap_free(ee->engine.x.mask);
1254 if (ee->engine.x.gc) ecore_x_gc_free(ee->engine.x.gc);
1255 if (ee->engine.x.damages) ecore_x_xregion_free(ee->engine.x.damages);
1256 ee->engine.x.pmap = 0;
1257 ee->engine.x.mask = 0;
1258 ee->engine.x.gc = 0;
1259 ee->engine.x.damages = NULL;
1260 ecore_event_window_unregister(ee->prop.window);
1261 while (ee->engine.x.win_extra)
1263 Ecore_X_Window *winp;
1265 winp = ee->engine.x.win_extra->data;
1266 ee->engine.x.win_extra =
1267 eina_list_remove_list(ee->engine.x.win_extra, ee->engine.x.win_extra);
1268 ecore_event_window_unregister(*winp);
1271 _ecore_evas_x_shutdown();
1276 _ecore_evas_x_callback_delete_request_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee))
1278 ee->func.fn_delete_request = func;
1279 _ecore_evas_x_protocols_set(ee);
1280 _ecore_evas_x_sync_set(ee);
1284 _ecore_evas_x_move(Ecore_Evas *ee, int x, int y)
1288 if (ee->engine.x.direct_resize)
1290 if (!ee->engine.x.managed)
1292 if ((x != ee->x) || (y != ee->y))
1296 ecore_x_window_move(ee->prop.window, x, y);
1297 if (!ee->should_be_visible)
1299 /* We need to request pos */
1300 ee->prop.request_pos = 1;
1301 _ecore_evas_x_size_pos_hints_update(ee);
1303 if (ee->func.fn_move) ee->func.fn_move(ee);
1309 ecore_x_window_move(ee->prop.window, x, y);
1310 if (!ee->should_be_visible)
1312 /* We need to request pos */
1313 ee->prop.request_pos = 1;
1314 _ecore_evas_x_size_pos_hints_update(ee);
1316 if (!ee->engine.x.managed)
1325 _ecore_evas_x_managed_move(Ecore_Evas *ee, int x, int y)
1329 if (ee->engine.x.direct_resize)
1331 ee->engine.x.managed = 1;
1332 if ((x != ee->x) || (y != ee->y))
1336 if (ee->func.fn_move) ee->func.fn_move(ee);
1342 _ecore_evas_x_resize(Ecore_Evas *ee, int w, int h)
1346 if (ee->engine.x.direct_resize)
1348 if ((ee->w != w) || (ee->h != h))
1350 ecore_x_window_resize(ee->prop.window, w, h);
1353 if ((ee->rotation == 90) || (ee->rotation == 270))
1355 evas_output_size_set(ee->evas, ee->h, ee->w);
1356 evas_output_viewport_set(ee->evas, 0, 0, ee->h, ee->w);
1360 evas_output_size_set(ee->evas, ee->w, ee->h);
1361 evas_output_viewport_set(ee->evas, 0, 0, ee->w, ee->h);
1363 if (ee->prop.avoid_damage)
1367 pdam = ecore_evas_avoid_damage_get(ee);
1368 ecore_evas_avoid_damage_set(ee, 0);
1369 ecore_evas_avoid_damage_set(ee, pdam);
1371 if ((ee->shaped) || (ee->alpha))
1372 _ecore_evas_x_resize_shape(ee);
1373 if (ee->func.fn_resize) ee->func.fn_resize(ee);
1377 ecore_x_window_resize(ee->prop.window, w, h);
1381 _ecore_evas_x_move_resize(Ecore_Evas *ee, int x, int y, int w, int h)
1387 if (ee->engine.x.direct_resize)
1389 if ((ee->w != w) || (ee->h != h) || (x != ee->x) || (y != ee->y))
1391 int change_size = 0, change_pos = 0;
1393 if ((ee->w != w) || (ee->h != h)) change_size = 1;
1394 if (!ee->engine.x.managed)
1396 if ((x != ee->x) || (y != ee->y)) change_pos = 1;
1398 ecore_x_window_move_resize(ee->prop.window, x, y, w, h);
1399 if (!ee->engine.x.managed)
1406 if ((ee->rotation == 90) || (ee->rotation == 270))
1408 evas_output_size_set(ee->evas, ee->h, ee->w);
1409 evas_output_viewport_set(ee->evas, 0, 0, ee->h, ee->w);
1413 evas_output_size_set(ee->evas, ee->w, ee->h);
1414 evas_output_viewport_set(ee->evas, 0, 0, ee->w, ee->h);
1416 if (ee->prop.avoid_damage)
1420 pdam = ecore_evas_avoid_damage_get(ee);
1421 ecore_evas_avoid_damage_set(ee, 0);
1422 ecore_evas_avoid_damage_set(ee, pdam);
1424 if ((ee->shaped) || (ee->alpha))
1425 _ecore_evas_x_resize_shape(ee);
1428 if (ee->func.fn_move) ee->func.fn_move(ee);
1432 if (ee->func.fn_resize) ee->func.fn_resize(ee);
1438 ecore_x_window_move_resize(ee->prop.window, x, y, w, h);
1439 if (!ee->engine.x.managed)
1448 _ecore_evas_x_rotation_set_internal(Ecore_Evas *ee, int rotation, int resize,
1449 Evas_Engine_Info *einfo)
1453 rot_dif = ee->rotation - rotation;
1454 if (rot_dif < 0) rot_dif = -rot_dif;
1458 int minw, minh, maxw, maxh, basew, baseh, stepw, steph;
1460 if (!evas_engine_info_set(ee->evas, einfo))
1462 ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver);
1467 if (!ee->prop.fullscreen)
1469 ecore_x_window_resize(ee->prop.window, ee->req.h, ee->req.w);
1470 ee->expecting_resize.w = ee->h;
1471 ee->expecting_resize.h = ee->w;
1477 ecore_x_window_size_get(ee->prop.window, &w, &h);
1478 ecore_x_window_resize(ee->prop.window, h, w);
1479 if ((rotation == 0) || (rotation == 180))
1481 evas_output_size_set(ee->evas, ee->req.w, ee->req.h);
1482 evas_output_viewport_set(ee->evas, 0, 0, ee->req.w, ee->req.h);
1486 evas_output_size_set(ee->evas, ee->req.h, ee->req.w);
1487 evas_output_viewport_set(ee->evas, 0, 0, ee->req.h, ee->req.w);
1489 if (ee->func.fn_resize) ee->func.fn_resize(ee);
1491 if ((ee->rotation == 90) || (ee->rotation == 270))
1492 evas_damage_rectangle_add(ee->evas, 0, 0, ee->req.h, ee->req.w);
1494 evas_damage_rectangle_add(ee->evas, 0, 0, ee->req.w, ee->req.h);
1500 ecore_x_window_size_get(ee->prop.window, &w, &h);
1501 if ((rotation == 0) || (rotation == 180))
1503 evas_output_size_set(ee->evas, ee->w, ee->h);
1504 evas_output_viewport_set(ee->evas, 0, 0, ee->w, ee->h);
1508 evas_output_size_set(ee->evas, ee->h, ee->w);
1509 evas_output_viewport_set(ee->evas, 0, 0, ee->h, ee->w);
1511 if (ee->func.fn_resize) ee->func.fn_resize(ee);
1512 if ((ee->rotation == 90) || (ee->rotation == 270))
1513 evas_damage_rectangle_add(ee->evas, 0, 0, ee->h, ee->w);
1515 evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h);
1517 ecore_evas_size_min_get(ee, &minw, &minh);
1518 ecore_evas_size_max_get(ee, &maxw, &maxh);
1519 ecore_evas_size_base_get(ee, &basew, &baseh);
1520 ecore_evas_size_step_get(ee, &stepw, &steph);
1521 ee->rotation = rotation;
1522 ecore_evas_size_min_set(ee, minh, minw);
1523 ecore_evas_size_max_set(ee, maxh, maxw);
1524 ecore_evas_size_base_set(ee, baseh, basew);
1525 ecore_evas_size_step_set(ee, steph, stepw);
1526 _ecore_evas_mouse_move_process(ee, ee->mouse.x, ee->mouse.y,
1527 ecore_x_current_time_get());
1531 if (!evas_engine_info_set(ee->evas, einfo))
1533 ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver);
1535 ee->rotation = rotation;
1536 _ecore_evas_mouse_move_process(ee, ee->mouse.x, ee->mouse.y,
1537 ecore_x_current_time_get());
1538 if (ee->func.fn_resize) ee->func.fn_resize(ee);
1540 if ((ee->rotation == 90) || (ee->rotation == 270))
1541 evas_damage_rectangle_add(ee->evas, 0, 0, ee->h, ee->w);
1543 evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h);
1547 #define _USE_WIN_ROT_EFFECT 1
1549 #if _USE_WIN_ROT_EFFECT
1550 static void _ecore_evas_x_flush_pre(void *data, Evas *e __UNUSED__, void *event_info __UNUSED__);
1552 typedef struct _Ecore_Evas_X_Rotation_Effect Ecore_Evas_X_Rotation_Effect;
1553 struct _Ecore_Evas_X_Rotation_Effect
1555 Eina_Bool wait_for_comp_reply;
1558 static Ecore_Evas_X_Rotation_Effect _rot_effect =
1564 _ecore_evas_x_rotation_effect_setup(void)
1566 _rot_effect.wait_for_comp_reply = EINA_TRUE;
1568 #endif /* end of _USE_WIN_ROT_EFFECT */
1571 _ecore_evas_x_rotation_set(Ecore_Evas *ee, int rotation, int resize)
1573 if (ee->rotation == rotation) return;
1574 if (!strcmp(ee->driver, "xrender_x11")) return;
1576 #if _USE_WIN_ROT_EFFECT
1578 angles[0] = rotation;
1579 angles[1] = ee->rotation;
1580 #endif /* end of _USE_WIN_ROT_EFFECT */
1582 if (!strcmp(ee->driver, "opengl_x11"))
1584 #ifdef BUILD_ECORE_EVAS_OPENGL_X11
1585 Evas_Engine_Info_GL_X11 *einfo;
1587 einfo = (Evas_Engine_Info_GL_X11 *)evas_engine_info_get(ee->evas);
1589 einfo->info.rotation = rotation;
1590 _ecore_evas_x_rotation_set_internal(ee, rotation, resize,
1591 (Evas_Engine_Info *)einfo);
1592 # if _USE_WIN_ROT_EFFECT
1593 ecore_x_window_prop_property_set(ee->prop.window,
1594 ECORE_X_ATOM_E_ILLUME_ROTATE_WINDOW_ANGLE,
1595 ECORE_X_ATOM_CARDINAL, 32, &angles, 2);
1597 ecore_x_window_prop_property_set(ee->prop.window,
1598 ECORE_X_ATOM_E_ILLUME_ROTATE_WINDOW_ANGLE,
1599 ECORE_X_ATOM_CARDINAL, 32, &rotation, 1);
1601 #endif /* BUILD_ECORE_EVAS_OPENGL_X11 */
1603 else if (!strcmp(ee->driver, "software_x11"))
1605 #ifdef BUILD_ECORE_EVAS_SOFTWARE_X11
1606 Evas_Engine_Info_Software_X11 *einfo;
1608 einfo = (Evas_Engine_Info_Software_X11 *)evas_engine_info_get(ee->evas);
1610 einfo->info.rotation = rotation;
1611 _ecore_evas_x_rotation_set_internal(ee, rotation, resize,
1612 (Evas_Engine_Info *)einfo);
1613 # if _USE_WIN_ROT_EFFECT
1614 ecore_x_window_prop_property_set(ee->prop.window,
1615 ECORE_X_ATOM_E_ILLUME_ROTATE_WINDOW_ANGLE,
1616 ECORE_X_ATOM_CARDINAL, 32, &angles, 2);
1618 ecore_x_window_prop_property_set(ee->prop.window,
1619 ECORE_X_ATOM_E_ILLUME_ROTATE_WINDOW_ANGLE,
1620 ECORE_X_ATOM_CARDINAL, 32, &rotation, 1);
1622 #endif /* BUILD_ECORE_EVAS_SOFTWARE_X11 */
1624 else if (!strcmp(ee->driver, "software_16_x11"))
1626 #if BUILD_ECORE_EVAS_SOFTWARE_16_X11
1627 Evas_Engine_Info_Software_16_X11 *einfo;
1629 einfo = (Evas_Engine_Info_Software_16_X11 *)evas_engine_info_get(ee->evas);
1631 einfo->info.rotation = rotation;
1632 _ecore_evas_x_rotation_set_internal(ee, rotation, resize,
1633 (Evas_Engine_Info *)einfo);
1634 # if _USE_WIN_ROT_EFFECT
1635 ecore_x_window_prop_property_set(ee->prop.window,
1636 ECORE_X_ATOM_E_ILLUME_ROTATE_WINDOW_ANGLE,
1637 ECORE_X_ATOM_CARDINAL, 32, &angles, 2);
1639 ecore_x_window_prop_property_set(ee->prop.window,
1640 ECORE_X_ATOM_E_ILLUME_ROTATE_WINDOW_ANGLE,
1641 ECORE_X_ATOM_CARDINAL, 32, &rotation, 1);
1643 #endif /* BUILD_ECORE_EVAS_SOFTWARE_16_X11 */
1645 else if (!strcmp(ee->driver, "software_8_x11"))
1647 #if BUILD_ECORE_EVAS_SOFTWARE_8_X11
1648 Evas_Engine_Info_Software_8_X11 *einfo;
1650 einfo = (Evas_Engine_Info_Software_8_X11 *)evas_engine_info_get(ee->evas);
1652 einfo->info.rotation = rotation;
1653 _ecore_evas_x_rotation_set_internal(ee, rotation, resize,
1654 (Evas_Engine_Info *)einfo);
1655 # if _USE_WIN_ROT_EFFECT
1656 ecore_x_window_prop_property_set(ee->prop.window,
1657 ECORE_X_ATOM_E_ILLUME_ROTATE_WINDOW_ANGLE,
1658 ECORE_X_ATOM_CARDINAL, 32, &angles, 2);
1660 ecore_x_window_prop_property_set(ee->prop.window,
1661 ECORE_X_ATOM_E_ILLUME_ROTATE_WINDOW_ANGLE,
1662 ECORE_X_ATOM_CARDINAL, 32, &rotation, 1);
1664 #endif /* BUILD_ECORE_EVAS_SOFTWARE_8_X11 */
1667 #if _USE_WIN_ROT_EFFECT
1668 _ecore_evas_x_rotation_effect_setup();
1669 _ecore_evas_x_flush_pre(ee, NULL, NULL);
1670 #endif /* end of _USE_WIN_ROT_EFFECT */
1674 _ecore_evas_x_shaped_set(Ecore_Evas *ee, int shaped)
1676 if ((ee->shaped == shaped)) return;
1677 if (!strcmp(ee->driver, "opengl_x11")) return;
1678 if (!strcmp(ee->driver, "software_x11"))
1680 #ifdef BUILD_ECORE_EVAS_SOFTWARE_X11
1681 Evas_Engine_Info_Software_X11 *einfo;
1683 einfo = (Evas_Engine_Info_Software_X11 *)evas_engine_info_get(ee->evas);
1684 ee->shaped = shaped;
1689 unsigned int foreground;
1692 if (!ee->engine.x.mask)
1693 ee->engine.x.mask = ecore_x_pixmap_new(ee->prop.window, ee->w, ee->h, 1);
1695 gc = ecore_x_gc_new(ee->engine.x.mask,
1696 ECORE_X_GC_VALUE_MASK_FOREGROUND,
1698 ecore_x_drawable_rectangle_fill(ee->engine.x.mask, gc,
1699 0, 0, ee->w, ee->h);
1700 ecore_x_gc_free(gc);
1701 einfo->info.mask = ee->engine.x.mask;
1702 if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo))
1704 ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver);
1706 evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h);
1707 ecore_x_window_shape_input_mask_set(ee->prop.window, 0);
1711 if (ee->engine.x.mask) ecore_x_pixmap_free(ee->engine.x.mask);
1712 ee->engine.x.mask = 0;
1713 einfo->info.mask = 0;
1714 if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo))
1716 ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver);
1718 ecore_x_window_shape_mask_set(ee->prop.window, 0);
1719 ecore_x_window_shape_input_mask_set(ee->prop.window, 0);
1722 #endif /* BUILD_ECORE_EVAS_SOFTWARE_X11 */
1724 else if (!strcmp(ee->driver, "software_16_x11"))
1726 #if BUILD_ECORE_EVAS_SOFTWARE_16_X11
1727 # if 0 /* XXX no shaped window support for software_16_x11 */
1728 Evas_Engine_Info_Software_16_X11 *einfo;
1730 einfo = (Evas_Engine_Info_Software_16_X11 *)evas_engine_info_get(ee->evas);
1731 ee->shaped = shaped;
1737 ecore_x_pixmap_new(ee->prop.window, ee->w, ee->h, 1);
1738 einfo->info.mask = ee->engine.x.mask;
1739 if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo))
1741 ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver);
1743 evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h);
1747 if (ee->engine.x.mask) ecore_x_pixmap_free(ee->engine.x.mask);
1748 ee->engine.x.mask = 0;
1749 einfo->info.mask = 0;
1750 if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo))
1752 ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver);
1754 ecore_x_window_shape_mask_set(ee->prop.window, 0);
1757 # endif /* XXX no shaped window support for software_16_x11 */
1758 #endif /* BUILD_ECORE_EVAS_SOFTWARE_16_X11 */
1760 if (!strcmp(ee->driver, "software_8_x11"))
1762 #if defined (BUILD_ECORE_EVAS_SOFTWARE_8_X11)
1763 Evas_Engine_Info_Software_8_X11 *einfo;
1765 einfo = (Evas_Engine_Info_Software_8_X11 *)evas_engine_info_get(ee->evas);
1766 ee->shaped = shaped;
1771 unsigned int foreground;
1774 if (!ee->engine.x.mask)
1775 ee->engine.x.mask = ecore_x_pixmap_new(ee->prop.window, ee->w, ee->h, 1);
1777 gc = ecore_x_gc_new(ee->engine.x.mask,
1778 ECORE_X_GC_VALUE_MASK_FOREGROUND,
1780 ecore_x_drawable_rectangle_fill(ee->engine.x.mask, gc,
1781 0, 0, ee->w, ee->h);
1782 ecore_x_gc_free(gc);
1783 einfo->info.mask = ee->engine.x.mask;
1784 if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo))
1786 ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver);
1788 evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h);
1789 ecore_x_window_shape_input_mask_set(ee->prop.window, 0);
1793 if (ee->engine.x.mask) ecore_x_pixmap_free(ee->engine.x.mask);
1794 ee->engine.x.mask = 0;
1795 einfo->info.mask = 0;
1796 if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo))
1798 ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver);
1800 ecore_x_window_shape_mask_set(ee->prop.window, 0);
1801 ecore_x_window_shape_input_mask_set(ee->prop.window, 0);
1804 #endif /* BUILD_ECORE_EVAS_SOFTWARE_8_X11 */
1808 /* FIXME, round trip */
1810 _ecore_evas_x_alpha_set(Ecore_Evas *ee, int alpha)
1812 Ecore_X_Window_Attributes att;
1815 if ((ee->alpha == alpha)) return;
1817 if (!strcmp(ee->driver, "software_x11"))
1819 #ifdef BUILD_ECORE_EVAS_SOFTWARE_X11
1820 Evas_Engine_Info_Software_X11 *einfo;
1822 einfo = (Evas_Engine_Info_Software_X11 *)evas_engine_info_get(ee->evas);
1825 if (!ecore_x_composite_query()) return;
1829 ecore_x_window_free(ee->prop.window);
1830 ecore_event_window_unregister(ee->prop.window);
1833 if (ee->prop.override)
1834 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);
1836 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);
1837 if (!ee->engine.x.mask)
1838 ee->engine.x.mask = ecore_x_pixmap_new(ee->prop.window, ee->req.w, ee->req.h, 1);
1842 if (ee->prop.override)
1843 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);
1845 ee->prop.window = ecore_x_window_new(ee->engine.x.win_root, ee->req.x, ee->req.y, ee->req.w, ee->req.h);
1846 if (ee->engine.x.mask) ecore_x_pixmap_free(ee->engine.x.mask);
1847 ee->engine.x.mask = 0;
1848 ecore_x_window_shape_input_mask_set(ee->prop.window, 0);
1851 einfo->info.destination_alpha = alpha;
1853 ecore_x_window_attributes_get(ee->prop.window, &att);
1854 einfo->info.visual = att.visual;
1855 einfo->info.colormap = att.colormap;
1856 einfo->info.depth = att.depth;
1858 // if (ee->engine.x.mask) ecore_x_pixmap_free(ee->engine.x.mask);
1859 // ee->engine.x.mask = 0;
1860 einfo->info.mask = ee->engine.x.mask;
1861 einfo->info.drawable = ee->prop.window;
1862 if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo))
1864 ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver);
1866 evas_damage_rectangle_add(ee->evas, 0, 0, ee->req.w, ee->req.h);
1867 ecore_x_window_shape_mask_set(ee->prop.window, 0);
1868 ecore_x_input_multi_select(ee->prop.window);
1869 ecore_event_window_register(ee->prop.window, ee, ee->evas,
1870 (Ecore_Event_Mouse_Move_Cb)_ecore_evas_mouse_move_process,
1871 (Ecore_Event_Multi_Move_Cb)_ecore_evas_mouse_multi_move_process,
1872 (Ecore_Event_Multi_Down_Cb)_ecore_evas_mouse_multi_down_process,
1873 (Ecore_Event_Multi_Up_Cb)_ecore_evas_mouse_multi_up_process);
1874 if (ee->prop.borderless)
1875 ecore_x_mwm_borderless_set(ee->prop.window, ee->prop.borderless);
1876 if (ee->visible) ecore_x_window_show(ee->prop.window);
1877 if (ee->prop.focused) ecore_x_window_focus(ee->prop.window);
1880 ecore_x_icccm_title_set(ee->prop.window, ee->prop.title);
1881 ecore_x_netwm_name_set(ee->prop.window, ee->prop.title);
1883 ecore_x_icccm_hints_set(ee->prop.window,
1884 1 /* accepts_focus */,
1885 ECORE_X_WINDOW_STATE_HINT_NORMAL /* initial_state */,
1886 0 /* icon_pixmap */,
1888 0 /* icon_window */,
1889 0 /* window_group */,
1891 _ecore_evas_x_group_leader_update(ee);
1892 ecore_x_window_defaults_set(ee->prop.window);
1893 _ecore_evas_x_protocols_set(ee);
1894 _ecore_evas_x_sync_set(ee);
1895 #endif /* BUILD_ECORE_EVAS_SOFTWARE_X11 */
1896 if ((id = getenv("DESKTOP_STARTUP_ID")))
1898 ecore_x_netwm_startup_id_set(ee->prop.window, id);
1899 /* NB: on linux this may simply empty the env as opposed to completely
1900 * unset it to being empty - unsure as solartis libc crashes looking
1901 * for the '=' char */
1902 // putenv((char*)"DESKTOP_STARTUP_ID=");
1905 else if (!strcmp(ee->driver, "opengl_x11"))
1907 #ifdef BUILD_ECORE_EVAS_OPENGL_X11
1908 Evas_Engine_Info_GL_X11 *einfo;
1910 einfo = (Evas_Engine_Info_GL_X11 *)evas_engine_info_get(ee->evas);
1913 if (!ecore_x_composite_query()) return;
1917 ecore_x_window_free(ee->prop.window);
1918 ecore_event_window_unregister(ee->prop.window);
1919 ee->prop.window = 0;
1921 einfo->info.destination_alpha = alpha;
1923 if (ee->engine.x.win_root != 0)
1925 /* FIXME: round trip in ecore_x_window_argb_get */
1926 if (ecore_x_window_argb_get(ee->engine.x.win_root))
1929 _ecore_evas_x_gl_window_new(ee, ee->engine.x.win_root,
1930 ee->req.x, ee->req.y,
1931 ee->req.w, ee->req.h,
1932 ee->prop.override, 1, NULL);
1937 _ecore_evas_x_gl_window_new(ee, ee->engine.x.win_root,
1938 ee->req.x, ee->req.y,
1939 ee->req.w, ee->req.h,
1940 ee->prop.override, ee->alpha,
1947 _ecore_evas_x_gl_window_new(ee, ee->engine.x.win_root,
1948 ee->req.x, ee->req.y,
1949 ee->req.w, ee->req.h,
1950 ee->prop.override, ee->alpha, NULL);
1953 if (!ee->prop.window) return;
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);
1976 ecore_x_window_attributes_get(ee->prop.window, &att);
1977 einfo->info.visual = att.visual;
1978 einfo->info.colormap = att.colormap;
1979 einfo->info.depth = att.depth;
1981 // if (ee->engine.x.mask) ecore_x_pixmap_free(ee->engine.x.mask);
1982 // ee->engine.x.mask = 0;
1983 // einfo->info.mask = ee->engine.x.mask;
1984 einfo->info.drawable = ee->prop.window;
1985 if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo))
1987 ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver);
1989 evas_damage_rectangle_add(ee->evas, 0, 0, ee->req.w, ee->req.h);
1990 // ecore_x_window_shape_mask_set(ee->prop.window, 0);
1991 ecore_x_input_multi_select(ee->prop.window);
1992 ecore_event_window_register(ee->prop.window, ee, ee->evas,
1993 (Ecore_Event_Mouse_Move_Cb)_ecore_evas_mouse_move_process,
1994 (Ecore_Event_Multi_Move_Cb)_ecore_evas_mouse_multi_move_process,
1995 (Ecore_Event_Multi_Down_Cb)_ecore_evas_mouse_multi_down_process,
1996 (Ecore_Event_Multi_Up_Cb)_ecore_evas_mouse_multi_up_process);
1997 if (ee->prop.borderless)
1998 ecore_x_mwm_borderless_set(ee->prop.window, ee->prop.borderless);
1999 if (ee->visible) ecore_x_window_show(ee->prop.window);
2000 if (ee->prop.focused) ecore_x_window_focus(ee->prop.window);
2003 ecore_x_icccm_title_set(ee->prop.window, ee->prop.title);
2004 ecore_x_netwm_name_set(ee->prop.window, ee->prop.title);
2006 ecore_x_icccm_hints_set(ee->prop.window,
2007 1 /* accepts_focus */,
2008 ECORE_X_WINDOW_STATE_HINT_NORMAL /* initial_state */,
2009 0 /* icon_pixmap */,
2011 0 /* icon_window */,
2012 0 /* window_group */,
2014 _ecore_evas_x_group_leader_update(ee);
2015 ecore_x_window_defaults_set(ee->prop.window);
2016 _ecore_evas_x_protocols_set(ee);
2017 _ecore_evas_x_sync_set(ee);
2018 #endif /* BUILD_ECORE_EVAS_OPENGL_X11 */
2019 if ((id = getenv("DESKTOP_STARTUP_ID")))
2021 ecore_x_netwm_startup_id_set(ee->prop.window, id);
2022 /* NB: on linux this may simply empty the env as opposed to completely
2023 * unset it to being empty - unsure as solartis libc crashes looking
2024 * for the '=' char */
2025 // putenv((char*)"DESKTOP_STARTUP_ID=");
2028 else if (!strcmp(ee->driver, "software_16_x11"))
2030 #if BUILD_ECORE_EVAS_SOFTWARE_16_X11
2031 Evas_Engine_Info_Software_16_X11 *einfo;
2033 einfo = (Evas_Engine_Info_Software_16_X11 *)evas_engine_info_get(ee->evas);
2038 ecore_x_window_free(ee->prop.window);
2039 ecore_event_window_unregister(ee->prop.window);
2042 if (ee->prop.override)
2043 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);
2045 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);
2046 if (!ee->engine.x.mask)
2047 ee->engine.x.mask = ecore_x_pixmap_new(ee->prop.window, ee->req.w, ee->req.h, 1);
2051 if (ee->prop.override)
2052 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);
2054 ee->prop.window = ecore_x_window_new(ee->engine.x.win_root, ee->req.x, ee->req.y, ee->req.w, ee->req.h);
2055 if (ee->engine.x.mask) ecore_x_pixmap_free(ee->engine.x.mask);
2056 ee->engine.x.mask = 0;
2057 ecore_x_window_shape_input_mask_set(ee->prop.window, 0);
2060 # if 0 /* XXX no alpha window support for software_16_x11 */
2061 einfo->info.destination_alpha = alpha;
2062 # endif /* XXX no alpha window support for software_16_x11 */
2064 # if 0 /* XXX no shaped window support for software_16_x11 */
2065 // if (ee->engine.x.mask) ecore_x_pixmap_free(ee->engine.x.mask);
2066 // ee->engine.x.mask = 0;
2067 einfo->info.mask = ee->engine.x.mask;
2068 # endif /* XXX no shaped window support for software_16_x11 */
2070 einfo->info.drawable = ee->prop.window;
2071 if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo))
2073 ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver);
2075 evas_damage_rectangle_add(ee->evas, 0, 0, ee->req.w, ee->req.h);
2076 ecore_x_window_shape_mask_set(ee->prop.window, 0);
2077 ecore_x_input_multi_select(ee->prop.window);
2078 ecore_event_window_register(ee->prop.window, ee, ee->evas,
2079 (Ecore_Event_Mouse_Move_Cb)_ecore_evas_mouse_move_process,
2080 (Ecore_Event_Multi_Move_Cb)_ecore_evas_mouse_multi_move_process,
2081 (Ecore_Event_Multi_Down_Cb)_ecore_evas_mouse_multi_down_process,
2082 (Ecore_Event_Multi_Up_Cb)_ecore_evas_mouse_multi_up_process);
2083 if (ee->prop.borderless)
2084 ecore_x_mwm_borderless_set(ee->prop.window, ee->prop.borderless);
2085 if (ee->visible) ecore_x_window_show(ee->prop.window);
2086 if (ee->prop.focused) ecore_x_window_focus(ee->prop.window);
2089 ecore_x_icccm_title_set(ee->prop.window, ee->prop.title);
2090 ecore_x_netwm_name_set(ee->prop.window, ee->prop.title);
2092 ecore_x_icccm_hints_set(ee->prop.window,
2093 1 /* accepts_focus */,
2094 ECORE_X_WINDOW_STATE_HINT_NORMAL /* initial_state */,
2095 0 /* icon_pixmap */,
2097 0 /* icon_window */,
2098 0 /* window_group */,
2100 _ecore_evas_x_group_leader_update(ee);
2101 ecore_x_window_defaults_set(ee->prop.window);
2102 _ecore_evas_x_protocols_set(ee);
2103 _ecore_evas_x_sync_set(ee);
2104 #endif /* BUILD_ECORE_EVAS_SOFTWARE_16_X11 */
2105 if ((id = getenv("DESKTOP_STARTUP_ID")))
2107 ecore_x_netwm_startup_id_set(ee->prop.window, id);
2108 /* NB: on linux this may simply empty the env as opposed to completely
2109 * unset it to being empty - unsure as solartis libc crashes looking
2110 * for the '=' char */
2111 // putenv((char*)"DESKTOP_STARTUP_ID=");
2114 else if (!strcmp(ee->driver, "software_8_x11"))
2116 #if defined (BUILD_ECORE_EVAS_SOFTWARE_8_X11)
2117 Evas_Engine_Info_Software_8_X11 *einfo;
2119 einfo = (Evas_Engine_Info_Software_8_X11 *)evas_engine_info_get(ee->evas);
2124 ecore_x_window_free(ee->prop.window);
2125 ecore_event_window_unregister(ee->prop.window);
2128 if (ee->prop.override)
2129 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);
2131 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);
2132 if (!ee->engine.x.mask)
2133 ee->engine.x.mask = ecore_x_pixmap_new(ee->prop.window, ee->req.w, ee->req.h, 1);
2137 if (ee->prop.override)
2138 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);
2140 ee->prop.window = ecore_x_window_new(ee->engine.x.win_root, ee->req.x, ee->req.y, ee->req.w, ee->req.h);
2141 if (ee->engine.x.mask) ecore_x_pixmap_free(ee->engine.x.mask);
2142 ee->engine.x.mask = 0;
2143 ecore_x_window_shape_input_mask_set(ee->prop.window, 0);
2146 einfo->info.destination_alpha = alpha;
2148 ecore_x_window_attributes_get(ee->prop.window, &att);
2149 einfo->info.visual = att.visual;
2150 einfo->info.colormap = att.colormap;
2151 einfo->info.depth = att.depth;
2153 // if (ee->engine.x.mask) ecore_x_pixmap_free(ee->engine.x.mask);
2154 // ee->engine.x.mask = 0;
2155 einfo->info.mask = ee->engine.x.mask;
2156 einfo->info.drawable = ee->prop.window;
2157 if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo))
2159 ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver);
2161 evas_damage_rectangle_add(ee->evas, 0, 0, ee->req.w, ee->req.h);
2162 ecore_x_window_shape_mask_set(ee->prop.window, 0);
2163 ecore_x_input_multi_select(ee->prop.window);
2164 ecore_event_window_register(ee->prop.window, ee, ee->evas,
2165 (Ecore_Event_Mouse_Move_Cb)_ecore_evas_mouse_move_process,
2166 (Ecore_Event_Multi_Move_Cb)_ecore_evas_mouse_multi_move_process,
2167 (Ecore_Event_Multi_Down_Cb)_ecore_evas_mouse_multi_down_process,
2168 (Ecore_Event_Multi_Up_Cb)_ecore_evas_mouse_multi_up_process);
2169 if (ee->prop.borderless)
2170 ecore_x_mwm_borderless_set(ee->prop.window, ee->prop.borderless);
2171 if (ee->visible) ecore_x_window_show(ee->prop.window);
2172 if (ee->prop.focused) ecore_x_window_focus(ee->prop.window);
2175 ecore_x_icccm_title_set(ee->prop.window, ee->prop.title);
2176 ecore_x_netwm_name_set(ee->prop.window, ee->prop.title);
2178 ecore_x_icccm_hints_set(ee->prop.window,
2179 1 /* accepts_focus */,
2180 ECORE_X_WINDOW_STATE_HINT_NORMAL /* initial_state */,
2181 0 /* icon_pixmap */,
2183 0 /* icon_window */,
2184 0 /* window_group */,
2186 _ecore_evas_x_group_leader_update(ee);
2187 ecore_x_window_defaults_set(ee->prop.window);
2188 _ecore_evas_x_protocols_set(ee);
2189 _ecore_evas_x_sync_set(ee);
2191 if ((id = getenv("DESKTOP_STARTUP_ID")))
2193 ecore_x_netwm_startup_id_set(ee->prop.window, id);
2194 /* NB: on linux this may simply empty the env as opposed to completely
2195 * unset it to being empty - unsure as solartis libc crashes looking
2196 * for the '=' char */
2197 // putenv((char*)"DESKTOP_STARTUP_ID=");
2199 #endif /* BUILD_ECORE_EVAS_SOFTWARE_8_X11 */
2204 _ecore_evas_x_transparent_set(Ecore_Evas *ee, int transparent)
2206 if ((ee->transparent == transparent)) return;
2208 if (!strcmp(ee->driver, "software_x11"))
2210 #ifdef BUILD_ECORE_EVAS_SOFTWARE_X11
2211 Evas_Engine_Info_Software_X11 *einfo;
2213 einfo = (Evas_Engine_Info_Software_X11 *)evas_engine_info_get(ee->evas);
2216 ee->transparent = transparent;
2217 einfo->info.destination_alpha = transparent;
2218 if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo))
2220 ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver);
2222 evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h);
2226 #endif /* BUILD_ECORE_EVAS_X11 */
2228 #ifdef BUILD_ECORE_EVAS_X11
2230 _ecore_evas_x_show(Ecore_Evas *ee)
2232 ee->should_be_visible = 1;
2233 if (ee->prop.avoid_damage)
2234 _ecore_evas_x_render(ee);
2235 _ecore_evas_x_sync_set(ee);
2236 ecore_x_window_show(ee->prop.window);
2237 if (ee->prop.fullscreen)
2238 ecore_x_window_focus(ee->prop.window);
2242 _ecore_evas_x_hide(Ecore_Evas *ee)
2244 ecore_x_window_hide(ee->prop.window);
2245 ee->should_be_visible = 0;
2246 _ecore_evas_x_sync_set(ee);
2250 _ecore_evas_x_raise(Ecore_Evas *ee)
2252 ecore_x_window_raise(ee->prop.window);
2256 _ecore_evas_x_lower(Ecore_Evas *ee)
2258 ecore_x_window_lower(ee->prop.window);
2262 _ecore_evas_x_activate(Ecore_Evas *ee)
2264 ecore_x_netwm_client_active_request(ee->engine.x.win_root,
2265 ee->prop.window, 2, 0);
2269 _ecore_evas_x_title_set(Ecore_Evas *ee, const char *t)
2271 if (ee->prop.title) free(ee->prop.title);
2272 ee->prop.title = NULL;
2273 if (t) ee->prop.title = strdup(t);
2274 ecore_x_icccm_title_set(ee->prop.window, ee->prop.title);
2275 ecore_x_netwm_name_set(ee->prop.window, ee->prop.title);
2279 _ecore_evas_x_name_class_set(Ecore_Evas *ee, const char *n, const char *c)
2281 if (ee->prop.name) free(ee->prop.name);
2282 if (ee->prop.clas) free(ee->prop.clas);
2283 ee->prop.name = NULL;
2284 ee->prop.clas = NULL;
2285 if (n) ee->prop.name = strdup(n);
2286 if (c) ee->prop.clas = strdup(c);
2287 ecore_x_icccm_name_class_set(ee->prop.window, ee->prop.name, ee->prop.clas);
2291 _ecore_evas_x_size_min_set(Ecore_Evas *ee, int w, int h)
2295 if ((ee->prop.min.w == w) && (ee->prop.min.h == h)) return;
2298 _ecore_evas_x_size_pos_hints_update(ee);
2302 _ecore_evas_x_size_max_set(Ecore_Evas *ee, int w, int h)
2306 if ((ee->prop.max.w == w) && (ee->prop.max.h == h)) return;
2309 _ecore_evas_x_size_pos_hints_update(ee);
2313 _ecore_evas_x_size_base_set(Ecore_Evas *ee, int w, int h)
2317 if ((ee->prop.base.w == w) && (ee->prop.base.h == h)) return;
2318 ee->prop.base.w = w;
2319 ee->prop.base.h = h;
2320 _ecore_evas_x_size_pos_hints_update(ee);
2324 _ecore_evas_x_size_step_set(Ecore_Evas *ee, int w, int h)
2328 if ((ee->prop.step.w == w) && (ee->prop.step.h == h)) return;
2329 ee->prop.step.w = w;
2330 ee->prop.step.h = h;
2331 _ecore_evas_x_size_pos_hints_update(ee);
2335 _ecore_evas_object_cursor_del(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
2340 if (ee) ee->prop.cursor.object = NULL;
2344 _ecore_evas_x_object_cursor_set(Ecore_Evas *ee, Evas_Object *obj, int layer, int hot_x, int hot_y)
2348 if (ee->prop.cursor.object) evas_object_del(ee->prop.cursor.object);
2352 ee->prop.cursor.object = NULL;
2353 ee->prop.cursor.layer = 0;
2354 ee->prop.cursor.hot.x = 0;
2355 ee->prop.cursor.hot.y = 0;
2356 ecore_x_window_cursor_show(ee->prop.window, 1);
2360 ee->prop.cursor.object = obj;
2361 ee->prop.cursor.layer = layer;
2362 ee->prop.cursor.hot.x = hot_x;
2363 ee->prop.cursor.hot.y = hot_y;
2365 ecore_x_window_cursor_show(ee->prop.window, 0);
2367 evas_pointer_output_xy_get(ee->evas, &x, &y);
2368 evas_object_layer_set(ee->prop.cursor.object, ee->prop.cursor.layer);
2369 evas_object_move(ee->prop.cursor.object,
2370 x - ee->prop.cursor.hot.x,
2371 y - ee->prop.cursor.hot.y);
2372 evas_object_pass_events_set(ee->prop.cursor.object, 1);
2373 if (evas_pointer_inside_get(ee->evas))
2374 evas_object_show(ee->prop.cursor.object);
2376 evas_object_event_callback_add(obj, EVAS_CALLBACK_DEL, _ecore_evas_object_cursor_del, ee);
2381 * @param layer If < 3, @a ee will be put below all other windows.
2382 * If > 5, @a ee will be "always-on-top"
2383 * If = 4, @a ee will be put in the default layer.
2384 * Acceptable values range from 1 to 255 (0 reserved for
2388 _ecore_evas_x_layer_set(Ecore_Evas *ee, int layer)
2390 if (ee->prop.layer == layer) return;
2392 /* FIXME: Should this logic be here? */
2395 else if (layer > 255)
2398 ee->prop.layer = layer;
2399 _ecore_evas_x_layer_update(ee);
2403 _ecore_evas_x_focus_set(Ecore_Evas *ee, int on __UNUSED__)
2405 ecore_x_window_focus(ee->prop.window);
2409 _ecore_evas_x_iconified_set(Ecore_Evas *ee, int on)
2411 if (ee->prop.iconified == on) return;
2412 ee->prop.iconified = on;
2415 ecore_x_icccm_hints_set(ee->prop.window,
2416 1 /* accepts_focus */,
2417 ECORE_X_WINDOW_STATE_HINT_ICONIC /* initial_state */,
2418 0 /* icon_pixmap */,
2420 0 /* icon_window */,
2421 0 /* window_group */,
2423 ecore_x_icccm_iconic_request_send(ee->prop.window, ee->engine.x.win_root);
2427 ecore_x_icccm_hints_set(ee->prop.window,
2428 1 /* accepts_focus */,
2429 ECORE_X_WINDOW_STATE_HINT_NORMAL /* initial_state */,
2430 0 /* icon_pixmap */,
2432 0 /* icon_window */,
2433 0 /* window_group */,
2435 ecore_evas_show(ee);
2440 _ecore_evas_x_borderless_set(Ecore_Evas *ee, int on)
2442 if (ee->prop.borderless == on) return;
2443 ee->prop.borderless = on;
2444 ecore_x_mwm_borderless_set(ee->prop.window, ee->prop.borderless);
2447 /* FIXME: This function changes the initial state of the ee
2448 * whilest the iconic function changes the current state! */
2450 _ecore_evas_x_withdrawn_set(Ecore_Evas *ee, int withdrawn)
2452 Ecore_X_Window_State_Hint hint;
2454 if (ee->prop.withdrawn == withdrawn) return;
2456 ee->prop.withdrawn = withdrawn;
2458 hint = ECORE_X_WINDOW_STATE_HINT_WITHDRAWN;
2460 hint = ECORE_X_WINDOW_STATE_HINT_NORMAL;
2462 ecore_x_icccm_hints_set(ee->prop.window,
2463 1 /* accepts_focus */,
2464 hint /* initial_state */,
2465 0 /* icon_pixmap */,
2467 0 /* icon_window */,
2468 0 /* window_group */,
2473 _ecore_evas_x_sticky_set(Ecore_Evas *ee, int sticky)
2475 if (ee->prop.sticky == sticky) return;
2477 /* We dont want to set prop.sticky here as it will cause
2478 * the sticky callback not to get called. Its set on the
2479 * property change event.
2480 * ee->prop.sticky = sticky;
2482 ee->engine.x.state.sticky = sticky;
2483 if (ee->should_be_visible)
2484 ecore_x_netwm_state_request_send(ee->prop.window, ee->engine.x.win_root,
2485 ECORE_X_WINDOW_STATE_STICKY, -1, sticky);
2487 _ecore_evas_x_state_update(ee);
2491 _ecore_evas_x_ignore_events_set(Ecore_Evas *ee, int ignore)
2493 if (ee->ignore_events == ignore) return;
2495 ee->ignore_events = ignore;
2496 if (ee->prop.window)
2497 ecore_x_window_ignore_set(ee->prop.window, ignore);
2502 _ecore_evas_x_reinit_win(Ecore_Evas *ee)
2504 if (!strcmp(ee->driver, "software_x11"))
2506 #ifdef BUILD_ECORE_EVAS_X11
2507 Evas_Engine_Info_Software_X11 *einfo;
2509 einfo = (Evas_Engine_Info_Software_X11 *)evas_engine_info_get(ee->evas);
2512 einfo->info.drawable = ee->prop.window;
2513 evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo);
2517 else if (!strcmp(ee->driver, "opengl_x11"))
2519 #ifdef BUILD_ECORE_EVAS_OPENGL_X11
2520 Evas_Engine_Info_GL_X11 *einfo;
2522 einfo = (Evas_Engine_Info_GL_X11 *)evas_engine_info_get(ee->evas);
2525 einfo->info.drawable = ee->prop.window;
2526 evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo);
2534 _ecore_evas_x_override_set(Ecore_Evas *ee, int on)
2536 if (ee->prop.override == on) return;
2537 ecore_x_window_hide(ee->prop.window);
2538 ecore_x_window_override_set(ee->prop.window, on);
2539 if (ee->visible) ecore_x_window_show(ee->prop.window);
2540 if (ee->prop.focused) ecore_x_window_focus(ee->prop.window);
2541 ee->prop.override = on;
2545 _ecore_evas_x_fullscreen_set(Ecore_Evas *ee, int on)
2547 if (ee->prop.fullscreen == on) return;
2549 /* FIXME: Detect if WM is EWMH compliant and handle properly if not,
2550 * i.e. reposition, resize, and change borderless hint */
2551 ee->engine.x.state.fullscreen = on;
2552 if (ee->should_be_visible)
2553 ecore_x_netwm_state_request_send(ee->prop.window, ee->engine.x.win_root,
2554 ECORE_X_WINDOW_STATE_FULLSCREEN, -1, on);
2556 _ecore_evas_x_state_update(ee);
2560 _ecore_evas_x_avoid_damage_set(Ecore_Evas *ee, int on)
2562 if (ee->prop.avoid_damage == on) return;
2563 if (!strcmp(ee->driver, "opengl_x11")) return;
2565 if (!strcmp(ee->driver, "software_x11"))
2567 #ifdef BUILD_ECORE_EVAS_SOFTWARE_X11
2568 Evas_Engine_Info_Software_X11 *einfo;
2570 ee->prop.avoid_damage = on;
2571 einfo = (Evas_Engine_Info_Software_X11 *)evas_engine_info_get(ee->evas);
2574 if (ee->prop.avoid_damage)
2576 ee->engine.x.pmap = ecore_x_pixmap_new(ee->prop.window, ee->w, ee->h, einfo->info.depth);
2577 ee->engine.x.gc = ecore_x_gc_new(ee->engine.x.pmap, 0, NULL);
2578 einfo->info.drawable = ee->engine.x.pmap;
2579 if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo))
2581 ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver);
2583 if ((ee->rotation == 90) || (ee->rotation == 270))
2584 evas_damage_rectangle_add(ee->evas, 0, 0, ee->h, ee->w);
2586 evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h);
2587 if (ee->prop.avoid_damage == ECORE_EVAS_AVOID_DAMAGE_BUILT_IN)
2589 ee->engine.x.using_bg_pixmap = 1;
2590 ecore_x_window_pixmap_set(ee->prop.window, ee->engine.x.pmap);
2591 ecore_x_window_area_expose(ee->prop.window, 0, 0, ee->w, ee->h);
2593 if (ee->engine.x.direct_resize)
2595 /* Turn this off for now
2596 ee->engine.x.using_bg_pixmap = 1;
2597 ecore_x_window_pixmap_set(ee->prop.window, ee->engine.x.pmap);
2603 if (ee->engine.x.pmap) ecore_x_pixmap_free(ee->engine.x.pmap);
2604 if (ee->engine.x.gc) ecore_x_gc_free(ee->engine.x.gc);
2605 if (ee->engine.x.using_bg_pixmap)
2607 ecore_x_window_pixmap_set(ee->prop.window, 0);
2608 ee->engine.x.using_bg_pixmap = 0;
2609 ecore_x_window_area_expose(ee->prop.window, 0, 0, ee->w, ee->h);
2611 ee->engine.x.pmap = 0;
2612 ee->engine.x.gc = 0;
2613 einfo->info.drawable = ee->prop.window;
2614 if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo))
2616 ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver);
2620 #endif /* BUILD_ECORE_EVAS_SOFTWARE_X11 */
2622 else if (!strcmp(ee->driver, "software_16_x11"))
2624 #if BUILD_ECORE_EVAS_SOFTWARE_16_X11
2625 Evas_Engine_Info_Software_16_X11 *einfo;
2627 ee->prop.avoid_damage = on;
2628 einfo = (Evas_Engine_Info_Software_16_X11 *)evas_engine_info_get(ee->evas);
2631 if (ee->prop.avoid_damage)
2633 ee->engine.x.pmap = ecore_x_pixmap_new(ee->prop.window, ee->w, ee->h, 16);
2634 ee->engine.x.gc = ecore_x_gc_new(ee->engine.x.pmap, 0, NULL);
2635 einfo->info.drawable = ee->engine.x.pmap;
2636 if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo))
2638 ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver);
2640 if ((ee->rotation == 90) || (ee->rotation == 270))
2641 evas_damage_rectangle_add(ee->evas, 0, 0, ee->h, ee->w);
2643 evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h);
2644 if (ee->engine.x.direct_resize)
2646 /* Turn this off for now
2647 ee->engine.x.using_bg_pixmap = 1;
2648 ecore_x_window_pixmap_set(ee->prop.window, ee->engine.x.pmap);
2654 if (ee->engine.x.pmap) ecore_x_pixmap_free(ee->engine.x.pmap);
2655 if (ee->engine.x.gc) ecore_x_gc_free(ee->engine.x.gc);
2656 if (ee->engine.x.using_bg_pixmap)
2658 ecore_x_window_pixmap_set(ee->prop.window, 0);
2659 ee->engine.x.using_bg_pixmap = 0;
2661 ee->engine.x.pmap = 0;
2662 ee->engine.x.gc = 0;
2663 einfo->info.drawable = ee->prop.window;
2664 if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo))
2666 ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver);
2670 #endif /* BUILD_ECORE_EVAS_SOFTWARE_16_X11 */
2672 else if (!strcmp(ee->driver, "software_8_x11"))
2674 #if BUILD_ECORE_EVAS_SOFTWARE_8_X11
2675 Evas_Engine_Info_Software_8_X11 *einfo;
2677 ee->prop.avoid_damage = on;
2678 einfo = (Evas_Engine_Info_Software_8_X11 *)evas_engine_info_get(ee->evas);
2681 if (ee->prop.avoid_damage)
2683 ee->engine.x.pmap = ecore_x_pixmap_new(ee->prop.window, ee->w, ee->h, einfo->info.depth);
2684 ee->engine.x.gc = ecore_x_gc_new(ee->engine.x.pmap, 0, NULL);
2685 einfo->info.drawable = ee->engine.x.pmap;
2686 if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo))
2688 ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver);
2690 if ((ee->rotation == 90) || (ee->rotation == 270))
2691 evas_damage_rectangle_add(ee->evas, 0, 0, ee->h, ee->w);
2693 evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h);
2694 if (ee->prop.avoid_damage == ECORE_EVAS_AVOID_DAMAGE_BUILT_IN)
2696 ee->engine.x.using_bg_pixmap = 1;
2697 ecore_x_window_pixmap_set(ee->prop.window, ee->engine.x.pmap);
2698 ecore_x_window_area_expose(ee->prop.window, 0, 0, ee->w, ee->h);
2700 if (ee->engine.x.direct_resize)
2702 /* Turn this off for now
2703 ee->engine.x.using_bg_pixmap = 1;
2704 ecore_x_window_pixmap_set(ee->prop.window, ee->engine.x.pmap);
2710 if (ee->engine.x.pmap) ecore_x_pixmap_free(ee->engine.x.pmap);
2711 if (ee->engine.x.gc) ecore_x_gc_free(ee->engine.x.gc);
2712 if (ee->engine.x.using_bg_pixmap)
2714 ecore_x_window_pixmap_set(ee->prop.window, 0);
2715 ee->engine.x.using_bg_pixmap = 0;
2716 ecore_x_window_area_expose(ee->prop.window, 0, 0, ee->w, ee->h);
2718 ee->engine.x.pmap = 0;
2719 ee->engine.x.gc = 0;
2720 einfo->info.drawable = ee->prop.window;
2721 if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo))
2723 ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver);
2727 #endif /* BUILD_ECORE_EVAS_SOFTWARE_8_X11 */
2732 _ecore_evas_x_screen_geometry_get(const Ecore_Evas *ee __UNUSED__, int *x, int *y, int *w, int *h)
2736 ecore_x_screen_size_get(ecore_x_default_screen_get(), w, h);
2740 _ecore_evas_x_shutdown(void)
2742 _ecore_evas_init_count--;
2743 if (_ecore_evas_init_count == 0)
2747 for (i = 0; i < sizeof(ecore_evas_event_handlers) / sizeof(Ecore_Event_Handler*); i++)
2749 if (ecore_evas_event_handlers[i])
2750 ecore_event_handler_del(ecore_evas_event_handlers[i]);
2752 ecore_event_evas_shutdown();
2754 if (_ecore_evas_init_count < 0) _ecore_evas_init_count = 0;
2755 return _ecore_evas_init_count;
2758 static Ecore_Evas_Engine_Func _ecore_x_engine_func =
2765 _ecore_evas_x_callback_delete_request_set,
2776 _ecore_evas_x_managed_move,
2777 _ecore_evas_x_resize,
2778 _ecore_evas_x_move_resize,
2779 _ecore_evas_x_rotation_set,
2780 _ecore_evas_x_shaped_set,
2783 _ecore_evas_x_raise,
2784 _ecore_evas_x_lower,
2785 _ecore_evas_x_activate,
2786 _ecore_evas_x_title_set,
2787 _ecore_evas_x_name_class_set,
2788 _ecore_evas_x_size_min_set,
2789 _ecore_evas_x_size_max_set,
2790 _ecore_evas_x_size_base_set,
2791 _ecore_evas_x_size_step_set,
2792 _ecore_evas_x_object_cursor_set,
2793 _ecore_evas_x_layer_set,
2794 _ecore_evas_x_focus_set,
2795 _ecore_evas_x_iconified_set,
2796 _ecore_evas_x_borderless_set,
2797 _ecore_evas_x_override_set,
2799 _ecore_evas_x_fullscreen_set,
2800 _ecore_evas_x_avoid_damage_set,
2801 _ecore_evas_x_withdrawn_set,
2802 _ecore_evas_x_sticky_set,
2803 _ecore_evas_x_ignore_events_set,
2804 _ecore_evas_x_alpha_set,
2805 _ecore_evas_x_transparent_set,
2808 _ecore_evas_x_screen_geometry_get
2810 #endif /* BUILD_ECORE_EVAS_X11 */
2813 * FIXME: there are some round trips. Especially, we can split
2814 * ecore_x_init in 2 functions and suppress some round trips.
2817 #if defined (BUILD_ECORE_EVAS_SOFTWARE_X11) || defined (BUILD_ECORE_EVAS_OPENGL_X11) || defined (BUILD_ECORE_EVAS_SOFTWARE_16_X11) || defined (BUILD_ECORE_EVAS_SOFTWARE_8_X11)
2819 _ecore_evas_x_flush_pre(void *data, Evas *e __UNUSED__, void *event_info __UNUSED__)
2821 Ecore_Evas *ee = data;
2823 if (ee->no_comp_sync) return;
2824 if (!_ecore_evas_app_comp_sync) return;
2825 if (ee->engine.x.sync_counter)
2827 if (ee->engine.x.sync_began)
2829 ee->engine.x.sync_val++;
2830 if (!ee->engine.x.sync_cancel)
2833 ecore_x_sync_counter_val_wait(ee->engine.x.sync_counter,
2834 ee->engine.x.sync_val);
2841 _ecore_evas_x_flush_post(void *data, Evas *e __UNUSED__, void *event_info __UNUSED__)
2843 Ecore_Evas *ee = data;
2845 if ((!ee->no_comp_sync) && (_ecore_evas_app_comp_sync) &&
2846 (!ee->gl_sync_draw_done)) // added by gl77.lee
2848 if (ee->engine.x.sync_counter)
2850 if (ee->engine.x.sync_began)
2852 if (!ee->engine.x.sync_cancel)
2854 ecore_x_e_comp_sync_draw_size_done_send
2855 (ee->engine.x.win_root, ee->prop.window, ee->w, ee->h);
2860 if (ee->engine.x.netwm_sync_set)
2862 ecore_x_sync_counter_2_set(ee->engine.x.netwm_sync_counter,
2863 ee->engine.x.netwm_sync_val_hi,
2864 ee->engine.x.netwm_sync_val_lo);
2865 ee->engine.x.netwm_sync_set = 0;
2873 * FIXME: To be fixed.
2875 #ifdef BUILD_ECORE_EVAS_SOFTWARE_X11
2877 ecore_evas_software_x11_new(const char *disp_name, Ecore_X_Window parent,
2878 int x, int y, int w, int h)
2880 Evas_Engine_Info_Software_X11 *einfo;
2882 int argb = 0, rmethod;
2883 static int redraw_debug = -1;
2886 rmethod = evas_render_method_lookup("software_x11");
2887 if (!rmethod) return NULL;
2888 if (!ecore_x_init(disp_name)) return NULL;
2889 ee = calloc(1, sizeof(Ecore_Evas));
2890 if (!ee) return NULL;
2892 ECORE_MAGIC_SET(ee, ECORE_MAGIC_EVAS);
2894 _ecore_evas_x_init();
2896 ee->engine.func = (Ecore_Evas_Engine_Func *)&_ecore_x_engine_func;
2898 ee->driver = "software_x11";
2899 if (disp_name) ee->name = strdup(disp_name);
2912 ee->prop.max.w = 32767;
2913 ee->prop.max.h = 32767;
2915 ee->prop.request_pos = 0;
2916 ee->prop.sticky = 0;
2917 ee->engine.x.state.sticky = 0;
2919 /* init evas here */
2920 ee->evas = evas_new();
2921 evas_event_callback_add(ee->evas, EVAS_CALLBACK_RENDER_FLUSH_PRE,
2922 _ecore_evas_x_flush_pre, ee);
2923 evas_event_callback_add(ee->evas, EVAS_CALLBACK_RENDER_FLUSH_POST,
2924 _ecore_evas_x_flush_post, ee);
2925 evas_data_attach_set(ee->evas, ee);
2926 evas_output_method_set(ee->evas, rmethod);
2927 evas_output_size_set(ee->evas, w, h);
2928 evas_output_viewport_set(ee->evas, 0, 0, w, h);
2930 ee->engine.x.win_root = parent;
2931 ee->engine.x.screen_num = 0;
2935 ee->engine.x.screen_num = 1; /* FIXME: get real scren # */
2936 /* FIXME: round trip in ecore_x_window_argb_get */
2937 if (ecore_x_window_argb_get(parent))
2939 ee->prop.window = ecore_x_window_argb_new(parent, x, y, w, h);
2943 ee->prop.window = ecore_x_window_new(parent, x, y, w, h);
2946 ee->prop.window = ecore_x_window_new(parent, x, y, w, h);
2947 if ((id = getenv("DESKTOP_STARTUP_ID")))
2949 ecore_x_netwm_startup_id_set(ee->prop.window, id);
2950 /* NB: on linux this may simply empty the env as opposed to completely
2951 * unset it to being empty - unsure as solartis libc crashes looking
2952 * for the '=' char */
2953 // putenv((char*)"DESKTOP_STARTUP_ID=");
2955 einfo = (Evas_Engine_Info_Software_X11 *)evas_engine_info_get(ee->evas);
2958 Ecore_X_Screen *screen;
2959 Ecore_X_Window_Attributes at;
2961 /* FIXME: this is inefficient as its 1 or more round trips */
2962 screen = ecore_x_default_screen_get();
2963 if (ecore_x_screen_count_get() > 1)
2965 Ecore_X_Window *roots;
2969 roots = ecore_x_window_root_list(&num);
2972 Ecore_X_Window root;
2974 root = ecore_x_window_root_get(parent);
2975 for (i = 0; i < num; i++)
2977 if (root == roots[i])
2979 screen = ecore_x_screen_get(i);
2987 einfo->info.destination_alpha = argb;
2989 if (redraw_debug < 0)
2991 if (getenv("REDRAW_DEBUG"))
2992 redraw_debug = atoi(getenv("REDRAW_DEBUG"));
2997 # ifdef BUILD_ECORE_EVAS_SOFTWARE_XCB
2998 einfo->info.backend = EVAS_ENGINE_INFO_SOFTWARE_X11_BACKEND_XCB;
2999 einfo->info.connection = ecore_x_connection_get();
3000 einfo->info.screen = screen;
3002 einfo->info.backend = EVAS_ENGINE_INFO_SOFTWARE_X11_BACKEND_XLIB;
3003 einfo->info.connection = ecore_x_display_get();
3004 einfo->info.screen = NULL;
3006 einfo->info.drawable = ee->prop.window;
3008 # ifdef EVAS_FRAME_QUEUING
3012 render_mode = getenv("EVAS_RENDER_MODE");
3013 if ((render_mode) && (!strcmp(render_mode, "non-blocking")))
3014 einfo->render_mode = EVAS_RENDER_MODE_NONBLOCKING;
3020 ecore_x_window_attributes_get(ee->prop.window, &at);
3021 einfo->info.visual = at.visual;
3022 einfo->info.colormap = at.colormap;
3023 einfo->info.depth = at.depth;
3024 einfo->info.destination_alpha = 1;
3028 einfo->info.visual =
3029 ecore_x_default_visual_get(einfo->info.connection, screen);
3030 einfo->info.colormap =
3031 ecore_x_default_colormap_get(einfo->info.connection, screen);
3033 ecore_x_default_depth_get(einfo->info.connection, screen);
3034 einfo->info.destination_alpha = 0;
3037 einfo->info.rotation = 0;
3038 einfo->info.debug = redraw_debug;
3039 if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo))
3041 ERR("evas_engine_info_set() init engine '%s' failed.", ee->driver);
3042 ecore_evas_free(ee);
3047 ecore_x_icccm_hints_set(ee->prop.window,
3048 1 /* accepts_focus */,
3049 ECORE_X_WINDOW_STATE_HINT_NORMAL /* initial_state */,
3050 0 /* icon_pixmap */,
3052 0 /* icon_window */,
3053 0 /* window_group */,
3055 _ecore_evas_x_group_leader_set(ee);
3056 ecore_x_window_defaults_set(ee->prop.window);
3057 _ecore_evas_x_protocols_set(ee);
3058 _ecore_evas_x_sync_set(ee);
3060 ee->engine.func->fn_render = _ecore_evas_x_render;
3061 _ecore_evas_register(ee);
3062 ecore_x_input_multi_select(ee->prop.window);
3063 ecore_event_window_register(ee->prop.window, ee, ee->evas,
3064 (Ecore_Event_Mouse_Move_Cb)_ecore_evas_mouse_move_process,
3065 (Ecore_Event_Multi_Move_Cb)_ecore_evas_mouse_multi_move_process,
3066 (Ecore_Event_Multi_Down_Cb)_ecore_evas_mouse_multi_down_process,
3067 (Ecore_Event_Multi_Up_Cb)_ecore_evas_mouse_multi_up_process);
3072 ecore_evas_software_x11_new(const char *disp_name __UNUSED__, Ecore_X_Window parent __UNUSED__,
3073 int x __UNUSED__, int y __UNUSED__, int w __UNUSED__, int h __UNUSED__)
3082 * FIXME: To be fixed.
3084 #ifdef BUILD_ECORE_EVAS_SOFTWARE_X11
3086 ecore_evas_software_x11_window_get(const Ecore_Evas *ee)
3088 return (Ecore_X_Window) ecore_evas_window_get(ee);
3092 ecore_evas_software_x11_window_get(const Ecore_Evas *ee __UNUSED__)
3101 * FIXME: To be fixed.
3103 #ifdef BUILD_ECORE_EVAS_SOFTWARE_X11
3105 ecore_evas_software_x11_direct_resize_set(Ecore_Evas *ee, Eina_Bool on)
3107 ee->engine.x.direct_resize = on;
3108 if (ee->prop.avoid_damage)
3110 if (ee->engine.x.direct_resize)
3112 /* turn this off for now
3113 ee->engine.x.using_bg_pixmap = 1;
3114 ecore_x_window_pixmap_set(ee->prop.window, ee->engine.x.pmap);
3119 /* turn this off too- bg pixmap is controlled by avoid damage directly
3120 ee->engine.x.using_bg_pixmap = 0;
3121 ecore_x_window_pixmap_set(ee->prop.window, 0);
3122 ecore_x_window_area_expose(ee->prop.window, 0, 0, ee->w, ee->h);
3129 ecore_evas_software_x11_direct_resize_set(Ecore_Evas *ee __UNUSED__, Eina_Bool on __UNUSED__)
3137 * FIXME: To be fixed.
3139 #ifdef BUILD_ECORE_EVAS_SOFTWARE_X11
3141 ecore_evas_software_x11_direct_resize_get(const Ecore_Evas *ee)
3143 return ee->engine.x.direct_resize;
3147 ecore_evas_software_x11_direct_resize_get(const Ecore_Evas *ee __UNUSED__)
3156 * FIXME: To be fixed.
3158 #ifdef BUILD_ECORE_EVAS_SOFTWARE_X11
3160 ecore_evas_software_x11_extra_event_window_add(Ecore_Evas *ee, Ecore_X_Window win)
3162 Ecore_X_Window *winp;
3164 winp = malloc(sizeof(Ecore_X_Window));
3168 ee->engine.x.win_extra = eina_list_append(ee->engine.x.win_extra, winp);
3169 ecore_x_input_multi_select(win);
3170 ecore_event_window_register(win, ee, ee->evas,
3171 (Ecore_Event_Mouse_Move_Cb)_ecore_evas_mouse_move_process,
3172 (Ecore_Event_Multi_Move_Cb)_ecore_evas_mouse_multi_move_process,
3173 (Ecore_Event_Multi_Down_Cb)_ecore_evas_mouse_multi_down_process,
3174 (Ecore_Event_Multi_Up_Cb)_ecore_evas_mouse_multi_up_process);
3179 ecore_evas_software_x11_extra_event_window_add(Ecore_Evas *ee __UNUSED__, Ecore_X_Window win __UNUSED__)
3187 * FIXME: To be fixed.
3189 #ifdef BUILD_ECORE_EVAS_OPENGL_X11
3191 ecore_evas_gl_x11_new(const char *disp_name, Ecore_X_Window parent,
3192 int x, int y, int w, int h)
3194 return ecore_evas_gl_x11_options_new(disp_name, parent, x, y, w, h, NULL);
3198 ecore_evas_gl_x11_options_new(const char *disp_name, Ecore_X_Window parent,
3199 int x, int y, int w, int h, const int *opt)
3205 rmethod = evas_render_method_lookup("gl_x11");
3206 if (!rmethod) return NULL;
3207 if (!ecore_x_init(disp_name)) return NULL;
3208 ee = calloc(1, sizeof(Ecore_Evas));
3209 if (!ee) return NULL;
3211 ECORE_MAGIC_SET(ee, ECORE_MAGIC_EVAS);
3213 ee->gl_sync_draw_done = -1; // added by gl77.lee
3215 _ecore_evas_x_init();
3217 ee->engine.func = (Ecore_Evas_Engine_Func *)&_ecore_x_engine_func;
3219 ee->driver = "opengl_x11";
3220 ee->semi_sync = 0; // gl engine doesn't need to sync - its whole swaps
3221 // ee->no_comp_sync = 1; // gl engine doesn't need to sync - its whole swaps
3222 if (disp_name) ee->name = strdup(disp_name);
3235 ee->prop.max.w = 32767;
3236 ee->prop.max.h = 32767;
3238 ee->prop.request_pos = 0;
3239 ee->prop.sticky = 0;
3240 ee->engine.x.state.sticky = 0;
3242 /* init evas here */
3243 ee->evas = evas_new();
3244 evas_event_callback_add(ee->evas, EVAS_CALLBACK_RENDER_FLUSH_PRE, _ecore_evas_x_flush_pre, ee);
3245 evas_event_callback_add(ee->evas, EVAS_CALLBACK_RENDER_FLUSH_POST, _ecore_evas_x_flush_post, ee);
3246 evas_data_attach_set(ee->evas, ee);
3247 evas_output_method_set(ee->evas, rmethod);
3248 evas_output_size_set(ee->evas, w, h);
3249 evas_output_viewport_set(ee->evas, 0, 0, w, h);
3251 if (parent == 0) parent = DefaultRootWindow(ecore_x_display_get());
3252 ee->engine.x.win_root = parent;
3254 if (ee->engine.x.win_root != 0)
3256 ee->engine.x.screen_num = 1; /* FIXME: get real scren # */
3257 /* FIXME: round trip in ecore_x_window_argb_get */
3258 if (ecore_x_window_argb_get(ee->engine.x.win_root))
3260 ee->prop.window = _ecore_evas_x_gl_window_new
3261 (ee, ee->engine.x.win_root, x, y, w, h, 0, 1, opt);
3264 ee->prop.window = _ecore_evas_x_gl_window_new
3265 (ee, ee->engine.x.win_root, x, y, w, h, 0, 0, opt);
3268 ee->prop.window = _ecore_evas_x_gl_window_new
3269 (ee, ee->engine.x.win_root, x, y, w, h, 0, 0, opt);
3270 if (!ee->prop.window)
3272 ERR("evas_engine_info_set() init engine '%s' failed.", ee->driver);
3273 ecore_evas_free(ee);
3276 if ((id = getenv("DESKTOP_STARTUP_ID")))
3278 ecore_x_netwm_startup_id_set(ee->prop.window, id);
3279 /* NB: on linux this may simply empty the env as opposed to completely
3280 * unset it to being empty - unsure as solartis libc crashes looking
3281 * for the '=' char */
3282 // putenv((char*)"DESKTOP_STARTUP_ID=");
3285 ecore_x_icccm_hints_set(ee->prop.window,
3286 1 /* accepts_focus */,
3287 ECORE_X_WINDOW_STATE_HINT_NORMAL /* initial_state */,
3288 0 /* icon_pixmap */,
3290 0 /* icon_window */,
3291 0 /* window_group */,
3293 _ecore_evas_x_group_leader_set(ee);
3294 ecore_x_window_defaults_set(ee->prop.window);
3295 _ecore_evas_x_protocols_set(ee);
3296 _ecore_evas_x_sync_set(ee);
3298 ee->engine.func->fn_render = _ecore_evas_x_render;
3299 _ecore_evas_register(ee);
3300 ecore_x_input_multi_select(ee->prop.window);
3301 ecore_event_window_register(ee->prop.window, ee, ee->evas,
3302 (Ecore_Event_Mouse_Move_Cb)_ecore_evas_mouse_move_process,
3303 (Ecore_Event_Multi_Move_Cb)_ecore_evas_mouse_multi_move_process,
3304 (Ecore_Event_Multi_Down_Cb)_ecore_evas_mouse_multi_down_process,
3305 (Ecore_Event_Multi_Up_Cb)_ecore_evas_mouse_multi_up_process);
3311 ecore_evas_gl_x11_new(const char *disp_name __UNUSED__, Ecore_X_Window parent __UNUSED__,
3312 int x __UNUSED__, int y __UNUSED__, int w __UNUSED__, int h __UNUSED__)
3317 ecore_evas_gl_x11_options_new(const char *disp_name __UNUSED__, Ecore_X_Window parent __UNUSED__,
3318 int x __UNUSED__, int y __UNUSED__, int w __UNUSED__, int h __UNUSED__, const int *opt __UNUSED__)
3322 #endif /* ! BUILD_ECORE_EVAS_OPENGL_X11 */
3327 * FIXME: To be fixed.
3329 #ifdef BUILD_ECORE_EVAS_OPENGL_X11
3331 ecore_evas_gl_x11_window_get(const Ecore_Evas *ee)
3333 return (Ecore_X_Window) ecore_evas_window_get(ee);
3337 ecore_evas_gl_x11_window_get(const Ecore_Evas *ee __UNUSED__)
3341 #endif /* ! BUILD_ECORE_EVAS_OPENGL_X11 */
3346 * FIXME: To be fixed.
3348 #ifdef BUILD_ECORE_EVAS_OPENGL_X11
3350 ecore_evas_gl_x11_direct_resize_set(Ecore_Evas *ee, Eina_Bool on)
3352 ee->engine.x.direct_resize = on;
3356 ecore_evas_gl_x11_direct_resize_set(Ecore_Evas *ee __UNUSED__, Eina_Bool on __UNUSED__)
3359 #endif /* ! BUILD_ECORE_EVAS_OPENGL_X11 */
3364 * FIXME: To be fixed.
3366 #ifdef BUILD_ECORE_EVAS_OPENGL_X11
3368 ecore_evas_gl_x11_direct_resize_get(const Ecore_Evas *ee)
3370 return ee->engine.x.direct_resize;
3374 ecore_evas_gl_x11_direct_resize_get(const Ecore_Evas *ee __UNUSED__)
3378 #endif /* ! BUILD_ECORE_EVAS_OPENGL_X11 */
3383 * FIXME: To be fixed.
3385 #ifdef BUILD_ECORE_EVAS_OPENGL_X11
3387 ecore_evas_gl_x11_extra_event_window_add(Ecore_Evas *ee, Ecore_X_Window win)
3389 ecore_evas_software_x11_extra_event_window_add(ee, win);
3393 ecore_evas_gl_x11_extra_event_window_add(Ecore_Evas *ee __UNUSED__, Ecore_X_Window win __UNUSED__)
3396 #endif /* ! BUILD_ECORE_EVAS_OPENGL_X11 */
3401 * FIXME: To be fixed.
3403 #ifdef BUILD_ECORE_EVAS_OPENGL_X11
3405 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))
3407 Evas_Engine_Info_GL_X11 *einfo;
3409 if (!(!strcmp(ee->driver, "opengl_x11"))) return;
3411 einfo = (Evas_Engine_Info_GL_X11 *)evas_engine_info_get(ee->evas);
3414 einfo->callback.pre_swap = pre_cb;
3415 einfo->callback.pre_swap = post_cb;
3416 einfo->callback.data = data;
3417 if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo))
3419 ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver);
3425 ecore_evas_gl_x11_pre_post_swap_callback_set(const Ecore_Evas *ee __UNUSED__, void *data __UNUSED__, void (*pre_cb) (void *data, Evas *e) __UNUSED__, void (*post_cb) (void *data, Evas *e) __UNUSED__)
3429 #endif /* ! BUILD_ECORE_EVAS_OPENGL_X11 */
3434 * FIXME: To be fixed or maybe removed rather?
3437 ecore_evas_xrender_x11_new(const char *disp_name __UNUSED__, Ecore_X_Window parent __UNUSED__,
3438 int x __UNUSED__, int y __UNUSED__, int w __UNUSED__, int h __UNUSED__)
3446 * FIXME: To be fixed or maybe removed rather?
3449 ecore_evas_xrender_x11_window_get(const Ecore_Evas *ee __UNUSED__)
3457 * FIXME: To be fixed.
3460 ecore_evas_xrender_x11_direct_resize_set(Ecore_Evas *ee __UNUSED__, Eina_Bool on __UNUSED__)
3467 * FIXME: To be fixed.
3470 ecore_evas_xrender_x11_direct_resize_get(const Ecore_Evas *ee __UNUSED__)
3478 * FIXME: To be fixed.
3481 ecore_evas_xrender_x11_extra_event_window_add(Ecore_Evas *ee __UNUSED__, Ecore_X_Window win __UNUSED__)
3488 * FIXME: To be fixed.
3490 #if BUILD_ECORE_EVAS_SOFTWARE_16_X11
3492 ecore_evas_software_x11_16_new(const char *disp_name, Ecore_X_Window parent,
3493 int x, int y, int w, int h)
3495 Evas_Engine_Info_Software_16_X11 *einfo;
3498 static int redraw_debug = -1;
3500 rmethod = evas_render_method_lookup("software_16_x11");
3501 if (!rmethod) return NULL;
3502 if (!ecore_x_init(disp_name)) return NULL;
3503 ee = calloc(1, sizeof(Ecore_Evas));
3504 if (!ee) return NULL;
3506 ECORE_MAGIC_SET(ee, ECORE_MAGIC_EVAS);
3508 _ecore_evas_x_init();
3510 ee->engine.func = (Ecore_Evas_Engine_Func *)&_ecore_x_engine_func;
3512 ee->driver = "software_16_x11";
3513 if (disp_name) ee->name = strdup(disp_name);
3526 ee->prop.max.w = 32767;
3527 ee->prop.max.h = 32767;
3529 ee->prop.request_pos = 0;
3530 ee->prop.sticky = 0;
3531 ee->engine.x.state.sticky = 0;
3533 /* init evas here */
3534 ee->evas = evas_new();
3535 evas_event_callback_add(ee->evas, EVAS_CALLBACK_RENDER_FLUSH_PRE, _ecore_evas_x_flush_pre, ee);
3536 evas_event_callback_add(ee->evas, EVAS_CALLBACK_RENDER_FLUSH_POST, _ecore_evas_x_flush_post, ee);
3537 evas_data_attach_set(ee->evas, ee);
3538 evas_output_method_set(ee->evas, rmethod);
3539 evas_output_size_set(ee->evas, w, h);
3540 evas_output_viewport_set(ee->evas, 0, 0, w, h);
3542 ee->engine.x.win_root = parent;
3545 /* FIXME: round trip in ecore_x_window_argb_get */
3546 if (ecore_x_window_argb_get(parent))
3548 ee->prop.window = ecore_x_window_argb_new(parent, x, y, w, h);
3551 ee->prop.window = ecore_x_window_new(parent, x, y, w, h);
3554 ee->prop.window = ecore_x_window_new(parent, x, y, w, h);
3555 if (getenv("DESKTOP_STARTUP_ID"))
3557 ecore_x_netwm_startup_id_set(ee->prop.window,
3558 getenv("DESKTOP_STARTUP_ID"));
3559 /* NB: on linux this may simply empty the env as opposed to completely
3560 * unset it to being empty - unsure as solartis libc crashes looking
3561 * for the '=' char */
3562 // putenv((char*)"DESKTOP_STARTUP_ID=");
3564 einfo = (Evas_Engine_Info_Software_16_X11 *)evas_engine_info_get(ee->evas);
3568 if (ScreenCount(ecore_x_display_get()) > 1)
3570 Ecore_X_Window *roots;
3574 roots = ecore_x_window_root_list(&num);
3577 XWindowAttributes at;
3579 if (XGetWindowAttributes(ecore_x_display_get(),
3582 for (i = 0; i < num; i++)
3584 if (at.root == roots[i])
3592 if (redraw_debug < 0)
3594 if (getenv("REDRAW_DEBUG"))
3595 redraw_debug = atoi(getenv("REDRAW_DEBUG"));
3599 einfo->info.display = ecore_x_display_get();
3600 einfo->info.drawable = ee->prop.window;
3602 if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo))
3604 ERR("evas_engine_info_set() init engine '%s' failed.", ee->driver);
3605 ecore_evas_free(ee);
3611 ERR("evas_engine_info_set() init engine '%s' failed.", ee->driver);
3612 ecore_evas_free(ee);
3616 ecore_x_icccm_hints_set(ee->prop.window,
3617 1 /* accepts_focus */,
3618 ECORE_X_WINDOW_STATE_HINT_NORMAL /* initial_state */,
3619 0 /* icon_pixmap */,
3621 0 /* icon_window */,
3622 0 /* window_group */,
3624 _ecore_evas_x_group_leader_set(ee);
3625 ecore_x_window_defaults_set(ee->prop.window);
3626 _ecore_evas_x_protocols_set(ee);
3627 _ecore_evas_x_sync_set(ee);
3629 ee->engine.func->fn_render = _ecore_evas_x_render;
3630 _ecore_evas_register(ee);
3631 ecore_x_input_multi_select(ee->prop.window);
3632 ecore_event_window_register(ee->prop.window, ee, ee->evas,
3633 (Ecore_Event_Mouse_Move_Cb)_ecore_evas_mouse_move_process,
3634 (Ecore_Event_Multi_Move_Cb)_ecore_evas_mouse_multi_move_process,
3635 (Ecore_Event_Multi_Down_Cb)_ecore_evas_mouse_multi_down_process,
3636 (Ecore_Event_Multi_Up_Cb)_ecore_evas_mouse_multi_up_process);
3641 ecore_evas_software_x11_16_new(const char *disp_name __UNUSED__, Ecore_X_Window parent __UNUSED__,
3642 int x __UNUSED__, int y __UNUSED__, int w __UNUSED__, int h __UNUSED__)
3646 #endif /* ! BUILD_ECORE_EVAS_SOFTWARE_16_X11 */
3651 * FIXME: To be fixed.
3653 #if BUILD_ECORE_EVAS_SOFTWARE_16_X11
3655 ecore_evas_software_x11_16_window_get(const Ecore_Evas *ee)
3657 return (Ecore_X_Window) ecore_evas_window_get(ee);
3661 ecore_evas_software_x11_16_window_get(const Ecore_Evas *ee __UNUSED__)
3665 #endif /* ! BUILD_ECORE_EVAS_SOFTWARE_16_X11 */
3670 * FIXME: To be fixed.
3672 #if BUILD_ECORE_EVAS_SOFTWARE_16_X11
3674 ecore_evas_software_x11_16_direct_resize_set(Ecore_Evas *ee, Eina_Bool on)
3676 ee->engine.x.direct_resize = on;
3677 if (ee->prop.avoid_damage)
3679 if (ee->engine.x.direct_resize)
3681 /* turn this off for now
3682 ee->engine.x.using_bg_pixmap = 1;
3683 ecore_x_window_pixmap_set(ee->prop.window, ee->engine.x.pmap);
3688 /* turn this off too- bg pixmap is controlled by avoid damage directly
3689 ee->engine.x.using_bg_pixmap = 0;
3690 ecore_x_window_pixmap_set(ee->prop.window, 0);
3691 ecore_x_window_area_expose(ee->prop.window, 0, 0, ee->w, ee->h);
3698 ecore_evas_software_x11_16_direct_resize_set(Ecore_Evas *ee __UNUSED__, Eina_Bool on __UNUSED__)
3701 #endif /* ! BUILD_ECORE_EVAS_SOFTWARE_16_X11 */
3706 * FIXME: To be fixed.
3708 #if BUILD_ECORE_EVAS_SOFTWARE_16_X11
3710 ecore_evas_software_x11_16_direct_resize_get(const Ecore_Evas *ee)
3712 return ee->engine.x.direct_resize;
3716 ecore_evas_software_x11_16_direct_resize_get(const Ecore_Evas *ee __UNUSED__)
3720 #endif /* ! BUILD_ECORE_EVAS_SOFTWARE_16_X11 */
3725 * FIXME: To be fixed.
3727 #if BUILD_ECORE_EVAS_SOFTWARE_16_X11
3729 ecore_evas_software_x11_16_extra_event_window_add(Ecore_Evas *ee, Ecore_X_Window win)
3731 Ecore_X_Window *winp;
3733 winp = malloc(sizeof(Ecore_X_Window));
3737 ee->engine.x.win_extra = eina_list_append(ee->engine.x.win_extra, winp);
3738 ecore_x_input_multi_select(win);
3739 ecore_event_window_register(win, ee, ee->evas,
3740 (Ecore_Event_Mouse_Move_Cb)_ecore_evas_mouse_move_process,
3741 (Ecore_Event_Multi_Move_Cb)_ecore_evas_mouse_multi_move_process,
3742 (Ecore_Event_Multi_Down_Cb)_ecore_evas_mouse_multi_down_process,
3743 (Ecore_Event_Multi_Up_Cb)_ecore_evas_mouse_multi_up_process);
3748 ecore_evas_software_x11_16_extra_event_window_add(Ecore_Evas *ee __UNUSED__, Ecore_X_Window win __UNUSED__)
3751 #endif /* ! BUILD_ECORE_EVAS_SOFTWARE_16_X11 */
3757 * FIXME: To be fixed.
3760 ecore_evas_software_x11_8_new(const char *disp_name, Ecore_X_Window parent,
3761 int x, int y, int w, int h)
3763 #if defined (BUILD_ECORE_EVAS_SOFTWARE_8_X11)
3764 Evas_Engine_Info_Software_8_X11 *einfo;
3768 static int redraw_debug = -1;
3770 rmethod = evas_render_method_lookup("software_8_x11");
3771 if (!rmethod) return NULL;
3772 if (!ecore_x_init(disp_name)) return NULL;
3773 ee = calloc(1, sizeof(Ecore_Evas));
3774 if (!ee) return NULL;
3776 ECORE_MAGIC_SET(ee, ECORE_MAGIC_EVAS);
3778 _ecore_evas_x_init();
3780 ee->engine.func = (Ecore_Evas_Engine_Func *)&_ecore_x_engine_func;
3782 ee->driver = "software_8_x11";
3783 if (disp_name) ee->name = strdup(disp_name);
3796 ee->prop.max.w = 32767;
3797 ee->prop.max.h = 32767;
3799 ee->prop.request_pos = 0;
3800 ee->prop.sticky = 0;
3801 ee->engine.x.state.sticky = 0;
3803 /* init evas here */
3804 ee->evas = evas_new();
3805 evas_event_callback_add(ee->evas, EVAS_CALLBACK_RENDER_FLUSH_PRE, _ecore_evas_x_flush_pre, ee);
3806 evas_event_callback_add(ee->evas, EVAS_CALLBACK_RENDER_FLUSH_POST, _ecore_evas_x_flush_post, ee);
3807 evas_data_attach_set(ee->evas, ee);
3808 evas_output_method_set(ee->evas, rmethod);
3809 evas_output_size_set(ee->evas, w, h);
3810 evas_output_viewport_set(ee->evas, 0, 0, w, h);
3812 ee->engine.x.win_root = parent;
3815 // /* FIXME: round trip in ecore_x_window_argb_get */
3816 // if (ecore_x_window_argb_get(parent))
3818 // ee->engine.x.win = ecore_x_window_argb_new(parent, x, y, w, h);
3822 // ee->engine.x.win = ecore_x_window_new(parent, x, y, w, h);
3825 ee->prop.window = ecore_x_window_new(parent, x, y, w, h);
3826 if (getenv("DESKTOP_STARTUP_ID"))
3828 ecore_x_netwm_startup_id_set(ee->prop.window,
3829 getenv("DESKTOP_STARTUP_ID"));
3830 /* NB: on linux this may simply empty the env as opposed to completely
3831 * unset it to being empty - unsure as solartis libc crashes looking
3832 * for the '=' char */
3833 // putenv((char*)"DESKTOP_STARTUP_ID=");
3835 einfo = (Evas_Engine_Info_Software_8_X11 *)evas_engine_info_get(ee->evas);
3838 xcb_screen_iterator_t iter;
3839 xcb_screen_t *screen;
3841 /* FIXME: this is inefficient as its a round trip */
3842 //einfo->info.backend = 1;
3843 screen = ecore_x_default_screen_get();
3844 iter = xcb_setup_roots_iterator (xcb_get_setup (ecore_x_connection_get()));
3847 xcb_get_geometry_cookie_t cookie;
3848 xcb_get_geometry_reply_t *reply;
3849 Ecore_X_Window *roots;
3854 cookie = xcb_get_geometry_unchecked(ecore_x_connection_get(), parent);
3855 roots = ecore_x_window_root_list(&num);
3858 reply = xcb_get_geometry_reply(ecore_x_connection_get(), cookie, NULL);
3862 for (i = 0; i < num; xcb_screen_next (&iter), i++)
3864 if (reply->root == roots[i])
3876 reply = xcb_get_geometry_reply(ecore_x_connection_get(), cookie, NULL);
3877 if (reply) free(reply);
3881 if (redraw_debug < 0)
3883 if (getenv("REDRAW_DEBUG"))
3884 redraw_debug = atoi(getenv("REDRAW_DEBUG"));
3888 einfo->info.connection = ecore_x_connection_get();
3889 einfo->info.screen = screen;
3890 einfo->info.drawable = ee->prop.window;
3893 /* FIXME: round trip */
3894 xcb_get_geometry_cookie_t cookie_geom;
3895 xcb_get_window_attributes_cookie_t cookie_attr;
3896 xcb_get_geometry_reply_t *reply_geom;
3897 xcb_get_window_attributes_reply_t *reply_attr;
3899 cookie_geom = xcb_get_geometry_unchecked(ecore_x_connection_get(), ee->prop.window);
3900 cookie_attr = xcb_get_window_attributes_unchecked(ecore_x_connection_get(), ee->prop.window);
3902 reply_geom = xcb_get_geometry_reply(ecore_x_connection_get(), cookie_geom, NULL);
3903 reply_attr = xcb_get_window_attributes_reply(ecore_x_connection_get(), cookie_attr, NULL);
3904 if (reply_attr && reply_geom)
3906 einfo->info.visual = xcb_visualtype_get(ecore_x_default_screen_get(), reply_attr->visual);
3907 einfo->info.colormap = reply_attr->colormap;
3908 einfo->info.depth = reply_geom->depth;
3909 einfo->info.destination_alpha = 1;
3916 xcb_screen_t *screen;
3918 screen = ecore_x_default_screen_get();
3919 einfo->info.visual = xcb_visualtype_get(screen, screen->root_visual);
3920 einfo->info.colormap = screen->default_colormap;
3921 einfo->info.depth = screen->root_depth;
3922 einfo->info.destination_alpha = 0;
3924 einfo->info.rotation = 0;
3925 einfo->info.debug = redraw_debug;
3926 if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo))
3928 ERR("evas_engine_info_set() init engine '%s' failed.", ee->driver);
3929 ecore_evas_free(ee);
3935 ERR("evas_engine_info_set() init engine '%s' failed.", ee->driver);
3936 ecore_evas_free(ee);
3940 ecore_x_icccm_hints_set(ee->prop.window,
3941 1 /* accepts_focus */,
3942 ECORE_X_WINDOW_STATE_HINT_NORMAL /* initial_state */,
3943 0 /* icon_pixmap */,
3945 0 /* icon_window */,
3946 0 /* window_group */,
3948 _ecore_evas_x_group_leader_set(ee);
3949 ecore_x_window_defaults_set(ee->prop.window);
3950 _ecore_evas_x_protocols_set(ee);
3951 _ecore_evas_x_sync_set(ee);
3953 ee->engine.func->fn_render = _ecore_evas_x_render;
3954 _ecore_evas_register(ee);
3955 ecore_x_input_multi_select(ee->prop.window);
3956 ecore_event_window_register(ee->prop.window, ee, ee->evas,
3957 (Ecore_Event_Mouse_Move_Cb)_ecore_evas_mouse_move_process,
3958 (Ecore_Event_Multi_Move_Cb)_ecore_evas_mouse_multi_move_process,
3959 (Ecore_Event_Multi_Down_Cb)_ecore_evas_mouse_multi_down_process,
3960 (Ecore_Event_Multi_Up_Cb)_ecore_evas_mouse_multi_up_process);
3971 #endif /* ! BUILD_ECORE_EVAS_SOFTWARE_8_X11 */
3977 * FIXME: To be fixed.
3980 ecore_evas_software_x11_8_window_get(const Ecore_Evas *ee)
3982 #if defined (BUILD_ECORE_EVAS_SOFTWARE_8_X11)
3983 return (Ecore_X_Window) ecore_evas_window_get(ee);
3993 * FIXME: To be fixed.
3996 ecore_evas_software_x11_8_subwindow_get(const Ecore_Evas *ee)
3998 #if defined (BUILD_ECORE_EVAS_SOFTWARE_8_X11)
3999 return (Ecore_X_Window) ecore_evas_window_get(ee);
4009 * FIXME: To be fixed.
4012 ecore_evas_software_x11_8_direct_resize_set(Ecore_Evas *ee, Eina_Bool on)
4014 #if defined (BUILD_ECORE_EVAS_SOFTWARE_8_X11)
4015 ee->engine.x.direct_resize = on;
4016 if (ee->prop.avoid_damage)
4018 if (ee->engine.x.direct_resize)
4020 /* turn this off for now
4021 ee->engine.x.using_bg_pixmap = 1;
4022 ecore_x_window_pixmap_set(ee->engine.x.win, ee->engine.x.pmap);
4027 /* turn this off too- bg pixmap is controlled by avoid damage directly
4028 ee->engine.x.using_bg_pixmap = 0;
4029 ecore_x_window_pixmap_set(ee->engine.x.win, 0);
4030 ecore_x_window_area_expose(ee->engine.x.win, 0, 0, ee->w, ee->h);
4044 * FIXME: To be fixed.
4047 ecore_evas_software_x11_8_direct_resize_get(const Ecore_Evas *ee)
4049 #if defined (BUILD_ECORE_EVAS_SOFTWARE_8_X11)
4050 return ee->engine.x.direct_resize;
4060 * FIXME: To be fixed.
4063 ecore_evas_software_x11_8_extra_event_window_add(Ecore_Evas *ee, Ecore_X_Window win)
4065 #if defined (BUILD_ECORE_EVAS_SOFTWARE_8_X11)
4066 Ecore_X_Window *winp;
4068 winp = malloc(sizeof(Ecore_X_Window));
4072 ee->engine.x.win_extra = eina_list_append(ee->engine.x.win_extra, winp);
4073 ecore_x_input_multi_select(win);
4074 ecore_event_window_register(win, ee, ee->evas,
4075 (Ecore_Event_Mouse_Move_Cb)_ecore_evas_mouse_move_process,
4076 (Ecore_Event_Multi_Move_Cb)_ecore_evas_mouse_multi_move_process,
4077 (Ecore_Event_Multi_Down_Cb)_ecore_evas_mouse_multi_down_process,
4078 (Ecore_Event_Multi_Up_Cb)_ecore_evas_mouse_multi_up_process);
4088 ecore_evas_x11_leader_set(Ecore_Evas *ee, Ecore_X_Window win)
4090 #ifdef BUILD_ECORE_EVAS_X11
4091 _ecore_evas_x_group_leader_unset(ee);
4092 ee->engine.x.leader = win;
4093 _ecore_evas_x_group_leader_update(ee);
4102 ecore_evas_x11_leader_get(Ecore_Evas *ee)
4104 #ifdef BUILD_ECORE_EVAS_X11
4105 return ee->engine.x.leader;
4113 ecore_evas_x11_leader_default_set(Ecore_Evas *ee)
4115 #ifdef BUILD_ECORE_EVAS_X11
4116 _ecore_evas_x_group_leader_unset(ee);
4117 _ecore_evas_x_group_leader_set(ee);
4124 #ifdef BUILD_ECORE_EVAS_X11
4126 _ecore_evas_x11_convert_rectangle_with_angle(Ecore_Evas *ee, Ecore_X_Rectangle *dst_rect, Ecore_X_Rectangle *src_rect)
4128 if ((!src_rect) || (!dst_rect)) return 0;
4130 if (ee->rotation == 0)
4132 dst_rect->x = src_rect->x;
4133 dst_rect->y = src_rect->y;
4134 dst_rect->width = src_rect->width;
4135 dst_rect->height = src_rect->height;
4137 else if (ee->rotation == 90)
4139 dst_rect->x = src_rect->y;
4140 dst_rect->y = ee->req.h - src_rect->x - src_rect->width;
4141 dst_rect->width = src_rect->height;
4142 dst_rect->height = src_rect->width;
4144 else if (ee->rotation == 180)
4146 dst_rect->x = ee->req.w - src_rect->x - src_rect->width;
4147 dst_rect->y = ee->req.h - src_rect->y - src_rect->height;
4148 dst_rect->width = src_rect->width;
4149 dst_rect->height = src_rect->height;
4151 else if (ee->rotation == 270)
4153 dst_rect->x = ee->req.w - src_rect->y - src_rect->height;
4154 dst_rect->y = src_rect->x;
4155 dst_rect->width = src_rect->height;
4156 dst_rect->height = src_rect->width;
4168 ecore_evas_x11_shape_input_rectangle_set(Ecore_Evas *ee, int x, int y, int w, int h)
4170 #ifdef BUILD_ECORE_EVAS_X11
4172 Ecore_X_Rectangle src_rect;
4173 Ecore_X_Rectangle dst_rect;
4175 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
4177 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
4178 "ecore_evas_x11_shape_input_rectangle_set");
4185 src_rect.height = h;
4190 dst_rect.height = 0;
4192 ret = _ecore_evas_x11_convert_rectangle_with_angle(ee, &dst_rect, &src_rect);
4194 if (!ee->engine.x.win_shaped_input)
4195 ee->engine.x.win_shaped_input = ecore_x_window_override_new(ee->engine.x.win_root,
4199 ecore_x_window_shape_input_rectangle_set(ee->engine.x.win_shaped_input,
4200 dst_rect.x, dst_rect.y,
4201 dst_rect.width, dst_rect.height);
4213 ecore_evas_x11_shape_input_rectangle_add(Ecore_Evas *ee, int x, int y, int w, int h)
4215 #ifdef BUILD_ECORE_EVAS_X11
4217 Ecore_X_Rectangle src_rect;
4218 Ecore_X_Rectangle dst_rect;
4220 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
4222 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
4223 "ecore_evas_x11_shape_input_rectangle_add");
4230 src_rect.height = h;
4235 dst_rect.height = 0;
4237 ret = _ecore_evas_x11_convert_rectangle_with_angle(ee, &dst_rect, &src_rect);
4239 if (!ee->engine.x.win_shaped_input)
4240 ee->engine.x.win_shaped_input = ecore_x_window_override_new(ee->engine.x.win_root,
4244 ecore_x_window_shape_input_rectangle_add(ee->engine.x.win_shaped_input,
4245 dst_rect.x, dst_rect.y,
4246 dst_rect.width, dst_rect.height);
4258 ecore_evas_x11_shape_input_rectangle_subtract(Ecore_Evas *ee, int x, int y, int w, int h)
4260 #ifdef BUILD_ECORE_EVAS_X11
4262 Ecore_X_Rectangle src_rect;
4263 Ecore_X_Rectangle dst_rect;
4265 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
4267 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
4268 "ecore_evas_x11_shape_input_rectangle_subtract");
4275 src_rect.height = h;
4280 dst_rect.height = 0;
4282 ret = _ecore_evas_x11_convert_rectangle_with_angle(ee, &dst_rect, &src_rect);
4284 if (!ee->engine.x.win_shaped_input)
4285 ee->engine.x.win_shaped_input = ecore_x_window_override_new(ee->engine.x.win_root,
4289 ecore_x_window_shape_input_rectangle_subtract(ee->engine.x.win_shaped_input,
4290 dst_rect.x, dst_rect.y,
4291 dst_rect.width, dst_rect.height);
4303 ecore_evas_x11_shape_input_empty(Ecore_Evas *ee)
4305 #ifdef BUILD_ECORE_EVAS_X11
4306 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
4308 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
4309 "ecore_evas_x11_shape_input_empty");
4313 if (!ee->engine.x.win_shaped_input)
4314 ee->engine.x.win_shaped_input = ecore_x_window_override_new(ee->engine.x.win_root, 0, 0, 1, 1);
4316 ecore_x_window_shape_input_rectangle_set(ee->engine.x.win_shaped_input, 0, 0, 0, 0);
4324 ecore_evas_x11_shape_input_reset(Ecore_Evas *ee)
4326 #ifdef BUILD_ECORE_EVAS_X11
4327 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
4329 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
4330 "ecore_evas_x11_shape_input_reset");
4334 if (!ee->engine.x.win_shaped_input)
4335 ee->engine.x.win_shaped_input = ecore_x_window_override_new(ee->engine.x.win_root, 0, 0, 1, 1);
4337 ecore_x_window_shape_input_rectangle_set(ee->engine.x.win_shaped_input, 0, 0, 65535, 65535);
4345 ecore_evas_x11_shape_input_apply(Ecore_Evas *ee)
4347 #ifdef BUILD_ECORE_EVAS_X11
4348 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
4350 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
4351 "ecore_evas_x11_shape_input_apply");
4355 if (!ee->engine.x.win_shaped_input) return;
4357 ecore_x_window_shape_input_window_set(ee->prop.window, ee->engine.x.win_shaped_input);