summaryrefslogtreecommitdiff
path: root/src/lib/ecore_wl2
diff options
context:
space:
mode:
authorDerek Foreman <derekf@osg.samsung.com>2017-09-29 16:18:43 -0500
committerDerek Foreman <derekf@osg.samsung.com>2017-10-12 12:24:03 -0500
commit10b3a41ab0e00b4eb3a98a120089e3fa21230c83 (patch)
tree47dcb06d0d633b22abe05a27fe613959660e9879 /src/lib/ecore_wl2
parenta3ac6043ab318ac183acff6039ad70b5a63c5c39 (diff)
ecore_wl2: Move some state into its own struct
These need to be double buffered, and that will be done in a follow up patch.
Diffstat (limited to 'src/lib/ecore_wl2')
-rw-r--r--src/lib/ecore_wl2/ecore_wl2_display.c2
-rw-r--r--src/lib/ecore_wl2/ecore_wl2_private.h20
-rw-r--r--src/lib/ecore_wl2/ecore_wl2_window.c129
3 files changed, 80 insertions, 71 deletions
diff --git a/src/lib/ecore_wl2/ecore_wl2_display.c b/src/lib/ecore_wl2/ecore_wl2_display.c
index 4d081cc5c3..dca7b68dcd 100644
--- a/src/lib/ecore_wl2/ecore_wl2_display.c
+++ b/src/lib/ecore_wl2/ecore_wl2_display.c
@@ -471,7 +471,7 @@ _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->configure_serial = 0; 474 window->config.serial = 0;
475 window->zxdg_configure_ack = NULL; 475 window->zxdg_configure_ack = NULL;
476 window->zxdg_set_min_size = NULL; 476 window->zxdg_set_min_size = NULL;
477 window->zxdg_set_max_size = NULL; 477 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 95afcd5f48..d89fb9ce98 100644
--- a/src/lib/ecore_wl2/ecore_wl2_private.h
+++ b/src/lib/ecore_wl2/ecore_wl2_private.h
@@ -146,6 +146,17 @@ struct _Ecore_Wl2_Frame_Cb_Handle
146 void *data; 146 void *data;
147}; 147};
148 148
149typedef struct _Ecore_Wl2_Window_Configure_State
150{
151 uint32_t serial;
152 Eina_Rectangle geometry;
153 Eina_Bool minimized : 1;
154 Eina_Bool maximized : 1;
155 Eina_Bool fullscreen : 1;
156 Eina_Bool focused : 1;
157 Eina_Bool resizing : 1;
158} Ecore_Wl2_Window_Configure_State;
159
149struct _Ecore_Wl2_Window 160struct _Ecore_Wl2_Window
150{ 161{
151 EINA_INLIST; 162 EINA_INLIST;
@@ -170,13 +181,11 @@ struct _Ecore_Wl2_Window
170 181
171 Eina_Stringshare *uuid; 182 Eina_Stringshare *uuid;
172 183
173 uint32_t configure_serial;
174 void (*zxdg_configure_ack)(struct zxdg_surface_v6 *surface, uint32_t serial); 184 void (*zxdg_configure_ack)(struct zxdg_surface_v6 *surface, uint32_t serial);
175 void (*zxdg_set_min_size)(struct zxdg_toplevel_v6 *toplevel, int32_t w, int32_t h); 185 void (*zxdg_set_min_size)(struct zxdg_toplevel_v6 *toplevel, int32_t w, int32_t h);
176 void (*zxdg_set_max_size)(struct zxdg_toplevel_v6 *toplevel, int32_t w, int32_t h); 186 void (*zxdg_set_max_size)(struct zxdg_toplevel_v6 *toplevel, int32_t w, int32_t h);
177 187
178 Eina_Rectangle saved; 188 Eina_Rectangle saved;
179 Eina_Rectangle geometry;
180 Eina_Rectangle opaque; 189 Eina_Rectangle opaque;
181 Eina_Rectangle input_rect; 190 Eina_Rectangle input_rect;
182 191
@@ -193,12 +202,9 @@ struct _Ecore_Wl2_Window
193 Eina_List *supported_aux_hints; 202 Eina_List *supported_aux_hints;
194 Eina_List *frame_callbacks; 203 Eina_List *frame_callbacks;
195 204
205 Ecore_Wl2_Window_Configure_State config;
206
196 Eina_Bool moving : 1; 207 Eina_Bool moving : 1;
197 Eina_Bool minimized : 1;
198 Eina_Bool maximized : 1;
199 Eina_Bool fullscreen : 1;
200 Eina_Bool focused : 1;
201 Eina_Bool resizing : 1;
202 Eina_Bool alpha : 1; 208 Eina_Bool alpha : 1;
203 Eina_Bool transparent : 1; 209 Eina_Bool transparent : 1;
204 210
diff --git a/src/lib/ecore_wl2/ecore_wl2_window.c b/src/lib/ecore_wl2/ecore_wl2_window.c
index f7b01a092d..dc032e6b44 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->configure_serial = serial; 102 window->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,49 +117,52 @@ _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->maximized) && (!win->fullscreen)) 120 if ((!win->config.maximized) && (!win->config.fullscreen))
121 win->saved = win->geometry; 121 win->saved = win->config.geometry;
122 122
123 fs = win->fullscreen; 123 fs = win->config.fullscreen;
124 max = win->maximized; 124 max = win->config.maximized;
125 125
126 win->minimized = EINA_FALSE; 126 win->config.minimized = EINA_FALSE;
127 win->maximized = EINA_FALSE; 127 win->config.maximized = EINA_FALSE;
128 win->fullscreen = EINA_FALSE; 128 win->config.fullscreen = EINA_FALSE;
129 win->focused = EINA_FALSE; 129 win->config.focused = EINA_FALSE;
130 win->resizing = EINA_FALSE; 130 win->config.resizing = EINA_FALSE;
131 131
132 wl_array_for_each(s, states) 132 wl_array_for_each(s, states)
133 { 133 {
134 switch (*s) 134 switch (*s)
135 { 135 {
136 case ZXDG_TOPLEVEL_V6_STATE_MAXIMIZED: 136 case ZXDG_TOPLEVEL_V6_STATE_MAXIMIZED:
137 win->maximized = EINA_TRUE; 137 win->config.maximized = EINA_TRUE;
138 break; 138 break;
139 case ZXDG_TOPLEVEL_V6_STATE_FULLSCREEN: 139 case ZXDG_TOPLEVEL_V6_STATE_FULLSCREEN:
140 win->fullscreen = EINA_TRUE; 140 win->config.fullscreen = EINA_TRUE;
141 break; 141 break;
142 case ZXDG_TOPLEVEL_V6_STATE_RESIZING: 142 case ZXDG_TOPLEVEL_V6_STATE_RESIZING:
143 win->resizing = EINA_TRUE; 143 win->config.resizing = EINA_TRUE;
144 break; 144 break;
145 case ZXDG_TOPLEVEL_V6_STATE_ACTIVATED: 145 case ZXDG_TOPLEVEL_V6_STATE_ACTIVATED:
146 win->focused = EINA_TRUE; 146 win->config.focused = EINA_TRUE;
147 win->minimized = EINA_FALSE; 147 win->config.minimized = EINA_FALSE;
148 default: 148 default:
149 break; 149 break;
150 } 150 }
151 } 151 }
152 152
153 if ((win->geometry.w == width) && (win->geometry.h == height)) 153 if ((win->config.geometry.w == width) &&
154 (win->config.geometry.h == height))
154 width = height = 0; 155 width = height = 0;
155 else if ((!width) && (!height) && (!win->fullscreen) && (!win->maximized) && 156 else if ((!width) && (!height) && (!win->config.fullscreen) &&
156 ((win->fullscreen != fs) || (win->maximized != max))) 157 (!win->config.maximized) &&
158 ((win->config.fullscreen != fs) ||
159 (win->config.maximized != max)))
157 width = win->saved.w, height = win->saved.h; 160 width = win->saved.w, height = win->saved.h;
158 161
159 _ecore_wl2_window_configure_send(win, width, height, !!win->resizing, 162 _ecore_wl2_window_configure_send(win, width, height, !!win->config.resizing,
160 win->fullscreen, win->maximized); 163 win->config.fullscreen, win->config.maximized);
161 164
162 if (win->focused) 165 if (win->config.focused)
163 _ecore_wl2_window_activate_send(win); 166 _ecore_wl2_window_activate_send(win);
164 else 167 else
165 _ecore_wl2_window_deactivate_send(win); 168 _ecore_wl2_window_deactivate_send(win);
@@ -214,9 +217,9 @@ _ecore_wl2_window_zxdg_popup_create(Ecore_Wl2_Window *win)
214 pos = zxdg_shell_v6_create_positioner(win->display->wl.zxdg_shell); 217 pos = zxdg_shell_v6_create_positioner(win->display->wl.zxdg_shell);
215 if (!pos) return; 218 if (!pos) return;
216 219
217 zxdg_positioner_v6_set_anchor_rect(pos, win->geometry.x, win->geometry.y, 220 zxdg_positioner_v6_set_anchor_rect(pos, win->config.geometry.x, win->config.geometry.y,
218 1, 1); 221 1, 1);
219 zxdg_positioner_v6_set_size(pos, win->geometry.w, win->geometry.h); 222 zxdg_positioner_v6_set_size(pos, win->config.geometry.w, win->config.geometry.h);
220 zxdg_positioner_v6_set_anchor(pos, ZXDG_POSITIONER_V6_ANCHOR_TOP | 223 zxdg_positioner_v6_set_anchor(pos, ZXDG_POSITIONER_V6_ANCHOR_TOP |
221 ZXDG_POSITIONER_V6_ANCHOR_LEFT); 224 ZXDG_POSITIONER_V6_ANCHOR_LEFT);
222 zxdg_positioner_v6_set_gravity(pos, ZXDG_POSITIONER_V6_ANCHOR_BOTTOM | 225 zxdg_positioner_v6_set_gravity(pos, ZXDG_POSITIONER_V6_ANCHOR_BOTTOM |
@@ -342,10 +345,10 @@ _ecore_wl2_window_shell_surface_init(Ecore_Wl2_Window *window)
342 if (ptop) 345 if (ptop)
343 zxdg_toplevel_v6_set_parent(window->zxdg_toplevel, ptop); 346 zxdg_toplevel_v6_set_parent(window->zxdg_toplevel, ptop);
344 347
345 if (window->maximized) 348 if (window->config.maximized)
346 zxdg_toplevel_v6_set_maximized(window->zxdg_toplevel); 349 zxdg_toplevel_v6_set_maximized(window->zxdg_toplevel);
347 350
348 if (window->fullscreen) 351 if (window->config.fullscreen)
349 zxdg_toplevel_v6_set_fullscreen(window->zxdg_toplevel, NULL); 352 zxdg_toplevel_v6_set_fullscreen(window->zxdg_toplevel, NULL);
350 if (window->aspect.set && window->display->wl.efl_hints) 353 if (window->aspect.set && window->display->wl.efl_hints)
351 efl_hints_set_aspect(window->display->wl.efl_hints, window->zxdg_toplevel, 354 efl_hints_set_aspect(window->display->wl.efl_hints, window->zxdg_toplevel,
@@ -363,10 +366,10 @@ _ecore_wl2_window_shell_surface_init(Ecore_Wl2_Window *window)
363 window->surface, window->uuid); 366 window->surface, window->uuid);
364 if (window->zxdg_surface) 367 if (window->zxdg_surface)
365 zxdg_surface_v6_set_window_geometry(window->zxdg_surface, 368 zxdg_surface_v6_set_window_geometry(window->zxdg_surface,
366 window->geometry.x, 369 window->config.geometry.x,
367 window->geometry.y, 370 window->config.geometry.y,
368 window->geometry.w, 371 window->config.geometry.w,
369 window->geometry.h); 372 window->config.geometry.h);
370 373
371 ecore_wl2_window_opaque_region_set(window, 374 ecore_wl2_window_opaque_region_set(window,
372 window->opaque.x, 375 window->opaque.x,
@@ -454,10 +457,10 @@ ecore_wl2_window_new(Ecore_Wl2_Display *display, Ecore_Wl2_Window *parent, int x
454 win->parent = parent; 457 win->parent = parent;
455 win->id = _win_id++; 458 win->id = _win_id++;
456 459
457 win->geometry.x = x; 460 win->config.geometry.x = x;
458 win->geometry.y = y; 461 win->config.geometry.y = y;
459 win->geometry.w = w; 462 win->config.geometry.w = w;
460 win->geometry.h = h; 463 win->config.geometry.h = h;
461 464
462 win->opaque.x = x; 465 win->opaque.x = x;
463 win->opaque.y = y; 466 win->opaque.y = y;
@@ -551,7 +554,7 @@ ecore_wl2_window_hide(Ecore_Wl2_Window *window)
551 window->callback = NULL; 554 window->callback = NULL;
552 } 555 }
553 556
554 window->configure_serial = 0; 557 window->config.serial = 0;
555 window->zxdg_configure_ack = NULL; 558 window->zxdg_configure_ack = NULL;
556 window->zxdg_set_min_size = NULL; 559 window->zxdg_set_min_size = NULL;
557 window->zxdg_set_max_size = NULL; 560 window->zxdg_set_max_size = NULL;
@@ -652,8 +655,8 @@ ecore_wl2_window_raise(Ecore_Wl2_Window *window)
652 s = wl_array_add(&states, sizeof(*s)); 655 s = wl_array_add(&states, sizeof(*s));
653 *s = ZXDG_TOPLEVEL_V6_STATE_ACTIVATED; 656 *s = ZXDG_TOPLEVEL_V6_STATE_ACTIVATED;
654 _zxdg_toplevel_cb_configure(window, window->zxdg_toplevel, 657 _zxdg_toplevel_cb_configure(window, window->zxdg_toplevel,
655 window->geometry.w, 658 window->config.geometry.w,
656 window->geometry.h, &states); 659 window->config.geometry.h, &states);
657 wl_array_release(&states); 660 wl_array_release(&states);
658 } 661 }
659} 662}
@@ -846,7 +849,7 @@ ecore_wl2_window_maximized_get(Ecore_Wl2_Window *window)
846{ 849{
847 EINA_SAFETY_ON_NULL_RETURN_VAL(window, EINA_FALSE); 850 EINA_SAFETY_ON_NULL_RETURN_VAL(window, EINA_FALSE);
848 851
849 return window->maximized; 852 return window->config.maximized;
850} 853}
851 854
852EAPI void 855EAPI void
@@ -856,16 +859,16 @@ ecore_wl2_window_maximized_set(Ecore_Wl2_Window *window, Eina_Bool maximized)
856 859
857 EINA_SAFETY_ON_NULL_RETURN(window); 860 EINA_SAFETY_ON_NULL_RETURN(window);
858 861
859 prev = window->maximized; 862 prev = window->config.maximized;
860 maximized = !!maximized; 863 maximized = !!maximized;
861 if (prev == maximized) return; 864 if (prev == maximized) return;
862 865
863 if (!ecore_wl2_window_shell_surface_exists(window)) 866 if (!ecore_wl2_window_shell_surface_exists(window))
864 window->maximized = maximized; 867 window->config.maximized = maximized;
865 868
866 if (maximized) 869 if (maximized)
867 { 870 {
868 window->saved = window->geometry; 871 window->saved = window->config.geometry;
869 872
870 if (window->zxdg_toplevel) 873 if (window->zxdg_toplevel)
871 zxdg_toplevel_v6_set_maximized(window->zxdg_toplevel); 874 zxdg_toplevel_v6_set_maximized(window->zxdg_toplevel);
@@ -882,7 +885,7 @@ ecore_wl2_window_fullscreen_get(Ecore_Wl2_Window *window)
882{ 885{
883 EINA_SAFETY_ON_NULL_RETURN_VAL(window, EINA_FALSE); 886 EINA_SAFETY_ON_NULL_RETURN_VAL(window, EINA_FALSE);
884 887
885 return window->fullscreen; 888 return window->config.fullscreen;
886} 889}
887 890
888EAPI void 891EAPI void
@@ -892,16 +895,16 @@ ecore_wl2_window_fullscreen_set(Ecore_Wl2_Window *window, Eina_Bool fullscreen)
892 895
893 EINA_SAFETY_ON_NULL_RETURN(window); 896 EINA_SAFETY_ON_NULL_RETURN(window);
894 897
895 prev = window->fullscreen; 898 prev = window->config.fullscreen;
896 fullscreen = !!fullscreen; 899 fullscreen = !!fullscreen;
897 if (prev == fullscreen) return; 900 if (prev == fullscreen) return;
898 901
899 if (!ecore_wl2_window_shell_surface_exists(window)) 902 if (!ecore_wl2_window_shell_surface_exists(window))
900 window->fullscreen = fullscreen; 903 window->config.fullscreen = fullscreen;
901 904
902 if (fullscreen) 905 if (fullscreen)
903 { 906 {
904 window->saved = window->geometry; 907 window->saved = window->config.geometry;
905 908
906 if (window->zxdg_toplevel) 909 if (window->zxdg_toplevel)
907 zxdg_toplevel_v6_set_fullscreen(window->zxdg_toplevel, NULL); 910 zxdg_toplevel_v6_set_fullscreen(window->zxdg_toplevel, NULL);
@@ -958,10 +961,10 @@ ecore_wl2_window_geometry_get(Ecore_Wl2_Window *window, int *x, int *y, int *w,
958{ 961{
959 EINA_SAFETY_ON_NULL_RETURN(window); 962 EINA_SAFETY_ON_NULL_RETURN(window);
960 963
961 if (x) *x = window->geometry.x; 964 if (x) *x = window->config.geometry.x;
962 if (y) *y = window->geometry.y; 965 if (y) *y = window->config.geometry.y;
963 if (w) *w = window->geometry.w; 966 if (w) *w = window->config.geometry.w;
964 if (h) *h = window->geometry.h; 967 if (h) *h = window->config.geometry.h;
965} 968}
966 969
967EAPI void 970EAPI void
@@ -969,14 +972,14 @@ ecore_wl2_window_geometry_set(Ecore_Wl2_Window *window, int x, int y, int w, int
969{ 972{
970 EINA_SAFETY_ON_NULL_RETURN(window); 973 EINA_SAFETY_ON_NULL_RETURN(window);
971 974
972 if ((window->geometry.x == x) && (window->geometry.y == y) && 975 if ((window->config.geometry.x == x) && (window->config.geometry.y == y) &&
973 (window->geometry.w == w) && (window->geometry.h == h)) 976 (window->config.geometry.w == w) && (window->config.geometry.h == h))
974 return; 977 return;
975 978
976 window->geometry.x = x; 979 window->config.geometry.x = x;
977 window->geometry.y = y; 980 window->config.geometry.y = y;
978 window->geometry.w = w; 981 window->config.geometry.w = w;
979 window->geometry.h = h; 982 window->config.geometry.h = h;
980 983
981 if (window->zxdg_toplevel) 984 if (window->zxdg_toplevel)
982 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);
@@ -987,7 +990,7 @@ ecore_wl2_window_iconified_get(Ecore_Wl2_Window *window)
987{ 990{
988 EINA_SAFETY_ON_NULL_RETURN_VAL(window, EINA_FALSE); 991 EINA_SAFETY_ON_NULL_RETURN_VAL(window, EINA_FALSE);
989 992
990 return window->minimized; 993 return window->config.minimized;
991} 994}
992 995
993EAPI void 996EAPI void
@@ -997,11 +1000,11 @@ ecore_wl2_window_iconified_set(Ecore_Wl2_Window *window, Eina_Bool iconified)
997 1000
998 EINA_SAFETY_ON_NULL_RETURN(window); 1001 EINA_SAFETY_ON_NULL_RETURN(window);
999 1002
1000 prev = window->minimized; 1003 prev = window->config.minimized;
1001 iconified = !!iconified; 1004 iconified = !!iconified;
1002 if (prev == iconified) return; 1005 if (prev == iconified) return;
1003 1006
1004 window->minimized = iconified; 1007 window->config.minimized = iconified;
1005 1008
1006 if (iconified) 1009 if (iconified)
1007 { 1010 {
@@ -1019,8 +1022,8 @@ ecore_wl2_window_iconified_set(Ecore_Wl2_Window *window, Eina_Bool iconified)
1019 s = wl_array_add(&states, sizeof(*s)); 1022 s = wl_array_add(&states, sizeof(*s));
1020 *s = ZXDG_TOPLEVEL_V6_STATE_ACTIVATED; 1023 *s = ZXDG_TOPLEVEL_V6_STATE_ACTIVATED;
1021 _zxdg_toplevel_cb_configure(window, window->zxdg_toplevel, 1024 _zxdg_toplevel_cb_configure(window, window->zxdg_toplevel,
1022 window->geometry.w, 1025 window->config.geometry.w,
1023 window->geometry.h, &states); 1026 window->config.geometry.h, &states);
1024 wl_array_release(&states); 1027 wl_array_release(&states);
1025 } 1028 }
1026 } 1029 }
@@ -1060,7 +1063,7 @@ EAPI Eina_Bool
1060ecore_wl2_window_activated_get(const Ecore_Wl2_Window *window) 1063ecore_wl2_window_activated_get(const Ecore_Wl2_Window *window)
1061{ 1064{
1062 EINA_SAFETY_ON_NULL_RETURN_VAL(window, EINA_FALSE); 1065 EINA_SAFETY_ON_NULL_RETURN_VAL(window, EINA_FALSE);
1063 return window->focused; 1066 return window->config.focused;
1064} 1067}
1065 1068
1066EAPI Ecore_Wl2_Output * 1069EAPI Ecore_Wl2_Output *
@@ -1072,8 +1075,8 @@ ecore_wl2_window_output_find(Ecore_Wl2_Window *window)
1072 1075
1073 EINA_SAFETY_ON_NULL_RETURN_VAL(window, NULL); 1076 EINA_SAFETY_ON_NULL_RETURN_VAL(window, NULL);
1074 1077
1075 x = window->geometry.x; 1078 x = window->config.geometry.x;
1076 y = window->geometry.y; 1079 y = window->config.geometry.y;
1077 1080
1078 EINA_INLIST_FOREACH_SAFE(window->display->outputs, tmp, out) 1081 EINA_INLIST_FOREACH_SAFE(window->display->outputs, tmp, out)
1079 { 1082 {
@@ -1463,5 +1466,5 @@ ecore_wl2_window_resizing_get(Ecore_Wl2_Window *window)
1463{ 1466{
1464 EINA_SAFETY_ON_NULL_RETURN_VAL(window, EINA_FALSE); 1467 EINA_SAFETY_ON_NULL_RETURN_VAL(window, EINA_FALSE);
1465 1468
1466 return window->resizing; 1469 return window->config.resizing;
1467} 1470}