summaryrefslogtreecommitdiff
path: root/src/lib/ecore_wl2
diff options
context:
space:
mode:
authorDerek Foreman <derekf@osg.samsung.com>2017-10-04 12:12:55 -0500
committerDerek Foreman <derekf@osg.samsung.com>2017-10-12 12:24:03 -0500
commit0badc0522b1d08fddf9676883d37da06a264db28 (patch)
tree9f5fca225f65a634aadf3926db37c23cc3750902 /src/lib/ecore_wl2
parent10b3a41ab0e00b4eb3a98a120089e3fa21230c83 (diff)
ecore_wl2: Split configurations into client set and compositor requested
This should lead to clearer and more maintainable code than having one pile of state that's asynchronously fiddled with by both client and compositor.
Diffstat (limited to 'src/lib/ecore_wl2')
-rw-r--r--src/lib/ecore_wl2/ecore_wl2_display.c3
-rw-r--r--src/lib/ecore_wl2/ecore_wl2_private.h3
-rw-r--r--src/lib/ecore_wl2/ecore_wl2_window.c138
3 files changed, 73 insertions, 71 deletions
diff --git a/src/lib/ecore_wl2/ecore_wl2_display.c b/src/lib/ecore_wl2/ecore_wl2_display.c
index dca7b68dcd..365658c2a4 100644
--- a/src/lib/ecore_wl2/ecore_wl2_display.c
+++ b/src/lib/ecore_wl2/ecore_wl2_display.c
@@ -471,7 +471,8 @@ _recovery_timer_add(Ecore_Wl2_Display *ewd)
471 EINA_INLIST_FOREACH_SAFE(window->subsurfs, tmp2, subsurf) 471 EINA_INLIST_FOREACH_SAFE(window->subsurfs, tmp2, subsurf)
472 _ecore_wl2_subsurf_unmap(subsurf); 472 _ecore_wl2_subsurf_unmap(subsurf);
473 _ecore_wl2_window_semi_free(window); 473 _ecore_wl2_window_semi_free(window);
474 window->config.serial = 0; 474 window->set_config.serial = 0;
475 window->req_config.serial = 0;
475 window->zxdg_configure_ack = NULL; 476 window->zxdg_configure_ack = NULL;
476 window->zxdg_set_min_size = NULL; 477 window->zxdg_set_min_size = NULL;
477 window->zxdg_set_max_size = NULL; 478 window->zxdg_set_max_size = NULL;
diff --git a/src/lib/ecore_wl2/ecore_wl2_private.h b/src/lib/ecore_wl2/ecore_wl2_private.h
index d89fb9ce98..743c05bf2f 100644
--- a/src/lib/ecore_wl2/ecore_wl2_private.h
+++ b/src/lib/ecore_wl2/ecore_wl2_private.h
@@ -202,7 +202,8 @@ struct _Ecore_Wl2_Window
202 Eina_List *supported_aux_hints; 202 Eina_List *supported_aux_hints;
203 Eina_List *frame_callbacks; 203 Eina_List *frame_callbacks;
204 204
205 Ecore_Wl2_Window_Configure_State config; 205 Ecore_Wl2_Window_Configure_State set_config;
206 Ecore_Wl2_Window_Configure_State req_config;
206 207
207 Eina_Bool moving : 1; 208 Eina_Bool moving : 1;
208 Eina_Bool alpha : 1; 209 Eina_Bool alpha : 1;
diff --git a/src/lib/ecore_wl2/ecore_wl2_window.c b/src/lib/ecore_wl2/ecore_wl2_window.c
index dc032e6b44..ed9732df72 100644
--- a/src/lib/ecore_wl2/ecore_wl2_window.c
+++ b/src/lib/ecore_wl2/ecore_wl2_window.c
@@ -99,7 +99,7 @@ _zxdg_surface_cb_configure(void *data, struct zxdg_surface_v6 *zxdg_surface EINA
99 Ecore_Wl2_Window *window; 99 Ecore_Wl2_Window *window;
100 100
101 window = data; 101 window = data;
102 window->config.serial = serial; 102 window->req_config.serial = serial;
103 if (!window->pending.configure) return; 103 if (!window->pending.configure) return;
104 104
105 _configure_complete(window); 105 _configure_complete(window);
@@ -117,52 +117,49 @@ _zxdg_toplevel_cb_configure(void *data, struct zxdg_toplevel_v6 *zxdg_toplevel E
117 uint32_t *s; 117 uint32_t *s;
118 Eina_Bool fs, max; 118 Eina_Bool fs, max;
119 119
120 if ((!win->config.maximized) && (!win->config.fullscreen)) 120 fs = win->req_config.fullscreen;
121 win->saved = win->config.geometry; 121 max = win->req_config.maximized;
122 122
123 fs = win->config.fullscreen; 123 win->req_config.minimized = EINA_FALSE;
124 max = win->config.maximized; 124 win->req_config.maximized = EINA_FALSE;
125 125 win->req_config.fullscreen = EINA_FALSE;
126 win->config.minimized = EINA_FALSE; 126 win->req_config.focused = EINA_FALSE;
127 win->config.maximized = EINA_FALSE; 127 win->req_config.resizing = EINA_FALSE;
128 win->config.fullscreen = EINA_FALSE;
129 win->config.focused = EINA_FALSE;
130 win->config.resizing = EINA_FALSE;
131 128
132 wl_array_for_each(s, states) 129 wl_array_for_each(s, states)
133 { 130 {
134 switch (*s) 131 switch (*s)
135 { 132 {
136 case ZXDG_TOPLEVEL_V6_STATE_MAXIMIZED: 133 case ZXDG_TOPLEVEL_V6_STATE_MAXIMIZED:
137 win->config.maximized = EINA_TRUE; 134 win->req_config.maximized = EINA_TRUE;
138 break; 135 break;
139 case ZXDG_TOPLEVEL_V6_STATE_FULLSCREEN: 136 case ZXDG_TOPLEVEL_V6_STATE_FULLSCREEN:
140 win->config.fullscreen = EINA_TRUE; 137 win->req_config.fullscreen = EINA_TRUE;
141 break; 138 break;
142 case ZXDG_TOPLEVEL_V6_STATE_RESIZING: 139 case ZXDG_TOPLEVEL_V6_STATE_RESIZING:
143 win->config.resizing = EINA_TRUE; 140 win->req_config.resizing = EINA_TRUE;
144 break; 141 break;
145 case ZXDG_TOPLEVEL_V6_STATE_ACTIVATED: 142 case ZXDG_TOPLEVEL_V6_STATE_ACTIVATED:
146 win->config.focused = EINA_TRUE; 143 win->req_config.focused = EINA_TRUE;
147 win->config.minimized = EINA_FALSE; 144 win->req_config.minimized = EINA_FALSE;
148 default: 145 default:
149 break; 146 break;
150 } 147 }
151 } 148 }
152 149
153 if ((win->config.geometry.w == width) && 150 if ((win->set_config.geometry.w == width) &&
154 (win->config.geometry.h == height)) 151 (win->set_config.geometry.h == height))
155 width = height = 0; 152 width = height = 0;
156 else if ((!width) && (!height) && (!win->config.fullscreen) && 153 else if ((!width) && (!height) && (!win->req_config.fullscreen) &&
157 (!win->config.maximized) && 154 (!win->req_config.maximized) &&
158 ((win->config.fullscreen != fs) || 155 ((win->req_config.fullscreen != fs) ||
159 (win->config.maximized != max))) 156 (win->req_config.maximized != max)))
160 width = win->saved.w, height = win->saved.h; 157 width = win->saved.w, height = win->saved.h;
161 158
162 _ecore_wl2_window_configure_send(win, width, height, !!win->config.resizing, 159 _ecore_wl2_window_configure_send(win, width, height, !!win->req_config.resizing,
163 win->config.fullscreen, win->config.maximized); 160 win->req_config.fullscreen, win->req_config.maximized);
164 161
165 if (win->config.focused) 162 if (win->req_config.focused)
166 _ecore_wl2_window_activate_send(win); 163 _ecore_wl2_window_activate_send(win);
167 else 164 else
168 _ecore_wl2_window_deactivate_send(win); 165 _ecore_wl2_window_deactivate_send(win);
@@ -217,9 +214,11 @@ _ecore_wl2_window_zxdg_popup_create(Ecore_Wl2_Window *win)
217 pos = zxdg_shell_v6_create_positioner(win->display->wl.zxdg_shell); 214 pos = zxdg_shell_v6_create_positioner(win->display->wl.zxdg_shell);
218 if (!pos) return; 215 if (!pos) return;
219 216
220 zxdg_positioner_v6_set_anchor_rect(pos, win->config.geometry.x, win->config.geometry.y, 217 zxdg_positioner_v6_set_anchor_rect(pos, win->set_config.geometry.x,
218 win->set_config.geometry.y,
221 1, 1); 219 1, 1);
222 zxdg_positioner_v6_set_size(pos, win->config.geometry.w, win->config.geometry.h); 220 zxdg_positioner_v6_set_size(pos, win->set_config.geometry.w,
221 win->set_config.geometry.h);
223 zxdg_positioner_v6_set_anchor(pos, ZXDG_POSITIONER_V6_ANCHOR_TOP | 222 zxdg_positioner_v6_set_anchor(pos, ZXDG_POSITIONER_V6_ANCHOR_TOP |
224 ZXDG_POSITIONER_V6_ANCHOR_LEFT); 223 ZXDG_POSITIONER_V6_ANCHOR_LEFT);
225 zxdg_positioner_v6_set_gravity(pos, ZXDG_POSITIONER_V6_ANCHOR_BOTTOM | 224 zxdg_positioner_v6_set_gravity(pos, ZXDG_POSITIONER_V6_ANCHOR_BOTTOM |
@@ -345,10 +344,10 @@ _ecore_wl2_window_shell_surface_init(Ecore_Wl2_Window *window)
345 if (ptop) 344 if (ptop)
346 zxdg_toplevel_v6_set_parent(window->zxdg_toplevel, ptop); 345 zxdg_toplevel_v6_set_parent(window->zxdg_toplevel, ptop);
347 346
348 if (window->config.maximized) 347 if (window->set_config.maximized)
349 zxdg_toplevel_v6_set_maximized(window->zxdg_toplevel); 348 zxdg_toplevel_v6_set_maximized(window->zxdg_toplevel);
350 349
351 if (window->config.fullscreen) 350 if (window->set_config.fullscreen)
352 zxdg_toplevel_v6_set_fullscreen(window->zxdg_toplevel, NULL); 351 zxdg_toplevel_v6_set_fullscreen(window->zxdg_toplevel, NULL);
353 if (window->aspect.set && window->display->wl.efl_hints) 352 if (window->aspect.set && window->display->wl.efl_hints)
354 efl_hints_set_aspect(window->display->wl.efl_hints, window->zxdg_toplevel, 353 efl_hints_set_aspect(window->display->wl.efl_hints, window->zxdg_toplevel,
@@ -366,10 +365,10 @@ _ecore_wl2_window_shell_surface_init(Ecore_Wl2_Window *window)
366 window->surface, window->uuid); 365 window->surface, window->uuid);
367 if (window->zxdg_surface) 366 if (window->zxdg_surface)
368 zxdg_surface_v6_set_window_geometry(window->zxdg_surface, 367 zxdg_surface_v6_set_window_geometry(window->zxdg_surface,
369 window->config.geometry.x, 368 window->set_config.geometry.x,
370 window->config.geometry.y, 369 window->set_config.geometry.y,
371 window->config.geometry.w, 370 window->set_config.geometry.w,
372 window->config.geometry.h); 371 window->set_config.geometry.h);
373 372
374 ecore_wl2_window_opaque_region_set(window, 373 ecore_wl2_window_opaque_region_set(window,
375 window->opaque.x, 374 window->opaque.x,
@@ -457,10 +456,10 @@ ecore_wl2_window_new(Ecore_Wl2_Display *display, Ecore_Wl2_Window *parent, int x
457 win->parent = parent; 456 win->parent = parent;
458 win->id = _win_id++; 457 win->id = _win_id++;
459 458
460 win->config.geometry.x = x; 459 win->set_config.geometry.x = x;
461 win->config.geometry.y = y; 460 win->set_config.geometry.y = y;
462 win->config.geometry.w = w; 461 win->set_config.geometry.w = w;
463 win->config.geometry.h = h; 462 win->set_config.geometry.h = h;
464 463
465 win->opaque.x = x; 464 win->opaque.x = x;
466 win->opaque.y = y; 465 win->opaque.y = y;
@@ -554,7 +553,8 @@ ecore_wl2_window_hide(Ecore_Wl2_Window *window)
554 window->callback = NULL; 553 window->callback = NULL;
555 } 554 }
556 555
557 window->config.serial = 0; 556 window->set_config.serial = 0;
557 window->req_config.serial = 0;
558 window->zxdg_configure_ack = NULL; 558 window->zxdg_configure_ack = NULL;
559 window->zxdg_set_min_size = NULL; 559 window->zxdg_set_min_size = NULL;
560 window->zxdg_set_max_size = NULL; 560 window->zxdg_set_max_size = NULL;
@@ -655,8 +655,8 @@ ecore_wl2_window_raise(Ecore_Wl2_Window *window)
655 s = wl_array_add(&states, sizeof(*s)); 655 s = wl_array_add(&states, sizeof(*s));
656 *s = ZXDG_TOPLEVEL_V6_STATE_ACTIVATED; 656 *s = ZXDG_TOPLEVEL_V6_STATE_ACTIVATED;
657 _zxdg_toplevel_cb_configure(window, window->zxdg_toplevel, 657 _zxdg_toplevel_cb_configure(window, window->zxdg_toplevel,
658 window->config.geometry.w, 658 window->set_config.geometry.w,
659 window->config.geometry.h, &states); 659 window->set_config.geometry.h, &states);
660 wl_array_release(&states); 660 wl_array_release(&states);
661 } 661 }
662} 662}
@@ -849,7 +849,7 @@ ecore_wl2_window_maximized_get(Ecore_Wl2_Window *window)
849{ 849{
850 EINA_SAFETY_ON_NULL_RETURN_VAL(window, EINA_FALSE); 850 EINA_SAFETY_ON_NULL_RETURN_VAL(window, EINA_FALSE);
851 851
852 return window->config.maximized; 852 return window->set_config.maximized;
853} 853}
854 854
855EAPI void 855EAPI void
@@ -859,16 +859,15 @@ ecore_wl2_window_maximized_set(Ecore_Wl2_Window *window, Eina_Bool maximized)
859 859
860 EINA_SAFETY_ON_NULL_RETURN(window); 860 EINA_SAFETY_ON_NULL_RETURN(window);
861 861
862 prev = window->config.maximized; 862 prev = window->set_config.maximized;
863 maximized = !!maximized; 863 maximized = !!maximized;
864 if (prev == maximized) return; 864 if (prev == maximized) return;
865 865
866 if (!ecore_wl2_window_shell_surface_exists(window)) 866 window->set_config.maximized = maximized;
867 window->config.maximized = maximized;
868 867
869 if (maximized) 868 if (maximized)
870 { 869 {
871 window->saved = window->config.geometry; 870 window->saved = window->set_config.geometry;
872 871
873 if (window->zxdg_toplevel) 872 if (window->zxdg_toplevel)
874 zxdg_toplevel_v6_set_maximized(window->zxdg_toplevel); 873 zxdg_toplevel_v6_set_maximized(window->zxdg_toplevel);
@@ -885,7 +884,7 @@ ecore_wl2_window_fullscreen_get(Ecore_Wl2_Window *window)
885{ 884{
886 EINA_SAFETY_ON_NULL_RETURN_VAL(window, EINA_FALSE); 885 EINA_SAFETY_ON_NULL_RETURN_VAL(window, EINA_FALSE);
887 886
888 return window->config.fullscreen; 887 return window->set_config.fullscreen;
889} 888}
890 889
891EAPI void 890EAPI void
@@ -895,16 +894,15 @@ ecore_wl2_window_fullscreen_set(Ecore_Wl2_Window *window, Eina_Bool fullscreen)
895 894
896 EINA_SAFETY_ON_NULL_RETURN(window); 895 EINA_SAFETY_ON_NULL_RETURN(window);
897 896
898 prev = window->config.fullscreen; 897 prev = window->set_config.fullscreen;
899 fullscreen = !!fullscreen; 898 fullscreen = !!fullscreen;
900 if (prev == fullscreen) return; 899 if (prev == fullscreen) return;
901 900
902 if (!ecore_wl2_window_shell_surface_exists(window)) 901 window->set_config.fullscreen = fullscreen;
903 window->config.fullscreen = fullscreen;
904 902
905 if (fullscreen) 903 if (fullscreen)
906 { 904 {
907 window->saved = window->config.geometry; 905 window->saved = window->set_config.geometry;
908 906
909 if (window->zxdg_toplevel) 907 if (window->zxdg_toplevel)
910 zxdg_toplevel_v6_set_fullscreen(window->zxdg_toplevel, NULL); 908 zxdg_toplevel_v6_set_fullscreen(window->zxdg_toplevel, NULL);
@@ -961,10 +959,10 @@ ecore_wl2_window_geometry_get(Ecore_Wl2_Window *window, int *x, int *y, int *w,
961{ 959{
962 EINA_SAFETY_ON_NULL_RETURN(window); 960 EINA_SAFETY_ON_NULL_RETURN(window);
963 961
964 if (x) *x = window->config.geometry.x; 962 if (x) *x = window->set_config.geometry.x;
965 if (y) *y = window->config.geometry.y; 963 if (y) *y = window->set_config.geometry.y;
966 if (w) *w = window->config.geometry.w; 964 if (w) *w = window->set_config.geometry.w;
967 if (h) *h = window->config.geometry.h; 965 if (h) *h = window->set_config.geometry.h;
968} 966}
969 967
970EAPI void 968EAPI void
@@ -972,14 +970,16 @@ ecore_wl2_window_geometry_set(Ecore_Wl2_Window *window, int x, int y, int w, int
972{ 970{
973 EINA_SAFETY_ON_NULL_RETURN(window); 971 EINA_SAFETY_ON_NULL_RETURN(window);
974 972
975 if ((window->config.geometry.x == x) && (window->config.geometry.y == y) && 973 if ((window->set_config.geometry.x == x) &&
976 (window->config.geometry.w == w) && (window->config.geometry.h == h)) 974 (window->set_config.geometry.y == y) &&
975 (window->set_config.geometry.w == w) &&
976 (window->set_config.geometry.h == h))
977 return; 977 return;
978 978
979 window->config.geometry.x = x; 979 window->set_config.geometry.x = x;
980 window->config.geometry.y = y; 980 window->set_config.geometry.y = y;
981 window->config.geometry.w = w; 981 window->set_config.geometry.w = w;
982 window->config.geometry.h = h; 982 window->set_config.geometry.h = h;
983 983
984 if (window->zxdg_toplevel) 984 if (window->zxdg_toplevel)
985 zxdg_surface_v6_set_window_geometry(window->zxdg_surface, x, y, w, h); 985 zxdg_surface_v6_set_window_geometry(window->zxdg_surface, x, y, w, h);
@@ -990,7 +990,7 @@ ecore_wl2_window_iconified_get(Ecore_Wl2_Window *window)
990{ 990{
991 EINA_SAFETY_ON_NULL_RETURN_VAL(window, EINA_FALSE); 991 EINA_SAFETY_ON_NULL_RETURN_VAL(window, EINA_FALSE);
992 992
993 return window->config.minimized; 993 return window->set_config.minimized;
994} 994}
995 995
996EAPI void 996EAPI void
@@ -1000,11 +1000,11 @@ ecore_wl2_window_iconified_set(Ecore_Wl2_Window *window, Eina_Bool iconified)
1000 1000
1001 EINA_SAFETY_ON_NULL_RETURN(window); 1001 EINA_SAFETY_ON_NULL_RETURN(window);
1002 1002
1003 prev = window->config.minimized; 1003 prev = window->set_config.minimized;
1004 iconified = !!iconified; 1004 iconified = !!iconified;
1005 if (prev == iconified) return; 1005 if (prev == iconified) return;
1006 1006
1007 window->config.minimized = iconified; 1007 window->set_config.minimized = iconified;
1008 1008
1009 if (iconified) 1009 if (iconified)
1010 { 1010 {
@@ -1022,8 +1022,8 @@ ecore_wl2_window_iconified_set(Ecore_Wl2_Window *window, Eina_Bool iconified)
1022 s = wl_array_add(&states, sizeof(*s)); 1022 s = wl_array_add(&states, sizeof(*s));
1023 *s = ZXDG_TOPLEVEL_V6_STATE_ACTIVATED; 1023 *s = ZXDG_TOPLEVEL_V6_STATE_ACTIVATED;
1024 _zxdg_toplevel_cb_configure(window, window->zxdg_toplevel, 1024 _zxdg_toplevel_cb_configure(window, window->zxdg_toplevel,
1025 window->config.geometry.w, 1025 window->set_config.geometry.w,
1026 window->config.geometry.h, &states); 1026 window->set_config.geometry.h, &states);
1027 wl_array_release(&states); 1027 wl_array_release(&states);
1028 } 1028 }
1029 } 1029 }
@@ -1063,7 +1063,7 @@ EAPI Eina_Bool
1063ecore_wl2_window_activated_get(const Ecore_Wl2_Window *window) 1063ecore_wl2_window_activated_get(const Ecore_Wl2_Window *window)
1064{ 1064{
1065 EINA_SAFETY_ON_NULL_RETURN_VAL(window, EINA_FALSE); 1065 EINA_SAFETY_ON_NULL_RETURN_VAL(window, EINA_FALSE);
1066 return window->config.focused; 1066 return window->req_config.focused;
1067} 1067}
1068 1068
1069EAPI Ecore_Wl2_Output * 1069EAPI Ecore_Wl2_Output *
@@ -1075,8 +1075,8 @@ ecore_wl2_window_output_find(Ecore_Wl2_Window *window)
1075 1075
1076 EINA_SAFETY_ON_NULL_RETURN_VAL(window, NULL); 1076 EINA_SAFETY_ON_NULL_RETURN_VAL(window, NULL);
1077 1077
1078 x = window->config.geometry.x; 1078 x = window->set_config.geometry.x;
1079 y = window->config.geometry.y; 1079 y = window->set_config.geometry.y;
1080 1080
1081 EINA_INLIST_FOREACH_SAFE(window->display->outputs, tmp, out) 1081 EINA_INLIST_FOREACH_SAFE(window->display->outputs, tmp, out)
1082 { 1082 {
@@ -1466,5 +1466,5 @@ ecore_wl2_window_resizing_get(Ecore_Wl2_Window *window)
1466{ 1466{
1467 EINA_SAFETY_ON_NULL_RETURN_VAL(window, EINA_FALSE); 1467 EINA_SAFETY_ON_NULL_RETURN_VAL(window, EINA_FALSE);
1468 1468
1469 return window->config.resizing; 1469 return window->req_config.resizing;
1470} 1470}