Subversion Repositories Kolibri OS

Rev

Rev 479 | Rev 549 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 479 Rev 523
1
$Revision: 479 $
1
$Revision: 523 $
2
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
3
;;                                                              ;;
3
;;                                                              ;;
4
;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;;
4
;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;;
5
;; Copyright (C) MenuetOS 2000-2004 Ville Mikael Turjanmaa      ;;
5
;; Copyright (C) MenuetOS 2000-2004 Ville Mikael Turjanmaa      ;;
6
;; Distributed under terms of the GNU General Public License    ;;
6
;; Distributed under terms of the GNU General Public License    ;;
7
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
7
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
8
 
8
 
9
get_titlebar_height: ; edi = window draw_data pointer
9
get_titlebar_height: ; edi = window draw_data pointer
10
	mov	al,[edi+WDATA.fl_wstyle]
10
	mov	al,[edi+WDATA.fl_wstyle]
11
	and	al,0x0F
11
	and	al,0x0F
12
	cmp	al,0x03
12
	cmp	al,0x03
13
	jne	@f
13
	jne	@f
14
	mov	eax,[_skinh]
14
	mov	eax,[_skinh]
15
	ret
15
	ret
16
    @@: mov	eax,21
16
    @@: mov	eax,21
17
	ret
17
	ret
18
 
18
 
19
get_rolledup_height: ; edi = window draw_data pointer
19
get_rolledup_height: ; edi = window draw_data pointer
20
	mov	al,[edi+WDATA.fl_wstyle]
20
	mov	al,[edi+WDATA.fl_wstyle]
21
	and	al,0x0F
21
	and	al,0x0F
22
	cmp	al,0x03
22
	cmp	al,0x03
23
	jne	@f
23
	jne	@f
24
	mov	eax,[_skinh]
24
	mov	eax,[_skinh]
25
	add	eax,3
25
	add	eax,3
26
	ret
26
	ret
27
    @@: or	al,al
27
    @@: or	al,al
28
	jnz	@f
28
	jnz	@f
29
	mov	eax,21
29
	mov	eax,21
30
	ret
30
	ret
31
    @@: mov	eax,21+2
31
    @@: mov	eax,21+2
32
	ret
32
	ret
33
 
33
 
34
 
34
 
35
setwindowdefaults:
35
setwindowdefaults:
36
	pushad
36
	pushad
37
 
37
 
38
	xor   eax,eax
38
	xor   eax,eax
39
	mov   ecx,WIN_STACK
39
	mov   ecx,WIN_STACK
40
       @@:
40
       @@:
41
	inc   eax
41
	inc   eax
42
	add   ecx,2
42
	add   ecx,2
43
	mov   [ecx+0x000],ax	      ; process no
43
	mov   [ecx+0x000],ax	      ; process no
44
	mov   [ecx+0x400],ax	      ; positions in stack
44
	mov   [ecx+0x400],ax	      ; positions in stack
45
	cmp   ecx,WIN_POS-2	       ; the more high, the more surface
45
	cmp   ecx,WIN_POS-2	       ; the more high, the more surface
46
	jnz   @b
46
	jnz   @b
47
 
47
 
48
	popad
48
	popad
49
	ret
49
	ret
50
 
50
 
51
 
51
 
52
 
52
 
53
; eax = cx
53
; eax = cx
54
; ebx = cy
54
; ebx = cy
55
; ecx = ex
55
; ecx = ex
56
; edx = ey
56
; edx = ey
57
; èäåÿ: ïåðåáðàòü âñå îêíà, íà÷èíàÿ ñ ñàìîãî íèæíåãî,
57
; èäåÿ: ïåðåáðàòü âñå îêíà, íà÷èíàÿ ñ ñàìîãî íèæíåãî,
58
;       è äëÿ ïîïàâøèõ â çàäàííóþ îáëàñòü
58
;       è äëÿ ïîïàâøèõ â çàäàííóþ îáëàñòü
59
;       ÷àñòåé îêîí âûçâàòü setscreen
59
;       ÷àñòåé îêîí âûçâàòü setscreen
60
align 4
60
align 4
61
calculatescreen:
61
calculatescreen:
62
	pushad
62
	pushad
63
	pushfd
63
	pushfd
64
	cli
64
	cli
65
 
65
 
66
	push	edx ecx ebx eax
66
	push	edx ecx ebx eax
67
 
67
 
68
	mov	esi, 1
68
	mov	esi, 1
69
	call	setscreen
69
	call	setscreen
70
 
70
 
71
	mov	ebp, [TASK_COUNT]	 ; number of processes
71
	mov	ebp, [TASK_COUNT]	 ; number of processes
72
	cmp	ebp, 1
72
	cmp	ebp, 1
73
	jbe	.finish
73
	jbe	.finish
74
	align 4
74
	align 4
75
      .new_wnd:
75
      .new_wnd:
76
	movzx	edi, word [WIN_POS + esi * 2]
76
	movzx	edi, word [WIN_POS + esi * 2]
77
	shl	edi, 5
77
	shl	edi, 5
78
 
78
 
79
	cmp	[CURRENT_TASK+edi+TASKDATA.state], byte 9
79
	cmp	[CURRENT_TASK+edi+TASKDATA.state], byte 9
80
	je	.not_wnd
80
	je	.not_wnd
81
 
81
 
82
	add	edi, window_data
82
	add	edi, window_data
83
	test	[edi+WDATA.fl_wstate], WSTATE_MINIMIZED
83
	test	[edi+WDATA.fl_wstate], WSTATE_MINIMIZED
84
	jnz	.not_wnd
84
	jnz	.not_wnd
85
 
85
 
86
	mov	eax,[edi+WDATA.box.left]
86
	mov	eax,[edi+WDATA.box.left]
87
	cmp	eax, [esp+RECT.right]
87
	cmp	eax, [esp+RECT.right]
88
	ja	.out_of_bounds
88
	ja	.out_of_bounds
89
	mov	ebx,[edi+WDATA.box.top]
89
	mov	ebx,[edi+WDATA.box.top]
90
	cmp	ebx, [esp+RECT.bottom]
90
	cmp	ebx, [esp+RECT.bottom]
91
	ja	.out_of_bounds
91
	ja	.out_of_bounds
92
	mov	ecx,[edi+WDATA.box.width]
92
	mov	ecx,[edi+WDATA.box.width]
93
	add	ecx, eax
93
	add	ecx, eax
94
	cmp	ecx, [esp+RECT.left]
94
	cmp	ecx, [esp+RECT.left]
95
	jb	.out_of_bounds
95
	jb	.out_of_bounds
96
	mov	edx,[edi+WDATA.box.height]
96
	mov	edx,[edi+WDATA.box.height]
97
	add	edx, ebx
97
	add	edx, ebx
98
	cmp	edx, [esp+RECT.top]
98
	cmp	edx, [esp+RECT.top]
99
	jb	.out_of_bounds
99
	jb	.out_of_bounds
100
 
100
 
101
    cmp     eax, [esp+RECT.left]
101
    cmp     eax, [esp+RECT.left]
102
	jae	@f
102
	jae	@f
103
	mov	eax, [esp+RECT.left]
103
	mov	eax, [esp+RECT.left]
104
     @@:
104
     @@:
105
    cmp     ebx, [esp+RECT.top]
105
    cmp     ebx, [esp+RECT.top]
106
	jae	@f
106
	jae	@f
107
	mov	ebx, [esp+RECT.top]
107
	mov	ebx, [esp+RECT.top]
108
     @@:
108
     @@:
109
    cmp     ecx, [esp+RECT.right]
109
    cmp     ecx, [esp+RECT.right]
110
	jbe	@f
110
	jbe	@f
111
	mov	ecx, [esp+RECT.right]
111
	mov	ecx, [esp+RECT.right]
112
     @@:
112
     @@:
113
    cmp     edx, [esp+RECT.bottom]
113
    cmp     edx, [esp+RECT.bottom]
114
	jbe	@f
114
	jbe	@f
115
	mov	edx, [esp+RECT.bottom]
115
	mov	edx, [esp+RECT.bottom]
116
     @@:
116
     @@:
117
 
117
 
118
	push	esi
118
	push	esi
119
	movzx	esi, word [WIN_POS + esi * 2]
119
	movzx	esi, word [WIN_POS + esi * 2]
120
	call	setscreen
120
	call	setscreen
121
	pop	esi
121
	pop	esi
122
 
122
 
123
      .not_wnd:
123
      .not_wnd:
124
      .out_of_bounds:
124
      .out_of_bounds:
125
	inc	esi
125
	inc	esi
126
	dec	ebp
126
	dec	ebp
127
	jnz	.new_wnd
127
	jnz	.new_wnd
128
      .finish:
128
      .finish:
129
 
129
 
130
    pop     eax ebx ecx edx
130
    pop     eax ebx ecx edx
131
 
131
 
132
	popfd
132
	popfd
133
	popad
133
	popad
134
ret
134
ret
135
 
135
 
136
 
136
 
137
 
137
 
138
virtual at esp
138
virtual at esp
139
  ff_x	   dd ?
139
  ff_x	   dd ?
140
  ff_y	   dd ?
140
  ff_y	   dd ?
141
  ff_width dd ?
141
  ff_width dd ?
142
  ff_xsz   dd ?
142
  ff_xsz   dd ?
143
  ff_ysz   dd ?
143
  ff_ysz   dd ?
144
  ff_scale dd ?
144
  ff_scale dd ?
145
end virtual
145
end virtual
146
 
146
 
147
align 4
147
align 4
148
; ðåçåðâèðóåò ìåñòî ïîä îêíî çàäàííîãî ïðîöåññà
148
; ðåçåðâèðóåò ìåñòî ïîä îêíî çàäàííîãî ïðîöåññà
149
setscreen:
149
setscreen:
150
;  eax  x start
150
;  eax  x start
151
;  ebx  y start
151
;  ebx  y start
152
;  ecx  x end
152
;  ecx  x end
153
;  edx  y end
153
;  edx  y end
154
;  esi  process number
154
;  esi  process number
155
pushad
155
pushad
156
; \begin{diamond}[29.08.2006]
156
; \begin{diamond}[29.08.2006]
157
	cmp	esi, 1
157
	cmp	esi, 1
158
	jz	@f
158
	jz	@f
159
	mov	edi, esi
159
	mov	edi, esi
160
	shl	edi, 5
160
	shl	edi, 5
161
	cmp	[edi+window_data+WDATA.box.width], 0
161
	cmp	[edi+window_data+WDATA.box.width], 0
162
	jnz	@f
162
	jnz	@f
163
	cmp	[edi+window_data+WDATA.box.height], 0
163
	cmp	[edi+window_data+WDATA.box.height], 0
164
	jz	.ret
164
	jz	.ret
165
@@:
165
@@:
166
; \end{diamond}[29.08.2006]
166
; \end{diamond}[29.08.2006]
167
	mov edi, esi ;;;word [esi*2+WIN_POS]
167
	mov edi, esi ;;;word [esi*2+WIN_POS]
168
	shl   edi, 8
168
	shl   edi, 8
169
	add   edi, SLOT_BASE  ; address of random shaped window area
169
	add   edi, SLOT_BASE  ; address of random shaped window area
170
	cmp   [edi+APPDATA.wnd_shape], dword 0
170
	cmp   [edi+APPDATA.wnd_shape], dword 0
171
	jne   .free_form
171
	jne   .free_form
172
 
172
 
173
	; get x&y size
173
	; get x&y size
174
	sub   ecx, eax
174
	sub   ecx, eax
175
	sub   edx, ebx
175
	sub   edx, ebx
176
	inc   ecx
176
	inc   ecx
177
	inc   edx
177
	inc   edx
178
 
178
 
179
	; get WinMap start
179
	; get WinMap start
180
	mov   edi, [ScreenWidth] ; screen_sx
180
	mov   edi, [ScreenWidth] ; screen_sx
181
	inc   edi
181
	inc   edi
182
	imul  edi, ebx
182
	imul  edi, ebx
183
	add   edi, eax
183
	add   edi, eax
184
	add   edi, WinMapAddress
184
	add   edi, WinMapAddress
185
 
185
 
186
  .new_y:
186
  .new_y:
187
	push  ecx ; sx
187
	push  ecx ; sx
188
	push  edx
188
	push  edx
189
 
189
 
190
	mov   edx, esi
190
	mov   edx, esi
191
	align 4
191
	align 4
192
  .new_x:
192
  .new_x:
193
	mov   byte [edi], dl
193
	mov   byte [edi], dl
194
	inc   edi
194
	inc   edi
195
	dec   ecx
195
	dec   ecx
196
	jnz   .new_x
196
	jnz   .new_x
197
 
197
 
198
	pop   edx
198
	pop   edx
199
	pop   ecx
199
	pop   ecx
200
	add   edi, [ScreenWidth]
200
	add   edi, [ScreenWidth]
201
	inc   edi
201
	inc   edi
202
	sub   edi, ecx
202
	sub   edi, ecx
203
	dec   edx
203
	dec   edx
204
	jnz   .new_y
204
	jnz   .new_y
205
.ret:
205
.ret:
206
 popad
206
 popad
207
 ret
207
 ret
208
  .read_byte:
208
  .read_byte:
209
   ;eax - address
209
   ;eax - address
210
   ;esi - slot
210
   ;esi - slot
211
	push  eax
211
	push  eax
212
	push  ebx
212
	push  ebx
213
	push  ecx
213
	push  ecx
214
	push  edx
214
	push  edx
215
	mov   edx,eax
215
	mov   edx,eax
216
	mov   eax,esi
216
	mov   eax,esi
217
	lea   ebx,[esp+12]
217
	lea   ebx,[esp+12]
218
	mov   ecx,1
218
	mov   ecx,1
219
	call  read_process_memory
219
	call  read_process_memory
220
	pop   edx
220
	pop   edx
221
	pop   ecx
221
	pop   ecx
222
	pop   ebx
222
	pop   ebx
223
	pop   eax
223
	pop   eax
224
	ret
224
	ret
225
  .free_form:
225
  .free_form:
226
 
226
 
227
	;  for (y=0; y <= x_size; y++)
227
	;  for (y=0; y <= x_size; y++)
228
	;      for (x=0; x <= x_size; x++)
228
	;      for (x=0; x <= x_size; x++)
229
	;          if (shape[coord(x,y,scale)]==1)
229
	;          if (shape[coord(x,y,scale)]==1)
230
	;             set_pixel(x, y, process_number);
230
	;             set_pixel(x, y, process_number);
231
 
231
 
232
	sub  ecx, eax
232
	sub  ecx, eax
233
	sub  edx, ebx
233
	sub  edx, ebx
234
	inc  ecx
234
	inc  ecx
235
	inc  edx
235
	inc  edx
236
 
236
 
237
	push  dword [edi+APPDATA.wnd_shape_scale]  ; push scale first -> for loop
237
	push  dword [edi+APPDATA.wnd_shape_scale]  ; push scale first -> for loop
238
 
238
 
239
	; get WinMap start  -> ebp
239
	; get WinMap start  -> ebp
240
	push  eax
240
	push  eax
241
	mov   eax, [ScreenWidth] ; screen_sx
241
	mov   eax, [ScreenWidth] ; screen_sx
242
	inc   eax
242
	inc   eax
243
	imul  eax, ebx
243
	imul  eax, ebx
244
	add   eax, [esp]
244
	add   eax, [esp]
245
	add   eax, WinMapAddress
245
	add   eax, WinMapAddress
246
	mov   ebp, eax
246
	mov   ebp, eax
247
 
247
 
248
	mov   edi, [edi+APPDATA.wnd_shape]
248
	mov   edi, [edi+APPDATA.wnd_shape]
249
	pop   eax
249
	pop   eax
250
 
250
 
251
	; eax = x_start
251
	; eax = x_start
252
	; ebx = y_start
252
	; ebx = y_start
253
	; ecx = x_size
253
	; ecx = x_size
254
	; edx = y_size
254
	; edx = y_size
255
	; esi = process_number
255
	; esi = process_number
256
	; edi = &shape
256
	; edi = &shape
257
	;       [scale]
257
	;       [scale]
258
	push edx ecx ; for loop - x,y size
258
	push edx ecx ; for loop - x,y size
259
 
259
 
260
	mov  ecx, esi
260
	mov  ecx, esi
261
	shl  ecx, 5
261
	shl  ecx, 5
262
	mov  edx, [window_data+ecx+WDATA.box.top]
262
	mov  edx, [window_data+ecx+WDATA.box.top]
263
	push [window_data+ecx+WDATA.box.width]	    ; for loop - width
263
	push [window_data+ecx+WDATA.box.width]	    ; for loop - width
264
	mov  ecx, [window_data+ecx+WDATA.box.left]
264
	mov  ecx, [window_data+ecx+WDATA.box.left]
265
	sub  ebx, edx
265
	sub  ebx, edx
266
	sub  eax, ecx
266
	sub  eax, ecx
267
	push ebx eax ; for loop - x,y
267
	push ebx eax ; for loop - x,y
268
 
268
 
269
	add  [ff_xsz], eax
269
	add  [ff_xsz], eax
270
	add  [ff_ysz], ebx
270
	add  [ff_ysz], ebx
271
 
271
 
272
	mov  ebx, [ff_y]
272
	mov  ebx, [ff_y]
273
 
273
 
274
      .ff_new_y:
274
      .ff_new_y:
275
	mov  edx, [ff_x]
275
	mov  edx, [ff_x]
276
 
276
 
277
      .ff_new_x:
277
      .ff_new_x:
278
	; -- body --
278
	; -- body --
279
	mov  ecx, [ff_scale]
279
	mov  ecx, [ff_scale]
280
	mov  eax, [ff_width]
280
	mov  eax, [ff_width]
281
	inc  eax
281
	inc  eax
282
	shr  eax, cl
282
	shr  eax, cl
283
	push ebx edx
283
	push ebx edx
284
	shr  ebx, cl
284
	shr  ebx, cl
285
	shr  edx, cl
285
	shr  edx, cl
286
	imul eax, ebx
286
	imul eax, ebx
287
	add  eax, edx
287
	add  eax, edx
288
	pop  edx ebx
288
	pop  edx ebx
289
	add  eax, edi
289
	add  eax, edi
290
	call .read_byte
290
	call .read_byte
291
	test al,al
291
	test al,al
292
	jz   @f
292
	jz   @f
293
	mov  eax, esi
293
	mov  eax, esi
294
	mov  [ebp], al
294
	mov  [ebp], al
295
       @@:
295
       @@:
296
	; -- end body --
296
	; -- end body --
297
	inc  ebp
297
	inc  ebp
298
	inc  edx
298
	inc  edx
299
	cmp  edx, [ff_xsz]
299
	cmp  edx, [ff_xsz]
300
	jb   .ff_new_x
300
	jb   .ff_new_x
301
	sub  ebp, [ff_xsz]
301
	sub  ebp, [ff_xsz]
302
	add  ebp, [ff_x]
302
	add  ebp, [ff_x]
303
	add  ebp, [ScreenWidth]  ; screen.x
303
	add  ebp, [ScreenWidth]  ; screen.x
304
	inc  ebp
304
	inc  ebp
305
	inc  ebx
305
	inc  ebx
306
	cmp  ebx, [ff_ysz]
306
	cmp  ebx, [ff_ysz]
307
	jb   .ff_new_y
307
	jb   .ff_new_y
308
 
308
 
309
	add  esp, 24
309
	add  esp, 24
310
popad
310
popad
311
ret
311
ret
312
 
312
 
313
 
313
 
314
display_settings:
314
display_settings:
315
 
315
 
316
;    eax = 0         ; DISPLAY redraw
316
;    eax = 0         ; DISPLAY redraw
317
;          ebx = 0   ; all
317
;          ebx = 0   ; all
318
;
318
;
319
;    eax = 1         ; BUTTON type
319
;    eax = 1         ; BUTTON type
320
;          ebx = 0   ; flat
320
;          ebx = 0   ; flat
321
;          ebx = 1   ; 3D
321
;          ebx = 1   ; 3D
322
;    eax = 2         ; set WINDOW colours
322
;    eax = 2         ; set WINDOW colours
323
;          ebx = pointer to table
323
;          ebx = pointer to table
324
;          ecx = number of bytes define
324
;          ecx = number of bytes define
325
;    eax = 3         ; get WINDOW colours
325
;    eax = 3         ; get WINDOW colours
326
;          ebx = pointer to table
326
;          ebx = pointer to table
327
;          ecx = number of bytes wanted
327
;          ecx = number of bytes wanted
328
;    eax = 4         ; get skin height
328
;    eax = 4         ; get skin height
329
;          input  : nothing
329
;          input  : nothing
330
;          output : eax = skin height in pixel
330
;          output : eax = skin height in pixel
331
;    eax = 5         ; get screen workarea
331
;    eax = 5         ; get screen workarea
332
;          input  : nothing
332
;          input  : nothing
333
;          output : eax = [left]*65536+[right]
333
;          output : eax = [left]*65536+[right]
334
;                   ebx = [top]*65536+[bottom]
334
;                   ebx = [top]*65536+[bottom]
335
;    eax = 6         ; set screen workarea
335
;    eax = 6         ; set screen workarea
336
;          input  : ecx = [left]*65536+[right]
336
;          input  : ecx = [left]*65536+[right]
337
;                   edx = [top]*65536+[bottom]
337
;                   edx = [top]*65536+[bottom]
338
;          output : nothing
338
;          output : nothing
339
;    eax = 7         ; get skin margins
339
;    eax = 7         ; get skin margins
340
;          input  : nothing
340
;          input  : nothing
341
;          output : eax = [left]*65536+[right]
341
;          output : eax = [left]*65536+[right]
342
;                   ebx = [top]*65536+[bottom]
342
;                   ebx = [top]*65536+[bottom]
343
;    eax = 8         ; set window skin
343
;    eax = 8         ; set window skin
344
;          input  : ecx = pointer to file info block
344
;          input  : ecx = pointer to file info block
345
;          output : eax = FS error code
345
;          output : eax = FS error code
346
 
346
 
347
 
347
 
348
     pushad
348
     pushad
349
 
349
 
350
     test eax, eax	; redraw display
350
     test eax, eax	; redraw display
351
     jnz  dspl0
351
     jnz  dspl0
352
     test ebx, ebx
352
     test ebx, ebx
353
     jnz  dspl0
353
     jnz  dspl0
354
     cmp  [windowtypechanged],dword 1
354
     cmp  [windowtypechanged],dword 1
355
     jne  dspl00
355
     jne  dspl00
356
     mov  [windowtypechanged],dword 0
356
     mov  [windowtypechanged],dword 0
357
  redraw_screen_direct:
357
  redraw_screen_direct:
358
     mov  [dlx],dword 0
358
     mov  [dlx],dword 0
359
     mov  [dly],dword 0
359
     mov  [dly],dword 0
360
     mov  eax,[ScreenWidth]
360
     mov  eax,[ScreenWidth]
361
     mov  [dlxe],eax
361
     mov  [dlxe],eax
362
     mov  eax,[ScreenHeight]
362
     mov  eax,[ScreenHeight]
363
     mov  [dlye],eax
363
     mov  [dlye],eax
364
     mov  eax,window_data
364
     mov  eax,window_data
365
     call redrawscreen
365
     call redrawscreen
366
   dspl00:
366
   dspl00:
367
     popad
367
     popad
368
     ret
368
     ret
369
   dspl0:
369
   dspl0:
370
 
370
 
371
     cmp  eax,1       ; button type
371
     cmp  eax,1       ; button type
372
     jne  dspl1
372
     jne  dspl1
373
     and  ebx,1
373
     and  ebx,1
374
     cmp  ebx,[buttontype]
374
     cmp  ebx,[buttontype]
375
     je   dspl9
375
     je   dspl9
376
     mov  [buttontype],ebx
376
     mov  [buttontype],ebx
377
     mov  [windowtypechanged],dword 1
377
     mov  [windowtypechanged],dword 1
378
    dspl9:
378
    dspl9:
379
     popad
379
     popad
380
     ret
380
     ret
381
   dspl1:
381
   dspl1:
382
 
382
 
383
     cmp  eax,2       ; set common window colours
383
     cmp  eax,2       ; set common window colours
384
     jne  no_com_colours
384
     jne  no_com_colours
385
     mov  [windowtypechanged],dword 1
385
     mov  [windowtypechanged],dword 1
386
     mov  esi,[TASK_BASE]
386
     mov  esi,[TASK_BASE]
387
     add  esi,TASKDATA.mem_start
387
     add  esi,TASKDATA.mem_start
388
     add  ebx,[esi]
388
     add  ebx,[esi]
389
     mov  esi,ebx
389
     mov  esi,ebx
390
     mov  edi,common_colours
390
     mov  edi,common_colours
391
     and  ecx,127
391
     and  ecx,127
392
     cld
392
     cld
393
     rep  movsb
393
     rep  movsb
394
     popad
394
     popad
395
     ret
395
     ret
396
   no_com_colours:
396
   no_com_colours:
397
 
397
 
398
     cmp  eax,3       ; get common window colours
398
     cmp  eax,3       ; get common window colours
399
     jne  no_get_com
399
     jne  no_get_com
400
     mov  esi,[TASK_BASE]
400
     mov  esi,[TASK_BASE]
401
     add  esi,TASKDATA.mem_start
401
     add  esi,TASKDATA.mem_start
402
     add  ebx,[esi]
402
     add  ebx,[esi]
403
     mov  edi,ebx
403
     mov  edi,ebx
404
     mov  esi,common_colours
404
     mov  esi,common_colours
405
     and  ecx,127
405
     and  ecx,127
406
     cld
406
     cld
407
     rep  movsb
407
     rep  movsb
408
     popad
408
     popad
409
     ret
409
     ret
410
   no_get_com:
410
   no_get_com:
411
 
411
 
412
     cmp  eax,4       ; get skin height
412
     cmp  eax,4       ; get skin height
413
     jne  no_skin_height
413
     jne  no_skin_height
414
     popad
414
     popad
415
     mov  eax,[_skinh]
415
     mov  eax,[_skinh]
416
     mov  [esp+36],eax
416
     mov  [esp+36],eax
417
     ret
417
     ret
418
   no_skin_height:
418
   no_skin_height:
419
 
419
 
420
	cmp	eax,5	    ; get screen workarea
420
	cmp	eax,5	    ; get screen workarea
421
	jne	no_get_workarea
421
	jne	no_get_workarea
422
	popad
422
	popad
423
	mov	eax,[screen_workarea.left-2]
423
	mov	eax,[screen_workarea.left-2]
424
	mov	ax,word[screen_workarea.right]
424
	mov	ax,word[screen_workarea.right]
425
	mov	[esp+36],eax
425
	mov	[esp+36],eax
426
	mov	eax,[screen_workarea.top-2]
426
	mov	eax,[screen_workarea.top-2]
427
	mov	ax,word[screen_workarea.bottom]
427
	mov	ax,word[screen_workarea.bottom]
428
	mov	[esp+24],eax
428
	mov	[esp+24],eax
429
	ret
429
	ret
430
   no_get_workarea:
430
   no_get_workarea:
431
 
431
 
432
	cmp	eax,6	    ; set screen workarea
432
	cmp	eax,6	    ; set screen workarea
433
	jne	no_set_workarea
433
	jne	no_set_workarea
434
	movsx	eax,word[esp+16+2]
434
	movsx	eax,word[esp+16+2]
435
	movsx	ebx,word[esp+16]
435
	movsx	ebx,word[esp+16]
436
	cmp	eax,ebx
436
	cmp	eax,ebx
437
	jge	.lp1
437
	jge	.lp1
438
	or	eax,eax;[ScreenWidth]
438
	or	eax,eax;[ScreenWidth]
439
	jl	@f
439
	jl	@f
440
	mov	[screen_workarea.left],eax
440
	mov	[screen_workarea.left],eax
441
    @@: cmp	ebx,[ScreenWidth]
441
    @@: cmp	ebx,[ScreenWidth]
442
	jg	.lp1
442
	jg	.lp1
443
	mov	[screen_workarea.right],ebx
443
	mov	[screen_workarea.right],ebx
444
  .lp1: movsx	eax,word[esp+24+2]
444
  .lp1: movsx	eax,word[esp+24+2]
445
	movsx	ebx,word[esp+24]
445
	movsx	ebx,word[esp+24]
446
	cmp	eax,ebx
446
	cmp	eax,ebx
447
	jge	.lp2
447
	jge	.lp2
448
	or	eax,eax;[0xFE04]
448
	or	eax,eax;[0xFE04]
449
	jl	@f
449
	jl	@f
450
	mov	[screen_workarea.top],eax
450
	mov	[screen_workarea.top],eax
451
    @@: cmp	ebx,[ScreenHeight]
451
    @@: cmp	ebx,[ScreenHeight]
452
	jg	.lp2
452
	jg	.lp2
453
	mov	[screen_workarea.bottom],ebx
453
	mov	[screen_workarea.bottom],ebx
454
  .lp2: call	repos_windows
454
  .lp2: call	repos_windows
455
	mov	eax, 0
455
	mov	eax, 0
456
	mov	ebx, 0
456
	mov	ebx, 0
457
	mov	ecx, [ScreenWidth]
457
	mov	ecx, [ScreenWidth]
458
	mov	edx, [ScreenHeight]
458
	mov	edx, [ScreenHeight]
459
    call    calculatescreen
459
    call    calculatescreen
460
;    jmp    redraw_screen_direct
460
;    jmp    redraw_screen_direct
461
    .exit:
461
    .exit:
462
	popad
462
	popad
463
	ret
463
	ret
464
   no_set_workarea:
464
   no_set_workarea:
465
 
465
 
466
	cmp	eax,7	    ; get skin margins
466
	cmp	eax,7	    ; get skin margins
467
	jne	no_get_skinmargins
467
	jne	no_get_skinmargins
468
	popad
468
	popad
469
	mov	eax,dword[_skinmargins+0]
469
	mov	eax,dword[_skinmargins+0]
470
	mov	[esp+36],eax
470
	mov	[esp+36],eax
471
	mov	eax,dword[_skinmargins+4]
471
	mov	eax,dword[_skinmargins+4]
472
	mov	[esp+24],eax
472
	mov	[esp+24],eax
473
	ret
473
	ret
474
   no_get_skinmargins:
474
   no_get_skinmargins:
475
 
475
 
476
	cmp	eax,8	    ; set window skin
476
	cmp	eax,8	    ; set window skin
477
	jne	no_set_skin
477
	jne	no_set_skin
478
	mov	eax,ebx
-
 
479
	mov	edi,[TASK_BASE]
-
 
480
	add	ebx,[edi+TASKDATA.mem_start]	    ; abs start of info block
-
 
481
	pushd	[ebx+0] [ebx+4] [ebx+8] [ebx+12]
-
 
482
	mov	dword[ebx+0],0	      ; read
-
 
483
	mov	dword[ebx+4],0	      ; from the beginning
478
        call    read_skin_file
484
	mov	dword[ebx+8],64       ; 32 KBytes maximum
479
        mov     [esp+32+36], eax
485
	mov	ecx,skin_data+64*512
480
        test    eax, eax
486
	sub	ecx,[edi+0x10]
-
 
487
	mov	dword[ebx+12],ecx     ; destination
-
 
488
	push	eax
-
 
489
	pushad
-
 
490
	call	file_system
481
        jnz     .ret
491
	popad
-
 
492
	pop    eax
482
        xor     eax, eax
493
	popd	[ebx+12] [ebx+8] [ebx+4] [ebx+0]
483
        xor     ebx, ebx
494
	cmp	eax,ERROR_SUCCESS
-
 
495
	je	@f
-
 
496
	cmp	eax,ERROR_END_OF_FILE
-
 
497
	jne	.exit
-
 
498
    @@: cmp	[skin_data+64*512+SKIN_HEADER.ident],'SKIN'
-
 
499
	mov	eax,ERROR_UNKNOWN_FS
-
 
500
	jne	.exit
-
 
501
	mov	esi,skin_data+64*512
-
 
502
	mov	edi,skin_data
-
 
503
	mov	ecx,(64*512)/4
-
 
504
	rep	movsd
-
 
505
	call	parse_skin_data
-
 
506
    pushad
-
 
507
	mov	eax, 0
-
 
508
	mov	ebx, 0
-
 
509
	mov	ecx, [ScreenWidth]
484
        mov     ecx, [ScreenWidth]
510
	mov	edx, [ScreenHeight]
485
        mov     edx, [ScreenHeight]
511
	call	calculatescreen
486
        call    calculatescreen
512
    popad
-
 
513
	mov	dword[esp+32+36],0
-
 
514
	jmp	redraw_screen_direct
487
	jmp	redraw_screen_direct
515
  .exit:
488
.ret:
516
	mov	[esp+32+36],eax
-
 
517
	popad
489
        popad
518
	ret
490
        ret
519
   no_set_skin:
491
   no_set_skin:
520
 
492
 
521
     popad
493
     popad
522
     ret
494
     ret
523
 
495
 
524
 
496
 
525
repos_windows:
497
repos_windows:
526
	mov	ecx,[TASK_COUNT]
498
	mov	ecx,[TASK_COUNT]
527
	mov	edi, OS_BASE+0x20*2
499
	mov	edi, OS_BASE+0x20*2
528
    mov    byte[REDRAW_BACKGROUND],1
500
    mov    byte[REDRAW_BACKGROUND],1
529
	dec	ecx
501
	dec	ecx
530
	jge    @f
502
	jge    @f
531
	ret
503
	ret
532
    @@: mov	[edi+WDATA.fl_redraw],1
504
    @@: mov	[edi+WDATA.fl_redraw],1
533
	test	[edi+WDATA.fl_wstate],WSTATE_MAXIMIZED
505
	test	[edi+WDATA.fl_wstate],WSTATE_MAXIMIZED
534
	jz	.lp2
506
	jz	.lp2
535
	mov	eax,[screen_workarea.left]
507
	mov	eax,[screen_workarea.left]
536
	mov	[edi+WDATA.box.left],eax
508
	mov	[edi+WDATA.box.left],eax
537
	sub	eax,[screen_workarea.right]
509
	sub	eax,[screen_workarea.right]
538
	neg	eax
510
	neg	eax
539
	mov	[edi+WDATA.box.width],eax
511
	mov	[edi+WDATA.box.width],eax
540
	mov	eax,[screen_workarea.top]
512
	mov	eax,[screen_workarea.top]
541
	mov	[edi+WDATA.box.top],eax
513
	mov	[edi+WDATA.box.top],eax
542
	test	[edi+WDATA.fl_wstate],WSTATE_ROLLEDUP
514
	test	[edi+WDATA.fl_wstate],WSTATE_ROLLEDUP
543
	jnz	.lp1
515
	jnz	.lp1
544
	sub	eax,[screen_workarea.bottom]
516
	sub	eax,[screen_workarea.bottom]
545
	neg	eax
517
	neg	eax
546
	mov	[edi+WDATA.box.height],eax
518
	mov	[edi+WDATA.box.height],eax
547
  .lp1:
519
  .lp1:
548
 
520
 
549
	call	set_window_clientbox
521
	call	set_window_clientbox
550
	add	edi,0x20
522
	add	edi,0x20
551
	loop	@b
523
	loop	@b
552
	ret
524
	ret
553
  .lp2: mov	eax,[edi+WDATA.box.left]
525
  .lp2: mov	eax,[edi+WDATA.box.left]
554
	add	eax,[edi+WDATA.box.width]
526
	add	eax,[edi+WDATA.box.width]
555
    mov    ebx,[ScreenWidth]
527
    mov    ebx,[ScreenWidth]
556
;    inc    ebx
528
;    inc    ebx
557
    cmp    eax,ebx
529
    cmp    eax,ebx
558
    jle    .lp4
530
    jle    .lp4
559
	mov	eax,[edi+WDATA.box.width]
531
	mov	eax,[edi+WDATA.box.width]
560
    sub    eax,ebx
532
    sub    eax,ebx
561
    jle    .lp3
533
    jle    .lp3
562
	mov	[edi+WDATA.box.width],ebx
534
	mov	[edi+WDATA.box.width],ebx
563
  .lp3: sub	ebx,[edi+WDATA.box.width]
535
  .lp3: sub	ebx,[edi+WDATA.box.width]
564
	mov	[edi+WDATA.box.left],ebx
536
	mov	[edi+WDATA.box.left],ebx
565
  .lp4: mov	eax,[edi+WDATA.box.top]
537
  .lp4: mov	eax,[edi+WDATA.box.top]
566
	add	eax,[edi+WDATA.box.height]
538
	add	eax,[edi+WDATA.box.height]
567
    mov    ebx,[ScreenHeight]
539
    mov    ebx,[ScreenHeight]
568
;    inc    ebx
540
;    inc    ebx
569
    cmp    eax,ebx
541
    cmp    eax,ebx
570
    jle    .lp6
542
    jle    .lp6
571
	mov	eax,[edi+WDATA.box.height]
543
	mov	eax,[edi+WDATA.box.height]
572
    sub    eax,ebx
544
    sub    eax,ebx
573
    jle    .lp5
545
    jle    .lp5
574
	mov	[edi+WDATA.box.height],ebx
546
	mov	[edi+WDATA.box.height],ebx
575
  .lp5: sub	ebx,[edi+WDATA.box.height]
547
  .lp5: sub	ebx,[edi+WDATA.box.height]
576
	mov	[edi+WDATA.box.top],ebx
548
	mov	[edi+WDATA.box.top],ebx
577
  .lp6: jmp	.lp1
549
  .lp6: jmp	.lp1
578
 
550
 
579
uglobal
551
uglobal
580
  common_colours:
552
  common_colours:
581
     times 128 db 0x0
553
     times 128 db 0x0
582
endg
554
endg
583
 
555
 
584
 
556
 
585
 
557
 
586
 
558
 
587
check_window_position:
559
check_window_position:
588
 
560
 
589
    pushad			     ; window inside screen ?
561
    pushad			     ; window inside screen ?
590
 
562
 
591
    movzx eax,word [edi+WDATA.box.left]
563
    movzx eax,word [edi+WDATA.box.left]
592
    movzx ebx,word [edi+WDATA.box.top]
564
    movzx ebx,word [edi+WDATA.box.top]
593
    movzx ecx,word [edi+WDATA.box.width]
565
    movzx ecx,word [edi+WDATA.box.width]
594
    movzx edx,word [edi+WDATA.box.height]
566
    movzx edx,word [edi+WDATA.box.height]
595
 
567
 
596
    mov   esi,ecx	      ; check x pos
568
    mov   esi,ecx	      ; check x pos
597
    add   esi,eax
569
    add   esi,eax
598
    cmp   esi,[ScreenWidth]
570
    cmp   esi,[ScreenWidth]
599
    jbe   x_pos_ok
571
    jbe   x_pos_ok
600
    mov   [edi+WDATA.box.left],dword 0
572
    mov   [edi+WDATA.box.left],dword 0
601
    xor   eax, eax
573
    xor   eax, eax
602
  x_pos_ok:
574
  x_pos_ok:
603
 
575
 
604
    mov   esi,edx	      ; check y pos
576
    mov   esi,edx	      ; check y pos
605
    add   esi,ebx
577
    add   esi,ebx
606
    cmp   esi,[ScreenHeight]
578
    cmp   esi,[ScreenHeight]
607
    jbe   y_pos_ok
579
    jbe   y_pos_ok
608
    mov   [edi+WDATA.box.top],dword 0
580
    mov   [edi+WDATA.box.top],dword 0
609
    mov   ebx,0
581
    mov   ebx,0
610
  y_pos_ok:
582
  y_pos_ok:
611
 
583
 
612
    mov   esi,ecx	      ; check x size
584
    mov   esi,ecx	      ; check x size
613
    add   esi,eax
585
    add   esi,eax
614
    cmp   esi,[ScreenWidth]
586
    cmp   esi,[ScreenWidth]
615
    jbe   x_size_ok
587
    jbe   x_size_ok
616
    mov   ecx,[ScreenWidth]
588
    mov   ecx,[ScreenWidth]
617
    mov   [edi+WDATA.box.width],ecx
589
    mov   [edi+WDATA.box.width],ecx
618
  x_size_ok:
590
  x_size_ok:
619
 
591
 
620
    mov   esi,edx	      ; check y size
592
    mov   esi,edx	      ; check y size
621
    add   esi,ebx
593
    add   esi,ebx
622
    cmp   esi,[ScreenHeight]
594
    cmp   esi,[ScreenHeight]
623
    jbe   y_size_ok
595
    jbe   y_size_ok
624
    mov   edx,[ScreenHeight]
596
    mov   edx,[ScreenHeight]
625
    mov   [edi+WDATA.box.height],edx
597
    mov   [edi+WDATA.box.height],edx
626
  y_size_ok:
598
  y_size_ok:
627
 
599
 
628
    popad
600
    popad
629
 
601
 
630
    ret
602
    ret
631
 
603
 
632
 
604
 
633
uglobal
605
uglobal
634
  new_window_starting dd 0
606
  new_window_starting dd 0
635
endg
607
endg
636
 
608
 
637
 
609
 
638
sys_window_mouse:
610
sys_window_mouse:
639
 
611
 
640
    push  eax
612
    push  eax
641
 
613
 
642
    mov   eax,[timer_ticks]
614
    mov   eax,[timer_ticks]
643
    cmp   [new_window_starting],eax
615
    cmp   [new_window_starting],eax
644
    jb	  swml1
616
    jb	  swml1
645
 
617
 
646
    mov   [MOUSE_BACKGROUND],byte 0  ; no mouse background
618
    mov   [MOUSE_BACKGROUND],byte 0  ; no mouse background
647
    mov   [DONT_DRAW_MOUSE],byte 0  ; draw mouse
619
    mov   [DONT_DRAW_MOUSE],byte 0  ; draw mouse
648
 
620
 
649
    mov   [new_window_starting],eax
621
    mov   [new_window_starting],eax
650
 
622
 
651
  swml1:
623
  swml1:
652
 
624
 
653
    pop   eax
625
    pop   eax
654
 
626
 
655
    ret
627
    ret
656
 
628
 
657
 
629
 
658
 
630
 
659
 
631
 
660
drawwindow_I_caption:
632
drawwindow_I_caption:
661
 
633
 
662
	mov   ecx,[edx+WDATA.cl_titlebar]   ; grab bar
634
	mov   ecx,[edx+WDATA.cl_titlebar]   ; grab bar
663
	push  ecx
635
	push  ecx
664
	mov   esi,edx
636
	mov   esi,edx
665
	mov   edx,[esi+WDATA.box.top]
637
	mov   edx,[esi+WDATA.box.top]
666
	add   edx,1
638
	add   edx,1
667
	mov   ebx,[esi+WDATA.box.top]
639
	mov   ebx,[esi+WDATA.box.top]
668
	add   ebx,21
640
	add   ebx,21
669
	mov   eax,[esi+WDATA.box.top]
641
	mov   eax,[esi+WDATA.box.top]
670
	add   eax,[esi+WDATA.box.height]
642
	add   eax,[esi+WDATA.box.height]
671
	cmp   ebx,eax
643
	cmp   ebx,eax
672
	jb    .wdsizeok
644
	jb    .wdsizeok
673
	mov   ebx,eax
645
	mov   ebx,eax
674
  .wdsizeok:
646
  .wdsizeok:
675
	push  ebx
647
	push  ebx
676
  .drwi:
648
  .drwi:
677
	mov   ebx,edx
649
	mov   ebx,edx
678
	shl   ebx,16
650
	shl   ebx,16
679
	add   ebx,edx
651
	add   ebx,edx
680
	mov   eax,[esi+WDATA.box.left]
652
	mov   eax,[esi+WDATA.box.left]
681
	inc   eax
653
	inc   eax
682
	shl   eax,16
654
	shl   eax,16
683
	add   eax,[esi+WDATA.box.left]
655
	add   eax,[esi+WDATA.box.left]
684
	add   eax,[esi+WDATA.box.width]
656
	add   eax,[esi+WDATA.box.width]
685
	sub   eax,1
657
	sub   eax,1
686
	push  edx
658
	push  edx
687
	mov   edx,0x80000000
659
	mov   edx,0x80000000
688
	mov   ecx,[esi+WDATA.cl_titlebar]
660
	mov   ecx,[esi+WDATA.cl_titlebar]
689
	and   ecx,edx
661
	and   ecx,edx
690
	cmp   ecx,edx
662
	cmp   ecx,edx
691
	jnz   .nofa
663
	jnz   .nofa
692
	mov   ecx,[esi+WDATA.cl_titlebar]
664
	mov   ecx,[esi+WDATA.cl_titlebar]
693
	sub   ecx,0x00040404
665
	sub   ecx,0x00040404
694
	mov   [esi+WDATA.cl_titlebar],ecx
666
	mov   [esi+WDATA.cl_titlebar],ecx
695
	and   ecx,0x00ffffff
667
	and   ecx,0x00ffffff
696
	jmp   .faj
668
	jmp   .faj
697
  .nofa:
669
  .nofa:
698
	mov   ecx,[esi+WDATA.cl_titlebar]
670
	mov   ecx,[esi+WDATA.cl_titlebar]
699
	and   ecx,0x00ffffff
671
	and   ecx,0x00ffffff
700
  .faj:
672
  .faj:
701
	pop   edx
673
	pop   edx
702
	mov   edi,0
674
	mov   edi,0
703
	call  [draw_line]
675
	call  [draw_line]
704
	inc   edx
676
	inc   edx
705
	cmp   edx,[esp]
677
	cmp   edx,[esp]
706
	jb    .drwi
678
	jb    .drwi
707
	add   esp,4
679
	add   esp,4
708
	pop   ecx
680
	pop   ecx
709
	mov   [esi+WDATA.cl_titlebar],ecx
681
	mov   [esi+WDATA.cl_titlebar],ecx
710
 
682
 
711
	ret
683
	ret
712
 
684
 
713
 
685
 
714
drawwindow_I:
686
drawwindow_I:
715
 
687
 
716
	pushad
688
	pushad
717
	or	[edx+WDATA.fl_wdrawn], 4
689
	or	[edx+WDATA.fl_wdrawn], 4
718
 
690
 
719
	mov   esi,[edx+WDATA.cl_frames]   ; rectangle
691
	mov   esi,[edx+WDATA.cl_frames]   ; rectangle
720
	mov   eax,[edx+WDATA.box.left]
692
	mov   eax,[edx+WDATA.box.left]
721
	shl   eax,16
693
	shl   eax,16
722
	add   eax,[edx+WDATA.box.left]
694
	add   eax,[edx+WDATA.box.left]
723
	add   eax,[edx+WDATA.box.width]
695
	add   eax,[edx+WDATA.box.width]
724
	mov   ebx,[edx+WDATA.box.top]
696
	mov   ebx,[edx+WDATA.box.top]
725
	shl   ebx,16
697
	shl   ebx,16
726
	add   ebx,[edx+WDATA.box.top]
698
	add   ebx,[edx+WDATA.box.top]
727
	add   ebx,[edx+WDATA.box.height]
699
	add   ebx,[edx+WDATA.box.height]
728
	call  draw_rectangle
700
	call  draw_rectangle
729
 
701
 
730
	and	[edx+WDATA.fl_wdrawn], not 4
702
	and	[edx+WDATA.fl_wdrawn], not 4
731
	test	[edx+WDATA.fl_wdrawn], 2
703
	test	[edx+WDATA.fl_wdrawn], 2
732
	jz	@f
704
	jz	@f
733
	call	drawwindowframes2
705
	call	drawwindowframes2
734
@@:
706
@@:
735
 
707
 
736
	call	drawwindow_I_caption
708
	call	drawwindow_I_caption
737
 
709
 
738
	mov   edx,[esi+WDATA.box.top]	   ; inside work area
710
	mov   edx,[esi+WDATA.box.top]	   ; inside work area
739
	add   edx,21+5
711
	add   edx,21+5
740
	mov   ebx,[esi+WDATA.box.top]
712
	mov   ebx,[esi+WDATA.box.top]
741
	add   ebx,[esi+WDATA.box.height]
713
	add   ebx,[esi+WDATA.box.height]
742
	cmp   edx,ebx
714
	cmp   edx,ebx
743
	jg    noinside
715
	jg    noinside
744
	mov   eax,1
716
	mov   eax,1
745
	mov   ebx,21
717
	mov   ebx,21
746
	mov   ecx,[esi+WDATA.box.width]
718
	mov   ecx,[esi+WDATA.box.width]
747
	mov   edx,[esi+WDATA.box.height]
719
	mov   edx,[esi+WDATA.box.height]
748
	mov   edi,[esi+WDATA.cl_workarea]
720
	mov   edi,[esi+WDATA.cl_workarea]
749
	test  edi,0x40000000
721
	test  edi,0x40000000
750
	jnz   noinside
722
	jnz   noinside
751
	call  [drawbar]
723
	call  [drawbar]
752
      noinside:
724
      noinside:
753
 
725
 
754
	popad
726
	popad
755
 
727
 
756
	ret
728
	ret
757
 
729
 
758
 
730
 
759
draw_rectangle:
731
draw_rectangle:
760
 
732
 
761
r_eax equ [esp+28]   ; x start
733
r_eax equ [esp+28]   ; x start
762
r_ax  equ [esp+30]   ; x end
734
r_ax  equ [esp+30]   ; x end
763
r_ebx equ [esp+16]   ; y start
735
r_ebx equ [esp+16]   ; y start
764
r_bx  equ [esp+18]   ; y end
736
r_bx  equ [esp+18]   ; y end
765
;esi                 ; color
737
;esi                 ; color
766
 
738
 
767
	pushad
739
	pushad
768
 
740
 
769
	mov   ecx,esi	       ; yb,xb -> yb,xe
741
	mov   ecx,esi	       ; yb,xb -> yb,xe
770
	mov   eax, r_eax
742
	mov   eax, r_eax
771
	rol   eax, 16
743
	rol   eax, 16
772
	mov   ebx,r_ebx
744
	mov   ebx,r_ebx
773
	shl   ebx,16
745
	shl   ebx,16
774
	mov   bx,r_ebx
746
	mov   bx,r_ebx
775
	xor   edi, edi
747
	xor   edi, edi
776
	call  [draw_line]
748
	call  [draw_line]
777
 
749
 
778
	mov   ebx,r_bx	       ; ye,xb -> ye,xe
750
	mov   ebx,r_bx	       ; ye,xb -> ye,xe
779
	shl   ebx,16
751
	shl   ebx,16
780
	mov   bx,r_bx
752
	mov   bx,r_bx
781
	call  [draw_line]
753
	call  [draw_line]
782
 
754
 
783
	mov   ecx,esi	       ; ya,xa -> ye,xa
755
	mov   ecx,esi	       ; ya,xa -> ye,xa
784
	mov   eax,r_eax
756
	mov   eax,r_eax
785
	shl   eax,16
757
	shl   eax,16
786
	mov   ax,r_eax
758
	mov   ax,r_eax
787
	mov   ebx,r_ebx
759
	mov   ebx,r_ebx
788
	shl   ebx,16
760
	shl   ebx,16
789
	mov   bx,r_bx
761
	mov   bx,r_bx
790
	mov   edi,0
762
	mov   edi,0
791
	call  [draw_line]
763
	call  [draw_line]
792
 
764
 
793
	mov   eax,r_ax	     ; ya,xe -> ye,xe
765
	mov   eax,r_ax	     ; ya,xe -> ye,xe
794
	shl   eax,16
766
	shl   eax,16
795
	mov   ax,r_ax
767
	mov   ax,r_ax
796
	call  [draw_line]
768
	call  [draw_line]
797
 
769
 
798
	popad
770
	popad
799
	ret
771
	ret
800
 
772
 
801
 
773
 
802
drawwindow_III_caption:
774
drawwindow_III_caption:
803
 
775
 
804
	mov   ecx,[edx+WDATA.cl_titlebar]			; GRAB BAR
776
	mov   ecx,[edx+WDATA.cl_titlebar]			; GRAB BAR
805
	push  ecx
777
	push  ecx
806
	mov   esi,edx
778
	mov   esi,edx
807
	mov   edx,[esi+WDATA.box.top]
779
	mov   edx,[esi+WDATA.box.top]
808
	add   edx,4
780
	add   edx,4
809
	mov   ebx,[esi+WDATA.box.top]
781
	mov   ebx,[esi+WDATA.box.top]
810
	add   ebx,20
782
	add   ebx,20
811
	mov   eax,[esi+WDATA.box.top]
783
	mov   eax,[esi+WDATA.box.top]
812
	add   eax,[esi+WDATA.box.height]
784
	add   eax,[esi+WDATA.box.height]
813
	cmp   ebx,eax
785
	cmp   ebx,eax
814
	jb    .wdsizeok
786
	jb    .wdsizeok
815
	mov   ebx,eax
787
	mov   ebx,eax
816
  .wdsizeok:
788
  .wdsizeok:
817
	push  ebx
789
	push  ebx
818
  .drwi:
790
  .drwi:
819
	mov   ebx,edx
791
	mov   ebx,edx
820
	shl   ebx,16
792
	shl   ebx,16
821
	add   ebx,edx
793
	add   ebx,edx
822
	mov   eax,[esi+WDATA.box.left]
794
	mov   eax,[esi+WDATA.box.left]
823
	shl   eax,16
795
	shl   eax,16
824
	add   eax,[esi+WDATA.box.left]
796
	add   eax,[esi+WDATA.box.left]
825
	add   eax,[esi+WDATA.box.width]
797
	add   eax,[esi+WDATA.box.width]
826
	add   eax,4*65536-4
798
	add   eax,4*65536-4
827
	mov   ecx,[esi+WDATA.cl_titlebar]
799
	mov   ecx,[esi+WDATA.cl_titlebar]
828
	test  ecx,0x40000000
800
	test  ecx,0x40000000
829
	jz    .nofa
801
	jz    .nofa
830
	add   ecx,0x040404
802
	add   ecx,0x040404
831
  .nofa:
803
  .nofa:
832
	test  ecx,0x80000000
804
	test  ecx,0x80000000
833
	jz    .nofa2
805
	jz    .nofa2
834
	sub   ecx,0x040404
806
	sub   ecx,0x040404
835
  .nofa2:
807
  .nofa2:
836
	mov   [esi+WDATA.cl_titlebar],ecx
808
	mov   [esi+WDATA.cl_titlebar],ecx
837
	and   ecx,0xffffff
809
	and   ecx,0xffffff
838
	xor   edi, edi
810
	xor   edi, edi
839
	call  [draw_line]
811
	call  [draw_line]
840
	inc   edx
812
	inc   edx
841
	cmp   edx,[esp]
813
	cmp   edx,[esp]
842
	jb    .drwi
814
	jb    .drwi
843
	add   esp,4
815
	add   esp,4
844
	pop   ecx
816
	pop   ecx
845
	mov   [esi+WDATA.cl_titlebar],ecx
817
	mov   [esi+WDATA.cl_titlebar],ecx
846
 
818
 
847
	ret
819
	ret
848
 
820
 
849
 
821
 
850
drawwindow_III:
822
drawwindow_III:
851
 
823
 
852
	pushad
824
	pushad
853
 
825
 
854
	mov   edi,edx				   ; RECTANGLE
826
	mov   edi,edx				   ; RECTANGLE
855
	mov   eax,[edi+WDATA.box.left]
827
	mov   eax,[edi+WDATA.box.left]
856
	shl   eax,16
828
	shl   eax,16
857
    mov   ax, word [edi+WDATA.box.left]
829
    mov   ax, word [edi+WDATA.box.left]
858
    add   ax, word [edi+WDATA.box.width]
830
    add   ax, word [edi+WDATA.box.width]
859
	mov   ebx,[edi+WDATA.box.top]
831
	mov   ebx,[edi+WDATA.box.top]
860
	shl   ebx,16
832
	shl   ebx,16
861
    mov   bx, word [edi+WDATA.box.top]
833
    mov   bx, word [edi+WDATA.box.top]
862
    add   bx, word [edi+WDATA.box.height]
834
    add   bx, word [edi+WDATA.box.height]
863
	mov   esi,[edi+WDATA.cl_frames]
835
	mov   esi,[edi+WDATA.cl_frames]
864
	shr   esi,1
836
	shr   esi,1
865
	and   esi,0x007f7f7f
837
	and   esi,0x007f7f7f
866
	push  esi
838
	push  esi
867
	or	[edi+WDATA.fl_wdrawn], 4
839
	or	[edi+WDATA.fl_wdrawn], 4
868
	call  draw_rectangle
840
	call  draw_rectangle
869
	and	[edi+WDATA.fl_wdrawn], not 4
841
	and	[edi+WDATA.fl_wdrawn], not 4
870
	test	[edi+WDATA.fl_wdrawn], 2
842
	test	[edi+WDATA.fl_wdrawn], 2
871
	jz	@f
843
	jz	@f
872
	call	drawwindowframes2
844
	call	drawwindowframes2
873
@@:
845
@@:
874
	mov   ecx,3
846
	mov   ecx,3
875
      dw3l:
847
      dw3l:
876
	add   eax,1*65536-1
848
	add   eax,1*65536-1
877
	add   ebx,1*65536-1
849
	add   ebx,1*65536-1
878
	mov   esi,[edi+WDATA.cl_frames]
850
	mov   esi,[edi+WDATA.cl_frames]
879
	call  draw_rectangle
851
	call  draw_rectangle
880
	dec   ecx
852
	dec   ecx
881
	jnz   dw3l
853
	jnz   dw3l
882
	pop   esi
854
	pop   esi
883
	add   eax,1*65536-1
855
	add   eax,1*65536-1
884
	add   ebx,1*65536-1
856
	add   ebx,1*65536-1
885
	call  draw_rectangle
857
	call  draw_rectangle
886
 
858
 
887
	call	drawwindow_III_caption
859
	call	drawwindow_III_caption
888
 
860
 
889
	mov   edx,[esi+WDATA.box.top]			    ; WORK AREA
861
	mov   edx,[esi+WDATA.box.top]			    ; WORK AREA
890
	add   edx,21+5
862
	add   edx,21+5
891
	mov   ebx,[esi+WDATA.box.top]
863
	mov   ebx,[esi+WDATA.box.top]
892
	add   ebx,[esi+WDATA.box.height]
864
	add   ebx,[esi+WDATA.box.height]
893
	cmp   edx,ebx
865
	cmp   edx,ebx
894
	jg    noinside2
866
	jg    noinside2
895
	mov   eax,5
867
	mov   eax,5
896
	mov   ebx,20
868
	mov   ebx,20
897
	mov   ecx,[esi+WDATA.box.width]
869
	mov   ecx,[esi+WDATA.box.width]
898
	mov   edx,[esi+WDATA.box.height]
870
	mov   edx,[esi+WDATA.box.height]
899
	sub   ecx,4
871
	sub   ecx,4
900
	sub   edx,4
872
	sub   edx,4
901
	mov   edi,[esi+WDATA.cl_workarea]
873
	mov   edi,[esi+WDATA.cl_workarea]
902
	test  edi,0x40000000
874
	test  edi,0x40000000
903
	jnz   noinside2
875
	jnz   noinside2
904
	call  [drawbar]
876
	call  [drawbar]
905
      noinside2:
877
      noinside2:
906
 
878
 
907
	popad
879
	popad
908
 
880
 
909
	ret
881
	ret
910
 
882
 
911
 
883
 
912
 
884
 
913
; activate window
885
; activate window
914
align 4
886
align 4
915
windowactivate:
887
windowactivate:
916
 
888
 
917
	; esi = abs mem position in stack 0xC400+
889
	; esi = abs mem position in stack 0xC400+
918
 
890
 
919
	pushad
891
	pushad
920
 
892
 
921
     ; if type of current active window is 3,
893
     ; if type of current active window is 3,
922
     ; it must be redrawn
894
     ; it must be redrawn
923
	mov   eax, [TASK_COUNT]
895
	mov   eax, [TASK_COUNT]
924
	movzx eax, word [WIN_POS + eax*2]
896
	movzx eax, word [WIN_POS + eax*2]
925
	shl   eax, 5
897
	shl   eax, 5
926
	add   eax, window_data
898
	add   eax, window_data
927
	mov   ebx, [eax + WDATA.cl_workarea]
899
	mov   ebx, [eax + WDATA.cl_workarea]
928
	and   ebx, 0x0f000000
900
	and   ebx, 0x0f000000
929
	cmp   ebx, 0x03000000
901
	cmp   ebx, 0x03000000
930
	jne   @f
902
	jne   @f
931
	mov   [eax + WDATA.fl_redraw], byte 1
903
	mov   [eax + WDATA.fl_redraw], byte 1
932
     @@:
904
     @@:
933
 
905
 
934
	push   esi
906
	push   esi
935
      movzx   eax, word [esi] ; ax <- process no
907
      movzx   eax, word [esi] ; ax <- process no
936
      movzx   eax, word [WIN_STACK+eax*2] ; ax <- position in window stack
908
      movzx   eax, word [WIN_STACK+eax*2] ; ax <- position in window stack
937
 
909
 
938
	xor   esi, esi	      ; drop others
910
	xor   esi, esi	      ; drop others
939
      waloop:
911
      waloop:
940
	cmp   esi, dword [TASK_COUNT]
912
	cmp   esi, dword [TASK_COUNT]
941
	jae   wacont
913
	jae   wacont
942
	inc   esi
914
	inc   esi
943
	lea   edi, [WIN_STACK + esi*2]
915
	lea   edi, [WIN_STACK + esi*2]
944
	mov   bx, [edi] ; position of the current process
916
	mov   bx, [edi] ; position of the current process
945
	cmp   bx, ax
917
	cmp   bx, ax
946
	jbe   @f
918
	jbe   @f
947
	dec   bx       ; upper? => drop!
919
	dec   bx       ; upper? => drop!
948
	mov   [edi], bx
920
	mov   [edi], bx
949
      @@:
921
      @@:
950
	jmp   waloop
922
	jmp   waloop
951
      wacont:
923
      wacont:
952
			    ; set to no 1
924
			    ; set to no 1
953
	pop   esi	    ;   esi = pointer at 0xC400
925
	pop   esi	    ;   esi = pointer at 0xC400
954
 
926
 
955
      movzx   eax, word [esi]
927
      movzx   eax, word [esi]
956
	mov   bx, [TASK_COUNT]	; number of processes
928
	mov   bx, [TASK_COUNT]	; number of processes
957
	mov   [WIN_STACK+eax*2], bx	; this is the last (and the upper)
929
	mov   [WIN_STACK+eax*2], bx	; this is the last (and the upper)
958
 
930
 
959
	; update on screen -window stack
931
	; update on screen -window stack
960
	xor   esi, esi
932
	xor   esi, esi
961
      waloop2:
933
      waloop2:
962
	mov   edi, [TASK_COUNT]
934
	mov   edi, [TASK_COUNT]
963
	cmp   esi, edi
935
	cmp   esi, edi
964
	jae   wacont2
936
	jae   wacont2
965
	inc   esi
937
	inc   esi
966
	movzx ebx, word [esi*2 + WIN_STACK]
938
	movzx ebx, word [esi*2 + WIN_STACK]
967
	mov   [ebx*2 + WIN_POS], si
939
	mov   [ebx*2 + WIN_POS], si
968
	jmp   waloop2
940
	jmp   waloop2
969
      wacont2:
941
      wacont2:
970
	mov   [KEY_COUNT], byte 0	      ; empty keyboard buffer
942
	mov   [KEY_COUNT], byte 0	      ; empty keyboard buffer
971
	mov   [BTN_COUNT], byte 0	      ; empty button buffer
943
	mov   [BTN_COUNT], byte 0	      ; empty button buffer
972
	mov   [MOUSE_SCROLL_H], word 0  ; zero mouse z-index
944
	mov   [MOUSE_SCROLL_H], word 0  ; zero mouse z-index
973
	mov   [MOUSE_SCROLL_V], word 0  ; zero mouse z-index
945
	mov   [MOUSE_SCROLL_V], word 0  ; zero mouse z-index
974
	popad
946
	popad
975
	ret
947
	ret
976
 
948
 
977
 
949
 
978
; check if window is necessary to draw
950
; check if window is necessary to draw
979
 
951
 
980
checkwindowdraw:
952
checkwindowdraw:
981
 
953
 
982
	; edi = position in window_data+
954
	; edi = position in window_data+
983
 
955
 
984
	mov   eax, [edi + WDATA.cl_workarea]
956
	mov   eax, [edi + WDATA.cl_workarea]
985
	and   eax, 0x0f000000
957
	and   eax, 0x0f000000
986
	cmp   eax, 0x03000000
958
	cmp   eax, 0x03000000
987
	je    .return_yes      ; window type 3
959
	je    .return_yes      ; window type 3
988
 
960
 
989
	mov   esi, edi
961
	mov   esi, edi
990
	sub   esi, window_data
962
	sub   esi, window_data
991
	shr   esi, 5
963
	shr   esi, 5
992
 
964
 
993
	; esi = process number
965
	; esi = process number
994
 
966
 
995
	movzx eax, word [WIN_STACK + esi * 2] ; get value of the curr process
967
	movzx eax, word [WIN_STACK + esi * 2] ; get value of the curr process
996
	lea   esi, [WIN_POS + eax * 2]	    ; get address of this process at 0xC400
968
	lea   esi, [WIN_POS + eax * 2]	    ; get address of this process at 0xC400
997
 
969
 
998
	push  esi
970
	push  esi
999
 
971
 
1000
      .new_check:
972
      .new_check:
1001
 
973
 
1002
	pop   esi
974
	pop   esi
1003
	add   esi, 2
975
	add   esi, 2
1004
	push  esi
976
	push  esi
1005
 
977
 
1006
	mov   eax, [TASK_COUNT]
978
	mov   eax, [TASK_COUNT]
1007
	lea   eax, word [WIN_POS + eax * 2] ; number of the upper window
979
	lea   eax, word [WIN_POS + eax * 2] ; number of the upper window
1008
 
980
 
1009
	cmp   esi, eax
981
	cmp   esi, eax
1010
	ja    .all_wnds_to_top
982
	ja    .all_wnds_to_top
1011
 
983
 
1012
	movzx eax, word [esi]
984
	movzx eax, word [esi]
1013
	shl   eax, 5
985
	shl   eax, 5
1014
	cmp   [CURRENT_TASK + eax + TASKDATA.state], byte 9
986
	cmp   [CURRENT_TASK + eax + TASKDATA.state], byte 9
1015
	je    .new_check		    ; skip dead windows
987
	je    .new_check		    ; skip dead windows
1016
 
988
 
1017
	lea   esi, [eax+window_data]
989
	lea   esi, [eax+window_data]
1018
 
990
 
1019
	mov   ebx, [edi+WDATA.box.top]	; y0
991
	mov   ebx, [edi+WDATA.box.top]	; y0
1020
	mov   edx, [edi+WDATA.box.height]
992
	mov   edx, [edi+WDATA.box.height]
1021
	add   edx, ebx	    ; y0e
993
	add   edx, ebx	    ; y0e
1022
 
994
 
1023
	mov   ecx, [esi+WDATA.box.top]	; y  ; y check
995
	mov   ecx, [esi+WDATA.box.top]	; y  ; y check
1024
	cmp   ecx, edx
996
	cmp   ecx, edx
1025
	jae   .new_check     ; y < y0e
997
	jae   .new_check     ; y < y0e
1026
	mov   eax, [esi+WDATA.box.height]
998
	mov   eax, [esi+WDATA.box.height]
1027
	add   ecx, eax	     ; ye
999
	add   ecx, eax	     ; ye
1028
	cmp   ebx, ecx	     ; y0 >= ye
1000
	cmp   ebx, ecx	     ; y0 >= ye
1029
	ja    .new_check
1001
	ja    .new_check
1030
 
1002
 
1031
	mov   eax, [edi+WDATA.box.left]   ; x0
1003
	mov   eax, [edi+WDATA.box.left]   ; x0
1032
	mov   ecx, [edi+WDATA.box.width]
1004
	mov   ecx, [edi+WDATA.box.width]
1033
	add   ecx, eax	     ; x0e
1005
	add   ecx, eax	     ; x0e
1034
 
1006
 
1035
	mov   edx, [esi+WDATA.box.left]   ; x ; x check
1007
	mov   edx, [esi+WDATA.box.left]   ; x ; x check
1036
	cmp   edx, ecx
1008
	cmp   edx, ecx
1037
	jae   .new_check     ; x < x0e
1009
	jae   .new_check     ; x < x0e
1038
	mov   ecx, [esi+WDATA.box.width]
1010
	mov   ecx, [esi+WDATA.box.width]
1039
	add   edx, ecx
1011
	add   edx, ecx
1040
	cmp   eax, edx
1012
	cmp   eax, edx
1041
	ja    .new_check
1013
	ja    .new_check
1042
 
1014
 
1043
	pop   esi
1015
	pop   esi
1044
  .return_yes:
1016
  .return_yes:
1045
	mov   ecx,1   ; overlap some window
1017
	mov   ecx,1   ; overlap some window
1046
	ret
1018
	ret
1047
 
1019
 
1048
  .all_wnds_to_top:
1020
  .all_wnds_to_top:
1049
 
1021
 
1050
	pop   esi
1022
	pop   esi
1051
 
1023
 
1052
	xor   ecx, ecx	     ; passed all windows to top
1024
	xor   ecx, ecx	     ; passed all windows to top
1053
	ret
1025
	ret
1054
 
1026
 
1055
 
1027
 
1056
 
1028
 
1057
 
1029
 
1058
waredraw:     ; if redraw necessary at activate
1030
waredraw:     ; if redraw necessary at activate
1059
 
1031
 
1060
	pushad
1032
	pushad
1061
 
1033
 
1062
	call  checkwindowdraw	   ; draw window on activation ?
1034
	call  checkwindowdraw	   ; draw window on activation ?
1063
	test  ecx, ecx
1035
	test  ecx, ecx
1064
	jz    .do_not_draw
1036
	jz    .do_not_draw
1065
 
1037
 
1066
	popad
1038
	popad
1067
	mov   [MOUSE_DOWN], byte 1     ; do draw mouse
1039
	mov   [MOUSE_DOWN], byte 1     ; do draw mouse
1068
	call  windowactivate
1040
	call  windowactivate
1069
 
1041
 
1070
	; update screen info
1042
	; update screen info
1071
	pushad
1043
	pushad
1072
	mov   edi, [TASK_COUNT] ; the last process (number)
1044
	mov   edi, [TASK_COUNT] ; the last process (number)
1073
	movzx esi, word [WIN_POS + edi * 2]
1045
	movzx esi, word [WIN_POS + edi * 2]
1074
	shl   esi, 5
1046
	shl   esi, 5
1075
	add   esi, window_data
1047
	add   esi, window_data
1076
 
1048
 
1077
	; coordinates of the upper window
1049
	; coordinates of the upper window
1078
    mov   eax, [esi + WDATA.box.left]	; cx
1050
    mov   eax, [esi + WDATA.box.left]	; cx
1079
    mov   ebx, [esi + WDATA.box.top]	; cy
1051
    mov   ebx, [esi + WDATA.box.top]	; cy
1080
    mov   ecx, [esi + WDATA.box.width]	; sx
1052
    mov   ecx, [esi + WDATA.box.width]	; sx
1081
    mov   edx, [esi + WDATA.box.height] ; sy
1053
    mov   edx, [esi + WDATA.box.height] ; sy
1082
 
1054
 
1083
	add   ecx, eax	     ; ecx = x_end
1055
	add   ecx, eax	     ; ecx = x_end
1084
	add   edx, ebx	     ; edx = y_end
1056
	add   edx, ebx	     ; edx = y_end
1085
 
1057
 
1086
	mov   edi, [TASK_COUNT]
1058
	mov   edi, [TASK_COUNT]
1087
	movzx esi, word [WIN_POS + edi * 2]
1059
	movzx esi, word [WIN_POS + edi * 2]
1088
	call  setscreen
1060
	call  setscreen
1089
	popad
1061
	popad
1090
 
1062
 
1091
    mov   [edi + WDATA.fl_redraw], 1  ; redraw flag for app
1063
    mov   [edi + WDATA.fl_redraw], 1  ; redraw flag for app
1092
    mov   [MOUSE_DOWN],byte 0		  ; mouse down checks
1064
    mov   [MOUSE_DOWN],byte 0		  ; mouse down checks
1093
 
1065
 
1094
	ret
1066
	ret
1095
 
1067
 
1096
     .do_not_draw:
1068
     .do_not_draw:
1097
 
1069
 
1098
	popad
1070
	popad
1099
 
1071
 
1100
	call  windowactivate
1072
	call  windowactivate
1101
	mov   [MOUSE_DOWN],byte 0  ; mouse down checks
1073
	mov   [MOUSE_DOWN],byte 0  ; mouse down checks
1102
	mov   [MOUSE_BACKGROUND],byte 0  ; no mouse background
1074
	mov   [MOUSE_BACKGROUND],byte 0  ; no mouse background
1103
	mov   [DONT_DRAW_MOUSE],byte 0	; draw mouse
1075
	mov   [DONT_DRAW_MOUSE],byte 0	; draw mouse
1104
	ret
1076
	ret
1105
 
1077
 
1106
 
1078
 
1107
; eax = window number on screen
1079
; eax = window number on screen
1108
; corrupts registers and [dl*]
1080
; corrupts registers and [dl*]
1109
minimize_window:
1081
minimize_window:
1110
	movzx eax, word [WIN_POS+eax*2]
1082
	movzx eax, word [WIN_POS+eax*2]
1111
	shl   eax, 5
1083
	shl   eax, 5
1112
	add   eax, window_data
1084
	add   eax, window_data
1113
	test  [eax+WDATA.fl_wstate], WSTATE_MINIMIZED
1085
	test  [eax+WDATA.fl_wstate], WSTATE_MINIMIZED
1114
	jnz   .skip_redrawings
1086
	jnz   .skip_redrawings
1115
	pushfd
1087
	pushfd
1116
	cli
1088
	cli
1117
	or    [eax+WDATA.fl_wstate], WSTATE_MINIMIZED
1089
	or    [eax+WDATA.fl_wstate], WSTATE_MINIMIZED
1118
	mov   edi, eax
1090
	mov   edi, eax
1119
	;call  calculatescreen
1091
	;call  calculatescreen
1120
	mov   eax, [edi+WDATA.box.left]
1092
	mov   eax, [edi+WDATA.box.left]
1121
	mov   [dlx], eax
1093
	mov   [dlx], eax
1122
	mov   ecx, eax
1094
	mov   ecx, eax
1123
	add   ecx, [edi+WDATA.box.width]
1095
	add   ecx, [edi+WDATA.box.width]
1124
	mov   [dlxe], ecx
1096
	mov   [dlxe], ecx
1125
	mov   ebx, [edi+WDATA.box.top]
1097
	mov   ebx, [edi+WDATA.box.top]
1126
	mov   [dly], ebx
1098
	mov   [dly], ebx
1127
	mov   edx, ebx
1099
	mov   edx, ebx
1128
	add   edx, [edi+WDATA.box.height]
1100
	add   edx, [edi+WDATA.box.height]
1129
	mov   [dlye], edx
1101
	mov   [dlye], edx
1130
	call  calculatescreen
1102
	call  calculatescreen
1131
	xor   esi, esi
1103
	xor   esi, esi
1132
	xor   eax, eax
1104
	xor   eax, eax
1133
	call  redrawscreen
1105
	call  redrawscreen
1134
	popfd
1106
	popfd
1135
.skip_redrawings:
1107
.skip_redrawings:
1136
	ret
1108
	ret
1137
 
1109
 
1138
; eax = window number on screen
1110
; eax = window number on screen
1139
; corrupts registers and [dl*]
1111
; corrupts registers and [dl*]
1140
restore_minimized_window:
1112
restore_minimized_window:
1141
	pushfd
1113
	pushfd
1142
	cli
1114
	cli
1143
	movzx esi, word [WIN_POS+eax*2]
1115
	movzx esi, word [WIN_POS+eax*2]
1144
	mov   edi, esi
1116
	mov   edi, esi
1145
	shl   edi, 5
1117
	shl   edi, 5
1146
	add   edi, window_data
1118
	add   edi, window_data
1147
	test  [edi+WDATA.fl_wstate], WSTATE_MINIMIZED
1119
	test  [edi+WDATA.fl_wstate], WSTATE_MINIMIZED
1148
	jz    .skip_redrawings
1120
	jz    .skip_redrawings
1149
	mov   [edi+WDATA.fl_redraw], 1
1121
	mov   [edi+WDATA.fl_redraw], 1
1150
	and   [edi+WDATA.fl_wstate], not WSTATE_MINIMIZED
1122
	and   [edi+WDATA.fl_wstate], not WSTATE_MINIMIZED
1151
	cmp   eax, [TASK_COUNT] ; the uppermost window
1123
	cmp   eax, [TASK_COUNT] ; the uppermost window
1152
	jnz   .no_uppermost
1124
	jnz   .no_uppermost
1153
	mov   eax, [edi+WDATA.box.left]
1125
	mov   eax, [edi+WDATA.box.left]
1154
	mov   ebx, [edi+WDATA.box.top]
1126
	mov   ebx, [edi+WDATA.box.top]
1155
	mov   ecx, eax
1127
	mov   ecx, eax
1156
	mov   edx, ebx
1128
	mov   edx, ebx
1157
	add   ecx, [edi+WDATA.box.width]
1129
	add   ecx, [edi+WDATA.box.width]
1158
	add   edx, [edi+WDATA.box.height]
1130
	add   edx, [edi+WDATA.box.height]
1159
	call  setscreen
1131
	call  setscreen
1160
	jmp   .done
1132
	jmp   .done
1161
.no_uppermost:
1133
.no_uppermost:
1162
	mov   eax, [edi+WDATA.box.left]
1134
	mov   eax, [edi+WDATA.box.left]
1163
	mov   ebx, [edi+WDATA.box.top]
1135
	mov   ebx, [edi+WDATA.box.top]
1164
	mov   ecx, eax
1136
	mov   ecx, eax
1165
	mov   edx, ebx
1137
	mov   edx, ebx
1166
	add   ecx, [edi+WDATA.box.width]
1138
	add   ecx, [edi+WDATA.box.width]
1167
	add   edx, [edi+WDATA.box.height]
1139
	add   edx, [edi+WDATA.box.height]
1168
	call  calculatescreen
1140
	call  calculatescreen
1169
.done:
1141
.done:
1170
	mov   [MOUSE_BACKGROUND],byte 0 ; no mouse under
1142
	mov   [MOUSE_BACKGROUND],byte 0 ; no mouse under
1171
.skip_redrawings:
1143
.skip_redrawings:
1172
	popfd
1144
	popfd
1173
	ret
1145
	ret
1174
 
1146
 
1175
 
1147
 
1176
iglobal
1148
iglobal
1177
  window_moving   db 'K : Window - move/resize',13,10,0
1149
  window_moving   db 'K : Window - move/resize',13,10,0
1178
  window_moved	  db 'K : Window - done',13,10,0
1150
  window_moved	  db 'K : Window - done',13,10,0
1179
endg
1151
endg
1180
 
1152
 
1181
; check window touch
1153
; check window touch
1182
align 4
1154
align 4
1183
checkwindows:
1155
checkwindows:
1184
	pushad
1156
	pushad
1185
 
1157
 
1186
	cmp   [window_minimize], 0
1158
	cmp   [window_minimize], 0
1187
	je    .no_minimizing
1159
	je    .no_minimizing
1188
	mov   eax, [TASK_COUNT]       ; the uppermost window
1160
	mov   eax, [TASK_COUNT]       ; the uppermost window
1189
	mov   bl, 0
1161
	mov   bl, 0
1190
	xchg  [window_minimize], bl
1162
	xchg  [window_minimize], bl
1191
	cmp   bl, 1
1163
	cmp   bl, 1
1192
	jne   .restore
1164
	jne   .restore
1193
	call  minimize_window
1165
	call  minimize_window
1194
	jmp   .continue
1166
	jmp   .continue
1195
  .restore:
1167
  .restore:
1196
	call  restore_minimized_window
1168
	call  restore_minimized_window
1197
  .continue:
1169
  .continue:
1198
  .no_minimizing:
1170
  .no_minimizing:
1199
 
1171
 
1200
	cmp   [BTN_DOWN],byte 0    ; mouse buttons pressed ?
1172
	cmp   [BTN_DOWN],byte 0    ; mouse buttons pressed ?
1201
	jne  .mouse_buttons_pressed
1173
	jne  .mouse_buttons_pressed
1202
;..................................... start 1/4 : modified by vhanla .................
1174
;..................................... start 1/4 : modified by vhanla .................
1203
	mov [bPressedMouseXY_W],0
1175
	mov [bPressedMouseXY_W],0
1204
;..................................... end 1/4 : modified by vhanla ...................
1176
;..................................... end 1/4 : modified by vhanla ...................
1205
	popad
1177
	popad
1206
	ret
1178
	ret
1207
    .mouse_buttons_pressed:
1179
    .mouse_buttons_pressed:
1208
;..................................... start 2/4 : modified by vhanla .................
1180
;..................................... start 2/4 : modified by vhanla .................
1209
	jmp @f
1181
	jmp @f
1210
	bPressedMouseXY_W db 0x0
1182
	bPressedMouseXY_W db 0x0
1211
	@@:
1183
	@@:
1212
;..................................... end 2/4 : modified by vhanla ...................
1184
;..................................... end 2/4 : modified by vhanla ...................
1213
	mov   esi,[TASK_COUNT]
1185
	mov   esi,[TASK_COUNT]
1214
	inc   esi
1186
	inc   esi
1215
 
1187
 
1216
;..................................... start 3/4 : modified by vhanla .................
1188
;..................................... start 3/4 : modified by vhanla .................
1217
	push ax
1189
	push ax
1218
	cmp [bPressedMouseXY_W],0
1190
	cmp [bPressedMouseXY_W],0
1219
	jnz @f
1191
	jnz @f
1220
	mov [bPressedMouseXY_W],1
1192
	mov [bPressedMouseXY_W],1
1221
	mov ax,[MOUSE_X]
1193
	mov ax,[MOUSE_X]
1222
	mov [mx],ax
1194
	mov [mx],ax
1223
	mov ax,[MOUSE_Y]
1195
	mov ax,[MOUSE_Y]
1224
	mov [my],ax
1196
	mov [my],ax
1225
	@@:
1197
	@@:
1226
	pop ax
1198
	pop ax
1227
;..................................... end 3/4 : modified by vhanla ...................
1199
;..................................... end 3/4 : modified by vhanla ...................
1228
 
1200
 
1229
      cwloop:
1201
      cwloop:
1230
	cmp   esi,2
1202
	cmp   esi,2
1231
	jb   .exit
1203
	jb   .exit
1232
 
1204
 
1233
	dec   esi
1205
	dec   esi
1234
	movzx edi, word [WIN_POS + esi * 2] ; ebx
1206
	movzx edi, word [WIN_POS + esi * 2] ; ebx
1235
	shl   edi, 5
1207
	shl   edi, 5
1236
	add   edi, window_data
1208
	add   edi, window_data
1237
;        mov   edi, ebx
1209
;        mov   edi, ebx
1238
    mov   ecx, [edi + WDATA.box.left]
1210
    mov   ecx, [edi + WDATA.box.left]
1239
    mov   edx, [edi + WDATA.box.top]
1211
    mov   edx, [edi + WDATA.box.top]
1240
 
1212
 
1241
	mov   eax,ecx
1213
	mov   eax,ecx
1242
	mov   ebx,edx
1214
	mov   ebx,edx
1243
	test	[edi+WDATA.fl_wstate],WSTATE_MINIMIZED
1215
	test	[edi+WDATA.fl_wstate],WSTATE_MINIMIZED
1244
	jnz	cwloop
1216
	jnz	cwloop
1245
 
1217
 
1246
;..................................... start 4/4 : modified by vhanla .................
1218
;..................................... start 4/4 : modified by vhanla .................
1247
       movzx  eax, word [mx]; movzx eax,word[MOUSE_X]
1219
       movzx  eax, word [mx]; movzx eax,word[MOUSE_X]
1248
       movzx  ebx, word [my]; movzx ebx,word[MOUSE_Y]
1220
       movzx  ebx, word [my]; movzx ebx,word[MOUSE_Y]
1249
;..................................... endt 4/4 : modified by vhanla ..................
1221
;..................................... endt 4/4 : modified by vhanla ..................
1250
	cmp   ecx, eax
1222
	cmp   ecx, eax
1251
	jae   cwloop
1223
	jae   cwloop
1252
	cmp   edx, ebx
1224
	cmp   edx, ebx
1253
	jae   cwloop
1225
	jae   cwloop
1254
    add   ecx, [edi + WDATA.box.width]
1226
    add   ecx, [edi + WDATA.box.width]
1255
    add   edx, [edi + WDATA.box.height]
1227
    add   edx, [edi + WDATA.box.height]
1256
	cmp   eax, ecx
1228
	cmp   eax, ecx
1257
	jae   cwloop
1229
	jae   cwloop
1258
	cmp   ebx, edx
1230
	cmp   ebx, edx
1259
	jae   cwloop
1231
	jae   cwloop
1260
 
1232
 
1261
	pushad
1233
	pushad
1262
	mov   eax, esi
1234
	mov   eax, esi
1263
	mov   ebx, [TASK_COUNT]
1235
	mov   ebx, [TASK_COUNT]
1264
	cmp   eax, ebx	    ; is this window active?
1236
	cmp   eax, ebx	    ; is this window active?
1265
	jz    .move_resize_window
1237
	jz    .move_resize_window
1266
 
1238
 
1267
	; eax = position in windowing stack
1239
	; eax = position in windowing stack
1268
	; redraw must ?
1240
	; redraw must ?
1269
	lea   esi, [WIN_POS + esi * 2]
1241
	lea   esi, [WIN_POS + esi * 2]
1270
	call  waredraw
1242
	call  waredraw
1271
	add   esp, 32
1243
	add   esp, 32
1272
 
1244
 
1273
      .exit:
1245
      .exit:
1274
	popad
1246
	popad
1275
	ret
1247
	ret
1276
 
1248
 
1277
   .move_resize_window:    ; MOVE OR RESIZE WINDOW
1249
   .move_resize_window:    ; MOVE OR RESIZE WINDOW
1278
	popad
1250
	popad
1279
 
1251
 
1280
	; Check for user enabled fixed window
1252
	; Check for user enabled fixed window
1281
    mov   edx, [edi + WDATA.cl_titlebar]
1253
    mov   edx, [edi + WDATA.cl_titlebar]
1282
	and   edx, 0x0f000000
1254
	and   edx, 0x0f000000
1283
	cmp   edx, 0x01000000
1255
	cmp   edx, 0x01000000
1284
	jne   .window_move_enabled_for_user
1256
	jne   .window_move_enabled_for_user
1285
	popad
1257
	popad
1286
	ret
1258
	ret
1287
      .window_move_enabled_for_user:
1259
      .window_move_enabled_for_user:
1288
 
1260
 
1289
    test    [edi+WDATA.fl_wstate],WSTATE_ROLLEDUP
1261
    test    [edi+WDATA.fl_wstate],WSTATE_ROLLEDUP
1290
	jnz	.no_resize_2
1262
	jnz	.no_resize_2
1291
 
1263
 
1292
	mov   [do_resize_from_corner],byte 0   ; resize for skinned window
1264
	mov   [do_resize_from_corner],byte 0   ; resize for skinned window
1293
    mov   edx, [edi + WDATA.cl_workarea]
1265
    mov   edx, [edi + WDATA.cl_workarea]
1294
	and   edx, 0x0f000000
1266
	and   edx, 0x0f000000
1295
	cmp   edx, 0x02000000
1267
	cmp   edx, 0x02000000
1296
	jb    .no_resize_2 ; not type 2 wnd
1268
	jb    .no_resize_2 ; not type 2 wnd
1297
 
1269
 
1298
    mov   edx, [edi + WDATA.box.top]
1270
    mov   edx, [edi + WDATA.box.top]
1299
    add   edx, [edi + WDATA.box.height]
1271
    add   edx, [edi + WDATA.box.height]
1300
	sub   edx, 6	   ; edx = y_end - 6
1272
	sub   edx, 6	   ; edx = y_end - 6
1301
	cmp   ebx, edx	   ; ebx = mouse_y
1273
	cmp   ebx, edx	   ; ebx = mouse_y
1302
	jb    .no_resize_2
1274
	jb    .no_resize_2
1303
	mov   [do_resize_from_corner],byte 1
1275
	mov   [do_resize_from_corner],byte 1
1304
	jmp   .continue
1276
	jmp   .continue
1305
      .no_resize_2:
1277
      .no_resize_2:
1306
 
1278
 
1307
	push	eax
1279
	push	eax
1308
	call	get_titlebar_height
1280
	call	get_titlebar_height
1309
    add     eax,[edi + WDATA.box.top]
1281
    add     eax,[edi + WDATA.box.top]
1310
	cmp	ebx,eax
1282
	cmp	ebx,eax
1311
	pop	eax
1283
	pop	eax
1312
	jae	.exit
1284
	jae	.exit
1313
 
1285
 
1314
     .continue:
1286
     .continue:
1315
 
1287
 
1316
	push  esi
1288
	push  esi
1317
	mov   esi, window_moving
1289
	mov   esi, window_moving
1318
	call  sys_msg_board_str
1290
	call  sys_msg_board_str
1319
	pop   esi
1291
	pop   esi
1320
 
1292
 
1321
	mov   ecx, [timer_ticks]     ; double-click ?
1293
	mov   ecx, [timer_ticks]     ; double-click ?
1322
	mov   edx, ecx
1294
	mov   edx, ecx
1323
	sub   edx, [latest_window_touch]
1295
	sub   edx, [latest_window_touch]
1324
	mov   [latest_window_touch], ecx
1296
	mov   [latest_window_touch], ecx
1325
	mov   [latest_window_touch_delta], edx
1297
	mov   [latest_window_touch_delta], edx
1326
 
1298
 
1327
	mov   cl, [BTN_DOWN]	 ; save for shade check
1299
	mov   cl, [BTN_DOWN]	 ; save for shade check
1328
	mov   [do_resize], cl
1300
	mov   [do_resize], cl
1329
     no_emulation_righ_button:
1301
     no_emulation_righ_button:
1330
    mov   ecx, [edi + WDATA.box.left]
1302
    mov   ecx, [edi + WDATA.box.left]
1331
    mov   edx, [edi + WDATA.box.top]
1303
    mov   edx, [edi + WDATA.box.top]
1332
 
1304
 
1333
	push  eax ecx edx
1305
	push  eax ecx edx
1334
	mov   [dlx], ecx      ; save for drawlimits
1306
	mov   [dlx], ecx      ; save for drawlimits
1335
	mov   [dly], edx
1307
	mov   [dly], edx
1336
    mov   eax, [edi + WDATA.box.width]
1308
    mov   eax, [edi + WDATA.box.width]
1337
	add   ecx, eax
1309
	add   ecx, eax
1338
    mov   eax, [edi + WDATA.box.height]
1310
    mov   eax, [edi + WDATA.box.height]
1339
	add   edx, eax
1311
	add   edx, eax
1340
	mov   [dlxe], ecx
1312
	mov   [dlxe], ecx
1341
	mov   [dlye], edx
1313
	mov   [dlye], edx
1342
	pop   edx ecx eax
1314
	pop   edx ecx eax
1343
 
1315
 
1344
	sub   eax, ecx
1316
	sub   eax, ecx
1345
	sub   ebx, edx
1317
	sub   ebx, edx
1346
 
1318
 
1347
	mov   esi, [MOUSE_X]
1319
	mov   esi, [MOUSE_X]
1348
	mov   [WIN_TEMP_XY], esi
1320
	mov   [WIN_TEMP_XY], esi
1349
 
1321
 
1350
	pushad		 ; wait for putimages to finish
1322
	pushad		 ; wait for putimages to finish
1351
;        mov   eax,5
1323
;        mov   eax,5
1352
;        call  delay_hs
1324
;        call  delay_hs
1353
    mov   eax,[edi + WDATA.box.left]
1325
    mov   eax,[edi + WDATA.box.left]
1354
	mov   [npx],eax
1326
	mov   [npx],eax
1355
    mov   eax,[edi + WDATA.box.top]
1327
    mov   eax,[edi + WDATA.box.top]
1356
	mov   [npy],eax
1328
	mov   [npy],eax
1357
	popad
1329
	popad
1358
 
1330
 
1359
	push eax		  ; save old coordinates
1331
	push eax		  ; save old coordinates
1360
    mov   ax, word [edi + WDATA.box.left]
1332
    mov   ax, word [edi + WDATA.box.left]
1361
	mov   word [oldc+BOX.left],ax
1333
	mov   word [oldc+BOX.left],ax
1362
    mov   ax, word [edi + WDATA.box.top]
1334
    mov   ax, word [edi + WDATA.box.top]
1363
	mov   word [oldc+BOX.top],ax
1335
	mov   word [oldc+BOX.top],ax
1364
    mov   ax, word [edi + WDATA.box.width]
1336
    mov   ax, word [edi + WDATA.box.width]
1365
	mov   word [oldc+BOX.width],ax
1337
	mov   word [oldc+BOX.width],ax
1366
	mov   word [npxe],ax
1338
	mov   word [npxe],ax
1367
    mov   ax, word [edi + WDATA.box.height]
1339
    mov   ax, word [edi + WDATA.box.height]
1368
	mov   word [oldc+BOX.height],ax
1340
	mov   word [oldc+BOX.height],ax
1369
	mov   word [npye],ax
1341
	mov   word [npye],ax
1370
	pop eax
1342
	pop eax
1371
 
1343
 
1372
	call  drawwindowframes
1344
	call  drawwindowframes
1373
 
1345
 
1374
	mov   [reposition],0
1346
	mov   [reposition],0
1375
	mov   [MOUSE_DOWN],byte 1   ; no reaction to mouse up/down
1347
	mov   [MOUSE_DOWN],byte 1   ; no reaction to mouse up/down
1376
 
1348
 
1377
	; move window
1349
	; move window
1378
 
1350
 
1379
      newchm:
1351
      newchm:
1380
 
1352
 
1381
	mov   [DONT_DRAW_MOUSE],byte 1
1353
	mov   [DONT_DRAW_MOUSE],byte 1
1382
 
1354
 
1383
	call  checkidle
1355
	call  checkidle
1384
 
1356
 
1385
	call  checkVga_N13
1357
	call  checkVga_N13
1386
 
1358
 
1387
	mov   [MOUSE_BACKGROUND],byte 0
1359
	mov   [MOUSE_BACKGROUND],byte 0
1388
 
1360
 
1389
	call  [draw_pointer]
1361
	call  [draw_pointer]
1390
 
1362
 
1391
	pushad
1363
	pushad
1392
	call   stack_handler
1364
	call   stack_handler
1393
	popad
1365
	popad
1394
 
1366
 
1395
	mov   esi,[WIN_TEMP_XY]
1367
	mov   esi,[WIN_TEMP_XY]
1396
	cmp   esi,[MOUSE_X]
1368
	cmp   esi,[MOUSE_X]
1397
	je    cwb
1369
	je    cwb
1398
 
1370
 
1399
	mov   cx,[MOUSE_X]
1371
	mov   cx,[MOUSE_X]
1400
	mov   dx,[MOUSE_Y]
1372
	mov   dx,[MOUSE_Y]
1401
	sub   cx,ax
1373
	sub   cx,ax
1402
	sub   dx,bx
1374
	sub   dx,bx
1403
 
1375
 
1404
	push  ax
1376
	push  ax
1405
	push  bx
1377
	push  bx
1406
 
1378
 
1407
	call  drawwindowframes
1379
	call  drawwindowframes
1408
 
1380
 
1409
	mov   ax,[ScreenWidth]
1381
	mov   ax,[ScreenWidth]
1410
	mov   bx,[ScreenHeight]
1382
	mov   bx,[ScreenHeight]
1411
 
1383
 
1412
	cmp   [do_resize_from_corner],1
1384
	cmp   [do_resize_from_corner],1
1413
	je    no_new_position
1385
	je    no_new_position
1414
 
1386
 
1415
	mov   word [npx],word 0     ; x repos ?
1387
	mov   word [npx],word 0     ; x repos ?
1416
	cmp   ax,cx
1388
	cmp   ax,cx
1417
	jb    noreposx
1389
	jb    noreposx
1418
	mov   [reposition],1
1390
	mov   [reposition],1
1419
	sub   ax,word [npxe]
1391
	sub   ax,word [npxe]
1420
	mov   word [npx],ax
1392
	mov   word [npx],ax
1421
	cmp   ax,cx
1393
	cmp   ax,cx
1422
	jb    noreposx
1394
	jb    noreposx
1423
	mov   word [npx],cx
1395
	mov   word [npx],cx
1424
      noreposx:
1396
      noreposx:
1425
 
1397
 
1426
	mov   word [npy],word 0     ; y repos ?
1398
	mov   word [npy],word 0     ; y repos ?
1427
	cmp   bx,dx
1399
	cmp   bx,dx
1428
	jb    noreposy
1400
	jb    noreposy
1429
	mov   [reposition],1
1401
	mov   [reposition],1
1430
	sub   bx,word [npye]
1402
	sub   bx,word [npye]
1431
	mov   word [npy],bx
1403
	mov   word [npy],bx
1432
	cmp   bx,dx
1404
	cmp   bx,dx
1433
	jb    noreposy
1405
	jb    noreposy
1434
	mov   word [npy],dx
1406
	mov   word [npy],dx
1435
      noreposy:
1407
      noreposy:
1436
 
1408
 
1437
      no_new_position:
1409
      no_new_position:
1438
 
1410
 
1439
	cmp   [do_resize_from_corner],0    ; resize from right corner
1411
	cmp   [do_resize_from_corner],0    ; resize from right corner
1440
	je    norepos_size
1412
	je    norepos_size
1441
	pushad
1413
	pushad
1442
 
1414
 
1443
	mov   edx,edi
1415
	mov   edx,edi
1444
	sub   edx,window_data
1416
	sub   edx,window_data
1445
	;shr   edx,5
1417
	;shr   edx,5
1446
	;shl   edx,8
1418
	;shl   edx,8
1447
	;add   edx,0x80000                 ; process base at 0x80000+
1419
	;add   edx,0x80000                 ; process base at 0x80000+
1448
    lea   edx, [SLOT_BASE + edx*8]
1420
    lea   edx, [SLOT_BASE + edx*8]
1449
 
1421
 
1450
	movzx eax,word [MOUSE_X]
1422
	movzx eax,word [MOUSE_X]
1451
    cmp   eax,[edi + WDATA.box.left]
1423
    cmp   eax,[edi + WDATA.box.left]
1452
	jb    nnepx
1424
	jb    nnepx
1453
    sub   eax,[edi + WDATA.box.left]
1425
    sub   eax,[edi + WDATA.box.left]
1454
	cmp   eax,32 ; [edx+0x90+8]
1426
	cmp   eax,32 ; [edx+0x90+8]
1455
	jge   nnepx2
1427
	jge   nnepx2
1456
	mov   eax,32 ; [edx+0x90+8]
1428
	mov   eax,32 ; [edx+0x90+8]
1457
      nnepx2:
1429
      nnepx2:
1458
	mov   [npxe],eax
1430
	mov   [npxe],eax
1459
      nnepx:
1431
      nnepx:
1460
 
1432
 
1461
	call	get_rolledup_height
1433
	call	get_rolledup_height
1462
	mov	ebx,eax
1434
	mov	ebx,eax
1463
	movzx eax,word [MOUSE_Y]
1435
	movzx eax,word [MOUSE_Y]
1464
    cmp   eax,[edi + WDATA.box.top]
1436
    cmp   eax,[edi + WDATA.box.top]
1465
	jb    nnepy
1437
	jb    nnepy
1466
    sub   eax,[edi + WDATA.box.top]
1438
    sub   eax,[edi + WDATA.box.top]
1467
	cmp	eax,ebx ; [edx+0x90+12]
1439
	cmp	eax,ebx ; [edx+0x90+12]
1468
	jge	nnepy2
1440
	jge	nnepy2
1469
	mov	eax,ebx ; [edx+0x90+12]
1441
	mov	eax,ebx ; [edx+0x90+12]
1470
      nnepy2:
1442
      nnepy2:
1471
	mov   [npye],eax
1443
	mov   [npye],eax
1472
      nnepy:
1444
      nnepy:
1473
 
1445
 
1474
	mov   [reposition],1
1446
	mov   [reposition],1
1475
 
1447
 
1476
	popad
1448
	popad
1477
      norepos_size:
1449
      norepos_size:
1478
 
1450
 
1479
	pop   bx
1451
	pop   bx
1480
	pop   ax
1452
	pop   ax
1481
	call  drawwindowframes
1453
	call  drawwindowframes
1482
 
1454
 
1483
	mov   esi,[MOUSE_X]
1455
	mov   esi,[MOUSE_X]
1484
	mov   [WIN_TEMP_XY],esi
1456
	mov   [WIN_TEMP_XY],esi
1485
 
1457
 
1486
      cwb:
1458
      cwb:
1487
	cmp   [BTN_DOWN],byte 0
1459
	cmp   [BTN_DOWN],byte 0
1488
	jne   newchm
1460
	jne   newchm
1489
				     ; new position done
1461
				     ; new position done
1490
	mov	[DONT_DRAW_MOUSE],byte 1
1462
	mov	[DONT_DRAW_MOUSE],byte 1
1491
	mov	cl,0
1463
	mov	cl,0
1492
	test	[edi+WDATA.fl_wstate],WSTATE_MAXIMIZED
1464
	test	[edi+WDATA.fl_wstate],WSTATE_MAXIMIZED
1493
	jnz	@f
1465
	jnz	@f
1494
	mov	cl,[reposition]
1466
	mov	cl,[reposition]
1495
	call	drawwindowframes
1467
	call	drawwindowframes
1496
 
1468
 
1497
	mov   eax,[npx]
1469
	mov   eax,[npx]
1498
    mov   [edi + WDATA.box.left],eax
1470
    mov   [edi + WDATA.box.left],eax
1499
	mov   eax,[npy]
1471
	mov   eax,[npy]
1500
    mov   [edi + WDATA.box.top],eax
1472
    mov   [edi + WDATA.box.top],eax
1501
	mov   eax,[npxe]
1473
	mov   eax,[npxe]
1502
    mov   [edi + WDATA.box.width],eax
1474
    mov   [edi + WDATA.box.width],eax
1503
	mov   eax,[npye]
1475
	mov   eax,[npye]
1504
    mov   [edi + WDATA.box.height],eax
1476
    mov   [edi + WDATA.box.height],eax
1505
	call	set_window_clientbox
1477
	call	set_window_clientbox
1506
 
1478
 
1507
    @@: mov	[reposition],cl
1479
    @@: mov	[reposition],cl
1508
 
1480
 
1509
	cmp   [reposition],1	     ; save new position and size
1481
	cmp   [reposition],1	     ; save new position and size
1510
	jne   no_bounds_save
1482
	jne   no_bounds_save
1511
	push  esi edi ecx
1483
	push  esi edi ecx
1512
	mov   esi,edi
1484
	mov   esi,edi
1513
	mov   ecx,2
1485
	mov   ecx,2
1514
	test  [edi+WDATA.fl_wstate],WSTATE_ROLLEDUP or WSTATE_MAXIMIZED
1486
	test  [edi+WDATA.fl_wstate],WSTATE_ROLLEDUP or WSTATE_MAXIMIZED
1515
	jnz   @f
1487
	jnz   @f
1516
	add   ecx,2
1488
	add   ecx,2
1517
    @@: sub   edi,window_data
1489
    @@: sub   edi,window_data
1518
	shr   edi,5
1490
	shr   edi,5
1519
	shl   edi,8
1491
	shl   edi,8
1520
	add   edi,SLOT_BASE+APPDATA.saved_box
1492
	add   edi,SLOT_BASE+APPDATA.saved_box
1521
	cld
1493
	cld
1522
	rep   movsd
1494
	rep   movsd
1523
	pop   ecx edi esi
1495
	pop   ecx edi esi
1524
      no_bounds_save:
1496
      no_bounds_save:
1525
 
1497
 
1526
	pushad				   ; WINDOW SHADE/FULLSCREEN
1498
	pushad				   ; WINDOW SHADE/FULLSCREEN
1527
 
1499
 
1528
	cmp   [reposition],1
1500
	cmp   [reposition],1
1529
	je    no_window_sizing
1501
	je    no_window_sizing
1530
	mov   edx,edi
1502
	mov   edx,edi
1531
	sub   edx,window_data
1503
	sub   edx,window_data
1532
	shr   edx,5
1504
	shr   edx,5
1533
	shl   edx,8
1505
	shl   edx,8
1534
	add   edx,SLOT_BASE		    ; process base at 0x80000+
1506
	add   edx,SLOT_BASE		    ; process base at 0x80000+
1535
 
1507
 
1536
	cmp   [do_resize],2		  ; window shade ?
1508
	cmp   [do_resize],2		  ; window shade ?
1537
	jne   no_window_shade
1509
	jne   no_window_shade
1538
	mov   [reposition],1
1510
	mov   [reposition],1
1539
 
1511
 
1540
	test	[edi+WDATA.fl_wstate],WSTATE_ROLLEDUP
1512
	test	[edi+WDATA.fl_wstate],WSTATE_ROLLEDUP
1541
	jnz	wnd_rolldown
1513
	jnz	wnd_rolldown
1542
  wnd_rollup:
1514
  wnd_rollup:
1543
	or	[edi+WDATA.fl_wstate],WSTATE_ROLLEDUP
1515
	or	[edi+WDATA.fl_wstate],WSTATE_ROLLEDUP
1544
	call	get_rolledup_height
1516
	call	get_rolledup_height
1545
	jmp	@f
1517
	jmp	@f
1546
  wnd_rolldown:
1518
  wnd_rolldown:
1547
	and	[edi+WDATA.fl_wstate],not WSTATE_ROLLEDUP
1519
	and	[edi+WDATA.fl_wstate],not WSTATE_ROLLEDUP
1548
    mov     eax,[edx + APPDATA.saved_box.height] ; 0x90+BOX.height
1520
    mov     eax,[edx + APPDATA.saved_box.height] ; 0x90+BOX.height
1549
	test	[edi+WDATA.fl_wstate],WSTATE_MAXIMIZED
1521
	test	[edi+WDATA.fl_wstate],WSTATE_MAXIMIZED
1550
	jz	@f
1522
	jz	@f
1551
	mov	eax,[screen_workarea.bottom]
1523
	mov	eax,[screen_workarea.bottom]
1552
	sub	eax,[screen_workarea.top]
1524
	sub	eax,[screen_workarea.top]
1553
    @@: mov	[edi+WDATA.box.height],eax
1525
    @@: mov	[edi+WDATA.box.height],eax
1554
	call	set_window_clientbox
1526
	call	set_window_clientbox
1555
 
1527
 
1556
      no_window_shade:
1528
      no_window_shade:
1557
 
1529
 
1558
	cmp   [do_resize],1		  ; fullscreen/restore ?
1530
	cmp   [do_resize],1		  ; fullscreen/restore ?
1559
	jne   no_fullscreen_restore
1531
	jne   no_fullscreen_restore
1560
	cmp   [latest_window_touch_delta],dword 50
1532
	cmp   [latest_window_touch_delta],dword 50
1561
	jg    no_fullscreen_restore
1533
	jg    no_fullscreen_restore
1562
	mov   [reposition],1
1534
	mov   [reposition],1
1563
	test	[edi+WDATA.fl_wstate],WSTATE_MAXIMIZED
1535
	test	[edi+WDATA.fl_wstate],WSTATE_MAXIMIZED
1564
	jnz	restore_from_fullscreen
1536
	jnz	restore_from_fullscreen
1565
	or	[edi+WDATA.fl_wstate],WSTATE_MAXIMIZED
1537
	or	[edi+WDATA.fl_wstate],WSTATE_MAXIMIZED
1566
	mov	eax,[screen_workarea.left]
1538
	mov	eax,[screen_workarea.left]
1567
	mov	[edi+WDATA.box.left],eax
1539
	mov	[edi+WDATA.box.left],eax
1568
	sub	eax,[screen_workarea.right]
1540
	sub	eax,[screen_workarea.right]
1569
	neg	eax
1541
	neg	eax
1570
	mov	[edi+WDATA.box.width],eax
1542
	mov	[edi+WDATA.box.width],eax
1571
	mov	eax,[screen_workarea.top]
1543
	mov	eax,[screen_workarea.top]
1572
	mov	[edi+WDATA.box.top],eax
1544
	mov	[edi+WDATA.box.top],eax
1573
	test	[edi+WDATA.fl_wstate],WSTATE_ROLLEDUP
1545
	test	[edi+WDATA.fl_wstate],WSTATE_ROLLEDUP
1574
	jnz	@f
1546
	jnz	@f
1575
	sub	eax,[screen_workarea.bottom]
1547
	sub	eax,[screen_workarea.bottom]
1576
	neg	eax
1548
	neg	eax
1577
	mov	[edi+WDATA.box.height],eax
1549
	mov	[edi+WDATA.box.height],eax
1578
    @@:
1550
    @@:
1579
	jmp	restore_from_fullscreen.clientbox
1551
	jmp	restore_from_fullscreen.clientbox
1580
      restore_from_fullscreen:
1552
      restore_from_fullscreen:
1581
	and	[edi+WDATA.fl_wstate],not WSTATE_MAXIMIZED
1553
	and	[edi+WDATA.fl_wstate],not WSTATE_MAXIMIZED
1582
	push	[edi+WDATA.box.height]
1554
	push	[edi+WDATA.box.height]
1583
	push  edi			  ; restore
1555
	push  edi			  ; restore
1584
	lea   esi, [edx + APPDATA.saved_box]
1556
	lea   esi, [edx + APPDATA.saved_box]
1585
	mov   ecx,4
1557
	mov   ecx,4
1586
	cld
1558
	cld
1587
	rep   movsd
1559
	rep   movsd
1588
	pop   edi
1560
	pop   edi
1589
	pop	eax
1561
	pop	eax
1590
	test	[edi+WDATA.fl_wstate],WSTATE_ROLLEDUP
1562
	test	[edi+WDATA.fl_wstate],WSTATE_ROLLEDUP
1591
	jz	@f
1563
	jz	@f
1592
	mov	[edi+WDATA.box.height],eax
1564
	mov	[edi+WDATA.box.height],eax
1593
    @@:
1565
    @@:
1594
    .clientbox:
1566
    .clientbox:
1595
	call	set_window_clientbox
1567
	call	set_window_clientbox
1596
 
1568
 
1597
      no_fullscreen_restore:
1569
      no_fullscreen_restore:
1598
 
1570
 
1599
	mov   eax,[edi+WDATA.box.top]		      ; check Y inside screen
1571
	mov   eax,[edi+WDATA.box.top]		      ; check Y inside screen
1600
	add   eax,[edi+WDATA.box.height]
1572
	add   eax,[edi+WDATA.box.height]
1601
	cmp   eax,[ScreenHeight]
1573
	cmp   eax,[ScreenHeight]
1602
	jbe   no_window_sizing
1574
	jbe   no_window_sizing
1603
	mov   eax,[edi+WDATA.box.left]		       ; check X inside screen
1575
	mov   eax,[edi+WDATA.box.left]		       ; check X inside screen
1604
	add   eax,[edi+WDATA.box.width]
1576
	add   eax,[edi+WDATA.box.width]
1605
	cmp   eax,[ScreenWidth]
1577
	cmp   eax,[ScreenWidth]
1606
	jbe   no_window_sizing
1578
	jbe   no_window_sizing
1607
	mov   eax,[ScreenWidth]
1579
	mov   eax,[ScreenWidth]
1608
	sub   eax,[edi+WDATA.box.width]
1580
	sub   eax,[edi+WDATA.box.width]
1609
	mov   [edi+WDATA.box.left],eax
1581
	mov   [edi+WDATA.box.left],eax
1610
	mov   eax,[ScreenHeight]
1582
	mov   eax,[ScreenHeight]
1611
	sub   eax,[edi+WDATA.box.height]
1583
	sub   eax,[edi+WDATA.box.height]
1612
	mov   [edi+WDATA.box.top],eax
1584
	mov   [edi+WDATA.box.top],eax
1613
	call  set_window_clientbox
1585
	call  set_window_clientbox
1614
      no_window_sizing:
1586
      no_window_sizing:
1615
 
1587
 
1616
	popad
1588
	popad
1617
 
1589
 
1618
	cmp   [reposition],0
1590
	cmp   [reposition],0
1619
	je    retwm
1591
	je    retwm
1620
 
1592
 
1621
	mov   [DONT_DRAW_MOUSE],byte 1 ; no mouse
1593
	mov   [DONT_DRAW_MOUSE],byte 1 ; no mouse
1622
 
1594
 
1623
 
1595
 
1624
	push  eax ebx ecx edx
1596
	push  eax ebx ecx edx
1625
	mov   eax,[edi+WDATA.box.left]
1597
	mov   eax,[edi+WDATA.box.left]
1626
	mov   ebx,[edi+WDATA.box.top]
1598
	mov   ebx,[edi+WDATA.box.top]
1627
	mov   ecx,[edi+WDATA.box.width]
1599
	mov   ecx,[edi+WDATA.box.width]
1628
	mov   edx,[edi+WDATA.box.height]
1600
	mov   edx,[edi+WDATA.box.height]
1629
	add   ecx,eax
1601
	add   ecx,eax
1630
	add   edx,ebx
1602
	add   edx,ebx
1631
	call  calculatescreen
1603
	call  calculatescreen
1632
 
1604
 
1633
	mov   eax,[oldc+BOX.left]
1605
	mov   eax,[oldc+BOX.left]
1634
	mov   ebx,[oldc+BOX.top]
1606
	mov   ebx,[oldc+BOX.top]
1635
	mov   ecx,[oldc+BOX.width]
1607
	mov   ecx,[oldc+BOX.width]
1636
	mov   edx,[oldc+BOX.height]
1608
	mov   edx,[oldc+BOX.height]
1637
	add   ecx,eax
1609
	add   ecx,eax
1638
	add   edx,ebx
1610
	add   edx,ebx
1639
	call  calculatescreen
1611
	call  calculatescreen
1640
	pop   edx ecx ebx eax
1612
	pop   edx ecx ebx eax
1641
 
1613
 
1642
	mov   eax,edi
1614
	mov   eax,edi
1643
	call  redrawscreen
1615
	call  redrawscreen
1644
 
1616
 
1645
 
1617
 
1646
	mov	[edi+WDATA.fl_redraw],1
1618
	mov	[edi+WDATA.fl_redraw],1
1647
 
1619
 
1648
	mov   ecx,100	      ; wait to avoid mouse residuals
1620
	mov   ecx,100	      ; wait to avoid mouse residuals
1649
      waitre2:
1621
      waitre2:
1650
	mov   [DONT_DRAW_MOUSE],byte 1
1622
	mov   [DONT_DRAW_MOUSE],byte 1
1651
	call  checkidle
1623
	call  checkidle
1652
	cmp	[edi+WDATA.fl_redraw],0
1624
	cmp	[edi+WDATA.fl_redraw],0
1653
	jz    retwm
1625
	jz    retwm
1654
	loop  waitre2
1626
	loop  waitre2
1655
 
1627
 
1656
      retwm:
1628
      retwm:
1657
 
1629
 
1658
	mov   [DONT_DRAW_MOUSE],byte 0 ; mouse pointer
1630
	mov   [DONT_DRAW_MOUSE],byte 0 ; mouse pointer
1659
	mov   [MOUSE_BACKGROUND],byte 0 ; no mouse under
1631
	mov   [MOUSE_BACKGROUND],byte 0 ; no mouse under
1660
	mov   [MOUSE_DOWN],byte 0 ; react to mouse up/down
1632
	mov   [MOUSE_DOWN],byte 0 ; react to mouse up/down
1661
 
1633
 
1662
	mov    esi,window_moved
1634
	mov    esi,window_moved
1663
	call   sys_msg_board_str
1635
	call   sys_msg_board_str
1664
 
1636
 
1665
	popad
1637
	popad
1666
 
1638
 
1667
	ret
1639
	ret
1668
 
1640
 
1669
 
1641
 
1670
uglobal
1642
uglobal
1671
  add_window_data	     dd  0
1643
  add_window_data	     dd  0
1672
  do_resize_from_corner      db  0x0
1644
  do_resize_from_corner      db  0x0
1673
  reposition		     db  0x0
1645
  reposition		     db  0x0
1674
  latest_window_touch	     dd  0x0
1646
  latest_window_touch	     dd  0x0
1675
  latest_window_touch_delta  dd  0x0
1647
  latest_window_touch_delta  dd  0x0
1676
 
1648
 
1677
  do_resize db 0x0
1649
  do_resize db 0x0
1678
 
1650
 
1679
  oldc	  dd 0x0,0x0,0x0,0x0
1651
  oldc	  dd 0x0,0x0,0x0,0x0
1680
 
1652
 
1681
  dlx	  dd 0x0
1653
  dlx	  dd 0x0
1682
  dly	  dd 0x0
1654
  dly	  dd 0x0
1683
  dlxe	  dd 0x0
1655
  dlxe	  dd 0x0
1684
  dlye	  dd 0x0
1656
  dlye	  dd 0x0
1685
 
1657
 
1686
  npx	  dd 0x0
1658
  npx	  dd 0x0
1687
  npy	  dd 0x0
1659
  npy	  dd 0x0
1688
  npxe	  dd 0x0
1660
  npxe	  dd 0x0
1689
  npye	  dd 0x0
1661
  npye	  dd 0x0
1690
 
1662
 
1691
  mpx	  dd 0x0
1663
  mpx	  dd 0x0
1692
  mpy	  dd 0x0
1664
  mpy	  dd 0x0
1693
endg
1665
endg
1694
 
1666
 
1695
 
1667
 
1696
; draw negative window frames
1668
; draw negative window frames
1697
drawwindowframes2:
1669
drawwindowframes2:
1698
	pushad
1670
	pushad
1699
	cli
1671
	cli
1700
	jmp	drawwindowframes.do
1672
	jmp	drawwindowframes.do
1701
drawwindowframes:
1673
drawwindowframes:
1702
	pushad
1674
	pushad
1703
	cli
1675
	cli
1704
 
1676
 
1705
	test	[edi+WDATA.fl_wstate],WSTATE_MAXIMIZED
1677
	test	[edi+WDATA.fl_wstate],WSTATE_MAXIMIZED
1706
	jnz	.ret
1678
	jnz	.ret
1707
	mov	eax, [npx]
1679
	mov	eax, [npx]
1708
	cmp	eax, [edi+WDATA.box.left]
1680
	cmp	eax, [edi+WDATA.box.left]
1709
	jnz	.nowndframe
1681
	jnz	.nowndframe
1710
	mov	eax, [npxe]
1682
	mov	eax, [npxe]
1711
	cmp	eax, [edi+WDATA.box.width]
1683
	cmp	eax, [edi+WDATA.box.width]
1712
	jnz	.nowndframe
1684
	jnz	.nowndframe
1713
	mov	eax, [npy]
1685
	mov	eax, [npy]
1714
	cmp	eax, [edi+WDATA.box.top]
1686
	cmp	eax, [edi+WDATA.box.top]
1715
	jnz	.nowndframe
1687
	jnz	.nowndframe
1716
	mov	eax, [npye]
1688
	mov	eax, [npye]
1717
	cmp	eax, [edi+WDATA.box.height]
1689
	cmp	eax, [edi+WDATA.box.height]
1718
	jnz	.nowndframe
1690
	jnz	.nowndframe
1719
	xor	[edi+WDATA.fl_wdrawn], 2
1691
	xor	[edi+WDATA.fl_wdrawn], 2
1720
	test	[edi+WDATA.fl_wdrawn], 4
1692
	test	[edi+WDATA.fl_wdrawn], 4
1721
	jnz	.ret
1693
	jnz	.ret
1722
 
1694
 
1723
.nowndframe:
1695
.nowndframe:
1724
.do:
1696
.do:
1725
	mov	edi, 1
1697
	mov	edi, 1
1726
	mov	ecx, 0x01000000
1698
	mov	ecx, 0x01000000
1727
	mov   eax,[npx]
1699
	mov   eax,[npx]
1728
	shl   eax,16
1700
	shl   eax,16
1729
	add   eax,[npx]
1701
	add   eax,[npx]
1730
	add   eax,[npxe]
1702
	add   eax,[npxe]
1731
	add   eax,65536*1-1
1703
	add   eax,65536*1-1
1732
	mov   ebx,[npy]
1704
	mov   ebx,[npy]
1733
	shl   ebx,16
1705
	shl   ebx,16
1734
	add   ebx,[npy]
1706
	add   ebx,[npy]
1735
	call  [draw_line]
1707
	call  [draw_line]
1736
 
1708
 
1737
	mov   eax,[npx]
1709
	mov   eax,[npx]
1738
	shl   eax,16
1710
	shl   eax,16
1739
	add   eax,[npx]
1711
	add   eax,[npx]
1740
	add   eax,[npxe]
1712
	add   eax,[npxe]
1741
	add   eax,65536*1-1
1713
	add   eax,65536*1-1
1742
	mov   ebx,[npy]
1714
	mov   ebx,[npy]
1743
	add   ebx,[npye]
1715
	add   ebx,[npye]
1744
	shl   ebx,16
1716
	shl   ebx,16
1745
	add   ebx,[npy]
1717
	add   ebx,[npy]
1746
	add   ebx,[npye]
1718
	add   ebx,[npye]
1747
	call  [draw_line]
1719
	call  [draw_line]
1748
 
1720
 
1749
	mov   eax,[npx]
1721
	mov   eax,[npx]
1750
	shl   eax,16
1722
	shl   eax,16
1751
	add   eax,[npx]
1723
	add   eax,[npx]
1752
	mov   ebx,[npy]
1724
	mov   ebx,[npy]
1753
	shl   ebx,16
1725
	shl   ebx,16
1754
	add   ebx,[npy]
1726
	add   ebx,[npy]
1755
	add   ebx,[npye]
1727
	add   ebx,[npye]
1756
	call  [draw_line]
1728
	call  [draw_line]
1757
 
1729
 
1758
	mov   eax,[npx]
1730
	mov   eax,[npx]
1759
	add   eax,[npxe]
1731
	add   eax,[npxe]
1760
	shl   eax,16
1732
	shl   eax,16
1761
	add   eax,[npx]
1733
	add   eax,[npx]
1762
	add   eax,[npxe]
1734
	add   eax,[npxe]
1763
	mov   ebx,[npy]
1735
	mov   ebx,[npy]
1764
	shl   ebx,16
1736
	shl   ebx,16
1765
	add   ebx,[npy]
1737
	add   ebx,[npy]
1766
	add   ebx,[npye]
1738
	add   ebx,[npye]
1767
	call  [draw_line]
1739
	call  [draw_line]
1768
 
1740
 
1769
.ret:
1741
.ret:
1770
	sti
1742
	sti
1771
	popad
1743
	popad
1772
	ret
1744
	ret
1773
 
1745
 
1774
 
1746
 
1775
 
1747
 
1776
random_shaped_window:
1748
random_shaped_window:
1777
 
1749
 
1778
;
1750
;
1779
;  eax = 0    giving address of data area
1751
;  eax = 0    giving address of data area
1780
;      ebx    address
1752
;      ebx    address
1781
;  eax = 1    shape area scale
1753
;  eax = 1    shape area scale
1782
;      ebx    2^ebx scale
1754
;      ebx    2^ebx scale
1783
 
1755
 
1784
     test eax, eax
1756
     test eax, eax
1785
     jne  rsw_no_address
1757
     jne  rsw_no_address
1786
     mov  eax,[current_slot]
1758
     mov  eax,[current_slot]
1787
     mov  [eax+APPDATA.wnd_shape],ebx
1759
     mov  [eax+APPDATA.wnd_shape],ebx
1788
rsw_no_address:
1760
rsw_no_address:
1789
 
1761
 
1790
     cmp  eax,1
1762
     cmp  eax,1
1791
     jne  rsw_no_scale
1763
     jne  rsw_no_scale
1792
     mov  eax,[current_slot]
1764
     mov  eax,[current_slot]
1793
     mov  byte [eax+APPDATA.wnd_shape_scale], bl
1765
     mov  byte [eax+APPDATA.wnd_shape_scale], bl
1794
rsw_no_scale:
1766
rsw_no_scale:
1795
 
1767
 
1796
     ret
1768
     ret