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