summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/efl_wl/Efl_Wl.h5
-rw-r--r--src/lib/efl_wl/efl_wl.c159
-rw-r--r--src/lib/efl_wl/efl_wl.eo6
-rw-r--r--src/lib/efl_wl/efl_wl_surface.eo22
-rw-r--r--src/lib/efl_wl/meson.build1
5 files changed, 71 insertions, 122 deletions
diff --git a/src/lib/efl_wl/Efl_Wl.h b/src/lib/efl_wl/Efl_Wl.h
index ee36eb74bb..06fca3f5b5 100644
--- a/src/lib/efl_wl/Efl_Wl.h
+++ b/src/lib/efl_wl/Efl_Wl.h
@@ -30,6 +30,7 @@ typedef void * Efl_Wl_Wl_Interface_Data;
30typedef void * Efl_Wl_Wl_Interface_Bind_Cb; 30typedef void * Efl_Wl_Wl_Interface_Bind_Cb;
31 31
32#include <efl_wl.eo.h> 32#include <efl_wl.eo.h>
33#include <efl_wl_surface.eo.h>
33/** 34/**
34 * @defgroup Efl_Wl_Group EFL Wayland 35 * @defgroup Efl_Wl_Group EFL Wayland
35 * 36 *
@@ -164,7 +165,7 @@ EAPI void efl_wl_minmax_set(Evas_Object *obj, Eina_Bool set);
164 * @since 1.21 165 * @since 1.21
165 */ 166 */
166EAPI void *efl_wl_global_add(Evas_Object *obj, const void *interface, uint32_t version, void *data, void *bind_cb); 167EAPI void *efl_wl_global_add(Evas_Object *obj, const void *interface, uint32_t version, void *data, void *bind_cb);
167#endif 168
168/** 169/**
169 * Extract a child surface from the compositor 170 * Extract a child surface from the compositor
170 * 171 *
@@ -187,7 +188,7 @@ EAPI Eina_Bool efl_wl_surface_extract(Evas_Object *surface);
187 * @since 1.24 188 * @since 1.24
188 */ 189 */
189EAPI int32_t efl_wl_surface_pid_get(Evas_Object *surface); 190EAPI int32_t efl_wl_surface_pid_get(Evas_Object *surface);
190 191#endif
191/** 192/**
192 * Get the Evas_Object for an extracted wl_surface resource created by an efl_wl object 193 * Get the Evas_Object for an extracted wl_surface resource created by an efl_wl object
193 * 194 *
diff --git a/src/lib/efl_wl/efl_wl.c b/src/lib/efl_wl/efl_wl.c
index defa800066..d6b77f4f44 100644
--- a/src/lib/efl_wl/efl_wl.c
+++ b/src/lib/efl_wl/efl_wl.c
@@ -1925,8 +1925,6 @@ comp_surface_impl_destroy(struct wl_resource *resource)
1925} 1925}
1926 1926
1927 1927
1928static Evas_Smart *comp_surface_smart = NULL;
1929
1930static inline Eina_Bool 1928static inline Eina_Bool
1931comp_surface_check_grab(Comp_Surface *cs, Comp_Seat *s) 1929comp_surface_check_grab(Comp_Surface *cs, Comp_Seat *s)
1932{ 1930{
@@ -2379,14 +2377,19 @@ comp_surface_multi_move(void *data, Evas *e EINA_UNUSED, Eo *obj EINA_UNUSED, vo
2379 } 2377 }
2380} 2378}
2381 2379
2380EOLIAN static Eo *
2381_efl_wl_surface_efl_object_constructor(Eo *obj, Comp_Surface *cs EINA_UNUSED)
2382{
2383 efl_canvas_group_clipped_set(obj, EINA_TRUE);
2384 return efl_constructor(efl_super(obj, EFL_WL_SURFACE_CLASS));
2385}
2386
2382static void 2387static void
2383comp_surface_smart_add(Eo *obj) 2388_efl_wl_surface_efl_canvas_group_group_add(Eo *obj, Comp_Surface *cs)
2384{ 2389{
2385 Comp_Surface *cs;
2386 Evas *e; 2390 Evas *e;
2387 2391
2388 cs = calloc(1, sizeof(Comp_Surface)); 2392 efl_canvas_group_add(efl_super(obj, EFL_WL_SURFACE_CLASS));
2389 evas_object_smart_data_set(obj, cs);
2390 cs->obj = obj; 2393 cs->obj = obj;
2391 evas_object_event_callback_add(cs->obj, EVAS_CALLBACK_MOUSE_DOWN, comp_surface_mouse_down, cs); 2394 evas_object_event_callback_add(cs->obj, EVAS_CALLBACK_MOUSE_DOWN, comp_surface_mouse_down, cs);
2392 evas_object_event_callback_add(cs->obj, EVAS_CALLBACK_MOUSE_UP, comp_surface_mouse_up, cs); 2395 evas_object_event_callback_add(cs->obj, EVAS_CALLBACK_MOUSE_UP, comp_surface_mouse_up, cs);
@@ -2400,19 +2403,17 @@ comp_surface_smart_add(Eo *obj)
2400 e = evas_object_evas_get(obj); 2403 e = evas_object_evas_get(obj);
2401 cs->img = evas_object_image_filled_add(e); 2404 cs->img = evas_object_image_filled_add(e);
2402 evas_object_show(cs->img); 2405 evas_object_show(cs->img);
2403 cs->clip = evas_object_rectangle_add(e); 2406 cs->clip = (Eo*)efl_canvas_group_clipper_get(obj);
2407 efl_gfx_entity_geometry_set(cs->clip, efl_gfx_entity_geometry_get(obj));
2404 2408
2405 evas_object_smart_member_add(cs->img, cs->obj); 2409 evas_object_smart_member_add(cs->img, cs->obj);
2406 evas_object_smart_member_add(cs->clip, cs->obj);
2407 evas_object_image_border_center_fill_set(cs->img, EVAS_BORDER_FILL_SOLID); 2410 evas_object_image_border_center_fill_set(cs->img, EVAS_BORDER_FILL_SOLID);
2408 evas_object_image_colorspace_set(cs->img, EVAS_COLORSPACE_ARGB8888); 2411 evas_object_image_colorspace_set(cs->img, EVAS_COLORSPACE_ARGB8888);
2409} 2412}
2410 2413
2411static void 2414static void
2412comp_surface_smart_del(Eo *obj) 2415_efl_wl_surface_efl_canvas_group_group_del(Eo *obj, Comp_Surface *cs)
2413{ 2416{
2414 Comp_Surface *cs = evas_object_smart_data_get(obj);
2415
2416 array_clear(&cs->input_rects); 2417 array_clear(&cs->input_rects);
2417 array_clear(&cs->opaque_rects); 2418 array_clear(&cs->opaque_rects);
2418 eina_tiler_free(cs->opaque); 2419 eina_tiler_free(cs->opaque);
@@ -2426,7 +2427,6 @@ comp_surface_smart_del(Eo *obj)
2426 wl_resource_destroy(cs->res); 2427 wl_resource_destroy(cs->res);
2427 } 2428 }
2428 evas_object_del(cs->img); 2429 evas_object_del(cs->img);
2429 evas_object_del(cs->clip);
2430 if (cs->shell.surface) 2430 if (cs->shell.surface)
2431 { 2431 {
2432 if (cs->role) 2432 if (cs->role)
@@ -2435,54 +2435,41 @@ comp_surface_smart_del(Eo *obj)
2435 } 2435 }
2436 cs->c->surfaces = eina_inlist_remove(cs->c->surfaces, EINA_INLIST_GET(cs)); 2436 cs->c->surfaces = eina_inlist_remove(cs->c->surfaces, EINA_INLIST_GET(cs));
2437 cs->c->surfaces_count--; 2437 cs->c->surfaces_count--;
2438 free(cs);
2439} 2438}
2440 2439
2441static void 2440static void
2442comp_surface_smart_move(Eo *obj, int x, int y) 2441_efl_wl_surface_efl_gfx_entity_position_set(Eo *obj, Comp_Surface *cs, Eina_Position2D pos)
2443{ 2442{
2444 Eina_List *l; 2443 efl_gfx_entity_position_set(efl_super(obj, EFL_WL_SURFACE_CLASS), pos);
2445 Eo *o; 2444 efl_gfx_entity_position_set(cs->clip, pos);
2446 int px, py, cx, cy;
2447 2445
2448 evas_object_geometry_get(obj, &px, &py, NULL, NULL);
2449 //{ 2446 //{
2450 //Comp_Surface *cs = evas_object_smart_data_get(obj);
2451 //if (cs->cursor) 2447 //if (cs->cursor)
2452 //fprintf(stderr, "COMP %sSURFACE(%p) %d,%d\n", cs->subsurface ? "SUB" : "", cs, x, y); 2448 //fprintf(stderr, "COMP %sSURFACE(%p) %d,%d\n", cs->subsurface ? "SUB" : "", cs, x, y);
2453 //} 2449 //}
2454 l = evas_object_smart_members_get(obj);
2455 EINA_LIST_FREE(l, o)
2456 {
2457 evas_object_geometry_get(o, &cx, &cy, NULL, NULL);
2458 evas_object_move(o, x + (cx - px), y + (cy - py));
2459 //fprintf(stderr, "SUBOBJ %d,%d\n", x + (cx - px), y + (cy - py));
2460 }
2461} 2450}
2462 2451
2463static void 2452static void
2464comp_surface_smart_resize(Eo *obj, int w, int h) 2453_efl_wl_surface_efl_gfx_entity_size_set(Eo *obj, Comp_Surface *cs, Eina_Size2D sz)
2465{ 2454{
2466 Comp_Surface *cs = evas_object_smart_data_get(obj); 2455 efl_gfx_entity_size_set(efl_super(obj, EFL_WL_SURFACE_CLASS), sz);
2467 evas_object_resize(cs->clip, w, h); 2456 evas_object_resize(cs->clip, sz.w, sz.h);
2468 //if (cs->cursor) fprintf(stderr, "COMP %sSURFACE(%p) %dx%d\n", cs->subsurface ? "SUB" : "", cs, w, h); 2457 //if (cs->cursor) fprintf(stderr, "COMP %sSURFACE(%p) %dx%d\n", cs->subsurface ? "SUB" : "", cs, w, h);
2469 if (cs->drag) 2458 if (cs->drag)
2470 evas_object_move(cs->obj, cs->drag->ptr.pos.x, cs->drag->ptr.pos.y); 2459 evas_object_move(cs->obj, cs->drag->ptr.pos.x, cs->drag->ptr.pos.y);
2471} 2460}
2472 2461
2473static void 2462static void
2474comp_surface_smart_show(Eo *obj) 2463_efl_wl_surface_efl_gfx_entity_visible_set(Eo *obj, Comp_Surface *cs, Eina_Bool vis)
2475{ 2464{
2476 Comp_Surface *cs = evas_object_smart_data_get(obj); 2465 Comp_Surface *pcs = NULL, *lcs;
2477 evas_object_show(cs->clip); 2466 efl_gfx_entity_visible_set(efl_super(obj, EFL_WL_SURFACE_CLASS), vis);
2478 cs->mapped = 1; 2467 if (vis)
2479} 2468 {
2480 2469 evas_object_show(cs->clip);
2481static void 2470 cs->mapped = 1;
2482comp_surface_smart_hide(Eo *obj) 2471 return;
2483{ 2472 }
2484 Comp_Surface *pcs = NULL, *lcs, *cs = evas_object_smart_data_get(obj);
2485
2486 evas_object_hide(cs->clip); 2473 evas_object_hide(cs->clip);
2487 cs->mapped = 0; 2474 cs->mapped = 0;
2488 2475
@@ -2520,65 +2507,6 @@ comp_surface_smart_hide(Eo *obj)
2520} 2507}
2521 2508
2522static void 2509static void
2523comp_surface_smart_clip_set(Eo *obj, Eo *clip)
2524{
2525 Comp_Surface *cs = evas_object_smart_data_get(obj);
2526 evas_object_clip_set(cs->clip, clip);
2527}
2528
2529static void
2530comp_surface_smart_clip_unset(Eo *obj)
2531{
2532 Comp_Surface *cs = evas_object_smart_data_get(obj);
2533 evas_object_clip_unset(cs->clip);
2534}
2535
2536static void
2537comp_surface_smart_member_add(Eo *obj, Eo *child)
2538{
2539 Comp_Surface *cs = evas_object_smart_data_get(obj);
2540 if (child != cs->clip) evas_object_clip_set(child, cs->clip);
2541}
2542
2543static void
2544comp_surface_smart_member_del(Eo *obj, Eo *child)
2545{
2546 Comp_Surface *cs = evas_object_smart_data_get(obj);
2547 if (child != cs->clip) evas_object_clip_unset(child);
2548}
2549
2550static void
2551comp_surface_smart_init(void)
2552{
2553 if (comp_surface_smart) return;
2554 {
2555 static const Evas_Smart_Class sc =
2556 {
2557 "comp_surface",
2558 EVAS_SMART_CLASS_VERSION,
2559 comp_surface_smart_add,
2560 comp_surface_smart_del,
2561 comp_surface_smart_move,
2562 comp_surface_smart_resize,
2563 comp_surface_smart_show,
2564 comp_surface_smart_hide,
2565 NULL, //color_set
2566 comp_surface_smart_clip_set,
2567 comp_surface_smart_clip_unset,
2568 NULL,
2569 comp_surface_smart_member_add,
2570 comp_surface_smart_member_del,
2571
2572 NULL,
2573 NULL,
2574 NULL,
2575 NULL
2576 };
2577 comp_surface_smart = evas_smart_class_new(&sc);
2578 }
2579}
2580
2581static void
2582comp_surface_create(struct wl_client *client, struct wl_resource *resource, uint32_t id) 2510comp_surface_create(struct wl_client *client, struct wl_resource *resource, uint32_t id)
2583{ 2511{
2584 struct wl_resource *res; 2512 struct wl_resource *res;
@@ -2588,9 +2516,9 @@ comp_surface_create(struct wl_client *client, struct wl_resource *resource, uint
2588 int x, y; 2516 int x, y;
2589 2517
2590 res = wl_resource_create(client, &wl_surface_interface, wl_resource_get_version(resource), id); 2518 res = wl_resource_create(client, &wl_surface_interface, wl_resource_get_version(resource), id);
2591 comp_surface_smart_init(); 2519 obj = efl_add(EFL_WL_SURFACE_CLASS, c->obj);
2592 obj = evas_object_smart_add(c->evas, comp_surface_smart); 2520 efl_gfx_entity_visible_set(obj, EINA_FALSE);
2593 cs = evas_object_smart_data_get(obj); 2521 cs = efl_data_scope_get(obj, EFL_WL_SURFACE_CLASS);
2594 cs->res = res; 2522 cs->res = res;
2595 evas_object_smart_member_add(cs->obj, c->obj); 2523 evas_object_smart_member_add(cs->obj, c->obj);
2596 cs->c = c; 2524 cs->c = c;
@@ -5767,8 +5695,8 @@ _efl_wl_minmax_set(Eo *obj, Comp *c, Eina_Bool set)
5767 } 5695 }
5768} 5696}
5769 5697
5770EOLIAN static Efl_Wl_Global * 5698EOLIAN static Efl_Wl_Wl_Global *
5771_efl_wl_global_add(Eo *obj, Comp *c, const Efl_Wl_Interface *interface, uint32_t version, Efl_Wl_Interface_Data *data, Efl_Wl_Interface_Bind_Cb *bind_cb) 5699_efl_wl_global_add(Eo *obj, Comp *c, const Efl_Wl_Wl_Interface *interface, uint32_t version, Efl_Wl_Wl_Interface_Data *data, Efl_Wl_Wl_Interface_Bind_Cb *bind_cb)
5772{ 5700{
5773 EINA_SAFETY_ON_NULL_RETURN_VAL(interface, NULL); 5701 EINA_SAFETY_ON_NULL_RETURN_VAL(interface, NULL);
5774 return (void*)wl_global_create(c->display, (void*)interface, version, (void*)data, (void*)bind_cb); 5702 return (void*)wl_global_create(c->display, (void*)interface, version, (void*)data, (void*)bind_cb);
@@ -5810,24 +5738,18 @@ extracted_changed(void *data, Evas *e EINA_UNUSED, Eo *obj, void *event_info EIN
5810 shell_surface_send_configure(data); 5738 shell_surface_send_configure(data);
5811} 5739}
5812 5740
5813int32_t 5741static EOLIAN int32_t
5814efl_wl_surface_pid_get(Eo *surface) 5742_efl_wl_surface_pid_get(const Eo *surface, Comp_Surface *cs)
5815{ 5743{
5816 Comp_Surface *cs;
5817 int32_t pid; 5744 int32_t pid;
5818 if (!eina_streq(evas_object_type_get(surface), "comp_surface")) abort();
5819 cs = evas_object_smart_data_get(surface);
5820 EINA_SAFETY_ON_TRUE_RETURN_VAL(cs->dead, -1); 5745 EINA_SAFETY_ON_TRUE_RETURN_VAL(cs->dead, -1);
5821 wl_client_get_credentials(wl_resource_get_client(cs->res), &pid, NULL, NULL); 5746 wl_client_get_credentials(wl_resource_get_client(cs->res), &pid, NULL, NULL);
5822 return pid; 5747 return pid;
5823} 5748}
5824 5749
5825Eina_Bool 5750static EOLIAN Eina_Bool
5826efl_wl_surface_extract(Eo *surface) 5751_efl_wl_surface_extract(Eo *surface, Comp_Surface *cs)
5827{ 5752{
5828 Comp_Surface *cs;
5829 if (!eina_streq(evas_object_type_get(surface), "comp_surface")) abort();
5830 cs = evas_object_smart_data_get(surface);
5831 EINA_SAFETY_ON_TRUE_RETURN_VAL(cs->extracted, EINA_FALSE); 5753 EINA_SAFETY_ON_TRUE_RETURN_VAL(cs->extracted, EINA_FALSE);
5832 EINA_SAFETY_ON_TRUE_RETURN_VAL(cs->dead, EINA_FALSE); 5754 EINA_SAFETY_ON_TRUE_RETURN_VAL(cs->dead, EINA_FALSE);
5833 cs->extracted = 1; 5755 cs->extracted = 1;
@@ -5857,9 +5779,8 @@ efl_wl_extracted_surface_extracted_parent_get(Eo *surface)
5857 Comp_Surface *cs; 5779 Comp_Surface *cs;
5858 5780
5859 EINA_SAFETY_ON_NULL_RETURN_VAL(surface, NULL); 5781 EINA_SAFETY_ON_NULL_RETURN_VAL(surface, NULL);
5860 if (!eina_streq(evas_object_type_get(surface), "comp_surface")) abort(); 5782 cs = efl_data_scope_get(surface, EFL_WL_SURFACE_CLASS);
5861 5783 if (!cs) abort();
5862 cs = evas_object_smart_data_get(surface);
5863 EINA_SAFETY_ON_TRUE_RETURN_VAL(!cs->extracted, NULL); 5784 EINA_SAFETY_ON_TRUE_RETURN_VAL(!cs->extracted, NULL);
5864 EINA_SAFETY_ON_TRUE_RETURN_VAL(cs->dead, NULL); 5785 EINA_SAFETY_ON_TRUE_RETURN_VAL(cs->dead, NULL);
5865 5786
@@ -5924,4 +5845,8 @@ efl_wl_seat_key_repeat_set(Eo *obj, Eo *seat, int repeat_rate, int repeat_delay)
5924#define EFL_WL_EXTRA_OPS \ 5845#define EFL_WL_EXTRA_OPS \
5925 EFL_CANVAS_GROUP_ADD_DEL_OPS(efl_wl), \ 5846 EFL_CANVAS_GROUP_ADD_DEL_OPS(efl_wl), \
5926 5847
5848#define EFL_WL_SURFACE_EXTRA_OPS \
5849 EFL_CANVAS_GROUP_ADD_DEL_OPS(efl_wl_surface), \
5850
5927#include "efl_wl.eo.c" 5851#include "efl_wl.eo.c"
5852#include "efl_wl_surface.eo.c"
diff --git a/src/lib/efl_wl/efl_wl.eo b/src/lib/efl_wl/efl_wl.eo
index 1f28738c49..ffd2e9d5c7 100644
--- a/src/lib/efl_wl/efl_wl.eo
+++ b/src/lib/efl_wl/efl_wl.eo
@@ -91,9 +91,9 @@ class @beta Efl.Wl extends Efl.Canvas.Group
91 Efl.Gfx.Entity.scale { get; set; } 91 Efl.Gfx.Entity.scale { get; set; }
92 } 92 }
93 events { 93 events {
94 toplevel,added: Efl.Gfx.Entity; [[]] 94 toplevel,added: Efl.Wl.Surface; [[]]
95 child,added: Efl.Gfx.Entity; [[]] 95 child,added: Efl.Wl.Surface; [[]]
96 popup,added: Efl.Gfx.Entity; [[]] 96 popup,added: Efl.Wl.Surface; [[]]
97 seat,added: Efl.Input.Device; [[The seat object added.]] 97 seat,added: Efl.Input.Device; [[The seat object added.]]
98 } 98 }
99} 99}
diff --git a/src/lib/efl_wl/efl_wl_surface.eo b/src/lib/efl_wl/efl_wl_surface.eo
new file mode 100644
index 0000000000..8f8e44c893
--- /dev/null
+++ b/src/lib/efl_wl/efl_wl_surface.eo
@@ -0,0 +1,22 @@
1class @beta Efl.Wl.Surface extends Efl.Canvas.Group
2{
3 [[@since 1.24]]
4 data: Comp_Surface;
5 methods {
6 extract {
7 return: bool;
8 }
9 @property pid {
10 get {}
11 values {
12 pid: int;
13 }
14 }
15 }
16 implements {
17 Efl.Object.constructor;
18 Efl.Gfx.Entity.visible { set; }
19 Efl.Gfx.Entity.size { set; }
20 Efl.Gfx.Entity.position { set; }
21 }
22}
diff --git a/src/lib/efl_wl/meson.build b/src/lib/efl_wl/meson.build
index 3976b97ab0..ca1a082e36 100644
--- a/src/lib/efl_wl/meson.build
+++ b/src/lib/efl_wl/meson.build
@@ -8,6 +8,7 @@ endif
8 8
9pub_eo_files = [ 9pub_eo_files = [
10 'efl_wl.eo', 10 'efl_wl.eo',
11 'efl_wl_surface.eo',
11] 12]
12 13
13foreach eo_file : pub_eo_files 14foreach eo_file : pub_eo_files