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