summaryrefslogtreecommitdiff
path: root/src/lib/efl_wl
diff options
context:
space:
mode:
authorMike Blumenkrantz <zmike@osg.samsung.com>2018-01-08 12:53:57 -0500
committerMike Blumenkrantz <zmike@osg.samsung.com>2018-01-10 11:39:52 -0500
commit79ca67d8a53d1d6612af1d1e46771699cb3e3661 (patch)
tree0d61408246580ba1560cc17f12e8b38aa1f03a67 /src/lib/efl_wl
parente2fa576b023da94caa4309c4bfe1e16be4fb7f49 (diff)
efl-wl: move to xdg-shell vfinal
@feature
Diffstat (limited to 'src/lib/efl_wl')
-rw-r--r--src/lib/efl_wl/Efl_Wl.h2
-rw-r--r--src/lib/efl_wl/efl_wl.c217
2 files changed, 123 insertions, 96 deletions
diff --git a/src/lib/efl_wl/Efl_Wl.h b/src/lib/efl_wl/Efl_Wl.h
index c6af024105..1d86093e33 100644
--- a/src/lib/efl_wl/Efl_Wl.h
+++ b/src/lib/efl_wl/Efl_Wl.h
@@ -34,7 +34,7 @@
34/** 34/**
35 * @defgroup Efl_Wl_Group EFL Wayland 35 * @defgroup Efl_Wl_Group EFL Wayland
36 * 36 *
37 * A multiseat Wayland compositor in an Evas object. 37 * A multiseat xdg-shell compliant Wayland compositor in an Evas object.
38 * All toplevel windows will be sized to the size of the compositor object. 38 * All toplevel windows will be sized to the size of the compositor object.
39 * @since 1.20 39 * @since 1.20
40 * @{ 40 * @{
diff --git a/src/lib/efl_wl/efl_wl.c b/src/lib/efl_wl/efl_wl.c
index 0943dbe3f8..5880f62e30 100644
--- a/src/lib/efl_wl/efl_wl.c
+++ b/src/lib/efl_wl/efl_wl.c
@@ -26,7 +26,7 @@
26 * the opaque struct client side. 26 * the opaque struct client side.
27 */ 27 */
28#include <wayland-server.h> 28#include <wayland-server.h>
29#include "xdg-shell-unstable-v6-server-protocol.h" 29#include "xdg-shell-server-protocol.h"
30#include "efl-hints-server-protocol.h" 30#include "efl-hints-server-protocol.h"
31#include "dmabuf.h" 31#include "dmabuf.h"
32 32
@@ -281,9 +281,9 @@ typedef struct Shell_Positioner
281 struct wl_resource *res; 281 struct wl_resource *res;
282 Evas_Coord_Size size; 282 Evas_Coord_Size size;
283 Eina_Rectangle anchor_rect; 283 Eina_Rectangle anchor_rect;
284 enum zxdg_positioner_v6_anchor anchor; 284 enum xdg_positioner_anchor anchor;
285 enum zxdg_positioner_v6_gravity gravity; 285 enum xdg_positioner_gravity gravity;
286 enum zxdg_positioner_v6_constraint_adjustment constrain; 286 enum xdg_positioner_constraint_adjustment constrain;
287 Evas_Coord_Point offset; 287 Evas_Coord_Point offset;
288} Shell_Positioner; 288} Shell_Positioner;
289 289
@@ -734,19 +734,19 @@ resource_destroy(struct wl_client *client EINA_UNUSED, struct wl_resource *resou
734static int 734static int
735_apply_positioner_x(int x, Shell_Positioner *sp, Eina_Bool invert) 735_apply_positioner_x(int x, Shell_Positioner *sp, Eina_Bool invert)
736{ 736{
737 enum zxdg_positioner_v6_anchor an = ZXDG_POSITIONER_V6_ANCHOR_NONE; 737 enum xdg_positioner_anchor an = XDG_POSITIONER_ANCHOR_NONE;
738 enum zxdg_positioner_v6_gravity grav = ZXDG_POSITIONER_V6_GRAVITY_NONE; 738 enum xdg_positioner_gravity grav = XDG_POSITIONER_GRAVITY_NONE;
739 739
740 if (invert) 740 if (invert)
741 { 741 {
742 if (sp->anchor & ZXDG_POSITIONER_V6_ANCHOR_LEFT) 742 if (sp->anchor == XDG_POSITIONER_ANCHOR_LEFT)
743 an |= ZXDG_POSITIONER_V6_ANCHOR_RIGHT; 743 an = XDG_POSITIONER_ANCHOR_RIGHT;
744 else if (sp->anchor & ZXDG_POSITIONER_V6_ANCHOR_RIGHT) 744 else if (sp->anchor == XDG_POSITIONER_ANCHOR_RIGHT)
745 an |= ZXDG_POSITIONER_V6_ANCHOR_LEFT; 745 an = XDG_POSITIONER_ANCHOR_LEFT;
746 if (sp->gravity & ZXDG_POSITIONER_V6_GRAVITY_LEFT) 746 if (sp->gravity & XDG_POSITIONER_GRAVITY_LEFT)
747 grav |= ZXDG_POSITIONER_V6_GRAVITY_RIGHT; 747 grav |= XDG_POSITIONER_GRAVITY_RIGHT;
748 else if (sp->gravity & ZXDG_POSITIONER_V6_GRAVITY_RIGHT) 748 else if (sp->gravity & XDG_POSITIONER_GRAVITY_RIGHT)
749 grav |= ZXDG_POSITIONER_V6_GRAVITY_LEFT; 749 grav |= XDG_POSITIONER_GRAVITY_LEFT;
750 } 750 }
751 else 751 else
752 { 752 {
@@ -755,20 +755,20 @@ _apply_positioner_x(int x, Shell_Positioner *sp, Eina_Bool invert)
755 } 755 }
756 756
757 /* left edge */ 757 /* left edge */
758 if (an & ZXDG_POSITIONER_V6_ANCHOR_LEFT) 758 if (an == XDG_POSITIONER_ANCHOR_LEFT)
759 x += sp->anchor_rect.x; 759 x += sp->anchor_rect.x;
760 /* right edge */ 760 /* right edge */
761 else if (an & ZXDG_POSITIONER_V6_ANCHOR_RIGHT) 761 else if (an == XDG_POSITIONER_ANCHOR_RIGHT)
762 x += sp->anchor_rect.x + sp->anchor_rect.w; 762 x += sp->anchor_rect.x + sp->anchor_rect.w;
763 /* center */ 763 /* center */
764 else 764 else
765 x += sp->anchor_rect.x + (sp->anchor_rect.w / 2); 765 x += sp->anchor_rect.x + (sp->anchor_rect.w / 2);
766 766
767 /* flip left over anchor */ 767 /* flip left over anchor */
768 if (grav & ZXDG_POSITIONER_V6_GRAVITY_LEFT) 768 if (grav & XDG_POSITIONER_GRAVITY_LEFT)
769 x -= sp->size.w; 769 x -= sp->size.w;
770 /* center on anchor */ 770 /* center on anchor */
771 else if (!(grav & ZXDG_POSITIONER_V6_GRAVITY_RIGHT)) 771 else if (!(grav & XDG_POSITIONER_GRAVITY_RIGHT))
772 x -= sp->size.w / 2; 772 x -= sp->size.w / 2;
773 return x; 773 return x;
774} 774}
@@ -776,19 +776,19 @@ _apply_positioner_x(int x, Shell_Positioner *sp, Eina_Bool invert)
776static int 776static int
777_apply_positioner_y(int y, Shell_Positioner *sp, Eina_Bool invert) 777_apply_positioner_y(int y, Shell_Positioner *sp, Eina_Bool invert)
778{ 778{
779 enum zxdg_positioner_v6_anchor an = ZXDG_POSITIONER_V6_ANCHOR_NONE; 779 enum xdg_positioner_anchor an = XDG_POSITIONER_ANCHOR_NONE;
780 enum zxdg_positioner_v6_gravity grav = ZXDG_POSITIONER_V6_GRAVITY_NONE; 780 enum xdg_positioner_gravity grav = XDG_POSITIONER_GRAVITY_NONE;
781 781
782 if (invert) 782 if (invert)
783 { 783 {
784 if (sp->anchor & ZXDG_POSITIONER_V6_ANCHOR_TOP) 784 if (sp->anchor == XDG_POSITIONER_ANCHOR_TOP)
785 an |= ZXDG_POSITIONER_V6_ANCHOR_BOTTOM; 785 an = XDG_POSITIONER_ANCHOR_BOTTOM;
786 else if (sp->anchor & ZXDG_POSITIONER_V6_ANCHOR_BOTTOM) 786 else if (sp->anchor == XDG_POSITIONER_ANCHOR_BOTTOM)
787 an |= ZXDG_POSITIONER_V6_ANCHOR_TOP; 787 an = XDG_POSITIONER_ANCHOR_TOP;
788 if (sp->gravity & ZXDG_POSITIONER_V6_GRAVITY_TOP) 788 if (sp->gravity & XDG_POSITIONER_GRAVITY_TOP)
789 grav |= ZXDG_POSITIONER_V6_GRAVITY_BOTTOM; 789 grav |= XDG_POSITIONER_GRAVITY_BOTTOM;
790 else if (sp->gravity & ZXDG_POSITIONER_V6_GRAVITY_BOTTOM) 790 else if (sp->gravity & XDG_POSITIONER_GRAVITY_BOTTOM)
791 grav |= ZXDG_POSITIONER_V6_GRAVITY_TOP; 791 grav |= XDG_POSITIONER_GRAVITY_TOP;
792 } 792 }
793 else 793 else
794 { 794 {
@@ -797,20 +797,20 @@ _apply_positioner_y(int y, Shell_Positioner *sp, Eina_Bool invert)
797 } 797 }
798 798
799 /* up edge */ 799 /* up edge */
800 if (an & ZXDG_POSITIONER_V6_ANCHOR_TOP) 800 if (an == XDG_POSITIONER_ANCHOR_TOP)
801 y += sp->anchor_rect.y; 801 y += sp->anchor_rect.y;
802 /* bottom edge */ 802 /* bottom edge */
803 else if (an & ZXDG_POSITIONER_V6_ANCHOR_BOTTOM) 803 else if (an == XDG_POSITIONER_ANCHOR_BOTTOM)
804 y += sp->anchor_rect.y + sp->anchor_rect.h; 804 y += sp->anchor_rect.y + sp->anchor_rect.h;
805 /* center */ 805 /* center */
806 else 806 else
807 y += sp->anchor_rect.y + (sp->anchor_rect.h / 2); 807 y += sp->anchor_rect.y + (sp->anchor_rect.h / 2);
808 808
809 /* flip up over anchor */ 809 /* flip up over anchor */
810 if (grav & ZXDG_POSITIONER_V6_GRAVITY_TOP) 810 if (grav & XDG_POSITIONER_GRAVITY_TOP)
811 y -= sp->size.h; 811 y -= sp->size.h;
812 /* center on anchor */ 812 /* center on anchor */
813 else if (!(grav & ZXDG_POSITIONER_V6_GRAVITY_BOTTOM)) 813 else if (!(grav & XDG_POSITIONER_GRAVITY_BOTTOM))
814 y -= sp->size.h / 2; 814 y -= sp->size.h / 2;
815 return y; 815 return y;
816} 816}
@@ -823,19 +823,19 @@ _apply_positioner_slide(Comp_Surface *cs, Shell_Positioner *sp, int *x, int *y,
823 evas_object_geometry_get(cs->parent->obj, &px, &py, NULL, NULL); 823 evas_object_geometry_get(cs->parent->obj, &px, &py, NULL, NULL);
824 evas_object_geometry_get(cs->c->obj, &cx, &cy, NULL, NULL); 824 evas_object_geometry_get(cs->c->obj, &cx, &cy, NULL, NULL);
825 px -= cx, py -= cy; 825 px -= cx, py -= cy;
826 if ((sp->constrain & ZXDG_POSITIONER_V6_CONSTRAINT_ADJUSTMENT_SLIDE_X) && 826 if ((sp->constrain & XDG_POSITIONER_CONSTRAINT_ADJUSTMENT_SLIDE_X) &&
827 (!CONTAINS(zx, zy, zw, zh, *x, zy, *w, 1))) 827 (!CONTAINS(zx, zy, zw, zh, *x, zy, *w, 1)))
828 { 828 {
829 int sx = *x; 829 int sx = *x;
830 830
831 if (sp->gravity & ZXDG_POSITIONER_V6_GRAVITY_LEFT) 831 if (sp->gravity & XDG_POSITIONER_GRAVITY_LEFT)
832 { 832 {
833 if (*x + *w > zx + zw) 833 if (*x + *w > zx + zw)
834 sx = MAX(zx + zw - *w, px + sp->anchor_rect.x - *w); 834 sx = MAX(zx + zw - *w, px + sp->anchor_rect.x - *w);
835 else if (*x < zx) 835 else if (*x < zx)
836 sx = MIN(zx, px + sp->anchor_rect.x + sp->anchor_rect.w); 836 sx = MIN(zx, px + sp->anchor_rect.x + sp->anchor_rect.w);
837 } 837 }
838 else if (sp->gravity & ZXDG_POSITIONER_V6_GRAVITY_RIGHT) 838 else if (sp->gravity & XDG_POSITIONER_GRAVITY_RIGHT)
839 { 839 {
840 if (*x < zx) 840 if (*x < zx)
841 sx = MIN(zx, *x + sp->anchor_rect.x + sp->anchor_rect.w); 841 sx = MIN(zx, *x + sp->anchor_rect.x + sp->anchor_rect.w);
@@ -846,19 +846,19 @@ _apply_positioner_slide(Comp_Surface *cs, Shell_Positioner *sp, int *x, int *y,
846 *x = sx; 846 *x = sx;
847 } 847 }
848 if (!CONSTRAINED(*w, *h, *x, *y)) return EINA_TRUE; 848 if (!CONSTRAINED(*w, *h, *x, *y)) return EINA_TRUE;
849 if ((sp->constrain & ZXDG_POSITIONER_V6_CONSTRAINT_ADJUSTMENT_SLIDE_Y) && 849 if ((sp->constrain & XDG_POSITIONER_CONSTRAINT_ADJUSTMENT_SLIDE_Y) &&
850 (!CONTAINS(zx, zy, zw, zh, zx, *y, 1, *h))) 850 (!CONTAINS(zx, zy, zw, zh, zx, *y, 1, *h)))
851 { 851 {
852 int sy = *y; 852 int sy = *y;
853 853
854 if (sp->gravity & ZXDG_POSITIONER_V6_GRAVITY_TOP) 854 if (sp->gravity & XDG_POSITIONER_GRAVITY_TOP)
855 { 855 {
856 if (*y + *h > zy + zh) 856 if (*y + *h > zy + zh)
857 sy = MAX(zy + zh - *h, py + sp->anchor_rect.y - *h); 857 sy = MAX(zy + zh - *h, py + sp->anchor_rect.y - *h);
858 else if (*y < zy) 858 else if (*y < zy)
859 sy = MIN(zy, py + sp->anchor_rect.y + sp->anchor_rect.h); 859 sy = MIN(zy, py + sp->anchor_rect.y + sp->anchor_rect.h);
860 } 860 }
861 else if (sp->gravity & ZXDG_POSITIONER_V6_GRAVITY_BOTTOM) 861 else if (sp->gravity & XDG_POSITIONER_GRAVITY_BOTTOM)
862 { 862 {
863 if (*y < zy) 863 if (*y < zy)
864 sy = MIN(zy, py + sp->anchor_rect.y + sp->anchor_rect.h); 864 sy = MIN(zy, py + sp->anchor_rect.y + sp->anchor_rect.h);
@@ -913,7 +913,7 @@ _apply_positioner(Comp_Surface *cs, Shell_Positioner *sp)
913 - slide 913 - slide
914 - resize 914 - resize
915 */ 915 */
916 if ((sp->constrain & ZXDG_POSITIONER_V6_CONSTRAINT_ADJUSTMENT_FLIP_X) && 916 if ((sp->constrain & XDG_POSITIONER_CONSTRAINT_ADJUSTMENT_FLIP_X) &&
917 (!CONTAINS(zx, zy, zw, zh, x, zy, w, 1))) 917 (!CONTAINS(zx, zy, zw, zh, x, zy, w, 1)))
918 { 918 {
919 int fx; 919 int fx;
@@ -928,7 +928,7 @@ _apply_positioner(Comp_Surface *cs, Shell_Positioner *sp)
928 if (w > 0) evas_object_resize(cs->obj, w, h); 928 if (w > 0) evas_object_resize(cs->obj, w, h);
929 return; 929 return;
930 } 930 }
931 if ((sp->constrain & ZXDG_POSITIONER_V6_CONSTRAINT_ADJUSTMENT_FLIP_Y) && 931 if ((sp->constrain & XDG_POSITIONER_CONSTRAINT_ADJUSTMENT_FLIP_Y) &&
932 (!CONTAINS(zx, zy, zw, zh, zx, y, 1, h))) 932 (!CONTAINS(zx, zy, zw, zh, zx, y, 1, h)))
933 { 933 {
934 int fy; 934 int fy;
@@ -957,7 +957,7 @@ _apply_positioner(Comp_Surface *cs, Shell_Positioner *sp)
957 return; 957 return;
958 } 958 }
959 959
960 if ((sp->constrain & ZXDG_POSITIONER_V6_CONSTRAINT_ADJUSTMENT_RESIZE_X) && 960 if ((sp->constrain & XDG_POSITIONER_CONSTRAINT_ADJUSTMENT_RESIZE_X) &&
961 (!CONTAINS(zx, zy, zw, zh, x, zy, w, 1))) 961 (!CONTAINS(zx, zy, zw, zh, x, zy, w, 1)))
962 { 962 {
963 w = zx + zw - x; 963 w = zx + zw - x;
@@ -968,7 +968,7 @@ _apply_positioner(Comp_Surface *cs, Shell_Positioner *sp)
968 return; 968 return;
969 } 969 }
970 } 970 }
971 if ((sp->constrain & ZXDG_POSITIONER_V6_CONSTRAINT_ADJUSTMENT_RESIZE_Y) && 971 if ((sp->constrain & XDG_POSITIONER_CONSTRAINT_ADJUSTMENT_RESIZE_Y) &&
972 (!CONTAINS(zx, zy, zw, zh, zx, y, 1, h))) 972 (!CONTAINS(zx, zy, zw, zh, zx, y, 1, h)))
973 { 973 {
974 h = zy + zh - y; 974 h = zy + zh - y;
@@ -1225,17 +1225,17 @@ shell_surface_send_configure(Comp_Surface *cs)
1225 evas_object_geometry_get(cs->obj, &x, &y, &w, &h); 1225 evas_object_geometry_get(cs->obj, &x, &y, &w, &h);
1226 evas_object_geometry_get(cs->parent->obj, &px, &py, NULL, NULL); 1226 evas_object_geometry_get(cs->parent->obj, &px, &py, NULL, NULL);
1227 serial = wl_display_next_serial(cs->c->display); 1227 serial = wl_display_next_serial(cs->c->display);
1228 zxdg_popup_v6_send_configure(cs->role, x - px, y - py, w, h); 1228 xdg_popup_send_configure(cs->role, x - px, y - py, w, h);
1229 zxdg_surface_v6_send_configure(cs->shell.surface, serial); 1229 xdg_surface_send_configure(cs->shell.surface, serial);
1230 return; 1230 return;
1231 } 1231 }
1232 wl_array_init(&states); 1232 wl_array_init(&states);
1233 s = wl_array_add(&states, sizeof(uint32_t)); 1233 s = wl_array_add(&states, sizeof(uint32_t));
1234 *s = ZXDG_TOPLEVEL_V6_STATE_FULLSCREEN; 1234 *s = XDG_TOPLEVEL_STATE_FULLSCREEN;
1235 if (cs->shell.activated) 1235 if (cs->shell.activated)
1236 { 1236 {
1237 s = wl_array_add(&states, sizeof(uint32_t)); 1237 s = wl_array_add(&states, sizeof(uint32_t));
1238 *s = ZXDG_TOPLEVEL_V6_STATE_ACTIVATED; 1238 *s = XDG_TOPLEVEL_STATE_ACTIVATED;
1239 if (!cs->extracted) 1239 if (!cs->extracted)
1240 evas_object_raise(cs->obj); 1240 evas_object_raise(cs->obj);
1241 if (cs->parent) 1241 if (cs->parent)
@@ -1249,8 +1249,8 @@ shell_surface_send_configure(Comp_Surface *cs)
1249 evas_object_geometry_get(cs->obj, NULL, NULL, &w, &h); 1249 evas_object_geometry_get(cs->obj, NULL, NULL, &w, &h);
1250 else 1250 else
1251 evas_object_geometry_get(cs->c->clip, NULL, NULL, &w, &h); 1251 evas_object_geometry_get(cs->c->clip, NULL, NULL, &w, &h);
1252 zxdg_toplevel_v6_send_configure(cs->role, w, h, &states); 1252 xdg_toplevel_send_configure(cs->role, w, h, &states);
1253 zxdg_surface_v6_send_configure(cs->shell.surface, serial); 1253 xdg_surface_send_configure(cs->shell.surface, serial);
1254 wl_array_release(&states); 1254 wl_array_release(&states);
1255 if (cs->shell.activated) 1255 if (cs->shell.activated)
1256 { 1256 {
@@ -1381,6 +1381,15 @@ comp_surface_commit_image_state(Comp_Surface *cs, Comp_Buffer *buffer, Evas_Obje
1381} 1381}
1382 1382
1383static void 1383static void
1384shell_surface_reset(Comp_Surface *cs)
1385{
1386 EINA_RECTANGLE_SET(&cs->shell.geom, 0, 0, 0, 0);
1387 eina_stringshare_replace(&cs->shell.title, NULL);
1388 eina_stringshare_replace(&cs->shell.app_id, NULL);
1389 cs->shell.activated = 0;
1390}
1391
1392static void
1384comp_surface_commit_state(Comp_Surface *cs, Comp_Buffer_State *state) 1393comp_surface_commit_state(Comp_Surface *cs, Comp_Buffer_State *state)
1385{ 1394{
1386 int x, y; 1395 int x, y;
@@ -1406,6 +1415,11 @@ comp_surface_commit_state(Comp_Surface *cs, Comp_Buffer_State *state)
1406 evas_object_hide(cs->obj); 1415 evas_object_hide(cs->obj);
1407 EINA_LIST_FOREACH(cs->proxies, l, o) 1416 EINA_LIST_FOREACH(cs->proxies, l, o)
1408 evas_object_hide(o); 1417 evas_object_hide(o);
1418 if (cs->shell.surface)
1419 {
1420 cs->shell.new = 1;
1421 shell_surface_reset(cs);
1422 }
1409 } 1423 }
1410 } 1424 }
1411 evas_object_geometry_get(cs->obj, &x, &y, NULL, NULL); 1425 evas_object_geometry_get(cs->obj, &x, &y, NULL, NULL);
@@ -1606,6 +1620,13 @@ comp_surface_attach(struct wl_client *client EINA_UNUSED, struct wl_resource *re
1606 struct wl_shm_buffer *shmbuff; 1620 struct wl_shm_buffer *shmbuff;
1607 struct linux_dmabuf_buffer *dmabuf; 1621 struct linux_dmabuf_buffer *dmabuf;
1608 1622
1623 if (cs->shell.new)
1624 {
1625 wl_resource_post_error(cs->shell.surface, XDG_SURFACE_ERROR_UNCONFIGURED_BUFFER,
1626 "buffer attached/committed before configure");
1627 return;
1628 }
1629
1609 comp_surface_buffer_detach(&cs->pending.buffer); 1630 comp_surface_buffer_detach(&cs->pending.buffer);
1610 cs->pending.attach = 1; 1631 cs->pending.attach = 1;
1611 if (!buffer_resource) return; 1632 if (!buffer_resource) return;
@@ -1752,6 +1773,13 @@ comp_surface_commit(struct wl_client *client, struct wl_resource *resource)
1752 Eina_List *l; 1773 Eina_List *l;
1753 Comp_Buffer_State *cbs = &cs->pending; 1774 Comp_Buffer_State *cbs = &cs->pending;
1754 1775
1776 if (cs->shell.popup && (!cs->parent))
1777 {
1778 wl_resource_post_error(cs->shell.surface, XDG_WM_BASE_ERROR_INVALID_POPUP_PARENT,
1779 "popup surface has no parent");
1780 return;
1781 }
1782
1755 cs->commit = 1; 1783 cs->commit = 1;
1756 if (cs->subsurface) 1784 if (cs->subsurface)
1757 { 1785 {
@@ -2368,7 +2396,7 @@ comp_surface_smart_hide(Evas_Object *obj)
2368 if (!cs->shell.activated) return; 2396 if (!cs->shell.activated) return;
2369 cs->shell.activated = 0; 2397 cs->shell.activated = 0;
2370 if (cs->shell.popup && cs->role) 2398 if (cs->shell.popup && cs->role)
2371 zxdg_popup_v6_send_popup_done(cs->role); 2399 xdg_popup_send_popup_done(cs->role);
2372 if (cs->parent && cs->shell.popup) return; 2400 if (cs->parent && cs->shell.popup) return;
2373 /* attempt to revert focus based on stacking order */ 2401 /* attempt to revert focus based on stacking order */
2374 if (cs->parent) 2402 if (cs->parent)
@@ -3092,6 +3120,7 @@ shell_surface_toplevel_impl_destroy(struct wl_resource *resource)
3092 3120
3093 cs->role = NULL; 3121 cs->role = NULL;
3094 evas_object_hide(cs->obj); 3122 evas_object_hide(cs->obj);
3123 shell_surface_reset(cs);
3095 if (!cs->parent) return; 3124 if (!cs->parent) return;
3096 comp_surface_reparent(cs, NULL); 3125 comp_surface_reparent(cs, NULL);
3097} 3126}
@@ -3160,7 +3189,7 @@ shell_surface_toplevel_unset_fullscreen(){}
3160static void 3189static void
3161shell_surface_toplevel_set_minimized(){} 3190shell_surface_toplevel_set_minimized(){}
3162 3191
3163static const struct zxdg_toplevel_v6_interface shell_surface_toplevel_interface = 3192static const struct xdg_toplevel_interface shell_surface_toplevel_interface =
3164{ 3193{
3165 resource_destroy, 3194 resource_destroy,
3166 shell_surface_toplevel_set_parent, 3195 shell_surface_toplevel_set_parent,
@@ -3185,18 +3214,18 @@ shell_surface_toplevel_create(struct wl_client *client EINA_UNUSED, struct wl_re
3185 3214
3186 if (cs->buffer[0] || cs->pending.buffer) 3215 if (cs->buffer[0] || cs->pending.buffer)
3187 { 3216 {
3188 wl_resource_post_error(resource, ZXDG_SURFACE_V6_ERROR_UNCONFIGURED_BUFFER, 3217 wl_resource_post_error(resource, XDG_SURFACE_ERROR_UNCONFIGURED_BUFFER,
3189 "buffer attached/committed before configure"); 3218 "buffer attached/committed before configure");
3190 return; 3219 return;
3191 } 3220 }
3192 if (cs->role) 3221 if (cs->role)
3193 { 3222 {
3194 wl_resource_post_error(resource, ZXDG_SHELL_V6_ERROR_ROLE, 3223 wl_resource_post_error(resource, XDG_WM_BASE_ERROR_ROLE,
3195 "surface already has assigned role"); 3224 "surface already has assigned role");
3196 return; 3225 return;
3197 } 3226 }
3198 3227
3199 cs->role = wl_resource_create(client, &zxdg_toplevel_v6_interface, 1, id); 3228 cs->role = wl_resource_create(client, &xdg_toplevel_interface, 1, id);
3200 wl_resource_set_implementation(cs->role, &shell_surface_toplevel_interface, cs, shell_surface_toplevel_impl_destroy); 3229 wl_resource_set_implementation(cs->role, &shell_surface_toplevel_interface, cs, shell_surface_toplevel_impl_destroy);
3201 cs->shell.new = 1; 3230 cs->shell.new = 1;
3202} 3231}
@@ -3214,14 +3243,14 @@ shell_surface_popup_grab(struct wl_client *client EINA_UNUSED, struct wl_resourc
3214 } 3243 }
3215 if (cs->mapped) 3244 if (cs->mapped)
3216 { 3245 {
3217 wl_resource_post_error(resource, ZXDG_POPUP_V6_ERROR_INVALID_GRAB, 3246 wl_resource_post_error(resource, XDG_POPUP_ERROR_INVALID_GRAB,
3218 "grab requested on mapped popup"); 3247 "grab requested on mapped popup");
3219 return; 3248 return;
3220 } 3249 }
3221 3250
3222 if (cs->parent->shell.popup && (s->grab != cs->parent)) 3251 if (cs->parent->shell.popup && (s->grab != cs->parent))
3223 { 3252 {
3224 wl_resource_post_error(resource, ZXDG_POPUP_V6_ERROR_INVALID_GRAB, 3253 wl_resource_post_error(resource, XDG_POPUP_ERROR_INVALID_GRAB,
3225 "grab requested on ungrabbed nested popup"); 3254 "grab requested on ungrabbed nested popup");
3226 return; 3255 return;
3227 } 3256 }
@@ -3229,7 +3258,7 @@ shell_surface_popup_grab(struct wl_client *client EINA_UNUSED, struct wl_resourc
3229 cs->shell.grabs = eina_list_append(cs->shell.grabs, s); 3258 cs->shell.grabs = eina_list_append(cs->shell.grabs, s);
3230} 3259}
3231 3260
3232static const struct zxdg_popup_v6_interface shell_surface_popup_interface = 3261static const struct xdg_popup_interface shell_surface_popup_interface =
3233{ 3262{
3234 resource_destroy, 3263 resource_destroy,
3235 shell_surface_popup_grab, 3264 shell_surface_popup_grab,
@@ -3244,6 +3273,7 @@ shell_surface_popup_impl_destroy(struct wl_resource *resource)
3244 cs->role = NULL; 3273 cs->role = NULL;
3245 evas_object_hide(cs->obj); 3274 evas_object_hide(cs->obj);
3246 cs->shell.popup = 0; 3275 cs->shell.popup = 0;
3276 shell_surface_reset(cs);
3247 EINA_LIST_FREE(cs->shell.grabs, s) 3277 EINA_LIST_FREE(cs->shell.grabs, s)
3248 if (s->grab == cs) 3278 if (s->grab == cs)
3249 { 3279 {
@@ -3254,7 +3284,7 @@ shell_surface_popup_impl_destroy(struct wl_resource *resource)
3254 s->grab = NULL; 3284 s->grab = NULL;
3255 } 3285 }
3256 if (cs->children) 3286 if (cs->children)
3257 wl_resource_post_error(cs->shell.surface, ZXDG_SHELL_V6_ERROR_DEFUNCT_SURFACES, 3287 wl_resource_post_error(cs->shell.surface, XDG_WM_BASE_ERROR_DEFUNCT_SURFACES,
3258 "popups dismissed out of order"); 3288 "popups dismissed out of order");
3259 if (cs->parent) 3289 if (cs->parent)
3260 comp_surface_reparent(cs, NULL); 3290 comp_surface_reparent(cs, NULL);
@@ -3267,28 +3297,23 @@ shell_surface_popup_create(struct wl_client *client, struct wl_resource *resourc
3267 3297
3268 if (cs->buffer[0] || cs->pending.buffer) 3298 if (cs->buffer[0] || cs->pending.buffer)
3269 { 3299 {
3270 wl_resource_post_error(resource, ZXDG_SURFACE_V6_ERROR_UNCONFIGURED_BUFFER, 3300 wl_resource_post_error(resource, XDG_SURFACE_ERROR_UNCONFIGURED_BUFFER,
3271 "buffer attached/committed before configure"); 3301 "buffer attached/committed before configure");
3272 return; 3302 return;
3273 } 3303 }
3274 if (cs->role) 3304 if (cs->role)
3275 { 3305 {
3276 wl_resource_post_error(resource, ZXDG_SHELL_V6_ERROR_ROLE, 3306 wl_resource_post_error(resource, XDG_WM_BASE_ERROR_ROLE,
3277 "surface already has assigned role"); 3307 "surface already has assigned role");
3278 return; 3308 return;
3279 } 3309 }
3280 if (!parent_resource)
3281 {
3282 wl_resource_post_error(resource, ZXDG_SHELL_V6_ERROR_INVALID_POPUP_PARENT,
3283 "popup surface has no parent");
3284 return;
3285 }
3286 3310
3287 cs->role = wl_resource_create(client, &zxdg_popup_v6_interface, 1, id); 3311 cs->role = wl_resource_create(client, &xdg_popup_interface, 1, id);
3288 wl_resource_set_implementation(cs->role, &shell_surface_popup_interface, cs, shell_surface_popup_impl_destroy); 3312 wl_resource_set_implementation(cs->role, &shell_surface_popup_interface, cs, shell_surface_popup_impl_destroy);
3289 cs->shell.new = 1; 3313 cs->shell.new = 1;
3290 cs->shell.popup = 1; 3314 cs->shell.popup = 1;
3291 comp_surface_reparent(cs, wl_resource_get_user_data(parent_resource)); 3315 if(parent_resource)
3316 comp_surface_reparent(cs, wl_resource_get_user_data(parent_resource));
3292 cs->shell.positioner = wl_resource_get_user_data(positioner_resource); 3317 cs->shell.positioner = wl_resource_get_user_data(positioner_resource);
3293 _apply_positioner(cs, cs->shell.positioner); 3318 _apply_positioner(cs, cs->shell.positioner);
3294 evas_object_smart_callback_call(cs->c->obj, "popup_added", cs->obj); 3319 evas_object_smart_callback_call(cs->c->obj, "popup_added", cs->obj);
@@ -3298,7 +3323,14 @@ static void
3298_validate_size(struct wl_resource *resource, int32_t value) 3323_validate_size(struct wl_resource *resource, int32_t value)
3299{ 3324{
3300 if (value <= 0) 3325 if (value <= 0)
3301 wl_resource_post_error(resource, ZXDG_POSITIONER_V6_ERROR_INVALID_INPUT, "Invalid size passed"); 3326 wl_resource_post_error(resource, XDG_POSITIONER_ERROR_INVALID_INPUT, "Invalid size passed");
3327}
3328
3329static void
3330_validate_size_negative(struct wl_resource *resource, int32_t value)
3331{
3332 if (value < 0)
3333 wl_resource_post_error(resource, XDG_POSITIONER_ERROR_INVALID_INPUT, "Invalid size passed");
3302} 3334}
3303 3335
3304static void 3336static void
@@ -3318,44 +3350,37 @@ shell_positioner_set_anchor_rect(struct wl_client *wl_client EINA_UNUSED, struct
3318{ 3350{
3319 Shell_Positioner *p = wl_resource_get_user_data(resource); 3351 Shell_Positioner *p = wl_resource_get_user_data(resource);
3320 3352
3321 _validate_size(resource, w); 3353 _validate_size_negative(resource, w);
3322 _validate_size(resource, h); 3354 _validate_size_negative(resource, h);
3323 3355
3324 EINA_RECTANGLE_SET(&p->anchor_rect, x, y, w, h); 3356 EINA_RECTANGLE_SET(&p->anchor_rect, x, y, w, h);
3325} 3357}
3326 3358
3327static void 3359static void
3328shell_positioner_set_anchor(struct wl_client *wl_client EINA_UNUSED, struct wl_resource *resource, enum zxdg_positioner_v6_anchor anchor) 3360shell_positioner_set_anchor(struct wl_client *wl_client EINA_UNUSED, struct wl_resource *resource, enum xdg_positioner_anchor anchor)
3329{ 3361{
3330 Shell_Positioner *p = wl_resource_get_user_data(resource); 3362 Shell_Positioner *p = wl_resource_get_user_data(resource);
3331 3363
3332 if ((anchor & (ZXDG_POSITIONER_V6_ANCHOR_TOP | ZXDG_POSITIONER_V6_ANCHOR_BOTTOM)) == 3364 p->anchor = anchor;
3333 (ZXDG_POSITIONER_V6_ANCHOR_TOP | ZXDG_POSITIONER_V6_ANCHOR_BOTTOM))
3334 wl_resource_post_error(resource, ZXDG_POSITIONER_V6_ERROR_INVALID_INPUT, "Invalid anchor values passed");
3335 else if ((anchor & (ZXDG_POSITIONER_V6_ANCHOR_LEFT | ZXDG_POSITIONER_V6_ANCHOR_RIGHT)) ==
3336 (ZXDG_POSITIONER_V6_ANCHOR_LEFT | ZXDG_POSITIONER_V6_ANCHOR_RIGHT))
3337 wl_resource_post_error(resource, ZXDG_POSITIONER_V6_ERROR_INVALID_INPUT, "Invalid anchor values passed");
3338 else
3339 p->anchor = anchor;
3340} 3365}
3341 3366
3342static void 3367static void
3343shell_positioner_set_gravity(struct wl_client *wl_client EINA_UNUSED, struct wl_resource *resource, enum zxdg_positioner_v6_gravity gravity) 3368shell_positioner_set_gravity(struct wl_client *wl_client EINA_UNUSED, struct wl_resource *resource, enum xdg_positioner_gravity gravity)
3344{ 3369{
3345 Shell_Positioner *p = wl_resource_get_user_data(resource); 3370 Shell_Positioner *p = wl_resource_get_user_data(resource);
3346 3371
3347 if ((gravity & (ZXDG_POSITIONER_V6_GRAVITY_TOP | ZXDG_POSITIONER_V6_GRAVITY_BOTTOM)) == 3372 if ((gravity & (XDG_POSITIONER_GRAVITY_TOP | XDG_POSITIONER_GRAVITY_BOTTOM)) ==
3348 (ZXDG_POSITIONER_V6_GRAVITY_TOP | ZXDG_POSITIONER_V6_GRAVITY_BOTTOM)) 3373 (XDG_POSITIONER_GRAVITY_TOP | XDG_POSITIONER_GRAVITY_BOTTOM))
3349 wl_resource_post_error(resource, ZXDG_POSITIONER_V6_ERROR_INVALID_INPUT, "Invalid gravity values passed"); 3374 wl_resource_post_error(resource, XDG_POSITIONER_ERROR_INVALID_INPUT, "Invalid gravity values passed");
3350 else if ((gravity & (ZXDG_POSITIONER_V6_GRAVITY_LEFT | ZXDG_POSITIONER_V6_GRAVITY_RIGHT)) == 3375 else if ((gravity & (XDG_POSITIONER_GRAVITY_LEFT | XDG_POSITIONER_GRAVITY_RIGHT)) ==
3351 (ZXDG_POSITIONER_V6_GRAVITY_LEFT | ZXDG_POSITIONER_V6_GRAVITY_RIGHT)) 3376 (XDG_POSITIONER_GRAVITY_LEFT | XDG_POSITIONER_GRAVITY_RIGHT))
3352 wl_resource_post_error(resource, ZXDG_POSITIONER_V6_ERROR_INVALID_INPUT, "Invalid gravity values passed"); 3377 wl_resource_post_error(resource, XDG_POSITIONER_ERROR_INVALID_INPUT, "Invalid gravity values passed");
3353 else 3378 else
3354 p->gravity = gravity; 3379 p->gravity = gravity;
3355} 3380}
3356 3381
3357static void 3382static void
3358shell_positioner_set_constraint_adjustment(struct wl_client *wl_client EINA_UNUSED, struct wl_resource *resource, enum zxdg_positioner_v6_constraint_adjustment constraint_adjustment) 3383shell_positioner_set_constraint_adjustment(struct wl_client *wl_client EINA_UNUSED, struct wl_resource *resource, enum xdg_positioner_constraint_adjustment constraint_adjustment)
3359{ 3384{
3360 Shell_Positioner *p = wl_resource_get_user_data(resource); 3385 Shell_Positioner *p = wl_resource_get_user_data(resource);
3361 3386
@@ -3371,7 +3396,7 @@ shell_positioner_set_offset(struct wl_client *client EINA_UNUSED, struct wl_reso
3371 p->offset.y = y; 3396 p->offset.y = y;
3372} 3397}
3373 3398
3374static const struct zxdg_positioner_v6_interface shell_positioner_interface = 3399static const struct xdg_positioner_interface shell_positioner_interface =
3375{ 3400{
3376 resource_destroy, 3401 resource_destroy,
3377 shell_positioner_set_size, 3402 shell_positioner_set_size,
@@ -3401,8 +3426,9 @@ shell_positioner_create(struct wl_client *client, struct wl_resource *resource,
3401 Shell_Positioner *sp; 3426 Shell_Positioner *sp;
3402 3427
3403 sd = wl_resource_get_user_data(resource); 3428 sd = wl_resource_get_user_data(resource);
3404 res = wl_resource_create(client, &zxdg_positioner_v6_interface, 1, id); 3429 res = wl_resource_create(client, &xdg_positioner_interface, 1, id);
3405 sp = calloc(1, sizeof(Shell_Positioner)); 3430 sp = calloc(1, sizeof(Shell_Positioner));
3431 sp->anchor_rect.w = sp->anchor_rect.h = -1;
3406 sp->sd = sd; 3432 sp->sd = sd;
3407 sp->res = res; 3433 sp->res = res;
3408 sd->positioners = eina_inlist_append(sd->positioners, EINA_INLIST_GET(sp)); 3434 sd->positioners = eina_inlist_append(sd->positioners, EINA_INLIST_GET(sp));
@@ -3422,7 +3448,7 @@ shell_surface_ack_configure(struct wl_client *client EINA_UNUSED, struct wl_reso
3422{ 3448{
3423} 3449}
3424 3450
3425static const struct zxdg_surface_v6_interface shell_surface_interface = 3451static const struct xdg_surface_interface shell_surface_interface =
3426{ 3452{
3427 resource_destroy, 3453 resource_destroy,
3428 shell_surface_toplevel_create, 3454 shell_surface_toplevel_create,
@@ -3438,12 +3464,13 @@ shell_surface_impl_destroy(struct wl_resource *resource)
3438 3464
3439 if (cs->role) 3465 if (cs->role)
3440 { 3466 {
3441 wl_resource_post_error(resource, ZXDG_SHELL_V6_ERROR_DEFUNCT_SURFACES, "shell surface destroyed before role surfaces"); 3467 wl_resource_post_error(resource, XDG_WM_BASE_ERROR_DEFUNCT_SURFACES, "shell surface destroyed before role surfaces");
3442 wl_resource_destroy(cs->role); 3468 wl_resource_destroy(cs->role);
3443 } 3469 }
3444 cs->shell.surface = NULL; 3470 cs->shell.surface = NULL;
3445 cs->shell.data->surfaces = eina_list_remove(cs->shell.data->surfaces, cs); 3471 cs->shell.data->surfaces = eina_list_remove(cs->shell.data->surfaces, cs);
3446 cs->shell.data = NULL; 3472 cs->shell.data = NULL;
3473 shell_surface_reset(cs);
3447 while (cs->children) 3474 while (cs->children)
3448 { 3475 {
3449 ccs = EINA_INLIST_CONTAINER_GET(cs->children, Comp_Surface); 3476 ccs = EINA_INLIST_CONTAINER_GET(cs->children, Comp_Surface);
@@ -3464,7 +3491,7 @@ shell_surface_create(struct wl_client *client, struct wl_resource *resource, uin
3464 return; 3491 return;
3465 } 3492 }
3466 3493
3467 cs->shell.surface = wl_resource_create(client, &zxdg_surface_v6_interface, 1, id); 3494 cs->shell.surface = wl_resource_create(client, &xdg_surface_interface, 1, id);
3468 cs->shell.data = sd; 3495 cs->shell.data = sd;
3469 wl_resource_set_implementation(cs->shell.surface, &shell_surface_interface, cs, shell_surface_impl_destroy); 3496 wl_resource_set_implementation(cs->shell.surface, &shell_surface_interface, cs, shell_surface_impl_destroy);
3470 sd->surfaces = eina_list_append(sd->surfaces, cs); 3497 sd->surfaces = eina_list_append(sd->surfaces, cs);
@@ -3478,7 +3505,7 @@ shell_pong(struct wl_client *client EINA_UNUSED, struct wl_resource *resource, u
3478 sd->ping = 0; 3505 sd->ping = 0;
3479} 3506}
3480 3507
3481static const struct zxdg_shell_v6_interface shell_interface = 3508static const struct xdg_wm_base_interface shell_interface =
3482{ 3509{
3483 resource_destroy, 3510 resource_destroy,
3484 shell_positioner_create, 3511 shell_positioner_create,
@@ -3517,7 +3544,7 @@ shell_bind(struct wl_client *client, void *data, uint32_t version, uint32_t id)
3517 sd->c = c; 3544 sd->c = c;
3518 c->shells = eina_inlist_append(c->shells, EINA_INLIST_GET(sd)); 3545 c->shells = eina_inlist_append(c->shells, EINA_INLIST_GET(sd));
3519 3546
3520 res = wl_resource_create(client, &zxdg_shell_v6_interface, version, id); 3547 res = wl_resource_create(client, &xdg_wm_base_interface, version, id);
3521 sd->res = res; 3548 sd->res = res;
3522 wl_resource_set_implementation(res, &shell_interface, sd, shell_unbind); 3549 wl_resource_set_implementation(res, &shell_interface, sd, shell_unbind);
3523} 3550}
@@ -5074,7 +5101,7 @@ comp_smart_add(Evas_Object *obj)
5074 wl_global_create(c->display, &wl_compositor_interface, 4, c, comp_bind); 5101 wl_global_create(c->display, &wl_compositor_interface, 4, c, comp_bind);
5075 wl_global_create(c->display, &wl_subcompositor_interface, 1, c, subcomp_bind); 5102 wl_global_create(c->display, &wl_subcompositor_interface, 1, c, subcomp_bind);
5076 wl_global_create(c->display, &wl_output_interface, 2, c, output_bind); 5103 wl_global_create(c->display, &wl_output_interface, 2, c, output_bind);
5077 wl_global_create(c->display, &zxdg_shell_v6_interface, 1, c, shell_bind); 5104 wl_global_create(c->display, &xdg_wm_base_interface, 1, c, shell_bind);
5078 wl_global_create(c->display, &wl_data_device_manager_interface, 3, c, data_device_manager_bind); 5105 wl_global_create(c->display, &wl_data_device_manager_interface, 3, c, data_device_manager_bind);
5079 wl_global_create(c->display, &efl_hints_interface, 1, c, efl_hints_bind); 5106 wl_global_create(c->display, &efl_hints_interface, 1, c, efl_hints_bind);
5080 wl_display_init_shm(c->display); 5107 wl_display_init_shm(c->display);