summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJean-Philippe Andre <jp.andre@samsung.com>2017-11-10 16:50:01 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2017-11-14 12:18:39 +0900
commit0c142462a1b928f88589612333c695f80cc09a51 (patch)
tree07a465343042a12343d067c089c97879e45a9579 /src
parentee89f8767305326f63a196b9290cabc99e857c87 (diff)
win: Move autodel to C only
Note: this is C only, not legacy only. The problem is that bindings will hold a strong reference to the window, which will then die "under the rug" if autodel is enabled. This then leads to at least ERR if not crashes. Note: elm_policy needs to support autodel and quit on last del only for C applications. Bindings will require some other mechanism that doesn't break all assumptions wrt. references.
Diffstat (limited to 'src')
-rw-r--r--src/examples/elementary/toolbar_cxx_example_01.cc2
-rw-r--r--src/lib/elementary/efl_ui_win.c12
-rw-r--r--src/lib/elementary/efl_ui_win.eo51
-rw-r--r--src/lib/elementary/elm_win.h2
-rw-r--r--src/lib/elementary/elm_win_eo.h48
-rw-r--r--src/lib/elementary/elm_win_legacy.h33
6 files changed, 103 insertions, 45 deletions
diff --git a/src/examples/elementary/toolbar_cxx_example_01.cc b/src/examples/elementary/toolbar_cxx_example_01.cc
index 12548e046d..f76f959589 100644
--- a/src/examples/elementary/toolbar_cxx_example_01.cc
+++ b/src/examples/elementary/toolbar_cxx_example_01.cc
@@ -25,8 +25,6 @@ elm_main(int argc, char* argv[])
25 win_1.type_set(EFL_UI_WIN_BASIC); 25 win_1.type_set(EFL_UI_WIN_BASIC);
26 }); 26 });
27 27
28 win_1.autodel_set(true);
29
30#if 0 28#if 0
31 win_1.eo_cxx::efl::Gfx::size_set({320, 300}); 29 win_1.eo_cxx::efl::Gfx::size_set({320, 300});
32 30
diff --git a/src/lib/elementary/efl_ui_win.c b/src/lib/elementary/efl_ui_win.c
index 812e1645d7..145dc027e1 100644
--- a/src/lib/elementary/efl_ui_win.c
+++ b/src/lib/elementary/efl_ui_win.c
@@ -5540,15 +5540,19 @@ _efl_ui_win_icon_object_get(Eo *obj EINA_UNUSED, Efl_Ui_Win_Data *sd)
5540 return sd->icon; 5540 return sd->icon;
5541} 5541}
5542 5542
5543EOLIAN static void 5543/* Only for C API */
5544_efl_ui_win_autodel_set(Eo *obj EINA_UNUSED, Efl_Ui_Win_Data *sd, Eina_Bool autodel) 5544EAPI void
5545elm_win_autodel_set(Eo *obj, Eina_Bool autodel)
5545{ 5546{
5547 ELM_WIN_DATA_GET_OR_RETURN(obj, sd);
5546 sd->autodel = autodel; 5548 sd->autodel = autodel;
5547} 5549}
5548 5550
5549EOLIAN static Eina_Bool 5551EAPI Eina_Bool
5550_efl_ui_win_autodel_get(Eo *obj EINA_UNUSED, Efl_Ui_Win_Data *sd) 5552elm_win_autodel_get(const Eo *obj)
5551{ 5553{
5554 Efl_Ui_Win_Data *sd = efl_data_scope_safe_get(obj, MY_CLASS);
5555 if (!sd) return EINA_FALSE;
5552 return sd->autodel; 5556 return sd->autodel;
5553} 5557}
5554 5558
diff --git a/src/lib/elementary/efl_ui_win.eo b/src/lib/elementary/efl_ui_win.eo
index 5ccf8240d1..8fb9bb4033 100644
--- a/src/lib/elementary/efl_ui_win.eo
+++ b/src/lib/elementary/efl_ui_win.eo
@@ -305,51 +305,26 @@ class Efl.Ui.Win (Elm.Widget, Efl.Canvas, Efl.Access.Window,
305 skip: bool; [[The skip flag state ($true if it is to be skipped).]] 305 skip: bool; [[The skip flag state ($true if it is to be skipped).]]
306 } 306 }
307 } 307 }
308 @property autodel {
309 set {
310 [[Set the window's autodel state.
311
312 When closing the window in any way outside of the program
313 control, like pressing the X button in the titlebar or using
314 a command from the Window Manager, a "delete,request" signal
315 is emitted to indicate that this event occurred and the
316 developer can take any action, which may include, or not,
317 destroying the window object.
318
319 When the $autodel parameter is set, the window will be
320 automatically destroyed when this event occurs, after the
321 signal is emitted. If $autodel is $false, then the window
322 will not be destroyed and is up to the program to do so
323 when it's required.
324 ]]
325 }
326 get {
327 [[Get the window's autodel state.]]
328 }
329 values {
330 autodel: bool; [[If $true, the window will automatically delete
331 itself when closed.]]
332 }
333 }
334 @property autohide { 308 @property autohide {
335 [[Window's autohide state. 309 [[Window's autohide state.
336 310
337 This property works similarly to @.autodel, automatically handling 311 When closing the window in any way outside of the program control,
338 "delete,request" signals when set to $trze, with the difference 312 like pressing the X button in the titlebar or using a command from
339 that it will hide the window, instead of destroying it. 313 the Window Manager, a "delete,request" signal is emitted to indicate
314 that this event occurred and the developer can take any action, which
315 may include, or not, destroying the window object.
316
317 When this property is set to $true, the window will be automatically
318 hidden when this event occurs, after the signal is emitted. If this
319 property is $false, nothing will happen, beyond the event emission.
340 320
341 It is specially designed to work together with $ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN 321 C applications can use this option along with the quit policy
342 which allows exiting Elementary's main loop when all the windows 322 $ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN which allows exiting EFL's main
343 are hidden. 323 loop when all the windows are hidden.
344 324
345 Note: @.autodel and $autohide are not mutually exclusive. The window 325 Note: $autodel and $autohide are not mutually exclusive. The window
346 will be deleted if both are set to $true. 326 will be deleted if both are set to $true.
347 ]] 327 ]]
348
349 set {
350 }
351 get {
352 }
353 values { 328 values {
354 autohide: bool; [[If $true, the window will automatically hide 329 autohide: bool; [[If $true, the window will automatically hide
355 itself when closed.]] 330 itself when closed.]]
diff --git a/src/lib/elementary/elm_win.h b/src/lib/elementary/elm_win.h
index 467666ca3e..7720b980cb 100644
--- a/src/lib/elementary/elm_win.h
+++ b/src/lib/elementary/elm_win.h
@@ -105,7 +105,7 @@
105 105
106#include <elm_win_common.h> 106#include <elm_win_common.h>
107#ifdef EFL_EO_API_SUPPORT 107#ifdef EFL_EO_API_SUPPORT
108#include <efl_ui_win.eo.h> 108#include <elm_win_eo.h>
109#endif 109#endif
110#ifndef EFL_NOLEGACY_API_SUPPORT 110#ifndef EFL_NOLEGACY_API_SUPPORT
111#include <elm_win_legacy.h> 111#include <elm_win_legacy.h>
diff --git a/src/lib/elementary/elm_win_eo.h b/src/lib/elementary/elm_win_eo.h
index cdddf880f7..4d3daa8884 100644
--- a/src/lib/elementary/elm_win_eo.h
+++ b/src/lib/elementary/elm_win_eo.h
@@ -6,6 +6,54 @@
6 6
7#include "efl_ui_win.eo.h" 7#include "efl_ui_win.eo.h"
8 8
9EAPI void elm_win_autodel_set(Evas_Object *obj, Eina_Bool autodel);
10EAPI Eina_Bool elm_win_autodel_get(const Evas_Object *obj);
11
12/**
13 * @brief Set the window's autodel state.
14 *
15 * When closing the window in any way outside of the program control, like
16 * pressing the X button in the titlebar or using a command from the Window
17 * Manager, a "delete,request" signal is emitted to indicate that this event
18 * occurred and the developer can take any action, which may include, or not,
19 * destroying the window object.
20 *
21 * When the @c autodel parameter is set, the window will be automatically
22 * destroyed when this event occurs, after the signal is emitted. If @c autodel
23 * is @c false, then the window will not be destroyed and is up to the program
24 * to do so when it's required.
25 *
26 * @param[in] obj The object.
27 * @param[in] autodel If @c true, the window will automatically delete itself
28 * when closed.
29 *
30 * Note: This function is only available in C.
31 *
32 * @ingroup Efl_Ui_Win
33 */
34static inline void
35efl_ui_win_autodel_set(Efl_Ui_Win *obj, Eina_Bool autodel)
36{
37 elm_win_autodel_set(obj, autodel);
38}
39
40/**
41 * @brief Get the window's autodel state.
42 *
43 * @param[in] obj The object.
44 *
45 * @return If @c true, the window will automatically delete itself when closed.
46 *
47 * Note: This function is only available in C.
48 *
49 * @ingroup Efl_Ui_Win
50 */
51static inline Eina_Bool
52efl_ui_win_autodel_get(const Efl_Ui_Win *obj)
53{
54 return elm_win_autodel_get(obj);
55}
56
9/** 57/**
10 * @} 58 * @}
11 */ 59 */
diff --git a/src/lib/elementary/elm_win_legacy.h b/src/lib/elementary/elm_win_legacy.h
index 3abb242940..74774c7d19 100644
--- a/src/lib/elementary/elm_win_legacy.h
+++ b/src/lib/elementary/elm_win_legacy.h
@@ -180,6 +180,39 @@ EAPI Evas_Object *elm_win_util_standard_add(const char *name, const cha
180EAPI Evas_Object *elm_win_util_dialog_add(Evas_Object *parent, const char *name, const char *title); 180EAPI Evas_Object *elm_win_util_dialog_add(Evas_Object *parent, const char *name, const char *title);
181 181
182/** 182/**
183 * @brief Set the window's autodel state.
184 *
185 * When closing the window in any way outside of the program control, like
186 * pressing the X button in the titlebar or using a command from the Window
187 * Manager, a "delete,request" signal is emitted to indicate that this event
188 * occurred and the developer can take any action, which may include, or not,
189 * destroying the window object.
190 *
191 * When the @c autodel parameter is set, the window will be automatically
192 * destroyed when this event occurs, after the signal is emitted. If @c autodel
193 * is @c false, then the window will not be destroyed and is up to the program
194 * to do so when it's required.
195 *
196 * @param[in] obj The object.
197 * @param[in] autodel If @c true, the window will automatically delete itself
198 * when closed.
199 *
200 * @ingroup Elm_Win
201 */
202EAPI void elm_win_autodel_set(Evas_Object *obj, Eina_Bool autodel);
203
204/**
205 * @brief Get the window's autodel state.
206 *
207 * @param[in] obj The object.
208 *
209 * @return If @c true, the window will automatically delete itself when closed.
210 *
211 * @ingroup Elm_Win
212 */
213EAPI Eina_Bool elm_win_autodel_get(const Evas_Object *obj);
214
215/**
183 * Set the floating mode of a window. 216 * Set the floating mode of a window.
184 * 217 *
185 * @param obj The window object 218 * @param obj The window object