summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChris Michael <devilhorns@comcast.net>2013-06-19 10:32:31 +0100
committerChris Michael <devilhorns@comcast.net>2013-06-19 10:32:31 +0100
commita9ab914845c50db80242f599388b3e50dfbba040 (patch)
treea2b6d9ba74b07ab9cd341a7bb3da0a3b78ae7fab /src
parentf9f9b30982cf69ef5989ebd7591d2a75c45d6c1a (diff)
Remove unused variable
Signed-off-by: Chris Michael <devilhorns@comcast.net>
Diffstat (limited to 'src')
-rw-r--r--src/bin/e_border.c20256
1 files changed, 10128 insertions, 10128 deletions
diff --git a/src/bin/e_border.c b/src/bin/e_border.c
index 6b2e39faa..218e04684 100644
--- a/src/bin/e_border.c
+++ b/src/bin/e_border.c
@@ -1,10129 +1,10129 @@
1#include "e.h" 1#include "e.h"
2 2
3//#define INOUTDEBUG_MOUSE 1 3//#define INOUTDEBUG_MOUSE 1
4//#define INOUTDEBUG_FOCUS 1 4//#define INOUTDEBUG_FOCUS 1
5 5
6/* local subsystem functions */ 6/* local subsystem functions */
7static void _e_border_pri_raise(E_Border *bd); 7static void _e_border_pri_raise(E_Border *bd);
8static void _e_border_pri_norm(E_Border *bd); 8static void _e_border_pri_norm(E_Border *bd);
9static void _e_border_free(E_Border *bd); 9static void _e_border_free(E_Border *bd);
10static void _e_border_del(E_Border *bd); 10static void _e_border_del(E_Border *bd);
11 11
12#ifdef PRINT_LOTS_OF_DEBUG 12#ifdef PRINT_LOTS_OF_DEBUG
13#define E_PRINT_BORDER_INFO(X) \ 13#define E_PRINT_BORDER_INFO(X) \
14 _e_border_print(X, __PRETTY_FUNC__) 14 _e_border_print(X, __PRETTY_FUNC__)
15 15
16static void _e_border_print(E_Border *bd, 16static void _e_border_print(E_Border *bd,
17 const char *func); 17 const char *func);
18#endif 18#endif
19 19
20static void _e_border_shadow(E_Border *bd); 20static void _e_border_shadow(E_Border *bd);
21 21
22/* FIXME: these likely belong in a separate icccm/client handler */ 22/* FIXME: these likely belong in a separate icccm/client handler */
23/* and the border needs to become a dumb object that just does what its */ 23/* and the border needs to become a dumb object that just does what its */
24/* told to do */ 24/* told to do */
25static Eina_Bool _e_border_cb_window_show_request(void *data, 25static Eina_Bool _e_border_cb_window_show_request(void *data,
26 int ev_type, 26 int ev_type,
27 void *ev); 27 void *ev);
28static Eina_Bool _e_border_cb_window_destroy(void *data, 28static Eina_Bool _e_border_cb_window_destroy(void *data,
29 int ev_type, 29 int ev_type,
30 void *ev); 30 void *ev);
31static Eina_Bool _e_border_cb_window_hide(void *data, 31static Eina_Bool _e_border_cb_window_hide(void *data,
32 int ev_type, 32 int ev_type,
33 void *ev); 33 void *ev);
34static Eina_Bool _e_border_cb_window_reparent(void *data, 34static Eina_Bool _e_border_cb_window_reparent(void *data,
35 int ev_type, 35 int ev_type,
36 void *ev); 36 void *ev);
37static Eina_Bool _e_border_cb_window_configure_request(void *data, 37static Eina_Bool _e_border_cb_window_configure_request(void *data,
38 int ev_type, 38 int ev_type,
39 void *ev); 39 void *ev);
40static Eina_Bool _e_border_cb_window_resize_request(void *data, 40static Eina_Bool _e_border_cb_window_resize_request(void *data,
41 int ev_type, 41 int ev_type,
42 void *ev); 42 void *ev);
43static Eina_Bool _e_border_cb_window_gravity(void *data, 43static Eina_Bool _e_border_cb_window_gravity(void *data,
44 int ev_type, 44 int ev_type,
45 void *ev); 45 void *ev);
46static Eina_Bool _e_border_cb_window_stack_request(void *data, 46static Eina_Bool _e_border_cb_window_stack_request(void *data,
47 int ev_type, 47 int ev_type,
48 void *ev); 48 void *ev);
49static Eina_Bool _e_border_cb_window_property(void *data, 49static Eina_Bool _e_border_cb_window_property(void *data,
50 int ev_type, 50 int ev_type,
51 void *ev); 51 void *ev);
52static Eina_Bool _e_border_cb_window_colormap(void *data, 52static Eina_Bool _e_border_cb_window_colormap(void *data,
53 int ev_type, 53 int ev_type,
54 void *ev); 54 void *ev);
55static Eina_Bool _e_border_cb_window_shape(void *data, 55static Eina_Bool _e_border_cb_window_shape(void *data,
56 int ev_type, 56 int ev_type,
57 void *ev); 57 void *ev);
58static Eina_Bool _e_border_cb_window_focus_in(void *data, 58static Eina_Bool _e_border_cb_window_focus_in(void *data,
59 int ev_type, 59 int ev_type,
60 void *ev); 60 void *ev);
61static Eina_Bool _e_border_cb_window_focus_out(void *data, 61static Eina_Bool _e_border_cb_window_focus_out(void *data,
62 int ev_type, 62 int ev_type,
63 void *ev); 63 void *ev);
64static Eina_Bool _e_border_cb_client_message(void *data, int ev_type, void *ev); 64static Eina_Bool _e_border_cb_client_message(void *data, int ev_type, void *ev);
65static Eina_Bool _e_border_cb_window_state_request(void *data, 65static Eina_Bool _e_border_cb_window_state_request(void *data,
66 int ev_type, 66 int ev_type,
67 void *ev); 67 void *ev);
68static Eina_Bool _e_border_cb_window_move_resize_request(void *data, 68static Eina_Bool _e_border_cb_window_move_resize_request(void *data,
69 int ev_type, 69 int ev_type,
70 void *ev); 70 void *ev);
71static Eina_Bool _e_border_cb_desktop_change(void *data, 71static Eina_Bool _e_border_cb_desktop_change(void *data,
72 int ev_type, 72 int ev_type,
73 void *ev); 73 void *ev);
74static Eina_Bool _e_border_cb_sync_alarm(void *data, 74static Eina_Bool _e_border_cb_sync_alarm(void *data,
75 int ev_type, 75 int ev_type,
76 void *ev); 76 void *ev);
77static Eina_Bool _e_border_cb_efreet_cache_update(void *data, 77static Eina_Bool _e_border_cb_efreet_cache_update(void *data,
78 int ev_type, 78 int ev_type,
79 void *ev); 79 void *ev);
80static Eina_Bool _e_border_cb_config_icon_theme(void *data, 80static Eina_Bool _e_border_cb_config_icon_theme(void *data,
81 int ev_type, 81 int ev_type,
82 void *ev); 82 void *ev);
83static Eina_Bool _e_border_cb_config_mode(void *data, 83static Eina_Bool _e_border_cb_config_mode(void *data,
84 int ev_type, 84 int ev_type,
85 void *ev); 85 void *ev);
86static Eina_Bool _e_border_cb_pointer_warp(void *data, 86static Eina_Bool _e_border_cb_pointer_warp(void *data,
87 int ev_type, 87 int ev_type,
88 void *ev); 88 void *ev);
89static void _e_border_cb_signal_bind(void *data, 89static void _e_border_cb_signal_bind(void *data,
90 Evas_Object *obj, 90 Evas_Object *obj,
91 const char *emission, 91 const char *emission,
92 const char *source); 92 const char *source);
93static Eina_Bool _e_border_cb_grab_replay(void *data, 93static Eina_Bool _e_border_cb_grab_replay(void *data,
94 int type, 94 int type,
95 void *event); 95 void *event);
96static void _e_border_cb_drag_finished(E_Drag *drag, 96static void _e_border_cb_drag_finished(E_Drag *drag,
97 int dropped); 97 int dropped);
98#if (ECORE_VERSION_MAJOR > 1) || (ECORE_VERSION_MINOR >= 8) 98#if (ECORE_VERSION_MAJOR > 1) || (ECORE_VERSION_MINOR >= 8)
99static Eina_Bool _e_border_cb_desk_window_profile_change(void *data, 99static Eina_Bool _e_border_cb_desk_window_profile_change(void *data,
100 int ev_type, 100 int ev_type,
101 void *ev); 101 void *ev);
102#endif 102#endif
103static void _e_border_eval(E_Border *bd); 103static void _e_border_eval(E_Border *bd);
104static void _e_border_eval0(E_Border *bd); 104static void _e_border_eval0(E_Border *bd);
105static void _e_border_container_layout_hook(E_Container *con); 105static void _e_border_container_layout_hook(E_Container *con);
106 106
107static void _e_border_moveinfo_gather(E_Border *bd, 107static void _e_border_moveinfo_gather(E_Border *bd,
108 const char *source); 108 const char *source);
109static void _e_border_resize_handle(E_Border *bd); 109static void _e_border_resize_handle(E_Border *bd);
110 110
111static Eina_Bool _e_border_shade_animator(void *data); 111static Eina_Bool _e_border_shade_animator(void *data);
112 112
113static void _e_border_event_border_add_free(void *data, 113static void _e_border_event_border_add_free(void *data,
114 void *ev); 114 void *ev);
115static void _e_border_event_border_remove_free(void *data, 115static void _e_border_event_border_remove_free(void *data,
116 void *ev); 116 void *ev);
117static void _e_border_event_border_zone_set_free(void *data, 117static void _e_border_event_border_zone_set_free(void *data,
118 void *ev); 118 void *ev);
119static void _e_border_event_border_desk_set_free(void *data, 119static void _e_border_event_border_desk_set_free(void *data,
120 void *ev); 120 void *ev);
121static void _e_border_event_border_stack_free(void *data, 121static void _e_border_event_border_stack_free(void *data,
122 void *ev); 122 void *ev);
123static void _e_border_event_border_icon_change_free(void *data, 123static void _e_border_event_border_icon_change_free(void *data,
124 void *ev); 124 void *ev);
125static void _e_border_event_border_title_change_free(void *data, 125static void _e_border_event_border_title_change_free(void *data,
126 void *ev); 126 void *ev);
127static void _e_border_event_border_urgent_change_free(void *data, 127static void _e_border_event_border_urgent_change_free(void *data,
128 void *ev); 128 void *ev);
129static void _e_border_event_border_focus_in_free(void *data, 129static void _e_border_event_border_focus_in_free(void *data,
130 void *ev); 130 void *ev);
131static void _e_border_event_border_focus_out_free(void *data, 131static void _e_border_event_border_focus_out_free(void *data,
132 void *ev); 132 void *ev);
133static void _e_border_event_border_resize_free(void *data, 133static void _e_border_event_border_resize_free(void *data,
134 void *ev); 134 void *ev);
135static void _e_border_event_border_move_free(void *data, 135static void _e_border_event_border_move_free(void *data,
136 void *ev); 136 void *ev);
137static void _e_border_event_border_show_free(void *data, 137static void _e_border_event_border_show_free(void *data,
138 void *ev); 138 void *ev);
139static void _e_border_event_border_hide_free(void *data, 139static void _e_border_event_border_hide_free(void *data,
140 void *ev); 140 void *ev);
141static void _e_border_event_border_iconify_free(void *data, 141static void _e_border_event_border_iconify_free(void *data,
142 void *ev); 142 void *ev);
143static void _e_border_event_border_uniconify_free(void *data, 143static void _e_border_event_border_uniconify_free(void *data,
144 void *ev); 144 void *ev);
145static void _e_border_event_border_stick_free(void *data, 145static void _e_border_event_border_stick_free(void *data,
146 void *ev); 146 void *ev);
147static void _e_border_event_border_unstick_free(void *data, 147static void _e_border_event_border_unstick_free(void *data,
148 void *ev); 148 void *ev);
149static void _e_border_event_border_property_free(void *data, 149static void _e_border_event_border_property_free(void *data,
150 void *ev); 150 void *ev);
151static void _e_border_event_border_fullscreen_free(void *data, 151static void _e_border_event_border_fullscreen_free(void *data,
152 void *ev); 152 void *ev);
153static void _e_border_event_border_unfullscreen_free(void *data, 153static void _e_border_event_border_unfullscreen_free(void *data,
154 void *ev); 154 void *ev);
155 155
156static void _e_border_zone_update(E_Border *bd); 156static void _e_border_zone_update(E_Border *bd);
157 157
158static int _e_border_resize_begin(E_Border *bd); 158static int _e_border_resize_begin(E_Border *bd);
159static int _e_border_resize_end(E_Border *bd); 159static int _e_border_resize_end(E_Border *bd);
160static void _e_border_resize_update(E_Border *bd); 160static void _e_border_resize_update(E_Border *bd);
161 161
162static int _e_border_move_begin(E_Border *bd); 162static int _e_border_move_begin(E_Border *bd);
163static int _e_border_move_end(E_Border *bd); 163static int _e_border_move_end(E_Border *bd);
164static void _e_border_move_update(E_Border *bd); 164static void _e_border_move_update(E_Border *bd);
165 165
166static Eina_Bool _e_border_cb_ping_poller(void *data); 166static Eina_Bool _e_border_cb_ping_poller(void *data);
167static Eina_Bool _e_border_cb_kill_timer(void *data); 167static Eina_Bool _e_border_cb_kill_timer(void *data);
168 168
169static void _e_border_hook_call(E_Border_Hook_Point hookpoint, 169static void _e_border_hook_call(E_Border_Hook_Point hookpoint,
170 void *bd); 170 void *bd);
171 171
172static void _e_border_client_move_resize_send(E_Border *bd); 172static void _e_border_client_move_resize_send(E_Border *bd);
173 173
174static void _e_border_shape_input_rectangle_set(E_Border *bd); 174static void _e_border_shape_input_rectangle_set(E_Border *bd);
175static void _e_border_show(E_Border *bd); 175static void _e_border_show(E_Border *bd);
176static void _e_border_hide(E_Border *bd); 176static void _e_border_hide(E_Border *bd);
177 177
178static void _e_border_cb_mouse_in(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info); 178static void _e_border_cb_mouse_in(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info);
179static void _e_border_cb_mouse_out(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info); 179static void _e_border_cb_mouse_out(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info);
180static void _e_border_cb_mouse_move(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info); 180static void _e_border_cb_mouse_move(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info);
181static void _e_border_cb_mouse_down(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info); 181static void _e_border_cb_mouse_down(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info);
182static void _e_border_cb_mouse_up(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info); 182static void _e_border_cb_mouse_up(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info);
183static void _e_border_cb_mouse_wheel(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info); 183static void _e_border_cb_mouse_wheel(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info);
184 184
185static Eina_Bool _e_border_cb_mouse_x_wheel(void *d EINA_UNUSED, int t, Ecore_Event_Mouse_Wheel *ev); 185static Eina_Bool _e_border_cb_mouse_x_wheel(void *d EINA_UNUSED, int t, Ecore_Event_Mouse_Wheel *ev);
186static Eina_Bool _e_border_cb_mouse_x_up(void *d EINA_UNUSED, int t, Ecore_Event_Mouse_Button *ev); 186static Eina_Bool _e_border_cb_mouse_x_up(void *d EINA_UNUSED, int t, Ecore_Event_Mouse_Button *ev);
187static Eina_Bool _e_border_cb_mouse_x_down(void *d EINA_UNUSED, int t, Ecore_Event_Mouse_Button *ev); 187static Eina_Bool _e_border_cb_mouse_x_down(void *d EINA_UNUSED, int t, Ecore_Event_Mouse_Button *ev);
188static Eina_Bool _e_border_cb_mouse_x_move(void *d, int t EINA_UNUSED, Ecore_Event_Mouse_Move *ev); 188static Eina_Bool _e_border_cb_mouse_x_move(void *d, int t EINA_UNUSED, Ecore_Event_Mouse_Move *ev);
189static Eina_Bool _e_border_cb_mouse_x_in(void *d, int t EINA_UNUSED, Ecore_X_Event_Mouse_In *ev); 189static Eina_Bool _e_border_cb_mouse_x_in(void *d, int t EINA_UNUSED, Ecore_X_Event_Mouse_In *ev);
190static Eina_Bool _e_border_cb_mouse_x_out(void *d, int t EINA_UNUSED, Ecore_X_Event_Mouse_Out *ev); 190static Eina_Bool _e_border_cb_mouse_x_out(void *d, int t EINA_UNUSED, Ecore_X_Event_Mouse_Out *ev);
191 191
192static void _e_border_move_lost_window_to_center(E_Border *bd); 192static void _e_border_move_lost_window_to_center(E_Border *bd);
193static void _e_border_reset_lost_window(E_Border *bd); 193static void _e_border_reset_lost_window(E_Border *bd);
194static Eina_Bool _e_border_pointer_warp_to_center_timer(void *data); 194static Eina_Bool _e_border_pointer_warp_to_center_timer(void *data);
195 195
196/* local subsystem globals */ 196/* local subsystem globals */
197static Eina_List *handlers = NULL; 197static Eina_List *handlers = NULL;
198static Eina_List *borders = NULL; 198static Eina_List *borders = NULL;
199static Eina_Hash *borders_hash = NULL; 199static Eina_Hash *borders_hash = NULL;
200static E_Border *focused = NULL; 200static E_Border *focused = NULL;
201static E_Border *focusing = NULL; 201static E_Border *focusing = NULL;
202static Eina_List *focus_next = NULL; 202static Eina_List *focus_next = NULL;
203static Ecore_X_Time focus_time = 0; 203static Ecore_X_Time focus_time = 0;
204 204
205static E_Border *bdresize = NULL; 205static E_Border *bdresize = NULL;
206static E_Border *bdmove = NULL; 206static E_Border *bdmove = NULL;
207static E_Drag *drag_border = NULL; 207static E_Drag *drag_border = NULL;
208 208
209static int grabbed = 0; 209static int grabbed = 0;
210 210
211static Eina_List *focus_stack = NULL; 211static Eina_List *focus_stack = NULL;
212static Eina_List *raise_stack = NULL; 212static Eina_List *raise_stack = NULL;
213 213
214static E_Border *warp_timer_border = NULL; 214static E_Border *warp_timer_border = NULL;
215static Eina_Bool focus_locked = EINA_FALSE; 215static Eina_Bool focus_locked = EINA_FALSE;
216 216
217static Ecore_X_Randr_Screen_Size screen_size = { -1, -1 }; 217static Ecore_X_Randr_Screen_Size screen_size = { -1, -1 };
218static int screen_size_index = -1; 218static int screen_size_index = -1;
219 219
220static int focus_track_frozen = 0; 220static int focus_track_frozen = 0;
221 221
222static int warp_to = 0; 222static int warp_to = 0;
223static int warp_to_x = 0; 223static int warp_to_x = 0;
224static int warp_to_y = 0; 224static int warp_to_y = 0;
225static int warp_x[2] = {0}; //{cur,prev} 225static int warp_x[2] = {0}; //{cur,prev}
226static int warp_y[2] = {0}; //{cur,prev} 226static int warp_y[2] = {0}; //{cur,prev}
227static Ecore_X_Window warp_to_win; 227static Ecore_X_Window warp_to_win;
228static Ecore_Timer *warp_timer = NULL; 228static Ecore_Timer *warp_timer = NULL;
229 229
230EAPI int E_EVENT_BORDER_ADD = 0; 230EAPI int E_EVENT_BORDER_ADD = 0;
231EAPI int E_EVENT_BORDER_REMOVE = 0; 231EAPI int E_EVENT_BORDER_REMOVE = 0;
232EAPI int E_EVENT_BORDER_ZONE_SET = 0; 232EAPI int E_EVENT_BORDER_ZONE_SET = 0;
233EAPI int E_EVENT_BORDER_DESK_SET = 0; 233EAPI int E_EVENT_BORDER_DESK_SET = 0;
234EAPI int E_EVENT_BORDER_RESIZE = 0; 234EAPI int E_EVENT_BORDER_RESIZE = 0;
235EAPI int E_EVENT_BORDER_MOVE = 0; 235EAPI int E_EVENT_BORDER_MOVE = 0;
236EAPI int E_EVENT_BORDER_SHOW = 0; 236EAPI int E_EVENT_BORDER_SHOW = 0;
237EAPI int E_EVENT_BORDER_HIDE = 0; 237EAPI int E_EVENT_BORDER_HIDE = 0;
238EAPI int E_EVENT_BORDER_ICONIFY = 0; 238EAPI int E_EVENT_BORDER_ICONIFY = 0;
239EAPI int E_EVENT_BORDER_UNICONIFY = 0; 239EAPI int E_EVENT_BORDER_UNICONIFY = 0;
240EAPI int E_EVENT_BORDER_STICK = 0; 240EAPI int E_EVENT_BORDER_STICK = 0;
241EAPI int E_EVENT_BORDER_UNSTICK = 0; 241EAPI int E_EVENT_BORDER_UNSTICK = 0;
242EAPI int E_EVENT_BORDER_STACK = 0; 242EAPI int E_EVENT_BORDER_STACK = 0;
243EAPI int E_EVENT_BORDER_ICON_CHANGE = 0; 243EAPI int E_EVENT_BORDER_ICON_CHANGE = 0;
244EAPI int E_EVENT_BORDER_TITLE_CHANGE = 0; 244EAPI int E_EVENT_BORDER_TITLE_CHANGE = 0;
245EAPI int E_EVENT_BORDER_URGENT_CHANGE = 0; 245EAPI int E_EVENT_BORDER_URGENT_CHANGE = 0;
246EAPI int E_EVENT_BORDER_FOCUS_IN = 0; 246EAPI int E_EVENT_BORDER_FOCUS_IN = 0;
247EAPI int E_EVENT_BORDER_FOCUS_OUT = 0; 247EAPI int E_EVENT_BORDER_FOCUS_OUT = 0;
248EAPI int E_EVENT_BORDER_PROPERTY = 0; 248EAPI int E_EVENT_BORDER_PROPERTY = 0;
249EAPI int E_EVENT_BORDER_FULLSCREEN = 0; 249EAPI int E_EVENT_BORDER_FULLSCREEN = 0;
250EAPI int E_EVENT_BORDER_UNFULLSCREEN = 0; 250EAPI int E_EVENT_BORDER_UNFULLSCREEN = 0;
251 251
252#define GRAV_SET(bd, grav) \ 252#define GRAV_SET(bd, grav) \
253 ecore_x_window_gravity_set(bd->win, grav); \ 253 ecore_x_window_gravity_set(bd->win, grav); \
254 if (bd->client.lock_win) ecore_x_window_gravity_set(bd->client.lock_win, grav); \ 254 if (bd->client.lock_win) ecore_x_window_gravity_set(bd->client.lock_win, grav); \
255 ecore_x_window_gravity_set(bd->client.win, grav); 255 ecore_x_window_gravity_set(bd->client.win, grav);
256 256
257static Eina_List * 257static Eina_List *
258_e_border_sub_borders_new(E_Border *bd) 258_e_border_sub_borders_new(E_Border *bd)
259{ 259{
260 Eina_List *list = NULL, *l; 260 Eina_List *list = NULL, *l;
261 E_Border *child; 261 E_Border *child;
262 262
263 EINA_LIST_FOREACH(bd->transients, l, child) 263 EINA_LIST_FOREACH(bd->transients, l, child)
264 { 264 {
265 if (!eina_list_data_find(list, child)) 265 if (!eina_list_data_find(list, child))
266 list = eina_list_append(list, child); 266 list = eina_list_append(list, child);
267 } 267 }
268 return list; 268 return list;
269} 269}
270 270
271/* externally accessible functions */ 271/* externally accessible functions */
272EINTERN int 272EINTERN int
273e_border_init(void) 273e_border_init(void)
274{ 274{
275 E_LIST_HANDLER_APPEND(handlers, ECORE_X_EVENT_WINDOW_SHOW_REQUEST, 275 E_LIST_HANDLER_APPEND(handlers, ECORE_X_EVENT_WINDOW_SHOW_REQUEST,
276 _e_border_cb_window_show_request, NULL); 276 _e_border_cb_window_show_request, NULL);
277 E_LIST_HANDLER_APPEND(handlers, ECORE_X_EVENT_WINDOW_DESTROY, 277 E_LIST_HANDLER_APPEND(handlers, ECORE_X_EVENT_WINDOW_DESTROY,
278 _e_border_cb_window_destroy, NULL); 278 _e_border_cb_window_destroy, NULL);
279 E_LIST_HANDLER_APPEND(handlers, ECORE_X_EVENT_WINDOW_HIDE, 279 E_LIST_HANDLER_APPEND(handlers, ECORE_X_EVENT_WINDOW_HIDE,
280 _e_border_cb_window_hide, NULL); 280 _e_border_cb_window_hide, NULL);
281 E_LIST_HANDLER_APPEND(handlers, ECORE_X_EVENT_WINDOW_REPARENT, 281 E_LIST_HANDLER_APPEND(handlers, ECORE_X_EVENT_WINDOW_REPARENT,
282 _e_border_cb_window_reparent, NULL); 282 _e_border_cb_window_reparent, NULL);
283 E_LIST_HANDLER_APPEND(handlers, ECORE_X_EVENT_WINDOW_CONFIGURE_REQUEST, 283 E_LIST_HANDLER_APPEND(handlers, ECORE_X_EVENT_WINDOW_CONFIGURE_REQUEST,
284 _e_border_cb_window_configure_request, NULL); 284 _e_border_cb_window_configure_request, NULL);
285 E_LIST_HANDLER_APPEND(handlers, ECORE_X_EVENT_WINDOW_RESIZE_REQUEST, 285 E_LIST_HANDLER_APPEND(handlers, ECORE_X_EVENT_WINDOW_RESIZE_REQUEST,
286 _e_border_cb_window_resize_request, NULL); 286 _e_border_cb_window_resize_request, NULL);
287 E_LIST_HANDLER_APPEND(handlers, ECORE_X_EVENT_WINDOW_GRAVITY, 287 E_LIST_HANDLER_APPEND(handlers, ECORE_X_EVENT_WINDOW_GRAVITY,
288 _e_border_cb_window_gravity, NULL); 288 _e_border_cb_window_gravity, NULL);
289 E_LIST_HANDLER_APPEND(handlers, ECORE_X_EVENT_WINDOW_STACK_REQUEST, 289 E_LIST_HANDLER_APPEND(handlers, ECORE_X_EVENT_WINDOW_STACK_REQUEST,
290 _e_border_cb_window_stack_request, NULL); 290 _e_border_cb_window_stack_request, NULL);
291 E_LIST_HANDLER_APPEND(handlers, ECORE_X_EVENT_WINDOW_PROPERTY, 291 E_LIST_HANDLER_APPEND(handlers, ECORE_X_EVENT_WINDOW_PROPERTY,
292 _e_border_cb_window_property, NULL); 292 _e_border_cb_window_property, NULL);
293 E_LIST_HANDLER_APPEND(handlers, ECORE_X_EVENT_WINDOW_COLORMAP, 293 E_LIST_HANDLER_APPEND(handlers, ECORE_X_EVENT_WINDOW_COLORMAP,
294 _e_border_cb_window_colormap, NULL); 294 _e_border_cb_window_colormap, NULL);
295 E_LIST_HANDLER_APPEND(handlers, ECORE_X_EVENT_WINDOW_SHAPE, 295 E_LIST_HANDLER_APPEND(handlers, ECORE_X_EVENT_WINDOW_SHAPE,
296 _e_border_cb_window_shape, NULL); 296 _e_border_cb_window_shape, NULL);
297 E_LIST_HANDLER_APPEND(handlers, ECORE_X_EVENT_WINDOW_FOCUS_IN, 297 E_LIST_HANDLER_APPEND(handlers, ECORE_X_EVENT_WINDOW_FOCUS_IN,
298 _e_border_cb_window_focus_in, NULL); 298 _e_border_cb_window_focus_in, NULL);
299 E_LIST_HANDLER_APPEND(handlers, ECORE_X_EVENT_WINDOW_FOCUS_OUT, 299 E_LIST_HANDLER_APPEND(handlers, ECORE_X_EVENT_WINDOW_FOCUS_OUT,
300 _e_border_cb_window_focus_out, NULL); 300 _e_border_cb_window_focus_out, NULL);
301 E_LIST_HANDLER_APPEND(handlers, ECORE_X_EVENT_CLIENT_MESSAGE, 301 E_LIST_HANDLER_APPEND(handlers, ECORE_X_EVENT_CLIENT_MESSAGE,
302 _e_border_cb_client_message, NULL); 302 _e_border_cb_client_message, NULL);
303 E_LIST_HANDLER_APPEND(handlers, ECORE_X_EVENT_WINDOW_STATE_REQUEST, 303 E_LIST_HANDLER_APPEND(handlers, ECORE_X_EVENT_WINDOW_STATE_REQUEST,
304 _e_border_cb_window_state_request, NULL); 304 _e_border_cb_window_state_request, NULL);
305 E_LIST_HANDLER_APPEND(handlers, ECORE_X_EVENT_WINDOW_MOVE_RESIZE_REQUEST, 305 E_LIST_HANDLER_APPEND(handlers, ECORE_X_EVENT_WINDOW_MOVE_RESIZE_REQUEST,
306 _e_border_cb_window_move_resize_request, NULL); 306 _e_border_cb_window_move_resize_request, NULL);
307 E_LIST_HANDLER_APPEND(handlers, ECORE_X_EVENT_DESKTOP_CHANGE, 307 E_LIST_HANDLER_APPEND(handlers, ECORE_X_EVENT_DESKTOP_CHANGE,
308 _e_border_cb_desktop_change, NULL); 308 _e_border_cb_desktop_change, NULL);
309 E_LIST_HANDLER_APPEND(handlers, ECORE_X_EVENT_SYNC_ALARM, 309 E_LIST_HANDLER_APPEND(handlers, ECORE_X_EVENT_SYNC_ALARM,
310 _e_border_cb_sync_alarm, NULL); 310 _e_border_cb_sync_alarm, NULL);
311 E_LIST_HANDLER_APPEND(handlers, ECORE_EVENT_MOUSE_BUTTON_DOWN, 311 E_LIST_HANDLER_APPEND(handlers, ECORE_EVENT_MOUSE_BUTTON_DOWN,
312 _e_border_cb_mouse_x_down, NULL); 312 _e_border_cb_mouse_x_down, NULL);
313 E_LIST_HANDLER_APPEND(handlers, ECORE_EVENT_MOUSE_BUTTON_UP, 313 E_LIST_HANDLER_APPEND(handlers, ECORE_EVENT_MOUSE_BUTTON_UP,
314 _e_border_cb_mouse_x_up, NULL); 314 _e_border_cb_mouse_x_up, NULL);
315 E_LIST_HANDLER_APPEND(handlers, ECORE_X_EVENT_MOUSE_IN, 315 E_LIST_HANDLER_APPEND(handlers, ECORE_X_EVENT_MOUSE_IN,
316 _e_border_cb_mouse_x_in, NULL); 316 _e_border_cb_mouse_x_in, NULL);
317 E_LIST_HANDLER_APPEND(handlers, ECORE_X_EVENT_MOUSE_OUT, 317 E_LIST_HANDLER_APPEND(handlers, ECORE_X_EVENT_MOUSE_OUT,
318 _e_border_cb_mouse_x_out, NULL); 318 _e_border_cb_mouse_x_out, NULL);
319 E_LIST_HANDLER_APPEND(handlers, ECORE_EVENT_MOUSE_WHEEL, 319 E_LIST_HANDLER_APPEND(handlers, ECORE_EVENT_MOUSE_WHEEL,
320 _e_border_cb_mouse_x_wheel, NULL); 320 _e_border_cb_mouse_x_wheel, NULL);
321 E_LIST_HANDLER_APPEND(handlers, ECORE_EVENT_MOUSE_MOVE, 321 E_LIST_HANDLER_APPEND(handlers, ECORE_EVENT_MOUSE_MOVE,
322 _e_border_cb_mouse_x_move, NULL); 322 _e_border_cb_mouse_x_move, NULL);
323 323
324 ecore_x_passive_grab_replay_func_set(_e_border_cb_grab_replay, NULL); 324 ecore_x_passive_grab_replay_func_set(_e_border_cb_grab_replay, NULL);
325 325
326 E_LIST_HANDLER_APPEND(handlers, E_EVENT_POINTER_WARP, 326 E_LIST_HANDLER_APPEND(handlers, E_EVENT_POINTER_WARP,
327 _e_border_cb_pointer_warp, NULL); 327 _e_border_cb_pointer_warp, NULL);
328 E_LIST_HANDLER_APPEND(handlers, EFREET_EVENT_DESKTOP_CACHE_UPDATE, 328 E_LIST_HANDLER_APPEND(handlers, EFREET_EVENT_DESKTOP_CACHE_UPDATE,
329 _e_border_cb_efreet_cache_update, NULL); 329 _e_border_cb_efreet_cache_update, NULL);
330 E_LIST_HANDLER_APPEND(handlers, EFREET_EVENT_ICON_CACHE_UPDATE, 330 E_LIST_HANDLER_APPEND(handlers, EFREET_EVENT_ICON_CACHE_UPDATE,
331 _e_border_cb_efreet_cache_update, NULL); 331 _e_border_cb_efreet_cache_update, NULL);
332 E_LIST_HANDLER_APPEND(handlers, E_EVENT_CONFIG_ICON_THEME, 332 E_LIST_HANDLER_APPEND(handlers, E_EVENT_CONFIG_ICON_THEME,
333 _e_border_cb_config_icon_theme, NULL); 333 _e_border_cb_config_icon_theme, NULL);
334 E_LIST_HANDLER_APPEND(handlers, E_EVENT_CONFIG_MODE_CHANGED, 334 E_LIST_HANDLER_APPEND(handlers, E_EVENT_CONFIG_MODE_CHANGED,
335 _e_border_cb_config_mode, NULL); 335 _e_border_cb_config_mode, NULL);
336#if (ECORE_VERSION_MAJOR > 1) || (ECORE_VERSION_MINOR >= 8) 336#if (ECORE_VERSION_MAJOR > 1) || (ECORE_VERSION_MINOR >= 8)
337 E_LIST_HANDLER_APPEND(handlers, E_EVENT_DESK_WINDOW_PROFILE_CHANGE, 337 E_LIST_HANDLER_APPEND(handlers, E_EVENT_DESK_WINDOW_PROFILE_CHANGE,
338 _e_border_cb_desk_window_profile_change, NULL); 338 _e_border_cb_desk_window_profile_change, NULL);
339#endif 339#endif
340 if (!borders_hash) borders_hash = eina_hash_string_superfast_new(NULL); 340 if (!borders_hash) borders_hash = eina_hash_string_superfast_new(NULL);
341 341
342 E_EVENT_BORDER_ADD = ecore_event_type_new(); 342 E_EVENT_BORDER_ADD = ecore_event_type_new();
343 E_EVENT_BORDER_REMOVE = ecore_event_type_new(); 343 E_EVENT_BORDER_REMOVE = ecore_event_type_new();
344 E_EVENT_BORDER_DESK_SET = ecore_event_type_new(); 344 E_EVENT_BORDER_DESK_SET = ecore_event_type_new();
345 E_EVENT_BORDER_ZONE_SET = ecore_event_type_new(); 345 E_EVENT_BORDER_ZONE_SET = ecore_event_type_new();
346 E_EVENT_BORDER_RESIZE = ecore_event_type_new(); 346 E_EVENT_BORDER_RESIZE = ecore_event_type_new();
347 E_EVENT_BORDER_MOVE = ecore_event_type_new(); 347 E_EVENT_BORDER_MOVE = ecore_event_type_new();
348 E_EVENT_BORDER_SHOW = ecore_event_type_new(); 348 E_EVENT_BORDER_SHOW = ecore_event_type_new();
349 E_EVENT_BORDER_HIDE = ecore_event_type_new(); 349 E_EVENT_BORDER_HIDE = ecore_event_type_new();
350 E_EVENT_BORDER_ICONIFY = ecore_event_type_new(); 350 E_EVENT_BORDER_ICONIFY = ecore_event_type_new();
351 E_EVENT_BORDER_UNICONIFY = ecore_event_type_new(); 351 E_EVENT_BORDER_UNICONIFY = ecore_event_type_new();
352 E_EVENT_BORDER_STICK = ecore_event_type_new(); 352 E_EVENT_BORDER_STICK = ecore_event_type_new();
353 E_EVENT_BORDER_UNSTICK = ecore_event_type_new(); 353 E_EVENT_BORDER_UNSTICK = ecore_event_type_new();
354 E_EVENT_BORDER_STACK = ecore_event_type_new(); 354 E_EVENT_BORDER_STACK = ecore_event_type_new();
355 E_EVENT_BORDER_ICON_CHANGE = ecore_event_type_new(); 355 E_EVENT_BORDER_ICON_CHANGE = ecore_event_type_new();
356 E_EVENT_BORDER_TITLE_CHANGE = ecore_event_type_new(); 356 E_EVENT_BORDER_TITLE_CHANGE = ecore_event_type_new();
357 E_EVENT_BORDER_URGENT_CHANGE = ecore_event_type_new(); 357 E_EVENT_BORDER_URGENT_CHANGE = ecore_event_type_new();
358 E_EVENT_BORDER_FOCUS_IN = ecore_event_type_new(); 358 E_EVENT_BORDER_FOCUS_IN = ecore_event_type_new();
359 E_EVENT_BORDER_FOCUS_OUT = ecore_event_type_new(); 359 E_EVENT_BORDER_FOCUS_OUT = ecore_event_type_new();
360 E_EVENT_BORDER_PROPERTY = ecore_event_type_new(); 360 E_EVENT_BORDER_PROPERTY = ecore_event_type_new();
361 E_EVENT_BORDER_FULLSCREEN = ecore_event_type_new(); 361 E_EVENT_BORDER_FULLSCREEN = ecore_event_type_new();
362 E_EVENT_BORDER_UNFULLSCREEN = ecore_event_type_new(); 362 E_EVENT_BORDER_UNFULLSCREEN = ecore_event_type_new();
363 363
364// e_init_undone(); 364// e_init_undone();
365 365
366 return 1; 366 return 1;
367} 367}
368 368
369EINTERN int 369EINTERN int
370e_border_shutdown(void) 370e_border_shutdown(void)
371{ 371{
372 E_FREE_LIST(handlers, ecore_event_handler_del); 372 E_FREE_LIST(handlers, ecore_event_handler_del);
373 373
374 if (borders_hash) eina_hash_free(borders_hash); 374 if (borders_hash) eina_hash_free(borders_hash);
375 borders_hash = NULL; 375 borders_hash = NULL;
376 e_int_border_menu_hooks_clear(); 376 e_int_border_menu_hooks_clear();
377 focus_locked = EINA_FALSE; 377 focus_locked = EINA_FALSE;
378 if (warp_timer) ecore_timer_del(warp_timer); 378 if (warp_timer) ecore_timer_del(warp_timer);
379 warp_timer = NULL; 379 warp_timer = NULL;
380 warp_timer_border = NULL; 380 warp_timer_border = NULL;
381 381
382 return 1; 382 return 1;
383} 383}
384 384
385EAPI void 385EAPI void
386e_border_focus_lock_set(Eina_Bool lock) 386e_border_focus_lock_set(Eina_Bool lock)
387{ 387{
388 focus_locked = !!lock; 388 focus_locked = !!lock;
389} 389}
390 390
391EAPI Eina_Bool 391EAPI Eina_Bool
392e_border_focus_lock_get(void) 392e_border_focus_lock_get(void)
393{ 393{
394 return focus_locked; 394 return focus_locked;
395} 395}
396 396
397EAPI E_Border * 397EAPI E_Border *
398e_border_new(E_Container *con, 398e_border_new(E_Container *con,
399 Ecore_X_Window win, 399 Ecore_X_Window win,
400 int first_map, 400 int first_map,
401 int internal) 401 int internal)
402{ 402{
403 E_Border *bd, *bd2; 403 E_Border *bd;
404 Ecore_X_Window_Attributes *att; 404 Ecore_X_Window_Attributes *att;
405 unsigned int managed, desk[2]; 405 unsigned int managed, desk[2];
406 int deskx, desky; 406 int deskx, desky;
407 407
408 if (eina_hash_find(borders_hash, e_util_winid_str_get(win))) return NULL; 408 if (eina_hash_find(borders_hash, e_util_winid_str_get(win))) return NULL;
409 bd = E_OBJECT_ALLOC(E_Border, E_BORDER_TYPE, _e_border_free); 409 bd = E_OBJECT_ALLOC(E_Border, E_BORDER_TYPE, _e_border_free);
410 if (!bd) return NULL; 410 if (!bd) return NULL;
411 ecore_x_window_shadow_tree_flush(); 411 ecore_x_window_shadow_tree_flush();
412 e_object_del_func_set(E_OBJECT(bd), E_OBJECT_CLEANUP_FUNC(_e_border_del)); 412 e_object_del_func_set(E_OBJECT(bd), E_OBJECT_CLEANUP_FUNC(_e_border_del));
413 413
414 bd->w = 1; 414 bd->w = 1;
415 bd->h = 1; 415 bd->h = 1;
416 /* FIXME: ewww - round trip */ 416 /* FIXME: ewww - round trip */
417 bd->client.argb = ecore_x_window_argb_get(win); 417 bd->client.argb = ecore_x_window_argb_get(win);
418 /* match bd parent argbness */ 418 /* match bd parent argbness */
419 if (bd->client.argb) 419 if (bd->client.argb)
420 bd->win = ecore_x_window_manager_argb_new(con->win, 0, 0, bd->w, bd->h); 420 bd->win = ecore_x_window_manager_argb_new(con->win, 0, 0, bd->w, bd->h);
421 else 421 else
422 { 422 {
423 bd->win = ecore_x_window_override_new(con->win, 0, 0, bd->w, bd->h); 423 bd->win = ecore_x_window_override_new(con->win, 0, 0, bd->w, bd->h);
424 ecore_x_window_shape_events_select(bd->win, 1); 424 ecore_x_window_shape_events_select(bd->win, 1);
425 } 425 }
426 e_bindings_mouse_grab(E_BINDING_CONTEXT_WINDOW, bd->win); 426 e_bindings_mouse_grab(E_BINDING_CONTEXT_WINDOW, bd->win);
427 e_bindings_wheel_grab(E_BINDING_CONTEXT_WINDOW, bd->win); 427 e_bindings_wheel_grab(E_BINDING_CONTEXT_WINDOW, bd->win);
428 e_focus_setup(bd); 428 e_focus_setup(bd);
429 /* FIXME: Round trip. XCB */ 429 /* FIXME: Round trip. XCB */
430 /* fetch needed to avoid grabbing the server as window may vanish */ 430 /* fetch needed to avoid grabbing the server as window may vanish */
431 att = &bd->client.initial_attributes; 431 att = &bd->client.initial_attributes;
432 if ((!ecore_x_window_attributes_get(win, att)) || (att->input_only)) 432 if ((!ecore_x_window_attributes_get(win, att)) || (att->input_only))
433 { 433 {
434 // printf("##- ATTR FETCH FAILED/INPUT ONLY FOR 0x%x - ABORT MANAGE\n", win); 434 // printf("##- ATTR FETCH FAILED/INPUT ONLY FOR 0x%x - ABORT MANAGE\n", win);
435 ecore_x_window_free(bd->win); 435 ecore_x_window_free(bd->win);
436 e_bindings_mouse_ungrab(E_BINDING_CONTEXT_WINDOW, bd->win); 436 e_bindings_mouse_ungrab(E_BINDING_CONTEXT_WINDOW, bd->win);
437 e_bindings_wheel_ungrab(E_BINDING_CONTEXT_WINDOW, bd->win); 437 e_bindings_wheel_ungrab(E_BINDING_CONTEXT_WINDOW, bd->win);
438 ecore_x_window_free(bd->win); 438 ecore_x_window_free(bd->win);
439 free(bd); 439 free(bd);
440 return NULL; 440 return NULL;
441 } 441 }
442 ecore_x_window_container_manage(bd->win); 442 ecore_x_window_container_manage(bd->win);
443 if (!internal) ecore_x_window_client_manage(win); 443 if (!internal) ecore_x_window_client_manage(win);
444 ecore_x_window_configure(bd->win, 444 ecore_x_window_configure(bd->win,
445 ECORE_X_WINDOW_CONFIGURE_MASK_SIBLING | 445 ECORE_X_WINDOW_CONFIGURE_MASK_SIBLING |
446 ECORE_X_WINDOW_CONFIGURE_MASK_STACK_MODE, 446 ECORE_X_WINDOW_CONFIGURE_MASK_STACK_MODE,
447 0, 0, 0, 0, 0, 447 0, 0, 0, 0, 0,
448 win, ECORE_X_WINDOW_STACK_BELOW); 448 win, ECORE_X_WINDOW_STACK_BELOW);
449 ecore_x_event_mask_set(bd->win, ECORE_X_EVENT_MASK_MOUSE_IN | ECORE_X_EVENT_MASK_MOUSE_OUT); 449 ecore_x_event_mask_set(bd->win, ECORE_X_EVENT_MASK_MOUSE_IN | ECORE_X_EVENT_MASK_MOUSE_OUT);
450 450
451 /* printf("##- ON MAP CLIENT 0x%x SIZE %ix%i %i:%i\n", 451 /* printf("##- ON MAP CLIENT 0x%x SIZE %ix%i %i:%i\n",
452 * bd->client.win, bd->client.w, bd->client.h, att->x, att->y); */ 452 * bd->client.win, bd->client.w, bd->client.h, att->x, att->y); */
453 453
454 /* FIXME: if first_map is 1 then we should ignore the first hide event 454 /* FIXME: if first_map is 1 then we should ignore the first hide event
455 * or ensure the window is already hidden and events flushed before we 455 * or ensure the window is already hidden and events flushed before we
456 * create a border for it */ 456 * create a border for it */
457 if (first_map) 457 if (first_map)
458 { 458 {
459 // printf("##- FIRST MAP\n"); 459 // printf("##- FIRST MAP\n");
460 bd->x = att->x; 460 bd->x = att->x;
461 bd->y = att->y; 461 bd->y = att->y;
462 bd->changes.pos = 1; 462 bd->changes.pos = 1;
463 bd->re_manage = 1; 463 bd->re_manage = 1;
464 // needed to be 1 for internal windw and on restart. 464 // needed to be 1 for internal windw and on restart.
465 // bd->ignore_first_unmap = 2; 465 // bd->ignore_first_unmap = 2;
466 } 466 }
467 467
468 bd->client.win = win; 468 bd->client.win = win;
469 bd->zone = e_zone_current_get(con); 469 bd->zone = e_zone_current_get(con);
470 470
471 _e_border_hook_call(E_BORDER_HOOK_NEW_BORDER, bd); 471 _e_border_hook_call(E_BORDER_HOOK_NEW_BORDER, bd);
472 472
473 bd->client.icccm.title = NULL; 473 bd->client.icccm.title = NULL;
474 bd->client.icccm.name = NULL; 474 bd->client.icccm.name = NULL;
475 bd->client.icccm.class = NULL; 475 bd->client.icccm.class = NULL;
476 bd->client.icccm.icon_name = NULL; 476 bd->client.icccm.icon_name = NULL;
477 bd->client.icccm.machine = NULL; 477 bd->client.icccm.machine = NULL;
478 bd->client.icccm.min_w = 1; 478 bd->client.icccm.min_w = 1;
479 bd->client.icccm.min_h = 1; 479 bd->client.icccm.min_h = 1;
480 bd->client.icccm.max_w = 32767; 480 bd->client.icccm.max_w = 32767;
481 bd->client.icccm.max_h = 32767; 481 bd->client.icccm.max_h = 32767;
482 bd->client.icccm.base_w = 0; 482 bd->client.icccm.base_w = 0;
483 bd->client.icccm.base_h = 0; 483 bd->client.icccm.base_h = 0;
484 bd->client.icccm.step_w = -1; 484 bd->client.icccm.step_w = -1;
485 bd->client.icccm.step_h = -1; 485 bd->client.icccm.step_h = -1;
486 bd->client.icccm.min_aspect = 0.0; 486 bd->client.icccm.min_aspect = 0.0;
487 bd->client.icccm.max_aspect = 0.0; 487 bd->client.icccm.max_aspect = 0.0;
488 bd->client.icccm.accepts_focus = 1; 488 bd->client.icccm.accepts_focus = 1;
489 489
490 bd->client.netwm.pid = 0; 490 bd->client.netwm.pid = 0;
491 bd->client.netwm.name = NULL; 491 bd->client.netwm.name = NULL;
492 bd->client.netwm.icon_name = NULL; 492 bd->client.netwm.icon_name = NULL;
493 bd->client.netwm.desktop = 0; 493 bd->client.netwm.desktop = 0;
494 bd->client.netwm.state.modal = 0; 494 bd->client.netwm.state.modal = 0;
495 bd->client.netwm.state.sticky = 0; 495 bd->client.netwm.state.sticky = 0;
496 bd->client.netwm.state.shaded = 0; 496 bd->client.netwm.state.shaded = 0;
497 bd->client.netwm.state.hidden = 0; 497 bd->client.netwm.state.hidden = 0;
498 bd->client.netwm.state.maximized_v = 0; 498 bd->client.netwm.state.maximized_v = 0;
499 bd->client.netwm.state.maximized_h = 0; 499 bd->client.netwm.state.maximized_h = 0;
500 bd->client.netwm.state.skip_taskbar = 0; 500 bd->client.netwm.state.skip_taskbar = 0;
501 bd->client.netwm.state.skip_pager = 0; 501 bd->client.netwm.state.skip_pager = 0;
502 bd->client.netwm.state.fullscreen = 0; 502 bd->client.netwm.state.fullscreen = 0;
503 bd->client.netwm.state.stacking = E_STACKING_NONE; 503 bd->client.netwm.state.stacking = E_STACKING_NONE;
504 bd->client.netwm.action.move = 0; 504 bd->client.netwm.action.move = 0;
505 bd->client.netwm.action.resize = 0; 505 bd->client.netwm.action.resize = 0;
506 bd->client.netwm.action.minimize = 0; 506 bd->client.netwm.action.minimize = 0;
507 bd->client.netwm.action.shade = 0; 507 bd->client.netwm.action.shade = 0;
508 bd->client.netwm.action.stick = 0; 508 bd->client.netwm.action.stick = 0;
509 bd->client.netwm.action.maximized_h = 0; 509 bd->client.netwm.action.maximized_h = 0;
510 bd->client.netwm.action.maximized_v = 0; 510 bd->client.netwm.action.maximized_v = 0;
511 bd->client.netwm.action.fullscreen = 0; 511 bd->client.netwm.action.fullscreen = 0;
512 bd->client.netwm.action.change_desktop = 0; 512 bd->client.netwm.action.change_desktop = 0;
513 bd->client.netwm.action.close = 0; 513 bd->client.netwm.action.close = 0;
514 bd->client.netwm.opacity = 255; 514 bd->client.netwm.opacity = 255;
515 bd->client.netwm.type = ECORE_X_WINDOW_TYPE_UNKNOWN; 515 bd->client.netwm.type = ECORE_X_WINDOW_TYPE_UNKNOWN;
516 516
517 { 517 {
518 int at_num = 0, i; 518 int at_num = 0, i;
519 Ecore_X_Atom *atoms; 519 Ecore_X_Atom *atoms;
520 520
521 atoms = ecore_x_window_prop_list(bd->client.win, &at_num); 521 atoms = ecore_x_window_prop_list(bd->client.win, &at_num);
522 bd->client.icccm.fetch.command = 1; 522 bd->client.icccm.fetch.command = 1;
523 if (atoms) 523 if (atoms)
524 { 524 {
525 Eina_Bool video_parent = EINA_FALSE; 525 Eina_Bool video_parent = EINA_FALSE;
526 Eina_Bool video_position = EINA_FALSE; 526 Eina_Bool video_position = EINA_FALSE;
527 527
528 /* icccm */ 528 /* icccm */
529 for (i = 0; i < at_num; i++) 529 for (i = 0; i < at_num; i++)
530 { 530 {
531 if (atoms[i] == ECORE_X_ATOM_WM_NAME) 531 if (atoms[i] == ECORE_X_ATOM_WM_NAME)
532 bd->client.icccm.fetch.title = 1; 532 bd->client.icccm.fetch.title = 1;
533 else if (atoms[i] == ECORE_X_ATOM_WM_CLASS) 533 else if (atoms[i] == ECORE_X_ATOM_WM_CLASS)
534 bd->client.icccm.fetch.name_class = 1; 534 bd->client.icccm.fetch.name_class = 1;
535 else if (atoms[i] == ECORE_X_ATOM_WM_ICON_NAME) 535 else if (atoms[i] == ECORE_X_ATOM_WM_ICON_NAME)
536 bd->client.icccm.fetch.icon_name = 1; 536 bd->client.icccm.fetch.icon_name = 1;
537 else if (atoms[i] == ECORE_X_ATOM_WM_CLIENT_MACHINE) 537 else if (atoms[i] == ECORE_X_ATOM_WM_CLIENT_MACHINE)
538 bd->client.icccm.fetch.machine = 1; 538 bd->client.icccm.fetch.machine = 1;
539 else if (atoms[i] == ECORE_X_ATOM_WM_HINTS) 539 else if (atoms[i] == ECORE_X_ATOM_WM_HINTS)
540 bd->client.icccm.fetch.hints = 1; 540 bd->client.icccm.fetch.hints = 1;
541 else if (atoms[i] == ECORE_X_ATOM_WM_NORMAL_HINTS) 541 else if (atoms[i] == ECORE_X_ATOM_WM_NORMAL_HINTS)
542 bd->client.icccm.fetch.size_pos_hints = 1; 542 bd->client.icccm.fetch.size_pos_hints = 1;
543 else if (atoms[i] == ECORE_X_ATOM_WM_PROTOCOLS) 543 else if (atoms[i] == ECORE_X_ATOM_WM_PROTOCOLS)
544 bd->client.icccm.fetch.protocol = 1; 544 bd->client.icccm.fetch.protocol = 1;
545 else if (atoms[i] == ECORE_X_ATOM_MOTIF_WM_HINTS) 545 else if (atoms[i] == ECORE_X_ATOM_MOTIF_WM_HINTS)
546 bd->client.mwm.fetch.hints = 1; 546 bd->client.mwm.fetch.hints = 1;
547 else if (atoms[i] == ECORE_X_ATOM_WM_TRANSIENT_FOR) 547 else if (atoms[i] == ECORE_X_ATOM_WM_TRANSIENT_FOR)
548 { 548 {
549 bd->client.icccm.fetch.transient_for = 1; 549 bd->client.icccm.fetch.transient_for = 1;
550 bd->client.netwm.fetch.type = 1; 550 bd->client.netwm.fetch.type = 1;
551 } 551 }
552 else if (atoms[i] == ECORE_X_ATOM_WM_CLIENT_LEADER) 552 else if (atoms[i] == ECORE_X_ATOM_WM_CLIENT_LEADER)
553 bd->client.icccm.fetch.client_leader = 1; 553 bd->client.icccm.fetch.client_leader = 1;
554 else if (atoms[i] == ECORE_X_ATOM_WM_WINDOW_ROLE) 554 else if (atoms[i] == ECORE_X_ATOM_WM_WINDOW_ROLE)
555 bd->client.icccm.fetch.window_role = 1; 555 bd->client.icccm.fetch.window_role = 1;
556 else if (atoms[i] == ECORE_X_ATOM_WM_STATE) 556 else if (atoms[i] == ECORE_X_ATOM_WM_STATE)
557 bd->client.icccm.fetch.state = 1; 557 bd->client.icccm.fetch.state = 1;
558 } 558 }
559 /* netwm, loop again, netwm will ignore some icccm, so we 559 /* netwm, loop again, netwm will ignore some icccm, so we
560 * have to be sure that netwm is checked after */ 560 * have to be sure that netwm is checked after */
561 for (i = 0; i < at_num; i++) 561 for (i = 0; i < at_num; i++)
562 { 562 {
563 if (atoms[i] == ECORE_X_ATOM_NET_WM_NAME) 563 if (atoms[i] == ECORE_X_ATOM_NET_WM_NAME)
564 { 564 {
565 /* Ignore icccm */ 565 /* Ignore icccm */
566 bd->client.icccm.fetch.title = 0; 566 bd->client.icccm.fetch.title = 0;
567 bd->client.netwm.fetch.name = 1; 567 bd->client.netwm.fetch.name = 1;
568 } 568 }
569 else if (atoms[i] == ECORE_X_ATOM_NET_WM_ICON_NAME) 569 else if (atoms[i] == ECORE_X_ATOM_NET_WM_ICON_NAME)
570 { 570 {
571 /* Ignore icccm */ 571 /* Ignore icccm */
572 bd->client.icccm.fetch.icon_name = 0; 572 bd->client.icccm.fetch.icon_name = 0;
573 bd->client.netwm.fetch.icon_name = 1; 573 bd->client.netwm.fetch.icon_name = 1;
574 } 574 }
575 else if (atoms[i] == ECORE_X_ATOM_NET_WM_ICON) 575 else if (atoms[i] == ECORE_X_ATOM_NET_WM_ICON)
576 { 576 {
577 bd->client.netwm.fetch.icon = 1; 577 bd->client.netwm.fetch.icon = 1;
578 } 578 }
579 else if (atoms[i] == ECORE_X_ATOM_NET_WM_USER_TIME) 579 else if (atoms[i] == ECORE_X_ATOM_NET_WM_USER_TIME)
580 { 580 {
581 bd->client.netwm.fetch.user_time = 1; 581 bd->client.netwm.fetch.user_time = 1;
582 } 582 }
583 else if (atoms[i] == ECORE_X_ATOM_NET_WM_STRUT) 583 else if (atoms[i] == ECORE_X_ATOM_NET_WM_STRUT)
584 { 584 {
585 DBG("ECORE_X_ATOM_NET_WM_STRUT"); 585 DBG("ECORE_X_ATOM_NET_WM_STRUT");
586 bd->client.netwm.fetch.strut = 1; 586 bd->client.netwm.fetch.strut = 1;
587 } 587 }
588 else if (atoms[i] == ECORE_X_ATOM_NET_WM_STRUT_PARTIAL) 588 else if (atoms[i] == ECORE_X_ATOM_NET_WM_STRUT_PARTIAL)
589 { 589 {
590 DBG("ECORE_X_ATOM_NET_WM_STRUT_PARTIAL"); 590 DBG("ECORE_X_ATOM_NET_WM_STRUT_PARTIAL");
591 bd->client.netwm.fetch.strut = 1; 591 bd->client.netwm.fetch.strut = 1;
592 } 592 }
593 else if (atoms[i] == ECORE_X_ATOM_NET_WM_WINDOW_TYPE) 593 else if (atoms[i] == ECORE_X_ATOM_NET_WM_WINDOW_TYPE)
594 { 594 {
595 /* Ignore mwm 595 /* Ignore mwm
596 bd->client.mwm.fetch.hints = 0; 596 bd->client.mwm.fetch.hints = 0;
597 */ 597 */
598 bd->client.netwm.fetch.type = 1; 598 bd->client.netwm.fetch.type = 1;
599 } 599 }
600 else if (atoms[i] == ECORE_X_ATOM_NET_WM_STATE) 600 else if (atoms[i] == ECORE_X_ATOM_NET_WM_STATE)
601 { 601 {
602 bd->client.netwm.fetch.state = 1; 602 bd->client.netwm.fetch.state = 1;
603 } 603 }
604 else if (atoms[i] == ECORE_X_ATOM_NET_WM_WINDOW_OPACITY) 604 else if (atoms[i] == ECORE_X_ATOM_NET_WM_WINDOW_OPACITY)
605 bd->client.netwm.fetch.opacity = 1; 605 bd->client.netwm.fetch.opacity = 1;
606 } 606 }
607 /* other misc atoms */ 607 /* other misc atoms */
608 for (i = 0; i < at_num; i++) 608 for (i = 0; i < at_num; i++)
609 { 609 {
610 /* loop to check for own atoms */ 610 /* loop to check for own atoms */
611 if (atoms[i] == E_ATOM_WINDOW_STATE) 611 if (atoms[i] == E_ATOM_WINDOW_STATE)
612 { 612 {
613 bd->client.e.fetch.state = 1; 613 bd->client.e.fetch.state = 1;
614 } 614 }
615 /* loop to check for qtopia atoms */ 615 /* loop to check for qtopia atoms */
616 if (atoms[i] == ATM__QTOPIA_SOFT_MENU) 616 if (atoms[i] == ATM__QTOPIA_SOFT_MENU)
617 bd->client.qtopia.fetch.soft_menu = 1; 617 bd->client.qtopia.fetch.soft_menu = 1;
618 else if (atoms[i] == ATM__QTOPIA_SOFT_MENUS) 618 else if (atoms[i] == ATM__QTOPIA_SOFT_MENUS)
619 bd->client.qtopia.fetch.soft_menus = 1; 619 bd->client.qtopia.fetch.soft_menus = 1;
620 /* loop to check for vkbd atoms */ 620 /* loop to check for vkbd atoms */
621 else if (atoms[i] == ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_STATE) 621 else if (atoms[i] == ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_STATE)
622 bd->client.vkbd.fetch.state = 1; 622 bd->client.vkbd.fetch.state = 1;
623 else if (atoms[i] == ECORE_X_ATOM_E_VIRTUAL_KEYBOARD) 623 else if (atoms[i] == ECORE_X_ATOM_E_VIRTUAL_KEYBOARD)
624 bd->client.vkbd.fetch.vkbd = 1; 624 bd->client.vkbd.fetch.vkbd = 1;
625 /* loop to check for illume atoms */ 625 /* loop to check for illume atoms */
626 else if (atoms[i] == ECORE_X_ATOM_E_ILLUME_CONFORMANT) 626 else if (atoms[i] == ECORE_X_ATOM_E_ILLUME_CONFORMANT)
627 bd->client.illume.conformant.fetch.conformant = 1; 627 bd->client.illume.conformant.fetch.conformant = 1;
628 else if (atoms[i] == ECORE_X_ATOM_E_ILLUME_QUICKPANEL_STATE) 628 else if (atoms[i] == ECORE_X_ATOM_E_ILLUME_QUICKPANEL_STATE)
629 bd->client.illume.quickpanel.fetch.state = 1; 629 bd->client.illume.quickpanel.fetch.state = 1;
630 else if (atoms[i] == ECORE_X_ATOM_E_ILLUME_QUICKPANEL) 630 else if (atoms[i] == ECORE_X_ATOM_E_ILLUME_QUICKPANEL)
631 bd->client.illume.quickpanel.fetch.quickpanel = 1; 631 bd->client.illume.quickpanel.fetch.quickpanel = 1;
632 else if (atoms[i] == ECORE_X_ATOM_E_ILLUME_QUICKPANEL_PRIORITY_MAJOR) 632 else if (atoms[i] == ECORE_X_ATOM_E_ILLUME_QUICKPANEL_PRIORITY_MAJOR)
633 bd->client.illume.quickpanel.fetch.priority.major = 1; 633 bd->client.illume.quickpanel.fetch.priority.major = 1;
634 else if (atoms[i] == ECORE_X_ATOM_E_ILLUME_QUICKPANEL_PRIORITY_MINOR) 634 else if (atoms[i] == ECORE_X_ATOM_E_ILLUME_QUICKPANEL_PRIORITY_MINOR)
635 bd->client.illume.quickpanel.fetch.priority.minor = 1; 635 bd->client.illume.quickpanel.fetch.priority.minor = 1;
636 else if (atoms[i] == ECORE_X_ATOM_E_ILLUME_QUICKPANEL_ZONE) 636 else if (atoms[i] == ECORE_X_ATOM_E_ILLUME_QUICKPANEL_ZONE)
637 bd->client.illume.quickpanel.fetch.zone = 1; 637 bd->client.illume.quickpanel.fetch.zone = 1;
638 else if (atoms[i] == ECORE_X_ATOM_E_ILLUME_DRAG_LOCKED) 638 else if (atoms[i] == ECORE_X_ATOM_E_ILLUME_DRAG_LOCKED)
639 bd->client.illume.drag.fetch.locked = 1; 639 bd->client.illume.drag.fetch.locked = 1;
640 else if (atoms[i] == ECORE_X_ATOM_E_ILLUME_DRAG) 640 else if (atoms[i] == ECORE_X_ATOM_E_ILLUME_DRAG)
641 bd->client.illume.drag.fetch.drag = 1; 641 bd->client.illume.drag.fetch.drag = 1;
642 else if (atoms[i] == ECORE_X_ATOM_E_ILLUME_WINDOW_STATE) 642 else if (atoms[i] == ECORE_X_ATOM_E_ILLUME_WINDOW_STATE)
643 bd->client.illume.win_state.fetch.state = 1; 643 bd->client.illume.win_state.fetch.state = 1;
644 else if (atoms[i] == ECORE_X_ATOM_E_VIDEO_PARENT) 644 else if (atoms[i] == ECORE_X_ATOM_E_VIDEO_PARENT)
645 video_parent = EINA_TRUE; 645 video_parent = EINA_TRUE;
646 else if (atoms[i] == ECORE_X_ATOM_E_VIDEO_POSITION) 646 else if (atoms[i] == ECORE_X_ATOM_E_VIDEO_POSITION)
647 video_position = EINA_TRUE; 647 video_position = EINA_TRUE;
648#if (ECORE_VERSION_MAJOR > 1) || (ECORE_VERSION_MINOR >= 8) 648#if (ECORE_VERSION_MAJOR > 1) || (ECORE_VERSION_MINOR >= 8)
649 /* loop to check for window profile list atom */ 649 /* loop to check for window profile list atom */
650 else if (atoms[i] == ECORE_X_ATOM_E_WINDOW_PROFILE_SUPPORTED) 650 else if (atoms[i] == ECORE_X_ATOM_E_WINDOW_PROFILE_SUPPORTED)
651 bd->client.e.fetch.profile = 1; 651 bd->client.e.fetch.profile = 1;
652#endif 652#endif
653 } 653 }
654 if (video_position && video_parent) 654 if (video_position && video_parent)
655 { 655 {
656 bd->client.e.state.video = 1; 656 bd->client.e.state.video = 1;
657 bd->client.e.fetch.video_parent = 1; 657 bd->client.e.fetch.video_parent = 1;
658 bd->client.e.fetch.video_position = 1; 658 bd->client.e.fetch.video_position = 1;
659 ecore_x_window_lower(bd->win); 659 ecore_x_window_lower(bd->win);
660 ecore_x_composite_window_events_disable(bd->win); 660 ecore_x_composite_window_events_disable(bd->win);
661 ecore_x_window_ignore_set(bd->win, EINA_TRUE); 661 ecore_x_window_ignore_set(bd->win, EINA_TRUE);
662 fprintf(stderr, "We found a video window \\o/ %x\n", win); 662 fprintf(stderr, "We found a video window \\o/ %x\n", win);
663 } 663 }
664 free(atoms); 664 free(atoms);
665 } 665 }
666 } 666 }
667 bd->client.border.changed = 1; 667 bd->client.border.changed = 1;
668 668
669 bd->client.w = att->w; 669 bd->client.w = att->w;
670 bd->client.h = att->h; 670 bd->client.h = att->h;
671 671
672 bd->w = bd->client.w; 672 bd->w = bd->client.w;
673 bd->h = bd->client.h; 673 bd->h = bd->client.h;
674 674
675 bd->resize_mode = E_POINTER_RESIZE_NONE; 675 bd->resize_mode = E_POINTER_RESIZE_NONE;
676 bd->layer = 100; 676 bd->layer = 100;
677 bd->saved.layer = bd->layer; 677 bd->saved.layer = bd->layer;
678 bd->changes.icon = 1; 678 bd->changes.icon = 1;
679 bd->changes.size = 1; 679 bd->changes.size = 1;
680 bd->changes.shape = 1; 680 bd->changes.shape = 1;
681 bd->changes.shape_input = 1; 681 bd->changes.shape_input = 1;
682 682
683 bd->offer_resistance = 1; 683 bd->offer_resistance = 1;
684 684
685 /* just to friggin make java happy - we're DELAYING the reparent until 685 /* just to friggin make java happy - we're DELAYING the reparent until
686 * eval time... 686 * eval time...
687 */ 687 */
688/* ecore_x_window_reparent(win, bd->win, 0, 0); */ 688/* ecore_x_window_reparent(win, bd->win, 0, 0); */
689 bd->need_reparent = 1; 689 bd->need_reparent = 1;
690 690
691 ecore_x_window_border_width_set(win, 0); 691 ecore_x_window_border_width_set(win, 0);
692 bd->shape = e_container_shape_add(con); 692 bd->shape = e_container_shape_add(con);
693 693
694 bd->take_focus = 1; 694 bd->take_focus = 1;
695 bd->new_client = 1; 695 bd->new_client = 1;
696 BD_CHANGED(bd); 696 BD_CHANGED(bd);
697 697
698// bd->zone = e_zone_current_get(con); 698// bd->zone = e_zone_current_get(con);
699 bd->desk = e_desk_current_get(bd->zone); 699 bd->desk = e_desk_current_get(bd->zone);
700 e_container_border_add(bd); 700 e_container_border_add(bd);
701 borders = eina_list_append(borders, bd); 701 borders = eina_list_append(borders, bd);
702 eina_hash_add(borders_hash, e_util_winid_str_get(bd->client.win), bd); 702 eina_hash_add(borders_hash, e_util_winid_str_get(bd->client.win), bd);
703 eina_hash_add(borders_hash, e_util_winid_str_get(bd->win), bd); 703 eina_hash_add(borders_hash, e_util_winid_str_get(bd->win), bd);
704 managed = 1; 704 managed = 1;
705 ecore_x_window_prop_card32_set(win, E_ATOM_MANAGED, &managed, 1); 705 ecore_x_window_prop_card32_set(win, E_ATOM_MANAGED, &managed, 1);
706 ecore_x_window_prop_card32_set(win, E_ATOM_CONTAINER, &bd->zone->container->num, 1); 706 ecore_x_window_prop_card32_set(win, E_ATOM_CONTAINER, &bd->zone->container->num, 1);
707 ecore_x_window_prop_card32_set(win, E_ATOM_ZONE, &bd->zone->num, 1); 707 ecore_x_window_prop_card32_set(win, E_ATOM_ZONE, &bd->zone->num, 1);
708 { 708 {
709 unsigned int zgeom[4]; 709 unsigned int zgeom[4];
710 710
711 zgeom[0] = bd->zone->x; 711 zgeom[0] = bd->zone->x;
712 zgeom[1] = bd->zone->y; 712 zgeom[1] = bd->zone->y;
713 zgeom[2] = bd->zone->w; 713 zgeom[2] = bd->zone->w;
714 zgeom[3] = bd->zone->h; 714 zgeom[3] = bd->zone->h;
715 ecore_x_window_prop_card32_set(win, E_ATOM_ZONE_GEOMETRY, zgeom, 4); 715 ecore_x_window_prop_card32_set(win, E_ATOM_ZONE_GEOMETRY, zgeom, 4);
716 } 716 }
717 e_desk_xy_get(bd->desk, &deskx, &desky); 717 e_desk_xy_get(bd->desk, &deskx, &desky);
718 desk[0] = deskx; 718 desk[0] = deskx;
719 desk[1] = desky; 719 desk[1] = desky;
720 ecore_x_window_prop_card32_set(win, E_ATOM_DESK, desk, 2); 720 ecore_x_window_prop_card32_set(win, E_ATOM_DESK, desk, 2);
721 721
722 focus_stack = eina_list_append(focus_stack, bd); 722 focus_stack = eina_list_append(focus_stack, bd);
723 723
724 return bd; 724 return bd;
725} 725}
726 726
727EAPI void 727EAPI void
728e_border_res_change_geometry_save(E_Border *bd) 728e_border_res_change_geometry_save(E_Border *bd)
729{ 729{
730 E_OBJECT_CHECK(bd); 730 E_OBJECT_CHECK(bd);
731 E_OBJECT_TYPE_CHECK(bd, E_BORDER_TYPE); 731 E_OBJECT_TYPE_CHECK(bd, E_BORDER_TYPE);
732 732
733 if (bd->pre_res_change.valid) return; 733 if (bd->pre_res_change.valid) return;
734 bd->pre_res_change.valid = 1; 734 bd->pre_res_change.valid = 1;
735 bd->pre_res_change.x = bd->x; 735 bd->pre_res_change.x = bd->x;
736 bd->pre_res_change.y = bd->y; 736 bd->pre_res_change.y = bd->y;
737 bd->pre_res_change.w = bd->w; 737 bd->pre_res_change.w = bd->w;
738 bd->pre_res_change.h = bd->h; 738 bd->pre_res_change.h = bd->h;
739 bd->pre_res_change.saved.x = bd->saved.x; 739 bd->pre_res_change.saved.x = bd->saved.x;
740 bd->pre_res_change.saved.y = bd->saved.y; 740 bd->pre_res_change.saved.y = bd->saved.y;
741 bd->pre_res_change.saved.w = bd->saved.w; 741 bd->pre_res_change.saved.w = bd->saved.w;
742 bd->pre_res_change.saved.h = bd->saved.h; 742 bd->pre_res_change.saved.h = bd->saved.h;
743} 743}
744 744
745EAPI void 745EAPI void
746e_border_res_change_geometry_restore(E_Border *bd) 746e_border_res_change_geometry_restore(E_Border *bd)
747{ 747{
748 struct 748 struct
749 { 749 {
750 unsigned char valid : 1; 750 unsigned char valid : 1;
751 int x, y, w, h; 751 int x, y, w, h;
752 struct 752 struct
753 { 753 {
754 int x, y, w, h; 754 int x, y, w, h;
755 } saved; 755 } saved;
756 } pre_res_change; 756 } pre_res_change;
757 757
758 E_OBJECT_CHECK(bd); 758 E_OBJECT_CHECK(bd);
759 E_OBJECT_TYPE_CHECK(bd, E_BORDER_TYPE); 759 E_OBJECT_TYPE_CHECK(bd, E_BORDER_TYPE);
760 if (!bd->pre_res_change.valid) return; 760 if (!bd->pre_res_change.valid) return;
761 if (bd->new_client) return; 761 if (bd->new_client) return;
762 762
763 ecore_x_window_shadow_tree_flush(); 763 ecore_x_window_shadow_tree_flush();
764 memcpy(&pre_res_change, &bd->pre_res_change, sizeof(pre_res_change)); 764 memcpy(&pre_res_change, &bd->pre_res_change, sizeof(pre_res_change));
765 765
766 if (bd->fullscreen) 766 if (bd->fullscreen)
767 { 767 {
768 e_border_unfullscreen(bd); 768 e_border_unfullscreen(bd);
769 e_border_fullscreen(bd, e_config->fullscreen_policy); 769 e_border_fullscreen(bd, e_config->fullscreen_policy);
770 } 770 }
771 else if (bd->maximized != E_MAXIMIZE_NONE) 771 else if (bd->maximized != E_MAXIMIZE_NONE)
772 { 772 {
773 E_Maximize max; 773 E_Maximize max;
774 774
775 max = bd->maximized; 775 max = bd->maximized;
776 e_border_unmaximize(bd, E_MAXIMIZE_BOTH); 776 e_border_unmaximize(bd, E_MAXIMIZE_BOTH);
777 e_border_maximize(bd, max); 777 e_border_maximize(bd, max);
778 } 778 }
779 else 779 else
780 { 780 {
781 int x, y, w, h, zx, zy, zw, zh; 781 int x, y, w, h, zx, zy, zw, zh;
782 782
783 bd->saved.x = bd->pre_res_change.saved.x; 783 bd->saved.x = bd->pre_res_change.saved.x;
784 bd->saved.y = bd->pre_res_change.saved.y; 784 bd->saved.y = bd->pre_res_change.saved.y;
785 bd->saved.w = bd->pre_res_change.saved.w; 785 bd->saved.w = bd->pre_res_change.saved.w;
786 bd->saved.h = bd->pre_res_change.saved.h; 786 bd->saved.h = bd->pre_res_change.saved.h;
787 787
788 e_zone_useful_geometry_get(bd->zone, &zx, &zy, &zw, &zh); 788 e_zone_useful_geometry_get(bd->zone, &zx, &zy, &zw, &zh);
789 789
790 if (bd->saved.w > zw) 790 if (bd->saved.w > zw)
791 bd->saved.w = zw; 791 bd->saved.w = zw;
792 if ((bd->saved.x + bd->saved.w) > (zx + zw)) 792 if ((bd->saved.x + bd->saved.w) > (zx + zw))
793 bd->saved.x = zx + zw - bd->saved.w; 793 bd->saved.x = zx + zw - bd->saved.w;
794 794
795 if (bd->saved.h > zh) 795 if (bd->saved.h > zh)
796 bd->saved.h = zh; 796 bd->saved.h = zh;
797 if ((bd->saved.y + bd->saved.h) > (zy + zh)) 797 if ((bd->saved.y + bd->saved.h) > (zy + zh))
798 bd->saved.y = zy + zh - bd->saved.h; 798 bd->saved.y = zy + zh - bd->saved.h;
799 799
800 x = bd->pre_res_change.x; 800 x = bd->pre_res_change.x;
801 y = bd->pre_res_change.y; 801 y = bd->pre_res_change.y;
802 w = bd->pre_res_change.w; 802 w = bd->pre_res_change.w;
803 h = bd->pre_res_change.h; 803 h = bd->pre_res_change.h;
804 if (w > zw) 804 if (w > zw)
805 w = zw; 805 w = zw;
806 if (h > zh) 806 if (h > zh)
807 h = zh; 807 h = zh;
808 if ((x + w) > (zx + zw)) 808 if ((x + w) > (zx + zw))
809 x = zx + zw - w; 809 x = zx + zw - w;
810 if ((y + h) > (zy + zh)) 810 if ((y + h) > (zy + zh))
811 y = zy + zh - h; 811 y = zy + zh - h;
812 e_border_move_resize(bd, x, y, w, h); 812 e_border_move_resize(bd, x, y, w, h);
813 } 813 }
814 memcpy(&bd->pre_res_change, &pre_res_change, sizeof(pre_res_change)); 814 memcpy(&bd->pre_res_change, &pre_res_change, sizeof(pre_res_change));
815} 815}
816 816
817EAPI void 817EAPI void
818e_border_zone_set(E_Border *bd, 818e_border_zone_set(E_Border *bd,
819 E_Zone *zone) 819 E_Zone *zone)
820{ 820{
821 E_Event_Border_Zone_Set *ev; 821 E_Event_Border_Zone_Set *ev;
822 822
823 E_OBJECT_CHECK(bd); 823 E_OBJECT_CHECK(bd);
824 E_OBJECT_TYPE_CHECK(bd, E_BORDER_TYPE); 824 E_OBJECT_TYPE_CHECK(bd, E_BORDER_TYPE);
825 E_OBJECT_CHECK(zone); 825 E_OBJECT_CHECK(zone);
826 E_OBJECT_TYPE_CHECK(zone, E_ZONE_TYPE); 826 E_OBJECT_TYPE_CHECK(zone, E_ZONE_TYPE);
827 if (!zone) return; 827 if (!zone) return;
828 if (bd->zone == zone) return; 828 if (bd->zone == zone) return;
829 829
830 /* if the window does not lie in the new zone, move it so that it does */ 830 /* if the window does not lie in the new zone, move it so that it does */
831 if (!E_INTERSECTS(bd->x, bd->y, bd->w, bd->h, zone->x, zone->y, zone->w, zone->h)) 831 if (!E_INTERSECTS(bd->x, bd->y, bd->w, bd->h, zone->x, zone->y, zone->w, zone->h))
832 { 832 {
833 int x, y; 833 int x, y;
834 /* first guess -- get offset from old zone, and apply to new zone */ 834 /* first guess -- get offset from old zone, and apply to new zone */
835 x = zone->x + (bd->x - bd->zone->x); 835 x = zone->x + (bd->x - bd->zone->x);
836 y = zone->y + (bd->y - bd->zone->y); 836 y = zone->y + (bd->y - bd->zone->y);
837 837
838 /* keep window from hanging off bottom and left */ 838 /* keep window from hanging off bottom and left */
839 if (x + bd->w > zone->x + zone->w) x += (zone->x + zone->w) - (x + bd->w); 839 if (x + bd->w > zone->x + zone->w) x += (zone->x + zone->w) - (x + bd->w);
840 if (y + bd->h > zone->y + zone->h) y += (zone->y + zone->h) - (y + bd->h); 840 if (y + bd->h > zone->y + zone->h) y += (zone->y + zone->h) - (y + bd->h);
841 841
842 /* make sure to and left are on screen (if the window is larger than the zone, it will hang off the bottom / right) */ 842 /* make sure to and left are on screen (if the window is larger than the zone, it will hang off the bottom / right) */
843 if (x < zone->x) x = zone->x; 843 if (x < zone->x) x = zone->x;
844 if (y < zone->y) y = zone->y; 844 if (y < zone->y) y = zone->y;
845 845
846 if (!E_INTERSECTS(x, y, bd->w, bd->h, zone->x, zone->y, zone->w, zone->h)) 846 if (!E_INTERSECTS(x, y, bd->w, bd->h, zone->x, zone->y, zone->w, zone->h))
847 { 847 {
848 /* still not in zone at all, so just move it to closest edge */ 848 /* still not in zone at all, so just move it to closest edge */
849 if (x < zone->x) x = zone->x; 849 if (x < zone->x) x = zone->x;
850 if (x >= zone->x + zone->w) x = zone->x + zone->w - bd->w; 850 if (x >= zone->x + zone->w) x = zone->x + zone->w - bd->w;
851 if (y < zone->y) y = zone->y; 851 if (y < zone->y) y = zone->y;
852 if (y >= zone->y + zone->h) y = zone->y + zone->h - bd->h; 852 if (y >= zone->y + zone->h) y = zone->y + zone->h - bd->h;
853 } 853 }
854 e_border_move(bd, x, y); 854 e_border_move(bd, x, y);
855 } 855 }
856 856
857 bd->zone = zone; 857 bd->zone = zone;
858 858
859 if (bd->desk->zone != bd->zone) 859 if (bd->desk->zone != bd->zone)
860 e_border_desk_set(bd, e_desk_current_get(bd->zone)); 860 e_border_desk_set(bd, e_desk_current_get(bd->zone));
861 861
862 ev = E_NEW(E_Event_Border_Zone_Set, 1); 862 ev = E_NEW(E_Event_Border_Zone_Set, 1);
863 ev->border = bd; 863 ev->border = bd;
864 e_object_ref(E_OBJECT(bd)); 864 e_object_ref(E_OBJECT(bd));
865// e_object_breadcrumb_add(E_OBJECT(bd), "border_zone_set_event"); 865// e_object_breadcrumb_add(E_OBJECT(bd), "border_zone_set_event");
866 ev->zone = zone; 866 ev->zone = zone;
867 e_object_ref(E_OBJECT(zone)); 867 e_object_ref(E_OBJECT(zone));
868 868
869 ecore_event_add(E_EVENT_BORDER_ZONE_SET, ev, _e_border_event_border_zone_set_free, NULL); 869 ecore_event_add(E_EVENT_BORDER_ZONE_SET, ev, _e_border_event_border_zone_set_free, NULL);
870 870
871 ecore_x_window_prop_card32_set(bd->client.win, E_ATOM_ZONE, &bd->zone->num, 1); 871 ecore_x_window_prop_card32_set(bd->client.win, E_ATOM_ZONE, &bd->zone->num, 1);
872 // XXXXXXXXXXXXXXXXXXXXXXXXX 872 // XXXXXXXXXXXXXXXXXXXXXXXXX
873 // XXX ZZZZZZZZZZZZZZZZZZZzz 873 // XXX ZZZZZZZZZZZZZZZZZZZzz
874 // need to adjust this if zone pos/size changes 874 // need to adjust this if zone pos/size changes
875 { 875 {
876 unsigned int zgeom[4]; 876 unsigned int zgeom[4];
877 877
878 zgeom[0] = bd->zone->x; 878 zgeom[0] = bd->zone->x;
879 zgeom[1] = bd->zone->y; 879 zgeom[1] = bd->zone->y;
880 zgeom[2] = bd->zone->w; 880 zgeom[2] = bd->zone->w;
881 zgeom[3] = bd->zone->h; 881 zgeom[3] = bd->zone->h;
882 ecore_x_window_prop_card32_set(bd->client.win, E_ATOM_ZONE_GEOMETRY, zgeom, 4); 882 ecore_x_window_prop_card32_set(bd->client.win, E_ATOM_ZONE_GEOMETRY, zgeom, 4);
883 } 883 }
884 e_remember_update(bd); 884 e_remember_update(bd);
885 e_border_res_change_geometry_save(bd); 885 e_border_res_change_geometry_save(bd);
886 e_border_res_change_geometry_restore(bd); 886 e_border_res_change_geometry_restore(bd);
887 bd->pre_res_change.valid = 0; 887 bd->pre_res_change.valid = 0;
888} 888}
889 889
890EAPI void 890EAPI void
891e_border_desk_set(E_Border *bd, 891e_border_desk_set(E_Border *bd,
892 E_Desk *desk) 892 E_Desk *desk)
893{ 893{
894 E_Event_Border_Desk_Set *ev; 894 E_Event_Border_Desk_Set *ev;
895 E_Desk *old_desk; 895 E_Desk *old_desk;
896 896
897 E_OBJECT_CHECK(bd); 897 E_OBJECT_CHECK(bd);
898 E_OBJECT_TYPE_CHECK(bd, E_BORDER_TYPE); 898 E_OBJECT_TYPE_CHECK(bd, E_BORDER_TYPE);
899 E_OBJECT_CHECK(desk); 899 E_OBJECT_CHECK(desk);
900 E_OBJECT_TYPE_CHECK(desk, E_DESK_TYPE); 900 E_OBJECT_TYPE_CHECK(desk, E_DESK_TYPE);
901 if (bd->desk == desk) return; 901 if (bd->desk == desk) return;
902#if (ECORE_VERSION_MAJOR > 1) || (ECORE_VERSION_MINOR >= 8) 902#if (ECORE_VERSION_MAJOR > 1) || (ECORE_VERSION_MINOR >= 8)
903 if ((e_config->use_desktop_window_profile) && 903 if ((e_config->use_desktop_window_profile) &&
904 (bd->client.e.state.profile.use)) 904 (bd->client.e.state.profile.use))
905 { 905 {
906 if (bd->client.e.state.profile.wait_for_done) return; 906 if (bd->client.e.state.profile.wait_for_done) return;
907 if (e_util_strcmp(bd->client.e.state.profile.name, desk->window_profile)) 907 if (e_util_strcmp(bd->client.e.state.profile.name, desk->window_profile))
908 { 908 {
909 ecore_x_e_window_profile_change_request_send(bd->client.win, 909 ecore_x_e_window_profile_change_request_send(bd->client.win,
910 desk->window_profile); 910 desk->window_profile);
911 bd->client.e.state.profile.wait_for_done = 1; 911 bd->client.e.state.profile.wait_for_done = 1;
912 return; 912 return;
913 } 913 }
914 } 914 }
915#endif 915#endif
916 ecore_x_window_shadow_tree_flush(); 916 ecore_x_window_shadow_tree_flush();
917 if (bd->fullscreen) 917 if (bd->fullscreen)
918 { 918 {
919 bd->desk->fullscreen_borders--; 919 bd->desk->fullscreen_borders--;
920 desk->fullscreen_borders++; 920 desk->fullscreen_borders++;
921 } 921 }
922 old_desk = bd->desk; 922 old_desk = bd->desk;
923 bd->desk = desk; 923 bd->desk = desk;
924 e_border_zone_set(bd, desk->zone); 924 e_border_zone_set(bd, desk->zone);
925 925
926 _e_border_hook_call(E_BORDER_HOOK_SET_DESK, bd); 926 _e_border_hook_call(E_BORDER_HOOK_SET_DESK, bd);
927 e_hints_window_desktop_set(bd); 927 e_hints_window_desktop_set(bd);
928 928
929 ev = E_NEW(E_Event_Border_Desk_Set, 1); 929 ev = E_NEW(E_Event_Border_Desk_Set, 1);
930 ev->border = bd; 930 ev->border = bd;
931 e_object_ref(E_OBJECT(bd)); 931 e_object_ref(E_OBJECT(bd));
932// e_object_breadcrumb_add(E_OBJECT(bd), "border_desk_set_event"); 932// e_object_breadcrumb_add(E_OBJECT(bd), "border_desk_set_event");
933 ev->desk = old_desk; 933 ev->desk = old_desk;
934 e_object_ref(E_OBJECT(old_desk)); 934 e_object_ref(E_OBJECT(old_desk));
935 ecore_event_add(E_EVENT_BORDER_DESK_SET, ev, _e_border_event_border_desk_set_free, NULL); 935 ecore_event_add(E_EVENT_BORDER_DESK_SET, ev, _e_border_event_border_desk_set_free, NULL);
936 936
937 if (bd->ignore_first_unmap != 1) 937 if (bd->ignore_first_unmap != 1)
938 { 938 {
939 if ((bd->desk->visible) || (bd->sticky)) 939 if ((bd->desk->visible) || (bd->sticky))
940 e_border_show(bd); 940 e_border_show(bd);
941 else 941 else
942 e_border_hide(bd, 1); 942 e_border_hide(bd, 1);
943 } 943 }
944 944
945 if (e_config->transient.desktop) 945 if (e_config->transient.desktop)
946 { 946 {
947 E_Border *child; 947 E_Border *child;
948 Eina_List *list = _e_border_sub_borders_new(bd); 948 Eina_List *list = _e_border_sub_borders_new(bd);
949 949
950 EINA_LIST_FREE(list, child) 950 EINA_LIST_FREE(list, child)
951 e_border_desk_set(child, bd->desk); 951 e_border_desk_set(child, bd->desk);
952 } 952 }
953 e_remember_update(bd); 953 e_remember_update(bd);
954} 954}
955 955
956EAPI void 956EAPI void
957e_border_show(E_Border *bd) 957e_border_show(E_Border *bd)
958{ 958{
959 E_Event_Border_Show *ev; 959 E_Event_Border_Show *ev;
960 unsigned int visible; 960 unsigned int visible;
961 961
962 E_OBJECT_CHECK(bd); 962 E_OBJECT_CHECK(bd);
963 E_OBJECT_TYPE_CHECK(bd, E_BORDER_TYPE); 963 E_OBJECT_TYPE_CHECK(bd, E_BORDER_TYPE);
964 if (bd->visible) return; 964 if (bd->visible) return;
965 ecore_x_window_shadow_tree_flush(); 965 ecore_x_window_shadow_tree_flush();
966 e_container_shape_show(bd->shape); 966 e_container_shape_show(bd->shape);
967 if (!bd->need_reparent) 967 if (!bd->need_reparent)
968 ecore_x_window_show(bd->client.win); 968 ecore_x_window_show(bd->client.win);
969 e_hints_window_visible_set(bd); 969 e_hints_window_visible_set(bd);
970 bd->hidden = 0; 970 bd->hidden = 0;
971 bd->visible = 1; 971 bd->visible = 1;
972 bd->changes.visible = 1; 972 bd->changes.visible = 1;
973 973
974 visible = 1; 974 visible = 1;
975 ecore_x_window_prop_card32_set(bd->client.win, E_ATOM_MAPPED, &visible, 1); 975 ecore_x_window_prop_card32_set(bd->client.win, E_ATOM_MAPPED, &visible, 1);
976 ecore_x_window_prop_card32_set(bd->client.win, E_ATOM_MANAGED, &visible, 1); 976 ecore_x_window_prop_card32_set(bd->client.win, E_ATOM_MANAGED, &visible, 1);
977 977
978 ev = E_NEW(E_Event_Border_Show, 1); 978 ev = E_NEW(E_Event_Border_Show, 1);
979 ev->border = bd; 979 ev->border = bd;
980 e_object_ref(E_OBJECT(bd)); 980 e_object_ref(E_OBJECT(bd));
981// e_object_breadcrumb_add(E_OBJECT(bd), "border_show_event"); 981// e_object_breadcrumb_add(E_OBJECT(bd), "border_show_event");
982 ecore_event_add(E_EVENT_BORDER_SHOW, ev, _e_border_event_border_show_free, NULL); 982 ecore_event_add(E_EVENT_BORDER_SHOW, ev, _e_border_event_border_show_free, NULL);
983} 983}
984 984
985EAPI void 985EAPI void
986e_border_hide(E_Border *bd, 986e_border_hide(E_Border *bd,
987 int manage) 987 int manage)
988{ 988{
989 unsigned int visible; 989 unsigned int visible;
990 990
991 E_OBJECT_CHECK(bd); 991 E_OBJECT_CHECK(bd);
992 E_OBJECT_TYPE_CHECK(bd, E_BORDER_TYPE); 992 E_OBJECT_TYPE_CHECK(bd, E_BORDER_TYPE);
993 if (!bd->visible) goto send_event; 993 if (!bd->visible) goto send_event;
994 ecore_x_window_shadow_tree_flush(); 994 ecore_x_window_shadow_tree_flush();
995 if (bd->moving) 995 if (bd->moving)
996 _e_border_move_end(bd); 996 _e_border_move_end(bd);
997 if (bd->resize_mode != E_POINTER_RESIZE_NONE) 997 if (bd->resize_mode != E_POINTER_RESIZE_NONE)
998 { 998 {
999 e_pointer_mode_pop(bd, bd->resize_mode); 999 e_pointer_mode_pop(bd, bd->resize_mode);
1000 bd->resize_mode = E_POINTER_RESIZE_NONE; 1000 bd->resize_mode = E_POINTER_RESIZE_NONE;
1001 _e_border_resize_end(bd); 1001 _e_border_resize_end(bd);
1002 } 1002 }
1003 1003
1004 e_container_shape_hide(bd->shape); 1004 e_container_shape_hide(bd->shape);
1005 if (!bd->iconic) e_hints_window_hidden_set(bd); 1005 if (!bd->iconic) e_hints_window_hidden_set(bd);
1006 1006
1007 bd->visible = 0; 1007 bd->visible = 0;
1008 bd->changes.visible = 1; 1008 bd->changes.visible = 1;
1009 1009
1010 if (!bd->need_reparent) 1010 if (!bd->need_reparent)
1011 { 1011 {
1012 if (bd->focused) 1012 if (bd->focused)
1013 { 1013 {
1014 e_border_focus_set(bd, 0, 1); 1014 e_border_focus_set(bd, 0, 1);
1015 if (manage != 2) 1015 if (manage != 2)
1016 { 1016 {
1017 E_Border *pbd; 1017 E_Border *pbd;
1018 E_Zone *zone; 1018 E_Zone *zone;
1019 E_Desk *desk; 1019 E_Desk *desk;
1020 1020
1021 zone = e_util_zone_current_get(e_manager_current_get()); 1021 zone = e_util_zone_current_get(e_manager_current_get());
1022 desk = e_desk_current_get(zone); 1022 desk = e_desk_current_get(zone);
1023 1023
1024 if ((bd->parent) && 1024 if ((bd->parent) &&
1025 (bd->parent->desk == desk) && (bd->parent->modal == bd)) 1025 (bd->parent->desk == desk) && (bd->parent->modal == bd))
1026 e_border_focus_set(bd->parent, 1, 1); 1026 e_border_focus_set(bd->parent, 1, 1);
1027 else if (e_config->focus_revert_on_hide_or_close) 1027 else if (e_config->focus_revert_on_hide_or_close)
1028 { 1028 {
1029 Eina_Bool unlock = bd->lock_focus_out; 1029 Eina_Bool unlock = bd->lock_focus_out;
1030 bd->lock_focus_out = 1; 1030 bd->lock_focus_out = 1;
1031 e_desk_last_focused_focus(desk); 1031 e_desk_last_focused_focus(desk);
1032 bd->lock_focus_out = unlock; 1032 bd->lock_focus_out = unlock;
1033 } 1033 }
1034 else if (e_config->focus_policy == E_FOCUS_MOUSE) 1034 else if (e_config->focus_policy == E_FOCUS_MOUSE)
1035 { 1035 {
1036 pbd = e_border_under_pointer_get(desk, bd); 1036 pbd = e_border_under_pointer_get(desk, bd);
1037 if (pbd) 1037 if (pbd)
1038 e_border_focus_set(pbd, 1, 1); 1038 e_border_focus_set(pbd, 1, 1);
1039 } 1039 }
1040 } 1040 }
1041 } 1041 }
1042 switch (manage) 1042 switch (manage)
1043 { 1043 {
1044 case 2: break; 1044 case 2: break;
1045 1045
1046 case 3: 1046 case 3:
1047 bd->hidden = 1; 1047 bd->hidden = 1;
1048 1048
1049 case 1: 1049 case 1:
1050 default: 1050 default:
1051 if (!e_comp_evas_exists(bd)) 1051 if (!e_comp_evas_exists(bd))
1052 { 1052 {
1053 /* Make sure that this border isn't deleted */ 1053 /* Make sure that this border isn't deleted */
1054 bd->await_hide_event++; 1054 bd->await_hide_event++;
1055 ecore_x_window_hide(bd->client.win); 1055 ecore_x_window_hide(bd->client.win);
1056 } 1056 }
1057 } 1057 }
1058 } 1058 }
1059 1059
1060 visible = 0; 1060 visible = 0;
1061 ecore_x_window_prop_card32_set(bd->client.win, E_ATOM_MAPPED, &visible, 1); 1061 ecore_x_window_prop_card32_set(bd->client.win, E_ATOM_MAPPED, &visible, 1);
1062 if (!manage) 1062 if (!manage)
1063 ecore_x_window_prop_card32_set(bd->client.win, E_ATOM_MANAGED, &visible, 1); 1063 ecore_x_window_prop_card32_set(bd->client.win, E_ATOM_MANAGED, &visible, 1);
1064 1064
1065 bd->post_show = 0; 1065 bd->post_show = 0;
1066 1066
1067send_event: 1067send_event:
1068 if (!stopping) 1068 if (!stopping)
1069 { 1069 {
1070 E_Event_Border_Hide *ev; 1070 E_Event_Border_Hide *ev;
1071 1071
1072 ev = E_NEW(E_Event_Border_Hide, 1); 1072 ev = E_NEW(E_Event_Border_Hide, 1);
1073 ev->border = bd; 1073 ev->border = bd;
1074 ev->manage = manage; 1074 ev->manage = manage;
1075 e_object_ref(E_OBJECT(bd)); 1075 e_object_ref(E_OBJECT(bd));
1076// e_object_breadcrumb_add(E_OBJECT(bd), "border_hide_event"); 1076// e_object_breadcrumb_add(E_OBJECT(bd), "border_hide_event");
1077 ecore_event_add(E_EVENT_BORDER_HIDE, ev, _e_border_event_border_hide_free, NULL); 1077 ecore_event_add(E_EVENT_BORDER_HIDE, ev, _e_border_event_border_hide_free, NULL);
1078 } 1078 }
1079} 1079}
1080 1080
1081static void 1081static void
1082_pri_adj(int pid, int set, int adj, Eina_Bool use_adj, Eina_Bool adj_children, Eina_Bool do_children) 1082_pri_adj(int pid, int set, int adj, Eina_Bool use_adj, Eina_Bool adj_children, Eina_Bool do_children)
1083{ 1083{
1084 int newpri = set; 1084 int newpri = set;
1085 1085
1086 if (use_adj) newpri = getpriority(PRIO_PROCESS, pid) + adj; 1086 if (use_adj) newpri = getpriority(PRIO_PROCESS, pid) + adj;
1087 setpriority(PRIO_PROCESS, pid, newpri); 1087 setpriority(PRIO_PROCESS, pid, newpri);
1088// shouldnt need to do this as default ionice class is "none" (0), and 1088// shouldnt need to do this as default ionice class is "none" (0), and
1089// this inherits io priority FROM nice level 1089// this inherits io priority FROM nice level
1090// ioprio_set(IOPRIO_WHO_PROCESS, pid, 1090// ioprio_set(IOPRIO_WHO_PROCESS, pid,
1091// IOPRIO_PRIO_VALUE(2, 5)); 1091// IOPRIO_PRIO_VALUE(2, 5));
1092 if (do_children) 1092 if (do_children)
1093 { 1093 {
1094 Eina_List *files; 1094 Eina_List *files;
1095 char *file, buf[PATH_MAX]; 1095 char *file, buf[PATH_MAX];
1096 FILE *f; 1096 FILE *f;
1097 int pid2, ppid; 1097 int pid2, ppid;
1098 1098
1099 // yes - this is /proc specific... so this may not work on some 1099 // yes - this is /proc specific... so this may not work on some
1100 // os's - works on linux. too bad for others. 1100 // os's - works on linux. too bad for others.
1101 files = ecore_file_ls("/proc"); 1101 files = ecore_file_ls("/proc");
1102 EINA_LIST_FREE(files, file) 1102 EINA_LIST_FREE(files, file)
1103 { 1103 {
1104 if (isdigit(file[0])) 1104 if (isdigit(file[0]))
1105 { 1105 {
1106 snprintf(buf, sizeof(buf), "/proc/%s/stat", file); 1106 snprintf(buf, sizeof(buf), "/proc/%s/stat", file);
1107 f = fopen(buf, "r"); 1107 f = fopen(buf, "r");
1108 if (f) 1108 if (f)
1109 { 1109 {
1110 pid2 = -1; 1110 pid2 = -1;
1111 ppid = -1; 1111 ppid = -1;
1112 if (fscanf(f, "%i %*s %*s %i %*s", &pid2, &ppid) == 2) 1112 if (fscanf(f, "%i %*s %*s %i %*s", &pid2, &ppid) == 2)
1113 { 1113 {
1114 fclose(f); 1114 fclose(f);
1115 if (ppid == pid) 1115 if (ppid == pid)
1116 { 1116 {
1117 if (adj_children) 1117 if (adj_children)
1118 _pri_adj(pid2, set, adj, EINA_TRUE, 1118 _pri_adj(pid2, set, adj, EINA_TRUE,
1119 adj_children, do_children); 1119 adj_children, do_children);
1120 else 1120 else
1121 _pri_adj(pid2, set, adj, use_adj, 1121 _pri_adj(pid2, set, adj, use_adj,
1122 adj_children, do_children); 1122 adj_children, do_children);
1123 } 1123 }
1124 } 1124 }
1125 else fclose(f); 1125 else fclose(f);
1126 } 1126 }
1127 } 1127 }
1128 free(file); 1128 free(file);
1129 } 1129 }
1130 } 1130 }
1131} 1131}
1132 1132
1133static void 1133static void
1134_e_border_pri_raise(E_Border *bd) 1134_e_border_pri_raise(E_Border *bd)
1135{ 1135{
1136 if (bd->client.netwm.pid <= 0) return; 1136 if (bd->client.netwm.pid <= 0) return;
1137 if (bd->client.netwm.pid == getpid()) return; 1137 if (bd->client.netwm.pid == getpid()) return;
1138 _pri_adj(bd->client.netwm.pid, 1138 _pri_adj(bd->client.netwm.pid,
1139 e_config->priority - 1, -1, EINA_FALSE, 1139 e_config->priority - 1, -1, EINA_FALSE,
1140// EINA_TRUE, EINA_TRUE); 1140// EINA_TRUE, EINA_TRUE);
1141 EINA_TRUE, EINA_FALSE); 1141 EINA_TRUE, EINA_FALSE);
1142// printf("WIN: pid %i, title %s (HI!!!!!!!!!!!!!!!!!!)\n", 1142// printf("WIN: pid %i, title %s (HI!!!!!!!!!!!!!!!!!!)\n",
1143// bd->client.netwm.pid, e_border_name_get(bd)); 1143// bd->client.netwm.pid, e_border_name_get(bd));
1144} 1144}
1145 1145
1146static void 1146static void
1147_e_border_pri_norm(E_Border *bd) 1147_e_border_pri_norm(E_Border *bd)
1148{ 1148{
1149 if (bd->client.netwm.pid <= 0) return; 1149 if (bd->client.netwm.pid <= 0) return;
1150 if (bd->client.netwm.pid == getpid()) return; 1150 if (bd->client.netwm.pid == getpid()) return;
1151 _pri_adj(bd->client.netwm.pid, 1151 _pri_adj(bd->client.netwm.pid,
1152 e_config->priority, 1, EINA_FALSE, 1152 e_config->priority, 1, EINA_FALSE,
1153// EINA_TRUE, EINA_TRUE); 1153// EINA_TRUE, EINA_TRUE);
1154 EINA_TRUE, EINA_FALSE); 1154 EINA_TRUE, EINA_FALSE);
1155// printf("WIN: pid %i, title %s (NORMAL)\n", 1155// printf("WIN: pid %i, title %s (NORMAL)\n",
1156// bd->client.netwm.pid, e_border_name_get(bd)); 1156// bd->client.netwm.pid, e_border_name_get(bd));
1157} 1157}
1158 1158
1159static void 1159static void
1160_e_border_client_move_resize_send(E_Border *bd) 1160_e_border_client_move_resize_send(E_Border *bd)
1161{ 1161{
1162 if (bd->internal_ecore_evas) 1162 if (bd->internal_ecore_evas)
1163 ecore_evas_managed_move(bd->internal_ecore_evas, 1163 ecore_evas_managed_move(bd->internal_ecore_evas,
1164 bd->client_inset.l, 1164 bd->client_inset.l,
1165 bd->client_inset.t); 1165 bd->client_inset.t);
1166 1166
1167 ecore_x_icccm_move_resize_send(bd->client.win, 1167 ecore_x_icccm_move_resize_send(bd->client.win,
1168 bd->x + bd->client_inset.l, 1168 bd->x + bd->client_inset.l,
1169 bd->y + bd->client_inset.t, 1169 bd->y + bd->client_inset.t,
1170 bd->client.w, 1170 bd->client.w,
1171 bd->client.h); 1171 bd->client.h);
1172} 1172}
1173 1173
1174static void 1174static void
1175_e_border_pending_move_resize_add(E_Border *bd, 1175_e_border_pending_move_resize_add(E_Border *bd,
1176 int move, 1176 int move,
1177 int resize, 1177 int resize,
1178 int x, 1178 int x,
1179 int y, 1179 int y,
1180 int w, 1180 int w,
1181 int h, 1181 int h,
1182 Eina_Bool without_border, 1182 Eina_Bool without_border,
1183 unsigned int serial) 1183 unsigned int serial)
1184{ 1184{
1185 E_Border_Pending_Move_Resize *pnd; 1185 E_Border_Pending_Move_Resize *pnd;
1186 1186
1187 pnd = E_NEW(E_Border_Pending_Move_Resize, 1); 1187 pnd = E_NEW(E_Border_Pending_Move_Resize, 1);
1188 if (!pnd) return; 1188 if (!pnd) return;
1189 pnd->resize = resize; 1189 pnd->resize = resize;
1190 pnd->move = move; 1190 pnd->move = move;
1191 pnd->without_border = without_border; 1191 pnd->without_border = without_border;
1192 pnd->x = x; 1192 pnd->x = x;
1193 pnd->y = y; 1193 pnd->y = y;
1194 pnd->w = w; 1194 pnd->w = w;
1195 pnd->h = h; 1195 pnd->h = h;
1196 pnd->serial = serial; 1196 pnd->serial = serial;
1197 bd->pending_move_resize = eina_list_append(bd->pending_move_resize, pnd); 1197 bd->pending_move_resize = eina_list_append(bd->pending_move_resize, pnd);
1198} 1198}
1199 1199
1200static void 1200static void
1201_e_border_move_internal(E_Border *bd, 1201_e_border_move_internal(E_Border *bd,
1202 int x, 1202 int x,
1203 int y, 1203 int y,
1204 Eina_Bool without_border) 1204 Eina_Bool without_border)
1205{ 1205{
1206 E_Event_Border_Move *ev; 1206 E_Event_Border_Move *ev;
1207 1207
1208 E_OBJECT_CHECK(bd); 1208 E_OBJECT_CHECK(bd);
1209 E_OBJECT_TYPE_CHECK(bd, E_BORDER_TYPE); 1209 E_OBJECT_TYPE_CHECK(bd, E_BORDER_TYPE);
1210 1210
1211 ecore_x_window_shadow_tree_flush(); 1211 ecore_x_window_shadow_tree_flush();
1212 if (bd->new_client) 1212 if (bd->new_client)
1213 { 1213 {
1214 _e_border_pending_move_resize_add(bd, 1, 0, x, y, 0, 0, without_border, 0); 1214 _e_border_pending_move_resize_add(bd, 1, 0, x, y, 0, 0, without_border, 0);
1215 return; 1215 return;
1216 } 1216 }
1217 1217
1218 if (bd->maximized) 1218 if (bd->maximized)
1219 { 1219 {
1220 if ((bd->maximized & E_MAXIMIZE_DIRECTION) != E_MAXIMIZE_BOTH) 1220 if ((bd->maximized & E_MAXIMIZE_DIRECTION) != E_MAXIMIZE_BOTH)
1221 { 1221 {
1222 if (e_config->allow_manip) 1222 if (e_config->allow_manip)
1223 bd->maximized = 0; 1223 bd->maximized = 0;
1224 1224
1225 if ((bd->maximized & E_MAXIMIZE_DIRECTION) == E_MAXIMIZE_HORIZONTAL) 1225 if ((bd->maximized & E_MAXIMIZE_DIRECTION) == E_MAXIMIZE_HORIZONTAL)
1226 { 1226 {
1227 x = bd->x; 1227 x = bd->x;
1228 } 1228 }
1229 else 1229 else
1230 if ((bd->maximized & E_MAXIMIZE_DIRECTION) == E_MAXIMIZE_VERTICAL) 1230 if ((bd->maximized & E_MAXIMIZE_DIRECTION) == E_MAXIMIZE_VERTICAL)
1231 { 1231 {
1232 y = bd->y; 1232 y = bd->y;
1233 } 1233 }
1234 } 1234 }
1235 else if (e_config->allow_manip) 1235 else if (e_config->allow_manip)
1236 bd->maximized = 0; 1236 bd->maximized = 0;
1237 else 1237 else
1238 return; 1238 return;
1239 } 1239 }
1240 1240
1241 if (without_border) 1241 if (without_border)
1242 { 1242 {
1243 x -= bd->client_inset.l; 1243 x -= bd->client_inset.l;
1244 y -= bd->client_inset.t; 1244 y -= bd->client_inset.t;
1245 } 1245 }
1246 if (bd->move_intercept_cb) 1246 if (bd->move_intercept_cb)
1247 { 1247 {
1248 int px, py; 1248 int px, py;
1249 px = bd->x, py = bd->y; 1249 px = bd->x, py = bd->y;
1250 bd->move_intercept_cb(bd, x, y); 1250 bd->move_intercept_cb(bd, x, y);
1251 if ((bd->x == px) && (bd->y == py)) return; 1251 if ((bd->x == px) && (bd->y == py)) return;
1252 } 1252 }
1253 else if ((x == bd->x) && (y == bd->y)) 1253 else if ((x == bd->x) && (y == bd->y))
1254 return; 1254 return;
1255 bd->pre_res_change.valid = 0; 1255 bd->pre_res_change.valid = 0;
1256 bd->x = x; 1256 bd->x = x;
1257 bd->y = y; 1257 bd->y = y;
1258 BD_CHANGED(bd); 1258 BD_CHANGED(bd);
1259 bd->changes.pos = 1; 1259 bd->changes.pos = 1;
1260#if 0 1260#if 0
1261 if (bd->client.netwm.sync.request) 1261 if (bd->client.netwm.sync.request)
1262 { 1262 {
1263 bd->client.netwm.sync.wait++; 1263 bd->client.netwm.sync.wait++;
1264 ecore_x_netwm_sync_request_send(bd->client.win, bd->client.netwm.sync.serial++); 1264 ecore_x_netwm_sync_request_send(bd->client.win, bd->client.netwm.sync.serial++);
1265 } 1265 }
1266#endif 1266#endif
1267 _e_border_client_move_resize_send(bd); 1267 _e_border_client_move_resize_send(bd);
1268 _e_border_move_update(bd); 1268 _e_border_move_update(bd);
1269 ev = E_NEW(E_Event_Border_Move, 1); 1269 ev = E_NEW(E_Event_Border_Move, 1);
1270 ev->border = bd; 1270 ev->border = bd;
1271 e_object_ref(E_OBJECT(bd)); 1271 e_object_ref(E_OBJECT(bd));
1272// e_object_breadcrumb_add(E_OBJECT(bd), "border_move_event"); 1272// e_object_breadcrumb_add(E_OBJECT(bd), "border_move_event");
1273 ecore_event_add(E_EVENT_BORDER_MOVE, ev, _e_border_event_border_move_free, NULL); 1273 ecore_event_add(E_EVENT_BORDER_MOVE, ev, _e_border_event_border_move_free, NULL);
1274 _e_border_zone_update(bd); 1274 _e_border_zone_update(bd);
1275} 1275}
1276 1276
1277/** 1277/**
1278 * Move window to coordinates that already account border decorations. 1278 * Move window to coordinates that already account border decorations.
1279 * 1279 *
1280 * This call will consider given position already accounts border 1280 * This call will consider given position already accounts border
1281 * decorations, so it will not be considered later. This will just 1281 * decorations, so it will not be considered later. This will just
1282 * work properly with borders that have being evaluated and border 1282 * work properly with borders that have being evaluated and border
1283 * decorations are known (border->client_inset). 1283 * decorations are known (border->client_inset).
1284 * 1284 *
1285 * @parm x horizontal position to place window. 1285 * @parm x horizontal position to place window.
1286 * @parm y vertical position to place window. 1286 * @parm y vertical position to place window.
1287 * 1287 *
1288 * @see e_border_move_without_border() 1288 * @see e_border_move_without_border()
1289 */ 1289 */
1290EAPI void 1290EAPI void
1291e_border_move(E_Border *bd, 1291e_border_move(E_Border *bd,
1292 int x, 1292 int x,
1293 int y) 1293 int y)
1294{ 1294{
1295 if (bd->fullscreen) 1295 if (bd->fullscreen)
1296 return; 1296 return;
1297 1297
1298 _e_border_move_internal(bd, x, y, 0); 1298 _e_border_move_internal(bd, x, y, 0);
1299} 1299}
1300 1300
1301/** 1301/**
1302 * Set a callback which will be called just prior to updating the 1302 * Set a callback which will be called just prior to updating the
1303 * move coordinates for a border 1303 * move coordinates for a border
1304 */ 1304 */
1305EAPI void 1305EAPI void
1306e_border_move_intercept_cb_set(E_Border *bd, E_Border_Move_Intercept_Cb cb) 1306e_border_move_intercept_cb_set(E_Border *bd, E_Border_Move_Intercept_Cb cb)
1307{ 1307{
1308 bd->move_intercept_cb = cb; 1308 bd->move_intercept_cb = cb;
1309} 1309}
1310 1310
1311/** 1311/**
1312 * Move window to coordinates that do not account border decorations yet. 1312 * Move window to coordinates that do not account border decorations yet.
1313 * 1313 *
1314 * This call will consider given position does not account border 1314 * This call will consider given position does not account border
1315 * decoration, so these values (border->client_inset) will be 1315 * decoration, so these values (border->client_inset) will be
1316 * accounted automatically. This is specially useful when it is a new 1316 * accounted automatically. This is specially useful when it is a new
1317 * client and has not be evaluated yet, in this case 1317 * client and has not be evaluated yet, in this case
1318 * border->client_inset will be zeroed and no information is known. It 1318 * border->client_inset will be zeroed and no information is known. It
1319 * will mark pending requests so border will be accounted on 1319 * will mark pending requests so border will be accounted on
1320 * evalutation phase. 1320 * evalutation phase.
1321 * 1321 *
1322 * @parm x horizontal position to place window. 1322 * @parm x horizontal position to place window.
1323 * @parm y vertical position to place window. 1323 * @parm y vertical position to place window.
1324 * 1324 *
1325 * @see e_border_move() 1325 * @see e_border_move()
1326 */ 1326 */
1327EAPI void 1327EAPI void
1328e_border_move_without_border(E_Border *bd, 1328e_border_move_without_border(E_Border *bd,
1329 int x, 1329 int x,
1330 int y) 1330 int y)
1331{ 1331{
1332 if (bd->fullscreen) 1332 if (bd->fullscreen)
1333 return; 1333 return;
1334 1334
1335 _e_border_move_internal(bd, x, y, 1); 1335 _e_border_move_internal(bd, x, y, 1);
1336} 1336}
1337 1337
1338EAPI void 1338EAPI void
1339e_border_center(E_Border *bd) 1339e_border_center(E_Border *bd)
1340{ 1340{
1341 int x, y, w, h; 1341 int x, y, w, h;
1342 E_OBJECT_CHECK(bd); 1342 E_OBJECT_CHECK(bd);
1343 E_OBJECT_TYPE_CHECK(bd, E_BORDER_TYPE); 1343 E_OBJECT_TYPE_CHECK(bd, E_BORDER_TYPE);
1344 1344
1345 e_zone_useful_geometry_get(bd->zone, &x, &y, &w, &h); 1345 e_zone_useful_geometry_get(bd->zone, &x, &y, &w, &h);
1346 e_border_move(bd, x + (w - bd->w) / 2, y + (h - bd->h) / 2); 1346 e_border_move(bd, x + (w - bd->w) / 2, y + (h - bd->h) / 2);
1347} 1347}
1348 1348
1349EAPI void 1349EAPI void
1350e_border_center_pos_get(E_Border *bd, 1350e_border_center_pos_get(E_Border *bd,
1351 int *x, 1351 int *x,
1352 int *y) 1352 int *y)
1353{ 1353{
1354 int zx, zy, zw, zh; 1354 int zx, zy, zw, zh;
1355 E_OBJECT_CHECK(bd); 1355 E_OBJECT_CHECK(bd);
1356 E_OBJECT_TYPE_CHECK(bd, E_BORDER_TYPE); 1356 E_OBJECT_TYPE_CHECK(bd, E_BORDER_TYPE);
1357 1357
1358 e_zone_useful_geometry_get(bd->zone, &zx, &zy, &zw, &zh); 1358 e_zone_useful_geometry_get(bd->zone, &zx, &zy, &zw, &zh);
1359 if (x) *x = zx + (zw - bd->w) / 2; 1359 if (x) *x = zx + (zw - bd->w) / 2;
1360 if (y) *y = zy + (zh - bd->h) / 2; 1360 if (y) *y = zy + (zh - bd->h) / 2;
1361} 1361}
1362 1362
1363static void 1363static void
1364_e_border_move_resize_internal(E_Border *bd, 1364_e_border_move_resize_internal(E_Border *bd,
1365 int x, 1365 int x,
1366 int y, 1366 int y,
1367 int w, 1367 int w,
1368 int h, 1368 int h,
1369 Eina_Bool without_border, 1369 Eina_Bool without_border,
1370 Eina_Bool move) 1370 Eina_Bool move)
1371{ 1371{
1372 E_Event_Border_Move *mev; 1372 E_Event_Border_Move *mev;
1373 E_Event_Border_Resize *rev; 1373 E_Event_Border_Resize *rev;
1374 1374
1375 E_OBJECT_CHECK(bd); 1375 E_OBJECT_CHECK(bd);
1376 E_OBJECT_TYPE_CHECK(bd, E_BORDER_TYPE); 1376 E_OBJECT_TYPE_CHECK(bd, E_BORDER_TYPE);
1377 1377
1378 ecore_x_window_shadow_tree_flush(); 1378 ecore_x_window_shadow_tree_flush();
1379 1379
1380 if (bd->new_client) 1380 if (bd->new_client)
1381 { 1381 {
1382 _e_border_pending_move_resize_add(bd, move, 1, x, y, w, h, without_border, 0); 1382 _e_border_pending_move_resize_add(bd, move, 1, x, y, w, h, without_border, 0);
1383 return; 1383 return;
1384 } 1384 }
1385 1385
1386 if (bd->maximized) 1386 if (bd->maximized)
1387 { 1387 {
1388 if ((bd->maximized & E_MAXIMIZE_DIRECTION) != E_MAXIMIZE_BOTH) 1388 if ((bd->maximized & E_MAXIMIZE_DIRECTION) != E_MAXIMIZE_BOTH)
1389 { 1389 {
1390 if (e_config->allow_manip) 1390 if (e_config->allow_manip)
1391 bd->maximized = 0; 1391 bd->maximized = 0;
1392 1392
1393 if ((bd->maximized & E_MAXIMIZE_DIRECTION) == E_MAXIMIZE_HORIZONTAL) 1393 if ((bd->maximized & E_MAXIMIZE_DIRECTION) == E_MAXIMIZE_HORIZONTAL)
1394 { 1394 {
1395 x = bd->x; 1395 x = bd->x;
1396 w = bd->w; 1396 w = bd->w;
1397 } 1397 }
1398 else 1398 else
1399 if ((bd->maximized & E_MAXIMIZE_DIRECTION) == E_MAXIMIZE_VERTICAL) 1399 if ((bd->maximized & E_MAXIMIZE_DIRECTION) == E_MAXIMIZE_VERTICAL)
1400 { 1400 {
1401 y = bd->y; 1401 y = bd->y;
1402 h = bd->h; 1402 h = bd->h;
1403 } 1403 }
1404 } 1404 }
1405 else 1405 else
1406 if (e_config->allow_manip) 1406 if (e_config->allow_manip)
1407 bd->maximized = 0; 1407 bd->maximized = 0;
1408 else 1408 else
1409 return; 1409 return;
1410 } 1410 }
1411 1411
1412 if (without_border) 1412 if (without_border)
1413 { 1413 {
1414 x -= bd->client_inset.l; 1414 x -= bd->client_inset.l;
1415 y -= bd->client_inset.t; 1415 y -= bd->client_inset.t;
1416 w += e_border_inset_width_get(bd); 1416 w += e_border_inset_width_get(bd);
1417 h += e_border_inset_height_get(bd); 1417 h += e_border_inset_height_get(bd);
1418 } 1418 }
1419 1419
1420 if ((!move || ((x == bd->x) && (y == bd->y))) && 1420 if ((!move || ((x == bd->x) && (y == bd->y))) &&
1421 (w == bd->w) && (h == bd->h)) 1421 (w == bd->w) && (h == bd->h))
1422 return; 1422 return;
1423 1423
1424 bd->pre_res_change.valid = 0; 1424 bd->pre_res_change.valid = 0;
1425 if (move) 1425 if (move)
1426 { 1426 {
1427 bd->changes.pos = 1; 1427 bd->changes.pos = 1;
1428 bd->x = x; 1428 bd->x = x;
1429 bd->y = y; 1429 bd->y = y;
1430 } 1430 }
1431 bd->w = w; 1431 bd->w = w;
1432 bd->h = h; 1432 bd->h = h;
1433 bd->client.w = bd->w - e_border_inset_width_get(bd); 1433 bd->client.w = bd->w - e_border_inset_width_get(bd);
1434 bd->client.h = bd->h - e_border_inset_height_get(bd); 1434 bd->client.h = bd->h - e_border_inset_height_get(bd);
1435 1435
1436 if (bd->client.shaped) 1436 if (bd->client.shaped)
1437 { 1437 {
1438 bd->need_shape_merge = 1; 1438 bd->need_shape_merge = 1;
1439 bd->need_shape_export = 1; 1439 bd->need_shape_export = 1;
1440 } 1440 }
1441 if (bd->shaped_input) 1441 if (bd->shaped_input)
1442 { 1442 {
1443 bd->need_shape_merge = 1; 1443 bd->need_shape_merge = 1;
1444 } 1444 }
1445 1445
1446 if (bd->internal_ecore_evas) 1446 if (bd->internal_ecore_evas)
1447 { 1447 {
1448 BD_CHANGED(bd); 1448 BD_CHANGED(bd);
1449 bd->changes.size = 1; 1449 bd->changes.size = 1;
1450 } 1450 }
1451 else 1451 else
1452 { 1452 {
1453 if (bdresize && bd->client.netwm.sync.request) 1453 if (bdresize && bd->client.netwm.sync.request)
1454 { 1454 {
1455 bd->client.netwm.sync.wait++; 1455 bd->client.netwm.sync.wait++;
1456 /* Don't use x and y as supplied to this function, as it is called with 0, 0 1456 /* Don't use x and y as supplied to this function, as it is called with 0, 0
1457 * when no move is intended. The border geometry is set above anyways. 1457 * when no move is intended. The border geometry is set above anyways.
1458 */ 1458 */
1459 _e_border_pending_move_resize_add(bd, move, 1, bd->x, bd->y, bd->w, bd->h, without_border, 1459 _e_border_pending_move_resize_add(bd, move, 1, bd->x, bd->y, bd->w, bd->h, without_border,
1460 bd->client.netwm.sync.serial); 1460 bd->client.netwm.sync.serial);
1461 ecore_x_netwm_sync_request_send(bd->client.win, 1461 ecore_x_netwm_sync_request_send(bd->client.win,
1462 bd->client.netwm.sync.serial++); 1462 bd->client.netwm.sync.serial++);
1463 } 1463 }
1464 else 1464 else
1465 { 1465 {
1466 BD_CHANGED(bd); 1466 BD_CHANGED(bd);
1467 bd->changes.size = 1; 1467 bd->changes.size = 1;
1468 } 1468 }
1469 } 1469 }
1470 1470
1471 _e_border_client_move_resize_send(bd); 1471 _e_border_client_move_resize_send(bd);
1472 1472
1473 _e_border_resize_update(bd); 1473 _e_border_resize_update(bd);
1474 if (move) 1474 if (move)
1475 { 1475 {
1476 mev = E_NEW(E_Event_Border_Move, 1); 1476 mev = E_NEW(E_Event_Border_Move, 1);
1477 mev->border = bd; 1477 mev->border = bd;
1478 e_object_ref(E_OBJECT(bd)); 1478 e_object_ref(E_OBJECT(bd));
1479 // e_object_breadcrumb_add(E_OBJECT(bd), "border_move_event"); 1479 // e_object_breadcrumb_add(E_OBJECT(bd), "border_move_event");
1480 ecore_event_add(E_EVENT_BORDER_MOVE, mev, _e_border_event_border_move_free, NULL); 1480 ecore_event_add(E_EVENT_BORDER_MOVE, mev, _e_border_event_border_move_free, NULL);
1481 } 1481 }
1482 1482
1483 rev = E_NEW(E_Event_Border_Resize, 1); 1483 rev = E_NEW(E_Event_Border_Resize, 1);
1484 rev->border = bd; 1484 rev->border = bd;
1485 e_object_ref(E_OBJECT(bd)); 1485 e_object_ref(E_OBJECT(bd));
1486// e_object_breadcrumb_add(E_OBJECT(bd), "border_resize_event"); 1486// e_object_breadcrumb_add(E_OBJECT(bd), "border_resize_event");
1487 ecore_event_add(E_EVENT_BORDER_RESIZE, rev, _e_border_event_border_resize_free, NULL); 1487 ecore_event_add(E_EVENT_BORDER_RESIZE, rev, _e_border_event_border_resize_free, NULL);
1488 _e_border_zone_update(bd); 1488 _e_border_zone_update(bd);
1489} 1489}
1490 1490
1491/** 1491/**
1492 * Move and resize window to values that already account border decorations. 1492 * Move and resize window to values that already account border decorations.
1493 * 1493 *
1494 * This call will consider given values already accounts border 1494 * This call will consider given values already accounts border
1495 * decorations, so it will not be considered later. This will just 1495 * decorations, so it will not be considered later. This will just
1496 * work properly with borders that have being evaluated and border 1496 * work properly with borders that have being evaluated and border
1497 * decorations are known (border->client_inset). 1497 * decorations are known (border->client_inset).
1498 * 1498 *
1499 * @parm x horizontal position to place window. 1499 * @parm x horizontal position to place window.
1500 * @parm y vertical position to place window. 1500 * @parm y vertical position to place window.
1501 * @parm w horizontal window size. 1501 * @parm w horizontal window size.
1502 * @parm h vertical window size. 1502 * @parm h vertical window size.
1503 * 1503 *
1504 * @see e_border_move_resize_without_border() 1504 * @see e_border_move_resize_without_border()
1505 */ 1505 */
1506EAPI void 1506EAPI void
1507e_border_move_resize(E_Border *bd, 1507e_border_move_resize(E_Border *bd,
1508 int x, 1508 int x,
1509 int y, 1509 int y,
1510 int w, 1510 int w,
1511 int h) 1511 int h)
1512{ 1512{
1513 if (bd->fullscreen) 1513 if (bd->fullscreen)
1514 return; 1514 return;
1515 1515
1516 _e_border_move_resize_internal(bd, x, y, w, h, 0, 1); 1516 _e_border_move_resize_internal(bd, x, y, w, h, 0, 1);
1517} 1517}
1518 1518
1519/** 1519/**
1520 * Move and resize window to values that do not account border decorations yet. 1520 * Move and resize window to values that do not account border decorations yet.
1521 * 1521 *
1522 * This call will consider given values already accounts border 1522 * This call will consider given values already accounts border
1523 * decorations, so it will not be considered later. This will just 1523 * decorations, so it will not be considered later. This will just
1524 * work properly with borders that have being evaluated and border 1524 * work properly with borders that have being evaluated and border
1525 * decorations are known (border->client_inset). 1525 * decorations are known (border->client_inset).
1526 * 1526 *
1527 * @parm x horizontal position to place window. 1527 * @parm x horizontal position to place window.
1528 * @parm y vertical position to place window. 1528 * @parm y vertical position to place window.
1529 * @parm w horizontal window size. 1529 * @parm w horizontal window size.
1530 * @parm h vertical window size. 1530 * @parm h vertical window size.
1531 * 1531 *
1532 * @see e_border_move_resize() 1532 * @see e_border_move_resize()
1533 */ 1533 */
1534EAPI void 1534EAPI void
1535e_border_move_resize_without_border(E_Border *bd, 1535e_border_move_resize_without_border(E_Border *bd,
1536 int x, 1536 int x,
1537 int y, 1537 int y,
1538 int w, 1538 int w,
1539 int h) 1539 int h)
1540{ 1540{
1541 if (bd->fullscreen) 1541 if (bd->fullscreen)
1542 return; 1542 return;
1543 1543
1544 _e_border_move_resize_internal(bd, x, y, w, h, 1, 1); 1544 _e_border_move_resize_internal(bd, x, y, w, h, 1, 1);
1545} 1545}
1546 1546
1547/** 1547/**
1548 * Resize window to values that already account border decorations. 1548 * Resize window to values that already account border decorations.
1549 * 1549 *
1550 * This call will consider given size already accounts border 1550 * This call will consider given size already accounts border
1551 * decorations, so it will not be considered later. This will just 1551 * decorations, so it will not be considered later. This will just
1552 * work properly with borders that have being evaluated and border 1552 * work properly with borders that have being evaluated and border
1553 * decorations are known (border->client_inset). 1553 * decorations are known (border->client_inset).
1554 * 1554 *
1555 * @parm w horizontal window size. 1555 * @parm w horizontal window size.
1556 * @parm h vertical window size. 1556 * @parm h vertical window size.
1557 * 1557 *
1558 * @see e_border_resize_without_border() 1558 * @see e_border_resize_without_border()
1559 */ 1559 */
1560EAPI void 1560EAPI void
1561e_border_resize(E_Border *bd, 1561e_border_resize(E_Border *bd,
1562 int w, 1562 int w,
1563 int h) 1563 int h)
1564{ 1564{
1565 if (bd->fullscreen) 1565 if (bd->fullscreen)
1566 return; 1566 return;
1567 1567
1568 _e_border_move_resize_internal(bd, 0, 0, w, h, 0, 0); 1568 _e_border_move_resize_internal(bd, 0, 0, w, h, 0, 0);
1569} 1569}
1570 1570
1571/** 1571/**
1572 * Resize window to values that do not account border decorations yet. 1572 * Resize window to values that do not account border decorations yet.
1573 * 1573 *
1574 * This call will consider given size does not account border 1574 * This call will consider given size does not account border
1575 * decoration, so these values (border->client_inset) will be 1575 * decoration, so these values (border->client_inset) will be
1576 * accounted automatically. This is specially useful when it is a new 1576 * accounted automatically. This is specially useful when it is a new
1577 * client and has not be evaluated yet, in this case 1577 * client and has not be evaluated yet, in this case
1578 * border->client_inset will be zeroed and no information is known. It 1578 * border->client_inset will be zeroed and no information is known. It
1579 * will mark pending requests so border will be accounted on 1579 * will mark pending requests so border will be accounted on
1580 * evalutation phase. 1580 * evalutation phase.
1581 * 1581 *
1582 * @parm w horizontal window size. 1582 * @parm w horizontal window size.
1583 * @parm h vertical window size. 1583 * @parm h vertical window size.
1584 * 1584 *
1585 * @see e_border_resize() 1585 * @see e_border_resize()
1586 */ 1586 */
1587EAPI void 1587EAPI void
1588e_border_resize_without_border(E_Border *bd, 1588e_border_resize_without_border(E_Border *bd,
1589 int w, 1589 int w,
1590 int h) 1590 int h)
1591{ 1591{
1592 if (bd->fullscreen) 1592 if (bd->fullscreen)
1593 return; 1593 return;
1594 1594
1595 _e_border_move_resize_internal(bd, 0, 0, w, h, 1, 0); 1595 _e_border_move_resize_internal(bd, 0, 0, w, h, 1, 0);
1596} 1596}
1597 1597
1598EAPI void 1598EAPI void
1599e_border_layer_set(E_Border *bd, 1599e_border_layer_set(E_Border *bd,
1600 E_Layer layer) 1600 E_Layer layer)
1601{ 1601{
1602 int oldraise; 1602 int oldraise;
1603 1603
1604 E_OBJECT_CHECK(bd); 1604 E_OBJECT_CHECK(bd);
1605 E_OBJECT_TYPE_CHECK(bd, E_BORDER_TYPE); 1605 E_OBJECT_TYPE_CHECK(bd, E_BORDER_TYPE);
1606 1606
1607 ecore_x_window_shadow_tree_flush(); 1607 ecore_x_window_shadow_tree_flush();
1608 1608
1609 oldraise = e_config->transient.raise; 1609 oldraise = e_config->transient.raise;
1610 1610
1611 if (bd->fullscreen) 1611 if (bd->fullscreen)
1612 { 1612 {
1613 bd->saved.layer = layer; 1613 bd->saved.layer = layer;
1614 return; 1614 return;
1615 } 1615 }
1616 bd->layer = layer; 1616 bd->layer = layer;
1617 if (e_config->transient.layer) 1617 if (e_config->transient.layer)
1618 { 1618 {
1619 E_Border *child; 1619 E_Border *child;
1620 Eina_List *list = _e_border_sub_borders_new(bd); 1620 Eina_List *list = _e_border_sub_borders_new(bd);
1621 1621
1622 /* We need to set raise to one, else the child wont 1622 /* We need to set raise to one, else the child wont
1623 * follow to the new layer. It should be like this, 1623 * follow to the new layer. It should be like this,
1624 * even if the user usually doesn't want to raise 1624 * even if the user usually doesn't want to raise
1625 * the transients. 1625 * the transients.
1626 */ 1626 */
1627 e_config->transient.raise = 1; 1627 e_config->transient.raise = 1;
1628 EINA_LIST_FREE(list, child) 1628 EINA_LIST_FREE(list, child)
1629 e_border_layer_set(child, layer); 1629 e_border_layer_set(child, layer);
1630 } 1630 }
1631 e_border_raise(bd); 1631 e_border_raise(bd);
1632 if (layer == E_LAYER_BELOW) 1632 if (layer == E_LAYER_BELOW)
1633 e_hints_window_stacking_set(bd, E_STACKING_BELOW); 1633 e_hints_window_stacking_set(bd, E_STACKING_BELOW);
1634 else if (layer == E_LAYER_ABOVE) 1634 else if (layer == E_LAYER_ABOVE)
1635 e_hints_window_stacking_set(bd, E_STACKING_ABOVE); 1635 e_hints_window_stacking_set(bd, E_STACKING_ABOVE);
1636 else 1636 else
1637 e_hints_window_stacking_set(bd, E_STACKING_NONE); 1637 e_hints_window_stacking_set(bd, E_STACKING_NONE);
1638 e_config->transient.raise = oldraise; 1638 e_config->transient.raise = oldraise;
1639} 1639}
1640 1640
1641EAPI void 1641EAPI void
1642e_border_raise(E_Border *bd) 1642e_border_raise(E_Border *bd)
1643{ 1643{
1644 E_Event_Border_Stack *ev; 1644 E_Event_Border_Stack *ev;
1645 E_Border *last = NULL, *child; 1645 E_Border *last = NULL, *child;
1646 1646
1647 E_OBJECT_CHECK(bd); 1647 E_OBJECT_CHECK(bd);
1648 E_OBJECT_TYPE_CHECK(bd, E_BORDER_TYPE); 1648 E_OBJECT_TYPE_CHECK(bd, E_BORDER_TYPE);
1649 1649
1650 ecore_x_window_shadow_tree_flush(); 1650 ecore_x_window_shadow_tree_flush();
1651 1651
1652 if (e_config->transient.raise) 1652 if (e_config->transient.raise)
1653 { 1653 {
1654 Eina_List *l, *l_prev; 1654 Eina_List *l, *l_prev;
1655 Eina_List *list = _e_border_sub_borders_new(bd); 1655 Eina_List *list = _e_border_sub_borders_new(bd);
1656 1656
1657 EINA_LIST_REVERSE_FOREACH_SAFE(list, l, l_prev, child) 1657 EINA_LIST_REVERSE_FOREACH_SAFE(list, l, l_prev, child)
1658 { 1658 {
1659 /* Don't stack iconic transients. If the user wants these shown, 1659 /* Don't stack iconic transients. If the user wants these shown,
1660 * thats another option. 1660 * thats another option.
1661 */ 1661 */
1662 if (!child->iconic) 1662 if (!child->iconic)
1663 { 1663 {
1664 if (last) 1664 if (last)
1665 e_border_stack_below(child, last); 1665 e_border_stack_below(child, last);
1666 else 1666 else
1667 { 1667 {
1668 E_Border *above; 1668 E_Border *above;
1669 1669
1670 /* First raise the border to find out which border we will end up above */ 1670 /* First raise the border to find out which border we will end up above */
1671 above = e_container_border_raise(child); 1671 above = e_container_border_raise(child);
1672 1672
1673 if (above) 1673 if (above)
1674 { 1674 {
1675 /* We ended up above a border, now we must stack this border to 1675 /* We ended up above a border, now we must stack this border to
1676 * generate the stacking event, and to check if this transient 1676 * generate the stacking event, and to check if this transient
1677 * has other transients etc. 1677 * has other transients etc.
1678 */ 1678 */
1679 e_border_stack_above(child, above); 1679 e_border_stack_above(child, above);
1680 } 1680 }
1681 else 1681 else
1682 { 1682 {
1683 /* If we didn't end up above any border, we are on the bottom! */ 1683 /* If we didn't end up above any border, we are on the bottom! */
1684 e_border_lower(child); 1684 e_border_lower(child);
1685 } 1685 }
1686 } 1686 }
1687 last = child; 1687 last = child;
1688 } 1688 }
1689 list = eina_list_remove_list(list, l); 1689 list = eina_list_remove_list(list, l);
1690 } 1690 }
1691 } 1691 }
1692 1692
1693 ev = E_NEW(E_Event_Border_Stack, 1); 1693 ev = E_NEW(E_Event_Border_Stack, 1);
1694 ev->border = bd; 1694 ev->border = bd;
1695 e_object_ref(E_OBJECT(bd)); 1695 e_object_ref(E_OBJECT(bd));
1696 1696
1697 if (last) 1697 if (last)
1698 { 1698 {
1699 e_container_border_stack_below(bd, last); 1699 e_container_border_stack_below(bd, last);
1700 ev->stack = last; 1700 ev->stack = last;
1701 e_object_ref(E_OBJECT(last)); 1701 e_object_ref(E_OBJECT(last));
1702 ev->type = E_STACKING_BELOW; 1702 ev->type = E_STACKING_BELOW;
1703 } 1703 }
1704 else 1704 else
1705 { 1705 {
1706 E_Border *above; 1706 E_Border *above;
1707 1707
1708 /* If we don't have any children, raise this border */ 1708 /* If we don't have any children, raise this border */
1709 above = e_container_border_raise(bd); 1709 above = e_container_border_raise(bd);
1710 e_border_raise_latest_set(bd); 1710 e_border_raise_latest_set(bd);
1711 if (above) 1711 if (above)
1712 { 1712 {
1713 /* We ended up above a border */ 1713 /* We ended up above a border */
1714 ev->stack = above; 1714 ev->stack = above;
1715 e_object_ref(E_OBJECT(above)); 1715 e_object_ref(E_OBJECT(above));
1716 ev->type = E_STACKING_ABOVE; 1716 ev->type = E_STACKING_ABOVE;
1717 } 1717 }
1718 else 1718 else
1719 { 1719 {
1720 /* No border to raise above, same as a lower! */ 1720 /* No border to raise above, same as a lower! */
1721 ev->stack = NULL; 1721 ev->stack = NULL;
1722 ev->type = E_STACKING_ABOVE; 1722 ev->type = E_STACKING_ABOVE;
1723 } 1723 }
1724 } 1724 }
1725 1725
1726 ecore_event_add(E_EVENT_BORDER_STACK, ev, _e_border_event_border_stack_free, NULL); 1726 ecore_event_add(E_EVENT_BORDER_STACK, ev, _e_border_event_border_stack_free, NULL);
1727 e_remember_update(bd); 1727 e_remember_update(bd);
1728} 1728}
1729 1729
1730EAPI void 1730EAPI void
1731e_border_lower(E_Border *bd) 1731e_border_lower(E_Border *bd)
1732{ 1732{
1733 E_Event_Border_Stack *ev; 1733 E_Event_Border_Stack *ev;
1734 E_Border *last = NULL, *child; 1734 E_Border *last = NULL, *child;
1735 1735
1736 E_OBJECT_CHECK(bd); 1736 E_OBJECT_CHECK(bd);
1737 E_OBJECT_TYPE_CHECK(bd, E_BORDER_TYPE); 1737 E_OBJECT_TYPE_CHECK(bd, E_BORDER_TYPE);
1738 1738
1739 ecore_x_window_shadow_tree_flush(); 1739 ecore_x_window_shadow_tree_flush();
1740 1740
1741 if (e_config->transient.lower) 1741 if (e_config->transient.lower)
1742 { 1742 {
1743 Eina_List *l, *l_prev; 1743 Eina_List *l, *l_prev;
1744 Eina_List *list = _e_border_sub_borders_new(bd); 1744 Eina_List *list = _e_border_sub_borders_new(bd);
1745 1745
1746 EINA_LIST_REVERSE_FOREACH_SAFE(list, l, l_prev, child) 1746 EINA_LIST_REVERSE_FOREACH_SAFE(list, l, l_prev, child)
1747 { 1747 {
1748 /* Don't stack iconic transients. If the user wants these shown, 1748 /* Don't stack iconic transients. If the user wants these shown,
1749 * thats another option. 1749 * thats another option.
1750 */ 1750 */
1751 if (!child->iconic) 1751 if (!child->iconic)
1752 { 1752 {
1753 if (last) 1753 if (last)
1754 e_border_stack_below(child, last); 1754 e_border_stack_below(child, last);
1755 else 1755 else
1756 { 1756 {
1757 E_Border *below; 1757 E_Border *below;
1758 1758
1759 /* First lower the border to find out which border we will end up below */ 1759 /* First lower the border to find out which border we will end up below */
1760 below = e_container_border_lower(child); 1760 below = e_container_border_lower(child);
1761 1761
1762 if (below) 1762 if (below)
1763 { 1763 {
1764 /* We ended up below a border, now we must stack this border to 1764 /* We ended up below a border, now we must stack this border to
1765 * generate the stacking event, and to check if this transient 1765 * generate the stacking event, and to check if this transient
1766 * has other transients etc. 1766 * has other transients etc.
1767 */ 1767 */
1768 e_border_stack_below(child, below); 1768 e_border_stack_below(child, below);
1769 } 1769 }
1770 else 1770 else
1771 { 1771 {
1772 /* If we didn't end up below any border, we are on top! */ 1772 /* If we didn't end up below any border, we are on top! */
1773 e_border_raise(child); 1773 e_border_raise(child);
1774 } 1774 }
1775 } 1775 }
1776 last = child; 1776 last = child;
1777 } 1777 }
1778 list = eina_list_remove_list(list, l); 1778 list = eina_list_remove_list(list, l);
1779 } 1779 }
1780 } 1780 }
1781 1781
1782 ev = E_NEW(E_Event_Border_Stack, 1); 1782 ev = E_NEW(E_Event_Border_Stack, 1);
1783 ev->border = bd; 1783 ev->border = bd;
1784 e_object_ref(E_OBJECT(bd)); 1784 e_object_ref(E_OBJECT(bd));
1785 1785
1786 if (last) 1786 if (last)
1787 { 1787 {
1788 e_container_border_stack_below(bd, last); 1788 e_container_border_stack_below(bd, last);
1789 ev->stack = last; 1789 ev->stack = last;
1790 e_object_ref(E_OBJECT(last)); 1790 e_object_ref(E_OBJECT(last));
1791 ev->type = E_STACKING_BELOW; 1791 ev->type = E_STACKING_BELOW;
1792 } 1792 }
1793 else 1793 else
1794 { 1794 {
1795 E_Border *below; 1795 E_Border *below;
1796 1796
1797 /* If we don't have any children, lower this border */ 1797 /* If we don't have any children, lower this border */
1798 below = e_container_border_lower(bd); 1798 below = e_container_border_lower(bd);
1799 if (below) 1799 if (below)
1800 { 1800 {
1801 /* We ended up below a border */ 1801 /* We ended up below a border */
1802 ev->stack = below; 1802 ev->stack = below;
1803 e_object_ref(E_OBJECT(below)); 1803 e_object_ref(E_OBJECT(below));
1804 ev->type = E_STACKING_BELOW; 1804 ev->type = E_STACKING_BELOW;
1805 } 1805 }
1806 else 1806 else
1807 { 1807 {
1808 /* No border to hide under, same as a raise! */ 1808 /* No border to hide under, same as a raise! */
1809 ev->stack = NULL; 1809 ev->stack = NULL;
1810 ev->type = E_STACKING_BELOW; 1810 ev->type = E_STACKING_BELOW;
1811 } 1811 }
1812 } 1812 }
1813 1813
1814 ecore_event_add(E_EVENT_BORDER_STACK, ev, _e_border_event_border_stack_free, NULL); 1814 ecore_event_add(E_EVENT_BORDER_STACK, ev, _e_border_event_border_stack_free, NULL);
1815 e_remember_update(bd); 1815 e_remember_update(bd);
1816} 1816}
1817 1817
1818EAPI void 1818EAPI void
1819e_border_stack_above(E_Border *bd, 1819e_border_stack_above(E_Border *bd,
1820 E_Border *above) 1820 E_Border *above)
1821{ 1821{
1822 /* TODO: Should stack above allow the border to change level */ 1822 /* TODO: Should stack above allow the border to change level */
1823 E_Event_Border_Stack *ev; 1823 E_Event_Border_Stack *ev;
1824 E_Border *last = NULL, *child; 1824 E_Border *last = NULL, *child;
1825 1825
1826 E_OBJECT_CHECK(bd); 1826 E_OBJECT_CHECK(bd);
1827 E_OBJECT_TYPE_CHECK(bd, E_BORDER_TYPE); 1827 E_OBJECT_TYPE_CHECK(bd, E_BORDER_TYPE);
1828 1828
1829 ecore_x_window_shadow_tree_flush(); 1829 ecore_x_window_shadow_tree_flush();
1830 1830
1831 if (e_config->transient.raise) 1831 if (e_config->transient.raise)
1832 { 1832 {
1833 Eina_List *l, *l_prev; 1833 Eina_List *l, *l_prev;
1834 Eina_List *list = _e_border_sub_borders_new(bd); 1834 Eina_List *list = _e_border_sub_borders_new(bd);
1835 1835
1836 EINA_LIST_REVERSE_FOREACH_SAFE(list, l, l_prev, child) 1836 EINA_LIST_REVERSE_FOREACH_SAFE(list, l, l_prev, child)
1837 { 1837 {
1838 /* Don't stack iconic transients. If the user wants these shown, 1838 /* Don't stack iconic transients. If the user wants these shown,
1839 * thats another option. 1839 * thats another option.
1840 */ 1840 */
1841 if (!child->iconic) 1841 if (!child->iconic)
1842 { 1842 {
1843 if (last) 1843 if (last)
1844 e_border_stack_below(child, last); 1844 e_border_stack_below(child, last);
1845 else 1845 else
1846 e_border_stack_above(child, above); 1846 e_border_stack_above(child, above);
1847 last = child; 1847 last = child;
1848 } 1848 }
1849 list = eina_list_remove_list(list, l); 1849 list = eina_list_remove_list(list, l);
1850 } 1850 }
1851 } 1851 }
1852 1852
1853 ev = E_NEW(E_Event_Border_Stack, 1); 1853 ev = E_NEW(E_Event_Border_Stack, 1);
1854 ev->border = bd; 1854 ev->border = bd;
1855 e_object_ref(E_OBJECT(bd)); 1855 e_object_ref(E_OBJECT(bd));
1856 1856
1857 if (last) 1857 if (last)
1858 { 1858 {
1859 e_container_border_stack_below(bd, last); 1859 e_container_border_stack_below(bd, last);
1860 ev->stack = last; 1860 ev->stack = last;
1861 e_object_ref(E_OBJECT(last)); 1861 e_object_ref(E_OBJECT(last));
1862 ev->type = E_STACKING_BELOW; 1862 ev->type = E_STACKING_BELOW;
1863 } 1863 }
1864 else 1864 else
1865 { 1865 {
1866 e_container_border_stack_above(bd, above); 1866 e_container_border_stack_above(bd, above);
1867 ev->stack = above; 1867 ev->stack = above;
1868 e_object_ref(E_OBJECT(above)); 1868 e_object_ref(E_OBJECT(above));
1869 ev->type = E_STACKING_ABOVE; 1869 ev->type = E_STACKING_ABOVE;
1870 } 1870 }
1871 1871
1872 ecore_event_add(E_EVENT_BORDER_STACK, ev, _e_border_event_border_stack_free, NULL); 1872 ecore_event_add(E_EVENT_BORDER_STACK, ev, _e_border_event_border_stack_free, NULL);
1873 e_remember_update(bd); 1873 e_remember_update(bd);
1874} 1874}
1875 1875
1876EAPI void 1876EAPI void
1877e_border_stack_below(E_Border *bd, 1877e_border_stack_below(E_Border *bd,
1878 E_Border *below) 1878 E_Border *below)
1879{ 1879{
1880 /* TODO: Should stack below allow the border to change level */ 1880 /* TODO: Should stack below allow the border to change level */
1881 E_Event_Border_Stack *ev; 1881 E_Event_Border_Stack *ev;
1882 E_Border *last = NULL, *child; 1882 E_Border *last = NULL, *child;
1883 1883
1884 E_OBJECT_CHECK(bd); 1884 E_OBJECT_CHECK(bd);
1885 E_OBJECT_TYPE_CHECK(bd, E_BORDER_TYPE); 1885 E_OBJECT_TYPE_CHECK(bd, E_BORDER_TYPE);
1886 1886
1887 ecore_x_window_shadow_tree_flush(); 1887 ecore_x_window_shadow_tree_flush();
1888 1888
1889 if (e_config->transient.lower) 1889 if (e_config->transient.lower)
1890 { 1890 {
1891 Eina_List *l, *l_prev; 1891 Eina_List *l, *l_prev;
1892 Eina_List *list = _e_border_sub_borders_new(bd); 1892 Eina_List *list = _e_border_sub_borders_new(bd);
1893 1893
1894 EINA_LIST_REVERSE_FOREACH_SAFE(bd->transients, l, l_prev, child) 1894 EINA_LIST_REVERSE_FOREACH_SAFE(bd->transients, l, l_prev, child)
1895 { 1895 {
1896 /* Don't stack iconic transients. If the user wants these shown, 1896 /* Don't stack iconic transients. If the user wants these shown,
1897 * thats another option. 1897 * thats another option.
1898 */ 1898 */
1899 if (!child->iconic) 1899 if (!child->iconic)
1900 { 1900 {
1901 if (last) 1901 if (last)
1902 e_border_stack_below(child, last); 1902 e_border_stack_below(child, last);
1903 else 1903 else
1904 e_border_stack_below(child, below); 1904 e_border_stack_below(child, below);
1905 last = child; 1905 last = child;
1906 } 1906 }
1907 list = eina_list_remove_list(list, l); 1907 list = eina_list_remove_list(list, l);
1908 } 1908 }
1909 } 1909 }
1910 1910
1911 ev = E_NEW(E_Event_Border_Stack, 1); 1911 ev = E_NEW(E_Event_Border_Stack, 1);
1912 ev->border = bd; 1912 ev->border = bd;
1913 e_object_ref(E_OBJECT(bd)); 1913 e_object_ref(E_OBJECT(bd));
1914 1914
1915 if (last) 1915 if (last)
1916 { 1916 {
1917 e_container_border_stack_below(bd, last); 1917 e_container_border_stack_below(bd, last);
1918 ev->stack = last; 1918 ev->stack = last;
1919 e_object_ref(E_OBJECT(last)); 1919 e_object_ref(E_OBJECT(last));
1920 ev->type = E_STACKING_BELOW; 1920 ev->type = E_STACKING_BELOW;
1921 } 1921 }
1922 else 1922 else
1923 { 1923 {
1924 e_container_border_stack_below(bd, below); 1924 e_container_border_stack_below(bd, below);
1925 ev->stack = below; 1925 ev->stack = below;
1926 e_object_ref(E_OBJECT(below)); 1926 e_object_ref(E_OBJECT(below));
1927 ev->type = E_STACKING_BELOW; 1927 ev->type = E_STACKING_BELOW;
1928 } 1928 }
1929 1929
1930 ecore_event_add(E_EVENT_BORDER_STACK, ev, _e_border_event_border_stack_free, NULL); 1930 ecore_event_add(E_EVENT_BORDER_STACK, ev, _e_border_event_border_stack_free, NULL);
1931 e_remember_update(bd); 1931 e_remember_update(bd);
1932} 1932}
1933 1933
1934EAPI void 1934EAPI void
1935e_border_focus_latest_set(E_Border *bd) 1935e_border_focus_latest_set(E_Border *bd)
1936{ 1936{
1937 focus_stack = eina_list_remove(focus_stack, bd); 1937 focus_stack = eina_list_remove(focus_stack, bd);
1938 focus_stack = eina_list_prepend(focus_stack, bd); 1938 focus_stack = eina_list_prepend(focus_stack, bd);
1939} 1939}
1940 1940
1941EAPI void 1941EAPI void
1942e_border_raise_latest_set(E_Border *bd) 1942e_border_raise_latest_set(E_Border *bd)
1943{ 1943{
1944 raise_stack = eina_list_remove(raise_stack, bd); 1944 raise_stack = eina_list_remove(raise_stack, bd);
1945 raise_stack = eina_list_prepend(raise_stack, bd); 1945 raise_stack = eina_list_prepend(raise_stack, bd);
1946} 1946}
1947 1947
1948/* 1948/*
1949 * Sets the focus to the given border if necessary 1949 * Sets the focus to the given border if necessary
1950 * There are 3 cases of different focus_policy-configurations: 1950 * There are 3 cases of different focus_policy-configurations:
1951 * 1951 *
1952 * - E_FOCUS_CLICK: just set the focus, the most simple one 1952 * - E_FOCUS_CLICK: just set the focus, the most simple one
1953 * 1953 *
1954 * - E_FOCUS_MOUSE: focus is where the mouse is, so try to 1954 * - E_FOCUS_MOUSE: focus is where the mouse is, so try to
1955 * warp the pointer to the window. If this fails (because 1955 * warp the pointer to the window. If this fails (because
1956 * the pointer is already in the window), just set the focus. 1956 * the pointer is already in the window), just set the focus.
1957 * 1957 *
1958 * - E_FOCUS_SLOPPY: focus is where the mouse is or on the 1958 * - E_FOCUS_SLOPPY: focus is where the mouse is or on the
1959 * last window which was focused, if the mouse is on the 1959 * last window which was focused, if the mouse is on the
1960 * desktop. So, we need to look if there is another window 1960 * desktop. So, we need to look if there is another window
1961 * under the pointer and warp to pointer to the right 1961 * under the pointer and warp to pointer to the right
1962 * one if so (also, we set the focus afterwards). In case 1962 * one if so (also, we set the focus afterwards). In case
1963 * there is no window under pointer, the pointer is on the 1963 * there is no window under pointer, the pointer is on the
1964 * desktop and so we just set the focus. 1964 * desktop and so we just set the focus.
1965 * 1965 *
1966 * 1966 *
1967 * This function is to be called when setting the focus was not 1967 * This function is to be called when setting the focus was not
1968 * explicitly triggered by the user (by moving the mouse or 1968 * explicitly triggered by the user (by moving the mouse or
1969 * clicking for example), but implicitly (by closing a window, 1969 * clicking for example), but implicitly (by closing a window,
1970 * the last focused window should get focus). 1970 * the last focused window should get focus).
1971 * 1971 *
1972 */ 1972 */
1973EAPI void 1973EAPI void
1974e_border_focus_set_with_pointer(E_Border *bd) 1974e_border_focus_set_with_pointer(E_Border *bd)
1975{ 1975{
1976#ifdef PRINT_LOTS_OF_DEBUG 1976#ifdef PRINT_LOTS_OF_DEBUG
1977 E_PRINT_BORDER_INFO(bd); 1977 E_PRINT_BORDER_INFO(bd);
1978#endif 1978#endif
1979 /* note: this is here as it seems there are enough apps that do not even 1979 /* note: this is here as it seems there are enough apps that do not even
1980 * expect us to emulate a look of focus but not actually set x input 1980 * expect us to emulate a look of focus but not actually set x input
1981 * focus as we do - so simply abort any focuse set on such windows */ 1981 * focus as we do - so simply abort any focuse set on such windows */
1982 /* be strict about accepting focus hint */ 1982 /* be strict about accepting focus hint */
1983 if ((!bd->client.icccm.accepts_focus) && 1983 if ((!bd->client.icccm.accepts_focus) &&
1984 (!bd->client.icccm.take_focus)) return; 1984 (!bd->client.icccm.take_focus)) return;
1985 if (bd->lock_focus_out) return; 1985 if (bd->lock_focus_out) return;
1986 if (bd == focused) return; 1986 if (bd == focused) return;
1987 e_border_focus_set(bd, 1, 1); 1987 e_border_focus_set(bd, 1, 1);
1988 1988
1989 if (e_config->focus_policy == E_FOCUS_CLICK) return; 1989 if (e_config->focus_policy == E_FOCUS_CLICK) return;
1990 if (!bd->visible) return; 1990 if (!bd->visible) return;
1991 1991
1992 if (e_config->focus_policy == E_FOCUS_SLOPPY) 1992 if (e_config->focus_policy == E_FOCUS_SLOPPY)
1993 { 1993 {
1994 E_Border *pbd; 1994 E_Border *pbd;
1995 int ret = 0; 1995 int ret = 0;
1996 pbd = e_border_under_pointer_get(bd->desk, bd); 1996 pbd = e_border_under_pointer_get(bd->desk, bd);
1997 /* Do not slide pointer when disabled (probably breaks focus 1997 /* Do not slide pointer when disabled (probably breaks focus
1998 * on sloppy/mouse focus but requested by users). */ 1998 * on sloppy/mouse focus but requested by users). */
1999 if (e_config->pointer_slide && pbd && (pbd != bd)) 1999 if (e_config->pointer_slide && pbd && (pbd != bd))
2000 ret = e_border_pointer_warp_to_center(bd); 2000 ret = e_border_pointer_warp_to_center(bd);
2001 if (!ret) e_border_focus_set(bd, 1, 0); 2001 if (!ret) e_border_focus_set(bd, 1, 0);
2002 } 2002 }
2003 else 2003 else
2004 { 2004 {
2005 if (e_config->pointer_slide && (!e_border_pointer_warp_to_center(bd))) 2005 if (e_config->pointer_slide && (!e_border_pointer_warp_to_center(bd)))
2006 e_border_focus_set(bd, 1, 0); 2006 e_border_focus_set(bd, 1, 0);
2007 } 2007 }
2008} 2008}
2009 2009
2010EAPI void 2010EAPI void
2011e_border_focus_set(E_Border *bd, 2011e_border_focus_set(E_Border *bd,
2012 int focus, 2012 int focus,
2013 int set) 2013 int set)
2014{ 2014{
2015 E_Border *bd_unfocus = NULL; 2015 E_Border *bd_unfocus = NULL;
2016 Eina_Bool focus_changed = EINA_FALSE; 2016 Eina_Bool focus_changed = EINA_FALSE;
2017 2017
2018 E_OBJECT_CHECK(bd); 2018 E_OBJECT_CHECK(bd);
2019 E_OBJECT_TYPE_CHECK(bd, E_BORDER_TYPE); 2019 E_OBJECT_TYPE_CHECK(bd, E_BORDER_TYPE);
2020 /* note: this is here as it seems there are enough apps that do not even 2020 /* note: this is here as it seems there are enough apps that do not even
2021 * expect us to emulate a look of focus but not actually set x input 2021 * expect us to emulate a look of focus but not actually set x input
2022 * focus as we do - so simply abort any focuse set on such windows */ 2022 * focus as we do - so simply abort any focuse set on such windows */
2023 /* be strict about accepting focus hint */ 2023 /* be strict about accepting focus hint */
2024 if ((!bd->client.icccm.accepts_focus) && 2024 if ((!bd->client.icccm.accepts_focus) &&
2025 (!bd->client.icccm.take_focus)) 2025 (!bd->client.icccm.take_focus))
2026 return; 2026 return;
2027 if ((set) && (focus) && (bd->lock_focus_out)) return; 2027 if ((set) && (focus) && (bd->lock_focus_out)) return;
2028 2028
2029 /* dont focus an iconified window. that's silly! */ 2029 /* dont focus an iconified window. that's silly! */
2030 if (focus) 2030 if (focus)
2031 { 2031 {
2032 if ((bd->iconic) && (!bd->deskshow)) 2032 if ((bd->iconic) && (!bd->deskshow))
2033 { 2033 {
2034 e_border_uniconify(bd); 2034 e_border_uniconify(bd);
2035 if (!focus_track_frozen) 2035 if (!focus_track_frozen)
2036 e_border_focus_latest_set(bd); 2036 e_border_focus_latest_set(bd);
2037 return; 2037 return;
2038 } 2038 }
2039 else if (!bd->visible) 2039 else if (!bd->visible)
2040 { 2040 {
2041 return; 2041 return;
2042 } 2042 }
2043 /* FIXME: hack for deskflip animation: 2043 /* FIXME: hack for deskflip animation:
2044 * dont update focus when sliding previous desk */ 2044 * dont update focus when sliding previous desk */
2045 else if ((!bd->sticky) && 2045 else if ((!bd->sticky) &&
2046 (bd->desk != e_desk_current_get(bd->desk->zone))) 2046 (bd->desk != e_desk_current_get(bd->desk->zone)))
2047 { 2047 {
2048 return; 2048 return;
2049 } 2049 }
2050 } 2050 }
2051 2051
2052 if ((bd->modal) && (bd->modal != bd) && (bd->modal->visible)) 2052 if ((bd->modal) && (bd->modal != bd) && (bd->modal->visible))
2053 { 2053 {
2054 e_border_focus_set(bd->modal, focus, set); 2054 e_border_focus_set(bd->modal, focus, set);
2055 return; 2055 return;
2056 } 2056 }
2057 else if ((bd->leader) && (bd->leader->modal) && (bd->leader->modal != bd)) 2057 else if ((bd->leader) && (bd->leader->modal) && (bd->leader->modal != bd))
2058 { 2058 {
2059 e_border_focus_set(bd->leader->modal, focus, set); 2059 e_border_focus_set(bd->leader->modal, focus, set);
2060 return; 2060 return;
2061 } 2061 }
2062 2062
2063 if (focus) 2063 if (focus)
2064 { 2064 {
2065 if (set) 2065 if (set)
2066 { 2066 {
2067 if (bd->visible && bd->changes.visible) 2067 if (bd->visible && bd->changes.visible)
2068 { 2068 {
2069 bd->want_focus = 1; 2069 bd->want_focus = 1;
2070 BD_CHANGED(bd); 2070 BD_CHANGED(bd);
2071 } 2071 }
2072 else if ((!bd->focused) || 2072 else if ((!bd->focused) ||
2073 (focus_next && (bd != eina_list_data_get(focus_next)))) 2073 (focus_next && (bd != eina_list_data_get(focus_next))))
2074 { 2074 {
2075 Eina_List *l; 2075 Eina_List *l;
2076 2076
2077 if ((l = eina_list_data_find_list(focus_next, bd))) 2077 if ((l = eina_list_data_find_list(focus_next, bd)))
2078 focus_next = eina_list_promote_list(focus_next, l); 2078 focus_next = eina_list_promote_list(focus_next, l);
2079 else 2079 else
2080 focus_next = eina_list_prepend(focus_next, bd); 2080 focus_next = eina_list_prepend(focus_next, bd);
2081 } 2081 }
2082 if ((bd->client.icccm.take_focus) && 2082 if ((bd->client.icccm.take_focus) &&
2083 (bd->client.icccm.accepts_focus)) 2083 (bd->client.icccm.accepts_focus))
2084 { 2084 {
2085 e_grabinput_focus(bd->client.win, E_FOCUS_METHOD_LOCALLY_ACTIVE); 2085 e_grabinput_focus(bd->client.win, E_FOCUS_METHOD_LOCALLY_ACTIVE);
2086 /* TODO what if the client didn't take focus ? */ 2086 /* TODO what if the client didn't take focus ? */
2087 } 2087 }
2088 else if (!bd->client.icccm.accepts_focus) 2088 else if (!bd->client.icccm.accepts_focus)
2089 { 2089 {
2090 e_grabinput_focus(bd->client.win, E_FOCUS_METHOD_GLOBALLY_ACTIVE); 2090 e_grabinput_focus(bd->client.win, E_FOCUS_METHOD_GLOBALLY_ACTIVE);
2091 } 2091 }
2092 else if (!bd->client.icccm.take_focus) 2092 else if (!bd->client.icccm.take_focus)
2093 { 2093 {
2094 e_grabinput_focus(bd->client.win, E_FOCUS_METHOD_PASSIVE); 2094 e_grabinput_focus(bd->client.win, E_FOCUS_METHOD_PASSIVE);
2095 /* e_border_focus_set(bd, 1, 0); */ 2095 /* e_border_focus_set(bd, 1, 0); */
2096 } 2096 }
2097 return; 2097 return;
2098 } 2098 }
2099 2099
2100 if (!bd->focused) 2100 if (!bd->focused)
2101 { 2101 {
2102 if (focused) bd_unfocus = focused; 2102 if (focused) bd_unfocus = focused;
2103 if (focusing == bd) focusing = NULL; 2103 if (focusing == bd) focusing = NULL;
2104 bd->focused = 1; 2104 bd->focused = 1;
2105 focused = bd; 2105 focused = bd;
2106 if ((!e_config->allow_above_fullscreen) && (!bd_unfocus)) 2106 if ((!e_config->allow_above_fullscreen) && (!bd_unfocus))
2107 { 2107 {
2108 Eina_List *l; 2108 Eina_List *l;
2109 E_Border *bd2; 2109 E_Border *bd2;
2110 2110
2111 EINA_LIST_FOREACH(e_border_client_list(), l, bd2) 2111 EINA_LIST_FOREACH(e_border_client_list(), l, bd2)
2112 { 2112 {
2113 if ((bd2->fullscreen) && 2113 if ((bd2->fullscreen) &&
2114 (bd2 != bd) && 2114 (bd2 != bd) &&
2115 (bd2->zone == bd->zone) && 2115 (bd2->zone == bd->zone) &&
2116 ((bd2->desk == bd->desk) || 2116 ((bd2->desk == bd->desk) ||
2117 (bd2->sticky) || (bd->sticky))) 2117 (bd2->sticky) || (bd->sticky)))
2118 { 2118 {
2119 Eina_Bool unfocus_is_parent = EINA_FALSE; 2119 Eina_Bool unfocus_is_parent = EINA_FALSE;
2120 E_Border *bd_parent; 2120 E_Border *bd_parent;
2121 2121
2122 bd_parent = bd->parent; 2122 bd_parent = bd->parent;
2123 while (bd_parent) 2123 while (bd_parent)
2124 { 2124 {
2125 if (bd_parent == bd2) 2125 if (bd_parent == bd2)
2126 { 2126 {
2127 unfocus_is_parent = EINA_TRUE; 2127 unfocus_is_parent = EINA_TRUE;
2128 break; 2128 break;
2129 } 2129 }
2130 bd_parent = bd->parent; 2130 bd_parent = bd->parent;
2131 } 2131 }
2132 if (!unfocus_is_parent) 2132 if (!unfocus_is_parent)
2133 e_border_unfullscreen(bd2); 2133 e_border_unfullscreen(bd2);
2134 } 2134 }
2135 } 2135 }
2136 } 2136 }
2137 focus_changed = EINA_TRUE; 2137 focus_changed = EINA_TRUE;
2138 } 2138 }
2139 } 2139 }
2140 else 2140 else
2141 { 2141 {
2142 bd->want_focus = 0; 2142 bd->want_focus = 0;
2143 focus_next = eina_list_remove(focus_next, bd); 2143 focus_next = eina_list_remove(focus_next, bd);
2144 if (bd == focusing) focusing = NULL; 2144 if (bd == focusing) focusing = NULL;
2145 2145
2146 if (bd->focused) 2146 if (bd->focused)
2147 { 2147 {
2148 Eina_Bool wasfocused = EINA_FALSE; 2148 Eina_Bool wasfocused = EINA_FALSE;
2149 bd_unfocus = bd; 2149 bd_unfocus = bd;
2150 2150
2151 /* should always be the case. anyway */ 2151 /* should always be the case. anyway */
2152 if (bd == focused) 2152 if (bd == focused)
2153 { 2153 {
2154 focused = NULL; 2154 focused = NULL;
2155 wasfocused = EINA_TRUE; 2155 wasfocused = EINA_TRUE;
2156 } 2156 }
2157 2157
2158 if ((set) && (!focus_next) && (!focusing)) 2158 if ((set) && (!focus_next) && (!focusing))
2159 { 2159 {
2160 e_grabinput_focus(bd->zone->container->bg_win, 2160 e_grabinput_focus(bd->zone->container->bg_win,
2161 E_FOCUS_METHOD_PASSIVE); 2161 E_FOCUS_METHOD_PASSIVE);
2162 } 2162 }
2163 if ((!e_config->allow_above_fullscreen) && 2163 if ((!e_config->allow_above_fullscreen) &&
2164 (bd->fullscreen) && (wasfocused) && 2164 (bd->fullscreen) && (wasfocused) &&
2165 ((bd->desk == e_desk_current_get(bd->zone)) || (bd->sticky))) 2165 ((bd->desk == e_desk_current_get(bd->zone)) || (bd->sticky)))
2166 { 2166 {
2167 Eina_Bool have_vis_child = EINA_FALSE; 2167 Eina_Bool have_vis_child = EINA_FALSE;
2168 Eina_List *l; 2168 Eina_List *l;
2169 E_Border *bd2; 2169 E_Border *bd2;
2170 2170
2171 EINA_LIST_FOREACH(e_border_client_list(), l, bd2) 2171 EINA_LIST_FOREACH(e_border_client_list(), l, bd2)
2172 { 2172 {
2173 if ((bd2 != bd) && 2173 if ((bd2 != bd) &&
2174 (bd2->zone == bd->zone) && 2174 (bd2->zone == bd->zone) &&
2175 ((bd2->desk == bd->desk) || 2175 ((bd2->desk == bd->desk) ||
2176 (bd2->sticky) || (bd->sticky))) 2176 (bd2->sticky) || (bd->sticky)))
2177 { 2177 {
2178 if (bd2->parent == bd) 2178 if (bd2->parent == bd)
2179 { 2179 {
2180 have_vis_child = EINA_TRUE; 2180 have_vis_child = EINA_TRUE;
2181 break; 2181 break;
2182 } 2182 }
2183 } 2183 }
2184 } 2184 }
2185 if (!have_vis_child) 2185 if (!have_vis_child)
2186 e_border_unfullscreen(bd); 2186 e_border_unfullscreen(bd);
2187 } 2187 }
2188 } 2188 }
2189 } 2189 }
2190 2190
2191 if ((bd_unfocus) && 2191 if ((bd_unfocus) &&
2192 (!e_object_is_del(E_OBJECT(bd_unfocus)) && 2192 (!e_object_is_del(E_OBJECT(bd_unfocus)) &&
2193 (e_object_ref_get(E_OBJECT(bd_unfocus)) > 0))) 2193 (e_object_ref_get(E_OBJECT(bd_unfocus)) > 0)))
2194 { 2194 {
2195 E_Event_Border_Focus_Out *ev; 2195 E_Event_Border_Focus_Out *ev;
2196 2196
2197 bd_unfocus->focused = 0; 2197 bd_unfocus->focused = 0;
2198 e_focus_event_focus_out(bd_unfocus); 2198 e_focus_event_focus_out(bd_unfocus);
2199 2199
2200 if (bd_unfocus->raise_timer) 2200 if (bd_unfocus->raise_timer)
2201 ecore_timer_del(bd_unfocus->raise_timer); 2201 ecore_timer_del(bd_unfocus->raise_timer);
2202 bd_unfocus->raise_timer = NULL; 2202 bd_unfocus->raise_timer = NULL;
2203 2203
2204 edje_object_signal_emit(bd_unfocus->bg_object, "e,state,unfocused", "e"); 2204 edje_object_signal_emit(bd_unfocus->bg_object, "e,state,unfocused", "e");
2205 if (bd_unfocus->icon_object) 2205 if (bd_unfocus->icon_object)
2206 edje_object_signal_emit(bd_unfocus->icon_object, "e,state,unfocused", "e"); 2206 edje_object_signal_emit(bd_unfocus->icon_object, "e,state,unfocused", "e");
2207 2207
2208 ev = E_NEW(E_Event_Border_Focus_Out, 1); 2208 ev = E_NEW(E_Event_Border_Focus_Out, 1);
2209 ev->border = bd_unfocus; 2209 ev->border = bd_unfocus;
2210 e_object_ref(E_OBJECT(bd_unfocus)); 2210 e_object_ref(E_OBJECT(bd_unfocus));
2211 2211
2212 ecore_event_add(E_EVENT_BORDER_FOCUS_OUT, ev, 2212 ecore_event_add(E_EVENT_BORDER_FOCUS_OUT, ev,
2213 _e_border_event_border_focus_out_free, NULL); 2213 _e_border_event_border_focus_out_free, NULL);
2214 if ((!e_config->allow_above_fullscreen) && 2214 if ((!e_config->allow_above_fullscreen) &&
2215 (bd_unfocus->fullscreen) && 2215 (bd_unfocus->fullscreen) &&
2216 (bd != bd_unfocus) && 2216 (bd != bd_unfocus) &&
2217 (bd->zone == bd_unfocus->zone) && 2217 (bd->zone == bd_unfocus->zone) &&
2218 ((bd->desk == bd_unfocus->desk) || 2218 ((bd->desk == bd_unfocus->desk) ||
2219 (bd->sticky) || (bd_unfocus->sticky))) 2219 (bd->sticky) || (bd_unfocus->sticky)))
2220 { 2220 {
2221 Eina_Bool unfocus_is_parent = EINA_FALSE; 2221 Eina_Bool unfocus_is_parent = EINA_FALSE;
2222 E_Border *bd_parent; 2222 E_Border *bd_parent;
2223 2223
2224 bd_parent = bd->parent; 2224 bd_parent = bd->parent;
2225 while (bd_parent) 2225 while (bd_parent)
2226 { 2226 {
2227 if (bd_parent == bd_unfocus) 2227 if (bd_parent == bd_unfocus)
2228 { 2228 {
2229 unfocus_is_parent = EINA_TRUE; 2229 unfocus_is_parent = EINA_TRUE;
2230 break; 2230 break;
2231 } 2231 }
2232 bd_parent = bd->parent; 2232 bd_parent = bd->parent;
2233 } 2233 }
2234 if (!unfocus_is_parent) 2234 if (!unfocus_is_parent)
2235 e_border_unfullscreen(bd_unfocus); 2235 e_border_unfullscreen(bd_unfocus);
2236 } 2236 }
2237 } 2237 }
2238 2238
2239 if (focus_changed) 2239 if (focus_changed)
2240 { 2240 {
2241 E_Event_Border_Focus_In *ev; 2241 E_Event_Border_Focus_In *ev;
2242 2242
2243 e_focus_event_focus_in(bd); 2243 e_focus_event_focus_in(bd);
2244 2244
2245 if (!focus_track_frozen) 2245 if (!focus_track_frozen)
2246 e_border_focus_latest_set(bd); 2246 e_border_focus_latest_set(bd);
2247 2247
2248 e_hints_active_window_set(bd->zone->container->manager, bd); 2248 e_hints_active_window_set(bd->zone->container->manager, bd);
2249 2249
2250 edje_object_signal_emit(bd->bg_object, "e,state,focused", "e"); 2250 edje_object_signal_emit(bd->bg_object, "e,state,focused", "e");
2251 if (bd->icon_object) 2251 if (bd->icon_object)
2252 edje_object_signal_emit(bd->icon_object, "e,state,focused", "e"); 2252 edje_object_signal_emit(bd->icon_object, "e,state,focused", "e");
2253 2253
2254 ev = E_NEW(E_Event_Border_Focus_In, 1); 2254 ev = E_NEW(E_Event_Border_Focus_In, 1);
2255 ev->border = bd; 2255 ev->border = bd;
2256 e_object_ref(E_OBJECT(bd)); 2256 e_object_ref(E_OBJECT(bd));
2257 2257
2258 ecore_event_add(E_EVENT_BORDER_FOCUS_IN, ev, 2258 ecore_event_add(E_EVENT_BORDER_FOCUS_IN, ev,
2259 _e_border_event_border_focus_in_free, NULL); 2259 _e_border_event_border_focus_in_free, NULL);
2260 } 2260 }
2261} 2261}
2262 2262
2263EAPI void 2263EAPI void
2264e_border_shade(E_Border *bd, 2264e_border_shade(E_Border *bd,
2265 E_Direction dir) 2265 E_Direction dir)
2266{ 2266{
2267 E_Event_Border_Simple *ev; 2267 E_Event_Border_Simple *ev;
2268 Eina_List *l; 2268 Eina_List *l;
2269 E_Border *tmp; 2269 E_Border *tmp;
2270 2270
2271 E_OBJECT_CHECK(bd); 2271 E_OBJECT_CHECK(bd);
2272 E_OBJECT_TYPE_CHECK(bd, E_BORDER_TYPE); 2272 E_OBJECT_TYPE_CHECK(bd, E_BORDER_TYPE);
2273 if ((bd->shaded) || (bd->shading) || (bd->fullscreen) || 2273 if ((bd->shaded) || (bd->shading) || (bd->fullscreen) ||
2274 ((bd->maximized) && (!e_config->allow_manip))) return; 2274 ((bd->maximized) && (!e_config->allow_manip))) return;
2275 if ((bd->client.border.name) && 2275 if ((bd->client.border.name) &&
2276 (!strcmp("borderless", bd->client.border.name))) return; 2276 (!strcmp("borderless", bd->client.border.name))) return;
2277 2277
2278 EINA_LIST_FOREACH(bd->client.e.state.video_child, l, tmp) 2278 EINA_LIST_FOREACH(bd->client.e.state.video_child, l, tmp)
2279 ecore_x_window_hide(tmp->win); 2279 ecore_x_window_hide(tmp->win);
2280 2280
2281 ecore_x_window_shadow_tree_flush(); 2281 ecore_x_window_shadow_tree_flush();
2282 2282
2283 bd->shade.x = bd->x; 2283 bd->shade.x = bd->x;
2284 bd->shade.y = bd->y; 2284 bd->shade.y = bd->y;
2285 bd->shade.dir = dir; 2285 bd->shade.dir = dir;
2286 2286
2287 e_hints_window_shaded_set(bd, 1); 2287 e_hints_window_shaded_set(bd, 1);
2288 e_hints_window_shade_direction_set(bd, dir); 2288 e_hints_window_shade_direction_set(bd, dir);
2289 2289
2290 if (e_config->border_shade_animate && (!bd->new_client)) 2290 if (e_config->border_shade_animate && (!bd->new_client))
2291 { 2291 {
2292 bd->shade.start = ecore_loop_time_get(); 2292 bd->shade.start = ecore_loop_time_get();
2293 bd->shading = 1; 2293 bd->shading = 1;
2294 bd->changes.shading = 1; 2294 bd->changes.shading = 1;
2295 BD_CHANGED(bd); 2295 BD_CHANGED(bd);
2296 2296
2297 bd->shade.anim = ecore_animator_add(_e_border_shade_animator, bd); 2297 bd->shade.anim = ecore_animator_add(_e_border_shade_animator, bd);
2298 edje_object_signal_emit(bd->bg_object, "e,state,shading", "e"); 2298 edje_object_signal_emit(bd->bg_object, "e,state,shading", "e");
2299 } 2299 }
2300 else 2300 else
2301 { 2301 {
2302 Eina_Bool move = EINA_FALSE; 2302 Eina_Bool move = EINA_FALSE;
2303 2303
2304 if (bd->shade.dir == E_DIRECTION_UP) 2304 if (bd->shade.dir == E_DIRECTION_UP)
2305 { 2305 {
2306 bd->h = bd->client_inset.t; 2306 bd->h = bd->client_inset.t;
2307 } 2307 }
2308 else if (bd->shade.dir == E_DIRECTION_DOWN) 2308 else if (bd->shade.dir == E_DIRECTION_DOWN)
2309 { 2309 {
2310 bd->h = bd->client_inset.t; 2310 bd->h = bd->client_inset.t;
2311 bd->y = bd->y + bd->client.h; 2311 bd->y = bd->y + bd->client.h;
2312 move = EINA_TRUE; 2312 move = EINA_TRUE;
2313 } 2313 }
2314 else if (bd->shade.dir == E_DIRECTION_LEFT) 2314 else if (bd->shade.dir == E_DIRECTION_LEFT)
2315 { 2315 {
2316 bd->w = bd->client_inset.t; 2316 bd->w = bd->client_inset.t;
2317 } 2317 }
2318 else if (bd->shade.dir == E_DIRECTION_RIGHT) 2318 else if (bd->shade.dir == E_DIRECTION_RIGHT)
2319 { 2319 {
2320 bd->w = bd->client_inset.t; 2320 bd->w = bd->client_inset.t;
2321 bd->x = bd->x + bd->client.w; 2321 bd->x = bd->x + bd->client.w;
2322 move = EINA_TRUE; 2322 move = EINA_TRUE;
2323 } 2323 }
2324 2324
2325 if (bd->client.shaped) 2325 if (bd->client.shaped)
2326 { 2326 {
2327 bd->need_shape_merge = 1; 2327 bd->need_shape_merge = 1;
2328 bd->need_shape_export = 1; 2328 bd->need_shape_export = 1;
2329 } 2329 }
2330 if (bd->shaped_input) 2330 if (bd->shaped_input)
2331 { 2331 {
2332 bd->need_shape_merge = 1; 2332 bd->need_shape_merge = 1;
2333 } 2333 }
2334 2334
2335 bd->shaded = 1; 2335 bd->shaded = 1;
2336 bd->changes.shaded = 1; 2336 bd->changes.shaded = 1;
2337 BD_CHANGED(bd); 2337 BD_CHANGED(bd);
2338 edje_object_signal_emit(bd->bg_object, "e,state,shaded", "e"); 2338 edje_object_signal_emit(bd->bg_object, "e,state,shaded", "e");
2339 e_border_frame_recalc(bd); 2339 e_border_frame_recalc(bd);
2340 if (move) 2340 if (move)
2341 { 2341 {
2342 ev = E_NEW(E_Event_Border_Simple, 1); 2342 ev = E_NEW(E_Event_Border_Simple, 1);
2343 ev->border = bd; 2343 ev->border = bd;
2344 e_object_ref(E_OBJECT(bd)); 2344 e_object_ref(E_OBJECT(bd));
2345 ecore_event_add(E_EVENT_BORDER_MOVE, ev, _e_border_event_border_move_free, NULL); 2345 ecore_event_add(E_EVENT_BORDER_MOVE, ev, _e_border_event_border_move_free, NULL);
2346 e_container_shape_move(bd->shape, bd->x, bd->y); 2346 e_container_shape_move(bd->shape, bd->x, bd->y);
2347 } 2347 }
2348 e_container_shape_resize(bd->shape, bd->w, bd->h); 2348 e_container_shape_resize(bd->shape, bd->w, bd->h);
2349 e_border_comp_hidden_set(bd, EINA_TRUE); 2349 e_border_comp_hidden_set(bd, EINA_TRUE);
2350 ev = E_NEW(E_Event_Border_Simple, 1); 2350 ev = E_NEW(E_Event_Border_Simple, 1);
2351 ev->border = bd; 2351 ev->border = bd;
2352 /* The resize is added in the animator when animation complete */ 2352 /* The resize is added in the animator when animation complete */
2353 /* For non-animated, we add it immediately with the new size */ 2353 /* For non-animated, we add it immediately with the new size */
2354 e_object_ref(E_OBJECT(bd)); 2354 e_object_ref(E_OBJECT(bd));
2355 // e_object_breadcrumb_add(E_OBJECT(bd), "border_resize_event"); 2355 // e_object_breadcrumb_add(E_OBJECT(bd), "border_resize_event");
2356 ecore_event_add(E_EVENT_BORDER_RESIZE, ev, _e_border_event_border_resize_free, NULL); 2356 ecore_event_add(E_EVENT_BORDER_RESIZE, ev, _e_border_event_border_resize_free, NULL);
2357 } 2357 }
2358 2358
2359 e_remember_update(bd); 2359 e_remember_update(bd);
2360} 2360}
2361 2361
2362EAPI void 2362EAPI void
2363e_border_unshade(E_Border *bd, 2363e_border_unshade(E_Border *bd,
2364 E_Direction dir) 2364 E_Direction dir)
2365{ 2365{
2366 E_Event_Border_Simple *ev; 2366 E_Event_Border_Simple *ev;
2367 Eina_List *l; 2367 Eina_List *l;
2368 E_Border *tmp; 2368 E_Border *tmp;
2369 2369
2370 E_OBJECT_CHECK(bd); 2370 E_OBJECT_CHECK(bd);
2371 E_OBJECT_TYPE_CHECK(bd, E_BORDER_TYPE); 2371 E_OBJECT_TYPE_CHECK(bd, E_BORDER_TYPE);
2372 if ((!bd->shaded) || (bd->shading)) 2372 if ((!bd->shaded) || (bd->shading))
2373 return; 2373 return;
2374 2374
2375 EINA_LIST_FOREACH(bd->client.e.state.video_child, l, tmp) 2375 EINA_LIST_FOREACH(bd->client.e.state.video_child, l, tmp)
2376 ecore_x_window_show(tmp->win); 2376 ecore_x_window_show(tmp->win);
2377 2377
2378 ecore_x_window_shadow_tree_flush(); 2378 ecore_x_window_shadow_tree_flush();
2379 2379
2380 bd->shade.dir = dir; 2380 bd->shade.dir = dir;
2381 2381
2382 e_hints_window_shaded_set(bd, 0); 2382 e_hints_window_shaded_set(bd, 0);
2383 e_hints_window_shade_direction_set(bd, dir); 2383 e_hints_window_shade_direction_set(bd, dir);
2384 2384
2385 if (bd->shade.dir == E_DIRECTION_UP || 2385 if (bd->shade.dir == E_DIRECTION_UP ||
2386 bd->shade.dir == E_DIRECTION_LEFT) 2386 bd->shade.dir == E_DIRECTION_LEFT)
2387 { 2387 {
2388 bd->shade.x = bd->x; 2388 bd->shade.x = bd->x;
2389 bd->shade.y = bd->y; 2389 bd->shade.y = bd->y;
2390 } 2390 }
2391 else 2391 else
2392 {