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