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