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