summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Blumenkrantz <zmike@osg.samsung.com>2015-01-10 00:33:55 -0500
committerMike Blumenkrantz <zmike@osg.samsung.com>2015-01-10 00:36:17 -0500
commit63a5cdf0f8516c16a62233da0c2af0e10a13264b (patch)
treebdfad16bdafb45f1c91de7e2f18fb809fc1ca10c
parent1ed6c4c47a774f1cbbe9655e057ddeb71082587f (diff)
+elm_win_fake(), ELM_WIN_FAKE type
this is a giant hack to provide widget parenting in e. do not use this function, do not use this type, do not even read the related documentation. @feature
-rw-r--r--src/lib/elm_win.c73
-rw-r--r--src/lib/elm_win.eo1
-rw-r--r--src/lib/elm_win_common.h4
-rw-r--r--src/lib/elm_win_legacy.h19
4 files changed, 69 insertions, 28 deletions
diff --git a/src/lib/elm_win.c b/src/lib/elm_win.c
index e5de5e889..3de1efd63 100644
--- a/src/lib/elm_win.c
+++ b/src/lib/elm_win.c
@@ -21,10 +21,11 @@ static const Elm_Win_Trap *trap = NULL;
21#define TRAP(sd, name, ...) \ 21#define TRAP(sd, name, ...) \
22 do \ 22 do \
23 { \ 23 { \
24 if ((!trap) || (!trap->name) || \ 24 if (sd->type != ELM_WIN_FAKE) \
25 ((trap->name) && \ 25 if ((!trap) || (!trap->name) || \
26 (trap->name(sd->trap_data, sd->obj, ## __VA_ARGS__)))) \ 26 ((trap->name) && \
27 ecore_evas_##name(sd->ee, ##__VA_ARGS__); \ 27 (trap->name(sd->trap_data, sd->obj, ## __VA_ARGS__)))) \
28 ecore_evas_##name(sd->ee, ##__VA_ARGS__); \
28 } \ 29 } \
29 while (0) 30 while (0)
30 31
@@ -1946,6 +1947,7 @@ _elm_win_xwin_update(Elm_Win_Data *sd)
1946{ 1947{
1947 const char *s; 1948 const char *s;
1948 1949
1950 if (sd->type == ELM_WIN_FAKE) return;
1949 _internal_elm_win_xwindow_get(sd); 1951 _internal_elm_win_xwindow_get(sd);
1950 if (sd->parent) 1952 if (sd->parent)
1951 { 1953 {
@@ -2908,10 +2910,16 @@ elm_win_add(Evas_Object *parent,
2908 const char *name, 2910 const char *name,
2909 Elm_Win_Type type) 2911 Elm_Win_Type type)
2910{ 2912{
2911 Evas_Object *obj = eo_add(MY_CLASS, parent, elm_obj_win_constructor(name, type)); 2913 Evas_Object *obj = eo_add(MY_CLASS, parent, elm_obj_win_constructor(name, type, NULL));
2912 return obj; 2914 return obj;
2913} 2915}
2914 2916
2917EAPI Evas_Object *
2918elm_win_fake(Ecore_Evas *ee)
2919{
2920 return eo_add(MY_CLASS, NULL, elm_obj_win_constructor(NULL, ELM_WIN_FAKE, ee));
2921}
2922
2915static void 2923static void
2916_elm_win_cb_hide(void *data EINA_UNUSED, 2924_elm_win_cb_hide(void *data EINA_UNUSED,
2917 Evas *e EINA_UNUSED, 2925 Evas *e EINA_UNUSED,
@@ -3008,7 +3016,7 @@ _accel_is_gl(void)
3008} 3016}
3009 3017
3010EOLIAN static void 3018EOLIAN static void
3011_elm_win_constructor(Eo *obj, Elm_Win_Data *sd, const char *name, Elm_Win_Type type) 3019_elm_win_constructor(Eo *obj, Elm_Win_Data *sd, const char *name, Elm_Win_Type type, Ecore_Evas *oee)
3012{ 3020{
3013 sd->obj = obj; // in ctor 3021 sd->obj = obj; // in ctor
3014 3022
@@ -3027,6 +3035,9 @@ _elm_win_constructor(Eo *obj, Elm_Win_Data *sd, const char *name, Elm_Win_Type t
3027 3035
3028 switch (type) 3036 switch (type)
3029 { 3037 {
3038 case ELM_WIN_FAKE:
3039 tmp_sd.ee = oee;
3040 break;
3030 case ELM_WIN_INLINED_IMAGE: 3041 case ELM_WIN_INLINED_IMAGE:
3031 if (!parent) break; 3042 if (!parent) break;
3032 { 3043 {
@@ -3366,7 +3377,7 @@ _elm_win_constructor(Eo *obj, Elm_Win_Data *sd, const char *name, Elm_Win_Type t
3366 SD_CPY(shot.info); 3377 SD_CPY(shot.info);
3367#undef SD_CPY 3378#undef SD_CPY
3368 3379
3369 if ((trap) && (trap->add)) 3380 if ((type != ELM_WIN_FAKE) && (trap) && (trap->add))
3370 sd->trap_data = trap->add(obj); 3381 sd->trap_data = trap->add(obj);
3371 3382
3372 /* complementary actions, which depend on final smart data 3383 /* complementary actions, which depend on final smart data
@@ -3438,31 +3449,35 @@ _elm_win_constructor(Eo *obj, Elm_Win_Data *sd, const char *name, Elm_Win_Type t
3438 /* use own version of ecore_evas_object_associate() that does TRAP() */ 3449 /* use own version of ecore_evas_object_associate() that does TRAP() */
3439 ecore_evas_data_set(sd->ee, "elm_win", obj); 3450 ecore_evas_data_set(sd->ee, "elm_win", obj);
3440 3451
3441 evas_object_event_callback_add 3452 if (type != ELM_WIN_FAKE)
3442 (obj, EVAS_CALLBACK_CHANGED_SIZE_HINTS, 3453 {
3443 _elm_win_obj_callback_changed_size_hints, obj); 3454 evas_object_event_callback_add(obj, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
3444 3455 _elm_win_obj_callback_changed_size_hints, obj);
3445 evas_object_intercept_raise_callback_add 3456 evas_object_intercept_raise_callback_add
3446 (obj, _elm_win_obj_intercept_raise, obj); 3457 (obj, _elm_win_obj_intercept_raise, obj);
3447 evas_object_intercept_lower_callback_add 3458 evas_object_intercept_lower_callback_add
3448 (obj, _elm_win_obj_intercept_lower, obj); 3459 (obj, _elm_win_obj_intercept_lower, obj);
3449 evas_object_intercept_stack_above_callback_add 3460 evas_object_intercept_stack_above_callback_add
3450 (obj, _elm_win_obj_intercept_stack_above, obj); 3461 (obj, _elm_win_obj_intercept_stack_above, obj);
3451 evas_object_intercept_stack_below_callback_add 3462 evas_object_intercept_stack_below_callback_add
3452 (obj, _elm_win_obj_intercept_stack_below, obj); 3463 (obj, _elm_win_obj_intercept_stack_below, obj);
3453 evas_object_intercept_layer_set_callback_add 3464 evas_object_intercept_layer_set_callback_add
3454 (obj, _elm_win_obj_intercept_layer_set, obj); 3465 (obj, _elm_win_obj_intercept_layer_set, obj);
3455 evas_object_intercept_show_callback_add 3466 evas_object_intercept_show_callback_add
3456 (obj, _elm_win_obj_intercept_show, obj); 3467 (obj, _elm_win_obj_intercept_show, obj);
3468 }
3457 3469
3458 TRAP(sd, name_class_set, name, _elm_appname); 3470 TRAP(sd, name_class_set, name, _elm_appname);
3459 ecore_evas_callback_delete_request_set(sd->ee, _elm_win_delete_request); 3471 ecore_evas_callback_delete_request_set(sd->ee, _elm_win_delete_request);
3460 ecore_evas_callback_resize_set(sd->ee, _elm_win_resize);
3461 ecore_evas_callback_mouse_in_set(sd->ee, _elm_win_mouse_in);
3462 ecore_evas_callback_focus_in_set(sd->ee, _elm_win_focus_in);
3463 ecore_evas_callback_focus_out_set(sd->ee, _elm_win_focus_out);
3464 ecore_evas_callback_move_set(sd->ee, _elm_win_move);
3465 ecore_evas_callback_state_change_set(sd->ee, _elm_win_state_change); 3472 ecore_evas_callback_state_change_set(sd->ee, _elm_win_state_change);
3473 if (type != ELM_WIN_FAKE)
3474 {
3475 ecore_evas_callback_resize_set(sd->ee, _elm_win_resize);
3476 ecore_evas_callback_mouse_in_set(sd->ee, _elm_win_mouse_in);
3477 ecore_evas_callback_focus_in_set(sd->ee, _elm_win_focus_in);
3478 ecore_evas_callback_focus_out_set(sd->ee, _elm_win_focus_out);
3479 ecore_evas_callback_move_set(sd->ee, _elm_win_move);
3480 }
3466 evas_object_event_callback_add(obj, EVAS_CALLBACK_HIDE, _elm_win_cb_hide, NULL); 3481 evas_object_event_callback_add(obj, EVAS_CALLBACK_HIDE, _elm_win_cb_hide, NULL);
3467 evas_object_event_callback_add(obj, EVAS_CALLBACK_SHOW, _elm_win_cb_show, NULL); 3482 evas_object_event_callback_add(obj, EVAS_CALLBACK_SHOW, _elm_win_cb_show, NULL);
3468 3483
@@ -3483,6 +3498,8 @@ _elm_win_constructor(Eo *obj, Elm_Win_Data *sd, const char *name, Elm_Win_Type t
3483 _elm_win_xwin_update(sd); 3498 _elm_win_xwin_update(sd);
3484#endif 3499#endif
3485 3500
3501 /* do not append to list; all windows render as black rects */
3502 if (type == ELM_WIN_FAKE) return;
3486 _elm_win_list = eina_list_append(_elm_win_list, obj); 3503 _elm_win_list = eina_list_append(_elm_win_list, obj);
3487 _elm_win_count++; 3504 _elm_win_count++;
3488 3505
diff --git a/src/lib/elm_win.eo b/src/lib/elm_win.eo
index 76e317b1b..9cea8eabb 100644
--- a/src/lib/elm_win.eo
+++ b/src/lib/elm_win.eo
@@ -1193,6 +1193,7 @@ class Elm_Win (Elm_Widget, Elm_Interface_Atspi_Window,
1193 params { 1193 params {
1194 @in const(char)* name; 1194 @in const(char)* name;
1195 @in Elm_Win_Type type; 1195 @in Elm_Win_Type type;
1196 @in Ecore_Evas *oee;
1196 } 1197 }
1197 } 1198 }
1198 wm_manual_rotation_done_manual { 1199 wm_manual_rotation_done_manual {
diff --git a/src/lib/elm_win_common.h b/src/lib/elm_win_common.h
index 5b5b6ff78..7e45a3aad 100644
--- a/src/lib/elm_win_common.h
+++ b/src/lib/elm_win_common.h
@@ -69,6 +69,10 @@ typedef enum
69 instead the window and all of its contents will be 69 instead the window and all of its contents will be
70 rendered to an image buffer and can be shown 70 rendered to an image buffer and can be shown
71 other process's plug image object*/ 71 other process's plug image object*/
72 ELM_WIN_FAKE /**< This window was created using a pre-existing canvas.
73 The window widget can be deleted, but the canvas
74 must be managed externally.
75 @since 1.13 */
72} Elm_Win_Type; 76} Elm_Win_Type;
73 77
74/** 78/**
diff --git a/src/lib/elm_win_legacy.h b/src/lib/elm_win_legacy.h
index a6f0c2b90..e32f27496 100644
--- a/src/lib/elm_win_legacy.h
+++ b/src/lib/elm_win_legacy.h
@@ -17,6 +17,25 @@
17EAPI Evas_Object *elm_win_add(Evas_Object *parent, const char *name, Elm_Win_Type type); 17EAPI Evas_Object *elm_win_add(Evas_Object *parent, const char *name, Elm_Win_Type type);
18 18
19/** 19/**
20 * Creates a fake window object using a pre-existing canvas.
21 *
22 * @param ee The Ecore_Evas to use
23 *
24 * The returned window widget will not manage or modify the canvas;
25 * this canvas must continue to be managed externally.
26 *
27 * Do not use this function if you are not writing a window manager.
28 * @warning Exact behaviors of this function are not guaranteed.
29 *
30 * @return The created object, or @c NULL on failure
31 *
32 * @ingroup Win
33 *
34 * @since 1.13
35 */
36EAPI Evas_Object *elm_win_fake(Ecore_Evas *ee);
37
38/**
20 * Adds a window object with standard setup 39 * Adds a window object with standard setup
21 * 40 *
22 * @param name The name of the window 41 * @param name The name of the window