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