Rev 1198 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1198 | Rev 1206 | ||
---|---|---|---|
1 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
1 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
2 | ;; ;; |
2 | ;; ;; |
3 | ;; Copyright (C) KolibriOS team 2004-2009. All rights reserved. ;; |
3 | ;; Copyright (C) KolibriOS team 2004-2009. All rights reserved. ;; |
4 | ;; Copyright (C) MenuetOS 2000-2004 Ville Mikael Turjanmaa ;; |
4 | ;; Copyright (C) MenuetOS 2000-2004 Ville Mikael Turjanmaa ;; |
5 | ;; Distributed under terms of the GNU General Public License ;; |
5 | ;; Distributed under terms of the GNU General Public License ;; |
6 | ;; ;; |
6 | ;; ;; |
7 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
7 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
8 | 8 | ||
9 | $Revision: 994 $ |
9 | $Revision: 1206 $ |
10 | 10 | ||
11 | 11 | ||
12 | get_titlebar_height: ; edi = window draw_data pointer |
12 | get_titlebar_height: ; edi = window draw_data pointer |
13 | mov al,[edi+WDATA.fl_wstyle] |
13 | mov al,[edi+WDATA.fl_wstyle] |
14 | and al,0x0F |
14 | and al,0x0F |
15 | cmp al,0x03 |
15 | cmp al,0x03 |
16 | jne @f |
16 | jne @f |
17 | mov eax,[_skinh] |
17 | mov eax,[_skinh] |
18 | ret |
18 | ret |
19 | @@: mov eax,21 |
19 | @@: mov eax,21 |
20 | ret |
20 | ret |
21 | 21 | ||
22 | get_rolledup_height: ; edi = window draw_data pointer |
22 | get_rolledup_height: ; edi = window draw_data pointer |
23 | mov al,[edi+WDATA.fl_wstyle] |
23 | mov al,[edi+WDATA.fl_wstyle] |
24 | and al,0x0F |
24 | and al,0x0F |
25 | cmp al,0x03 |
25 | cmp al,0x03 |
26 | jb @f |
26 | jb @f |
27 | mov eax,[_skinh] |
27 | mov eax,[_skinh] |
28 | add eax,3 |
28 | add eax,3 |
29 | ret |
29 | ret |
30 | @@: or al,al |
30 | @@: or al,al |
31 | jnz @f |
31 | jnz @f |
32 | mov eax,21 |
32 | mov eax,21 |
33 | ret |
33 | ret |
34 | @@: mov eax,21+2 |
34 | @@: mov eax,21+2 |
35 | ret |
35 | ret |
36 | 36 | ||
37 | 37 | ||
38 | setwindowdefaults: |
38 | setwindowdefaults: |
39 | pushad |
39 | pushad |
40 | 40 | ||
41 | xor eax,eax |
41 | xor eax,eax |
42 | mov ecx,WIN_STACK |
42 | mov ecx,WIN_STACK |
43 | @@: |
43 | @@: |
44 | inc eax |
44 | inc eax |
45 | add ecx,2 |
45 | add ecx,2 |
46 | mov [ecx+0x000],ax ; process no |
46 | mov [ecx+0x000],ax ; process no |
47 | mov [ecx+0x400],ax ; positions in stack |
47 | mov [ecx+0x400],ax ; positions in stack |
48 | cmp ecx,WIN_POS-2 ; the more high, the more surface |
48 | cmp ecx,WIN_POS-2 ; the more high, the more surface |
49 | jnz @b |
49 | jnz @b |
50 | 50 | ||
51 | popad |
51 | popad |
52 | ret |
52 | ret |
53 | 53 | ||
54 | 54 | ||
55 | 55 | ||
56 | ; eax = cx |
56 | ; eax = cx |
57 | ; ebx = cy |
57 | ; ebx = cy |
58 | ; ecx = ex |
58 | ; ecx = ex |
59 | ; edx = ey |
59 | ; edx = ey |
60 | ; èäåÿ: ïåðåáðàòü âñå îêíà, íà÷èíàÿ ñ ñàìîãî íèæíåãî, |
60 | ; èäåÿ: ïåðåáðàòü âñå îêíà, íà÷èíàÿ ñ ñàìîãî íèæíåãî, |
61 | ; è äëÿ ïîïàâøèõ â çàäàííóþ îáëàñòü |
61 | ; è äëÿ ïîïàâøèõ â çàäàííóþ îáëàñòü |
62 | ; ÷àñòåé îêîí âûçâàòü setscreen |
62 | ; ÷àñòåé îêîí âûçâàòü setscreen |
63 | align 4 |
63 | align 4 |
64 | calculatescreen: |
64 | calculatescreen: |
65 | pushad |
65 | pushad |
66 | pushfd |
66 | pushfd |
67 | cli |
67 | cli |
68 | 68 | ||
69 | push edx ecx ebx eax |
69 | push edx ecx ebx eax |
70 | 70 | ||
71 | mov esi, 1 |
71 | mov esi, 1 |
72 | call setscreen |
72 | call setscreen |
73 | 73 | ||
74 | mov ebp, [TASK_COUNT] ; number of processes |
74 | mov ebp, [TASK_COUNT] ; number of processes |
75 | cmp ebp, 1 |
75 | cmp ebp, 1 |
76 | jbe .finish |
76 | jbe .finish |
77 | align 4 |
77 | align 4 |
78 | .new_wnd: |
78 | .new_wnd: |
79 | movzx edi, word [WIN_POS + esi * 2] |
79 | movzx edi, word [WIN_POS + esi * 2] |
80 | shl edi, 5 |
80 | shl edi, 5 |
81 | 81 | ||
82 | cmp [CURRENT_TASK+edi+TASKDATA.state], byte 9 |
82 | cmp [CURRENT_TASK+edi+TASKDATA.state], byte 9 |
83 | je .not_wnd |
83 | je .not_wnd |
84 | 84 | ||
85 | add edi, window_data |
85 | add edi, window_data |
86 | test [edi+WDATA.fl_wstate], WSTATE_MINIMIZED |
86 | test [edi+WDATA.fl_wstate], WSTATE_MINIMIZED |
87 | jnz .not_wnd |
87 | jnz .not_wnd |
88 | 88 | ||
89 | mov eax,[edi+WDATA.box.left] |
89 | mov eax,[edi+WDATA.box.left] |
90 | cmp eax, [esp+RECT.right] |
90 | cmp eax, [esp+RECT.right] |
91 | ja .out_of_bounds |
91 | ja .out_of_bounds |
92 | mov ebx,[edi+WDATA.box.top] |
92 | mov ebx,[edi+WDATA.box.top] |
93 | cmp ebx, [esp+RECT.bottom] |
93 | cmp ebx, [esp+RECT.bottom] |
94 | ja .out_of_bounds |
94 | ja .out_of_bounds |
95 | mov ecx,[edi+WDATA.box.width] |
95 | mov ecx,[edi+WDATA.box.width] |
96 | add ecx, eax |
96 | add ecx, eax |
97 | cmp ecx, [esp+RECT.left] |
97 | cmp ecx, [esp+RECT.left] |
98 | jb .out_of_bounds |
98 | jb .out_of_bounds |
99 | mov edx,[edi+WDATA.box.height] |
99 | mov edx,[edi+WDATA.box.height] |
100 | add edx, ebx |
100 | add edx, ebx |
101 | cmp edx, [esp+RECT.top] |
101 | cmp edx, [esp+RECT.top] |
102 | jb .out_of_bounds |
102 | jb .out_of_bounds |
103 | 103 | ||
104 | cmp eax, [esp+RECT.left] |
104 | cmp eax, [esp+RECT.left] |
105 | jae @f |
105 | jae @f |
106 | mov eax, [esp+RECT.left] |
106 | mov eax, [esp+RECT.left] |
107 | @@: |
107 | @@: |
108 | cmp ebx, [esp+RECT.top] |
108 | cmp ebx, [esp+RECT.top] |
109 | jae @f |
109 | jae @f |
110 | mov ebx, [esp+RECT.top] |
110 | mov ebx, [esp+RECT.top] |
111 | @@: |
111 | @@: |
112 | cmp ecx, [esp+RECT.right] |
112 | cmp ecx, [esp+RECT.right] |
113 | jbe @f |
113 | jbe @f |
114 | mov ecx, [esp+RECT.right] |
114 | mov ecx, [esp+RECT.right] |
115 | @@: |
115 | @@: |
116 | cmp edx, [esp+RECT.bottom] |
116 | cmp edx, [esp+RECT.bottom] |
117 | jbe @f |
117 | jbe @f |
118 | mov edx, [esp+RECT.bottom] |
118 | mov edx, [esp+RECT.bottom] |
119 | @@: |
119 | @@: |
120 | 120 | ||
121 | push esi |
121 | push esi |
122 | movzx esi, word [WIN_POS + esi * 2] |
122 | movzx esi, word [WIN_POS + esi * 2] |
123 | call setscreen |
123 | call setscreen |
124 | pop esi |
124 | pop esi |
125 | 125 | ||
126 | .not_wnd: |
126 | .not_wnd: |
127 | .out_of_bounds: |
127 | .out_of_bounds: |
128 | inc esi |
128 | inc esi |
129 | dec ebp |
129 | dec ebp |
130 | jnz .new_wnd |
130 | jnz .new_wnd |
131 | .finish: |
131 | .finish: |
132 | 132 | ||
133 | pop eax ebx ecx edx |
133 | pop eax ebx ecx edx |
134 | 134 | ||
135 | popfd |
135 | popfd |
136 | popad |
136 | popad |
137 | ret |
137 | ret |
138 | 138 | ||
139 | 139 | ||
140 | 140 | ||
141 | virtual at esp |
141 | virtual at esp |
142 | ff_x dd ? |
142 | ff_x dd ? |
143 | ff_y dd ? |
143 | ff_y dd ? |
144 | ff_width dd ? |
144 | ff_width dd ? |
145 | ff_xsz dd ? |
145 | ff_xsz dd ? |
146 | ff_ysz dd ? |
146 | ff_ysz dd ? |
147 | ff_scale dd ? |
147 | ff_scale dd ? |
148 | end virtual |
148 | end virtual |
149 | 149 | ||
150 | align 4 |
150 | align 4 |
151 | ; ðåçåðâèðóåò ìåñòî ïîä îêíî çàäàííîãî ïðîöåññà |
151 | ; ðåçåðâèðóåò ìåñòî ïîä îêíî çàäàííîãî ïðîöåññà |
152 | setscreen: |
152 | setscreen: |
153 | ; eax x start |
153 | ; eax x start |
154 | ; ebx y start |
154 | ; ebx y start |
155 | ; ecx x end |
155 | ; ecx x end |
156 | ; edx y end |
156 | ; edx y end |
157 | ; esi process number |
157 | ; esi process number |
158 | pushad |
158 | pushad |
159 | ; \begin{diamond}[29.08.2006] |
159 | ; \begin{diamond}[29.08.2006] |
160 | cmp esi, 1 |
160 | cmp esi, 1 |
161 | jz @f |
161 | jz @f |
162 | mov edi, esi |
162 | mov edi, esi |
163 | shl edi, 5 |
163 | shl edi, 5 |
164 | cmp [edi+window_data+WDATA.box.width], 0 |
164 | cmp [edi+window_data+WDATA.box.width], 0 |
165 | jnz @f |
165 | jnz @f |
166 | cmp [edi+window_data+WDATA.box.height], 0 |
166 | cmp [edi+window_data+WDATA.box.height], 0 |
167 | jz .ret |
167 | jz .ret |
168 | @@: |
168 | @@: |
169 | ; \end{diamond}[29.08.2006] |
169 | ; \end{diamond}[29.08.2006] |
170 | mov edi, esi ;;;word [esi*2+WIN_POS] |
170 | mov edi, esi ;;;word [esi*2+WIN_POS] |
171 | shl edi, 8 |
171 | shl edi, 8 |
172 | add edi, SLOT_BASE ; address of random shaped window area |
172 | add edi, SLOT_BASE ; address of random shaped window area |
173 | cmp [edi+APPDATA.wnd_shape], dword 0 |
173 | cmp [edi+APPDATA.wnd_shape], dword 0 |
174 | jne .free_form |
174 | jne .free_form |
175 | 175 | ||
176 | ; get x&y size |
176 | ; get x&y size |
177 | sub ecx, eax |
177 | sub ecx, eax |
178 | sub edx, ebx |
178 | sub edx, ebx |
179 | inc ecx |
179 | inc ecx |
180 | inc edx |
180 | inc edx |
181 | 181 | ||
182 | ; get WinMap start |
182 | ; get WinMap start |
183 | mov edi, [Screen_Max_X] ; screen_sx |
183 | mov edi, [Screen_Max_X] ; screen_sx |
184 | inc edi |
184 | inc edi |
185 | imul edi, ebx |
185 | imul edi, ebx |
186 | add edi, eax |
186 | add edi, eax |
187 | add edi, WinMapAddress |
187 | add edi, WinMapAddress |
188 | 188 | ||
189 | .new_y: |
189 | .new_y: |
190 | push ecx ; sx |
190 | push ecx ; sx |
191 | push edx |
191 | push edx |
192 | 192 | ||
193 | mov edx, esi |
193 | mov edx, esi |
194 | align 4 |
194 | align 4 |
195 | .new_x: |
195 | .new_x: |
196 | mov byte [edi], dl |
196 | mov byte [edi], dl |
197 | inc edi |
197 | inc edi |
198 | dec ecx |
198 | dec ecx |
199 | jnz .new_x |
199 | jnz .new_x |
200 | 200 | ||
201 | pop edx |
201 | pop edx |
202 | pop ecx |
202 | pop ecx |
203 | add edi, [Screen_Max_X] |
203 | add edi, [Screen_Max_X] |
204 | inc edi |
204 | inc edi |
205 | sub edi, ecx |
205 | sub edi, ecx |
206 | dec edx |
206 | dec edx |
207 | jnz .new_y |
207 | jnz .new_y |
208 | .ret: |
208 | .ret: |
209 | popad |
209 | popad |
210 | ret |
210 | ret |
211 | .read_byte: |
211 | .read_byte: |
212 | ;eax - address |
212 | ;eax - address |
213 | ;esi - slot |
213 | ;esi - slot |
214 | push eax |
214 | push eax |
215 | push ebx |
215 | push ebx |
216 | push ecx |
216 | push ecx |
217 | push edx |
217 | push edx |
218 | mov edx,eax |
218 | mov edx,eax |
219 | mov eax,esi |
219 | mov eax,esi |
220 | lea ebx,[esp+12] |
220 | lea ebx,[esp+12] |
221 | mov ecx,1 |
221 | mov ecx,1 |
222 | call read_process_memory |
222 | call read_process_memory |
223 | pop edx |
223 | pop edx |
224 | pop ecx |
224 | pop ecx |
225 | pop ebx |
225 | pop ebx |
226 | pop eax |
226 | pop eax |
227 | ret |
227 | ret |
228 | .free_form: |
228 | .free_form: |
229 | 229 | ||
230 | ; for (y=0; y <= x_size; y++) |
230 | ; for (y=0; y <= x_size; y++) |
231 | ; for (x=0; x <= x_size; x++) |
231 | ; for (x=0; x <= x_size; x++) |
232 | ; if (shape[coord(x,y,scale)]==1) |
232 | ; if (shape[coord(x,y,scale)]==1) |
233 | ; set_pixel(x, y, process_number); |
233 | ; set_pixel(x, y, process_number); |
234 | 234 | ||
235 | sub ecx, eax |
235 | sub ecx, eax |
236 | sub edx, ebx |
236 | sub edx, ebx |
237 | inc ecx |
237 | inc ecx |
238 | inc edx |
238 | inc edx |
239 | 239 | ||
240 | push dword [edi+APPDATA.wnd_shape_scale] ; push scale first -> for loop |
240 | push dword [edi+APPDATA.wnd_shape_scale] ; push scale first -> for loop |
241 | 241 | ||
242 | ; get WinMap start -> ebp |
242 | ; get WinMap start -> ebp |
243 | push eax |
243 | push eax |
244 | mov eax, [Screen_Max_X] ; screen_sx |
244 | mov eax, [Screen_Max_X] ; screen_sx |
245 | inc eax |
245 | inc eax |
246 | imul eax, ebx |
246 | imul eax, ebx |
247 | add eax, [esp] |
247 | add eax, [esp] |
248 | add eax, WinMapAddress |
248 | add eax, WinMapAddress |
249 | mov ebp, eax |
249 | mov ebp, eax |
250 | 250 | ||
251 | mov edi, [edi+APPDATA.wnd_shape] |
251 | mov edi, [edi+APPDATA.wnd_shape] |
252 | pop eax |
252 | pop eax |
253 | 253 | ||
254 | ; eax = x_start |
254 | ; eax = x_start |
255 | ; ebx = y_start |
255 | ; ebx = y_start |
256 | ; ecx = x_size |
256 | ; ecx = x_size |
257 | ; edx = y_size |
257 | ; edx = y_size |
258 | ; esi = process_number |
258 | ; esi = process_number |
259 | ; edi = &shape |
259 | ; edi = &shape |
260 | ; [scale] |
260 | ; [scale] |
261 | push edx ecx ; for loop - x,y size |
261 | push edx ecx ; for loop - x,y size |
262 | 262 | ||
263 | mov ecx, esi |
263 | mov ecx, esi |
264 | shl ecx, 5 |
264 | shl ecx, 5 |
265 | mov edx, [window_data+ecx+WDATA.box.top] |
265 | mov edx, [window_data+ecx+WDATA.box.top] |
266 | push [window_data+ecx+WDATA.box.width] ; for loop - width |
266 | push [window_data+ecx+WDATA.box.width] ; for loop - width |
267 | mov ecx, [window_data+ecx+WDATA.box.left] |
267 | mov ecx, [window_data+ecx+WDATA.box.left] |
268 | sub ebx, edx |
268 | sub ebx, edx |
269 | sub eax, ecx |
269 | sub eax, ecx |
270 | push ebx eax ; for loop - x,y |
270 | push ebx eax ; for loop - x,y |
271 | 271 | ||
272 | add [ff_xsz], eax |
272 | add [ff_xsz], eax |
273 | add [ff_ysz], ebx |
273 | add [ff_ysz], ebx |
274 | 274 | ||
275 | mov ebx, [ff_y] |
275 | mov ebx, [ff_y] |
276 | 276 | ||
277 | .ff_new_y: |
277 | .ff_new_y: |
278 | mov edx, [ff_x] |
278 | mov edx, [ff_x] |
279 | 279 | ||
280 | .ff_new_x: |
280 | .ff_new_x: |
281 | ; -- body -- |
281 | ; -- body -- |
282 | mov ecx, [ff_scale] |
282 | mov ecx, [ff_scale] |
283 | mov eax, [ff_width] |
283 | mov eax, [ff_width] |
284 | inc eax |
284 | inc eax |
285 | shr eax, cl |
285 | shr eax, cl |
286 | push ebx edx |
286 | push ebx edx |
287 | shr ebx, cl |
287 | shr ebx, cl |
288 | shr edx, cl |
288 | shr edx, cl |
289 | imul eax, ebx |
289 | imul eax, ebx |
290 | add eax, edx |
290 | add eax, edx |
291 | pop edx ebx |
291 | pop edx ebx |
292 | add eax, edi |
292 | add eax, edi |
293 | call .read_byte |
293 | call .read_byte |
294 | test al,al |
294 | test al,al |
295 | jz @f |
295 | jz @f |
296 | mov eax, esi |
296 | mov eax, esi |
297 | mov [ebp], al |
297 | mov [ebp], al |
298 | @@: |
298 | @@: |
299 | ; -- end body -- |
299 | ; -- end body -- |
300 | inc ebp |
300 | inc ebp |
301 | inc edx |
301 | inc edx |
302 | cmp edx, [ff_xsz] |
302 | cmp edx, [ff_xsz] |
303 | jb .ff_new_x |
303 | jb .ff_new_x |
304 | sub ebp, [ff_xsz] |
304 | sub ebp, [ff_xsz] |
305 | add ebp, [ff_x] |
305 | add ebp, [ff_x] |
306 | add ebp, [Screen_Max_X] ; screen.x |
306 | add ebp, [Screen_Max_X] ; screen.x |
307 | inc ebp |
307 | inc ebp |
308 | inc ebx |
308 | inc ebx |
309 | cmp ebx, [ff_ysz] |
309 | cmp ebx, [ff_ysz] |
310 | jb .ff_new_y |
310 | jb .ff_new_y |
311 | 311 | ||
312 | add esp, 24 |
312 | add esp, 24 |
313 | popad |
313 | popad |
314 | ret |
314 | ret |
315 | 315 | ||
316 | 316 | ||
317 | display_settings: |
317 | display_settings: |
318 | 318 | ||
319 | ; eax = 0 ; DISPLAY redraw |
319 | ; eax = 0 ; DISPLAY redraw |
320 | ; ebx = 0 ; all |
320 | ; ebx = 0 ; all |
321 | ; |
321 | ; |
322 | ; eax = 1 ; BUTTON type |
322 | ; eax = 1 ; BUTTON type |
323 | ; ebx = 0 ; flat |
323 | ; ebx = 0 ; flat |
324 | ; ebx = 1 ; 3D |
324 | ; ebx = 1 ; 3D |
325 | ; eax = 2 ; set WINDOW colours |
325 | ; eax = 2 ; set WINDOW colours |
326 | ; ebx = pointer to table |
326 | ; ebx = pointer to table |
327 | ; ecx = number of bytes define |
327 | ; ecx = number of bytes define |
328 | ; eax = 3 ; get WINDOW colours |
328 | ; eax = 3 ; get WINDOW colours |
329 | ; ebx = pointer to table |
329 | ; ebx = pointer to table |
330 | ; ecx = number of bytes wanted |
330 | ; ecx = number of bytes wanted |
331 | ; eax = 4 ; get skin height |
331 | ; eax = 4 ; get skin height |
332 | ; input : nothing |
332 | ; input : nothing |
333 | ; output : eax = skin height in pixel |
333 | ; output : eax = skin height in pixel |
334 | ; eax = 5 ; get screen workarea |
334 | ; eax = 5 ; get screen workarea |
335 | ; input : nothing |
335 | ; input : nothing |
336 | ; output : eax = [left]*65536+[right] |
336 | ; output : eax = [left]*65536+[right] |
337 | ; ebx = [top]*65536+[bottom] |
337 | ; ebx = [top]*65536+[bottom] |
338 | ; eax = 6 ; set screen workarea |
338 | ; eax = 6 ; set screen workarea |
339 | ; input : ecx = [left]*65536+[right] |
339 | ; input : ecx = [left]*65536+[right] |
340 | ; edx = [top]*65536+[bottom] |
340 | ; edx = [top]*65536+[bottom] |
341 | ; output : nothing |
341 | ; output : nothing |
342 | ; eax = 7 ; get skin margins |
342 | ; eax = 7 ; get skin margins |
343 | ; input : nothing |
343 | ; input : nothing |
344 | ; output : eax = [left]*65536+[right] |
344 | ; output : eax = [left]*65536+[right] |
345 | ; ebx = [top]*65536+[bottom] |
345 | ; ebx = [top]*65536+[bottom] |
346 | ; eax = 8 ; set window skin |
346 | ; eax = 8 ; set window skin |
347 | ; input : ecx = pointer to file info block |
347 | ; input : ecx = pointer to file info block |
348 | ; output : eax = FS error code |
348 | ; output : eax = FS error code |
349 | 349 | ||
350 | 350 | ||
351 | pushad |
351 | pushad |
352 | 352 | ||
353 | test eax, eax ; redraw display |
353 | test eax, eax ; redraw display |
354 | jnz dspl0 |
354 | jnz dspl0 |
355 | test ebx, ebx |
355 | test ebx, ebx |
356 | jnz dspl0 |
356 | jnz dspl0 |
357 | cmp [windowtypechanged],dword 1 |
357 | cmp [windowtypechanged],dword 1 |
358 | jne dspl00 |
358 | jne dspl00 |
359 | mov [windowtypechanged],dword 0 |
359 | mov [windowtypechanged],dword 0 |
360 | redraw_screen_direct: |
360 | redraw_screen_direct: |
361 | mov [dlx],dword 0 |
361 | mov [dlx],dword 0 |
362 | mov [dly],dword 0 |
362 | mov [dly],dword 0 |
363 | mov eax,[Screen_Max_X] |
363 | mov eax,[Screen_Max_X] |
364 | mov [dlxe],eax |
364 | mov [dlxe],eax |
365 | mov eax,[Screen_Max_Y] |
365 | mov eax,[Screen_Max_Y] |
366 | mov [dlye],eax |
366 | mov [dlye],eax |
367 | mov eax,window_data |
367 | mov eax,window_data |
368 | call redrawscreen |
368 | call redrawscreen |
369 | dspl00: |
369 | dspl00: |
370 | popad |
370 | popad |
371 | ret |
371 | ret |
372 | dspl0: |
372 | dspl0: |
373 | 373 | ||
374 | cmp eax,1 ; button type |
374 | cmp eax,1 ; button type |
375 | jne dspl1 |
375 | jne dspl1 |
376 | and ebx,1 |
376 | and ebx,1 |
377 | cmp ebx,[buttontype] |
377 | cmp ebx,[buttontype] |
378 | je dspl9 |
378 | je dspl9 |
379 | mov [buttontype],ebx |
379 | mov [buttontype],ebx |
380 | mov [windowtypechanged],dword 1 |
380 | mov [windowtypechanged],dword 1 |
381 | dspl9: |
381 | dspl9: |
382 | popad |
382 | popad |
383 | ret |
383 | ret |
384 | dspl1: |
384 | dspl1: |
385 | 385 | ||
386 | cmp eax,2 ; set common window colours |
386 | cmp eax,2 ; set common window colours |
387 | jne no_com_colours |
387 | jne no_com_colours |
388 | mov [windowtypechanged],dword 1 |
388 | mov [windowtypechanged],dword 1 |
389 | mov esi,[TASK_BASE] |
389 | mov esi,[TASK_BASE] |
390 | add esi,TASKDATA.mem_start |
390 | add esi,TASKDATA.mem_start |
391 | add ebx,[esi] |
391 | add ebx,[esi] |
392 | mov esi,ebx |
392 | mov esi,ebx |
393 | mov edi,common_colours |
393 | mov edi,common_colours |
394 | and ecx,127 |
394 | and ecx,127 |
395 | cld |
395 | cld |
396 | rep movsb |
396 | rep movsb |
397 | popad |
397 | popad |
398 | ret |
398 | ret |
399 | no_com_colours: |
399 | no_com_colours: |
400 | 400 | ||
401 | cmp eax,3 ; get common window colours |
401 | cmp eax,3 ; get common window colours |
402 | jne no_get_com |
402 | jne no_get_com |
403 | mov esi,[TASK_BASE] |
403 | mov esi,[TASK_BASE] |
404 | add esi,TASKDATA.mem_start |
404 | add esi,TASKDATA.mem_start |
405 | add ebx,[esi] |
405 | add ebx,[esi] |
406 | mov edi,ebx |
406 | mov edi,ebx |
407 | mov esi,common_colours |
407 | mov esi,common_colours |
408 | and ecx,127 |
408 | and ecx,127 |
409 | cld |
409 | cld |
410 | rep movsb |
410 | rep movsb |
411 | popad |
411 | popad |
412 | ret |
412 | ret |
413 | no_get_com: |
413 | no_get_com: |
414 | 414 | ||
415 | cmp eax,4 ; get skin height |
415 | cmp eax,4 ; get skin height |
416 | jne no_skin_height |
416 | jne no_skin_height |
417 | popad |
417 | popad |
418 | mov eax,[_skinh] |
418 | mov eax,[_skinh] |
419 | mov [esp+36],eax |
419 | mov [esp+36],eax |
420 | ret |
420 | ret |
421 | no_skin_height: |
421 | no_skin_height: |
422 | 422 | ||
423 | cmp eax,5 ; get screen workarea |
423 | cmp eax,5 ; get screen workarea |
424 | jne no_get_workarea |
424 | jne no_get_workarea |
425 | popad |
425 | popad |
426 | mov eax,[screen_workarea.left-2] |
426 | mov eax,[screen_workarea.left-2] |
427 | mov ax,word[screen_workarea.right] |
427 | mov ax,word[screen_workarea.right] |
428 | mov [esp+36],eax |
428 | mov [esp+36],eax |
429 | mov eax,[screen_workarea.top-2] |
429 | mov eax,[screen_workarea.top-2] |
430 | mov ax,word[screen_workarea.bottom] |
430 | mov ax,word[screen_workarea.bottom] |
431 | mov [esp+24],eax |
431 | mov [esp+24],eax |
432 | ret |
432 | ret |
433 | no_get_workarea: |
433 | no_get_workarea: |
434 | 434 | ||
435 | cmp eax,6 ; set screen workarea |
435 | cmp eax,6 ; set screen workarea |
436 | jne no_set_workarea |
436 | jne no_set_workarea |
437 | movsx eax,word[esp+16+2] |
437 | movsx eax,word[esp+16+2] |
438 | movsx ebx,word[esp+16] |
438 | movsx ebx,word[esp+16] |
439 | cmp eax,ebx |
439 | cmp eax,ebx |
440 | jge .lp1 |
440 | jge .lp1 |
441 | or eax,eax;[Screen_Max_X] |
441 | or eax,eax;[Screen_Max_X] |
442 | jl @f |
442 | jl @f |
443 | mov [screen_workarea.left],eax |
443 | mov [screen_workarea.left],eax |
444 | @@: cmp ebx,[Screen_Max_X] |
444 | @@: cmp ebx,[Screen_Max_X] |
445 | jg .lp1 |
445 | jg .lp1 |
446 | mov [screen_workarea.right],ebx |
446 | mov [screen_workarea.right],ebx |
447 | .lp1: movsx eax,word[esp+24+2] |
447 | .lp1: movsx eax,word[esp+24+2] |
448 | movsx ebx,word[esp+24] |
448 | movsx ebx,word[esp+24] |
449 | cmp eax,ebx |
449 | cmp eax,ebx |
450 | jge .lp2 |
450 | jge .lp2 |
451 | or eax,eax;[0xFE04] |
451 | or eax,eax;[0xFE04] |
452 | jl @f |
452 | jl @f |
453 | mov [screen_workarea.top],eax |
453 | mov [screen_workarea.top],eax |
454 | @@: cmp ebx,[Screen_Max_Y] |
454 | @@: cmp ebx,[Screen_Max_Y] |
455 | jg .lp2 |
455 | jg .lp2 |
456 | mov [screen_workarea.bottom],ebx |
456 | mov [screen_workarea.bottom],ebx |
457 | .lp2: call repos_windows |
457 | .lp2: call repos_windows |
458 | mov eax, 0 |
458 | mov eax, 0 |
459 | mov ebx, 0 |
459 | mov ebx, 0 |
460 | mov ecx, [Screen_Max_X] |
460 | mov ecx, [Screen_Max_X] |
461 | mov edx, [Screen_Max_Y] |
461 | mov edx, [Screen_Max_Y] |
462 | call calculatescreen |
462 | call calculatescreen |
463 | ; jmp redraw_screen_direct |
463 | ; jmp redraw_screen_direct |
464 | .exit: |
464 | .exit: |
465 | popad |
465 | popad |
466 | ret |
466 | ret |
467 | no_set_workarea: |
467 | no_set_workarea: |
468 | 468 | ||
469 | cmp eax,7 ; get skin margins |
469 | cmp eax,7 ; get skin margins |
470 | jne no_get_skinmargins |
470 | jne no_get_skinmargins |
471 | popad |
471 | popad |
472 | mov eax,dword[_skinmargins+0] |
472 | mov eax,dword[_skinmargins+0] |
473 | mov [esp+36],eax |
473 | mov [esp+36],eax |
474 | mov eax,dword[_skinmargins+4] |
474 | mov eax,dword[_skinmargins+4] |
475 | mov [esp+24],eax |
475 | mov [esp+24],eax |
476 | ret |
476 | ret |
477 | no_get_skinmargins: |
477 | no_get_skinmargins: |
478 | 478 | ||
479 | cmp eax,8 ; set window skin |
479 | cmp eax,8 ; set window skin |
480 | jne no_set_skin |
480 | jne no_set_skin |
481 | call read_skin_file |
481 | call read_skin_file |
482 | mov [esp+32+36], eax |
482 | mov [esp+32+36], eax |
483 | test eax, eax |
483 | test eax, eax |
484 | jnz .ret |
484 | jnz .ret |
485 | xor eax, eax |
485 | xor eax, eax |
486 | xor ebx, ebx |
486 | xor ebx, ebx |
487 | mov ecx, [Screen_Max_X] |
487 | mov ecx, [Screen_Max_X] |
488 | mov edx, [Screen_Max_Y] |
488 | mov edx, [Screen_Max_Y] |
489 | call calculatescreen |
489 | call calculatescreen |
490 | jmp redraw_screen_direct |
490 | jmp redraw_screen_direct |
491 | .ret: |
491 | .ret: |
492 | popad |
492 | popad |
493 | ret |
493 | ret |
494 | no_set_skin: |
494 | no_set_skin: |
495 | 495 | ||
496 | popad |
496 | popad |
497 | ret |
497 | ret |
498 | 498 | ||
499 | 499 | ||
500 | repos_windows: |
500 | repos_windows: |
501 | mov ecx,[TASK_COUNT] |
501 | mov ecx,[TASK_COUNT] |
502 | mov edi, OS_BASE+0x20*2 |
502 | mov edi, OS_BASE+0x20*2 |
503 | call force_redraw_background |
503 | call force_redraw_background |
504 | dec ecx |
504 | dec ecx |
505 | jge @f |
505 | jge @f |
506 | ret |
506 | ret |
507 | @@: mov [edi+WDATA.fl_redraw],1 |
507 | @@: mov [edi+WDATA.fl_redraw],1 |
508 | test [edi+WDATA.fl_wstate],WSTATE_MAXIMIZED |
508 | test [edi+WDATA.fl_wstate],WSTATE_MAXIMIZED |
509 | jz .lp2 |
509 | jz .lp2 |
510 | mov eax,[screen_workarea.left] |
510 | mov eax,[screen_workarea.left] |
511 | mov [edi+WDATA.box.left],eax |
511 | mov [edi+WDATA.box.left],eax |
512 | sub eax,[screen_workarea.right] |
512 | sub eax,[screen_workarea.right] |
513 | neg eax |
513 | neg eax |
514 | mov [edi+WDATA.box.width],eax |
514 | mov [edi+WDATA.box.width],eax |
515 | mov eax,[screen_workarea.top] |
515 | mov eax,[screen_workarea.top] |
516 | mov [edi+WDATA.box.top],eax |
516 | mov [edi+WDATA.box.top],eax |
517 | test [edi+WDATA.fl_wstate],WSTATE_ROLLEDUP |
517 | test [edi+WDATA.fl_wstate],WSTATE_ROLLEDUP |
518 | jnz .lp1 |
518 | jnz .lp1 |
519 | sub eax,[screen_workarea.bottom] |
519 | sub eax,[screen_workarea.bottom] |
520 | neg eax |
520 | neg eax |
521 | mov [edi+WDATA.box.height],eax |
521 | mov [edi+WDATA.box.height],eax |
522 | .lp1: |
522 | .lp1: |
523 | 523 | ||
524 | call set_window_clientbox |
524 | call set_window_clientbox |
525 | add edi,0x20 |
525 | add edi,0x20 |
526 | loop @b |
526 | loop @b |
527 | ret |
527 | ret |
528 | .lp2: mov eax,[edi+WDATA.box.left] |
528 | .lp2: mov eax,[edi+WDATA.box.left] |
529 | add eax,[edi+WDATA.box.width] |
529 | add eax,[edi+WDATA.box.width] |
530 | mov ebx,[Screen_Max_X] |
530 | mov ebx,[Screen_Max_X] |
531 | ; inc ebx |
531 | ; inc ebx |
532 | cmp eax,ebx |
532 | cmp eax,ebx |
533 | jle .lp4 |
533 | jle .lp4 |
534 | mov eax,[edi+WDATA.box.width] |
534 | mov eax,[edi+WDATA.box.width] |
535 | sub eax,ebx |
535 | sub eax,ebx |
536 | jle .lp3 |
536 | jle .lp3 |
537 | mov [edi+WDATA.box.width],ebx |
537 | mov [edi+WDATA.box.width],ebx |
538 | .lp3: sub ebx,[edi+WDATA.box.width] |
538 | .lp3: sub ebx,[edi+WDATA.box.width] |
539 | mov [edi+WDATA.box.left],ebx |
539 | mov [edi+WDATA.box.left],ebx |
540 | .lp4: mov eax,[edi+WDATA.box.top] |
540 | .lp4: mov eax,[edi+WDATA.box.top] |
541 | add eax,[edi+WDATA.box.height] |
541 | add eax,[edi+WDATA.box.height] |
542 | mov ebx,[Screen_Max_Y] |
542 | mov ebx,[Screen_Max_Y] |
543 | ; inc ebx |
543 | ; inc ebx |
544 | cmp eax,ebx |
544 | cmp eax,ebx |
545 | jle .lp6 |
545 | jle .lp6 |
546 | mov eax,[edi+WDATA.box.height] |
546 | mov eax,[edi+WDATA.box.height] |
547 | sub eax,ebx |
547 | sub eax,ebx |
548 | jle .lp5 |
548 | jle .lp5 |
549 | mov [edi+WDATA.box.height],ebx |
549 | mov [edi+WDATA.box.height],ebx |
550 | .lp5: sub ebx,[edi+WDATA.box.height] |
550 | .lp5: sub ebx,[edi+WDATA.box.height] |
551 | mov [edi+WDATA.box.top],ebx |
551 | mov [edi+WDATA.box.top],ebx |
552 | .lp6: jmp .lp1 |
552 | .lp6: jmp .lp1 |
553 | 553 | ||
554 | uglobal |
554 | uglobal |
555 | common_colours: |
555 | common_colours: |
556 | times 128 db 0x0 |
556 | times 128 db 0x0 |
557 | endg |
557 | endg |
558 | 558 | ||
559 | 559 | ||
560 | 560 | ||
561 | 561 | ||
562 | check_window_position: |
562 | check_window_position: |
563 | 563 | ||
564 | pushad ; window inside screen ? |
564 | pushad ; window inside screen ? |
565 | 565 | ||
566 | mov eax, [edi+WDATA.box.left] |
566 | mov eax, [edi+WDATA.box.left] |
567 | mov ebx, [edi+WDATA.box.top] |
567 | mov ebx, [edi+WDATA.box.top] |
568 | mov ecx, [edi+WDATA.box.width] |
568 | mov ecx, [edi+WDATA.box.width] |
569 | mov edx, [edi+WDATA.box.height] |
569 | mov edx, [edi+WDATA.box.height] |
570 | 570 | ||
571 | cmp ecx,[Screen_Max_X] ; check x size |
571 | cmp ecx,[Screen_Max_X] ; check x size |
572 | jbe x_size_ok |
572 | jbe x_size_ok |
573 | mov ecx,[Screen_Max_X] |
573 | mov ecx,[Screen_Max_X] |
574 | mov [edi+WDATA.box.width],ecx |
574 | mov [edi+WDATA.box.width],ecx |
575 | 575 | ||
576 | x_size_ok: |
576 | x_size_ok: |
577 | 577 | ||
578 | cmp edx,[Screen_Max_Y] ; check y size |
578 | cmp edx,[Screen_Max_Y] ; check y size |
579 | jbe y_size_ok |
579 | jbe y_size_ok |
580 | mov edx,[Screen_Max_Y] |
580 | mov edx,[Screen_Max_Y] |
581 | mov [edi+WDATA.box.height],edx |
581 | mov [edi+WDATA.box.height],edx |
582 | 582 | ||
583 | y_size_ok: |
583 | y_size_ok: |
584 | 584 | ||
585 | cmp eax,0 ; check x pos |
585 | cmp eax,0 ; check x pos |
586 | jnle @f |
586 | jnle @f |
587 | xor eax,eax |
587 | xor eax,eax |
588 | mov [edi+WDATA.box.left],eax |
588 | mov [edi+WDATA.box.left],eax |
589 | jmp x_pos_ok |
589 | jmp x_pos_ok |
590 | @@: |
590 | @@: |
591 | add eax,ecx |
591 | add eax,ecx |
592 | cmp eax,[Screen_Max_X] |
592 | cmp eax,[Screen_Max_X] |
593 | jbe x_pos_ok |
593 | jbe x_pos_ok |
594 | mov eax,[Screen_Max_X] |
594 | mov eax,[Screen_Max_X] |
595 | sub eax,ecx |
595 | sub eax,ecx |
596 | mov [edi+WDATA.box.left],eax |
596 | mov [edi+WDATA.box.left],eax |
597 | 597 | ||
598 | x_pos_ok: |
598 | x_pos_ok: |
599 | 599 | ||
600 | cmp ebx,0 ; check x pos |
600 | cmp ebx,0 ; check x pos |
601 | jnle @f |
601 | jnle @f |
602 | xor ebx,ebx |
602 | xor ebx,ebx |
603 | mov [edi+WDATA.box.top],ebx |
603 | mov [edi+WDATA.box.top],ebx |
604 | jmp y_pos_ok |
604 | jmp y_pos_ok |
605 | @@: |
605 | @@: |
606 | add ebx,edx |
606 | add ebx,edx |
607 | cmp ebx,[Screen_Max_Y] |
607 | cmp ebx,[Screen_Max_Y] |
608 | jbe y_pos_ok |
608 | jbe y_pos_ok |
609 | mov ebx,[Screen_Max_Y] |
609 | mov ebx,[Screen_Max_Y] |
610 | sub ebx,edx |
610 | sub ebx,edx |
611 | mov [edi+WDATA.box.top],ebx |
611 | mov [edi+WDATA.box.top],ebx |
612 | 612 | ||
613 | y_pos_ok: |
613 | y_pos_ok: |
614 | 614 | ||
615 | popad |
615 | popad |
616 | 616 | ||
617 | ret |
617 | ret |
618 | 618 | ||
619 | 619 | ||
620 | uglobal |
620 | uglobal |
621 | new_window_starting dd 0 |
621 | new_window_starting dd 0 |
622 | endg |
622 | endg |
623 | 623 | ||
624 | 624 | ||
625 | sys_window_mouse: |
625 | sys_window_mouse: |
626 | 626 | ||
627 | push eax |
627 | push eax |
628 | 628 | ||
629 | mov eax,[timer_ticks] |
629 | mov eax,[timer_ticks] |
630 | cmp [new_window_starting],eax |
630 | cmp [new_window_starting],eax |
631 | jb swml1 |
631 | jb swml1 |
632 | 632 | ||
633 | mov [MOUSE_BACKGROUND],byte 0 ; no mouse background |
633 | mov [MOUSE_BACKGROUND],byte 0 ; no mouse background |
634 | mov [DONT_DRAW_MOUSE],byte 0 ; draw mouse |
634 | mov [DONT_DRAW_MOUSE],byte 0 ; draw mouse |
635 | 635 | ||
636 | mov [new_window_starting],eax |
636 | mov [new_window_starting],eax |
637 | 637 | ||
638 | swml1: |
638 | swml1: |
639 | 639 | ||
640 | pop eax |
640 | pop eax |
641 | 641 | ||
642 | ret |
642 | ret |
643 | 643 | ||
644 | 644 | ||
645 | 645 | ||
646 | 646 | ||
647 | drawwindow_I_caption: |
647 | drawwindow_I_caption: |
648 | 648 | ||
649 | mov ecx,[edx+WDATA.cl_titlebar] ; grab bar |
649 | mov ecx,[edx+WDATA.cl_titlebar] ; grab bar |
650 | push ecx |
650 | push ecx |
651 | mov esi,edx |
651 | mov esi,edx |
652 | mov edx,[esi+WDATA.box.top] |
652 | mov edx,[esi+WDATA.box.top] |
653 | add edx,1 |
653 | add edx,1 |
654 | mov ebx,[esi+WDATA.box.top] |
654 | mov ebx,[esi+WDATA.box.top] |
655 | add ebx,21 |
655 | add ebx,21 |
656 | mov eax,[esi+WDATA.box.top] |
656 | mov eax,[esi+WDATA.box.top] |
657 | add eax,[esi+WDATA.box.height] |
657 | add eax,[esi+WDATA.box.height] |
658 | cmp ebx,eax |
658 | cmp ebx,eax |
659 | jb .wdsizeok |
659 | jb .wdsizeok |
660 | mov ebx,eax |
660 | mov ebx,eax |
661 | .wdsizeok: |
661 | .wdsizeok: |
662 | push ebx |
662 | push ebx |
663 | .drwi: |
663 | .drwi: |
664 | mov ebx,edx |
664 | mov ebx,edx |
665 | shl ebx,16 |
665 | shl ebx,16 |
666 | add ebx,edx |
666 | add ebx,edx |
667 | mov eax,[esi+WDATA.box.left] |
667 | mov eax,[esi+WDATA.box.left] |
668 | inc eax |
668 | inc eax |
669 | shl eax,16 |
669 | shl eax,16 |
670 | add eax,[esi+WDATA.box.left] |
670 | add eax,[esi+WDATA.box.left] |
671 | add eax,[esi+WDATA.box.width] |
671 | add eax,[esi+WDATA.box.width] |
672 | sub eax,1 |
672 | sub eax,1 |
673 | push edx |
673 | push edx |
674 | mov edx,0x80000000 |
674 | mov edx,0x80000000 |
675 | mov ecx,[esi+WDATA.cl_titlebar] |
675 | mov ecx,[esi+WDATA.cl_titlebar] |
676 | and ecx,edx |
676 | and ecx,edx |
677 | cmp ecx,edx |
677 | cmp ecx,edx |
678 | jnz .nofa |
678 | jnz .nofa |
679 | mov ecx,[esi+WDATA.cl_titlebar] |
679 | mov ecx,[esi+WDATA.cl_titlebar] |
680 | sub ecx,0x00040404 |
680 | sub ecx,0x00040404 |
681 | mov [esi+WDATA.cl_titlebar],ecx |
681 | mov [esi+WDATA.cl_titlebar],ecx |
682 | and ecx,0x00ffffff |
682 | and ecx,0x00ffffff |
683 | jmp .faj |
683 | jmp .faj |
684 | .nofa: |
684 | .nofa: |
685 | mov ecx,[esi+WDATA.cl_titlebar] |
685 | mov ecx,[esi+WDATA.cl_titlebar] |
686 | and ecx,0x00ffffff |
686 | and ecx,0x00ffffff |
687 | .faj: |
687 | .faj: |
688 | pop edx |
688 | pop edx |
689 | mov edi,0 |
689 | mov edi,0 |
690 | call [draw_line] |
690 | call [draw_line] |
691 | inc edx |
691 | inc edx |
692 | cmp edx,[esp] |
692 | cmp edx,[esp] |
693 | jb .drwi |
693 | jb .drwi |
694 | add esp,4 |
694 | add esp,4 |
695 | pop ecx |
695 | pop ecx |
696 | mov [esi+WDATA.cl_titlebar],ecx |
696 | mov [esi+WDATA.cl_titlebar],ecx |
697 | 697 | ||
698 | ret |
698 | ret |
699 | 699 | ||
700 | 700 | ||
701 | drawwindow_I: |
701 | drawwindow_I: |
702 | 702 | ||
703 | pushad |
703 | pushad |
704 | or [edx+WDATA.fl_wdrawn], 4 |
704 | or [edx+WDATA.fl_wdrawn], 4 |
705 | 705 | ||
706 | mov esi,[edx+WDATA.cl_frames] ; rectangle |
706 | mov esi,[edx+WDATA.cl_frames] ; rectangle |
707 | mov eax,[edx+WDATA.box.left] |
707 | mov eax,[edx+WDATA.box.left] |
708 | shl eax,16 |
708 | shl eax,16 |
709 | add eax,[edx+WDATA.box.left] |
709 | add eax,[edx+WDATA.box.left] |
710 | add eax,[edx+WDATA.box.width] |
710 | add eax,[edx+WDATA.box.width] |
711 | mov ebx,[edx+WDATA.box.top] |
711 | mov ebx,[edx+WDATA.box.top] |
712 | shl ebx,16 |
712 | shl ebx,16 |
713 | add ebx,[edx+WDATA.box.top] |
713 | add ebx,[edx+WDATA.box.top] |
714 | add ebx,[edx+WDATA.box.height] |
714 | add ebx,[edx+WDATA.box.height] |
715 | call draw_rectangle |
715 | call draw_rectangle |
716 | 716 | ||
717 | and [edx+WDATA.fl_wdrawn], not 4 |
717 | and [edx+WDATA.fl_wdrawn], not 4 |
718 | test [edx+WDATA.fl_wdrawn], 2 |
718 | test [edx+WDATA.fl_wdrawn], 2 |
719 | jz @f |
719 | jz @f |
720 | call drawwindowframes2 |
720 | call drawwindowframes2 |
721 | @@: |
721 | @@: |
722 | 722 | ||
723 | call drawwindow_I_caption |
723 | call drawwindow_I_caption |
724 | 724 | ||
725 | mov edx,[esi+WDATA.box.top] ; inside work area |
725 | mov edx,[esi+WDATA.box.top] ; inside work area |
726 | add edx,21+5 |
726 | add edx,21+5 |
727 | mov ebx,[esi+WDATA.box.top] |
727 | mov ebx,[esi+WDATA.box.top] |
728 | add ebx,[esi+WDATA.box.height] |
728 | add ebx,[esi+WDATA.box.height] |
729 | cmp edx,ebx |
729 | cmp edx,ebx |
730 | jg noinside |
730 | jg noinside |
731 | mov eax,1 |
731 | mov eax,1 |
732 | mov ebx,21 |
732 | mov ebx,21 |
733 | mov ecx,[esi+WDATA.box.width] |
733 | mov ecx,[esi+WDATA.box.width] |
734 | mov edx,[esi+WDATA.box.height] |
734 | mov edx,[esi+WDATA.box.height] |
735 | mov edi,[esi+WDATA.cl_workarea] |
735 | mov edi,[esi+WDATA.cl_workarea] |
736 | test edi,0x40000000 |
736 | test edi,0x40000000 |
737 | jnz noinside |
737 | jnz noinside |
738 | call [drawbar] |
738 | call [drawbar] |
739 | noinside: |
739 | noinside: |
740 | 740 | ||
741 | popad |
741 | popad |
742 | 742 | ||
743 | ret |
743 | ret |
744 | 744 | ||
745 | 745 | ||
746 | draw_rectangle: |
746 | draw_rectangle: |
747 | 747 | ||
748 | r_eax equ [esp+28] ; x start |
748 | r_eax equ [esp+28] ; x start |
749 | r_ax equ [esp+30] ; x end |
749 | r_ax equ [esp+30] ; x end |
750 | r_ebx equ [esp+16] ; y start |
750 | r_ebx equ [esp+16] ; y start |
751 | r_bx equ [esp+18] ; y end |
751 | r_bx equ [esp+18] ; y end |
752 | ;esi ; color |
752 | ;esi ; color |
753 | 753 | ||
754 | pushad |
754 | pushad |
755 | 755 | ||
756 | mov ecx,esi ; yb,xb -> yb,xe |
756 | mov ecx,esi ; yb,xb -> yb,xe |
757 | mov eax, r_eax |
757 | mov eax, r_eax |
758 | rol eax, 16 |
758 | rol eax, 16 |
759 | mov ebx,r_ebx |
759 | mov ebx,r_ebx |
760 | shl ebx,16 |
760 | shl ebx,16 |
761 | mov bx,r_ebx |
761 | mov bx,r_ebx |
762 | xor edi, edi |
762 | xor edi, edi |
763 | call [draw_line] |
763 | call [draw_line] |
764 | 764 | ||
765 | mov ebx,r_bx ; ye,xb -> ye,xe |
765 | mov ebx,r_bx ; ye,xb -> ye,xe |
766 | shl ebx,16 |
766 | shl ebx,16 |
767 | mov bx,r_bx |
767 | mov bx,r_bx |
768 | call [draw_line] |
768 | call [draw_line] |
769 | 769 | ||
770 | mov ecx,esi ; ya,xa -> ye,xa |
770 | mov ecx,esi ; ya,xa -> ye,xa |
771 | mov eax,r_eax |
771 | mov eax,r_eax |
772 | shl eax,16 |
772 | shl eax,16 |
773 | mov ax,r_eax |
773 | mov ax,r_eax |
774 | mov ebx,r_ebx |
774 | mov ebx,r_ebx |
775 | shl ebx,16 |
775 | shl ebx,16 |
776 | mov bx,r_bx |
776 | mov bx,r_bx |
777 | mov edi,0 |
777 | mov edi,0 |
778 | call [draw_line] |
778 | call [draw_line] |
779 | 779 | ||
780 | mov eax,r_ax ; ya,xe -> ye,xe |
780 | mov eax,r_ax ; ya,xe -> ye,xe |
781 | shl eax,16 |
781 | shl eax,16 |
782 | mov ax,r_ax |
782 | mov ax,r_ax |
783 | call [draw_line] |
783 | call [draw_line] |
784 | 784 | ||
785 | popad |
785 | popad |
786 | ret |
786 | ret |
787 | 787 | ||
788 | 788 | ||
789 | drawwindow_III_caption: |
789 | drawwindow_III_caption: |
790 | 790 | ||
791 | mov ecx,[edx+WDATA.cl_titlebar] ; GRAB BAR |
791 | mov ecx,[edx+WDATA.cl_titlebar] ; GRAB BAR |
792 | push ecx |
792 | push ecx |
793 | mov esi,edx |
793 | mov esi,edx |
794 | mov edx,[esi+WDATA.box.top] |
794 | mov edx,[esi+WDATA.box.top] |
795 | add edx,4 |
795 | add edx,4 |
796 | mov ebx,[esi+WDATA.box.top] |
796 | mov ebx,[esi+WDATA.box.top] |
797 | add ebx,20 |
797 | add ebx,20 |
798 | mov eax,[esi+WDATA.box.top] |
798 | mov eax,[esi+WDATA.box.top] |
799 | add eax,[esi+WDATA.box.height] |
799 | add eax,[esi+WDATA.box.height] |
800 | cmp ebx,eax |
800 | cmp ebx,eax |
801 | jb .wdsizeok |
801 | jb .wdsizeok |
802 | mov ebx,eax |
802 | mov ebx,eax |
803 | .wdsizeok: |
803 | .wdsizeok: |
804 | push ebx |
804 | push ebx |
805 | .drwi: |
805 | .drwi: |
806 | mov ebx,edx |
806 | mov ebx,edx |
807 | shl ebx,16 |
807 | shl ebx,16 |
808 | add ebx,edx |
808 | add ebx,edx |
809 | mov eax,[esi+WDATA.box.left] |
809 | mov eax,[esi+WDATA.box.left] |
810 | shl eax,16 |
810 | shl eax,16 |
811 | add eax,[esi+WDATA.box.left] |
811 | add eax,[esi+WDATA.box.left] |
812 | add eax,[esi+WDATA.box.width] |
812 | add eax,[esi+WDATA.box.width] |
813 | add eax,4*65536-4 |
813 | add eax,4*65536-4 |
814 | mov ecx,[esi+WDATA.cl_titlebar] |
814 | mov ecx,[esi+WDATA.cl_titlebar] |
815 | test ecx,0x40000000 |
815 | test ecx,0x40000000 |
816 | jz .nofa |
816 | jz .nofa |
817 | add ecx,0x040404 |
817 | add ecx,0x040404 |
818 | .nofa: |
818 | .nofa: |
819 | test ecx,0x80000000 |
819 | test ecx,0x80000000 |
820 | jz .nofa2 |
820 | jz .nofa2 |
821 | sub ecx,0x040404 |
821 | sub ecx,0x040404 |
822 | .nofa2: |
822 | .nofa2: |
823 | mov [esi+WDATA.cl_titlebar],ecx |
823 | mov [esi+WDATA.cl_titlebar],ecx |
824 | and ecx,0xffffff |
824 | and ecx,0xffffff |
825 | xor edi, edi |
825 | xor edi, edi |
826 | call [draw_line] |
826 | call [draw_line] |
827 | inc edx |
827 | inc edx |
828 | cmp edx,[esp] |
828 | cmp edx,[esp] |
829 | jb .drwi |
829 | jb .drwi |
830 | add esp,4 |
830 | add esp,4 |
831 | pop ecx |
831 | pop ecx |
832 | mov [esi+WDATA.cl_titlebar],ecx |
832 | mov [esi+WDATA.cl_titlebar],ecx |
833 | 833 | ||
834 | ret |
834 | ret |
835 | 835 | ||
836 | 836 | ||
837 | drawwindow_III: |
837 | drawwindow_III: |
838 | 838 | ||
839 | pushad |
839 | pushad |
840 | 840 | ||
841 | mov edi,edx ; RECTANGLE |
841 | mov edi,edx ; RECTANGLE |
842 | mov eax,[edi+WDATA.box.left] |
842 | mov eax,[edi+WDATA.box.left] |
843 | shl eax,16 |
843 | shl eax,16 |
844 | mov ax, word [edi+WDATA.box.left] |
844 | mov ax, word [edi+WDATA.box.left] |
845 | add ax, word [edi+WDATA.box.width] |
845 | add ax, word [edi+WDATA.box.width] |
846 | mov ebx,[edi+WDATA.box.top] |
846 | mov ebx,[edi+WDATA.box.top] |
847 | shl ebx,16 |
847 | shl ebx,16 |
848 | mov bx, word [edi+WDATA.box.top] |
848 | mov bx, word [edi+WDATA.box.top] |
849 | add bx, word [edi+WDATA.box.height] |
849 | add bx, word [edi+WDATA.box.height] |
850 | mov esi,[edi+WDATA.cl_frames] |
850 | mov esi,[edi+WDATA.cl_frames] |
851 | shr esi,1 |
851 | shr esi,1 |
852 | and esi,0x007f7f7f |
852 | and esi,0x007f7f7f |
853 | push esi |
853 | push esi |
854 | or [edi+WDATA.fl_wdrawn], 4 |
854 | or [edi+WDATA.fl_wdrawn], 4 |
855 | call draw_rectangle |
855 | call draw_rectangle |
856 | and [edi+WDATA.fl_wdrawn], not 4 |
856 | and [edi+WDATA.fl_wdrawn], not 4 |
857 | test [edi+WDATA.fl_wdrawn], 2 |
857 | test [edi+WDATA.fl_wdrawn], 2 |
858 | jz @f |
858 | jz @f |
859 | call drawwindowframes2 |
859 | call drawwindowframes2 |
860 | @@: |
860 | @@: |
861 | mov ecx,3 |
861 | mov ecx,3 |
862 | dw3l: |
862 | dw3l: |
863 | add eax,1*65536-1 |
863 | add eax,1*65536-1 |
864 | add ebx,1*65536-1 |
864 | add ebx,1*65536-1 |
865 | mov esi,[edi+WDATA.cl_frames] |
865 | mov esi,[edi+WDATA.cl_frames] |
866 | call draw_rectangle |
866 | call draw_rectangle |
867 | dec ecx |
867 | dec ecx |
868 | jnz dw3l |
868 | jnz dw3l |
869 | pop esi |
869 | pop esi |
870 | add eax,1*65536-1 |
870 | add eax,1*65536-1 |
871 | add ebx,1*65536-1 |
871 | add ebx,1*65536-1 |
872 | call draw_rectangle |
872 | call draw_rectangle |
873 | 873 | ||
874 | call drawwindow_III_caption |
874 | call drawwindow_III_caption |
875 | 875 | ||
876 | mov edx,[esi+WDATA.box.top] ; WORK AREA |
876 | mov edx,[esi+WDATA.box.top] ; WORK AREA |
877 | add edx,21+5 |
877 | add edx,21+5 |
878 | mov ebx,[esi+WDATA.box.top] |
878 | mov ebx,[esi+WDATA.box.top] |
879 | add ebx,[esi+WDATA.box.height] |
879 | add ebx,[esi+WDATA.box.height] |
880 | cmp edx,ebx |
880 | cmp edx,ebx |
881 | jg noinside2 |
881 | jg noinside2 |
882 | mov eax,5 |
882 | mov eax,5 |
883 | mov ebx,20 |
883 | mov ebx,20 |
884 | mov ecx,[esi+WDATA.box.width] |
884 | mov ecx,[esi+WDATA.box.width] |
885 | mov edx,[esi+WDATA.box.height] |
885 | mov edx,[esi+WDATA.box.height] |
886 | sub ecx,4 |
886 | sub ecx,4 |
887 | sub edx,4 |
887 | sub edx,4 |
888 | mov edi,[esi+WDATA.cl_workarea] |
888 | mov edi,[esi+WDATA.cl_workarea] |
889 | test edi,0x40000000 |
889 | test edi,0x40000000 |
890 | jnz noinside2 |
890 | jnz noinside2 |
891 | call [drawbar] |
891 | call [drawbar] |
892 | noinside2: |
892 | noinside2: |
893 | 893 | ||
894 | popad |
894 | popad |
895 | 895 | ||
896 | ret |
896 | ret |
897 | 897 | ||
898 | 898 | ||
899 | 899 | ||
900 | ; activate window |
900 | ; activate window |
901 | align 4 |
901 | align 4 |
902 | windowactivate: |
902 | windowactivate: |
903 | 903 | ||
904 | ; esi = abs mem position in stack 0xC400+ |
904 | ; esi = abs mem position in stack 0xC400+ |
905 | 905 | ||
906 | pushad |
906 | pushad |
907 | 907 | ||
908 | ; if type of current active window is 3, |
908 | ; if type of current active window is 3, |
909 | ; it must be redrawn |
909 | ; it must be redrawn |
910 | mov eax, [TASK_COUNT] |
910 | mov eax, [TASK_COUNT] |
911 | movzx eax, word [WIN_POS + eax*2] |
911 | movzx eax, word [WIN_POS + eax*2] |
912 | shl eax, 5 |
912 | shl eax, 5 |
913 | add eax, window_data |
913 | add eax, window_data |
914 | mov ebx, [eax + WDATA.cl_workarea] |
914 | mov ebx, [eax + WDATA.cl_workarea] |
915 | and ebx, 0x0f000000 |
915 | and ebx, 0x0f000000 |
916 | cmp ebx, 0x03000000 |
916 | cmp ebx, 0x03000000 |
917 | je .set_WDATA_fl_redraw ; for 3 and 4 style |
917 | je .set_WDATA_fl_redraw ; for 3 and 4 style |
918 | cmp ebx, 0x04000000 |
918 | cmp ebx, 0x04000000 |
919 | je .set_WDATA_fl_redraw |
919 | je .set_WDATA_fl_redraw |
920 | jmp @f |
920 | jmp @f |
921 | .set_WDATA_fl_redraw: |
921 | .set_WDATA_fl_redraw: |
922 | mov [eax + WDATA.fl_redraw], byte 1 |
922 | mov [eax + WDATA.fl_redraw], byte 1 |
923 | @@: |
923 | @@: |
924 | 924 | ||
925 | push esi |
925 | push esi |
926 | movzx eax, word [esi] ; ax <- process no |
926 | movzx eax, word [esi] ; ax <- process no |
927 | movzx eax, word [WIN_STACK+eax*2] ; ax <- position in window stack |
927 | movzx eax, word [WIN_STACK+eax*2] ; ax <- position in window stack |
928 | 928 | ||
929 | xor esi, esi ; drop others |
929 | xor esi, esi ; drop others |
930 | waloop: |
930 | waloop: |
931 | cmp esi, dword [TASK_COUNT] |
931 | cmp esi, dword [TASK_COUNT] |
932 | jae wacont |
932 | jae wacont |
933 | inc esi |
933 | inc esi |
934 | lea edi, [WIN_STACK + esi*2] |
934 | lea edi, [WIN_STACK + esi*2] |
935 | mov bx, [edi] ; position of the current process |
935 | mov bx, [edi] ; position of the current process |
936 | cmp bx, ax |
936 | cmp bx, ax |
937 | jbe @f |
937 | jbe @f |
938 | dec bx ; upper? => drop! |
938 | dec bx ; upper? => drop! |
939 | mov [edi], bx |
939 | mov [edi], bx |
940 | @@: |
940 | @@: |
941 | jmp waloop |
941 | jmp waloop |
942 | wacont: |
942 | wacont: |
943 | ; set to no 1 |
943 | ; set to no 1 |
944 | pop esi ; esi = pointer at 0xC400 |
944 | pop esi ; esi = pointer at 0xC400 |
945 | 945 | ||
946 | movzx eax, word [esi] |
946 | movzx eax, word [esi] |
947 | mov bx, [TASK_COUNT] ; number of processes |
947 | mov bx, [TASK_COUNT] ; number of processes |
948 | mov [WIN_STACK+eax*2], bx ; this is the last (and the upper) |
948 | mov [WIN_STACK+eax*2], bx ; this is the last (and the upper) |
949 | 949 | ||
950 | ; update on screen -window stack |
950 | ; update on screen -window stack |
951 | xor esi, esi |
951 | xor esi, esi |
952 | waloop2: |
952 | waloop2: |
953 | mov edi, [TASK_COUNT] |
953 | mov edi, [TASK_COUNT] |
954 | cmp esi, edi |
954 | cmp esi, edi |
955 | jae wacont2 |
955 | jae wacont2 |
956 | inc esi |
956 | inc esi |
957 | movzx ebx, word [esi*2 + WIN_STACK] |
957 | movzx ebx, word [esi*2 + WIN_STACK] |
958 | mov [ebx*2 + WIN_POS], si |
958 | mov [ebx*2 + WIN_POS], si |
959 | jmp waloop2 |
959 | jmp waloop2 |
960 | wacont2: |
960 | wacont2: |
961 | mov [KEY_COUNT], byte 0 ; empty keyboard buffer |
961 | mov [KEY_COUNT], byte 0 ; empty keyboard buffer |
962 | mov [BTN_COUNT], byte 0 ; empty button buffer |
962 | mov [BTN_COUNT], byte 0 ; empty button buffer |
963 | mov [MOUSE_SCROLL_H], word 0 ; zero mouse z-index |
963 | mov [MOUSE_SCROLL_H], word 0 ; zero mouse z-index |
964 | mov [MOUSE_SCROLL_V], word 0 ; zero mouse z-index |
964 | mov [MOUSE_SCROLL_V], word 0 ; zero mouse z-index |
965 | popad |
965 | popad |
966 | ret |
966 | ret |
967 | 967 | ||
968 | 968 | ||
969 | ; check if window is necessary to draw |
969 | ; check if window is necessary to draw |
970 | 970 | ||
971 | checkwindowdraw: |
971 | checkwindowdraw: |
972 | 972 | ||
973 | ; edi = position in window_data+ |
973 | ; edi = position in window_data+ |
974 | 974 | ||
975 | mov eax, [edi + WDATA.cl_workarea] |
975 | mov eax, [edi + WDATA.cl_workarea] |
976 | and eax, 0x0f000000 |
976 | and eax, 0x0f000000 |
977 | cmp eax, 0x03000000 |
977 | cmp eax, 0x03000000 |
978 | je .return_yes ; window type 3 |
978 | je .return_yes ; window type 3 |
979 | cmp eax, 0x04000000 |
979 | cmp eax, 0x04000000 |
980 | je .return_yes ; window type 4 |
980 | je .return_yes ; window type 4 |
981 | 981 | ||
982 | mov esi, edi |
982 | mov esi, edi |
983 | sub esi, window_data |
983 | sub esi, window_data |
984 | shr esi, 5 |
984 | shr esi, 5 |
985 | 985 | ||
986 | ; esi = process number |
986 | ; esi = process number |
987 | 987 | ||
988 | movzx eax, word [WIN_STACK + esi * 2] ; get value of the curr process |
988 | movzx eax, word [WIN_STACK + esi * 2] ; get value of the curr process |
989 | lea esi, [WIN_POS + eax * 2] ; get address of this process at 0xC400 |
989 | lea esi, [WIN_POS + eax * 2] ; get address of this process at 0xC400 |
990 | 990 | ||
991 | push esi |
991 | push esi |
992 | 992 | ||
993 | .new_check: |
993 | .new_check: |
994 | 994 | ||
995 | pop esi |
995 | pop esi |
996 | add esi, 2 |
996 | add esi, 2 |
997 | push esi |
997 | push esi |
998 | 998 | ||
999 | mov eax, [TASK_COUNT] |
999 | mov eax, [TASK_COUNT] |
1000 | lea eax, word [WIN_POS + eax * 2] ; number of the upper window |
1000 | lea eax, word [WIN_POS + eax * 2] ; number of the upper window |
1001 | 1001 | ||
1002 | cmp esi, eax |
1002 | cmp esi, eax |
1003 | ja .all_wnds_to_top |
1003 | ja .all_wnds_to_top |
1004 | 1004 | ||
1005 | movzx eax, word [esi] |
1005 | movzx eax, word [esi] |
1006 | shl eax, 5 |
1006 | shl eax, 5 |
1007 | cmp [CURRENT_TASK + eax + TASKDATA.state], byte 9 |
1007 | cmp [CURRENT_TASK + eax + TASKDATA.state], byte 9 |
1008 | je .new_check ; skip dead windows |
1008 | je .new_check ; skip dead windows |
1009 | 1009 | ||
1010 | lea esi, [eax+window_data] |
1010 | lea esi, [eax+window_data] |
1011 | 1011 | ||
1012 | mov ebx, [edi+WDATA.box.top] ; y0 |
1012 | mov ebx, [edi+WDATA.box.top] ; y0 |
1013 | mov edx, [edi+WDATA.box.height] |
1013 | mov edx, [edi+WDATA.box.height] |
1014 | add edx, ebx ; y0e |
1014 | add edx, ebx ; y0e |
1015 | 1015 | ||
1016 | mov ecx, [esi+WDATA.box.top] ; y ; y check |
1016 | mov ecx, [esi+WDATA.box.top] ; y ; y check |
1017 | cmp ecx, edx |
1017 | cmp ecx, edx |
1018 | jae .new_check ; y < y0e |
1018 | jae .new_check ; y < y0e |
1019 | mov eax, [esi+WDATA.box.height] |
1019 | mov eax, [esi+WDATA.box.height] |
1020 | add ecx, eax ; ye |
1020 | add ecx, eax ; ye |
1021 | cmp ebx, ecx ; y0 >= ye |
1021 | cmp ebx, ecx ; y0 >= ye |
1022 | ja .new_check |
1022 | ja .new_check |
1023 | 1023 | ||
1024 | mov eax, [edi+WDATA.box.left] ; x0 |
1024 | mov eax, [edi+WDATA.box.left] ; x0 |
1025 | mov ecx, [edi+WDATA.box.width] |
1025 | mov ecx, [edi+WDATA.box.width] |
1026 | add ecx, eax ; x0e |
1026 | add ecx, eax ; x0e |
1027 | 1027 | ||
1028 | mov edx, [esi+WDATA.box.left] ; x ; x check |
1028 | mov edx, [esi+WDATA.box.left] ; x ; x check |
1029 | cmp edx, ecx |
1029 | cmp edx, ecx |
1030 | jae .new_check ; x < x0e |
1030 | jae .new_check ; x < x0e |
1031 | mov ecx, [esi+WDATA.box.width] |
1031 | mov ecx, [esi+WDATA.box.width] |
1032 | add edx, ecx |
1032 | add edx, ecx |
1033 | cmp eax, edx |
1033 | cmp eax, edx |
1034 | ja .new_check |
1034 | ja .new_check |
1035 | 1035 | ||
1036 | pop esi |
1036 | pop esi |
1037 | .return_yes: |
1037 | .return_yes: |
1038 | mov ecx,1 ; overlap some window |
1038 | mov ecx,1 ; overlap some window |
1039 | ret |
1039 | ret |
1040 | 1040 | ||
1041 | .all_wnds_to_top: |
1041 | .all_wnds_to_top: |
1042 | 1042 | ||
1043 | pop esi |
1043 | pop esi |
1044 | 1044 | ||
1045 | xor ecx, ecx ; passed all windows to top |
1045 | xor ecx, ecx ; passed all windows to top |
1046 | ret |
1046 | ret |
1047 | 1047 | ||
1048 | 1048 | ||
1049 | 1049 | ||
1050 | 1050 | ||
1051 | waredraw: ; if redraw necessary at activate |
1051 | waredraw: ; if redraw necessary at activate |
1052 | 1052 | ||
1053 | pushad |
1053 | pushad |
1054 | 1054 | ||
1055 | call checkwindowdraw ; draw window on activation ? |
1055 | call checkwindowdraw ; draw window on activation ? |
1056 | test ecx, ecx |
1056 | test ecx, ecx |
1057 | jz .do_not_draw |
1057 | jz .do_not_draw |
1058 | 1058 | ||
1059 | popad |
1059 | popad |
1060 | mov [MOUSE_DOWN], byte 1 ; do draw mouse |
1060 | mov [MOUSE_DOWN], byte 1 ; do draw mouse |
1061 | call windowactivate |
1061 | call windowactivate |
1062 | 1062 | ||
1063 | ; update screen info |
1063 | ; update screen info |
1064 | pushad |
1064 | pushad |
1065 | mov edi, [TASK_COUNT] ; the last process (number) |
1065 | mov edi, [TASK_COUNT] ; the last process (number) |
1066 | movzx esi, word [WIN_POS + edi * 2] |
1066 | movzx esi, word [WIN_POS + edi * 2] |
1067 | shl esi, 5 |
1067 | shl esi, 5 |
1068 | add esi, window_data |
1068 | add esi, window_data |
1069 | 1069 | ||
1070 | ; coordinates of the upper window |
1070 | ; coordinates of the upper window |
1071 | mov eax, [esi + WDATA.box.left] ; cx |
1071 | mov eax, [esi + WDATA.box.left] ; cx |
1072 | mov ebx, [esi + WDATA.box.top] ; cy |
1072 | mov ebx, [esi + WDATA.box.top] ; cy |
1073 | mov ecx, [esi + WDATA.box.width] ; sx |
1073 | mov ecx, [esi + WDATA.box.width] ; sx |
1074 | mov edx, [esi + WDATA.box.height] ; sy |
1074 | mov edx, [esi + WDATA.box.height] ; sy |
1075 | 1075 | ||
1076 | add ecx, eax ; ecx = x_end |
1076 | add ecx, eax ; ecx = x_end |
1077 | add edx, ebx ; edx = y_end |
1077 | add edx, ebx ; edx = y_end |
1078 | 1078 | ||
1079 | mov edi, [TASK_COUNT] |
1079 | mov edi, [TASK_COUNT] |
1080 | movzx esi, word [WIN_POS + edi * 2] |
1080 | movzx esi, word [WIN_POS + edi * 2] |
1081 | call setscreen |
1081 | call setscreen |
1082 | popad |
1082 | popad |
1083 | 1083 | ||
1084 | mov [edi + WDATA.fl_redraw], 1 ; redraw flag for app |
1084 | mov [edi + WDATA.fl_redraw], 1 ; redraw flag for app |
1085 | mov [MOUSE_DOWN],byte 0 ; mouse down checks |
1085 | mov [MOUSE_DOWN],byte 0 ; mouse down checks |
1086 | 1086 | ||
1087 | ret |
1087 | ret |
1088 | 1088 | ||
1089 | .do_not_draw: |
1089 | .do_not_draw: |
1090 | 1090 | ||
1091 | popad |
1091 | popad |
1092 | 1092 | ||
1093 | call windowactivate |
1093 | call windowactivate |
1094 | mov [MOUSE_DOWN],byte 0 ; mouse down checks |
1094 | mov [MOUSE_DOWN],byte 0 ; mouse down checks |
1095 | mov [MOUSE_BACKGROUND],byte 0 ; no mouse background |
1095 | mov [MOUSE_BACKGROUND],byte 0 ; no mouse background |
1096 | mov [DONT_DRAW_MOUSE],byte 0 ; draw mouse |
1096 | mov [DONT_DRAW_MOUSE],byte 0 ; draw mouse |
1097 | ret |
1097 | ret |
1098 | 1098 | ||
1099 | 1099 | ||
1100 | ; eax = window number on screen |
1100 | ; eax = window number on screen |
1101 | ; corrupts registers and [dl*] |
1101 | ; corrupts registers and [dl*] |
1102 | minimize_window: |
1102 | minimize_window: |
1103 | movzx eax, word [WIN_POS+eax*2] |
1103 | movzx eax, word [WIN_POS+eax*2] |
1104 | shl eax, 5 |
1104 | shl eax, 5 |
1105 | add eax, window_data |
1105 | add eax, window_data |
1106 | test [eax+WDATA.fl_wstate], WSTATE_MINIMIZED |
1106 | test [eax+WDATA.fl_wstate], WSTATE_MINIMIZED |
1107 | jnz .skip_redrawings |
1107 | jnz .skip_redrawings |
1108 | pushfd |
1108 | pushfd |
1109 | cli |
1109 | cli |
1110 | or [eax+WDATA.fl_wstate], WSTATE_MINIMIZED |
1110 | or [eax+WDATA.fl_wstate], WSTATE_MINIMIZED |
1111 | mov edi, eax |
1111 | mov edi, eax |
1112 | ;call calculatescreen |
1112 | ;call calculatescreen |
1113 | mov eax, [edi+WDATA.box.left] |
1113 | mov eax, [edi+WDATA.box.left] |
1114 | mov [dlx], eax |
1114 | mov [dlx], eax |
1115 | mov ecx, eax |
1115 | mov ecx, eax |
1116 | add ecx, [edi+WDATA.box.width] |
1116 | add ecx, [edi+WDATA.box.width] |
1117 | mov [dlxe], ecx |
1117 | mov [dlxe], ecx |
1118 | mov ebx, [edi+WDATA.box.top] |
1118 | mov ebx, [edi+WDATA.box.top] |
1119 | mov [dly], ebx |
1119 | mov [dly], ebx |
1120 | mov edx, ebx |
1120 | mov edx, ebx |
1121 | add edx, [edi+WDATA.box.height] |
1121 | add edx, [edi+WDATA.box.height] |
1122 | mov [dlye], edx |
1122 | mov [dlye], edx |
1123 | call calculatescreen |
1123 | call calculatescreen |
1124 | xor esi, esi |
1124 | xor esi, esi |
1125 | xor eax, eax |
1125 | xor eax, eax |
1126 | call redrawscreen |
1126 | call redrawscreen |
1127 | popfd |
1127 | popfd |
1128 | .skip_redrawings: |
1128 | .skip_redrawings: |
1129 | ret |
1129 | ret |
1130 | 1130 | ||
1131 | ; eax = window number on screen |
1131 | ; eax = window number on screen |
1132 | ; corrupts registers and [dl*] |
1132 | ; corrupts registers and [dl*] |
1133 | restore_minimized_window: |
1133 | restore_minimized_window: |
1134 | pushfd |
1134 | pushfd |
1135 | cli |
1135 | cli |
1136 | movzx esi, word [WIN_POS+eax*2] |
1136 | movzx esi, word [WIN_POS+eax*2] |
1137 | mov edi, esi |
1137 | mov edi, esi |
1138 | shl edi, 5 |
1138 | shl edi, 5 |
1139 | add edi, window_data |
1139 | add edi, window_data |
1140 | test [edi+WDATA.fl_wstate], WSTATE_MINIMIZED |
1140 | test [edi+WDATA.fl_wstate], WSTATE_MINIMIZED |
1141 | jz .skip_redrawings |
1141 | jz .skip_redrawings |
1142 | mov [edi+WDATA.fl_redraw], 1 |
1142 | mov [edi+WDATA.fl_redraw], 1 |
1143 | and [edi+WDATA.fl_wstate], not WSTATE_MINIMIZED |
1143 | and [edi+WDATA.fl_wstate], not WSTATE_MINIMIZED |
1144 | cmp eax, [TASK_COUNT] ; the uppermost window |
1144 | cmp eax, [TASK_COUNT] ; the uppermost window |
1145 | jnz .no_uppermost |
1145 | jnz .no_uppermost |
1146 | mov eax, [edi+WDATA.box.left] |
1146 | mov eax, [edi+WDATA.box.left] |
1147 | mov ebx, [edi+WDATA.box.top] |
1147 | mov ebx, [edi+WDATA.box.top] |
1148 | mov ecx, eax |
1148 | mov ecx, eax |
1149 | mov edx, ebx |
1149 | mov edx, ebx |
1150 | add ecx, [edi+WDATA.box.width] |
1150 | add ecx, [edi+WDATA.box.width] |
1151 | add edx, [edi+WDATA.box.height] |
1151 | add edx, [edi+WDATA.box.height] |
1152 | call setscreen |
1152 | call setscreen |
1153 | jmp .done |
1153 | jmp .done |
1154 | .no_uppermost: |
1154 | .no_uppermost: |
1155 | mov eax, [edi+WDATA.box.left] |
1155 | mov eax, [edi+WDATA.box.left] |
1156 | mov ebx, [edi+WDATA.box.top] |
1156 | mov ebx, [edi+WDATA.box.top] |
1157 | mov ecx, eax |
1157 | mov ecx, eax |
1158 | mov edx, ebx |
1158 | mov edx, ebx |
1159 | add ecx, [edi+WDATA.box.width] |
1159 | add ecx, [edi+WDATA.box.width] |
1160 | add edx, [edi+WDATA.box.height] |
1160 | add edx, [edi+WDATA.box.height] |
1161 | call calculatescreen |
1161 | call calculatescreen |
1162 | .done: |
1162 | .done: |
1163 | mov [MOUSE_BACKGROUND],byte 0 ; no mouse under |
1163 | mov [MOUSE_BACKGROUND],byte 0 ; no mouse under |
1164 | .skip_redrawings: |
1164 | .skip_redrawings: |
1165 | popfd |
1165 | popfd |
1166 | ret |
1166 | ret |
1167 | 1167 | ||
1168 | 1168 | ||
1169 | ;iglobal |
1169 | ;iglobal |
1170 | ; window_moving db 'K : Window - move/resize',13,10,0 |
1170 | ; window_moving db 'K : Window - move/resize',13,10,0 |
1171 | ; window_moved db 'K : Window - done',13,10,0 |
1171 | ; window_moved db 'K : Window - done',13,10,0 |
1172 | ;endg |
1172 | ;endg |
1173 | 1173 | ||
1174 | ; check window touch |
1174 | ; check window touch |
1175 | align 4 |
1175 | align 4 |
1176 | checkwindows: |
1176 | checkwindows: |
1177 | pushad |
1177 | pushad |
1178 | 1178 | ||
1179 | cmp [window_minimize], 0 |
1179 | cmp [window_minimize], 0 |
1180 | je .no_minimizing |
1180 | je .no_minimizing |
1181 | mov eax, [TASK_COUNT] ; the uppermost window |
1181 | mov eax, [TASK_COUNT] ; the uppermost window |
1182 | mov bl, 0 |
1182 | mov bl, 0 |
1183 | xchg [window_minimize], bl |
1183 | xchg [window_minimize], bl |
1184 | cmp bl, 1 |
1184 | cmp bl, 1 |
1185 | jne .restore |
1185 | jne .restore |
1186 | call minimize_window |
1186 | call minimize_window |
1187 | jmp .continue |
1187 | jmp .continue |
1188 | .restore: |
1188 | .restore: |
1189 | call restore_minimized_window |
1189 | call restore_minimized_window |
1190 | .continue: |
1190 | .continue: |
1191 | .no_minimizing: |
1191 | .no_minimizing: |
1192 | 1192 | ||
1193 | cmp [BTN_DOWN],byte 0 ; mouse buttons pressed ? |
1193 | cmp [BTN_DOWN],byte 0 ; mouse buttons pressed ? |
1194 | jne .mouse_buttons_pressed |
1194 | jne .mouse_buttons_pressed |
1195 | ;..................................... start 1/4 : modified by vhanla ................. |
1195 | ;..................................... start 1/4 : modified by vhanla ................. |
1196 | mov [bPressedMouseXY_W],0 |
1196 | mov [bPressedMouseXY_W],0 |
1197 | ;..................................... end 1/4 : modified by vhanla ................... |
1197 | ;..................................... end 1/4 : modified by vhanla ................... |
1198 | popad |
1198 | popad |
1199 | ret |
1199 | ret |
1200 | .mouse_buttons_pressed: |
1200 | .mouse_buttons_pressed: |
1201 | ;..................................... start 2/4 : modified by vhanla ................. |
1201 | ;..................................... start 2/4 : modified by vhanla ................. |
1202 | uglobal |
1202 | uglobal |
1203 | bPressedMouseXY_W db 0x0 |
1203 | bPressedMouseXY_W db 0x0 |
1204 | endg |
1204 | endg |
1205 | ;..................................... end 2/4 : modified by vhanla ................... |
1205 | ;..................................... end 2/4 : modified by vhanla ................... |
1206 | mov esi,[TASK_COUNT] |
1206 | mov esi,[TASK_COUNT] |
1207 | inc esi |
1207 | inc esi |
1208 | 1208 | ||
1209 | ;..................................... start 3/4 : modified by vhanla ................. |
1209 | ;..................................... start 3/4 : modified by vhanla ................. |
1210 | cmp [bPressedMouseXY_W],1 |
1210 | cmp [bPressedMouseXY_W],1 |
1211 | ja @f |
1211 | ja @f |
1212 | inc [bPressedMouseXY_W] |
1212 | inc [bPressedMouseXY_W] |
1213 | jnc @f |
1213 | jnc @f |
1214 | ;mov ax,[MOUSE_X] |
1214 | ;mov ax,[MOUSE_X] |
1215 | ;mov [mx],ax |
1215 | ;mov [mx],ax |
1216 | ;mov ax,[MOUSE_Y] |
1216 | ;mov ax,[MOUSE_Y] |
1217 | ;mov [my],ax |
1217 | ;mov [my],ax |
1218 | mov eax,dword[MOUSE_X] |
1218 | mov eax,dword[MOUSE_X] |
1219 | mov dword[mx],eax |
1219 | mov dword[mx],eax |
1220 | @@: |
1220 | @@: |
1221 | ;..................................... end 3/4 : modified by vhanla ................... |
1221 | ;..................................... end 3/4 : modified by vhanla ................... |
1222 | 1222 | ||
1223 | cwloop: |
1223 | cwloop: |
1224 | cmp esi,2 |
1224 | cmp esi,2 |
1225 | jb .exit |
1225 | jb .exit |
1226 | 1226 | ||
1227 | dec esi |
1227 | dec esi |
1228 | movzx edi, word [WIN_POS + esi * 2] ; ebx |
1228 | movzx edi, word [WIN_POS + esi * 2] ; ebx |
1229 | shl edi, 5 |
1229 | shl edi, 5 |
1230 | add edi, window_data |
1230 | add edi, window_data |
1231 | ; mov edi, ebx |
1231 | ; mov edi, ebx |
1232 | mov ecx, [edi + WDATA.box.left] |
1232 | mov ecx, [edi + WDATA.box.left] |
1233 | mov edx, [edi + WDATA.box.top] |
1233 | mov edx, [edi + WDATA.box.top] |
1234 | 1234 | ||
1235 | mov eax,ecx |
1235 | mov eax,ecx |
1236 | mov ebx,edx |
1236 | mov ebx,edx |
1237 | test [edi+WDATA.fl_wstate],WSTATE_MINIMIZED |
1237 | test [edi+WDATA.fl_wstate],WSTATE_MINIMIZED |
1238 | jnz cwloop |
1238 | jnz cwloop |
1239 | 1239 | ||
1240 | ;..................................... start 4/4 : modified by vhanla ................. |
1240 | ;..................................... start 4/4 : modified by vhanla ................. |
1241 | movzx eax, word [mx]; movzx eax,word[MOUSE_X] |
1241 | movzx eax, word [mx]; movzx eax,word[MOUSE_X] |
1242 | movzx ebx, word [my]; movzx ebx,word[MOUSE_Y] |
1242 | movzx ebx, word [my]; movzx ebx,word[MOUSE_Y] |
1243 | ;..................................... endt 4/4 : modified by vhanla .................. |
1243 | ;..................................... endt 4/4 : modified by vhanla .................. |
1244 | cmp ecx, eax |
1244 | cmp ecx, eax |
1245 | jae cwloop |
1245 | jae cwloop |
1246 | cmp edx, ebx |
1246 | cmp edx, ebx |
1247 | jae cwloop |
1247 | jae cwloop |
1248 | add ecx, [edi + WDATA.box.width] |
1248 | add ecx, [edi + WDATA.box.width] |
1249 | add edx, [edi + WDATA.box.height] |
1249 | add edx, [edi + WDATA.box.height] |
1250 | cmp eax, ecx |
1250 | cmp eax, ecx |
1251 | jae cwloop |
1251 | jae cwloop |
1252 | cmp ebx, edx |
1252 | cmp ebx, edx |
1253 | jae cwloop |
1253 | jae cwloop |
1254 | 1254 | ||
1255 | pushad |
1255 | pushad |
1256 | mov eax, esi |
1256 | mov eax, esi |
1257 | mov ebx, [TASK_COUNT] |
1257 | mov ebx, [TASK_COUNT] |
1258 | cmp eax, ebx ; is this window active? |
1258 | cmp eax, ebx ; is this window active? |
1259 | jz .move_resize_window |
1259 | jz .move_resize_window |
1260 | 1260 | ||
1261 | cmp [bPressedMouseXY_W], 1 |
1261 | cmp [bPressedMouseXY_W], 1 |
1262 | ja .exit_popa |
1262 | ja .exit_popa |
1263 | 1263 | ||
1264 | ; eax = position in windowing stack |
1264 | ; eax = position in windowing stack |
1265 | ; redraw must ? |
1265 | ; redraw must ? |
1266 | lea esi, [WIN_POS + esi * 2] |
1266 | lea esi, [WIN_POS + esi * 2] |
1267 | call waredraw |
1267 | call waredraw |
1268 | .exit_popa: |
1268 | .exit_popa: |
1269 | add esp, 32 |
1269 | add esp, 32 |
1270 | 1270 | ||
1271 | .exit: |
1271 | .exit: |
1272 | popad |
1272 | popad |
1273 | ret |
1273 | ret |
1274 | 1274 | ||
1275 | .move_resize_window: ; MOVE OR RESIZE WINDOW |
1275 | .move_resize_window: ; MOVE OR RESIZE WINDOW |
1276 | popad |
1276 | popad |
1277 | 1277 | ||
1278 | ; Check for user enabled fixed window |
1278 | ; Check for user enabled fixed window |
1279 | mov edx, [edi + WDATA.cl_titlebar] |
1279 | mov edx, [edi + WDATA.cl_titlebar] |
1280 | and edx, 0x0f000000 |
1280 | and edx, 0x0f000000 |
1281 | cmp edx, 0x01000000 |
1281 | cmp edx, 0x01000000 |
1282 | jne .window_move_enabled_for_user |
1282 | jne .window_move_enabled_for_user |
1283 | popad |
1283 | popad |
1284 | ret |
1284 | ret |
1285 | .window_move_enabled_for_user: |
1285 | .window_move_enabled_for_user: |
1286 | 1286 | ||
1287 | test [edi+WDATA.fl_wstate],WSTATE_ROLLEDUP |
1287 | test [edi+WDATA.fl_wstate],WSTATE_ROLLEDUP |
1288 | jnz .no_resize_2 |
1288 | jnz .no_resize_2 |
1289 | 1289 | ||
1290 | mov [do_resize_from_corner],byte 0 ; resize for skinned window |
1290 | mov [do_resize_from_corner],byte 0 ; resize for skinned window |
1291 | mov edx, [edi + WDATA.cl_workarea] |
1291 | mov edx, [edi + WDATA.cl_workarea] |
1292 | and edx, 0x0f000000 |
1292 | and edx, 0x0f000000 |
1293 | cmp edx, 0x00000000 ;{test for resized} |
1293 | cmp edx, 0x00000000 ;{test for resized} |
1294 | je .no_resize_2 |
1294 | je .no_resize_2 |
1295 | cmp edx, 0x01000000 ;{test for resized} |
1295 | cmp edx, 0x01000000 ;{test for resized} |
1296 | je .no_resize_2 |
1296 | je .no_resize_2 |
1297 | cmp edx, 0x04000000 ;{test for resized} |
1297 | cmp edx, 0x04000000 ;{test for resized} |
1298 | je .no_resize_2 |
1298 | je .no_resize_2 |
1299 | ; jb .no_resize_2 ; not type 2 wnd |
1299 | ; jb .no_resize_2 ; not type 2 wnd |
1300 | 1300 | ||
1301 | mov edx, [edi + WDATA.box.top] |
1301 | mov edx, [edi + WDATA.box.top] |
1302 | add edx, [edi + WDATA.box.height] |
1302 | add edx, [edi + WDATA.box.height] |
1303 | sub edx, 6 ; edx = y_end - 6 |
1303 | sub edx, 6 ; edx = y_end - 6 |
1304 | cmp ebx, edx ; ebx = mouse_y |
1304 | cmp ebx, edx ; ebx = mouse_y |
1305 | jb .no_resize_2 |
1305 | jb .no_resize_2 |
1306 | mov [do_resize_from_corner],byte 1 |
1306 | mov [do_resize_from_corner],byte 1 |
1307 | jmp .continue |
1307 | jmp .continue |
1308 | .no_resize_2: |
1308 | .no_resize_2: |
1309 | 1309 | ||
1310 | push eax |
1310 | push eax |
1311 | call get_titlebar_height |
1311 | call get_titlebar_height |
1312 | add eax,[edi + WDATA.box.top] |
1312 | add eax,[edi + WDATA.box.top] |
1313 | cmp ebx,eax |
1313 | cmp ebx,eax |
1314 | pop eax |
1314 | pop eax |
1315 | jae .exit |
1315 | jae .exit |
1316 | 1316 | ||
1317 | .continue: |
1317 | .continue: |
1318 | 1318 | ||
1319 | ; push esi |
1319 | ; push esi |
1320 | ; mov esi, window_moving |
1320 | ; mov esi, window_moving |
1321 | ; call sys_msg_board_str |
1321 | ; call sys_msg_board_str |
1322 | ; pop esi |
1322 | ; pop esi |
1323 | 1323 | ||
1324 | mov ecx, [timer_ticks] ; double-click ? |
1324 | mov ecx, [timer_ticks] ; double-click ? |
1325 | mov edx, ecx |
1325 | mov edx, ecx |
1326 | sub edx, [latest_window_touch] |
1326 | sub edx, [latest_window_touch] |
1327 | mov [latest_window_touch], ecx |
1327 | mov [latest_window_touch], ecx |
1328 | mov [latest_window_touch_delta], edx |
1328 | mov [latest_window_touch_delta], edx |
1329 | 1329 | ||
1330 | mov cl, [BTN_DOWN] ; save for shade check |
1330 | mov cl, [BTN_DOWN] ; save for shade check |
1331 | mov [do_resize], cl |
1331 | mov [do_resize], cl |
1332 | no_emulation_righ_button: |
1332 | no_emulation_righ_button: |
1333 | mov ecx, [edi + WDATA.box.left] |
1333 | mov ecx, [edi + WDATA.box.left] |
1334 | mov edx, [edi + WDATA.box.top] |
1334 | mov edx, [edi + WDATA.box.top] |
1335 | 1335 | ||
1336 | push eax ecx edx |
1336 | push eax ecx edx |
1337 | mov [dlx], ecx ; save for drawlimits |
1337 | mov [dlx], ecx ; save for drawlimits |
1338 | mov [dly], edx |
1338 | mov [dly], edx |
1339 | mov eax, [edi + WDATA.box.width] |
1339 | mov eax, [edi + WDATA.box.width] |
1340 | add ecx, eax |
1340 | add ecx, eax |
1341 | mov eax, [edi + WDATA.box.height] |
1341 | mov eax, [edi + WDATA.box.height] |
1342 | add edx, eax |
1342 | add edx, eax |
1343 | mov [dlxe], ecx |
1343 | mov [dlxe], ecx |
1344 | mov [dlye], edx |
1344 | mov [dlye], edx |
1345 | pop edx ecx eax |
1345 | pop edx ecx eax |
1346 | 1346 | ||
1347 | sub eax, ecx |
1347 | sub eax, ecx |
1348 | sub ebx, edx |
1348 | sub ebx, edx |
1349 | 1349 | ||
1350 | mov esi, [MOUSE_X] |
1350 | mov esi, [MOUSE_X] |
1351 | mov [WIN_TEMP_XY], esi |
1351 | mov [WIN_TEMP_XY], esi |
1352 | 1352 | ||
1353 | pushad ; wait for putimages to finish |
1353 | pushad ; wait for putimages to finish |
1354 | ; mov ebx,5 |
1354 | ; mov ebx,5 |
1355 | ; call delay_hs |
1355 | ; call delay_hs |
1356 | mov eax,[edi + WDATA.box.left] |
1356 | mov eax,[edi + WDATA.box.left] |
1357 | mov [npx],eax |
1357 | mov [npx],eax |
1358 | mov eax,[edi + WDATA.box.top] |
1358 | mov eax,[edi + WDATA.box.top] |
1359 | mov [npy],eax |
1359 | mov [npy],eax |
1360 | popad |
1360 | popad |
1361 | 1361 | ||
1362 | push eax ; save old coordinates |
1362 | push eax ; save old coordinates |
1363 | mov ax, word [edi + WDATA.box.left] |
1363 | mov ax, word [edi + WDATA.box.left] |
1364 | mov word [oldc+BOX.left],ax |
1364 | mov word [oldc+BOX.left],ax |
1365 | mov ax, word [edi + WDATA.box.top] |
1365 | mov ax, word [edi + WDATA.box.top] |
1366 | mov word [oldc+BOX.top],ax |
1366 | mov word [oldc+BOX.top],ax |
1367 | mov ax, word [edi + WDATA.box.width] |
1367 | mov ax, word [edi + WDATA.box.width] |
1368 | mov word [oldc+BOX.width],ax |
1368 | mov word [oldc+BOX.width],ax |
1369 | mov word [npxe],ax |
1369 | mov word [npxe],ax |
1370 | mov ax, word [edi + WDATA.box.height] |
1370 | mov ax, word [edi + WDATA.box.height] |
1371 | mov word [oldc+BOX.height],ax |
1371 | mov word [oldc+BOX.height],ax |
1372 | mov word [npye],ax |
1372 | mov word [npye],ax |
1373 | pop eax |
1373 | pop eax |
1374 | 1374 | ||
1375 | call drawwindowframes |
1375 | call drawwindowframes |
1376 | 1376 | ||
1377 | mov [reposition],0 |
1377 | mov [reposition],0 |
1378 | mov [MOUSE_DOWN],byte 1 ; no reaction to mouse up/down |
1378 | mov [MOUSE_DOWN],byte 1 ; no reaction to mouse up/down |
1379 | 1379 | ||
1380 | ; move window |
1380 | ; move window |
1381 | 1381 | ||
1382 | newchm: |
1382 | newchm: |
1383 | 1383 | ||
1384 | mov [DONT_DRAW_MOUSE],byte 1 |
1384 | mov [DONT_DRAW_MOUSE],byte 1 |
1385 | 1385 | ||
1386 | call checkidle |
1386 | call checkidle |
1387 | 1387 | ||
1388 | call checkVga_N13 |
1388 | call checkVga_N13 |
1389 | 1389 | ||
1390 | mov [MOUSE_BACKGROUND],byte 0 |
1390 | mov [MOUSE_BACKGROUND],byte 0 |
1391 | 1391 | ||
1392 | call [draw_pointer] |
1392 | call [draw_pointer] |
1393 | 1393 | ||
1394 | pushad |
1394 | pushad |
1395 | call stack_handler |
1395 | call stack_handler |
1396 | popad |
1396 | popad |
1397 | 1397 | ||
1398 | mov esi,[WIN_TEMP_XY] |
1398 | mov esi,[WIN_TEMP_XY] |
1399 | cmp esi,[MOUSE_X] |
1399 | cmp esi,[MOUSE_X] |
1400 | je cwb |
1400 | je cwb |
1401 | 1401 | ||
1402 | mov cx,[MOUSE_X] |
1402 | mov cx,[MOUSE_X] |
1403 | mov dx,[MOUSE_Y] |
1403 | mov dx,[MOUSE_Y] |
1404 | sub cx,ax |
1404 | sub cx,ax |
1405 | sub dx,bx |
1405 | sub dx,bx |
1406 | 1406 | ||
1407 | push ax |
1407 | push ax |
1408 | push bx |
1408 | push bx |
1409 | 1409 | ||
1410 | call drawwindowframes |
1410 | call drawwindowframes |
1411 | 1411 | ||
1412 | mov ax,[Screen_Max_X] |
1412 | mov ax,[Screen_Max_X] |
1413 | mov bx,[Screen_Max_Y] |
1413 | mov bx,[Screen_Max_Y] |
1414 | 1414 | ||
1415 | cmp [do_resize_from_corner],1 |
1415 | cmp [do_resize_from_corner],1 |
1416 | je no_new_position |
1416 | je no_new_position |
1417 | 1417 | ||
1418 | mov word [npx],word 0 ; x repos ? |
1418 | mov word [npx],word 0 ; x repos ? |
1419 | cmp ax,cx |
1419 | cmp ax,cx |
1420 | jb noreposx |
1420 | jb noreposx |
1421 | mov [reposition],1 |
1421 | mov [reposition],1 |
1422 | sub ax,word [npxe] |
1422 | sub ax,word [npxe] |
1423 | mov word [npx],ax |
1423 | mov word [npx],ax |
1424 | cmp ax,cx |
1424 | cmp ax,cx |
1425 | jb noreposx |
1425 | jb noreposx |
1426 | mov word [npx],cx |
1426 | mov word [npx],cx |
1427 | noreposx: |
1427 | noreposx: |
1428 | 1428 | ||
1429 | mov word [npy],word 0 ; y repos ? |
1429 | mov word [npy],word 0 ; y repos ? |
1430 | cmp bx,dx |
1430 | cmp bx,dx |
1431 | jb noreposy |
1431 | jb noreposy |
1432 | mov [reposition],1 |
1432 | mov [reposition],1 |
1433 | sub bx,word [npye] |
1433 | sub bx,word [npye] |
1434 | mov word [npy],bx |
1434 | mov word [npy],bx |
1435 | cmp bx,dx |
1435 | cmp bx,dx |
1436 | jb noreposy |
1436 | jb noreposy |
1437 | mov word [npy],dx |
1437 | mov word [npy],dx |
1438 | noreposy: |
1438 | noreposy: |
1439 | 1439 | ||
1440 | no_new_position: |
1440 | no_new_position: |
1441 | 1441 | ||
1442 | cmp [do_resize_from_corner],0 ; resize from right corner |
1442 | cmp [do_resize_from_corner],0 ; resize from right corner |
1443 | je norepos_size |
1443 | je norepos_size |
1444 | pushad |
1444 | pushad |
1445 | 1445 | ||
1446 | mov edx,edi |
1446 | mov edx,edi |
1447 | sub edx,window_data |
1447 | sub edx,window_data |
1448 | ;shr edx,5 |
1448 | ;shr edx,5 |
1449 | ;shl edx,8 |
1449 | ;shl edx,8 |
1450 | ;add edx,0x80000 ; process base at 0x80000+ |
1450 | ;add edx,0x80000 ; process base at 0x80000+ |
1451 | lea edx, [SLOT_BASE + edx*8] |
1451 | lea edx, [SLOT_BASE + edx*8] |
1452 | 1452 | ||
1453 | movzx eax,word [MOUSE_X] |
1453 | movzx eax,word [MOUSE_X] |
1454 | cmp eax,[edi + WDATA.box.left] |
1454 | cmp eax,[edi + WDATA.box.left] |
1455 | jb nnepx |
1455 | jb nnepx |
1456 | sub eax,[edi + WDATA.box.left] |
1456 | sub eax,[edi + WDATA.box.left] |
1457 | cmp eax,32 ; [edx+0x90+8] |
1457 | cmp eax,32 ; [edx+0x90+8] |
1458 | jge nnepx2 |
1458 | jge nnepx2 |
1459 | mov eax,32 ; [edx+0x90+8] |
1459 | mov eax,32 ; [edx+0x90+8] |
1460 | nnepx2: |
1460 | nnepx2: |
1461 | mov [npxe],eax |
1461 | mov [npxe],eax |
1462 | nnepx: |
1462 | nnepx: |
1463 | 1463 | ||
1464 | call get_rolledup_height |
1464 | call get_rolledup_height |
1465 | mov ebx,eax |
1465 | mov ebx,eax |
1466 | movzx eax,word [MOUSE_Y] |
1466 | movzx eax,word [MOUSE_Y] |
1467 | cmp eax,[edi + WDATA.box.top] |
1467 | cmp eax,[edi + WDATA.box.top] |
1468 | jb nnepy |
1468 | jb nnepy |
1469 | sub eax,[edi + WDATA.box.top] |
1469 | sub eax,[edi + WDATA.box.top] |
1470 | cmp eax,ebx ; [edx+0x90+12] |
1470 | cmp eax,ebx ; [edx+0x90+12] |
1471 | jge nnepy2 |
1471 | jge nnepy2 |
1472 | mov eax,ebx ; [edx+0x90+12] |
1472 | mov eax,ebx ; [edx+0x90+12] |
1473 | nnepy2: |
1473 | nnepy2: |
1474 | mov [npye],eax |
1474 | mov [npye],eax |
1475 | nnepy: |
1475 | nnepy: |
1476 | 1476 | ||
1477 | mov [reposition],1 |
1477 | mov [reposition],1 |
1478 | 1478 | ||
1479 | popad |
1479 | popad |
1480 | norepos_size: |
1480 | norepos_size: |
1481 | 1481 | ||
1482 | pop bx |
1482 | pop bx |
1483 | pop ax |
1483 | pop ax |
1484 | call drawwindowframes |
1484 | call drawwindowframes |
1485 | 1485 | ||
1486 | mov esi,[MOUSE_X] |
1486 | mov esi,[MOUSE_X] |
1487 | mov [WIN_TEMP_XY],esi |
1487 | mov [WIN_TEMP_XY],esi |
1488 | 1488 | ||
1489 | cwb: |
1489 | cwb: |
1490 | cmp [BTN_DOWN],byte 0 |
1490 | cmp [BTN_DOWN],byte 0 |
1491 | jne newchm |
1491 | jne newchm |
1492 | ; new position done |
1492 | ; new position done |
1493 | mov [DONT_DRAW_MOUSE],byte 1 |
1493 | mov [DONT_DRAW_MOUSE],byte 1 |
1494 | mov cl,0 |
1494 | mov cl,0 |
1495 | test [edi+WDATA.fl_wstate],WSTATE_MAXIMIZED |
1495 | test [edi+WDATA.fl_wstate],WSTATE_MAXIMIZED |
1496 | jnz @f |
1496 | jnz @f |
1497 | mov cl,[reposition] |
1497 | mov cl,[reposition] |
1498 | call drawwindowframes |
1498 | call drawwindowframes |
1499 | 1499 | ||
1500 | mov eax,[npx] |
1500 | mov eax,[npx] |
1501 | mov [edi + WDATA.box.left],eax |
1501 | mov [edi + WDATA.box.left],eax |
1502 | mov eax,[npy] |
1502 | mov eax,[npy] |
1503 | mov [edi + WDATA.box.top],eax |
1503 | mov [edi + WDATA.box.top],eax |
1504 | mov eax,[npxe] |
1504 | mov eax,[npxe] |
1505 | mov [edi + WDATA.box.width],eax |
1505 | mov [edi + WDATA.box.width],eax |
1506 | mov eax,[npye] |
1506 | mov eax,[npye] |
1507 | mov [edi + WDATA.box.height],eax |
1507 | mov [edi + WDATA.box.height],eax |
1508 | call set_window_clientbox |
1508 | call set_window_clientbox |
1509 | 1509 | ||
1510 | @@: mov [reposition],cl |
1510 | @@: mov [reposition],cl |
1511 | 1511 | ||
1512 | cmp [reposition],1 ; save new position and size |
1512 | cmp [reposition],1 ; save new position and size |
1513 | jne no_bounds_save |
1513 | jne no_bounds_save |
1514 | push esi edi ecx |
1514 | push esi edi ecx |
1515 | mov esi,edi |
1515 | mov esi,edi |
1516 | mov ecx,2 |
1516 | mov ecx,2 |
1517 | test [edi+WDATA.fl_wstate],WSTATE_ROLLEDUP or WSTATE_MAXIMIZED |
1517 | test [edi+WDATA.fl_wstate],WSTATE_ROLLEDUP or WSTATE_MAXIMIZED |
1518 | jnz @f |
1518 | jnz @f |
1519 | add ecx,2 |
1519 | add ecx,2 |
1520 | @@: sub edi,window_data |
1520 | @@: sub edi,window_data |
1521 | shr edi,5 |
1521 | shr edi,5 |
1522 | shl edi,8 |
1522 | shl edi,8 |
1523 | add edi,SLOT_BASE+APPDATA.saved_box |
1523 | add edi,SLOT_BASE+APPDATA.saved_box |
1524 | cld |
1524 | cld |
1525 | rep movsd |
1525 | rep movsd |
1526 | pop ecx edi esi |
1526 | pop ecx edi esi |
1527 | no_bounds_save: |
1527 | no_bounds_save: |
1528 | 1528 | ||
1529 | pushad ; WINDOW SHADE/FULLSCREEN |
1529 | pushad ; WINDOW SHADE/FULLSCREEN |
1530 | 1530 | ||
1531 | ;{doule click not worked for 4 type window} |
1531 | ;{doule click not worked for 4 type window} |
1532 | mov edx, [edi + WDATA.cl_workarea] |
1532 | mov edx, [edi + WDATA.cl_workarea] |
1533 | and edx, 0x0f000000 |
1533 | and edx, 0x0f000000 |
1534 | cmp edx, 0x00000000 |
1534 | cmp edx, 0x00000000 |
1535 | je no_fullscreen_restore |
1535 | je no_fullscreen_restore |
1536 | cmp edx, 0x01000000 |
1536 | cmp edx, 0x01000000 |
1537 | je no_fullscreen_restore |
1537 | je no_fullscreen_restore |
1538 | 1538 | ||
1539 | cmp [reposition],1 |
1539 | cmp [reposition],1 |
1540 | je no_window_sizing |
1540 | je no_window_sizing |
1541 | mov edx,edi |
1541 | mov edx,edi |
1542 | sub edx,window_data |
1542 | sub edx,window_data |
1543 | shr edx,5 |
1543 | shr edx,5 |
1544 | shl edx,8 |
1544 | shl edx,8 |
1545 | add edx,SLOT_BASE ; process base at 0x80000+ |
1545 | add edx,SLOT_BASE ; process base at 0x80000+ |
1546 | 1546 | ||
1547 | cmp [do_resize],2 ; window shade ? |
1547 | cmp [do_resize],2 ; window shade ? |
1548 | jne no_window_shade |
1548 | jne no_window_shade |
1549 | mov [reposition],1 |
1549 | mov [reposition],1 |
1550 | 1550 | ||
1551 | test [edi+WDATA.fl_wstate],WSTATE_ROLLEDUP |
1551 | test [edi+WDATA.fl_wstate],WSTATE_ROLLEDUP |
1552 | jnz wnd_rolldown |
1552 | jnz wnd_rolldown |
1553 | wnd_rollup: |
1553 | wnd_rollup: |
1554 | or [edi+WDATA.fl_wstate],WSTATE_ROLLEDUP |
1554 | or [edi+WDATA.fl_wstate],WSTATE_ROLLEDUP |
1555 | call get_rolledup_height |
1555 | call get_rolledup_height |
1556 | jmp @f |
1556 | jmp @f |
1557 | wnd_rolldown: |
1557 | wnd_rolldown: |
1558 | and [edi+WDATA.fl_wstate],not WSTATE_ROLLEDUP |
1558 | and [edi+WDATA.fl_wstate],not WSTATE_ROLLEDUP |
1559 | mov eax,[edx + APPDATA.saved_box.height] ; 0x90+BOX.height |
1559 | mov eax,[edx + APPDATA.saved_box.height] ; 0x90+BOX.height |
1560 | test [edi+WDATA.fl_wstate],WSTATE_MAXIMIZED |
1560 | test [edi+WDATA.fl_wstate],WSTATE_MAXIMIZED |
1561 | jz @f |
1561 | jz @f |
1562 | mov eax,[screen_workarea.bottom] |
1562 | mov eax,[screen_workarea.bottom] |
1563 | sub eax,[screen_workarea.top] |
1563 | sub eax,[screen_workarea.top] |
1564 | @@: mov [edi+WDATA.box.height],eax |
1564 | @@: mov [edi+WDATA.box.height],eax |
1565 | add eax, [edi+WDATA.box.top] |
1565 | add eax, [edi+WDATA.box.top] |
1566 | cmp eax, [Screen_Max_Y] |
1566 | cmp eax, [Screen_Max_Y] |
1567 | jbe @f |
1567 | jbe @f |
1568 | mov eax, [Screen_Max_Y] |
1568 | mov eax, [Screen_Max_Y] |
1569 | sub eax, [edi+WDATA.box.height] |
1569 | sub eax, [edi+WDATA.box.height] |
1570 | mov [edi+WDATA.box.top], eax |
1570 | mov [edi+WDATA.box.top], eax |
1571 | @@: call check_window_position |
1571 | @@: call check_window_position |
1572 | call set_window_clientbox |
1572 | call set_window_clientbox |
1573 | 1573 | ||
1574 | no_window_shade: |
1574 | no_window_shade: |
1575 | 1575 | ||
1576 | push edx |
1576 | push edx |
1577 | mov edx, [edi + WDATA.cl_workarea] |
1577 | mov edx, [edi + WDATA.cl_workarea] |
1578 | and edx, 0x0f000000 |
1578 | and edx, 0x0f000000 |
1579 | cmp edx, 0x04000000 |
1579 | cmp edx, 0x04000000 |
1580 | pop edx |
1580 | pop edx |
1581 | je no_fullscreen_restore |
1581 | je no_fullscreen_restore |
1582 | 1582 | ||
1583 | cmp [do_resize],1 ; fullscreen/restore ? |
1583 | cmp [do_resize],1 ; fullscreen/restore ? |
1584 | jne no_fullscreen_restore |
1584 | jne no_fullscreen_restore |
1585 | cmp [latest_window_touch_delta],dword 50 |
1585 | cmp [latest_window_touch_delta],dword 50 |
1586 | jg no_fullscreen_restore |
1586 | jg no_fullscreen_restore |
1587 | mov [reposition],1 |
1587 | mov [reposition],1 |
1588 | test [edi+WDATA.fl_wstate],WSTATE_MAXIMIZED |
1588 | test [edi+WDATA.fl_wstate],WSTATE_MAXIMIZED |
1589 | jnz restore_from_fullscreen |
1589 | jnz restore_from_fullscreen |
1590 | or [edi+WDATA.fl_wstate],WSTATE_MAXIMIZED |
1590 | or [edi+WDATA.fl_wstate],WSTATE_MAXIMIZED |
1591 | mov eax,[screen_workarea.left] |
1591 | mov eax,[screen_workarea.left] |
1592 | mov [edi+WDATA.box.left],eax |
1592 | mov [edi+WDATA.box.left],eax |
1593 | sub eax,[screen_workarea.right] |
1593 | sub eax,[screen_workarea.right] |
1594 | neg eax |
1594 | neg eax |
1595 | mov [edi+WDATA.box.width],eax |
1595 | mov [edi+WDATA.box.width],eax |
1596 | mov eax,[screen_workarea.top] |
1596 | mov eax,[screen_workarea.top] |
1597 | mov [edi+WDATA.box.top],eax |
1597 | mov [edi+WDATA.box.top],eax |
1598 | test [edi+WDATA.fl_wstate],WSTATE_ROLLEDUP |
1598 | test [edi+WDATA.fl_wstate],WSTATE_ROLLEDUP |
1599 | jnz @f |
1599 | jnz @f |
1600 | sub eax,[screen_workarea.bottom] |
1600 | sub eax,[screen_workarea.bottom] |
1601 | neg eax |
1601 | neg eax |
1602 | mov [edi+WDATA.box.height],eax |
1602 | mov [edi+WDATA.box.height],eax |
1603 | @@: |
1603 | @@: |
1604 | jmp restore_from_fullscreen.clientbox |
1604 | jmp restore_from_fullscreen.clientbox |
1605 | restore_from_fullscreen: |
1605 | restore_from_fullscreen: |
1606 | and [edi+WDATA.fl_wstate],not WSTATE_MAXIMIZED |
1606 | and [edi+WDATA.fl_wstate],not WSTATE_MAXIMIZED |
1607 | push [edi+WDATA.box.height] |
1607 | push [edi+WDATA.box.height] |
1608 | push edi ; restore |
1608 | push edi ; restore |
1609 | lea esi, [edx + APPDATA.saved_box] |
1609 | lea esi, [edx + APPDATA.saved_box] |
1610 | mov ecx,4 |
1610 | mov ecx,4 |
1611 | cld |
1611 | cld |
1612 | rep movsd |
1612 | rep movsd |
1613 | pop edi |
1613 | pop edi |
1614 | pop eax |
1614 | pop eax |
1615 | test [edi+WDATA.fl_wstate],WSTATE_ROLLEDUP |
1615 | test [edi+WDATA.fl_wstate],WSTATE_ROLLEDUP |
1616 | jz @f |
1616 | jz @f |
1617 | mov [edi+WDATA.box.height],eax |
1617 | mov [edi+WDATA.box.height],eax |
1618 | @@: |
1618 | @@: |
1619 | .clientbox: |
1619 | .clientbox: |
1620 | call set_window_clientbox |
1620 | call set_window_clientbox |
1621 | 1621 | ||
1622 | no_fullscreen_restore: |
1622 | no_fullscreen_restore: |
1623 | 1623 | ||
1624 | mov eax,[edi+WDATA.box.top] ; check Y inside screen |
1624 | mov eax,[edi+WDATA.box.top] ; check Y inside screen |
1625 | add eax,[edi+WDATA.box.height] |
1625 | add eax,[edi+WDATA.box.height] |
1626 | cmp eax,[Screen_Max_Y] |
1626 | cmp eax,[Screen_Max_Y] |
1627 | jbe no_window_sizing |
1627 | jbe no_window_sizing |
1628 | mov eax,[edi+WDATA.box.left] ; check X inside screen |
1628 | mov eax,[edi+WDATA.box.left] ; check X inside screen |
1629 | add eax,[edi+WDATA.box.width] |
1629 | add eax,[edi+WDATA.box.width] |
1630 | cmp eax,[Screen_Max_X] |
1630 | cmp eax,[Screen_Max_X] |
1631 | jbe no_window_sizing |
1631 | jbe no_window_sizing |
1632 | mov eax,[Screen_Max_X] |
1632 | mov eax,[Screen_Max_X] |
1633 | sub eax,[edi+WDATA.box.width] |
1633 | sub eax,[edi+WDATA.box.width] |
1634 | mov [edi+WDATA.box.left],eax |
1634 | mov [edi+WDATA.box.left],eax |
1635 | mov eax,[Screen_Max_Y] |
1635 | mov eax,[Screen_Max_Y] |
1636 | sub eax,[edi+WDATA.box.height] |
1636 | sub eax,[edi+WDATA.box.height] |
1637 | mov [edi+WDATA.box.top],eax |
1637 | mov [edi+WDATA.box.top],eax |
1638 | call set_window_clientbox |
1638 | call set_window_clientbox |
1639 | no_window_sizing: |
1639 | no_window_sizing: |
1640 | 1640 | ||
1641 | popad |
1641 | popad |
1642 | 1642 | ||
1643 | cmp [reposition],0 |
1643 | cmp [reposition],0 |
1644 | je retwm |
1644 | je retwm |
1645 | 1645 | ||
1646 | mov [DONT_DRAW_MOUSE],byte 1 ; no mouse |
1646 | mov [DONT_DRAW_MOUSE],byte 1 ; no mouse |
1647 | 1647 | ||
1648 | 1648 | ||
1649 | push eax ebx ecx edx |
1649 | push eax ebx ecx edx |
1650 | mov eax,[edi+WDATA.box.left] |
1650 | mov eax,[edi+WDATA.box.left] |
1651 | mov ebx,[edi+WDATA.box.top] |
1651 | mov ebx,[edi+WDATA.box.top] |
1652 | mov ecx,[edi+WDATA.box.width] |
1652 | mov ecx,[edi+WDATA.box.width] |
1653 | mov edx,[edi+WDATA.box.height] |
1653 | mov edx,[edi+WDATA.box.height] |
1654 | add ecx,eax |
1654 | add ecx,eax |
1655 | add edx,ebx |
1655 | add edx,ebx |
1656 | call calculatescreen |
1656 | call calculatescreen |
1657 | 1657 | ||
1658 | mov eax,[oldc+BOX.left] |
1658 | mov eax,[oldc+BOX.left] |
1659 | mov ebx,[oldc+BOX.top] |
1659 | mov ebx,[oldc+BOX.top] |
1660 | mov ecx,[oldc+BOX.width] |
1660 | mov ecx,[oldc+BOX.width] |
1661 | mov edx,[oldc+BOX.height] |
1661 | mov edx,[oldc+BOX.height] |
1662 | add ecx,eax |
1662 | add ecx,eax |
1663 | add edx,ebx |
1663 | add edx,ebx |
1664 | call calculatescreen |
1664 | call calculatescreen |
1665 | pop edx ecx ebx eax |
1665 | pop edx ecx ebx eax |
1666 | 1666 | ||
1667 | mov eax,edi |
1667 | mov eax,edi |
1668 | call redrawscreen |
1668 | call redrawscreen |
1669 | 1669 | ||
1670 | 1670 | ||
1671 | mov [edi+WDATA.fl_redraw],1 |
1671 | mov [edi+WDATA.fl_redraw],1 |
1672 | 1672 | ||
1673 | mov ecx,100 ; wait to avoid mouse residuals |
1673 | mov ecx,100 ; wait to avoid mouse residuals |
1674 | waitre2: |
1674 | waitre2: |
1675 | mov [DONT_DRAW_MOUSE],byte 1 |
1675 | mov [DONT_DRAW_MOUSE],byte 1 |
1676 | call checkidle |
1676 | call checkidle |
1677 | cmp [edi+WDATA.fl_redraw],0 |
1677 | cmp [edi+WDATA.fl_redraw],0 |
1678 | jz retwm |
1678 | jz retwm |
1679 | loop waitre2 |
1679 | loop waitre2 |
1680 | 1680 | ||
1681 | retwm: |
1681 | retwm: |
1682 | 1682 | ||
1683 | mov [DONT_DRAW_MOUSE],byte 0 ; mouse pointer |
1683 | mov [DONT_DRAW_MOUSE],byte 0 ; mouse pointer |
1684 | mov [MOUSE_BACKGROUND],byte 0 ; no mouse under |
1684 | mov [MOUSE_BACKGROUND],byte 0 ; no mouse under |
1685 | mov [MOUSE_DOWN],byte 0 ; react to mouse up/down |
1685 | mov [MOUSE_DOWN],byte 0 ; react to mouse up/down |
1686 | 1686 | ||
1687 | ; mov esi,window_moved |
1687 | ; mov esi,window_moved |
1688 | ; call sys_msg_board_str |
1688 | ; call sys_msg_board_str |
1689 | 1689 | ||
1690 | popad |
1690 | popad |
1691 | 1691 | ||
1692 | ret |
1692 | ret |
1693 | 1693 | ||
1694 | 1694 | ||
1695 | uglobal |
1695 | uglobal |
1696 | add_window_data dd 0 |
1696 | add_window_data dd 0 |
1697 | do_resize_from_corner db 0x0 |
1697 | do_resize_from_corner db 0x0 |
1698 | reposition db 0x0 |
1698 | reposition db 0x0 |
1699 | latest_window_touch dd 0x0 |
1699 | latest_window_touch dd 0x0 |
1700 | latest_window_touch_delta dd 0x0 |
1700 | latest_window_touch_delta dd 0x0 |
1701 | 1701 | ||
1702 | do_resize db 0x0 |
1702 | do_resize db 0x0 |
1703 | 1703 | ||
1704 | oldc dd 0x0,0x0,0x0,0x0 |
1704 | oldc dd 0x0,0x0,0x0,0x0 |
1705 | 1705 | ||
1706 | dlx dd 0x0 |
1706 | dlx dd 0x0 |
1707 | dly dd 0x0 |
1707 | dly dd 0x0 |
1708 | dlxe dd 0x0 |
1708 | dlxe dd 0x0 |
1709 | dlye dd 0x0 |
1709 | dlye dd 0x0 |
1710 | 1710 | ||
1711 | npx dd 0x0 |
1711 | npx dd 0x0 |
1712 | npy dd 0x0 |
1712 | npy dd 0x0 |
1713 | npxe dd 0x0 |
1713 | npxe dd 0x0 |
1714 | npye dd 0x0 |
1714 | npye dd 0x0 |
1715 | 1715 | ||
1716 | mpx dd 0x0 |
1716 | mpx dd 0x0 |
1717 | mpy dd 0x0 |
1717 | mpy dd 0x0 |
1718 | endg |
1718 | endg |
1719 | 1719 | ||
1720 | 1720 | ||
1721 | ; draw negative window frames |
1721 | ; draw negative window frames |
1722 | drawwindowframes2: |
1722 | drawwindowframes2: |
1723 | pushad |
1723 | pushad |
1724 | cli |
1724 | cli |
1725 | jmp drawwindowframes.do |
1725 | jmp drawwindowframes.do |
1726 | drawwindowframes: |
1726 | drawwindowframes: |
1727 | pushad |
1727 | pushad |
1728 | cli |
1728 | cli |
1729 | 1729 | ||
1730 | test [edi+WDATA.fl_wstate],WSTATE_MAXIMIZED |
1730 | test [edi+WDATA.fl_wstate],WSTATE_MAXIMIZED |
1731 | jnz .ret |
1731 | jnz .ret |
1732 | mov eax, [npx] |
1732 | mov eax, [npx] |
1733 | cmp eax, [edi+WDATA.box.left] |
1733 | cmp eax, [edi+WDATA.box.left] |
1734 | jnz .nowndframe |
1734 | jnz .nowndframe |
1735 | mov eax, [npxe] |
1735 | mov eax, [npxe] |
1736 | cmp eax, [edi+WDATA.box.width] |
1736 | cmp eax, [edi+WDATA.box.width] |
1737 | jnz .nowndframe |
1737 | jnz .nowndframe |
1738 | mov eax, [npy] |
1738 | mov eax, [npy] |
1739 | cmp eax, [edi+WDATA.box.top] |
1739 | cmp eax, [edi+WDATA.box.top] |
1740 | jnz .nowndframe |
1740 | jnz .nowndframe |
1741 | mov eax, [npye] |
1741 | mov eax, [npye] |
1742 | cmp eax, [edi+WDATA.box.height] |
1742 | cmp eax, [edi+WDATA.box.height] |
1743 | jnz .nowndframe |
1743 | jnz .nowndframe |
1744 | xor [edi+WDATA.fl_wdrawn], 2 |
1744 | xor [edi+WDATA.fl_wdrawn], 2 |
1745 | test [edi+WDATA.fl_wdrawn], 4 |
1745 | test [edi+WDATA.fl_wdrawn], 4 |
1746 | jnz .ret |
1746 | jnz .ret |
1747 | 1747 | ||
1748 | .nowndframe: |
1748 | .nowndframe: |
1749 | .do: |
1749 | .do: |
1750 | mov edi, 1 |
1750 | mov edi, 1 |
1751 | mov ecx, 0x01000000 |
1751 | mov ecx, 0x01000000 |
1752 | mov eax,[npx] |
1752 | mov eax,[npx] |
1753 | shl eax,16 |
1753 | shl eax,16 |
1754 | add eax,[npx] |
1754 | add eax,[npx] |
1755 | add eax,[npxe] |
1755 | add eax,[npxe] |
1756 | add eax,65536*1-1 |
1756 | add eax,65536*1-1 |
1757 | mov ebx,[npy] |
1757 | mov ebx,[npy] |
1758 | shl ebx,16 |
1758 | shl ebx,16 |
1759 | add ebx,[npy] |
1759 | add ebx,[npy] |
1760 | call [draw_line] |
1760 | call [draw_line] |
1761 | 1761 | ||
1762 | mov eax,[npx] |
1762 | mov eax,[npx] |
1763 | shl eax,16 |
1763 | shl eax,16 |
1764 | add eax,[npx] |
1764 | add eax,[npx] |
1765 | add eax,[npxe] |
1765 | add eax,[npxe] |
1766 | add eax,65536*1-1 |
1766 | add eax,65536*1-1 |
1767 | mov ebx,[npy] |
1767 | mov ebx,[npy] |
1768 | add ebx,[npye] |
1768 | add ebx,[npye] |
1769 | shl ebx,16 |
1769 | shl ebx,16 |
1770 | add ebx,[npy] |
1770 | add ebx,[npy] |
1771 | add ebx,[npye] |
1771 | add ebx,[npye] |
1772 | call [draw_line] |
1772 | call [draw_line] |
1773 | 1773 | ||
1774 | mov eax,[npx] |
1774 | mov eax,[npx] |
1775 | shl eax,16 |
1775 | shl eax,16 |
1776 | add eax,[npx] |
1776 | add eax,[npx] |
1777 | mov ebx,[npy] |
1777 | mov ebx,[npy] |
1778 | shl ebx,16 |
1778 | shl ebx,16 |
1779 | add ebx,[npy] |
1779 | add ebx,[npy] |
1780 | add ebx,[npye] |
1780 | add ebx,[npye] |
1781 | call [draw_line] |
1781 | call [draw_line] |
1782 | 1782 | ||
1783 | mov eax,[npx] |
1783 | mov eax,[npx] |
1784 | add eax,[npxe] |
1784 | add eax,[npxe] |
1785 | shl eax,16 |
1785 | shl eax,16 |
1786 | add eax,[npx] |
1786 | add eax,[npx] |
1787 | add eax,[npxe] |
1787 | add eax,[npxe] |
1788 | mov ebx,[npy] |
1788 | mov ebx,[npy] |
1789 | shl ebx,16 |
1789 | shl ebx,16 |
1790 | add ebx,[npy] |
1790 | add ebx,[npy] |
1791 | add ebx,[npye] |
1791 | add ebx,[npye] |
1792 | call [draw_line] |
1792 | call [draw_line] |
1793 | 1793 | ||
1794 | .ret: |
1794 | .ret: |
1795 | sti |
1795 | sti |
1796 | popad |
1796 | popad |
1797 | ret |
1797 | ret |
1798 | 1798 | ||
1799 | 1799 | ||
1800 | 1800 | ||
1801 | random_shaped_window: |
1801 | random_shaped_window: |
1802 | 1802 | ||
1803 | ; |
1803 | ; |
1804 | ; eax = 0 giving address of data area |
1804 | ; eax = 0 giving address of data area |
1805 | ; ebx address |
1805 | ; ebx address |
1806 | ; eax = 1 shape area scale |
1806 | ; eax = 1 shape area scale |
1807 | ; ebx 2^ebx scale |
1807 | ; ebx 2^ebx scale |
1808 | 1808 | ||
1809 | test eax, eax |
1809 | test eax, eax |
1810 | jne rsw_no_address |
1810 | jne rsw_no_address |
1811 | mov eax,[current_slot] |
1811 | mov eax,[current_slot] |
1812 | mov [eax+APPDATA.wnd_shape],ebx |
1812 | mov [eax+APPDATA.wnd_shape],ebx |
1813 | rsw_no_address: |
1813 | rsw_no_address: |
1814 | 1814 | ||
1815 | cmp eax,1 |
1815 | cmp eax,1 |
1816 | jne rsw_no_scale |
1816 | jne rsw_no_scale |
1817 | mov eax,[current_slot] |
1817 | mov eax,[current_slot] |
1818 | mov byte [eax+APPDATA.wnd_shape_scale], bl |
1818 | mov byte [eax+APPDATA.wnd_shape_scale], bl |
1819 | rsw_no_scale: |
1819 | rsw_no_scale: |
1820 | 1820 | ||
1821 | ret>>->->=>=> |
1821 | ret>>->->=>=> |