create rotation job and EAPI e_border_rotation_set
[platform/core/uifw/e17.git] / src / bin / e_stolen.c
1 #include "e.h"
2
3 typedef struct _E_Stolen_Window E_Stolen_Window;
4
5 struct _E_Stolen_Window
6 {
7    Ecore_X_Window win;
8    int refcount;
9 };
10
11 static Eina_Hash *_e_stolen_windows = NULL;
12
13 /* externally accessible functions */
14 EAPI int
15 e_stolen_win_get(Ecore_X_Window win)
16 {
17    E_Stolen_Window *esw;
18
19    esw = eina_hash_find(_e_stolen_windows, e_util_winid_str_get(win));
20    if (esw) return 1;
21    return 0;
22 }
23
24 EAPI void
25 e_stolen_win_add(Ecore_X_Window win)
26 {
27    E_Stolen_Window *esw;
28
29    esw = eina_hash_find(_e_stolen_windows, e_util_winid_str_get(win));
30    if (esw)
31      {
32         esw->refcount++;
33      }
34    else
35      {
36         esw = E_NEW(E_Stolen_Window, 1);
37         esw->win = win;
38         esw->refcount = 1;
39         if (!_e_stolen_windows) _e_stolen_windows = eina_hash_string_superfast_new(NULL);
40         eina_hash_add(_e_stolen_windows, e_util_winid_str_get(win), esw);
41      }
42    return;
43 }
44
45 EAPI void
46 e_stolen_win_del(Ecore_X_Window win)
47 {
48    E_Stolen_Window *esw;
49
50    esw = eina_hash_find(_e_stolen_windows, e_util_winid_str_get(win));
51    if (esw)
52      {
53         esw->refcount--;
54         if (esw->refcount == 0)
55           {
56              eina_hash_del(_e_stolen_windows, e_util_winid_str_get(win), esw);
57              if (!eina_hash_population(_e_stolen_windows))
58                {
59                  eina_hash_free(_e_stolen_windows);
60                  _e_stolen_windows = NULL;
61                }
62              free(esw);
63           }
64      }
65    return;
66 }