Rev 6800 | Rev 7103 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 6800 | Rev 6802 | ||
---|---|---|---|
1 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
1 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
2 | ;; ;; |
2 | ;; ;; |
3 | ;; Copyright (C) KolibriOS team 2004-2015. All rights reserved. ;; |
3 | ;; Copyright (C) KolibriOS team 2004-2015. All rights reserved. ;; |
4 | ;; Copyright (C) MenuetOS 2000-2004 Ville Mikael Turjanmaa ;; |
4 | ;; Copyright (C) MenuetOS 2000-2004 Ville Mikael Turjanmaa ;; |
5 | ;; Distributed under terms of the GNU General Public License ;; |
5 | ;; Distributed under terms of the GNU General Public License ;; |
6 | ;; ;; |
6 | ;; ;; |
7 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
7 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
8 | 8 | ||
9 | $Revision: 6800 $ |
9 | $Revision: 6802 $ |
10 | 10 | ||
11 | ;============================================================================== |
11 | ;============================================================================== |
12 | ;///// public functions /////////////////////////////////////////////////////// |
12 | ;///// public functions /////////////////////////////////////////////////////// |
13 | ;============================================================================== |
13 | ;============================================================================== |
14 | 14 | ||
15 | window.BORDER_SIZE = 5 |
15 | window.BORDER_SIZE = 5 |
16 | 16 | ||
17 | uglobal |
17 | uglobal |
18 | common_colours rd 48 |
18 | common_colours rd 48 |
19 | draw_limits RECT |
19 | draw_limits RECT |
20 | endg |
20 | endg |
21 | 21 | ||
22 | ;------------------------------------------------------------------------------ |
22 | ;------------------------------------------------------------------------------ |
23 | syscall_draw_window: ;///// system function 0 ///////////////////////////////// |
23 | syscall_draw_window: ;///// system function 0 ///////////////////////////////// |
24 | ;------------------------------------------------------------------------------ |
24 | ;------------------------------------------------------------------------------ |
25 | mov eax, edx |
25 | mov eax, edx |
26 | shr eax, 24 |
26 | shr eax, 24 |
27 | and al, 0x0f |
27 | and al, 0x0f |
28 | cmp al, 5 |
28 | cmp al, 5 |
29 | jae .exit |
29 | jae .exit |
30 | 30 | ||
31 | push eax |
31 | push eax |
32 | call window._.sys_set_window |
32 | call window._.sys_set_window |
33 | pop eax |
33 | pop eax |
34 | 34 | ||
35 | or al, al |
35 | or al, al |
36 | jnz @f |
36 | jnz @f |
37 | 37 | ||
38 | ; type I - original style |
38 | ; type I - original style |
39 | call drawwindow_I |
39 | call drawwindow_I |
40 | jmp window._.draw_window_caption.2 |
40 | jmp window._.draw_window_caption.2 |
41 | ;-------------------------------------- |
41 | ;-------------------------------------- |
42 | @@: |
42 | @@: |
43 | dec al |
43 | dec al |
44 | jnz @f |
44 | jnz @f |
45 | 45 | ||
46 | ; type II - only reserve area, no draw |
46 | ; type II - only reserve area, no draw |
47 | call __sys_draw_pointer |
47 | call __sys_draw_pointer |
48 | jmp .exit |
48 | jmp .exit |
49 | ;-------------------------------------- |
49 | ;-------------------------------------- |
50 | @@: |
50 | @@: |
51 | dec al |
51 | dec al |
52 | jnz @f |
52 | jnz @f |
53 | 53 | ||
54 | ; type III - new style |
54 | ; type III - new style |
55 | call drawwindow_III |
55 | call drawwindow_III |
56 | jmp window._.draw_window_caption.2 |
56 | jmp window._.draw_window_caption.2 |
57 | ;-------------------------------------- |
57 | ;-------------------------------------- |
58 | @@: |
58 | @@: |
59 | ; type IV & V - skinned window (resizable & not) |
59 | ; type IV & V - skinned window (resizable & not) |
60 | mov eax, [TASK_COUNT] |
60 | mov eax, [TASK_COUNT] |
61 | movzx eax, word[WIN_POS + eax * 2] |
61 | movzx eax, word[WIN_POS + eax * 2] |
62 | cmp eax, [CURRENT_TASK] |
62 | cmp eax, [CURRENT_TASK] |
63 | setz al |
63 | setz al |
64 | movzx eax, al |
64 | movzx eax, al |
65 | push eax |
65 | push eax |
66 | call drawwindow_IV |
66 | call drawwindow_IV |
67 | jmp window._.draw_window_caption.2 |
67 | jmp window._.draw_window_caption.2 |
68 | ;-------------------------------------- |
68 | ;-------------------------------------- |
69 | .exit: |
69 | .exit: |
70 | ret |
70 | ret |
71 | ;------------------------------------------------------------------------------ |
71 | ;------------------------------------------------------------------------------ |
72 | syscall_display_settings: ;///// system function 48 /////////////////////////// |
72 | syscall_display_settings: ;///// system function 48 /////////////////////////// |
73 | ;------------------------------------------------------------------------------ |
73 | ;------------------------------------------------------------------------------ |
74 | cmp ebx, 13 |
74 | cmp ebx, 13 |
75 | ja @f |
75 | ja @f |
76 | jmp dword[.ftable + ebx*4] |
76 | jmp dword[.ftable + ebx*4] |
77 | 77 | ||
78 | align 4 |
78 | align 4 |
79 | .ftable: |
79 | .ftable: |
80 | dd .redrawWholeScreen |
80 | dd .redrawWholeScreen |
81 | dd .setButtonStyle |
81 | dd .setButtonStyle |
82 | dd .setSystemColors |
82 | dd .setSystemColors |
83 | dd .getSystemColors |
83 | dd .getSystemColors |
84 | dd .getCaptionHeight |
84 | dd .getCaptionHeight |
85 | dd .getScreenWorkingArea |
85 | dd .getScreenWorkingArea |
86 | dd .setScreenWorkingArea |
86 | dd .setScreenWorkingArea |
87 | dd .getSkinMargins |
87 | dd .getSkinMargins |
88 | dd .setSkin |
88 | dd .setSkin |
89 | dd .getFontSmoothing |
89 | dd .getFontSmoothing |
90 | dd .setFontSmoothing |
90 | dd .setFontSmoothing |
91 | dd .getFontSize |
91 | dd .getFontSize |
92 | dd .setFontSize |
92 | dd .setFontSize |
93 | dd .setSkinUnicode |
93 | dd .setSkinUnicode |
94 | 94 | ||
95 | .redrawWholeScreen: |
95 | .redrawWholeScreen: |
96 | xor eax, eax |
96 | xor eax, eax |
97 | inc ebx |
97 | inc ebx |
98 | cmp [windowtypechanged], ebx |
98 | cmp [windowtypechanged], ebx |
99 | jne .ret |
99 | jne .ret |
100 | mov [windowtypechanged], eax |
100 | mov [windowtypechanged], eax |
101 | .redrawScreen: |
101 | .redrawScreen: |
102 | xor eax, eax |
102 | xor eax, eax |
103 | mov [draw_limits.left], eax |
103 | mov [draw_limits.left], eax |
104 | mov [draw_limits.top], eax |
104 | mov [draw_limits.top], eax |
105 | mov eax, [_display.width] |
105 | mov eax, [_display.width] |
106 | dec eax |
106 | dec eax |
107 | mov [draw_limits.right], eax |
107 | mov [draw_limits.right], eax |
108 | mov eax, [_display.height] |
108 | mov eax, [_display.height] |
109 | dec eax |
109 | dec eax |
110 | mov [draw_limits.bottom], eax |
110 | mov [draw_limits.bottom], eax |
111 | mov eax, window_data |
111 | mov eax, window_data |
112 | jmp redrawscreen |
112 | jmp redrawscreen |
113 | 113 | ||
114 | .setButtonStyle: |
114 | .setButtonStyle: |
115 | ; in: ecx: 0 = flat, 1 = with gradient |
115 | ; in: ecx: 0 = flat, 1 = with gradient |
116 | and ecx, 1 |
116 | and ecx, 1 |
117 | cmp ecx, [buttontype] |
117 | cmp ecx, [buttontype] |
118 | je .ret |
118 | je .ret |
119 | mov [buttontype], ecx |
119 | mov [buttontype], ecx |
120 | mov [windowtypechanged], ebx |
120 | mov [windowtypechanged], ebx |
121 | .ret: |
121 | .ret: |
122 | ret |
122 | ret |
123 | 123 | ||
124 | .setSystemColors: |
124 | .setSystemColors: |
125 | ; in: ecx = pointer to color table, edx = size of color table |
125 | ; in: ecx = pointer to color table, edx = size of color table |
126 | dec ebx |
126 | dec ebx |
127 | mov esi, ecx |
127 | mov esi, ecx |
128 | cmp edx, 192 |
128 | cmp edx, 192 |
129 | jnae @f |
129 | jnae @f |
130 | mov edx, 192 ; max size |
130 | mov edx, 192 ; max size |
131 | @@: |
131 | @@: |
132 | mov edi, common_colours |
132 | mov edi, common_colours |
133 | mov ecx, edx |
133 | mov ecx, edx |
134 | rep movsb |
134 | rep movsb |
135 | mov [windowtypechanged], ebx |
135 | mov [windowtypechanged], ebx |
136 | ret |
136 | ret |
137 | 137 | ||
138 | .getSystemColors: |
138 | .getSystemColors: |
139 | ; in: ecx = pointer to color table, edx = size of color table |
139 | ; in: ecx = pointer to color table, edx = size of color table |
140 | mov edi, ecx |
140 | mov edi, ecx |
141 | cmp edx, 192 |
141 | cmp edx, 192 |
142 | jnae @f |
142 | jnae @f |
143 | mov edx, 192 ; max size |
143 | mov edx, 192 ; max size |
144 | @@: |
144 | @@: |
145 | mov esi, common_colours |
145 | mov esi, common_colours |
146 | mov ecx, edx |
146 | mov ecx, edx |
147 | rep movsb |
147 | rep movsb |
148 | ret |
148 | ret |
149 | 149 | ||
150 | .getCaptionHeight: |
150 | .getCaptionHeight: |
151 | mov eax, [_skinh] |
151 | mov eax, [_skinh] |
152 | mov [esp + 32], eax |
152 | mov [esp + 32], eax |
153 | ret |
153 | ret |
154 | 154 | ||
155 | .getScreenWorkingArea: |
155 | .getScreenWorkingArea: |
156 | ; out: eax = pack[left, right], ebx = pack[top, bottom] |
156 | ; out: eax = pack[left, right], ebx = pack[top, bottom] |
157 | mov eax, [screen_workarea.left - 2] |
157 | mov eax, [screen_workarea.left - 2] |
158 | mov ax, word[screen_workarea.right] |
158 | mov ax, word[screen_workarea.right] |
159 | mov [esp + 32], eax |
159 | mov [esp + 32], eax |
160 | mov eax, [screen_workarea.top - 2] |
160 | mov eax, [screen_workarea.top - 2] |
161 | mov ax, word[screen_workarea.bottom] |
161 | mov ax, word[screen_workarea.bottom] |
162 | mov [esp + 20], eax |
162 | mov [esp + 20], eax |
163 | ret |
163 | ret |
164 | 164 | ||
165 | .setScreenWorkingArea: |
165 | .setScreenWorkingArea: |
166 | ; in: ecx = pack[left, right], edx = pack[top, bottom] |
166 | ; in: ecx = pack[left, right], edx = pack[top, bottom] |
167 | xor esi, esi |
167 | xor esi, esi |
168 | mov edi, [_display.width] |
168 | mov edi, [_display.width] |
169 | dec edi |
169 | dec edi |
170 | mov eax, ecx |
170 | mov eax, ecx |
171 | movsx ebx, ax |
171 | movsx ebx, ax |
172 | sar eax, 16 |
172 | sar eax, 16 |
173 | cmp eax, ebx |
173 | cmp eax, ebx |
174 | jge .check_horizontal |
174 | jge .check_horizontal |
175 | inc esi |
175 | inc esi |
176 | or eax, eax |
176 | or eax, eax |
177 | jge @f |
177 | jge @f |
178 | xor eax, eax |
178 | xor eax, eax |
179 | @@: |
179 | @@: |
180 | mov [screen_workarea.left], eax |
180 | mov [screen_workarea.left], eax |
181 | cmp ebx, edi |
181 | cmp ebx, edi |
182 | jle @f |
182 | jle @f |
183 | mov ebx, edi |
183 | mov ebx, edi |
184 | @@: |
184 | @@: |
185 | mov [screen_workarea.right], ebx |
185 | mov [screen_workarea.right], ebx |
186 | .check_horizontal: |
186 | .check_horizontal: |
187 | mov edi, [_display.height] |
187 | mov edi, [_display.height] |
188 | dec edi |
188 | dec edi |
189 | mov eax, edx |
189 | mov eax, edx |
190 | movsx ebx, ax |
190 | movsx ebx, ax |
191 | sar eax, 16 |
191 | sar eax, 16 |
192 | cmp eax, ebx |
192 | cmp eax, ebx |
193 | jge .check_if_redraw_needed |
193 | jge .check_if_redraw_needed |
194 | inc esi |
194 | inc esi |
195 | or eax, eax |
195 | or eax, eax |
196 | jge @f |
196 | jge @f |
197 | xor eax, eax |
197 | xor eax, eax |
198 | @@: |
198 | @@: |
199 | mov [screen_workarea.top], eax |
199 | mov [screen_workarea.top], eax |
200 | cmp ebx, edi |
200 | cmp ebx, edi |
201 | jle @f |
201 | jle @f |
202 | mov ebx, edi |
202 | mov ebx, edi |
203 | @@: |
203 | @@: |
204 | mov [screen_workarea.bottom], ebx |
204 | mov [screen_workarea.bottom], ebx |
205 | .check_if_redraw_needed: |
205 | .check_if_redraw_needed: |
206 | or esi, esi |
206 | or esi, esi |
207 | jz @f |
207 | jz @f |
208 | call repos_windows |
208 | call repos_windows |
209 | .calculateScreen: |
209 | .calculateScreen: |
210 | xor eax, eax |
210 | xor eax, eax |
211 | xor ebx, ebx |
211 | xor ebx, ebx |
212 | mov ecx, [_display.width] |
212 | mov ecx, [_display.width] |
213 | mov edx, [_display.height] |
213 | mov edx, [_display.height] |
214 | dec ecx |
214 | dec ecx |
215 | dec edx |
215 | dec edx |
216 | jmp calculatescreen |
216 | jmp calculatescreen |
217 | 217 | ||
218 | .getSkinMargins: |
218 | .getSkinMargins: |
219 | ; out: eax = pack[left, right], ebx = pack[top, bottom] |
219 | ; out: eax = pack[left, right], ebx = pack[top, bottom] |
220 | mov eax, [_skinmargins + 0] |
220 | mov eax, [_skinmargins + 0] |
221 | mov [esp + 32], eax |
221 | mov [esp + 32], eax |
222 | mov eax, [_skinmargins + 4] |
222 | mov eax, [_skinmargins + 4] |
223 | mov [esp + 20], eax |
223 | mov [esp + 20], eax |
224 | ret |
224 | ret |
225 | 225 | ||
226 | .setSkin: |
226 | .setSkin: |
227 | ; in: ecx -> file path string |
227 | ; in: ecx -> file path string |
228 | mov ebx, ecx |
228 | mov ebx, ecx |
229 | call read_skin_file |
229 | call read_skin_file |
230 | mov [esp + 32], eax |
230 | mov [esp + 32], eax |
231 | test eax, eax |
231 | test eax, eax |
232 | jnz .ret |
232 | jnz .ret |
233 | call .calculateScreen |
233 | call .calculateScreen |
234 | jmp .redrawScreen |
234 | jmp .redrawScreen |
235 | 235 | ||
236 | .getFontSmoothing: |
236 | .getFontSmoothing: |
237 | xor eax, eax |
237 | xor eax, eax |
238 | mov al, [fontSmoothing] |
238 | mov al, [fontSmoothing] |
239 | mov [esp + 32], eax |
239 | mov [esp + 32], eax |
240 | ret |
240 | ret |
241 | 241 | ||
242 | .setFontSmoothing: |
242 | .setFontSmoothing: |
243 | mov [fontSmoothing], cl |
243 | mov [fontSmoothing], cl |
244 | ret |
244 | ret |
245 | 245 | ||
246 | .getFontSize: |
246 | .getFontSize: |
247 | xor eax, eax |
247 | xor eax, eax |
248 | mov al, [fontSize] |
248 | mov al, [fontSize] |
249 | mov [esp + 32], eax |
249 | mov [esp + 32], eax |
250 | ret |
250 | ret |
251 | 251 | ||
252 | .setFontSize: |
252 | .setFontSize: |
253 | mov [fontSize], cl |
253 | mov [fontSize], cl |
254 | ret |
254 | ret |
255 | 255 | ||
256 | .setSkinUnicode: |
256 | .setSkinUnicode: |
257 | ; in: ecx -> file path string, edx = string encoding |
257 | ; in: ecx -> file path string, edx = string encoding |
258 | push ecx edx |
258 | push ecx edx |
259 | stdcall kernel_alloc, maxPathLength |
259 | stdcall kernel_alloc, maxPathLength |
260 | mov edi, eax |
260 | mov edi, eax |
261 | pop eax esi |
261 | pop eax esi |
262 | push edi |
262 | push edi |
263 | call getFullPath |
263 | call getFullPath |
264 | test eax, eax |
264 | test eax, eax |
265 | jz @f |
265 | jz @f |
266 | mov ebx, [esp] |
266 | mov ebx, [esp] |
267 | call read_skin_file |
267 | call read_skin_file |
268 | mov [esp + 32 + 4], eax |
268 | mov [esp + 32 + 4], eax |
269 | @@: |
269 | @@: |
270 | call kernel_free |
270 | call kernel_free |
271 | call .calculateScreen |
271 | call .calculateScreen |
272 | jmp .redrawScreen |
272 | jmp .redrawScreen |
273 | 273 | ||
274 | ;------------------------------------------------------------------------------ |
274 | ;------------------------------------------------------------------------------ |
275 | syscall_set_window_shape: ;///// system function 50 /////////////////////////// |
275 | syscall_set_window_shape: ;///// system function 50 /////////////////////////// |
276 | ;------------------------------------------------------------------------------ |
276 | ;------------------------------------------------------------------------------ |
277 | ;; Set window shape address: |
277 | ;; Set window shape address: |
278 | ;> ebx = 0 |
278 | ;> ebx = 0 |
279 | ;> ecx = shape data address |
279 | ;> ecx = shape data address |
280 | ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
280 | ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
281 | ;; Set window shape scale: |
281 | ;; Set window shape scale: |
282 | ;> ebx = 1 |
282 | ;> ebx = 1 |
283 | ;> ecx = scale power (resulting scale is 2^ebx) |
283 | ;> ecx = scale power (resulting scale is 2^ebx) |
284 | ;------------------------------------------------------------------------------ |
284 | ;------------------------------------------------------------------------------ |
285 | mov edi, [current_slot] |
285 | mov edi, [current_slot] |
286 | 286 | ||
287 | test ebx, ebx |
287 | test ebx, ebx |
288 | jne .shape_scale |
288 | jne .shape_scale |
289 | mov [edi + APPDATA.wnd_shape], ecx |
289 | mov [edi + APPDATA.wnd_shape], ecx |
290 | ;-------------------------------------- |
290 | ;-------------------------------------- |
291 | align 4 |
291 | align 4 |
292 | .shape_scale: |
292 | .shape_scale: |
293 | dec ebx |
293 | dec ebx |
294 | jnz .exit |
294 | jnz .exit |
295 | mov [edi + APPDATA.wnd_shape_scale], ecx |
295 | mov [edi + APPDATA.wnd_shape_scale], ecx |
296 | ;-------------------------------------- |
296 | ;-------------------------------------- |
297 | align 4 |
297 | align 4 |
298 | .exit: |
298 | .exit: |
299 | ret |
299 | ret |
300 | ;------------------------------------------------------------------------------ |
300 | ;------------------------------------------------------------------------------ |
301 | align 4 |
301 | align 4 |
302 | ;------------------------------------------------------------------------------ |
302 | ;------------------------------------------------------------------------------ |
303 | syscall_move_window: ;///// system function 67 //////////////////////////////// |
303 | syscall_move_window: ;///// system function 67 //////////////////////////////// |
304 | ;------------------------------------------------------------------------------ |
304 | ;------------------------------------------------------------------------------ |
305 | ;? |
305 | ;? |
306 | ;------------------------------------------------------------------------------ |
306 | ;------------------------------------------------------------------------------ |
307 | mov edi, [CURRENT_TASK] |
307 | mov edi, [CURRENT_TASK] |
308 | shl edi, 5 |
308 | shl edi, 5 |
309 | add edi, window_data |
309 | add edi, window_data |
310 | 310 | ||
311 | test [edi + WDATA.fl_wdrawn], 1 |
311 | test [edi + WDATA.fl_wdrawn], 1 |
312 | jz .exit |
312 | jz .exit |
313 | 313 | ||
314 | test [edi + WDATA.fl_wstate], WSTATE_MAXIMIZED |
314 | test [edi + WDATA.fl_wstate], WSTATE_MAXIMIZED |
315 | jnz .exit |
315 | jnz .exit |
316 | 316 | ||
317 | cmp ebx, -1 |
317 | cmp ebx, -1 |
318 | jne @f |
318 | jne @f |
319 | mov ebx, [edi + WDATA.box.left] |
319 | mov ebx, [edi + WDATA.box.left] |
320 | ;-------------------------------------- |
320 | ;-------------------------------------- |
321 | align 4 |
321 | align 4 |
322 | @@: |
322 | @@: |
323 | cmp ecx, -1 |
323 | cmp ecx, -1 |
324 | jne @f |
324 | jne @f |
325 | mov ecx, [edi + WDATA.box.top] |
325 | mov ecx, [edi + WDATA.box.top] |
326 | ;-------------------------------------- |
326 | ;-------------------------------------- |
327 | align 4 |
327 | align 4 |
328 | @@: |
328 | @@: |
329 | cmp edx, -1 |
329 | cmp edx, -1 |
330 | jne @f |
330 | jne @f |
331 | mov edx, [edi + WDATA.box.width] |
331 | mov edx, [edi + WDATA.box.width] |
332 | ;-------------------------------------- |
332 | ;-------------------------------------- |
333 | align 4 |
333 | align 4 |
334 | @@: |
334 | @@: |
335 | cmp esi, -1 |
335 | cmp esi, -1 |
336 | jne @f |
336 | jne @f |
337 | mov esi, [edi + WDATA.box.height] |
337 | mov esi, [edi + WDATA.box.height] |
338 | ;-------------------------------------- |
338 | ;-------------------------------------- |
339 | align 4 |
339 | align 4 |
340 | @@: |
340 | @@: |
341 | push esi edx ecx ebx |
341 | push esi edx ecx ebx |
342 | mov eax, esp |
342 | mov eax, esp |
343 | mov bl, [edi + WDATA.fl_wstate] |
343 | mov bl, [edi + WDATA.fl_wstate] |
344 | ;-------------------------------------- |
344 | ;-------------------------------------- |
345 | align 4 |
345 | align 4 |
346 | @@: |
346 | @@: |
347 | cmp [REDRAW_BACKGROUND], byte 0 |
347 | cmp [REDRAW_BACKGROUND], byte 0 |
348 | jz @f |
348 | jz @f |
349 | call change_task |
349 | call change_task |
350 | jmp @b |
350 | jmp @b |
351 | ;-------------------------------------- |
351 | ;-------------------------------------- |
352 | align 4 |
352 | align 4 |
353 | @@: |
353 | @@: |
354 | call window._.set_window_box |
354 | call window._.set_window_box |
355 | add esp, sizeof.BOX |
355 | add esp, sizeof.BOX |
356 | 356 | ||
357 | .exit: |
357 | .exit: |
358 | ret |
358 | ret |
359 | ;------------------------------------------------------------------------------ |
359 | ;------------------------------------------------------------------------------ |
360 | syscall_window_settings: ;///// system function 71 //////////////////////////// |
360 | syscall_window_settings: ;///// system function 71 //////////////////////////// |
361 | ;------------------------------------------------------------------------------ |
361 | ;------------------------------------------------------------------------------ |
362 | mov edi, [CURRENT_TASK] |
362 | mov edi, [CURRENT_TASK] |
363 | shl edi, 5 |
363 | shl edi, 5 |
364 | mov [edi * 8 + SLOT_BASE + APPDATA.wnd_caption], ecx |
- | |
365 | or [edi + window_data + WDATA.fl_wstyle], WSTYLE_HASCAPTION |
364 | or [edi + window_data + WDATA.fl_wstyle], WSTYLE_HASCAPTION |
- | 365 | cmp ebx, 2 |
|
- | 366 | jz @f |
|
- | 367 | xor edx, edx |
|
- | 368 | @@: |
|
- | 369 | cmp dl, 4 |
|
- | 370 | jc @f |
|
- | 371 | xor edx, edx |
|
- | 372 | @@: |
|
- | 373 | mov [edi*8 + SLOT_BASE + APPDATA.wnd_caption], ecx |
|
- | 374 | mov [edi*8 + SLOT_BASE + APPDATA.captionEncoding], dl |
|
366 | jmp window._.draw_window_caption |
375 | jmp window._.draw_window_caption |
367 | ;------------------------------------------------------------------------------ |
376 | ;------------------------------------------------------------------------------ |
368 | align 4 |
377 | align 4 |
369 | set_window_defaults: ;///////////////////////////////////////////////////////// |
378 | set_window_defaults: ;///////////////////////////////////////////////////////// |
370 | ;------------------------------------------------------------------------------ |
379 | ;------------------------------------------------------------------------------ |
371 | mov byte [window_data + 0x20 + WDATA.cl_titlebar + 3], 1 ; desktop is not movable |
380 | mov byte [window_data + 0x20 + WDATA.cl_titlebar + 3], 1 ; desktop is not movable |
372 | push eax ecx |
381 | push eax ecx |
373 | xor eax, eax |
382 | xor eax, eax |
374 | mov ecx, WIN_STACK |
383 | mov ecx, WIN_STACK |
375 | ;-------------------------------------- |
384 | ;-------------------------------------- |
376 | align 4 |
385 | align 4 |
377 | @@: |
386 | @@: |
378 | inc eax |
387 | inc eax |
379 | add ecx, 2 |
388 | add ecx, 2 |
380 | ; process no |
389 | ; process no |
381 | mov [ecx + 0x000], ax |
390 | mov [ecx + 0x000], ax |
382 | ; positions in stack |
391 | ; positions in stack |
383 | mov [ecx + 0x400], ax |
392 | mov [ecx + 0x400], ax |
384 | cmp ecx, WIN_POS - 2 |
393 | cmp ecx, WIN_POS - 2 |
385 | jne @b |
394 | jne @b |
386 | pop ecx eax |
395 | pop ecx eax |
387 | ret |
396 | ret |
388 | ;------------------------------------------------------------------------------ |
397 | ;------------------------------------------------------------------------------ |
389 | 398 | ||
390 | align 4 |
399 | align 4 |
391 | ;------------------------------------------------------------------------------ |
400 | ;------------------------------------------------------------------------------ |
392 | calculatescreen: ;///////////////////////////////////////////////////////////// |
401 | calculatescreen: ;///////////////////////////////////////////////////////////// |
393 | ;------------------------------------------------------------------------------ |
402 | ;------------------------------------------------------------------------------ |
394 | ;? Scan all windows from bottom to top, calling `setscreen` for each one |
403 | ;? Scan all windows from bottom to top, calling `setscreen` for each one |
395 | ;? intersecting given screen area |
404 | ;? intersecting given screen area |
396 | ;------------------------------------------------------------------------------ |
405 | ;------------------------------------------------------------------------------ |
397 | ;> eax = left |
406 | ;> eax = left |
398 | ;> ebx = top |
407 | ;> ebx = top |
399 | ;> ecx = right |
408 | ;> ecx = right |
400 | ;> edx = bottom |
409 | ;> edx = bottom |
401 | ;------------------------------------------------------------------------------ |
410 | ;------------------------------------------------------------------------------ |
402 | push esi |
411 | push esi |
403 | pushfd |
412 | pushfd |
404 | cli |
413 | cli |
405 | 414 | ||
406 | mov esi, 1 |
415 | mov esi, 1 |
407 | call window._.set_screen |
416 | call window._.set_screen |
408 | 417 | ||
409 | push ebp |
418 | push ebp |
410 | 419 | ||
411 | mov ebp, [TASK_COUNT] |
420 | mov ebp, [TASK_COUNT] |
412 | cmp ebp, 1 |
421 | cmp ebp, 1 |
413 | jbe .exit |
422 | jbe .exit |
414 | 423 | ||
415 | push eax ;for num layout |
424 | push eax ;for num layout |
416 | 425 | ||
417 | push edx ecx ebx eax |
426 | push edx ecx ebx eax |
418 | 427 | ||
419 | mov dword[esp+10h], ZPOS_DESKTOP |
428 | mov dword[esp+10h], ZPOS_DESKTOP |
420 | ;-------------------------------------- |
429 | ;-------------------------------------- |
421 | align 4 |
430 | align 4 |
422 | .layout: |
431 | .layout: |
423 | mov esi, 1 ; = num in window stack |
432 | mov esi, 1 ; = num in window stack |
424 | mov ebp, [TASK_COUNT] |
433 | mov ebp, [TASK_COUNT] |
425 | ;-------------------------------------- |
434 | ;-------------------------------------- |
426 | align 4 |
435 | align 4 |
427 | .next_window: |
436 | .next_window: |
428 | movzx edi, word[WIN_POS + esi * 2] |
437 | movzx edi, word[WIN_POS + esi * 2] |
429 | shl edi, 5 ;size of TASKDATA and WDATA = 32 bytes |
438 | shl edi, 5 ;size of TASKDATA and WDATA = 32 bytes |
430 | 439 | ||
431 | cmp [CURRENT_TASK + edi + TASKDATA.state], TSTATE_FREE |
440 | cmp [CURRENT_TASK + edi + TASKDATA.state], TSTATE_FREE |
432 | je .skip_window |
441 | je .skip_window |
433 | 442 | ||
434 | add edi, window_data |
443 | add edi, window_data |
435 | test [edi + WDATA.fl_wstate], WSTATE_MINIMIZED |
444 | test [edi + WDATA.fl_wstate], WSTATE_MINIMIZED |
436 | jnz .skip_window |
445 | jnz .skip_window |
437 | 446 | ||
438 | mov eax, [esp+10h] |
447 | mov eax, [esp+10h] |
439 | cmp [edi + WDATA.z_modif], al |
448 | cmp [edi + WDATA.z_modif], al |
440 | jne .skip_window |
449 | jne .skip_window |
441 | 450 | ||
442 | mov eax, [edi + WDATA.box.left] |
451 | mov eax, [edi + WDATA.box.left] |
443 | cmp eax, [esp + RECT.right] |
452 | cmp eax, [esp + RECT.right] |
444 | jg .skip_window |
453 | jg .skip_window |
445 | mov ebx, [edi + WDATA.box.top] |
454 | mov ebx, [edi + WDATA.box.top] |
446 | cmp ebx, [esp + RECT.bottom] |
455 | cmp ebx, [esp + RECT.bottom] |
447 | jg .skip_window |
456 | jg .skip_window |
448 | mov ecx, [edi + WDATA.box.width] |
457 | mov ecx, [edi + WDATA.box.width] |
449 | add ecx, eax |
458 | add ecx, eax |
450 | cmp ecx, [esp + RECT.left] |
459 | cmp ecx, [esp + RECT.left] |
451 | jl .skip_window |
460 | jl .skip_window |
452 | mov edx, [edi + WDATA.box.height] |
461 | mov edx, [edi + WDATA.box.height] |
453 | add edx, ebx |
462 | add edx, ebx |
454 | cmp edx, [esp + RECT.top] |
463 | cmp edx, [esp + RECT.top] |
455 | jl .skip_window |
464 | jl .skip_window |
456 | 465 | ||
457 | cmp eax, [esp + RECT.left] |
466 | cmp eax, [esp + RECT.left] |
458 | jae @f |
467 | jae @f |
459 | mov eax, [esp + RECT.left] |
468 | mov eax, [esp + RECT.left] |
460 | ;-------------------------------------- |
469 | ;-------------------------------------- |
461 | align 4 |
470 | align 4 |
462 | @@: |
471 | @@: |
463 | cmp ebx, [esp + RECT.top] |
472 | cmp ebx, [esp + RECT.top] |
464 | jae @f |
473 | jae @f |
465 | mov ebx, [esp + RECT.top] |
474 | mov ebx, [esp + RECT.top] |
466 | ;-------------------------------------- |
475 | ;-------------------------------------- |
467 | align 4 |
476 | align 4 |
468 | @@: |
477 | @@: |
469 | cmp ecx, [esp + RECT.right] |
478 | cmp ecx, [esp + RECT.right] |
470 | jbe @f |
479 | jbe @f |
471 | mov ecx, [esp + RECT.right] |
480 | mov ecx, [esp + RECT.right] |
472 | ;-------------------------------------- |
481 | ;-------------------------------------- |
473 | align 4 |
482 | align 4 |
474 | @@: |
483 | @@: |
475 | cmp edx, [esp + RECT.bottom] |
484 | cmp edx, [esp + RECT.bottom] |
476 | jbe @f |
485 | jbe @f |
477 | mov edx, [esp + RECT.bottom] |
486 | mov edx, [esp + RECT.bottom] |
478 | ;-------------------------------------- |
487 | ;-------------------------------------- |
479 | align 4 |
488 | align 4 |
480 | @@: |
489 | @@: |
481 | push esi |
490 | push esi |
482 | movzx esi, word[WIN_POS + esi * 2] |
491 | movzx esi, word[WIN_POS + esi * 2] |
483 | call window._.set_screen |
492 | call window._.set_screen |
484 | pop esi |
493 | pop esi |
485 | ;-------------------------------------- |
494 | ;-------------------------------------- |
486 | align 4 |
495 | align 4 |
487 | .skip_window: |
496 | .skip_window: |
488 | inc esi |
497 | inc esi |
489 | dec ebp |
498 | dec ebp |
490 | jnz .next_window |
499 | jnz .next_window |
491 | ;--------------------------------------------- |
500 | ;--------------------------------------------- |
492 | inc dword[esp+10h] |
501 | inc dword[esp+10h] |
493 | cmp dword[esp+10h], ZPOS_ALWAYS_TOP |
502 | cmp dword[esp+10h], ZPOS_ALWAYS_TOP |
494 | jle .layout |
503 | jle .layout |
495 | ;--------------------------------------------- |
504 | ;--------------------------------------------- |
496 | mov esi, [TASK_COUNT] |
505 | mov esi, [TASK_COUNT] |
497 | movzx edi, word[WIN_POS + esi * 2] |
506 | movzx edi, word[WIN_POS + esi * 2] |
498 | shl edi, 5 |
507 | shl edi, 5 |
499 | add edi, window_data |
508 | add edi, window_data |
500 | 509 | ||
501 | pop eax ebx ecx edx |
510 | pop eax ebx ecx edx |
502 | pop ebp ;del num layout |
511 | pop ebp ;del num layout |
503 | ;-------------------------------------- |
512 | ;-------------------------------------- |
504 | align 4 |
513 | align 4 |
505 | .exit: |
514 | .exit: |
506 | pop ebp |
515 | pop ebp |
507 | inc [_display.mask_seqno] |
516 | inc [_display.mask_seqno] |
508 | popfd |
517 | popfd |
509 | pop esi |
518 | pop esi |
510 | ret |
519 | ret |
511 | ;------------------------------------------------------------------------------ |
520 | ;------------------------------------------------------------------------------ |
512 | align 4 |
521 | align 4 |
513 | ;------------------------------------------------------------------------------ |
522 | ;------------------------------------------------------------------------------ |
514 | repos_windows: ;/////////////////////////////////////////////////////////////// |
523 | repos_windows: ;/////////////////////////////////////////////////////////////// |
515 | ;------------------------------------------------------------------------------ |
524 | ;------------------------------------------------------------------------------ |
516 | ;? |
525 | ;? |
517 | ;------------------------------------------------------------------------------ |
526 | ;------------------------------------------------------------------------------ |
518 | mov ecx, [TASK_COUNT] |
527 | mov ecx, [TASK_COUNT] |
519 | mov edi, window_data + sizeof.WDATA * 2 |
528 | mov edi, window_data + sizeof.WDATA * 2 |
520 | call force_redraw_background |
529 | call force_redraw_background |
521 | dec ecx |
530 | dec ecx |
522 | jle .exit |
531 | jle .exit |
523 | ;-------------------------------------- |
532 | ;-------------------------------------- |
524 | align 4 |
533 | align 4 |
525 | .next_window: |
534 | .next_window: |
526 | mov [edi + WDATA.fl_redraw], 1 |
535 | mov [edi + WDATA.fl_redraw], 1 |
527 | test [edi + WDATA.fl_wstate], WSTATE_MAXIMIZED |
536 | test [edi + WDATA.fl_wstate], WSTATE_MAXIMIZED |
528 | jnz .fix_maximized |
537 | jnz .fix_maximized |
529 | 538 | ||
530 | mov eax, [edi + WDATA.box.left] |
539 | mov eax, [edi + WDATA.box.left] |
531 | add eax, [edi + WDATA.box.width] |
540 | add eax, [edi + WDATA.box.width] |
532 | mov ebx, [_display.width] |
541 | mov ebx, [_display.width] |
533 | cmp eax, ebx |
542 | cmp eax, ebx |
534 | jl .fix_vertical |
543 | jl .fix_vertical |
535 | mov eax, [edi + WDATA.box.width] |
544 | mov eax, [edi + WDATA.box.width] |
536 | sub eax, ebx |
545 | sub eax, ebx |
537 | jl @f |
546 | jl @f |
538 | mov [edi + WDATA.box.width], ebx |
547 | mov [edi + WDATA.box.width], ebx |
539 | ;-------------------------------------- |
548 | ;-------------------------------------- |
540 | align 4 |
549 | align 4 |
541 | @@: |
550 | @@: |
542 | sub ebx, [edi + WDATA.box.width] |
551 | sub ebx, [edi + WDATA.box.width] |
543 | mov [edi + WDATA.box.left], ebx |
552 | mov [edi + WDATA.box.left], ebx |
544 | ;-------------------------------------- |
553 | ;-------------------------------------- |
545 | align 4 |
554 | align 4 |
546 | .fix_vertical: |
555 | .fix_vertical: |
547 | mov eax, [edi + WDATA.box.top] |
556 | mov eax, [edi + WDATA.box.top] |
548 | add eax, [edi + WDATA.box.height] |
557 | add eax, [edi + WDATA.box.height] |
549 | mov ebx, [_display.height] |
558 | mov ebx, [_display.height] |
550 | cmp eax, ebx |
559 | cmp eax, ebx |
551 | jl .fix_client_box |
560 | jl .fix_client_box |
552 | mov eax, [edi + WDATA.box.height] |
561 | mov eax, [edi + WDATA.box.height] |
553 | sub eax, ebx |
562 | sub eax, ebx |
554 | jl @f |
563 | jl @f |
555 | mov [edi + WDATA.box.height], ebx |
564 | mov [edi + WDATA.box.height], ebx |
556 | ;-------------------------------------- |
565 | ;-------------------------------------- |
557 | align 4 |
566 | align 4 |
558 | @@: |
567 | @@: |
559 | sub ebx, [edi + WDATA.box.height] |
568 | sub ebx, [edi + WDATA.box.height] |
560 | mov [edi + WDATA.box.top], ebx |
569 | mov [edi + WDATA.box.top], ebx |
561 | ;-------------------------------------- |
570 | ;-------------------------------------- |
562 | align 4 |
571 | align 4 |
563 | .fix_client_box: |
572 | .fix_client_box: |
564 | call window._.set_window_clientbox |
573 | call window._.set_window_clientbox |
565 | add edi, sizeof.WDATA |
574 | add edi, sizeof.WDATA |
566 | loop .next_window |
575 | loop .next_window |
567 | ;-------------------------------------- |
576 | ;-------------------------------------- |
568 | align 4 |
577 | align 4 |
569 | .exit: |
578 | .exit: |
570 | ret |
579 | ret |
571 | ;-------------------------------------- |
580 | ;-------------------------------------- |
572 | align 4 |
581 | align 4 |
573 | .fix_maximized: |
582 | .fix_maximized: |
574 | mov eax, [screen_workarea.left] |
583 | mov eax, [screen_workarea.left] |
575 | mov [edi + WDATA.box.left], eax |
584 | mov [edi + WDATA.box.left], eax |
576 | sub eax, [screen_workarea.right] |
585 | sub eax, [screen_workarea.right] |
577 | neg eax |
586 | neg eax |
578 | mov [edi + WDATA.box.width], eax |
587 | mov [edi + WDATA.box.width], eax |
579 | mov eax, [screen_workarea.top] |
588 | mov eax, [screen_workarea.top] |
580 | mov [edi + WDATA.box.top], eax |
589 | mov [edi + WDATA.box.top], eax |
581 | test [edi + WDATA.fl_wstate], WSTATE_ROLLEDUP |
590 | test [edi + WDATA.fl_wstate], WSTATE_ROLLEDUP |
582 | jnz .fix_client_box |
591 | jnz .fix_client_box |
583 | sub eax, [screen_workarea.bottom] |
592 | sub eax, [screen_workarea.bottom] |
584 | neg eax |
593 | neg eax |
585 | mov [edi + WDATA.box.height], eax |
594 | mov [edi + WDATA.box.height], eax |
586 | jmp .fix_client_box |
595 | jmp .fix_client_box |
587 | ;------------------------------------------------------------------------------ |
596 | ;------------------------------------------------------------------------------ |
588 | align 4 |
597 | align 4 |
589 | ;------------------------------------------------------------------------------ |
598 | ;------------------------------------------------------------------------------ |
590 | draw_rectangle: ;////////////////////////////////////////////////////////////// |
599 | draw_rectangle: ;////////////////////////////////////////////////////////////// |
591 | ;------------------------------------------------------------------------------ |
600 | ;------------------------------------------------------------------------------ |
592 | ;> eax = pack[16(left), 16(right)] |
601 | ;> eax = pack[16(left), 16(right)] |
593 | ;> ebx = pack[16(top), 16(bottom)] |
602 | ;> ebx = pack[16(top), 16(bottom)] |
594 | ;> esi = color |
603 | ;> esi = color |
595 | ; ?? RR GG BB ; 0x01000000 negation |
604 | ; ?? RR GG BB ; 0x01000000 negation |
596 | ; ; 0x02000000 used for draw_rectangle without top line |
605 | ; ; 0x02000000 used for draw_rectangle without top line |
597 | ; ; for example drawwindow_III and drawwindow_IV |
606 | ; ; for example drawwindow_III and drawwindow_IV |
598 | ;------------------------------------------------------------------------------ |
607 | ;------------------------------------------------------------------------------ |
599 | push eax ebx ecx edi |
608 | push eax ebx ecx edi |
600 | 609 | ||
601 | xor edi, edi |
610 | xor edi, edi |
602 | ;-------------------------------------- |
611 | ;-------------------------------------- |
603 | align 4 |
612 | align 4 |
604 | .flags_set: |
613 | .flags_set: |
605 | push ebx |
614 | push ebx |
606 | 615 | ||
607 | ; set line color |
616 | ; set line color |
608 | mov ecx, esi |
617 | mov ecx, esi |
609 | ; draw top border |
618 | ; draw top border |
610 | rol ebx, 16 |
619 | rol ebx, 16 |
611 | push ebx |
620 | push ebx |
612 | rol ebx, 16 |
621 | rol ebx, 16 |
613 | pop bx |
622 | pop bx |
614 | test ecx, 1 shl 25 |
623 | test ecx, 1 shl 25 |
615 | jnz @f |
624 | jnz @f |
616 | sub ecx, 1 shl 25 |
625 | sub ecx, 1 shl 25 |
617 | ; call [draw_line] |
626 | ; call [draw_line] |
618 | call __sys_draw_line |
627 | call __sys_draw_line |
619 | ;-------------------------------------- |
628 | ;-------------------------------------- |
620 | align 4 |
629 | align 4 |
621 | @@: |
630 | @@: |
622 | ; draw bottom border |
631 | ; draw bottom border |
623 | mov ebx, [esp - 2] |
632 | mov ebx, [esp - 2] |
624 | pop bx |
633 | pop bx |
625 | ; call [draw_line] |
634 | ; call [draw_line] |
626 | call __sys_draw_line |
635 | call __sys_draw_line |
627 | 636 | ||
628 | pop ebx |
637 | pop ebx |
629 | add ebx, 1 * 65536 - 1 |
638 | add ebx, 1 * 65536 - 1 |
630 | 639 | ||
631 | ; draw left border |
640 | ; draw left border |
632 | rol eax, 16 |
641 | rol eax, 16 |
633 | push eax |
642 | push eax |
634 | rol eax, 16 |
643 | rol eax, 16 |
635 | pop ax |
644 | pop ax |
636 | ; call [draw_line] |
645 | ; call [draw_line] |
637 | call __sys_draw_line |
646 | call __sys_draw_line |
638 | 647 | ||
639 | ; draw right border |
648 | ; draw right border |
640 | mov eax, [esp - 2] |
649 | mov eax, [esp - 2] |
641 | pop ax |
650 | pop ax |
642 | ; call [draw_line] |
651 | ; call [draw_line] |
643 | call __sys_draw_line |
652 | call __sys_draw_line |
644 | 653 | ||
645 | pop edi ecx ebx eax |
654 | pop edi ecx ebx eax |
646 | ret |
655 | ret |
647 | ;-------------------------------------- |
656 | ;-------------------------------------- |
648 | align 4 |
657 | align 4 |
649 | .forced: |
658 | .forced: |
650 | push eax ebx ecx edi |
659 | push eax ebx ecx edi |
651 | xor edi, edi |
660 | xor edi, edi |
652 | inc edi |
661 | inc edi |
653 | jmp .flags_set |
662 | jmp .flags_set |
654 | ;------------------------------------------------------------------------------ |
663 | ;------------------------------------------------------------------------------ |
655 | align 4 |
664 | align 4 |
656 | ;------------------------------------------------------------------------------ |
665 | ;------------------------------------------------------------------------------ |
657 | drawwindow_I_caption: ;//////////////////////////////////////////////////////// |
666 | drawwindow_I_caption: ;//////////////////////////////////////////////////////// |
658 | ;------------------------------------------------------------------------------ |
667 | ;------------------------------------------------------------------------------ |
659 | ;? |
668 | ;? |
660 | ;------------------------------------------------------------------------------ |
669 | ;------------------------------------------------------------------------------ |
661 | push [edx + WDATA.cl_titlebar] |
670 | push [edx + WDATA.cl_titlebar] |
662 | mov esi, edx |
671 | mov esi, edx |
663 | 672 | ||
664 | mov edx, [esi + WDATA.box.top] |
673 | mov edx, [esi + WDATA.box.top] |
665 | mov eax, edx |
674 | mov eax, edx |
666 | lea ebx, [edx + 21] |
675 | lea ebx, [edx + 21] |
667 | inc edx |
676 | inc edx |
668 | add eax, [esi + WDATA.box.height] |
677 | add eax, [esi + WDATA.box.height] |
669 | 678 | ||
670 | cmp ebx, eax |
679 | cmp ebx, eax |
671 | jbe @f |
680 | jbe @f |
672 | mov ebx, eax |
681 | mov ebx, eax |
673 | ;-------------------------------------- |
682 | ;-------------------------------------- |
674 | align 4 |
683 | align 4 |
675 | @@: |
684 | @@: |
676 | push ebx |
685 | push ebx |
677 | 686 | ||
678 | xor edi, edi |
687 | xor edi, edi |
679 | ;-------------------------------------- |
688 | ;-------------------------------------- |
680 | align 4 |
689 | align 4 |
681 | .next_line: |
690 | .next_line: |
682 | mov ebx, edx |
691 | mov ebx, edx |
683 | shl ebx, 16 |
692 | shl ebx, 16 |
684 | add ebx, edx |
693 | add ebx, edx |
685 | mov eax, [esi + WDATA.box.left] |
694 | mov eax, [esi + WDATA.box.left] |
686 | inc eax |
695 | inc eax |
687 | shl eax, 16 |
696 | shl eax, 16 |
688 | add eax, [esi + WDATA.box.left] |
697 | add eax, [esi + WDATA.box.left] |
689 | add eax, [esi + WDATA.box.width] |
698 | add eax, [esi + WDATA.box.width] |
690 | dec eax |
699 | dec eax |
691 | mov ecx, [esi + WDATA.cl_titlebar] |
700 | mov ecx, [esi + WDATA.cl_titlebar] |
692 | test ecx, 0x80000000 |
701 | test ecx, 0x80000000 |
693 | jz @f |
702 | jz @f |
694 | sub ecx, 0x00040404 |
703 | sub ecx, 0x00040404 |
695 | mov [esi + WDATA.cl_titlebar], ecx |
704 | mov [esi + WDATA.cl_titlebar], ecx |
696 | ;-------------------------------------- |
705 | ;-------------------------------------- |
697 | align 4 |
706 | align 4 |
698 | @@: |
707 | @@: |
699 | and ecx, 0x00ffffff |
708 | and ecx, 0x00ffffff |
700 | ; call [draw_line] |
709 | ; call [draw_line] |
701 | call __sys_draw_line |
710 | call __sys_draw_line |
702 | inc edx |
711 | inc edx |
703 | cmp edx, [esp] |
712 | cmp edx, [esp] |
704 | jb .next_line |
713 | jb .next_line |
705 | 714 | ||
706 | add esp, 4 |
715 | add esp, 4 |
707 | pop [esi + WDATA.cl_titlebar] |
716 | pop [esi + WDATA.cl_titlebar] |
708 | ret |
717 | ret |
709 | ;------------------------------------------------------------------------------ |
718 | ;------------------------------------------------------------------------------ |
710 | align 4 |
719 | align 4 |
711 | ;------------------------------------------------------------------------------ |
720 | ;------------------------------------------------------------------------------ |
712 | drawwindow_I: ;//////////////////////////////////////////////////////////////// |
721 | drawwindow_I: ;//////////////////////////////////////////////////////////////// |
713 | ;------------------------------------------------------------------------------ |
722 | ;------------------------------------------------------------------------------ |
714 | ;? |
723 | ;? |
715 | ;------------------------------------------------------------------------------ |
724 | ;------------------------------------------------------------------------------ |
716 | pushad |
725 | pushad |
717 | 726 | ||
718 | ; window border |
727 | ; window border |
719 | 728 | ||
720 | mov eax, [edx + WDATA.box.left - 2] |
729 | mov eax, [edx + WDATA.box.left - 2] |
721 | mov ax, word[edx + WDATA.box.left] |
730 | mov ax, word[edx + WDATA.box.left] |
722 | add ax, word[edx + WDATA.box.width] |
731 | add ax, word[edx + WDATA.box.width] |
723 | mov ebx, [edx + WDATA.box.top - 2] |
732 | mov ebx, [edx + WDATA.box.top - 2] |
724 | mov bx, word[edx + WDATA.box.top] |
733 | mov bx, word[edx + WDATA.box.top] |
725 | add bx, word[edx + WDATA.box.height] |
734 | add bx, word[edx + WDATA.box.height] |
726 | 735 | ||
727 | mov esi, [edx + WDATA.cl_frames] |
736 | mov esi, [edx + WDATA.cl_frames] |
728 | call draw_rectangle |
737 | call draw_rectangle |
729 | 738 | ||
730 | ; window caption |
739 | ; window caption |
731 | 740 | ||
732 | call drawwindow_I_caption |
741 | call drawwindow_I_caption |
733 | 742 | ||
734 | ; window client area |
743 | ; window client area |
735 | 744 | ||
736 | ; do we need to draw it? |
745 | ; do we need to draw it? |
737 | mov edi, [esi + WDATA.cl_workarea] |
746 | mov edi, [esi + WDATA.cl_workarea] |
738 | test edi, 0x40000000 |
747 | test edi, 0x40000000 |
739 | jnz .exit |
748 | jnz .exit |
740 | 749 | ||
741 | ; does client area have a positive size on screen? |
750 | ; does client area have a positive size on screen? |
742 | cmp [esi + WDATA.box.height], 21 |
751 | cmp [esi + WDATA.box.height], 21 |
743 | jle .exit |
752 | jle .exit |
744 | 753 | ||
745 | ; okay, let's draw it |
754 | ; okay, let's draw it |
746 | mov eax, 1 |
755 | mov eax, 1 |
747 | mov ebx, 21 |
756 | mov ebx, 21 |
748 | mov ecx, [esi + WDATA.box.width] |
757 | mov ecx, [esi + WDATA.box.width] |
749 | mov edx, [esi + WDATA.box.height] |
758 | mov edx, [esi + WDATA.box.height] |
750 | ; call [drawbar] |
759 | ; call [drawbar] |
751 | call vesa20_drawbar |
760 | call vesa20_drawbar |
752 | ;-------------------------------------- |
761 | ;-------------------------------------- |
753 | align 4 |
762 | align 4 |
754 | .exit: |
763 | .exit: |
755 | popad |
764 | popad |
756 | ret |
765 | ret |
757 | ;------------------------------------------------------------------------------ |
766 | ;------------------------------------------------------------------------------ |
758 | align 4 |
767 | align 4 |
759 | ;------------------------------------------------------------------------------ |
768 | ;------------------------------------------------------------------------------ |
760 | drawwindow_III_caption: ;///////////////////////////////////////////////////// |
769 | drawwindow_III_caption: ;///////////////////////////////////////////////////// |
761 | ;------------------------------------------------------------------------------ |
770 | ;------------------------------------------------------------------------------ |
762 | ;? |
771 | ;? |
763 | ;------------------------------------------------------------------------------ |
772 | ;------------------------------------------------------------------------------ |
764 | mov ecx, [edx + WDATA.cl_titlebar] |
773 | mov ecx, [edx + WDATA.cl_titlebar] |
765 | push ecx |
774 | push ecx |
766 | mov esi, edx |
775 | mov esi, edx |
767 | mov edx, [esi + WDATA.box.top] |
776 | mov edx, [esi + WDATA.box.top] |
768 | add edx, 4 |
777 | add edx, 4 |
769 | mov ebx, [esi + WDATA.box.top] |
778 | mov ebx, [esi + WDATA.box.top] |
770 | add ebx, 20 |
779 | add ebx, 20 |
771 | mov eax, [esi + WDATA.box.top] |
780 | mov eax, [esi + WDATA.box.top] |
772 | add eax, [esi + WDATA.box.height] |
781 | add eax, [esi + WDATA.box.height] |
773 | 782 | ||
774 | cmp ebx, eax |
783 | cmp ebx, eax |
775 | jb @f |
784 | jb @f |
776 | mov ebx, eax |
785 | mov ebx, eax |
777 | ;-------------------------------------- |
786 | ;-------------------------------------- |
778 | align 4 |
787 | align 4 |
779 | @@: |
788 | @@: |
780 | push ebx |
789 | push ebx |
781 | 790 | ||
782 | xor edi, edi |
791 | xor edi, edi |
783 | ;-------------------------------------- |
792 | ;-------------------------------------- |
784 | align 4 |
793 | align 4 |
785 | .next_line: |
794 | .next_line: |
786 | mov ebx, edx |
795 | mov ebx, edx |
787 | shl ebx, 16 |
796 | shl ebx, 16 |
788 | add ebx, edx |
797 | add ebx, edx |
789 | mov eax, [esi + WDATA.box.left] |
798 | mov eax, [esi + WDATA.box.left] |
790 | shl eax, 16 |
799 | shl eax, 16 |
791 | add eax, [esi + WDATA.box.left] |
800 | add eax, [esi + WDATA.box.left] |
792 | add eax, [esi + WDATA.box.width] |
801 | add eax, [esi + WDATA.box.width] |
793 | add eax, 4 * 65536 - 4 |
802 | add eax, 4 * 65536 - 4 |
794 | mov ecx, [esi + WDATA.cl_titlebar] |
803 | mov ecx, [esi + WDATA.cl_titlebar] |
795 | test ecx, 0x40000000 |
804 | test ecx, 0x40000000 |
796 | jz @f |
805 | jz @f |
797 | add ecx, 0x00040404 |
806 | add ecx, 0x00040404 |
798 | ;-------------------------------------- |
807 | ;-------------------------------------- |
799 | align 4 |
808 | align 4 |
800 | @@: |
809 | @@: |
801 | test ecx, 0x80000000 |
810 | test ecx, 0x80000000 |
802 | jz @f |
811 | jz @f |
803 | sub ecx, 0x00040404 |
812 | sub ecx, 0x00040404 |
804 | ;-------------------------------------- |
813 | ;-------------------------------------- |
805 | align 4 |
814 | align 4 |
806 | @@: |
815 | @@: |
807 | mov [esi + WDATA.cl_titlebar], ecx |
816 | mov [esi + WDATA.cl_titlebar], ecx |
808 | and ecx, 0x00ffffff |
817 | and ecx, 0x00ffffff |
809 | ; call [draw_line] |
818 | ; call [draw_line] |
810 | call __sys_draw_line |
819 | call __sys_draw_line |
811 | inc edx |
820 | inc edx |
812 | cmp edx, [esp] |
821 | cmp edx, [esp] |
813 | jb .next_line |
822 | jb .next_line |
814 | 823 | ||
815 | add esp, 4 |
824 | add esp, 4 |
816 | pop [esi + WDATA.cl_titlebar] |
825 | pop [esi + WDATA.cl_titlebar] |
817 | ret |
826 | ret |
818 | ;------------------------------------------------------------------------------ |
827 | ;------------------------------------------------------------------------------ |
819 | align 4 |
828 | align 4 |
820 | ;------------------------------------------------------------------------------ |
829 | ;------------------------------------------------------------------------------ |
821 | drawwindow_III: ;////////////////////////////////////////////////////////////// |
830 | drawwindow_III: ;////////////////////////////////////////////////////////////// |
822 | ;------------------------------------------------------------------------------ |
831 | ;------------------------------------------------------------------------------ |
823 | ;? |
832 | ;? |
824 | ;------------------------------------------------------------------------------ |
833 | ;------------------------------------------------------------------------------ |
825 | pushad |
834 | pushad |
826 | 835 | ||
827 | ; window border |
836 | ; window border |
828 | 837 | ||
829 | mov eax, [edx + WDATA.box.left - 2] |
838 | mov eax, [edx + WDATA.box.left - 2] |
830 | mov ax, word[edx + WDATA.box.left] |
839 | mov ax, word[edx + WDATA.box.left] |
831 | add ax, word[edx + WDATA.box.width] |
840 | add ax, word[edx + WDATA.box.width] |
832 | mov ebx, [edx + WDATA.box.top - 2] |
841 | mov ebx, [edx + WDATA.box.top - 2] |
833 | mov bx, word[edx + WDATA.box.top] |
842 | mov bx, word[edx + WDATA.box.top] |
834 | add bx, word[edx + WDATA.box.height] |
843 | add bx, word[edx + WDATA.box.height] |
835 | 844 | ||
836 | mov esi, [edx + WDATA.cl_frames] |
845 | mov esi, [edx + WDATA.cl_frames] |
837 | shr esi, 1 |
846 | shr esi, 1 |
838 | and esi, 0x007f7f7f |
847 | and esi, 0x007f7f7f |
839 | call draw_rectangle |
848 | call draw_rectangle |
840 | 849 | ||
841 | push esi |
850 | push esi |
842 | mov ecx, 3 |
851 | mov ecx, 3 |
843 | mov esi, [edx + WDATA.cl_frames] |
852 | mov esi, [edx + WDATA.cl_frames] |
844 | ;-------------------------------------- |
853 | ;-------------------------------------- |
845 | align 4 |
854 | align 4 |
846 | .next_frame: |
855 | .next_frame: |
847 | add eax, 1 * 65536 - 1 |
856 | add eax, 1 * 65536 - 1 |
848 | add ebx, 1 * 65536 - 1 |
857 | add ebx, 1 * 65536 - 1 |
849 | call draw_rectangle |
858 | call draw_rectangle |
850 | dec ecx |
859 | dec ecx |
851 | jnz .next_frame |
860 | jnz .next_frame |
852 | 861 | ||
853 | pop esi |
862 | pop esi |
854 | add eax, 1 * 65536 - 1 |
863 | add eax, 1 * 65536 - 1 |
855 | add ebx, 1 * 65536 - 1 |
864 | add ebx, 1 * 65536 - 1 |
856 | call draw_rectangle |
865 | call draw_rectangle |
857 | 866 | ||
858 | ; window caption |
867 | ; window caption |
859 | 868 | ||
860 | call drawwindow_III_caption |
869 | call drawwindow_III_caption |
861 | 870 | ||
862 | ; window client area |
871 | ; window client area |
863 | 872 | ||
864 | ; do we need to draw it? |
873 | ; do we need to draw it? |
865 | mov edi, [esi + WDATA.cl_workarea] |
874 | mov edi, [esi + WDATA.cl_workarea] |
866 | test edi, 0x40000000 |
875 | test edi, 0x40000000 |
867 | jnz .exit |
876 | jnz .exit |
868 | 877 | ||
869 | ; does client area have a positive size on screen? |
878 | ; does client area have a positive size on screen? |
870 | mov edx, [esi + WDATA.box.top] |
879 | mov edx, [esi + WDATA.box.top] |
871 | add edx, 21 + 5 |
880 | add edx, 21 + 5 |
872 | mov ebx, [esi + WDATA.box.top] |
881 | mov ebx, [esi + WDATA.box.top] |
873 | add ebx, [esi + WDATA.box.height] |
882 | add ebx, [esi + WDATA.box.height] |
874 | cmp edx, ebx |
883 | cmp edx, ebx |
875 | jg .exit |
884 | jg .exit |
876 | 885 | ||
877 | ; okay, let's draw it |
886 | ; okay, let's draw it |
878 | mov eax, 5 |
887 | mov eax, 5 |
879 | mov ebx, 20 |
888 | mov ebx, 20 |
880 | mov ecx, [esi + WDATA.box.width] |
889 | mov ecx, [esi + WDATA.box.width] |
881 | mov edx, [esi + WDATA.box.height] |
890 | mov edx, [esi + WDATA.box.height] |
882 | sub ecx, 4 |
891 | sub ecx, 4 |
883 | sub edx, 4 |
892 | sub edx, 4 |
884 | ; call [drawbar] |
893 | ; call [drawbar] |
885 | call vesa20_drawbar |
894 | call vesa20_drawbar |
886 | ;-------------------------------------- |
895 | ;-------------------------------------- |
887 | align 4 |
896 | align 4 |
888 | .exit: |
897 | .exit: |
889 | popad |
898 | popad |
890 | ret |
899 | ret |
891 | ;------------------------------------------------------------------------------ |
900 | ;------------------------------------------------------------------------------ |
892 | align 4 |
901 | align 4 |
893 | ;------------------------------------------------------------------------------ |
902 | ;------------------------------------------------------------------------------ |
894 | waredraw: ;//////////////////////////////////////////////////////////////////// |
903 | waredraw: ;//////////////////////////////////////////////////////////////////// |
895 | ;------------------------------------------------------------------------------ |
904 | ;------------------------------------------------------------------------------ |
896 | ;? Activate window, redrawing if necessary |
905 | ;? Activate window, redrawing if necessary |
897 | ;------------------------------------------------------------------------------ |
906 | ;------------------------------------------------------------------------------ |
898 | push -1 |
907 | push -1 |
899 | mov eax, [TASK_COUNT] |
908 | mov eax, [TASK_COUNT] |
900 | lea eax, [WIN_POS + eax * 2] |
909 | lea eax, [WIN_POS + eax * 2] |
901 | cmp eax, esi |
910 | cmp eax, esi |
902 | pop eax |
911 | pop eax |
903 | je .exit |
912 | je .exit |
904 | 913 | ||
905 | ; is it overlapped by another window now? |
914 | ; is it overlapped by another window now? |
906 | push ecx |
915 | push ecx |
907 | call window._.check_window_draw |
916 | call window._.check_window_draw |
908 | test ecx, ecx |
917 | test ecx, ecx |
909 | pop ecx |
918 | pop ecx |
910 | jz .do_not_draw |
919 | jz .do_not_draw |
911 | 920 | ||
912 | ; yes it is, activate and update screen buffer |
921 | ; yes it is, activate and update screen buffer |
913 | call window._.window_activate |
922 | call window._.window_activate |
914 | 923 | ||
915 | pushad |
924 | pushad |
916 | mov edi, [TASK_COUNT] |
925 | mov edi, [TASK_COUNT] |
917 | movzx esi, word[WIN_POS + edi * 2] |
926 | movzx esi, word[WIN_POS + edi * 2] |
918 | shl esi, 5 |
927 | shl esi, 5 |
919 | add esi, window_data |
928 | add esi, window_data |
920 | 929 | ||
921 | mov eax, [esi + WDATA.box.left] |
930 | mov eax, [esi + WDATA.box.left] |
922 | mov ebx, [esi + WDATA.box.top] |
931 | mov ebx, [esi + WDATA.box.top] |
923 | mov ecx, [esi + WDATA.box.width] |
932 | mov ecx, [esi + WDATA.box.width] |
924 | mov edx, [esi + WDATA.box.height] |
933 | mov edx, [esi + WDATA.box.height] |
925 | 934 | ||
926 | add ecx, eax |
935 | add ecx, eax |
927 | add edx, ebx |
936 | add edx, ebx |
928 | 937 | ||
929 | mov edi, [TASK_COUNT] |
938 | mov edi, [TASK_COUNT] |
930 | movzx esi, word[WIN_POS + edi * 2] |
939 | movzx esi, word[WIN_POS + edi * 2] |
931 | call window._.set_screen |
940 | call window._.set_screen |
932 | 941 | ||
933 | call window._.set_top_wnd |
942 | call window._.set_top_wnd |
934 | 943 | ||
935 | inc [_display.mask_seqno] |
944 | inc [_display.mask_seqno] |
936 | popad |
945 | popad |
937 | 946 | ||
938 | ; tell application to redraw itself |
947 | ; tell application to redraw itself |
939 | mov [edi + WDATA.fl_redraw], 1 |
948 | mov [edi + WDATA.fl_redraw], 1 |
940 | xor eax, eax |
949 | xor eax, eax |
941 | jmp .exit |
950 | jmp .exit |
942 | ;-------------------------------------- |
951 | ;-------------------------------------- |
943 | align 4 |
952 | align 4 |
944 | .do_not_draw: |
953 | .do_not_draw: |
945 | ; no it's not, just activate the window |
954 | ; no it's not, just activate the window |
946 | call window._.window_activate |
955 | call window._.window_activate |
947 | xor eax, eax |
956 | xor eax, eax |
948 | ret |
957 | ret |
949 | 958 | ||
950 | ;-------------------------------------- |
959 | ;-------------------------------------- |
951 | align 4 |
960 | align 4 |
952 | .exit: |
961 | .exit: |
953 | inc eax |
962 | inc eax |
954 | ret |
963 | ret |
955 | ;------------------------------------------------------------------------------ |
964 | ;------------------------------------------------------------------------------ |
956 | align 4 |
965 | align 4 |
957 | ;------------------------------------------------------------------------------ |
966 | ;------------------------------------------------------------------------------ |
958 | minimize_all_window: |
967 | minimize_all_window: |
959 | push ebx ecx edx esi edi |
968 | push ebx ecx edx esi edi |
960 | pushfd |
969 | pushfd |
961 | cli |
970 | cli |
962 | xor edx, edx |
971 | xor edx, edx |
963 | mov eax, 2 ; we do not minimize the kernel thread N1 |
972 | mov eax, 2 ; we do not minimize the kernel thread N1 |
964 | mov ebx, [TASK_COUNT] |
973 | mov ebx, [TASK_COUNT] |
965 | ;-------------------------------------- |
974 | ;-------------------------------------- |
966 | align 4 |
975 | align 4 |
967 | .loop: |
976 | .loop: |
968 | movzx edi, word[WIN_POS + eax * 2] |
977 | movzx edi, word[WIN_POS + eax * 2] |
969 | shl edi, 5 |
978 | shl edi, 5 |
970 | ; it is a unused slot? |
979 | ; it is a unused slot? |
971 | cmp dword [edi+CURRENT_TASK+TASKDATA.state], 9 |
980 | cmp dword [edi+CURRENT_TASK+TASKDATA.state], 9 |
972 | je @f |
981 | je @f |
973 | ; it is a hidden thread? |
982 | ; it is a hidden thread? |
974 | lea esi, [edi*8+SLOT_BASE+APPDATA.app_name] |
983 | lea esi, [edi*8+SLOT_BASE+APPDATA.app_name] |
975 | cmp [esi], byte '@' |
984 | cmp [esi], byte '@' |
976 | je @f |
985 | je @f |
977 | ; is it already minimized? |
986 | ; is it already minimized? |
978 | test [edi + window_data+WDATA.fl_wstate], WSTATE_MINIMIZED |
987 | test [edi + window_data+WDATA.fl_wstate], WSTATE_MINIMIZED |
979 | jnz @f |
988 | jnz @f |
980 | ; no it's not, let's do that |
989 | ; no it's not, let's do that |
981 | or [edi + window_data+WDATA.fl_wstate], WSTATE_MINIMIZED |
990 | or [edi + window_data+WDATA.fl_wstate], WSTATE_MINIMIZED |
982 | inc edx |
991 | inc edx |
983 | ;-------------------------------------- |
992 | ;-------------------------------------- |
984 | align 4 |
993 | align 4 |
985 | @@: |
994 | @@: |
986 | inc eax |
995 | inc eax |
987 | cmp eax, ebx |
996 | cmp eax, ebx |
988 | jbe .loop |
997 | jbe .loop |
989 | ; If nothing has changed |
998 | ; If nothing has changed |
990 | test edx, edx |
999 | test edx, edx |
991 | jz @f |
1000 | jz @f |
992 | 1001 | ||
993 | push edx |
1002 | push edx |
994 | call syscall_display_settings.calculateScreen |
1003 | call syscall_display_settings.calculateScreen |
995 | call syscall_display_settings.redrawScreen |
1004 | call syscall_display_settings.redrawScreen |
996 | pop edx |
1005 | pop edx |
997 | ;-------------------------------------- |
1006 | ;-------------------------------------- |
998 | align 4 |
1007 | align 4 |
999 | @@: |
1008 | @@: |
1000 | mov eax, edx |
1009 | mov eax, edx |
1001 | popfd |
1010 | popfd |
1002 | pop edi esi edx ecx ebx |
1011 | pop edi esi edx ecx ebx |
1003 | ret |
1012 | ret |
1004 | ;------------------------------------------------------------------------------ |
1013 | ;------------------------------------------------------------------------------ |
1005 | align 4 |
1014 | align 4 |
1006 | ;------------------------------------------------------------------------------ |
1015 | ;------------------------------------------------------------------------------ |
1007 | minimize_window: ;///////////////////////////////////////////////////////////// |
1016 | minimize_window: ;///////////////////////////////////////////////////////////// |
1008 | ;------------------------------------------------------------------------------ |
1017 | ;------------------------------------------------------------------------------ |
1009 | ;> eax = window number on screen |
1018 | ;> eax = window number on screen |
1010 | ;------------------------------------------------------------------------------ |
1019 | ;------------------------------------------------------------------------------ |
1011 | ;# corrupts [dl*] |
1020 | ;# corrupts [dl*] |
1012 | ;------------------------------------------------------------------------------ |
1021 | ;------------------------------------------------------------------------------ |
1013 | push edi |
1022 | push edi |
1014 | pushfd |
1023 | pushfd |
1015 | cli |
1024 | cli |
1016 | 1025 | ||
1017 | ; is it already minimized? |
1026 | ; is it already minimized? |
1018 | movzx edi, word[WIN_POS + eax * 2] |
1027 | movzx edi, word[WIN_POS + eax * 2] |
1019 | shl edi, 5 |
1028 | shl edi, 5 |
1020 | add edi, window_data |
1029 | add edi, window_data |
1021 | test [edi + WDATA.fl_wstate], WSTATE_MINIMIZED |
1030 | test [edi + WDATA.fl_wstate], WSTATE_MINIMIZED |
1022 | jnz .exit |
1031 | jnz .exit |
1023 | 1032 | ||
1024 | push eax ebx ecx edx esi |
1033 | push eax ebx ecx edx esi |
1025 | 1034 | ||
1026 | ; no it's not, let's do that |
1035 | ; no it's not, let's do that |
1027 | or [edi + WDATA.fl_wstate], WSTATE_MINIMIZED |
1036 | or [edi + WDATA.fl_wstate], WSTATE_MINIMIZED |
1028 | ; If the window width is 0, then the action is not needed. |
1037 | ; If the window width is 0, then the action is not needed. |
1029 | cmp [edi + WDATA.box.width], dword 0 |
1038 | cmp [edi + WDATA.box.width], dword 0 |
1030 | je @f |
1039 | je @f |
1031 | ; If the window height is 0, then the action is not needed. |
1040 | ; If the window height is 0, then the action is not needed. |
1032 | cmp [edi + WDATA.box.height], dword 0 |
1041 | cmp [edi + WDATA.box.height], dword 0 |
1033 | je @f |
1042 | je @f |
1034 | 1043 | ||
1035 | mov eax, [edi + WDATA.box.left] |
1044 | mov eax, [edi + WDATA.box.left] |
1036 | mov [draw_limits.left], eax |
1045 | mov [draw_limits.left], eax |
1037 | mov ecx, eax |
1046 | mov ecx, eax |
1038 | add ecx, [edi + WDATA.box.width] |
1047 | add ecx, [edi + WDATA.box.width] |
1039 | mov [draw_limits.right], ecx |
1048 | mov [draw_limits.right], ecx |
1040 | mov ebx, [edi + WDATA.box.top] |
1049 | mov ebx, [edi + WDATA.box.top] |
1041 | mov [draw_limits.top], ebx |
1050 | mov [draw_limits.top], ebx |
1042 | mov edx, ebx |
1051 | mov edx, ebx |
1043 | add edx, [edi + WDATA.box.height] |
1052 | add edx, [edi + WDATA.box.height] |
1044 | mov [draw_limits.bottom], edx |
1053 | mov [draw_limits.bottom], edx |
1045 | 1054 | ||
1046 | ; DEBUGF 1, "K : minimize_window\n" |
1055 | ; DEBUGF 1, "K : minimize_window\n" |
1047 | ; DEBUGF 1, "K : dl_left %x\n",[draw_limits.left] |
1056 | ; DEBUGF 1, "K : dl_left %x\n",[draw_limits.left] |
1048 | ; DEBUGF 1, "K : dl_right %x\n",[draw_limits.right] |
1057 | ; DEBUGF 1, "K : dl_right %x\n",[draw_limits.right] |
1049 | ; DEBUGF 1, "K : dl_top %x\n",[draw_limits.top] |
1058 | ; DEBUGF 1, "K : dl_top %x\n",[draw_limits.top] |
1050 | ; DEBUGF 1, "K : dl_bottom %x\n",[draw_limits.bottom] |
1059 | ; DEBUGF 1, "K : dl_bottom %x\n",[draw_limits.bottom] |
1051 | call calculatescreen |
1060 | call calculatescreen |
1052 | ; xor esi, esi |
1061 | ; xor esi, esi |
1053 | ; xor eax, eax |
1062 | ; xor eax, eax |
1054 | mov eax, edi |
1063 | mov eax, edi |
1055 | call redrawscreen |
1064 | call redrawscreen |
1056 | ;-------------------------------------- |
1065 | ;-------------------------------------- |
1057 | align 4 |
1066 | align 4 |
1058 | @@: |
1067 | @@: |
1059 | pop esi edx ecx ebx eax |
1068 | pop esi edx ecx ebx eax |
1060 | ;-------------------------------------- |
1069 | ;-------------------------------------- |
1061 | align 4 |
1070 | align 4 |
1062 | .exit: |
1071 | .exit: |
1063 | popfd |
1072 | popfd |
1064 | pop edi |
1073 | pop edi |
1065 | ret |
1074 | ret |
1066 | ;------------------------------------------------------------------------------ |
1075 | ;------------------------------------------------------------------------------ |
1067 | align 4 |
1076 | align 4 |
1068 | ;------------------------------------------------------------------------------ |
1077 | ;------------------------------------------------------------------------------ |
1069 | restore_minimized_window: ;//////////////////////////////////////////////////// |
1078 | restore_minimized_window: ;//////////////////////////////////////////////////// |
1070 | ;------------------------------------------------------------------------------ |
1079 | ;------------------------------------------------------------------------------ |
1071 | ;> eax = window number on screen |
1080 | ;> eax = window number on screen |
1072 | ;------------------------------------------------------------------------------ |
1081 | ;------------------------------------------------------------------------------ |
1073 | ;# corrupts [dl*] |
1082 | ;# corrupts [dl*] |
1074 | ;------------------------------------------------------------------------------ |
1083 | ;------------------------------------------------------------------------------ |
1075 | pushad |
1084 | pushad |
1076 | pushfd |
1085 | pushfd |
1077 | cli |
1086 | cli |
1078 | 1087 | ||
1079 | ; is it already restored? |
1088 | ; is it already restored? |
1080 | movzx esi, word[WIN_POS + eax * 2] |
1089 | movzx esi, word[WIN_POS + eax * 2] |
1081 | mov edi, esi |
1090 | mov edi, esi |
1082 | shl edi, 5 |
1091 | shl edi, 5 |
1083 | add edi, window_data |
1092 | add edi, window_data |
1084 | test [edi + WDATA.fl_wstate], WSTATE_MINIMIZED |
1093 | test [edi + WDATA.fl_wstate], WSTATE_MINIMIZED |
1085 | jz .exit |
1094 | jz .exit |
1086 | 1095 | ||
1087 | ; no it's not, let's do that |
1096 | ; no it's not, let's do that |
1088 | mov [edi + WDATA.fl_redraw], 1 |
1097 | mov [edi + WDATA.fl_redraw], 1 |
1089 | and [edi + WDATA.fl_wstate], not WSTATE_MINIMIZED |
1098 | and [edi + WDATA.fl_wstate], not WSTATE_MINIMIZED |
1090 | mov ebp, window._.set_screen |
1099 | mov ebp, window._.set_screen |
1091 | cmp eax, [TASK_COUNT] |
1100 | cmp eax, [TASK_COUNT] |
1092 | jz @f |
1101 | jz @f |
1093 | mov ebp, calculatescreen |
1102 | mov ebp, calculatescreen |
1094 | ;-------------------------------------- |
1103 | ;-------------------------------------- |
1095 | align 4 |
1104 | align 4 |
1096 | @@: |
1105 | @@: |
1097 | mov eax, [edi + WDATA.box.left] |
1106 | mov eax, [edi + WDATA.box.left] |
1098 | mov ebx, [edi + WDATA.box.top] |
1107 | mov ebx, [edi + WDATA.box.top] |
1099 | mov ecx, [edi + WDATA.box.width] |
1108 | mov ecx, [edi + WDATA.box.width] |
1100 | mov edx, [edi + WDATA.box.height] |
1109 | mov edx, [edi + WDATA.box.height] |
1101 | add ecx, eax |
1110 | add ecx, eax |
1102 | add edx, ebx |
1111 | add edx, ebx |
1103 | call ebp |
1112 | call ebp |
1104 | 1113 | ||
1105 | cmp ebp, window._.set_screen |
1114 | cmp ebp, window._.set_screen |
1106 | jne @f |
1115 | jne @f |
1107 | call window._.set_top_wnd |
1116 | call window._.set_top_wnd |
1108 | @@: |
1117 | @@: |
1109 | inc [_display.mask_seqno] |
1118 | inc [_display.mask_seqno] |
1110 | ;-------------------------------------- |
1119 | ;-------------------------------------- |
1111 | align 4 |
1120 | align 4 |
1112 | .exit: |
1121 | .exit: |
1113 | popfd |
1122 | popfd |
1114 | popad |
1123 | popad |
1115 | ret |
1124 | ret |
1116 | ;------------------------------------------------------------------------------ |
1125 | ;------------------------------------------------------------------------------ |
1117 | align 4 |
1126 | align 4 |
1118 | ; TODO: remove this proc |
1127 | ; TODO: remove this proc |
1119 | ;------------------------------------------------------------------------------ |
1128 | ;------------------------------------------------------------------------------ |
1120 | window_check_events: ;///////////////////////////////////////////////////////// |
1129 | window_check_events: ;///////////////////////////////////////////////////////// |
1121 | ;------------------------------------------------------------------------------ |
1130 | ;------------------------------------------------------------------------------ |
1122 | ;? |
1131 | ;? |
1123 | ;------------------------------------------------------------------------------ |
1132 | ;------------------------------------------------------------------------------ |
1124 | ; do we have window minimize/restore request? |
1133 | ; do we have window minimize/restore request? |
1125 | cmp [window_minimize], 0 |
1134 | cmp [window_minimize], 0 |
1126 | je .exit |
1135 | je .exit |
1127 | 1136 | ||
1128 | ; okay, minimize or restore top-most window and exit |
1137 | ; okay, minimize or restore top-most window and exit |
1129 | mov eax, [TASK_COUNT] |
1138 | mov eax, [TASK_COUNT] |
1130 | mov bl, 0 |
1139 | mov bl, 0 |
1131 | xchg [window_minimize], bl |
1140 | xchg [window_minimize], bl |
1132 | dec bl |
1141 | dec bl |
1133 | jnz @f |
1142 | jnz @f |
1134 | call minimize_window |
1143 | call minimize_window |
1135 | jmp .exit |
1144 | jmp .exit |
1136 | ;-------------------------------------- |
1145 | ;-------------------------------------- |
1137 | align 4 |
1146 | align 4 |
1138 | @@: |
1147 | @@: |
1139 | call restore_minimized_window |
1148 | call restore_minimized_window |
1140 | ;-------------------------------------- |
1149 | ;-------------------------------------- |
1141 | align 4 |
1150 | align 4 |
1142 | .exit: |
1151 | .exit: |
1143 | ret |
1152 | ret |
1144 | ;------------------------------------------------------------------------------ |
1153 | ;------------------------------------------------------------------------------ |
1145 | align 4 |
1154 | align 4 |
1146 | ;------------------------------------------------------------------------------ |
1155 | ;------------------------------------------------------------------------------ |
1147 | sys_window_maximize_handler: ;///////////////////////////////////////////////// |
1156 | sys_window_maximize_handler: ;///////////////////////////////////////////////// |
1148 | ;------------------------------------------------------------------------------ |
1157 | ;------------------------------------------------------------------------------ |
1149 | ;? |
1158 | ;? |
1150 | ;------------------------------------------------------------------------------ |
1159 | ;------------------------------------------------------------------------------ |
1151 | ;> esi = process slot |
1160 | ;> esi = process slot |
1152 | ;------------------------------------------------------------------------------ |
1161 | ;------------------------------------------------------------------------------ |
1153 | mov edi, esi |
1162 | mov edi, esi |
1154 | shl edi, 5 |
1163 | shl edi, 5 |
1155 | add edi, window_data |
1164 | add edi, window_data |
1156 | 1165 | ||
1157 | ; can window change its height? |
1166 | ; can window change its height? |
1158 | ; only types 2 and 3 can be resized |
1167 | ; only types 2 and 3 can be resized |
1159 | mov dl, [edi + WDATA.fl_wstyle] |
1168 | mov dl, [edi + WDATA.fl_wstyle] |
1160 | test dl, 2 |
1169 | test dl, 2 |
1161 | jz .exit |
1170 | jz .exit |
1162 | 1171 | ||
1163 | ; toggle normal/maximized window state |
1172 | ; toggle normal/maximized window state |
1164 | mov bl, [edi + WDATA.fl_wstate] |
1173 | mov bl, [edi + WDATA.fl_wstate] |
1165 | xor bl, WSTATE_MAXIMIZED |
1174 | xor bl, WSTATE_MAXIMIZED |
1166 | 1175 | ||
1167 | ; calculate and set appropriate window bounds |
1176 | ; calculate and set appropriate window bounds |
1168 | test bl, WSTATE_MAXIMIZED |
1177 | test bl, WSTATE_MAXIMIZED |
1169 | jz .restore_size |
1178 | jz .restore_size |
1170 | 1179 | ||
1171 | mov eax, [screen_workarea.left] |
1180 | mov eax, [screen_workarea.left] |
1172 | mov ecx, [screen_workarea.top] |
1181 | mov ecx, [screen_workarea.top] |
1173 | push [screen_workarea.bottom] \ |
1182 | push [screen_workarea.bottom] \ |
1174 | [screen_workarea.right] \ |
1183 | [screen_workarea.right] \ |
1175 | ecx \ |
1184 | ecx \ |
1176 | eax |
1185 | eax |
1177 | sub [esp + BOX.width], eax |
1186 | sub [esp + BOX.width], eax |
1178 | sub [esp + BOX.height], ecx |
1187 | sub [esp + BOX.height], ecx |
1179 | mov eax, esp |
1188 | mov eax, esp |
1180 | jmp .set_box |
1189 | jmp .set_box |
1181 | ;-------------------------------------- |
1190 | ;-------------------------------------- |
1182 | align 4 |
1191 | align 4 |
1183 | .restore_size: |
1192 | .restore_size: |
1184 | mov eax, esi |
1193 | mov eax, esi |
1185 | shl eax, 8 |
1194 | shl eax, 8 |
1186 | add eax, SLOT_BASE + APPDATA.saved_box |
1195 | add eax, SLOT_BASE + APPDATA.saved_box |
1187 | push [eax + BOX.height] \ |
1196 | push [eax + BOX.height] \ |
1188 | [eax + BOX.width] \ |
1197 | [eax + BOX.width] \ |
1189 | [eax + BOX.top] \ |
1198 | [eax + BOX.top] \ |
1190 | [eax + BOX.left] |
1199 | [eax + BOX.left] |
1191 | mov eax, esp |
1200 | mov eax, esp |
1192 | ;-------------------------------------- |
1201 | ;-------------------------------------- |
1193 | align 4 |
1202 | align 4 |
1194 | .set_box: |
1203 | .set_box: |
1195 | test bl, WSTATE_ROLLEDUP |
1204 | test bl, WSTATE_ROLLEDUP |
1196 | jz @f |
1205 | jz @f |
1197 | 1206 | ||
1198 | xchg eax, ecx |
1207 | xchg eax, ecx |
1199 | call window._.get_rolledup_height |
1208 | call window._.get_rolledup_height |
1200 | mov [ecx + BOX.height], eax |
1209 | mov [ecx + BOX.height], eax |
1201 | xchg eax, ecx |
1210 | xchg eax, ecx |
1202 | ;-------------------------------------- |
1211 | ;-------------------------------------- |
1203 | align 4 |
1212 | align 4 |
1204 | @@: |
1213 | @@: |
1205 | call window._.set_window_box |
1214 | call window._.set_window_box |
1206 | add esp, sizeof.BOX |
1215 | add esp, sizeof.BOX |
1207 | ;-------------------------------------- |
1216 | ;-------------------------------------- |
1208 | align 4 |
1217 | align 4 |
1209 | .exit: |
1218 | .exit: |
1210 | inc [_display.mask_seqno] |
1219 | inc [_display.mask_seqno] |
1211 | ret |
1220 | ret |
1212 | ;------------------------------------------------------------------------------ |
1221 | ;------------------------------------------------------------------------------ |
1213 | align 4 |
1222 | align 4 |
1214 | ;------------------------------------------------------------------------------ |
1223 | ;------------------------------------------------------------------------------ |
1215 | sys_window_rollup_handler: ;/////////////////////////////////////////////////// |
1224 | sys_window_rollup_handler: ;/////////////////////////////////////////////////// |
1216 | ;------------------------------------------------------------------------------ |
1225 | ;------------------------------------------------------------------------------ |
1217 | ;? |
1226 | ;? |
1218 | ;------------------------------------------------------------------------------ |
1227 | ;------------------------------------------------------------------------------ |
1219 | ;> esi = process slot |
1228 | ;> esi = process slot |
1220 | ;------------------------------------------------------------------------------ |
1229 | ;------------------------------------------------------------------------------ |
1221 | mov edx, esi |
1230 | mov edx, esi |
1222 | shl edx, 8 |
1231 | shl edx, 8 |
1223 | add edx, SLOT_BASE |
1232 | add edx, SLOT_BASE |
1224 | 1233 | ||
1225 | ; toggle normal/rolled up window state |
1234 | ; toggle normal/rolled up window state |
1226 | mov bl, [edi + WDATA.fl_wstate] |
1235 | mov bl, [edi + WDATA.fl_wstate] |
1227 | xor bl, WSTATE_ROLLEDUP |
1236 | xor bl, WSTATE_ROLLEDUP |
1228 | 1237 | ||
1229 | ; calculate and set appropriate window bounds |
1238 | ; calculate and set appropriate window bounds |
1230 | test bl, WSTATE_ROLLEDUP |
1239 | test bl, WSTATE_ROLLEDUP |
1231 | jz .restore_size |
1240 | jz .restore_size |
1232 | 1241 | ||
1233 | call window._.get_rolledup_height |
1242 | call window._.get_rolledup_height |
1234 | push eax \ |
1243 | push eax \ |
1235 | [edi + WDATA.box.width] \ |
1244 | [edi + WDATA.box.width] \ |
1236 | [edi + WDATA.box.top] \ |
1245 | [edi + WDATA.box.top] \ |
1237 | [edi + WDATA.box.left] |
1246 | [edi + WDATA.box.left] |
1238 | mov eax, esp |
1247 | mov eax, esp |
1239 | jmp .set_box |
1248 | jmp .set_box |
1240 | ;-------------------------------------- |
1249 | ;-------------------------------------- |
1241 | align 4 |
1250 | align 4 |
1242 | .restore_size: |
1251 | .restore_size: |
1243 | test bl, WSTATE_MAXIMIZED |
1252 | test bl, WSTATE_MAXIMIZED |
1244 | jnz @f |
1253 | jnz @f |
1245 | add esp, -sizeof.BOX |
1254 | add esp, -sizeof.BOX |
1246 | lea eax, [edx + APPDATA.saved_box] |
1255 | lea eax, [edx + APPDATA.saved_box] |
1247 | jmp .set_box |
1256 | jmp .set_box |
1248 | ;-------------------------------------- |
1257 | ;-------------------------------------- |
1249 | align 4 |
1258 | align 4 |
1250 | @@: |
1259 | @@: |
1251 | mov eax, [screen_workarea.top] |
1260 | mov eax, [screen_workarea.top] |
1252 | push [screen_workarea.bottom] \ |
1261 | push [screen_workarea.bottom] \ |
1253 | [edi + WDATA.box.width] \ |
1262 | [edi + WDATA.box.width] \ |
1254 | eax \ |
1263 | eax \ |
1255 | [edi + WDATA.box.left] |
1264 | [edi + WDATA.box.left] |
1256 | sub [esp + BOX.height], eax |
1265 | sub [esp + BOX.height], eax |
1257 | mov eax, esp |
1266 | mov eax, esp |
1258 | ;-------------------------------------- |
1267 | ;-------------------------------------- |
1259 | align 4 |
1268 | align 4 |
1260 | .set_box: |
1269 | .set_box: |
1261 | call window._.set_window_box |
1270 | call window._.set_window_box |
1262 | add esp, sizeof.BOX |
1271 | add esp, sizeof.BOX |
1263 | ret |
1272 | ret |
1264 | ;------------------------------------------------------------------------------ |
1273 | ;------------------------------------------------------------------------------ |
1265 | align 4 |
1274 | align 4 |
1266 | ;------------------------------------------------------------------------------ |
1275 | ;------------------------------------------------------------------------------ |
1267 | ;sys_window_start_moving_handler: ;///////////////////////////////////////////// |
1276 | ;sys_window_start_moving_handler: ;///////////////////////////////////////////// |
1268 | ;------------------------------------------------------------------------------ |
1277 | ;------------------------------------------------------------------------------ |
1269 | ;? |
1278 | ;? |
1270 | ;------------------------------------------------------------------------------ |
1279 | ;------------------------------------------------------------------------------ |
1271 | ;> eax = old (original) window box |
1280 | ;> eax = old (original) window box |
1272 | ;> esi = process slot |
1281 | ;> esi = process slot |
1273 | ;------------------------------------------------------------------------------ |
1282 | ;------------------------------------------------------------------------------ |
1274 | ; mov edi, eax |
1283 | ; mov edi, eax |
1275 | ; call window._.draw_negative_box |
1284 | ; call window._.draw_negative_box |
1276 | ; ret |
1285 | ; ret |
1277 | ;------------------------------------------------------------------------------ |
1286 | ;------------------------------------------------------------------------------ |
1278 | align 4 |
1287 | align 4 |
1279 | ;------------------------------------------------------------------------------ |
1288 | ;------------------------------------------------------------------------------ |
1280 | sys_window_end_moving_handler: ;/////////////////////////////////////////////// |
1289 | sys_window_end_moving_handler: ;/////////////////////////////////////////////// |
1281 | ;------------------------------------------------------------------------------ |
1290 | ;------------------------------------------------------------------------------ |
1282 | ;? |
1291 | ;? |
1283 | ;------------------------------------------------------------------------------ |
1292 | ;------------------------------------------------------------------------------ |
1284 | ;> eax = old (original) window box |
1293 | ;> eax = old (original) window box |
1285 | ;> ebx = new (final) window box |
1294 | ;> ebx = new (final) window box |
1286 | ;> esi = process slot |
1295 | ;> esi = process slot |
1287 | ;------------------------------------------------------------------------------ |
1296 | ;------------------------------------------------------------------------------ |
1288 | ; mov edi, ebx |
1297 | ; mov edi, ebx |
1289 | ; call window._.end_moving__box |
1298 | ; call window._.end_moving__box |
1290 | 1299 | ||
1291 | mov edi, esi |
1300 | mov edi, esi |
1292 | shl edi, 5 |
1301 | shl edi, 5 |
1293 | add edi, window_data |
1302 | add edi, window_data |
1294 | 1303 | ||
1295 | test [fl_moving], 1 |
1304 | test [fl_moving], 1 |
1296 | jz @f |
1305 | jz @f |
1297 | 1306 | ||
1298 | push edi |
1307 | push edi |
1299 | mov edi, ebx |
1308 | mov edi, ebx |
1300 | call window._.draw_negative_box |
1309 | call window._.draw_negative_box |
1301 | pop edi |
1310 | pop edi |
1302 | @@: |
1311 | @@: |
1303 | 1312 | ||
1304 | mov eax, ebx |
1313 | mov eax, ebx |
1305 | mov bl, [edi + WDATA.fl_wstate] |
1314 | mov bl, [edi + WDATA.fl_wstate] |
1306 | call window._.set_window_box |
1315 | call window._.set_window_box |
1307 | ret |
1316 | ret |
1308 | ;------------------------------------------------------------------------------ |
1317 | ;------------------------------------------------------------------------------ |
1309 | align 4 |
1318 | align 4 |
1310 | ;------------------------------------------------------------------------------ |
1319 | ;------------------------------------------------------------------------------ |
1311 | sys_window_moving_handler: ;/////////////////////////////////////////////////// |
1320 | sys_window_moving_handler: ;/////////////////////////////////////////////////// |
1312 | ;------------------------------------------------------------------------------ |
1321 | ;------------------------------------------------------------------------------ |
1313 | ;? |
1322 | ;? |
1314 | ;------------------------------------------------------------------------------ |
1323 | ;------------------------------------------------------------------------------ |
1315 | ;> eax = old (from previous call) window box |
1324 | ;> eax = old (from previous call) window box |
1316 | ;> ebx = new (current) window box |
1325 | ;> ebx = new (current) window box |
1317 | ;> esi = process_slot |
1326 | ;> esi = process_slot |
1318 | ;------------------------------------------------------------------------------ |
1327 | ;------------------------------------------------------------------------------ |
1319 | mov edi, eax |
1328 | mov edi, eax |
1320 | call window._.draw_negative_box |
1329 | call window._.draw_negative_box |
1321 | mov edi, ebx |
1330 | mov edi, ebx |
1322 | call window._.draw_negative_box |
1331 | call window._.draw_negative_box |
1323 | ret |
1332 | ret |
1324 | ;============================================================================== |
1333 | ;============================================================================== |
1325 | ;///// private functions ////////////////////////////////////////////////////// |
1334 | ;///// private functions ////////////////////////////////////////////////////// |
1326 | ;============================================================================== |
1335 | ;============================================================================== |
1327 | 1336 | ||
1328 | iglobal |
1337 | iglobal |
1329 | align 4 |
1338 | align 4 |
1330 | window_topleft dd \ |
1339 | window_topleft dd \ |
1331 | 1, 21, \ ;type 0 |
1340 | 1, 21, \ ;type 0 |
1332 | 0, 0, \ ;type 1 |
1341 | 0, 0, \ ;type 1 |
1333 | 5, 20, \ ;type 2 |
1342 | 5, 20, \ ;type 2 |
1334 | 5, ?, \ ;type 3 {set by skin} |
1343 | 5, ?, \ ;type 3 {set by skin} |
1335 | 5, ? ;type 4 {set by skin} |
1344 | 5, ? ;type 4 {set by skin} |
1336 | endg |
1345 | endg |
1337 | 1346 | ||
1338 | ;------------------------------------------------------------------------------ |
1347 | ;------------------------------------------------------------------------------ |
1339 | align 4 |
1348 | align 4 |
1340 | ;------------------------------------------------------------------------------ |
1349 | ;------------------------------------------------------------------------------ |
1341 | window._.invalidate_screen: ;////////////////////////////////////////////////// |
1350 | window._.invalidate_screen: ;////////////////////////////////////////////////// |
1342 | ;------------------------------------------------------------------------------ |
1351 | ;------------------------------------------------------------------------------ |
1343 | ;? |
1352 | ;? |
1344 | ;------------------------------------------------------------------------------ |
1353 | ;------------------------------------------------------------------------------ |
1345 | ;> eax = old (original) window box |
1354 | ;> eax = old (original) window box |
1346 | ;> ebx = new (final) window box |
1355 | ;> ebx = new (final) window box |
1347 | ;> edi = pointer to WDATA struct |
1356 | ;> edi = pointer to WDATA struct |
1348 | ;------------------------------------------------------------------------------ |
1357 | ;------------------------------------------------------------------------------ |
1349 | push eax ebx |
1358 | push eax ebx |
1350 | 1359 | ||
1351 | ; TODO: do we really need `draw_limits`? |
1360 | ; TODO: do we really need `draw_limits`? |
1352 | ; Yes, they are used by background drawing code. |
1361 | ; Yes, they are used by background drawing code. |
1353 | 1362 | ||
1354 | ; we need only to restore the background windows at the old place! |
1363 | ; we need only to restore the background windows at the old place! |
1355 | mov ecx, [ebx + BOX.left] |
1364 | mov ecx, [ebx + BOX.left] |
1356 | mov [draw_limits.left], ecx |
1365 | mov [draw_limits.left], ecx |
1357 | add ecx, [ebx + BOX.width] |
1366 | add ecx, [ebx + BOX.width] |
1358 | mov [draw_limits.right], ecx |
1367 | mov [draw_limits.right], ecx |
1359 | mov ecx, [ebx + BOX.top] |
1368 | mov ecx, [ebx + BOX.top] |
1360 | mov [draw_limits.top], ecx |
1369 | mov [draw_limits.top], ecx |
1361 | add ecx, [ebx + BOX.height] |
1370 | add ecx, [ebx + BOX.height] |
1362 | mov [draw_limits.bottom], ecx |
1371 | mov [draw_limits.bottom], ecx |
1363 | ; recalculate screen buffer at old position |
1372 | ; recalculate screen buffer at old position |
1364 | push ebx |
1373 | push ebx |
1365 | mov edx, [eax + BOX.height] |
1374 | mov edx, [eax + BOX.height] |
1366 | mov ecx, [eax + BOX.width] |
1375 | mov ecx, [eax + BOX.width] |
1367 | mov ebx, [eax + BOX.top] |
1376 | mov ebx, [eax + BOX.top] |
1368 | mov eax, [eax + BOX.left] |
1377 | mov eax, [eax + BOX.left] |
1369 | add ecx, eax |
1378 | add ecx, eax |
1370 | add edx, ebx |
1379 | add edx, ebx |
1371 | call calculatescreen |
1380 | call calculatescreen |
1372 | pop eax |
1381 | pop eax |
1373 | ; recalculate screen buffer at new position |
1382 | ; recalculate screen buffer at new position |
1374 | mov edx, [eax + BOX.height] |
1383 | mov edx, [eax + BOX.height] |
1375 | mov ecx, [eax + BOX.width] |
1384 | mov ecx, [eax + BOX.width] |
1376 | mov ebx, [eax + BOX.top] |
1385 | mov ebx, [eax + BOX.top] |
1377 | mov eax, [eax + BOX.left] |
1386 | mov eax, [eax + BOX.left] |
1378 | add ecx, eax |
1387 | add ecx, eax |
1379 | add edx, ebx |
1388 | add edx, ebx |
1380 | call calculatescreen |
1389 | call calculatescreen |
1381 | 1390 | ||
1382 | mov eax, edi |
1391 | mov eax, edi |
1383 | call redrawscreen |
1392 | call redrawscreen |
1384 | 1393 | ||
1385 | ; tell window to redraw itself |
1394 | ; tell window to redraw itself |
1386 | mov [edi + WDATA.fl_redraw], 1 |
1395 | mov [edi + WDATA.fl_redraw], 1 |
1387 | 1396 | ||
1388 | pop ebx eax |
1397 | pop ebx eax |
1389 | ret |
1398 | ret |
1390 | ;------------------------------------------------------------------------------ |
1399 | ;------------------------------------------------------------------------------ |
1391 | align 4 |
1400 | align 4 |
1392 | ;------------------------------------------------------------------------------ |
1401 | ;------------------------------------------------------------------------------ |
1393 | window._.set_window_box: ;///////////////////////////////////////////////////// |
1402 | window._.set_window_box: ;///////////////////////////////////////////////////// |
1394 | ;------------------------------------------------------------------------------ |
1403 | ;------------------------------------------------------------------------------ |
1395 | ;? |
1404 | ;? |
1396 | ;------------------------------------------------------------------------------ |
1405 | ;------------------------------------------------------------------------------ |
1397 | ;> eax = pointer to BOX struct |
1406 | ;> eax = pointer to BOX struct |
1398 | ;> bl = new window state flags |
1407 | ;> bl = new window state flags |
1399 | ;> edi = pointer to WDATA struct |
1408 | ;> edi = pointer to WDATA struct |
1400 | ;------------------------------------------------------------------------------ |
1409 | ;------------------------------------------------------------------------------ |
1401 | push eax ebx esi |
1410 | push eax ebx esi |
1402 | 1411 | ||
1403 | ; don't do anything if the new box is identical to the old |
1412 | ; don't do anything if the new box is identical to the old |
1404 | cmp bl, [edi + WDATA.fl_wstate] |
1413 | cmp bl, [edi + WDATA.fl_wstate] |
1405 | jnz @f |
1414 | jnz @f |
1406 | mov esi, eax |
1415 | mov esi, eax |
1407 | push edi |
1416 | push edi |
1408 | if WDATA.box |
1417 | if WDATA.box |
1409 | add edi, WDATA.box |
1418 | add edi, WDATA.box |
1410 | end if |
1419 | end if |
1411 | mov ecx, 4 |
1420 | mov ecx, 4 |
1412 | repz cmpsd |
1421 | repz cmpsd |
1413 | pop edi |
1422 | pop edi |
1414 | jz .exit |
1423 | jz .exit |
1415 | ;-------------------------------------- |
1424 | ;-------------------------------------- |
1416 | align 4 |
1425 | align 4 |
1417 | @@: |
1426 | @@: |
1418 | add esp, -sizeof.BOX |
1427 | add esp, -sizeof.BOX |
1419 | mov ebx, esp |
1428 | mov ebx, esp |
1420 | if WDATA.box |
1429 | if WDATA.box |
1421 | lea esi, [edi + WDATA.box] |
1430 | lea esi, [edi + WDATA.box] |
1422 | else |
1431 | else |
1423 | mov esi, edi ; optimization for WDATA.box = 0 |
1432 | mov esi, edi ; optimization for WDATA.box = 0 |
1424 | end if |
1433 | end if |
1425 | xchg eax, esi |
1434 | xchg eax, esi |
1426 | mov ecx, sizeof.BOX |
1435 | mov ecx, sizeof.BOX |
1427 | call memmove |
1436 | call memmove |
1428 | xchg eax, esi |
1437 | xchg eax, esi |
1429 | xchg ebx, esi |
1438 | xchg ebx, esi |
1430 | call memmove |
1439 | call memmove |
1431 | mov eax, ebx |
1440 | mov eax, ebx |
1432 | mov ebx, esi |
1441 | mov ebx, esi |
1433 | call window._.check_window_position |
1442 | call window._.check_window_position |
1434 | call window._.set_window_clientbox |
1443 | call window._.set_window_clientbox |
1435 | call window._.invalidate_screen |
1444 | call window._.invalidate_screen |
1436 | 1445 | ||
1437 | add esp, sizeof.BOX |
1446 | add esp, sizeof.BOX |
1438 | 1447 | ||
1439 | mov cl, [esp + 4] |
1448 | mov cl, [esp + 4] |
1440 | mov ch, cl |
1449 | mov ch, cl |
1441 | xchg cl, [edi + WDATA.fl_wstate] |
1450 | xchg cl, [edi + WDATA.fl_wstate] |
1442 | 1451 | ||
1443 | or cl, ch |
1452 | or cl, ch |
1444 | test cl, WSTATE_MAXIMIZED |
1453 | test cl, WSTATE_MAXIMIZED |
1445 | jnz .exit |
1454 | jnz .exit |
1446 | 1455 | ||
1447 | mov eax, edi |
1456 | mov eax, edi |
1448 | sub eax, window_data |
1457 | sub eax, window_data |
1449 | shl eax, 3 |
1458 | shl eax, 3 |
1450 | add eax, SLOT_BASE |
1459 | add eax, SLOT_BASE |
1451 | 1460 | ||
1452 | lea ebx, [edi + WDATA.box] |
1461 | lea ebx, [edi + WDATA.box] |
1453 | xchg esp, ebx |
1462 | xchg esp, ebx |
1454 | 1463 | ||
1455 | pop [eax + APPDATA.saved_box.left] \ |
1464 | pop [eax + APPDATA.saved_box.left] \ |
1456 | [eax + APPDATA.saved_box.top] \ |
1465 | [eax + APPDATA.saved_box.top] \ |
1457 | [eax + APPDATA.saved_box.width] \ |
1466 | [eax + APPDATA.saved_box.width] \ |
1458 | edx |
1467 | edx |
1459 | 1468 | ||
1460 | xchg esp, ebx |
1469 | xchg esp, ebx |
1461 | 1470 | ||
1462 | test ch, WSTATE_ROLLEDUP |
1471 | test ch, WSTATE_ROLLEDUP |
1463 | jnz .exit |
1472 | jnz .exit |
1464 | 1473 | ||
1465 | mov [eax + APPDATA.saved_box.height], edx |
1474 | mov [eax + APPDATA.saved_box.height], edx |
1466 | ;-------------------------------------- |
1475 | ;-------------------------------------- |
1467 | align 4 |
1476 | align 4 |
1468 | .exit: |
1477 | .exit: |
1469 | pop esi ebx eax |
1478 | pop esi ebx eax |
1470 | ret |
1479 | ret |
1471 | ;------------------------------------------------------------------------------ |
1480 | ;------------------------------------------------------------------------------ |
1472 | align 4 |
1481 | align 4 |
1473 | ;------------------------------------------------------------------------------ |
1482 | ;------------------------------------------------------------------------------ |
1474 | window._.set_window_clientbox: ;/////////////////////////////////////////////// |
1483 | window._.set_window_clientbox: ;/////////////////////////////////////////////// |
1475 | ;------------------------------------------------------------------------------ |
1484 | ;------------------------------------------------------------------------------ |
1476 | ;? |
1485 | ;? |
1477 | ;------------------------------------------------------------------------------ |
1486 | ;------------------------------------------------------------------------------ |
1478 | ;> edi = pointer to WDATA struct |
1487 | ;> edi = pointer to WDATA struct |
1479 | ;------------------------------------------------------------------------------ |
1488 | ;------------------------------------------------------------------------------ |
1480 | push eax ecx edi |
1489 | push eax ecx edi |
1481 | 1490 | ||
1482 | mov eax, [_skinh] |
1491 | mov eax, [_skinh] |
1483 | mov [window_topleft + 8 * 3 + 4], eax |
1492 | mov [window_topleft + 8 * 3 + 4], eax |
1484 | mov [window_topleft + 8 * 4 + 4], eax |
1493 | mov [window_topleft + 8 * 4 + 4], eax |
1485 | 1494 | ||
1486 | mov ecx, edi |
1495 | mov ecx, edi |
1487 | sub edi, window_data |
1496 | sub edi, window_data |
1488 | shl edi, 3 |
1497 | shl edi, 3 |
1489 | test [ecx + WDATA.fl_wstyle], WSTYLE_CLIENTRELATIVE |
1498 | test [ecx + WDATA.fl_wstyle], WSTYLE_CLIENTRELATIVE |
1490 | jz .whole_window |
1499 | jz .whole_window |
1491 | 1500 | ||
1492 | movzx eax, [ecx + WDATA.fl_wstyle] |
1501 | movzx eax, [ecx + WDATA.fl_wstyle] |
1493 | and eax, 0x0F |
1502 | and eax, 0x0F |
1494 | mov eax, [eax * 8 + window_topleft + 0] |
1503 | mov eax, [eax * 8 + window_topleft + 0] |
1495 | mov [edi + SLOT_BASE + APPDATA.wnd_clientbox.left], eax |
1504 | mov [edi + SLOT_BASE + APPDATA.wnd_clientbox.left], eax |
1496 | shl eax, 1 |
1505 | shl eax, 1 |
1497 | neg eax |
1506 | neg eax |
1498 | add eax, [ecx + WDATA.box.width] |
1507 | add eax, [ecx + WDATA.box.width] |
1499 | mov [edi + SLOT_BASE + APPDATA.wnd_clientbox.width], eax |
1508 | mov [edi + SLOT_BASE + APPDATA.wnd_clientbox.width], eax |
1500 | 1509 | ||
1501 | movzx eax, [ecx + WDATA.fl_wstyle] |
1510 | movzx eax, [ecx + WDATA.fl_wstyle] |
1502 | and eax, 0x0F |
1511 | and eax, 0x0F |
1503 | push [eax * 8 + window_topleft + 0] |
1512 | push [eax * 8 + window_topleft + 0] |
1504 | mov eax, [eax * 8 + window_topleft + 4] |
1513 | mov eax, [eax * 8 + window_topleft + 4] |
1505 | mov [edi + SLOT_BASE + APPDATA.wnd_clientbox.top], eax |
1514 | mov [edi + SLOT_BASE + APPDATA.wnd_clientbox.top], eax |
1506 | neg eax |
1515 | neg eax |
1507 | sub eax, [esp] |
1516 | sub eax, [esp] |
1508 | add eax, [ecx + WDATA.box.height] |
1517 | add eax, [ecx + WDATA.box.height] |
1509 | mov [edi + SLOT_BASE + APPDATA.wnd_clientbox.height], eax |
1518 | mov [edi + SLOT_BASE + APPDATA.wnd_clientbox.height], eax |
1510 | add esp, 4 |
1519 | add esp, 4 |
1511 | jmp .exit |
1520 | jmp .exit |
1512 | ;-------------------------------------- |
1521 | ;-------------------------------------- |
1513 | align 4 |
1522 | align 4 |
1514 | .whole_window: |
1523 | .whole_window: |
1515 | xor eax, eax |
1524 | xor eax, eax |
1516 | mov [edi + SLOT_BASE + APPDATA.wnd_clientbox.left], eax |
1525 | mov [edi + SLOT_BASE + APPDATA.wnd_clientbox.left], eax |
1517 | mov [edi + SLOT_BASE + APPDATA.wnd_clientbox.top], eax |
1526 | mov [edi + SLOT_BASE + APPDATA.wnd_clientbox.top], eax |
1518 | mov eax, [ecx + WDATA.box.width] |
1527 | mov eax, [ecx + WDATA.box.width] |
1519 | mov [edi + SLOT_BASE + APPDATA.wnd_clientbox.width], eax |
1528 | mov [edi + SLOT_BASE + APPDATA.wnd_clientbox.width], eax |
1520 | mov eax, [ecx + WDATA.box.height] |
1529 | mov eax, [ecx + WDATA.box.height] |
1521 | mov [edi + SLOT_BASE + APPDATA.wnd_clientbox.height], eax |
1530 | mov [edi + SLOT_BASE + APPDATA.wnd_clientbox.height], eax |
1522 | ;-------------------------------------- |
1531 | ;-------------------------------------- |
1523 | align 4 |
1532 | align 4 |
1524 | .exit: |
1533 | .exit: |
1525 | pop edi ecx eax |
1534 | pop edi ecx eax |
1526 | ret |
1535 | ret |
1527 | ;------------------------------------------------------------------------------ |
1536 | ;------------------------------------------------------------------------------ |
1528 | align 4 |
1537 | align 4 |
1529 | ;------------------------------------------------------------------------------ |
1538 | ;------------------------------------------------------------------------------ |
1530 | window._.sys_set_window: ;///////////////////////////////////////////////////// |
1539 | window._.sys_set_window: ;///////////////////////////////////////////////////// |
1531 | ;------------------------------------------------------------------------------ |
1540 | ;------------------------------------------------------------------------------ |
1532 | ;? |
1541 | ;? |
1533 | ;------------------------------------------------------------------------------ |
1542 | ;------------------------------------------------------------------------------ |
1534 | ;< edx = pointer to WDATA struct |
1543 | ;< edx = pointer to WDATA struct |
1535 | ;------------------------------------------------------------------------------ |
1544 | ;------------------------------------------------------------------------------ |
1536 | mov eax, [CURRENT_TASK] |
1545 | mov eax, [CURRENT_TASK] |
1537 | shl eax, 5 |
1546 | shl eax, 5 |
1538 | add eax, window_data |
1547 | add eax, window_data |
1539 | ; save window colors |
1548 | ; save window colors |
1540 | mov [eax + WDATA.cl_workarea], edx |
1549 | mov [eax + WDATA.cl_workarea], edx |
1541 | mov [eax + WDATA.cl_titlebar], esi |
1550 | mov [eax + WDATA.cl_titlebar], esi |
1542 | mov [eax + WDATA.cl_frames], edi |
1551 | mov [eax + WDATA.cl_frames], edi |
1543 | mov edi, eax |
1552 | mov edi, eax |
1544 | ; Was it already defined before? |
1553 | ; Was it already defined before? |
1545 | test [edi + WDATA.fl_wdrawn], 1 |
1554 | test [edi + WDATA.fl_wdrawn], 1 |
1546 | jnz .set_client_box |
1555 | jnz .set_client_box |
1547 | ; No, it wasn't. After first draw_window we need redraw mouse necessarily! |
1556 | ; No, it wasn't. After first draw_window we need redraw mouse necessarily! |
1548 | ; Otherwise the user can see cursor specified by f.37.5 from another window. |
1557 | ; Otherwise the user can see cursor specified by f.37.5 from another window. |
1549 | ; He will be really unhappy! Usually, he will be enraged! |
1558 | ; He will be really unhappy! Usually, he will be enraged! |
1550 | or [edi + WDATA.fl_wdrawn], 1 |
1559 | or [edi + WDATA.fl_wdrawn], 1 |
1551 | mov [redrawmouse_unconditional], 1 |
1560 | mov [redrawmouse_unconditional], 1 |
1552 | call wakeup_osloop |
1561 | call wakeup_osloop |
1553 | ; performing initial window definition |
1562 | ; performing initial window definition |
1554 | movzx eax, bx |
1563 | movzx eax, bx |
1555 | mov [edi + WDATA.box.width], eax |
1564 | mov [edi + WDATA.box.width], eax |
1556 | movzx eax, cx |
1565 | movzx eax, cx |
1557 | mov [edi + WDATA.box.height], eax |
1566 | mov [edi + WDATA.box.height], eax |
1558 | sar ebx, 16 |
1567 | sar ebx, 16 |
1559 | sar ecx, 16 |
1568 | sar ecx, 16 |
1560 | mov [edi + WDATA.box.left], ebx |
1569 | mov [edi + WDATA.box.left], ebx |
1561 | mov [edi + WDATA.box.top], ecx |
1570 | mov [edi + WDATA.box.top], ecx |
1562 | 1571 | ||
1563 | call window._.check_window_position |
1572 | call window._.check_window_position |
1564 | 1573 | ||
1565 | push ecx edi |
1574 | push ecx edi |
1566 | 1575 | ||
1567 | mov cl, [edi + WDATA.fl_wstyle] |
1576 | mov cl, [edi + WDATA.fl_wstyle] |
1568 | mov eax, [edi + WDATA.cl_frames] |
1577 | mov eax, [edi + WDATA.cl_frames] |
1569 | 1578 | ||
1570 | sub edi, window_data |
1579 | sub edi, window_data |
1571 | shl edi, 3 |
1580 | shl edi, 3 |
1572 | add edi, SLOT_BASE |
1581 | add edi, SLOT_BASE |
1573 | 1582 | ||
1574 | and cl, 0x0F |
1583 | and cl, 0x0F |
1575 | cmp cl, 3 |
1584 | cmp cl, 3 |
1576 | je @f |
1585 | je @f |
1577 | cmp cl, 4 |
1586 | cmp cl, 4 |
1578 | je @f |
1587 | je @f |
1579 | 1588 | ||
1580 | xor eax, eax |
1589 | xor eax, eax |
1581 | ;-------------------------------------- |
1590 | ;-------------------------------------- |
1582 | align 4 |
1591 | align 4 |
1583 | @@: |
1592 | @@: |
1584 | mov [edi + APPDATA.wnd_caption], eax |
1593 | mov [edi + APPDATA.wnd_caption], eax |
1585 | 1594 | ||
1586 | mov esi, [esp] |
1595 | mov esi, [esp] |
1587 | add edi, APPDATA.saved_box |
1596 | add edi, APPDATA.saved_box |
1588 | movsd |
1597 | movsd |
1589 | movsd |
1598 | movsd |
1590 | movsd |
1599 | movsd |
1591 | movsd |
1600 | movsd |
1592 | 1601 | ||
1593 | pop edi ecx |
1602 | pop edi ecx |
1594 | 1603 | ||
1595 | mov esi, [CURRENT_TASK] |
1604 | mov esi, [CURRENT_TASK] |
1596 | movzx esi, word[WIN_STACK + esi * 2] |
1605 | movzx esi, word[WIN_STACK + esi * 2] |
1597 | lea esi, [WIN_POS + esi * 2] |
1606 | lea esi, [WIN_POS + esi * 2] |
1598 | call waredraw |
1607 | call waredraw |
1599 | 1608 | ||
1600 | mov eax, [edi + WDATA.box.left] |
1609 | mov eax, [edi + WDATA.box.left] |
1601 | mov ebx, [edi + WDATA.box.top] |
1610 | mov ebx, [edi + WDATA.box.top] |
1602 | mov ecx, [edi + WDATA.box.width] |
1611 | mov ecx, [edi + WDATA.box.width] |
1603 | mov edx, [edi + WDATA.box.height] |
1612 | mov edx, [edi + WDATA.box.height] |
1604 | add ecx, eax |
1613 | add ecx, eax |
1605 | add edx, ebx |
1614 | add edx, ebx |
1606 | call calculatescreen |
1615 | call calculatescreen |
1607 | 1616 | ||
1608 | mov byte[KEY_COUNT], 0 ; empty keyboard buffer |
1617 | mov byte[KEY_COUNT], 0 ; empty keyboard buffer |
1609 | mov byte[BTN_COUNT], 0 ; empty button buffer |
1618 | mov byte[BTN_COUNT], 0 ; empty button buffer |
1610 | ;-------------------------------------- |
1619 | ;-------------------------------------- |
1611 | align 4 |
1620 | align 4 |
1612 | .set_client_box: |
1621 | .set_client_box: |
1613 | ; update window client box coordinates |
1622 | ; update window client box coordinates |
1614 | call window._.set_window_clientbox |
1623 | call window._.set_window_clientbox |
1615 | 1624 | ||
1616 | ; reset window redraw flag and exit |
1625 | ; reset window redraw flag and exit |
1617 | mov [edi + WDATA.fl_redraw], 0 |
1626 | mov [edi + WDATA.fl_redraw], 0 |
1618 | mov edx, edi |
1627 | mov edx, edi |
1619 | ret |
1628 | ret |
1620 | ;------------------------------------------------------------------------------ |
1629 | ;------------------------------------------------------------------------------ |
1621 | align 4 |
1630 | align 4 |
1622 | ;------------------------------------------------------------------------------ |
1631 | ;------------------------------------------------------------------------------ |
1623 | window._.check_window_position: ;////////////////////////////////////////////// |
1632 | window._.check_window_position: ;////////////////////////////////////////////// |
1624 | ;------------------------------------------------------------------------------ |
1633 | ;------------------------------------------------------------------------------ |
1625 | ;? Check if window is inside screen area |
1634 | ;? Check if window is inside screen area |
1626 | ;------------------------------------------------------------------------------ |
1635 | ;------------------------------------------------------------------------------ |
1627 | ;> edi = pointer to WDATA |
1636 | ;> edi = pointer to WDATA |
1628 | ;------------------------------------------------------------------------------ |
1637 | ;------------------------------------------------------------------------------ |
1629 | push eax ebx ecx edx esi |
1638 | push eax ebx ecx edx esi |
1630 | 1639 | ||
1631 | mov eax, [edi + WDATA.box.left] |
1640 | mov eax, [edi + WDATA.box.left] |
1632 | mov ebx, [edi + WDATA.box.top] |
1641 | mov ebx, [edi + WDATA.box.top] |
1633 | mov ecx, [edi + WDATA.box.width] |
1642 | mov ecx, [edi + WDATA.box.width] |
1634 | mov edx, [edi + WDATA.box.height] |
1643 | mov edx, [edi + WDATA.box.height] |
1635 | 1644 | ||
1636 | mov esi, [_display.width] |
1645 | mov esi, [_display.width] |
1637 | cmp ecx, esi |
1646 | cmp ecx, esi |
1638 | jae .fix_width_high |
1647 | jae .fix_width_high |
1639 | ;-------------------------------------- |
1648 | ;-------------------------------------- |
1640 | align 4 |
1649 | align 4 |
1641 | .check_left: |
1650 | .check_left: |
1642 | or eax, eax |
1651 | or eax, eax |
1643 | jl .fix_left_low |
1652 | jl .fix_left_low |
1644 | add eax, ecx |
1653 | add eax, ecx |
1645 | cmp eax, esi |
1654 | cmp eax, esi |
1646 | jge .fix_left_high |
1655 | jge .fix_left_high |
1647 | ;-------------------------------------- |
1656 | ;-------------------------------------- |
1648 | align 4 |
1657 | align 4 |
1649 | .check_height: |
1658 | .check_height: |
1650 | mov esi, [_display.height] |
1659 | mov esi, [_display.height] |
1651 | cmp edx, esi |
1660 | cmp edx, esi |
1652 | jae .fix_height_high |
1661 | jae .fix_height_high |
1653 | ;-------------------------------------- |
1662 | ;-------------------------------------- |
1654 | align 4 |
1663 | align 4 |
1655 | .check_top: |
1664 | .check_top: |
1656 | or ebx, ebx |
1665 | or ebx, ebx |
1657 | jl .fix_top_low |
1666 | jl .fix_top_low |
1658 | add ebx, edx |
1667 | add ebx, edx |
1659 | cmp ebx, esi |
1668 | cmp ebx, esi |
1660 | jge .fix_top_high |
1669 | jge .fix_top_high |
1661 | ;-------------------------------------- |
1670 | ;-------------------------------------- |
1662 | align 4 |
1671 | align 4 |
1663 | .exit: |
1672 | .exit: |
1664 | pop esi edx ecx ebx eax |
1673 | pop esi edx ecx ebx eax |
1665 | ret |
1674 | ret |
1666 | ;-------------------------------------- |
1675 | ;-------------------------------------- |
1667 | align 4 |
1676 | align 4 |
1668 | .fix_width_high: |
1677 | .fix_width_high: |
1669 | mov ecx, esi |
1678 | mov ecx, esi |
1670 | mov [edi + WDATA.box.width], esi |
1679 | mov [edi + WDATA.box.width], esi |
1671 | jmp .check_left |
1680 | jmp .check_left |
1672 | ;-------------------------------------- |
1681 | ;-------------------------------------- |
1673 | align 4 |
1682 | align 4 |
1674 | .fix_left_low: |
1683 | .fix_left_low: |
1675 | xor eax, eax |
1684 | xor eax, eax |
1676 | mov [edi + WDATA.box.left], eax |
1685 | mov [edi + WDATA.box.left], eax |
1677 | jmp .check_height |
1686 | jmp .check_height |
1678 | ;-------------------------------------- |
1687 | ;-------------------------------------- |
1679 | align 4 |
1688 | align 4 |
1680 | .fix_left_high: |
1689 | .fix_left_high: |
1681 | mov eax, esi |
1690 | mov eax, esi |
1682 | sub eax, ecx |
1691 | sub eax, ecx |
1683 | mov [edi + WDATA.box.left], eax |
1692 | mov [edi + WDATA.box.left], eax |
1684 | jmp .check_height |
1693 | jmp .check_height |
1685 | ;-------------------------------------- |
1694 | ;-------------------------------------- |
1686 | align 4 |
1695 | align 4 |
1687 | .fix_height_high: |
1696 | .fix_height_high: |
1688 | mov edx, esi |
1697 | mov edx, esi |
1689 | mov [edi + WDATA.box.height], esi |
1698 | mov [edi + WDATA.box.height], esi |
1690 | jmp .check_top |
1699 | jmp .check_top |
1691 | ;-------------------------------------- |
1700 | ;-------------------------------------- |
1692 | align 4 |
1701 | align 4 |
1693 | .fix_top_low: |
1702 | .fix_top_low: |
1694 | xor ebx, ebx |
1703 | xor ebx, ebx |
1695 | mov [edi + WDATA.box.top], ebx |
1704 | mov [edi + WDATA.box.top], ebx |
1696 | jmp .exit |
1705 | jmp .exit |
1697 | ;-------------------------------------- |
1706 | ;-------------------------------------- |
1698 | align 4 |
1707 | align 4 |
1699 | .fix_top_high: |
1708 | .fix_top_high: |
1700 | mov ebx, esi |
1709 | mov ebx, esi |
1701 | sub ebx, edx |
1710 | sub ebx, edx |
1702 | mov [edi + WDATA.box.top], ebx |
1711 | mov [edi + WDATA.box.top], ebx |
1703 | jmp .exit |
1712 | jmp .exit |
1704 | ;------------------------------------------------------------------------------ |
1713 | ;------------------------------------------------------------------------------ |
1705 | align 4 |
1714 | align 4 |
1706 | ;------------------------------------------------------------------------------ |
1715 | ;------------------------------------------------------------------------------ |
1707 | window._.get_titlebar_height: ;//////////////////////////////////////////////// |
1716 | window._.get_titlebar_height: ;//////////////////////////////////////////////// |
1708 | ;------------------------------------------------------------------------------ |
1717 | ;------------------------------------------------------------------------------ |
1709 | ;? |
1718 | ;? |
1710 | ;------------------------------------------------------------------------------ |
1719 | ;------------------------------------------------------------------------------ |
1711 | ;> edi = pointer to WDATA |
1720 | ;> edi = pointer to WDATA |
1712 | ;------------------------------------------------------------------------------ |
1721 | ;------------------------------------------------------------------------------ |
1713 | mov al, [edi + WDATA.fl_wstyle] |
1722 | mov al, [edi + WDATA.fl_wstyle] |
1714 | and al, 0x0f |
1723 | and al, 0x0f |
1715 | cmp al, 0x03 |
1724 | cmp al, 0x03 |
1716 | jne @f |
1725 | jne @f |
1717 | mov eax, [_skinh] |
1726 | mov eax, [_skinh] |
1718 | ret |
1727 | ret |
1719 | ;-------------------------------------- |
1728 | ;-------------------------------------- |
1720 | align 4 |
1729 | align 4 |
1721 | @@: |
1730 | @@: |
1722 | mov eax, 21 |
1731 | mov eax, 21 |
1723 | ret |
1732 | ret |
1724 | ;------------------------------------------------------------------------------ |
1733 | ;------------------------------------------------------------------------------ |
1725 | align 4 |
1734 | align 4 |
1726 | ;------------------------------------------------------------------------------ |
1735 | ;------------------------------------------------------------------------------ |
1727 | window._.get_rolledup_height: ;//////////////////////////////////////////////// |
1736 | window._.get_rolledup_height: ;//////////////////////////////////////////////// |
1728 | ;------------------------------------------------------------------------------ |
1737 | ;------------------------------------------------------------------------------ |
1729 | ;? |
1738 | ;? |
1730 | ;------------------------------------------------------------------------------ |
1739 | ;------------------------------------------------------------------------------ |
1731 | ;> edi = pointer to WDATA |
1740 | ;> edi = pointer to WDATA |
1732 | ;------------------------------------------------------------------------------ |
1741 | ;------------------------------------------------------------------------------ |
1733 | mov al, [edi + WDATA.fl_wstyle] |
1742 | mov al, [edi + WDATA.fl_wstyle] |
1734 | and al, 0x0f |
1743 | and al, 0x0f |
1735 | cmp al, 0x03 |
1744 | cmp al, 0x03 |
1736 | jb @f |
1745 | jb @f |
1737 | mov eax, [_skinh] |
1746 | mov eax, [_skinh] |
1738 | add eax, 3 |
1747 | add eax, 3 |
1739 | ret |
1748 | ret |
1740 | ;-------------------------------------- |
1749 | ;-------------------------------------- |
1741 | align 4 |
1750 | align 4 |
1742 | @@: |
1751 | @@: |
1743 | or al, al |
1752 | or al, al |
1744 | jnz @f |
1753 | jnz @f |
1745 | mov eax, 21 |
1754 | mov eax, 21 |
1746 | ret |
1755 | ret |
1747 | ;-------------------------------------- |
1756 | ;-------------------------------------- |
1748 | align 4 |
1757 | align 4 |
1749 | @@: |
1758 | @@: |
1750 | mov eax, 21 + 2 |
1759 | mov eax, 21 + 2 |
1751 | ret |
1760 | ret |
1752 | ;------------------------------------------------------------------------------ |
1761 | ;------------------------------------------------------------------------------ |
1753 | align 4 |
1762 | align 4 |
1754 | ;------------------------------------------------------------------------------ |
1763 | ;------------------------------------------------------------------------------ |
1755 | window._.set_screen: ;///////////////////////////////////////////////////////// |
1764 | window._.set_screen: ;///////////////////////////////////////////////////////// |
1756 | ;------------------------------------------------------------------------------ |
1765 | ;------------------------------------------------------------------------------ |
1757 | ;? Reserve window area in screen buffer |
1766 | ;? Reserve window area in screen buffer |
1758 | ;------------------------------------------------------------------------------ |
1767 | ;------------------------------------------------------------------------------ |
1759 | ;> eax = left |
1768 | ;> eax = left |
1760 | ;> ebx = top |
1769 | ;> ebx = top |
1761 | ;> ecx = right |
1770 | ;> ecx = right |
1762 | ;> edx = bottom |
1771 | ;> edx = bottom |
1763 | ;> esi = process number |
1772 | ;> esi = process number |
1764 | ;------------------------------------------------------------------------------ |
1773 | ;------------------------------------------------------------------------------ |
1765 | virtual at esp |
1774 | virtual at esp |
1766 | ff_x dd ? |
1775 | ff_x dd ? |
1767 | ff_y dd ? |
1776 | ff_y dd ? |
1768 | ff_width dd ? |
1777 | ff_width dd ? |
1769 | ff_xsz dd ? |
1778 | ff_xsz dd ? |
1770 | ff_ysz dd ? |
1779 | ff_ysz dd ? |
1771 | ff_scale dd ? |
1780 | ff_scale dd ? |
1772 | end virtual |
1781 | end virtual |
1773 | 1782 | ||
1774 | pushad |
1783 | pushad |
1775 | 1784 | ||
1776 | cmp esi, 1 |
1785 | cmp esi, 1 |
1777 | jz .check_for_shaped_window |
1786 | jz .check_for_shaped_window |
1778 | mov edi, esi |
1787 | mov edi, esi |
1779 | shl edi, 5 |
1788 | shl edi, 5 |
1780 | cmp [window_data + edi + WDATA.box.width], 0 |
1789 | cmp [window_data + edi + WDATA.box.width], 0 |
1781 | jnz .check_for_shaped_window |
1790 | jnz .check_for_shaped_window |
1782 | cmp [window_data + edi + WDATA.box.height], 0 |
1791 | cmp [window_data + edi + WDATA.box.height], 0 |
1783 | jz .exit |
1792 | jz .exit |
1784 | ;-------------------------------------- |
1793 | ;-------------------------------------- |
1785 | align 4 |
1794 | align 4 |
1786 | .check_for_shaped_window: |
1795 | .check_for_shaped_window: |
1787 | mov edi, esi |
1796 | mov edi, esi |
1788 | shl edi, 8 |
1797 | shl edi, 8 |
1789 | add edi, SLOT_BASE |
1798 | add edi, SLOT_BASE |
1790 | cmp [edi + APPDATA.wnd_shape], 0 |
1799 | cmp [edi + APPDATA.wnd_shape], 0 |
1791 | jne .shaped_window |
1800 | jne .shaped_window |
1792 | 1801 | ||
1793 | ; get x&y size |
1802 | ; get x&y size |
1794 | sub ecx, eax |
1803 | sub ecx, eax |
1795 | sub edx, ebx |
1804 | sub edx, ebx |
1796 | inc ecx |
1805 | inc ecx |
1797 | inc edx |
1806 | inc edx |
1798 | 1807 | ||
1799 | ; get WinMap start |
1808 | ; get WinMap start |
1800 | push esi |
1809 | push esi |
1801 | mov esi, [_display.width] |
1810 | mov esi, [_display.width] |
1802 | mov edi, [d_width_calc_area + ebx*4] |
1811 | mov edi, [d_width_calc_area + ebx*4] |
1803 | 1812 | ||
1804 | add edi, eax |
1813 | add edi, eax |
1805 | add edi, [_display.win_map] |
1814 | add edi, [_display.win_map] |
1806 | pop eax |
1815 | pop eax |
1807 | mov ah, al |
1816 | mov ah, al |
1808 | push ax |
1817 | push ax |
1809 | shl eax, 16 |
1818 | shl eax, 16 |
1810 | pop ax |
1819 | pop ax |
1811 | ;-------------------------------------- |
1820 | ;-------------------------------------- |
1812 | align 4 |
1821 | align 4 |
1813 | .next_line: |
1822 | .next_line: |
1814 | push ecx |
1823 | push ecx |
1815 | shr ecx, 2 |
1824 | shr ecx, 2 |
1816 | rep stosd |
1825 | rep stosd |
1817 | mov ecx, [esp] |
1826 | mov ecx, [esp] |
1818 | and ecx, 3 |
1827 | and ecx, 3 |
1819 | rep stosb |
1828 | rep stosb |
1820 | pop ecx |
1829 | pop ecx |
1821 | add edi, esi |
1830 | add edi, esi |
1822 | sub edi, ecx |
1831 | sub edi, ecx |
1823 | dec edx |
1832 | dec edx |
1824 | jnz .next_line |
1833 | jnz .next_line |
1825 | 1834 | ||
1826 | jmp .exit |
1835 | jmp .exit |
1827 | ;-------------------------------------- |
1836 | ;-------------------------------------- |
1828 | align 4 |
1837 | align 4 |
1829 | .shaped_window: |
1838 | .shaped_window: |
1830 | ; for (y=0; y <= x_size; y++) |
1839 | ; for (y=0; y <= x_size; y++) |
1831 | ; for (x=0; x <= x_size; x++) |
1840 | ; for (x=0; x <= x_size; x++) |
1832 | ; if (shape[coord(x,y,scale)]==1) |
1841 | ; if (shape[coord(x,y,scale)]==1) |
1833 | ; set_pixel(x, y, process_number); |
1842 | ; set_pixel(x, y, process_number); |
1834 | 1843 | ||
1835 | sub ecx, eax |
1844 | sub ecx, eax |
1836 | sub edx, ebx |
1845 | sub edx, ebx |
1837 | inc ecx |
1846 | inc ecx |
1838 | inc edx |
1847 | inc edx |
1839 | 1848 | ||
1840 | push [edi + APPDATA.wnd_shape_scale] ; push scale first -> for loop |
1849 | push [edi + APPDATA.wnd_shape_scale] ; push scale first -> for loop |
1841 | 1850 | ||
1842 | ; get WinMap start -> ebp |
1851 | ; get WinMap start -> ebp |
1843 | push eax |
1852 | push eax |
1844 | mov eax, [d_width_calc_area + ebx*4] |
1853 | mov eax, [d_width_calc_area + ebx*4] |
1845 | 1854 | ||
1846 | add eax, [esp] |
1855 | add eax, [esp] |
1847 | add eax, [_display.win_map] |
1856 | add eax, [_display.win_map] |
1848 | mov ebp, eax |
1857 | mov ebp, eax |
1849 | 1858 | ||
1850 | mov edi, [edi + APPDATA.wnd_shape] |
1859 | mov edi, [edi + APPDATA.wnd_shape] |
1851 | pop eax |
1860 | pop eax |
1852 | 1861 | ||
1853 | ; eax = x_start |
1862 | ; eax = x_start |
1854 | ; ebx = y_start |
1863 | ; ebx = y_start |
1855 | ; ecx = x_size |
1864 | ; ecx = x_size |
1856 | ; edx = y_size |
1865 | ; edx = y_size |
1857 | ; esi = process_number |
1866 | ; esi = process_number |
1858 | ; edi = &shape |
1867 | ; edi = &shape |
1859 | ; [scale] |
1868 | ; [scale] |
1860 | push edx ecx ; for loop - x,y size |
1869 | push edx ecx ; for loop - x,y size |
1861 | 1870 | ||
1862 | mov ecx, esi |
1871 | mov ecx, esi |
1863 | shl ecx, 5 |
1872 | shl ecx, 5 |
1864 | mov edx, [window_data + ecx + WDATA.box.top] |
1873 | mov edx, [window_data + ecx + WDATA.box.top] |
1865 | push [window_data + ecx + WDATA.box.width] ; for loop - width |
1874 | push [window_data + ecx + WDATA.box.width] ; for loop - width |
1866 | mov ecx, [window_data + ecx + WDATA.box.left] |
1875 | mov ecx, [window_data + ecx + WDATA.box.left] |
1867 | sub ebx, edx |
1876 | sub ebx, edx |
1868 | sub eax, ecx |
1877 | sub eax, ecx |
1869 | push ebx eax ; for loop - x,y |
1878 | push ebx eax ; for loop - x,y |
1870 | 1879 | ||
1871 | add [ff_xsz], eax |
1880 | add [ff_xsz], eax |
1872 | add [ff_ysz], ebx |
1881 | add [ff_ysz], ebx |
1873 | 1882 | ||
1874 | mov ebx, [ff_y] |
1883 | mov ebx, [ff_y] |
1875 | ;-------------------------------------- |
1884 | ;-------------------------------------- |
1876 | align 4 |
1885 | align 4 |
1877 | .ff_new_y: |
1886 | .ff_new_y: |
1878 | mov edx, [ff_x] |
1887 | mov edx, [ff_x] |
1879 | ;-------------------------------------- |
1888 | ;-------------------------------------- |
1880 | align 4 |
1889 | align 4 |
1881 | .ff_new_x: |
1890 | .ff_new_x: |
1882 | ; -- body -- |
1891 | ; -- body -- |
1883 | mov ecx, [ff_scale] |
1892 | mov ecx, [ff_scale] |
1884 | mov eax, [ff_width] |
1893 | mov eax, [ff_width] |
1885 | inc eax |
1894 | inc eax |
1886 | shr eax, cl |
1895 | shr eax, cl |
1887 | push ebx edx |
1896 | push ebx edx |
1888 | shr ebx, cl |
1897 | shr ebx, cl |
1889 | shr edx, cl |
1898 | shr edx, cl |
1890 | imul eax, ebx |
1899 | imul eax, ebx |
1891 | add eax, edx |
1900 | add eax, edx |
1892 | pop edx ebx |
1901 | pop edx ebx |
1893 | add eax, edi |
1902 | add eax, edi |
1894 | call .read_byte |
1903 | call .read_byte |
1895 | test al, al |
1904 | test al, al |
1896 | jz @f |
1905 | jz @f |
1897 | mov eax, esi |
1906 | mov eax, esi |
1898 | mov [ebp], al |
1907 | mov [ebp], al |
1899 | ; -- end body -- |
1908 | ; -- end body -- |
1900 | ;-------------------------------------- |
1909 | ;-------------------------------------- |
1901 | align 4 |
1910 | align 4 |
1902 | @@: |
1911 | @@: |
1903 | inc ebp |
1912 | inc ebp |
1904 | inc edx |
1913 | inc edx |
1905 | cmp edx, [ff_xsz] |
1914 | cmp edx, [ff_xsz] |
1906 | jb .ff_new_x |
1915 | jb .ff_new_x |
1907 | 1916 | ||
1908 | sub ebp, [ff_xsz] |
1917 | sub ebp, [ff_xsz] |
1909 | add ebp, [ff_x] |
1918 | add ebp, [ff_x] |
1910 | add ebp, [_display.width] ; screen.x |
1919 | add ebp, [_display.width] ; screen.x |
1911 | inc ebx |
1920 | inc ebx |
1912 | cmp ebx, [ff_ysz] |
1921 | cmp ebx, [ff_ysz] |
1913 | jb .ff_new_y |
1922 | jb .ff_new_y |
1914 | 1923 | ||
1915 | add esp, 24 |
1924 | add esp, 24 |
1916 | ;-------------------------------------- |
1925 | ;-------------------------------------- |
1917 | align 4 |
1926 | align 4 |
1918 | .exit: |
1927 | .exit: |
1919 | popad |
1928 | popad |
1920 | inc [_display.mask_seqno] |
1929 | inc [_display.mask_seqno] |
1921 | ret |
1930 | ret |
1922 | ;-------------------------------------- |
1931 | ;-------------------------------------- |
1923 | align 4 |
1932 | align 4 |
1924 | .read_byte: |
1933 | .read_byte: |
1925 | ; eax - address |
1934 | ; eax - address |
1926 | ; esi - slot |
1935 | ; esi - slot |
1927 | push eax ecx edx esi |
1936 | push eax ecx edx esi |
1928 | xchg eax, esi |
1937 | xchg eax, esi |
1929 | lea ecx, [esp + 12] |
1938 | lea ecx, [esp + 12] |
1930 | mov edx, 1 |
1939 | mov edx, 1 |
1931 | call read_process_memory |
1940 | call read_process_memory |
1932 | pop esi edx ecx eax |
1941 | pop esi edx ecx eax |
1933 | ret |
1942 | ret |
1934 | ;------------------------------------------------------------------------------ |
1943 | ;------------------------------------------------------------------------------ |
1935 | align 4 |
1944 | align 4 |
1936 | ;------------------------------------------------------------------------------ |
1945 | ;------------------------------------------------------------------------------ |
1937 | window._.window_activate: ;//////////////////////////////////////////////////// |
1946 | window._.window_activate: ;//////////////////////////////////////////////////// |
1938 | ;------------------------------------------------------------------------------ |
1947 | ;------------------------------------------------------------------------------ |
1939 | ;? Activate window |
1948 | ;? Activate window |
1940 | ;------------------------------------------------------------------------------ |
1949 | ;------------------------------------------------------------------------------ |
1941 | ;> esi = pointer to WIN_POS+ window data |
1950 | ;> esi = pointer to WIN_POS+ window data |
1942 | ;------------------------------------------------------------------------------ |
1951 | ;------------------------------------------------------------------------------ |
1943 | push eax ebx |
1952 | push eax ebx |
1944 | 1953 | ||
1945 | ; if type of current active window is 3 or 4, it must be redrawn |
1954 | ; if type of current active window is 3 or 4, it must be redrawn |
1946 | mov ebx, [TASK_COUNT] |
1955 | mov ebx, [TASK_COUNT] |
1947 | 1956 | ||
1948 | ; DEBUGF 1, "K : TASK_COUNT (0x%x)\n", ebx |
1957 | ; DEBUGF 1, "K : TASK_COUNT (0x%x)\n", ebx |
1949 | 1958 | ||
1950 | movzx ebx, word[WIN_POS + ebx * 2] |
1959 | movzx ebx, word[WIN_POS + ebx * 2] |
1951 | shl ebx, 5 |
1960 | shl ebx, 5 |
1952 | add eax, window_data |
1961 | add eax, window_data |
1953 | mov al, [window_data + ebx + WDATA.fl_wstyle] |
1962 | mov al, [window_data + ebx + WDATA.fl_wstyle] |
1954 | and al, 0x0f |
1963 | and al, 0x0f |
1955 | cmp al, 0x03 |
1964 | cmp al, 0x03 |
1956 | je .set_window_redraw_flag |
1965 | je .set_window_redraw_flag |
1957 | cmp al, 0x04 |
1966 | cmp al, 0x04 |
1958 | jne .move_others_down |
1967 | jne .move_others_down |
1959 | ;-------------------------------------- |
1968 | ;-------------------------------------- |
1960 | align 4 |
1969 | align 4 |
1961 | .set_window_redraw_flag: |
1970 | .set_window_redraw_flag: |
1962 | mov [window_data + ebx + WDATA.fl_redraw], 1 |
1971 | mov [window_data + ebx + WDATA.fl_redraw], 1 |
1963 | ;-------------------------------------- |
1972 | ;-------------------------------------- |
1964 | align 4 |
1973 | align 4 |
1965 | .move_others_down: |
1974 | .move_others_down: |
1966 | ; ax <- process no |
1975 | ; ax <- process no |
1967 | movzx ebx, word[esi] |
1976 | movzx ebx, word[esi] |
1968 | ; ax <- position in window stack |
1977 | ; ax <- position in window stack |
1969 | movzx ebx, word[WIN_STACK + ebx * 2] |
1978 | movzx ebx, word[WIN_STACK + ebx * 2] |
1970 | 1979 | ||
1971 | ; drop others |
1980 | ; drop others |
1972 | xor eax, eax |
1981 | xor eax, eax |
1973 | ;-------------------------------------- |
1982 | ;-------------------------------------- |
1974 | align 4 |
1983 | align 4 |
1975 | .next_stack_window: |
1984 | .next_stack_window: |
1976 | cmp eax, [TASK_COUNT] |
1985 | cmp eax, [TASK_COUNT] |
1977 | jae .move_self_up |
1986 | jae .move_self_up |
1978 | inc eax |
1987 | inc eax |
1979 | 1988 | ||
1980 | ; push ebx |
1989 | ; push ebx |
1981 | ; xor ebx,ebx |
1990 | ; xor ebx,ebx |
1982 | ; mov bx,[WIN_STACK + eax * 2] |
1991 | ; mov bx,[WIN_STACK + eax * 2] |
1983 | ; DEBUGF 1, "K : DEC WIN_STACK (0x%x)\n",ebx |
1992 | ; DEBUGF 1, "K : DEC WIN_STACK (0x%x)\n",ebx |
1984 | ; pop ebx |
1993 | ; pop ebx |
1985 | 1994 | ||
1986 | cmp [WIN_STACK + eax * 2], bx |
1995 | cmp [WIN_STACK + eax * 2], bx |
1987 | jbe .next_stack_window |
1996 | jbe .next_stack_window |
1988 | dec word[WIN_STACK + eax * 2] |
1997 | dec word[WIN_STACK + eax * 2] |
1989 | jmp .next_stack_window |
1998 | jmp .next_stack_window |
1990 | ;-------------------------------------- |
1999 | ;-------------------------------------- |
1991 | align 4 |
2000 | align 4 |
1992 | .move_self_up: |
2001 | .move_self_up: |
1993 | movzx ebx, word[esi] |
2002 | movzx ebx, word[esi] |
1994 | ; number of processes |
2003 | ; number of processes |
1995 | mov ax, [TASK_COUNT] |
2004 | mov ax, [TASK_COUNT] |
1996 | ; this is the last (and the upper) |
2005 | ; this is the last (and the upper) |
1997 | mov [WIN_STACK + ebx * 2], ax |
2006 | mov [WIN_STACK + ebx * 2], ax |
1998 | 2007 | ||
1999 | ; update on screen - window stack |
2008 | ; update on screen - window stack |
2000 | xor eax, eax |
2009 | xor eax, eax |
2001 | ;-------------------------------------- |
2010 | ;-------------------------------------- |
2002 | align 4 |
2011 | align 4 |
2003 | .next_window_pos: |
2012 | .next_window_pos: |
2004 | cmp eax, [TASK_COUNT] |
2013 | cmp eax, [TASK_COUNT] |
2005 | jae .reset_vars |
2014 | jae .reset_vars |
2006 | inc eax |
2015 | inc eax |
2007 | movzx ebx, word[WIN_STACK + eax * 2] |
2016 | movzx ebx, word[WIN_STACK + eax * 2] |
2008 | mov [WIN_POS + ebx * 2], ax |
2017 | mov [WIN_POS + ebx * 2], ax |
2009 | jmp .next_window_pos |
2018 | jmp .next_window_pos |
2010 | ;-------------------------------------- |
2019 | ;-------------------------------------- |
2011 | align 4 |
2020 | align 4 |
2012 | .reset_vars: |
2021 | .reset_vars: |
2013 | mov byte[KEY_COUNT], 0 |
2022 | mov byte[KEY_COUNT], 0 |
2014 | mov byte[BTN_COUNT], 0 |
2023 | mov byte[BTN_COUNT], 0 |
2015 | mov word[MOUSE_SCROLL_H], 0 |
2024 | mov word[MOUSE_SCROLL_H], 0 |
2016 | mov word[MOUSE_SCROLL_V], 0 |
2025 | mov word[MOUSE_SCROLL_V], 0 |
2017 | 2026 | ||
2018 | pop ebx eax |
2027 | pop ebx eax |
2019 | ret |
2028 | ret |
2020 | ;------------------------------------------------------------------------------ |
2029 | ;------------------------------------------------------------------------------ |
2021 | window._.window_deactivate: ;//////////////////////////////////////////////////// |
2030 | window._.window_deactivate: ;//////////////////////////////////////////////////// |
2022 | ;------------------------------------------------------------------------------ |
2031 | ;------------------------------------------------------------------------------ |
2023 | ;? Deactivate window |
2032 | ;? Deactivate window |
2024 | ;------------------------------------------------------------------------------ |
2033 | ;------------------------------------------------------------------------------ |
2025 | ;> esi = pointer to WIN_POS+ window data |
2034 | ;> esi = pointer to WIN_POS+ window data |
2026 | ;------------------------------------------------------------------------------ |
2035 | ;------------------------------------------------------------------------------ |
2027 | push eax ebx |
2036 | push eax ebx |
2028 | ;-------------------------------------- |
2037 | ;-------------------------------------- |
2029 | align 4 |
2038 | align 4 |
2030 | .move_others_up: |
2039 | .move_others_up: |
2031 | ; ax <- process no |
2040 | ; ax <- process no |
2032 | movzx ebx, word[esi] |
2041 | movzx ebx, word[esi] |
2033 | ; ax <- position in window stack |
2042 | ; ax <- position in window stack |
2034 | movzx ebx, word[WIN_STACK + ebx * 2] |
2043 | movzx ebx, word[WIN_STACK + ebx * 2] |
2035 | ; up others |
2044 | ; up others |
2036 | xor eax, eax |
2045 | xor eax, eax |
2037 | ;-------------------------------------- |
2046 | ;-------------------------------------- |
2038 | align 4 |
2047 | align 4 |
2039 | .next_stack_window: |
2048 | .next_stack_window: |
2040 | cmp eax, [TASK_COUNT] |
2049 | cmp eax, [TASK_COUNT] |
2041 | jae .move_self_down |
2050 | jae .move_self_down |
2042 | inc eax |
2051 | inc eax |
2043 | cmp [WIN_STACK + eax * 2], bx |
2052 | cmp [WIN_STACK + eax * 2], bx |
2044 | jae .next_stack_window |
2053 | jae .next_stack_window |
2045 | inc word[WIN_STACK + eax * 2] |
2054 | inc word[WIN_STACK + eax * 2] |
2046 | jmp .next_stack_window |
2055 | jmp .next_stack_window |
2047 | ;-------------------------------------- |
2056 | ;-------------------------------------- |
2048 | align 4 |
2057 | align 4 |
2049 | .move_self_down: |
2058 | .move_self_down: |
2050 | movzx ebx, word[esi] |
2059 | movzx ebx, word[esi] |
2051 | ; this is the last (and the low) |
2060 | ; this is the last (and the low) |
2052 | mov [WIN_STACK + ebx * 2], word 1 |
2061 | mov [WIN_STACK + ebx * 2], word 1 |
2053 | ; update on screen - window stack |
2062 | ; update on screen - window stack |
2054 | xor eax, eax |
2063 | xor eax, eax |
2055 | ;-------------------------------------- |
2064 | ;-------------------------------------- |
2056 | align 4 |
2065 | align 4 |
2057 | .next_window_pos: |
2066 | .next_window_pos: |
2058 | cmp eax, [TASK_COUNT] |
2067 | cmp eax, [TASK_COUNT] |
2059 | jae .reset_vars |
2068 | jae .reset_vars |
2060 | inc eax |
2069 | inc eax |
2061 | movzx ebx, word[WIN_STACK + eax * 2] |
2070 | movzx ebx, word[WIN_STACK + eax * 2] |
2062 | mov [WIN_POS + ebx * 2], ax |
2071 | mov [WIN_POS + ebx * 2], ax |
2063 | jmp .next_window_pos |
2072 | jmp .next_window_pos |
2064 | ;-------------------------------------- |
2073 | ;-------------------------------------- |
2065 | align 4 |
2074 | align 4 |
2066 | .reset_vars: |
2075 | .reset_vars: |
2067 | mov byte[KEY_COUNT], 0 |
2076 | mov byte[KEY_COUNT], 0 |
2068 | mov byte[BTN_COUNT], 0 |
2077 | mov byte[BTN_COUNT], 0 |
2069 | mov word[MOUSE_SCROLL_H], 0 |
2078 | mov word[MOUSE_SCROLL_H], 0 |
2070 | mov word[MOUSE_SCROLL_V], 0 |
2079 | mov word[MOUSE_SCROLL_V], 0 |
2071 | pop ebx eax |
2080 | pop ebx eax |
2072 | ret |
2081 | ret |
2073 | ;------------------------------------------------------------------------------ |
2082 | ;------------------------------------------------------------------------------ |
2074 | align 4 |
2083 | align 4 |
2075 | ;------------------------------------------------------------------------------ |
2084 | ;------------------------------------------------------------------------------ |
2076 | window._.check_window_draw: ;////////////////////////////////////////////////// |
2085 | window._.check_window_draw: ;////////////////////////////////////////////////// |
2077 | ;------------------------------------------------------------------------------ |
2086 | ;------------------------------------------------------------------------------ |
2078 | ;? Check if window is necessary to draw |
2087 | ;? Check if window is necessary to draw |
2079 | ;------------------------------------------------------------------------------ |
2088 | ;------------------------------------------------------------------------------ |
2080 | ;> edi = pointer to WDATA |
2089 | ;> edi = pointer to WDATA |
2081 | ;------------------------------------------------------------------------------ |
2090 | ;------------------------------------------------------------------------------ |
2082 | mov cl, [edi + WDATA.fl_wstyle] |
2091 | mov cl, [edi + WDATA.fl_wstyle] |
2083 | and cl, 0x0f |
2092 | and cl, 0x0f |
2084 | cmp cl, 3 |
2093 | cmp cl, 3 |
2085 | je .exit.redraw ; window type 3 |
2094 | je .exit.redraw ; window type 3 |
2086 | cmp cl, 4 |
2095 | cmp cl, 4 |
2087 | je .exit.redraw ; window type 4 |
2096 | je .exit.redraw ; window type 4 |
2088 | 2097 | ||
2089 | push eax ebx edx esi |
2098 | push eax ebx edx esi |
2090 | 2099 | ||
2091 | mov eax, edi |
2100 | mov eax, edi |
2092 | sub eax, window_data |
2101 | sub eax, window_data |
2093 | shr eax, 5 |
2102 | shr eax, 5 |
2094 | 2103 | ||
2095 | movzx eax, word[WIN_STACK + eax * 2] ; get value of the curr process |
2104 | movzx eax, word[WIN_STACK + eax * 2] ; get value of the curr process |
2096 | lea esi, [WIN_POS + eax * 2] ; get address of this process at 0xC400 |
2105 | lea esi, [WIN_POS + eax * 2] ; get address of this process at 0xC400 |
2097 | ;-------------------------------------- |
2106 | ;-------------------------------------- |
2098 | align 4 |
2107 | align 4 |
2099 | .next_window: |
2108 | .next_window: |
2100 | add esi, 2 |
2109 | add esi, 2 |
2101 | 2110 | ||
2102 | mov eax, [TASK_COUNT] |
2111 | mov eax, [TASK_COUNT] |
2103 | lea eax, word[WIN_POS + eax * 2] ; number of the upper window |
2112 | lea eax, word[WIN_POS + eax * 2] ; number of the upper window |
2104 | 2113 | ||
2105 | cmp esi, eax |
2114 | cmp esi, eax |
2106 | ja .exit.no_redraw |
2115 | ja .exit.no_redraw |
2107 | 2116 | ||
2108 | movzx edx, word[esi] |
2117 | movzx edx, word[esi] |
2109 | shl edx, 5 |
2118 | shl edx, 5 |
2110 | cmp [CURRENT_TASK + edx + TASKDATA.state], TSTATE_FREE |
2119 | cmp [CURRENT_TASK + edx + TASKDATA.state], TSTATE_FREE |
2111 | je .next_window |
2120 | je .next_window |
2112 | 2121 | ||
2113 | mov eax, [edi + WDATA.box.top] |
2122 | mov eax, [edi + WDATA.box.top] |
2114 | mov ebx, [edi + WDATA.box.height] |
2123 | mov ebx, [edi + WDATA.box.height] |
2115 | add ebx, eax |
2124 | add ebx, eax |
2116 | 2125 | ||
2117 | mov ecx, [window_data + edx + WDATA.box.top] |
2126 | mov ecx, [window_data + edx + WDATA.box.top] |
2118 | cmp ecx, ebx |
2127 | cmp ecx, ebx |
2119 | jge .next_window |
2128 | jge .next_window |
2120 | add ecx, [window_data + edx + WDATA.box.height] |
2129 | add ecx, [window_data + edx + WDATA.box.height] |
2121 | cmp eax, ecx |
2130 | cmp eax, ecx |
2122 | jge .next_window |
2131 | jge .next_window |
2123 | 2132 | ||
2124 | mov eax, [edi + WDATA.box.left] |
2133 | mov eax, [edi + WDATA.box.left] |
2125 | mov ebx, [edi + WDATA.box.width] |
2134 | mov ebx, [edi + WDATA.box.width] |
2126 | add ebx, eax |
2135 | add ebx, eax |
2127 | 2136 | ||
2128 | mov ecx, [window_data + edx + WDATA.box.left] |
2137 | mov ecx, [window_data + edx + WDATA.box.left] |
2129 | cmp ecx, ebx |
2138 | cmp ecx, ebx |
2130 | jge .next_window |
2139 | jge .next_window |
2131 | add ecx, [window_data + edx + WDATA.box.width] |
2140 | add ecx, [window_data + edx + WDATA.box.width] |
2132 | cmp eax, ecx |
2141 | cmp eax, ecx |
2133 | jge .next_window |
2142 | jge .next_window |
2134 | 2143 | ||
2135 | pop esi edx ebx eax |
2144 | pop esi edx ebx eax |
2136 | ;-------------------------------------- |
2145 | ;-------------------------------------- |
2137 | align 4 |
2146 | align 4 |
2138 | .exit.redraw: |
2147 | .exit.redraw: |
2139 | xor ecx, ecx |
2148 | xor ecx, ecx |
2140 | inc ecx |
2149 | inc ecx |
2141 | ret |
2150 | ret |
2142 | ;-------------------------------------- |
2151 | ;-------------------------------------- |
2143 | align 4 |
2152 | align 4 |
2144 | .exit.no_redraw: |
2153 | .exit.no_redraw: |
2145 | pop esi edx ebx eax |
2154 | pop esi edx ebx eax |
2146 | xor ecx, ecx |
2155 | xor ecx, ecx |
2147 | ret |
2156 | ret |
2148 | ;------------------------------------------------------------------------------ |
2157 | ;------------------------------------------------------------------------------ |
2149 | align 4 |
2158 | align 4 |
2150 | ;------------------------------------------------------------------------------ |
2159 | ;------------------------------------------------------------------------------ |
2151 | window._.draw_window_caption: ;//////////////////////////////////////////////// |
2160 | window._.draw_window_caption: ;//////////////////////////////////////////////// |
2152 | ;------------------------------------------------------------------------------ |
2161 | ;------------------------------------------------------------------------------ |
2153 | ;? |
2162 | ;? |
2154 | ;------------------------------------------------------------------------------ |
2163 | ;------------------------------------------------------------------------------ |
2155 | xor eax, eax |
2164 | xor eax, eax |
2156 | mov edx, [TASK_COUNT] |
2165 | mov edx, [TASK_COUNT] |
2157 | movzx edx, word[WIN_POS + edx * 2] |
2166 | movzx edx, word[WIN_POS + edx * 2] |
2158 | cmp edx, [CURRENT_TASK] |
2167 | cmp edx, [CURRENT_TASK] |
2159 | jne @f |
2168 | jne @f |
2160 | inc eax |
2169 | inc eax |
2161 | ;-------------------------------------- |
2170 | ;-------------------------------------- |
2162 | align 4 |
2171 | align 4 |
2163 | @@: |
2172 | @@: |
2164 | mov edx, [CURRENT_TASK] |
2173 | mov edx, [CURRENT_TASK] |
2165 | shl edx, 5 |
2174 | shl edx, 5 |
2166 | add edx, window_data |
2175 | add edx, window_data |
2167 | movzx ebx, [edx + WDATA.fl_wstyle] |
2176 | movzx ebx, [edx + WDATA.fl_wstyle] |
2168 | and bl, 0x0F |
2177 | and bl, 0x0F |
2169 | cmp bl, 3 |
2178 | cmp bl, 3 |
2170 | je .draw_caption_style_3 |
2179 | je .draw_caption_style_3 |
2171 | cmp bl, 4 |
2180 | cmp bl, 4 |
2172 | je .draw_caption_style_3 |
2181 | je .draw_caption_style_3 |
2173 | 2182 | ||
2174 | jmp .not_style_3 |
2183 | jmp .not_style_3 |
2175 | ;-------------------------------------- |
2184 | ;-------------------------------------- |
2176 | align 4 |
2185 | align 4 |
2177 | .draw_caption_style_3: |
2186 | .draw_caption_style_3: |
2178 | push edx |
2187 | push edx |
2179 | call drawwindow_IV_caption |
2188 | call drawwindow_IV_caption |
2180 | add esp, 4 |
2189 | add esp, 4 |
2181 | jmp .2 |
2190 | jmp .2 |
2182 | ;-------------------------------------- |
2191 | ;-------------------------------------- |
2183 | align 4 |
2192 | align 4 |
2184 | .not_style_3: |
2193 | .not_style_3: |
2185 | cmp bl, 2 |
2194 | cmp bl, 2 |
2186 | jne .not_style_2 |
2195 | jne .not_style_2 |
2187 | 2196 | ||
2188 | call drawwindow_III_caption |
2197 | call drawwindow_III_caption |
2189 | jmp .2 |
2198 | jmp .2 |
2190 | ;-------------------------------------- |
2199 | ;-------------------------------------- |
2191 | align 4 |
2200 | align 4 |
2192 | .not_style_2: |
2201 | .not_style_2: |
2193 | cmp bl, 0 |
2202 | cmp bl, 0 |
2194 | jne .2 |
2203 | jne .2 |
2195 | 2204 | ||
2196 | call drawwindow_I_caption |
2205 | call drawwindow_I_caption |
2197 | ;-------------------------------------- |
2206 | ;-------------------------------------- |
2198 | align 4 |
2207 | align 4 |
2199 | .2: |
2208 | .2: |
2200 | mov edi, [CURRENT_TASK] |
2209 | mov edi, [CURRENT_TASK] |
2201 | shl edi, 5 |
2210 | shl edi, 5 |
2202 | test [edi + window_data + WDATA.fl_wstyle], WSTYLE_HASCAPTION |
2211 | test [edi + window_data + WDATA.fl_wstyle], WSTYLE_HASCAPTION |
2203 | jz .exit |
2212 | jz .exit |
2204 | mov edx, [edi * 8 + SLOT_BASE + APPDATA.wnd_caption] |
2213 | mov edx, [edi * 8 + SLOT_BASE + APPDATA.wnd_caption] |
2205 | or edx, edx |
2214 | or edx, edx |
2206 | jz .exit |
2215 | jz .exit |
2207 | 2216 | ||
2208 | mov ebp, [edi + window_data + WDATA.box.left - 2] |
2217 | mov ebp, [edi + window_data + WDATA.box.left - 2] |
2209 | mov bp, word[edi + window_data + WDATA.box.top] |
2218 | mov bp, word[edi + window_data + WDATA.box.top] |
2210 | movzx eax, [edi + window_data + WDATA.fl_wstyle] |
2219 | movzx eax, [edi + window_data + WDATA.fl_wstyle] |
2211 | and al, 0x0F |
2220 | and al, 0x0F |
2212 | cmp al, 3 |
2221 | cmp al, 3 |
2213 | je .skinned |
2222 | je .skinned |
2214 | cmp al, 4 |
2223 | cmp al, 4 |
2215 | je .skinned |
2224 | je .skinned |
2216 | 2225 | ||
2217 | jmp .not_skinned |
2226 | jmp .not_skinned |
2218 | ;-------------------------------------- |
2227 | ;-------------------------------------- |
2219 | align 4 |
2228 | align 4 |
2220 | .skinned: |
2229 | .skinned: |
2221 | movzx eax, word[edi + window_data + WDATA.box.width] |
2230 | movzx eax, word[edi + window_data + WDATA.box.width] |
2222 | sub ax, [_skinmargins.left] |
2231 | sub ax, [_skinmargins.left] |
2223 | sub ax, [_skinmargins.right] |
2232 | sub ax, [_skinmargins.right] |
2224 | js .exit |
2233 | js .exit |
2225 | mov ebx, dword[_skinmargins.left - 2] |
2234 | mov ebx, dword[_skinmargins.left - 2] |
2226 | mov bx, word[_skinh] |
2235 | mov bx, word[_skinh] |
2227 | sub bx, [_skinmargins.bottom] |
2236 | sub bx, [_skinmargins.bottom] |
2228 | sub bx, [_skinmargins.top] |
2237 | sub bx, [_skinmargins.top] |
2229 | sar bx, 1 |
2238 | sar bx, 1 |
2230 | add bx, [_skinmargins.top] |
2239 | add bx, [_skinmargins.top] |
2231 | sub bx, 8 |
2240 | sub bx, 8 |
2232 | jmp .dodraw |
2241 | jmp .dodraw |
2233 | ;-------------------------------------- |
2242 | ;-------------------------------------- |
2234 | align 4 |
2243 | align 4 |
2235 | .not_skinned: |
2244 | .not_skinned: |
2236 | cmp al, 1 |
2245 | cmp al, 1 |
2237 | je .exit |
2246 | je .exit |
2238 | movzx eax, word[edi + window_data + WDATA.box.width] |
2247 | movzx eax, word[edi + window_data + WDATA.box.width] |
2239 | sub eax, 16 |
2248 | sub eax, 16 |
2240 | js .exit |
2249 | js .exit |
2241 | mov ebx, 80002h |
2250 | mov ebx, 80002h |
2242 | .dodraw: |
2251 | .dodraw: |
2243 | shr eax, 3 |
2252 | shr eax, 3 |
2244 | mov esi, eax |
2253 | mov esi, eax |
2245 | add ebx, ebp |
2254 | add ebx, ebp |
2246 | mov ecx, [common_colours + 16] |
2255 | mov ecx, [common_colours + 16] |
- | 2256 | mov al, [edi*8 + SLOT_BASE + APPDATA.captionEncoding] |
|
- | 2257 | test al, al |
|
- | 2258 | jnz @f |
|
2247 | mov al, 1 |
2259 | mov al, 1 |
2248 | cmp byte [edx], 4 |
2260 | cmp byte [edx], 4 |
2249 | jnc @f |
2261 | jnc @f |
2250 | mov al, [edx] |
2262 | mov al, [edx] |
2251 | test al, al |
2263 | test al, al |
2252 | jz .exit |
2264 | jz .exit |
2253 | inc edx |
2265 | inc edx |
2254 | @@: |
2266 | @@: |
2255 | shl eax, 28 |
2267 | shl eax, 28 |
2256 | or ecx, eax |
2268 | or ecx, eax |
2257 | xor edi, edi |
2269 | xor edi, edi |
2258 | call dtext |
2270 | call dtext |
2259 | .exit: |
2271 | .exit: |
2260 | jmp __sys_draw_pointer |
2272 | jmp __sys_draw_pointer |
2261 | ;------------------------------------------------------------------------------ |
2273 | ;------------------------------------------------------------------------------ |
2262 | align 4 |
2274 | align 4 |
2263 | ;------------------------------------------------------------------------------ |
2275 | ;------------------------------------------------------------------------------ |
2264 | window._.draw_negative_box: ;////////////////////////////////////////////////// |
2276 | window._.draw_negative_box: ;////////////////////////////////////////////////// |
2265 | ;------------------------------------------------------------------------------ |
2277 | ;------------------------------------------------------------------------------ |
2266 | ;? Draw negative box |
2278 | ;? Draw negative box |
2267 | ;------------------------------------------------------------------------------ |
2279 | ;------------------------------------------------------------------------------ |
2268 | ;> edi = pointer to BOX struct |
2280 | ;> edi = pointer to BOX struct |
2269 | ;------------------------------------------------------------------------------ |
2281 | ;------------------------------------------------------------------------------ |
2270 | push eax ebx esi |
2282 | push eax ebx esi |
2271 | mov esi, 0x01000000 |
2283 | mov esi, 0x01000000 |
2272 | ;-------------------------------------- |
2284 | ;-------------------------------------- |
2273 | align 4 |
2285 | align 4 |
2274 | .1: |
2286 | .1: |
2275 | mov eax, [edi + BOX.left - 2] |
2287 | mov eax, [edi + BOX.left - 2] |
2276 | mov ax, word[edi + BOX.left] |
2288 | mov ax, word[edi + BOX.left] |
2277 | add ax, word[edi + BOX.width] |
2289 | add ax, word[edi + BOX.width] |
2278 | mov ebx, [edi + BOX.top - 2] |
2290 | mov ebx, [edi + BOX.top - 2] |
2279 | mov bx, word[edi + BOX.top] |
2291 | mov bx, word[edi + BOX.top] |
2280 | add bx, word[edi + BOX.height] |
2292 | add bx, word[edi + BOX.height] |
2281 | call draw_rectangle.forced |
2293 | call draw_rectangle.forced |
2282 | pop esi ebx eax |
2294 | pop esi ebx eax |
2283 | ret |
2295 | ret |
2284 | ;------------------------------------------------------------------------------ |
2296 | ;------------------------------------------------------------------------------ |
2285 | ;align 4 |
2297 | ;align 4 |
2286 | ;------------------------------------------------------------------------------ |
2298 | ;------------------------------------------------------------------------------ |
2287 | ;window._.end_moving__box: ;////////////////////////////////////////////////// |
2299 | ;window._.end_moving__box: ;////////////////////////////////////////////////// |
2288 | ;------------------------------------------------------------------------------ |
2300 | ;------------------------------------------------------------------------------ |
2289 | ;? Draw positive box |
2301 | ;? Draw positive box |
2290 | ;------------------------------------------------------------------------------ |
2302 | ;------------------------------------------------------------------------------ |
2291 | ;> edi = pointer to BOX struct |
2303 | ;> edi = pointer to BOX struct |
2292 | ;------------------------------------------------------------------------------ |
2304 | ;------------------------------------------------------------------------------ |
2293 | ; push eax ebx esi |
2305 | ; push eax ebx esi |
2294 | ; xor esi, esi |
2306 | ; xor esi, esi |
2295 | ; jmp window._.draw_negative_box.1 |
2307 | ; jmp window._.draw_negative_box.1 |
2296 | ;------------------------------------------------------------------------------ |
2308 | ;------------------------------------------------------------------------------ |
2297 | align 4 |
2309 | align 4 |
2298 | ;------------------------------------------------------------------------------ |
2310 | ;------------------------------------------------------------------------------ |
2299 | window._.get_rect: ;///////////////////////////////////////////////////// |
2311 | window._.get_rect: ;///////////////////////////////////////////////////// |
2300 | ;------------------------------------------------------------------------------ |
2312 | ;------------------------------------------------------------------------------ |
2301 | ;? |
2313 | ;? |
2302 | ;------------------------------------------------------------------------------ |
2314 | ;------------------------------------------------------------------------------ |
2303 | ;> ecx = pointer to RECT |
2315 | ;> ecx = pointer to RECT |
2304 | ;------------------------------------------------------------------------------ |
2316 | ;------------------------------------------------------------------------------ |
2305 | mov eax, [TASK_BASE] |
2317 | mov eax, [TASK_BASE] |
2306 | 2318 | ||
2307 | mov edx, [eax-twdw + WDATA.box.left] |
2319 | mov edx, [eax-twdw + WDATA.box.left] |
2308 | mov [ecx+RECT.left], edx |
2320 | mov [ecx+RECT.left], edx |
2309 | 2321 | ||
2310 | add edx, [eax-twdw + WDATA.box.width] |
2322 | add edx, [eax-twdw + WDATA.box.width] |
2311 | mov [ecx+RECT.right], edx |
2323 | mov [ecx+RECT.right], edx |
2312 | 2324 | ||
2313 | mov edx, [eax-twdw + WDATA.box.top] |
2325 | mov edx, [eax-twdw + WDATA.box.top] |
2314 | mov [ecx+RECT.top], edx |
2326 | mov [ecx+RECT.top], edx |
2315 | 2327 | ||
2316 | add edx, [eax-twdw + WDATA.box.height] |
2328 | add edx, [eax-twdw + WDATA.box.height] |
2317 | mov [ecx+RECT.bottom], edx |
2329 | mov [ecx+RECT.bottom], edx |
2318 | ret |
2330 | ret |
2319 | ;------------------------------------------------------------------------------ |
2331 | ;------------------------------------------------------------------------------ |
2320 | align 4 |
2332 | align 4 |
2321 | ;------------------------------------------------------------------------------ |
2333 | ;------------------------------------------------------------------------------ |
2322 | window._.redraw_top_wnd: ;//////////////////////////////////////////////////////// |
2334 | window._.redraw_top_wnd: ;//////////////////////////////////////////////////////// |
2323 | ;------------------------------------------------------------------------------ |
2335 | ;------------------------------------------------------------------------------ |
2324 | ;? redraw all windows one above the window |
2336 | ;? redraw all windows one above the window |
2325 | ;------------------------------------------------------------------------------ |
2337 | ;------------------------------------------------------------------------------ |
2326 | ;> eax = left |
2338 | ;> eax = left |
2327 | ;> ebx = top |
2339 | ;> ebx = top |
2328 | ;> ecx = right |
2340 | ;> ecx = right |
2329 | ;> edx = bottom |
2341 | ;> edx = bottom |
2330 | ;> esi = process number |
2342 | ;> esi = process number |
2331 | ;! corrupted edi |
2343 | ;! corrupted edi |
2332 | ;------------------------------------------------------------------------------ |
2344 | ;------------------------------------------------------------------------------ |
2333 | push 0 |
2345 | push 0 |
2334 | jmp window._.set_top_wnd.go |
2346 | jmp window._.set_top_wnd.go |
2335 | 2347 | ||
2336 | align 4 |
2348 | align 4 |
2337 | ;------------------------------------------------------------------------------ |
2349 | ;------------------------------------------------------------------------------ |
2338 | window._.set_top_wnd: ;//////////////////////////////////////////////////////// |
2350 | window._.set_top_wnd: ;//////////////////////////////////////////////////////// |
2339 | ;------------------------------------------------------------------------------ |
2351 | ;------------------------------------------------------------------------------ |
2340 | ;? call set_screen for all windows one above the window |
2352 | ;? call set_screen for all windows one above the window |
2341 | ;------------------------------------------------------------------------------ |
2353 | ;------------------------------------------------------------------------------ |
2342 | ;> eax = left |
2354 | ;> eax = left |
2343 | ;> ebx = top |
2355 | ;> ebx = top |
2344 | ;> ecx = right |
2356 | ;> ecx = right |
2345 | ;> edx = bottom |
2357 | ;> edx = bottom |
2346 | ;> esi = process number |
2358 | ;> esi = process number |
2347 | ;! corrupted edi |
2359 | ;! corrupted edi |
2348 | ;------------------------------------------------------------------------------ |
2360 | ;------------------------------------------------------------------------------ |
2349 | 2361 | ||
2350 | push 1 |
2362 | push 1 |
2351 | .go: |
2363 | .go: |
2352 | push esi |
2364 | push esi |
2353 | pushfd |
2365 | pushfd |
2354 | cli |
2366 | cli |
2355 | 2367 | ||
2356 | push ebp |
2368 | push ebp |
2357 | mov ebp, [TASK_COUNT] |
2369 | mov ebp, [TASK_COUNT] |
2358 | cmp ebp, 1 |
2370 | cmp ebp, 1 |
2359 | jbe .exit |
2371 | jbe .exit |
2360 | 2372 | ||
2361 | shl esi, 5 |
2373 | shl esi, 5 |
2362 | cmp [esi + window_data + WDATA.z_modif], ZPOS_ALWAYS_TOP |
2374 | cmp [esi + window_data + WDATA.z_modif], ZPOS_ALWAYS_TOP |
2363 | je .exit |
2375 | je .exit |
2364 | 2376 | ||
2365 | push eax ;for num layout |
2377 | push eax ;for num layout |
2366 | push edx ecx ebx eax |
2378 | push edx ecx ebx eax |
2367 | 2379 | ||
2368 | movsx eax, byte [esi + window_data + WDATA.z_modif] |
2380 | movsx eax, byte [esi + window_data + WDATA.z_modif] |
2369 | inc eax |
2381 | inc eax |
2370 | mov dword[esp+10h], eax |
2382 | mov dword[esp+10h], eax |
2371 | ;-------------------------------------- |
2383 | ;-------------------------------------- |
2372 | align 4 |
2384 | align 4 |
2373 | .layout: |
2385 | .layout: |
2374 | mov esi, 1 ; = num in window stack |
2386 | mov esi, 1 ; = num in window stack |
2375 | mov ebp, [TASK_COUNT] |
2387 | mov ebp, [TASK_COUNT] |
2376 | ;-------------------------------------- |
2388 | ;-------------------------------------- |
2377 | align 4 |
2389 | align 4 |
2378 | .next_window: |
2390 | .next_window: |
2379 | movzx edi, word[WIN_POS + esi * 2] |
2391 | movzx edi, word[WIN_POS + esi * 2] |
2380 | shl edi, 5 ;size of TASKDATA and WDATA = 32 bytes |
2392 | shl edi, 5 ;size of TASKDATA and WDATA = 32 bytes |
2381 | 2393 | ||
2382 | cmp [CURRENT_TASK + edi + TASKDATA.state], TSTATE_FREE |
2394 | cmp [CURRENT_TASK + edi + TASKDATA.state], TSTATE_FREE |
2383 | je .skip_window |
2395 | je .skip_window |
2384 | 2396 | ||
2385 | add edi, window_data |
2397 | add edi, window_data |
2386 | test [edi + WDATA.fl_wstate], WSTATE_MINIMIZED |
2398 | test [edi + WDATA.fl_wstate], WSTATE_MINIMIZED |
2387 | jnz .skip_window |
2399 | jnz .skip_window |
2388 | 2400 | ||
2389 | mov eax, [esp+10h] |
2401 | mov eax, [esp+10h] |
2390 | cmp [edi + WDATA.z_modif], al |
2402 | cmp [edi + WDATA.z_modif], al |
2391 | jne .skip_window |
2403 | jne .skip_window |
2392 | 2404 | ||
2393 | mov eax, [edi + WDATA.box.left] |
2405 | mov eax, [edi + WDATA.box.left] |
2394 | cmp eax, [esp + RECT.right] |
2406 | cmp eax, [esp + RECT.right] |
2395 | jg .skip_window |
2407 | jg .skip_window |
2396 | mov ebx, [edi + WDATA.box.top] |
2408 | mov ebx, [edi + WDATA.box.top] |
2397 | cmp ebx, [esp + RECT.bottom] |
2409 | cmp ebx, [esp + RECT.bottom] |
2398 | jg .skip_window |
2410 | jg .skip_window |
2399 | mov ecx, [edi + WDATA.box.width] |
2411 | mov ecx, [edi + WDATA.box.width] |
2400 | add ecx, eax |
2412 | add ecx, eax |
2401 | cmp ecx, [esp + RECT.left] |
2413 | cmp ecx, [esp + RECT.left] |
2402 | jl .skip_window |
2414 | jl .skip_window |
2403 | mov edx, [edi + WDATA.box.height] |
2415 | mov edx, [edi + WDATA.box.height] |
2404 | add edx, ebx |
2416 | add edx, ebx |
2405 | cmp edx, [esp + RECT.top] |
2417 | cmp edx, [esp + RECT.top] |
2406 | jl .skip_window |
2418 | jl .skip_window |
2407 | 2419 | ||
2408 | cmp eax, [esp + RECT.left] |
2420 | cmp eax, [esp + RECT.left] |
2409 | jae @f |
2421 | jae @f |
2410 | mov eax, [esp + RECT.left] |
2422 | mov eax, [esp + RECT.left] |
2411 | ;-------------------------------------- |
2423 | ;-------------------------------------- |
2412 | align 4 |
2424 | align 4 |
2413 | @@: |
2425 | @@: |
2414 | cmp ebx, [esp + RECT.top] |
2426 | cmp ebx, [esp + RECT.top] |
2415 | jae @f |
2427 | jae @f |
2416 | mov ebx, [esp + RECT.top] |
2428 | mov ebx, [esp + RECT.top] |
2417 | ;-------------------------------------- |
2429 | ;-------------------------------------- |
2418 | align 4 |
2430 | align 4 |
2419 | @@: |
2431 | @@: |
2420 | cmp ecx, [esp + RECT.right] |
2432 | cmp ecx, [esp + RECT.right] |
2421 | jbe @f |
2433 | jbe @f |
2422 | mov ecx, [esp + RECT.right] |
2434 | mov ecx, [esp + RECT.right] |
2423 | ;-------------------------------------- |
2435 | ;-------------------------------------- |
2424 | align 4 |
2436 | align 4 |
2425 | @@: |
2437 | @@: |
2426 | cmp edx, [esp + RECT.bottom] |
2438 | cmp edx, [esp + RECT.bottom] |
2427 | jbe @f |
2439 | jbe @f |
2428 | mov edx, [esp + RECT.bottom] |
2440 | mov edx, [esp + RECT.bottom] |
2429 | ;-------------------------------------- |
2441 | ;-------------------------------------- |
2430 | align 4 |
2442 | align 4 |
2431 | @@: |
2443 | @@: |
2432 | cmp dword[esp+32], 0 |
2444 | cmp dword[esp+32], 0 |
2433 | je .set_fl_redraw |
2445 | je .set_fl_redraw |
2434 | 2446 | ||
2435 | push esi |
2447 | push esi |
2436 | movzx esi, word[WIN_POS + esi * 2] |
2448 | movzx esi, word[WIN_POS + esi * 2] |
2437 | call window._.set_screen |
2449 | call window._.set_screen |
2438 | pop esi |
2450 | pop esi |
2439 | jmp @f |
2451 | jmp @f |
2440 | .set_fl_redraw: |
2452 | .set_fl_redraw: |
2441 | mov [edi + WDATA.fl_redraw], 1 ;set redraw flag |
2453 | mov [edi + WDATA.fl_redraw], 1 ;set redraw flag |
2442 | @@: |
2454 | @@: |
2443 | ;-------------------------------------- |
2455 | ;-------------------------------------- |
2444 | align 4 |
2456 | align 4 |
2445 | .skip_window: |
2457 | .skip_window: |
2446 | inc esi |
2458 | inc esi |
2447 | dec ebp |
2459 | dec ebp |
2448 | jnz .next_window |
2460 | jnz .next_window |
2449 | ;-------------------------------------- |
2461 | ;-------------------------------------- |
2450 | inc dword[esp+10h] |
2462 | inc dword[esp+10h] |
2451 | cmp byte[esp+10h], ZPOS_ALWAYS_TOP |
2463 | cmp byte[esp+10h], ZPOS_ALWAYS_TOP |
2452 | jle .layout |
2464 | jle .layout |
2453 | ;------------------------------------- |
2465 | ;------------------------------------- |
2454 | 2466 | ||
2455 | pop eax ebx ecx edx |
2467 | pop eax ebx ecx edx |
2456 | pop ebp ;del num layout |
2468 | pop ebp ;del num layout |
2457 | ;------------------------------------- |
2469 | ;------------------------------------- |
2458 | align 4 |
2470 | align 4 |
2459 | .exit: |
2471 | .exit: |
2460 | 2472 | ||
2461 | pop ebp |
2473 | pop ebp |
2462 | popfd |
2474 | popfd |
2463 | pop esi |
2475 | pop esi |
2464 | 2476 | ||
2465 | add esp, 4 ;dword for 0/1 - set_screen/fl_redraw |
2477 | add esp, 4 ;dword for 0/1 - set_screen/fl_redraw |
2466 | ret->->->->=>=>> |
2478 | ret->->->->=>=>> |