Subversion Repositories Kolibri OS

Rev

Rev 523 | Rev 593 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 523 Rev 549
1
$Revision: 523 $
1
$Revision: 549 $
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
        call    read_skin_file
478
        call    read_skin_file
479
        mov     [esp+32+36], eax
479
        mov     [esp+32+36], eax
480
        test    eax, eax
480
        test    eax, eax
481
        jnz     .ret
481
        jnz     .ret
482
        xor     eax, eax
482
        xor     eax, eax
483
        xor     ebx, ebx
483
        xor     ebx, ebx
484
        mov     ecx, [ScreenWidth]
484
        mov     ecx, [ScreenWidth]
485
        mov     edx, [ScreenHeight]
485
        mov     edx, [ScreenHeight]
486
        call    calculatescreen
486
        call    calculatescreen
487
	jmp	redraw_screen_direct
487
	jmp	redraw_screen_direct
488
.ret:
488
.ret:
489
        popad
489
        popad
490
        ret
490
        ret
491
   no_set_skin:
491
   no_set_skin:
492
 
492
 
493
     popad
493
     popad
494
     ret
494
     ret
495
 
495
 
496
 
496
 
497
repos_windows:
497
repos_windows:
498
	mov	ecx,[TASK_COUNT]
498
	mov	ecx,[TASK_COUNT]
499
	mov	edi, OS_BASE+0x20*2
499
	mov	edi, OS_BASE+0x20*2
500
    mov    byte[REDRAW_BACKGROUND],1
500
    mov    byte[REDRAW_BACKGROUND],1
501
	dec	ecx
501
	dec	ecx
502
	jge    @f
502
	jge    @f
503
	ret
503
	ret
504
    @@: mov	[edi+WDATA.fl_redraw],1
504
    @@: mov	[edi+WDATA.fl_redraw],1
505
	test	[edi+WDATA.fl_wstate],WSTATE_MAXIMIZED
505
	test	[edi+WDATA.fl_wstate],WSTATE_MAXIMIZED
506
	jz	.lp2
506
	jz	.lp2
507
	mov	eax,[screen_workarea.left]
507
	mov	eax,[screen_workarea.left]
508
	mov	[edi+WDATA.box.left],eax
508
	mov	[edi+WDATA.box.left],eax
509
	sub	eax,[screen_workarea.right]
509
	sub	eax,[screen_workarea.right]
510
	neg	eax
510
	neg	eax
511
	mov	[edi+WDATA.box.width],eax
511
	mov	[edi+WDATA.box.width],eax
512
	mov	eax,[screen_workarea.top]
512
	mov	eax,[screen_workarea.top]
513
	mov	[edi+WDATA.box.top],eax
513
	mov	[edi+WDATA.box.top],eax
514
	test	[edi+WDATA.fl_wstate],WSTATE_ROLLEDUP
514
	test	[edi+WDATA.fl_wstate],WSTATE_ROLLEDUP
515
	jnz	.lp1
515
	jnz	.lp1
516
	sub	eax,[screen_workarea.bottom]
516
	sub	eax,[screen_workarea.bottom]
517
	neg	eax
517
	neg	eax
518
	mov	[edi+WDATA.box.height],eax
518
	mov	[edi+WDATA.box.height],eax
519
  .lp1:
519
  .lp1:
520
 
520
 
521
	call	set_window_clientbox
521
	call	set_window_clientbox
522
	add	edi,0x20
522
	add	edi,0x20
523
	loop	@b
523
	loop	@b
524
	ret
524
	ret
525
  .lp2: mov	eax,[edi+WDATA.box.left]
525
  .lp2: mov	eax,[edi+WDATA.box.left]
526
	add	eax,[edi+WDATA.box.width]
526
	add	eax,[edi+WDATA.box.width]
527
    mov    ebx,[ScreenWidth]
527
    mov    ebx,[ScreenWidth]
528
;    inc    ebx
528
;    inc    ebx
529
    cmp    eax,ebx
529
    cmp    eax,ebx
530
    jle    .lp4
530
    jle    .lp4
531
	mov	eax,[edi+WDATA.box.width]
531
	mov	eax,[edi+WDATA.box.width]
532
    sub    eax,ebx
532
    sub    eax,ebx
533
    jle    .lp3
533
    jle    .lp3
534
	mov	[edi+WDATA.box.width],ebx
534
	mov	[edi+WDATA.box.width],ebx
535
  .lp3: sub	ebx,[edi+WDATA.box.width]
535
  .lp3: sub	ebx,[edi+WDATA.box.width]
536
	mov	[edi+WDATA.box.left],ebx
536
	mov	[edi+WDATA.box.left],ebx
537
  .lp4: mov	eax,[edi+WDATA.box.top]
537
  .lp4: mov	eax,[edi+WDATA.box.top]
538
	add	eax,[edi+WDATA.box.height]
538
	add	eax,[edi+WDATA.box.height]
539
    mov    ebx,[ScreenHeight]
539
    mov    ebx,[ScreenHeight]
540
;    inc    ebx
540
;    inc    ebx
541
    cmp    eax,ebx
541
    cmp    eax,ebx
542
    jle    .lp6
542
    jle    .lp6
543
	mov	eax,[edi+WDATA.box.height]
543
	mov	eax,[edi+WDATA.box.height]
544
    sub    eax,ebx
544
    sub    eax,ebx
545
    jle    .lp5
545
    jle    .lp5
546
	mov	[edi+WDATA.box.height],ebx
546
	mov	[edi+WDATA.box.height],ebx
547
  .lp5: sub	ebx,[edi+WDATA.box.height]
547
  .lp5: sub	ebx,[edi+WDATA.box.height]
548
	mov	[edi+WDATA.box.top],ebx
548
	mov	[edi+WDATA.box.top],ebx
549
  .lp6: jmp	.lp1
549
  .lp6: jmp	.lp1
550
 
550
 
551
uglobal
551
uglobal
552
  common_colours:
552
  common_colours:
553
     times 128 db 0x0
553
     times 128 db 0x0
554
endg
554
endg
555
 
555
 
556
 
556
 
557
 
557
 
558
 
558
 
559
check_window_position:
559
check_window_position:
560
 
560
 
561
    pushad			     ; window inside screen ?
561
    pushad			     ; window inside screen ?
562
 
562
 
563
    movzx eax,word [edi+WDATA.box.left]
563
    movzx eax,word [edi+WDATA.box.left]
564
    movzx ebx,word [edi+WDATA.box.top]
564
    movzx ebx,word [edi+WDATA.box.top]
565
    movzx ecx,word [edi+WDATA.box.width]
565
    movzx ecx,word [edi+WDATA.box.width]
566
    movzx edx,word [edi+WDATA.box.height]
566
    movzx edx,word [edi+WDATA.box.height]
567
 
567
 
568
    mov   esi,ecx	      ; check x pos
568
    mov   esi,ecx	      ; check x pos
569
    add   esi,eax
569
    add   esi,eax
570
    cmp   esi,[ScreenWidth]
570
    cmp   esi,[ScreenWidth]
571
    jbe   x_pos_ok
571
    jbe   x_pos_ok
572
    mov   [edi+WDATA.box.left],dword 0
572
    mov   [edi+WDATA.box.left],dword 0
573
    xor   eax, eax
573
    xor   eax, eax
574
  x_pos_ok:
574
  x_pos_ok:
575
 
575
 
576
    mov   esi,edx	      ; check y pos
576
    mov   esi,edx	      ; check y pos
577
    add   esi,ebx
577
    add   esi,ebx
578
    cmp   esi,[ScreenHeight]
578
    cmp   esi,[ScreenHeight]
579
    jbe   y_pos_ok
579
    jbe   y_pos_ok
580
    mov   [edi+WDATA.box.top],dword 0
580
    mov   [edi+WDATA.box.top],dword 0
581
    mov   ebx,0
581
    mov   ebx,0
582
  y_pos_ok:
582
  y_pos_ok:
583
 
583
 
584
    mov   esi,ecx	      ; check x size
584
    mov   esi,ecx	      ; check x size
585
    add   esi,eax
585
    add   esi,eax
586
    cmp   esi,[ScreenWidth]
586
    cmp   esi,[ScreenWidth]
587
    jbe   x_size_ok
587
    jbe   x_size_ok
588
    mov   ecx,[ScreenWidth]
588
    mov   ecx,[ScreenWidth]
589
    mov   [edi+WDATA.box.width],ecx
589
    mov   [edi+WDATA.box.width],ecx
590
  x_size_ok:
590
  x_size_ok:
591
 
591
 
592
    mov   esi,edx	      ; check y size
592
    mov   esi,edx	      ; check y size
593
    add   esi,ebx
593
    add   esi,ebx
594
    cmp   esi,[ScreenHeight]
594
    cmp   esi,[ScreenHeight]
595
    jbe   y_size_ok
595
    jbe   y_size_ok
596
    mov   edx,[ScreenHeight]
596
    mov   edx,[ScreenHeight]
597
    mov   [edi+WDATA.box.height],edx
597
    mov   [edi+WDATA.box.height],edx
598
  y_size_ok:
598
  y_size_ok:
599
 
599
 
600
    popad
600
    popad
601
 
601
 
602
    ret
602
    ret
603
 
603
 
604
 
604
 
605
uglobal
605
uglobal
606
  new_window_starting dd 0
606
  new_window_starting dd 0
607
endg
607
endg
608
 
608
 
609
 
609
 
610
sys_window_mouse:
610
sys_window_mouse:
611
 
611
 
612
    push  eax
612
    push  eax
613
 
613
 
614
    mov   eax,[timer_ticks]
614
    mov   eax,[timer_ticks]
615
    cmp   [new_window_starting],eax
615
    cmp   [new_window_starting],eax
616
    jb	  swml1
616
    jb	  swml1
617
 
617
 
618
    mov   [MOUSE_BACKGROUND],byte 0  ; no mouse background
618
    mov   [MOUSE_BACKGROUND],byte 0  ; no mouse background
619
    mov   [DONT_DRAW_MOUSE],byte 0  ; draw mouse
619
    mov   [DONT_DRAW_MOUSE],byte 0  ; draw mouse
620
 
620
 
621
    mov   [new_window_starting],eax
621
    mov   [new_window_starting],eax
622
 
622
 
623
  swml1:
623
  swml1:
624
 
624
 
625
    pop   eax
625
    pop   eax
626
 
626
 
627
    ret
627
    ret
628
 
628
 
629
 
629
 
630
 
630
 
631
 
631
 
632
drawwindow_I_caption:
632
drawwindow_I_caption:
633
 
633
 
634
	mov   ecx,[edx+WDATA.cl_titlebar]   ; grab bar
634
	mov   ecx,[edx+WDATA.cl_titlebar]   ; grab bar
635
	push  ecx
635
	push  ecx
636
	mov   esi,edx
636
	mov   esi,edx
637
	mov   edx,[esi+WDATA.box.top]
637
	mov   edx,[esi+WDATA.box.top]
638
	add   edx,1
638
	add   edx,1
639
	mov   ebx,[esi+WDATA.box.top]
639
	mov   ebx,[esi+WDATA.box.top]
640
	add   ebx,21
640
	add   ebx,21
641
	mov   eax,[esi+WDATA.box.top]
641
	mov   eax,[esi+WDATA.box.top]
642
	add   eax,[esi+WDATA.box.height]
642
	add   eax,[esi+WDATA.box.height]
643
	cmp   ebx,eax
643
	cmp   ebx,eax
644
	jb    .wdsizeok
644
	jb    .wdsizeok
645
	mov   ebx,eax
645
	mov   ebx,eax
646
  .wdsizeok:
646
  .wdsizeok:
647
	push  ebx
647
	push  ebx
648
  .drwi:
648
  .drwi:
649
	mov   ebx,edx
649
	mov   ebx,edx
650
	shl   ebx,16
650
	shl   ebx,16
651
	add   ebx,edx
651
	add   ebx,edx
652
	mov   eax,[esi+WDATA.box.left]
652
	mov   eax,[esi+WDATA.box.left]
653
	inc   eax
653
	inc   eax
654
	shl   eax,16
654
	shl   eax,16
655
	add   eax,[esi+WDATA.box.left]
655
	add   eax,[esi+WDATA.box.left]
656
	add   eax,[esi+WDATA.box.width]
656
	add   eax,[esi+WDATA.box.width]
657
	sub   eax,1
657
	sub   eax,1
658
	push  edx
658
	push  edx
659
	mov   edx,0x80000000
659
	mov   edx,0x80000000
660
	mov   ecx,[esi+WDATA.cl_titlebar]
660
	mov   ecx,[esi+WDATA.cl_titlebar]
661
	and   ecx,edx
661
	and   ecx,edx
662
	cmp   ecx,edx
662
	cmp   ecx,edx
663
	jnz   .nofa
663
	jnz   .nofa
664
	mov   ecx,[esi+WDATA.cl_titlebar]
664
	mov   ecx,[esi+WDATA.cl_titlebar]
665
	sub   ecx,0x00040404
665
	sub   ecx,0x00040404
666
	mov   [esi+WDATA.cl_titlebar],ecx
666
	mov   [esi+WDATA.cl_titlebar],ecx
667
	and   ecx,0x00ffffff
667
	and   ecx,0x00ffffff
668
	jmp   .faj
668
	jmp   .faj
669
  .nofa:
669
  .nofa:
670
	mov   ecx,[esi+WDATA.cl_titlebar]
670
	mov   ecx,[esi+WDATA.cl_titlebar]
671
	and   ecx,0x00ffffff
671
	and   ecx,0x00ffffff
672
  .faj:
672
  .faj:
673
	pop   edx
673
	pop   edx
674
	mov   edi,0
674
	mov   edi,0
675
	call  [draw_line]
675
	call  [draw_line]
676
	inc   edx
676
	inc   edx
677
	cmp   edx,[esp]
677
	cmp   edx,[esp]
678
	jb    .drwi
678
	jb    .drwi
679
	add   esp,4
679
	add   esp,4
680
	pop   ecx
680
	pop   ecx
681
	mov   [esi+WDATA.cl_titlebar],ecx
681
	mov   [esi+WDATA.cl_titlebar],ecx
682
 
682
 
683
	ret
683
	ret
684
 
684
 
685
 
685
 
686
drawwindow_I:
686
drawwindow_I:
687
 
687
 
688
	pushad
688
	pushad
689
	or	[edx+WDATA.fl_wdrawn], 4
689
	or	[edx+WDATA.fl_wdrawn], 4
690
 
690
 
691
	mov   esi,[edx+WDATA.cl_frames]   ; rectangle
691
	mov   esi,[edx+WDATA.cl_frames]   ; rectangle
692
	mov   eax,[edx+WDATA.box.left]
692
	mov   eax,[edx+WDATA.box.left]
693
	shl   eax,16
693
	shl   eax,16
694
	add   eax,[edx+WDATA.box.left]
694
	add   eax,[edx+WDATA.box.left]
695
	add   eax,[edx+WDATA.box.width]
695
	add   eax,[edx+WDATA.box.width]
696
	mov   ebx,[edx+WDATA.box.top]
696
	mov   ebx,[edx+WDATA.box.top]
697
	shl   ebx,16
697
	shl   ebx,16
698
	add   ebx,[edx+WDATA.box.top]
698
	add   ebx,[edx+WDATA.box.top]
699
	add   ebx,[edx+WDATA.box.height]
699
	add   ebx,[edx+WDATA.box.height]
700
	call  draw_rectangle
700
	call  draw_rectangle
701
 
701
 
702
	and	[edx+WDATA.fl_wdrawn], not 4
702
	and	[edx+WDATA.fl_wdrawn], not 4
703
	test	[edx+WDATA.fl_wdrawn], 2
703
	test	[edx+WDATA.fl_wdrawn], 2
704
	jz	@f
704
	jz	@f
705
	call	drawwindowframes2
705
	call	drawwindowframes2
706
@@:
706
@@:
707
 
707
 
708
	call	drawwindow_I_caption
708
	call	drawwindow_I_caption
709
 
709
 
710
	mov   edx,[esi+WDATA.box.top]	   ; inside work area
710
	mov   edx,[esi+WDATA.box.top]	   ; inside work area
711
	add   edx,21+5
711
	add   edx,21+5
712
	mov   ebx,[esi+WDATA.box.top]
712
	mov   ebx,[esi+WDATA.box.top]
713
	add   ebx,[esi+WDATA.box.height]
713
	add   ebx,[esi+WDATA.box.height]
714
	cmp   edx,ebx
714
	cmp   edx,ebx
715
	jg    noinside
715
	jg    noinside
716
	mov   eax,1
716
	mov   eax,1
717
	mov   ebx,21
717
	mov   ebx,21
718
	mov   ecx,[esi+WDATA.box.width]
718
	mov   ecx,[esi+WDATA.box.width]
719
	mov   edx,[esi+WDATA.box.height]
719
	mov   edx,[esi+WDATA.box.height]
720
	mov   edi,[esi+WDATA.cl_workarea]
720
	mov   edi,[esi+WDATA.cl_workarea]
721
	test  edi,0x40000000
721
	test  edi,0x40000000
722
	jnz   noinside
722
	jnz   noinside
723
	call  [drawbar]
723
	call  [drawbar]
724
      noinside:
724
      noinside:
725
 
725
 
726
	popad
726
	popad
727
 
727
 
728
	ret
728
	ret
729
 
729
 
730
 
730
 
731
draw_rectangle:
731
draw_rectangle:
732
 
732
 
733
r_eax equ [esp+28]   ; x start
733
r_eax equ [esp+28]   ; x start
734
r_ax  equ [esp+30]   ; x end
734
r_ax  equ [esp+30]   ; x end
735
r_ebx equ [esp+16]   ; y start
735
r_ebx equ [esp+16]   ; y start
736
r_bx  equ [esp+18]   ; y end
736
r_bx  equ [esp+18]   ; y end
737
;esi                 ; color
737
;esi                 ; color
738
 
738
 
739
	pushad
739
	pushad
740
 
740
 
741
	mov   ecx,esi	       ; yb,xb -> yb,xe
741
	mov   ecx,esi	       ; yb,xb -> yb,xe
742
	mov   eax, r_eax
742
	mov   eax, r_eax
743
	rol   eax, 16
743
	rol   eax, 16
744
	mov   ebx,r_ebx
744
	mov   ebx,r_ebx
745
	shl   ebx,16
745
	shl   ebx,16
746
	mov   bx,r_ebx
746
	mov   bx,r_ebx
747
	xor   edi, edi
747
	xor   edi, edi
748
	call  [draw_line]
748
	call  [draw_line]
749
 
749
 
750
	mov   ebx,r_bx	       ; ye,xb -> ye,xe
750
	mov   ebx,r_bx	       ; ye,xb -> ye,xe
751
	shl   ebx,16
751
	shl   ebx,16
752
	mov   bx,r_bx
752
	mov   bx,r_bx
753
	call  [draw_line]
753
	call  [draw_line]
754
 
754
 
755
	mov   ecx,esi	       ; ya,xa -> ye,xa
755
	mov   ecx,esi	       ; ya,xa -> ye,xa
756
	mov   eax,r_eax
756
	mov   eax,r_eax
757
	shl   eax,16
757
	shl   eax,16
758
	mov   ax,r_eax
758
	mov   ax,r_eax
759
	mov   ebx,r_ebx
759
	mov   ebx,r_ebx
760
	shl   ebx,16
760
	shl   ebx,16
761
	mov   bx,r_bx
761
	mov   bx,r_bx
762
	mov   edi,0
762
	mov   edi,0
763
	call  [draw_line]
763
	call  [draw_line]
764
 
764
 
765
	mov   eax,r_ax	     ; ya,xe -> ye,xe
765
	mov   eax,r_ax	     ; ya,xe -> ye,xe
766
	shl   eax,16
766
	shl   eax,16
767
	mov   ax,r_ax
767
	mov   ax,r_ax
768
	call  [draw_line]
768
	call  [draw_line]
769
 
769
 
770
	popad
770
	popad
771
	ret
771
	ret
772
 
772
 
773
 
773
 
774
drawwindow_III_caption:
774
drawwindow_III_caption:
775
 
775
 
776
	mov   ecx,[edx+WDATA.cl_titlebar]			; GRAB BAR
776
	mov   ecx,[edx+WDATA.cl_titlebar]			; GRAB BAR
777
	push  ecx
777
	push  ecx
778
	mov   esi,edx
778
	mov   esi,edx
779
	mov   edx,[esi+WDATA.box.top]
779
	mov   edx,[esi+WDATA.box.top]
780
	add   edx,4
780
	add   edx,4
781
	mov   ebx,[esi+WDATA.box.top]
781
	mov   ebx,[esi+WDATA.box.top]
782
	add   ebx,20
782
	add   ebx,20
783
	mov   eax,[esi+WDATA.box.top]
783
	mov   eax,[esi+WDATA.box.top]
784
	add   eax,[esi+WDATA.box.height]
784
	add   eax,[esi+WDATA.box.height]
785
	cmp   ebx,eax
785
	cmp   ebx,eax
786
	jb    .wdsizeok
786
	jb    .wdsizeok
787
	mov   ebx,eax
787
	mov   ebx,eax
788
  .wdsizeok:
788
  .wdsizeok:
789
	push  ebx
789
	push  ebx
790
  .drwi:
790
  .drwi:
791
	mov   ebx,edx
791
	mov   ebx,edx
792
	shl   ebx,16
792
	shl   ebx,16
793
	add   ebx,edx
793
	add   ebx,edx
794
	mov   eax,[esi+WDATA.box.left]
794
	mov   eax,[esi+WDATA.box.left]
795
	shl   eax,16
795
	shl   eax,16
796
	add   eax,[esi+WDATA.box.left]
796
	add   eax,[esi+WDATA.box.left]
797
	add   eax,[esi+WDATA.box.width]
797
	add   eax,[esi+WDATA.box.width]
798
	add   eax,4*65536-4
798
	add   eax,4*65536-4
799
	mov   ecx,[esi+WDATA.cl_titlebar]
799
	mov   ecx,[esi+WDATA.cl_titlebar]
800
	test  ecx,0x40000000
800
	test  ecx,0x40000000
801
	jz    .nofa
801
	jz    .nofa
802
	add   ecx,0x040404
802
	add   ecx,0x040404
803
  .nofa:
803
  .nofa:
804
	test  ecx,0x80000000
804
	test  ecx,0x80000000
805
	jz    .nofa2
805
	jz    .nofa2
806
	sub   ecx,0x040404
806
	sub   ecx,0x040404
807
  .nofa2:
807
  .nofa2:
808
	mov   [esi+WDATA.cl_titlebar],ecx
808
	mov   [esi+WDATA.cl_titlebar],ecx
809
	and   ecx,0xffffff
809
	and   ecx,0xffffff
810
	xor   edi, edi
810
	xor   edi, edi
811
	call  [draw_line]
811
	call  [draw_line]
812
	inc   edx
812
	inc   edx
813
	cmp   edx,[esp]
813
	cmp   edx,[esp]
814
	jb    .drwi
814
	jb    .drwi
815
	add   esp,4
815
	add   esp,4
816
	pop   ecx
816
	pop   ecx
817
	mov   [esi+WDATA.cl_titlebar],ecx
817
	mov   [esi+WDATA.cl_titlebar],ecx
818
 
818
 
819
	ret
819
	ret
820
 
820
 
821
 
821
 
822
drawwindow_III:
822
drawwindow_III:
823
 
823
 
824
	pushad
824
	pushad
825
 
825
 
826
	mov   edi,edx				   ; RECTANGLE
826
	mov   edi,edx				   ; RECTANGLE
827
	mov   eax,[edi+WDATA.box.left]
827
	mov   eax,[edi+WDATA.box.left]
828
	shl   eax,16
828
	shl   eax,16
829
    mov   ax, word [edi+WDATA.box.left]
829
    mov   ax, word [edi+WDATA.box.left]
830
    add   ax, word [edi+WDATA.box.width]
830
    add   ax, word [edi+WDATA.box.width]
831
	mov   ebx,[edi+WDATA.box.top]
831
	mov   ebx,[edi+WDATA.box.top]
832
	shl   ebx,16
832
	shl   ebx,16
833
    mov   bx, word [edi+WDATA.box.top]
833
    mov   bx, word [edi+WDATA.box.top]
834
    add   bx, word [edi+WDATA.box.height]
834
    add   bx, word [edi+WDATA.box.height]
835
	mov   esi,[edi+WDATA.cl_frames]
835
	mov   esi,[edi+WDATA.cl_frames]
836
	shr   esi,1
836
	shr   esi,1
837
	and   esi,0x007f7f7f
837
	and   esi,0x007f7f7f
838
	push  esi
838
	push  esi
839
	or	[edi+WDATA.fl_wdrawn], 4
839
	or	[edi+WDATA.fl_wdrawn], 4
840
	call  draw_rectangle
840
	call  draw_rectangle
841
	and	[edi+WDATA.fl_wdrawn], not 4
841
	and	[edi+WDATA.fl_wdrawn], not 4
842
	test	[edi+WDATA.fl_wdrawn], 2
842
	test	[edi+WDATA.fl_wdrawn], 2
843
	jz	@f
843
	jz	@f
844
	call	drawwindowframes2
844
	call	drawwindowframes2
845
@@:
845
@@:
846
	mov   ecx,3
846
	mov   ecx,3
847
      dw3l:
847
      dw3l:
848
	add   eax,1*65536-1
848
	add   eax,1*65536-1
849
	add   ebx,1*65536-1
849
	add   ebx,1*65536-1
850
	mov   esi,[edi+WDATA.cl_frames]
850
	mov   esi,[edi+WDATA.cl_frames]
851
	call  draw_rectangle
851
	call  draw_rectangle
852
	dec   ecx
852
	dec   ecx
853
	jnz   dw3l
853
	jnz   dw3l
854
	pop   esi
854
	pop   esi
855
	add   eax,1*65536-1
855
	add   eax,1*65536-1
856
	add   ebx,1*65536-1
856
	add   ebx,1*65536-1
857
	call  draw_rectangle
857
	call  draw_rectangle
858
 
858
 
859
	call	drawwindow_III_caption
859
	call	drawwindow_III_caption
860
 
860
 
861
	mov   edx,[esi+WDATA.box.top]			    ; WORK AREA
861
	mov   edx,[esi+WDATA.box.top]			    ; WORK AREA
862
	add   edx,21+5
862
	add   edx,21+5
863
	mov   ebx,[esi+WDATA.box.top]
863
	mov   ebx,[esi+WDATA.box.top]
864
	add   ebx,[esi+WDATA.box.height]
864
	add   ebx,[esi+WDATA.box.height]
865
	cmp   edx,ebx
865
	cmp   edx,ebx
866
	jg    noinside2
866
	jg    noinside2
867
	mov   eax,5
867
	mov   eax,5
868
	mov   ebx,20
868
	mov   ebx,20
869
	mov   ecx,[esi+WDATA.box.width]
869
	mov   ecx,[esi+WDATA.box.width]
870
	mov   edx,[esi+WDATA.box.height]
870
	mov   edx,[esi+WDATA.box.height]
871
	sub   ecx,4
871
	sub   ecx,4
872
	sub   edx,4
872
	sub   edx,4
873
	mov   edi,[esi+WDATA.cl_workarea]
873
	mov   edi,[esi+WDATA.cl_workarea]
874
	test  edi,0x40000000
874
	test  edi,0x40000000
875
	jnz   noinside2
875
	jnz   noinside2
876
	call  [drawbar]
876
	call  [drawbar]
877
      noinside2:
877
      noinside2:
878
 
878
 
879
	popad
879
	popad
880
 
880
 
881
	ret
881
	ret
882
 
882
 
883
 
883
 
884
 
884
 
885
; activate window
885
; activate window
886
align 4
886
align 4
887
windowactivate:
887
windowactivate:
888
 
888
 
889
	; esi = abs mem position in stack 0xC400+
889
	; esi = abs mem position in stack 0xC400+
890
 
890
 
891
	pushad
891
	pushad
892
 
892
 
893
     ; if type of current active window is 3,
893
     ; if type of current active window is 3,
894
     ; it must be redrawn
894
     ; it must be redrawn
895
	mov   eax, [TASK_COUNT]
895
	mov   eax, [TASK_COUNT]
896
	movzx eax, word [WIN_POS + eax*2]
896
	movzx eax, word [WIN_POS + eax*2]
897
	shl   eax, 5
897
	shl   eax, 5
898
	add   eax, window_data
898
	add   eax, window_data
899
	mov   ebx, [eax + WDATA.cl_workarea]
899
	mov   ebx, [eax + WDATA.cl_workarea]
900
	and   ebx, 0x0f000000
900
	and   ebx, 0x0f000000
901
	cmp   ebx, 0x03000000
901
	cmp   ebx, 0x03000000
-
 
902
	je   .set_WDATA_fl_redraw   ; for 3 and 4 style
-
 
903
	cmp   ebx, 0x04000000
-
 
904
	je   .set_WDATA_fl_redraw
902
	jne   @f
905
	jmp @f
-
 
906
	.set_WDATA_fl_redraw:
903
	mov   [eax + WDATA.fl_redraw], byte 1
907
	mov   [eax + WDATA.fl_redraw], byte 1
904
     @@:
908
     @@:
905
 
909
 
906
	push   esi
910
	push   esi
907
      movzx   eax, word [esi] ; ax <- process no
911
      movzx   eax, word [esi] ; ax <- process no
908
      movzx   eax, word [WIN_STACK+eax*2] ; ax <- position in window stack
912
      movzx   eax, word [WIN_STACK+eax*2] ; ax <- position in window stack
909
 
913
 
910
	xor   esi, esi	      ; drop others
914
	xor   esi, esi	      ; drop others
911
      waloop:
915
      waloop:
912
	cmp   esi, dword [TASK_COUNT]
916
	cmp   esi, dword [TASK_COUNT]
913
	jae   wacont
917
	jae   wacont
914
	inc   esi
918
	inc   esi
915
	lea   edi, [WIN_STACK + esi*2]
919
	lea   edi, [WIN_STACK + esi*2]
916
	mov   bx, [edi] ; position of the current process
920
	mov   bx, [edi] ; position of the current process
917
	cmp   bx, ax
921
	cmp   bx, ax
918
	jbe   @f
922
	jbe   @f
919
	dec   bx       ; upper? => drop!
923
	dec   bx       ; upper? => drop!
920
	mov   [edi], bx
924
	mov   [edi], bx
921
      @@:
925
      @@:
922
	jmp   waloop
926
	jmp   waloop
923
      wacont:
927
      wacont:
924
			    ; set to no 1
928
			    ; set to no 1
925
	pop   esi	    ;   esi = pointer at 0xC400
929
	pop   esi	    ;   esi = pointer at 0xC400
926
 
930
 
927
      movzx   eax, word [esi]
931
      movzx   eax, word [esi]
928
	mov   bx, [TASK_COUNT]	; number of processes
932
	mov   bx, [TASK_COUNT]	; number of processes
929
	mov   [WIN_STACK+eax*2], bx	; this is the last (and the upper)
933
	mov   [WIN_STACK+eax*2], bx	; this is the last (and the upper)
930
 
934
 
931
	; update on screen -window stack
935
	; update on screen -window stack
932
	xor   esi, esi
936
	xor   esi, esi
933
      waloop2:
937
      waloop2:
934
	mov   edi, [TASK_COUNT]
938
	mov   edi, [TASK_COUNT]
935
	cmp   esi, edi
939
	cmp   esi, edi
936
	jae   wacont2
940
	jae   wacont2
937
	inc   esi
941
	inc   esi
938
	movzx ebx, word [esi*2 + WIN_STACK]
942
	movzx ebx, word [esi*2 + WIN_STACK]
939
	mov   [ebx*2 + WIN_POS], si
943
	mov   [ebx*2 + WIN_POS], si
940
	jmp   waloop2
944
	jmp   waloop2
941
      wacont2:
945
      wacont2:
942
	mov   [KEY_COUNT], byte 0	      ; empty keyboard buffer
946
	mov   [KEY_COUNT], byte 0	      ; empty keyboard buffer
943
	mov   [BTN_COUNT], byte 0	      ; empty button buffer
947
	mov   [BTN_COUNT], byte 0	      ; empty button buffer
944
	mov   [MOUSE_SCROLL_H], word 0  ; zero mouse z-index
948
	mov   [MOUSE_SCROLL_H], word 0  ; zero mouse z-index
945
	mov   [MOUSE_SCROLL_V], word 0  ; zero mouse z-index
949
	mov   [MOUSE_SCROLL_V], word 0  ; zero mouse z-index
946
	popad
950
	popad
947
	ret
951
	ret
948
 
952
 
949
 
953
 
950
; check if window is necessary to draw
954
; check if window is necessary to draw
951
 
955
 
952
checkwindowdraw:
956
checkwindowdraw:
953
 
957
 
954
	; edi = position in window_data+
958
	; edi = position in window_data+
955
 
959
 
956
	mov   eax, [edi + WDATA.cl_workarea]
960
	mov   eax, [edi + WDATA.cl_workarea]
957
	and   eax, 0x0f000000
961
	and   eax, 0x0f000000
958
	cmp   eax, 0x03000000
962
	cmp   eax, 0x03000000
959
	je    .return_yes      ; window type 3
963
	je    .return_yes      ; window type 3
-
 
964
	cmp   eax, 0x04000000
-
 
965
	je    .return_yes      ; window type 4
960
 
966
 
961
	mov   esi, edi
967
	mov   esi, edi
962
	sub   esi, window_data
968
	sub   esi, window_data
963
	shr   esi, 5
969
	shr   esi, 5
964
 
970
 
965
	; esi = process number
971
	; esi = process number
966
 
972
 
967
	movzx eax, word [WIN_STACK + esi * 2] ; get value of the curr process
973
	movzx eax, word [WIN_STACK + esi * 2] ; get value of the curr process
968
	lea   esi, [WIN_POS + eax * 2]	    ; get address of this process at 0xC400
974
	lea   esi, [WIN_POS + eax * 2]	    ; get address of this process at 0xC400
969
 
975
 
970
	push  esi
976
	push  esi
971
 
977
 
972
      .new_check:
978
      .new_check:
973
 
979
 
974
	pop   esi
980
	pop   esi
975
	add   esi, 2
981
	add   esi, 2
976
	push  esi
982
	push  esi
977
 
983
 
978
	mov   eax, [TASK_COUNT]
984
	mov   eax, [TASK_COUNT]
979
	lea   eax, word [WIN_POS + eax * 2] ; number of the upper window
985
	lea   eax, word [WIN_POS + eax * 2] ; number of the upper window
980
 
986
 
981
	cmp   esi, eax
987
	cmp   esi, eax
982
	ja    .all_wnds_to_top
988
	ja    .all_wnds_to_top
983
 
989
 
984
	movzx eax, word [esi]
990
	movzx eax, word [esi]
985
	shl   eax, 5
991
	shl   eax, 5
986
	cmp   [CURRENT_TASK + eax + TASKDATA.state], byte 9
992
	cmp   [CURRENT_TASK + eax + TASKDATA.state], byte 9
987
	je    .new_check		    ; skip dead windows
993
	je    .new_check		    ; skip dead windows
988
 
994
 
989
	lea   esi, [eax+window_data]
995
	lea   esi, [eax+window_data]
990
 
996
 
991
	mov   ebx, [edi+WDATA.box.top]	; y0
997
	mov   ebx, [edi+WDATA.box.top]	; y0
992
	mov   edx, [edi+WDATA.box.height]
998
	mov   edx, [edi+WDATA.box.height]
993
	add   edx, ebx	    ; y0e
999
	add   edx, ebx	    ; y0e
994
 
1000
 
995
	mov   ecx, [esi+WDATA.box.top]	; y  ; y check
1001
	mov   ecx, [esi+WDATA.box.top]	; y  ; y check
996
	cmp   ecx, edx
1002
	cmp   ecx, edx
997
	jae   .new_check     ; y < y0e
1003
	jae   .new_check     ; y < y0e
998
	mov   eax, [esi+WDATA.box.height]
1004
	mov   eax, [esi+WDATA.box.height]
999
	add   ecx, eax	     ; ye
1005
	add   ecx, eax	     ; ye
1000
	cmp   ebx, ecx	     ; y0 >= ye
1006
	cmp   ebx, ecx	     ; y0 >= ye
1001
	ja    .new_check
1007
	ja    .new_check
1002
 
1008
 
1003
	mov   eax, [edi+WDATA.box.left]   ; x0
1009
	mov   eax, [edi+WDATA.box.left]   ; x0
1004
	mov   ecx, [edi+WDATA.box.width]
1010
	mov   ecx, [edi+WDATA.box.width]
1005
	add   ecx, eax	     ; x0e
1011
	add   ecx, eax	     ; x0e
1006
 
1012
 
1007
	mov   edx, [esi+WDATA.box.left]   ; x ; x check
1013
	mov   edx, [esi+WDATA.box.left]   ; x ; x check
1008
	cmp   edx, ecx
1014
	cmp   edx, ecx
1009
	jae   .new_check     ; x < x0e
1015
	jae   .new_check     ; x < x0e
1010
	mov   ecx, [esi+WDATA.box.width]
1016
	mov   ecx, [esi+WDATA.box.width]
1011
	add   edx, ecx
1017
	add   edx, ecx
1012
	cmp   eax, edx
1018
	cmp   eax, edx
1013
	ja    .new_check
1019
	ja    .new_check
1014
 
1020
 
1015
	pop   esi
1021
	pop   esi
1016
  .return_yes:
1022
  .return_yes:
1017
	mov   ecx,1   ; overlap some window
1023
	mov   ecx,1   ; overlap some window
1018
	ret
1024
	ret
1019
 
1025
 
1020
  .all_wnds_to_top:
1026
  .all_wnds_to_top:
1021
 
1027
 
1022
	pop   esi
1028
	pop   esi
1023
 
1029
 
1024
	xor   ecx, ecx	     ; passed all windows to top
1030
	xor   ecx, ecx	     ; passed all windows to top
1025
	ret
1031
	ret
1026
 
1032
 
1027
 
1033
 
1028
 
1034
 
1029
 
1035
 
1030
waredraw:     ; if redraw necessary at activate
1036
waredraw:     ; if redraw necessary at activate
1031
 
1037
 
1032
	pushad
1038
	pushad
1033
 
1039
 
1034
	call  checkwindowdraw	   ; draw window on activation ?
1040
	call  checkwindowdraw	   ; draw window on activation ?
1035
	test  ecx, ecx
1041
	test  ecx, ecx
1036
	jz    .do_not_draw
1042
	jz    .do_not_draw
1037
 
1043
 
1038
	popad
1044
	popad
1039
	mov   [MOUSE_DOWN], byte 1     ; do draw mouse
1045
	mov   [MOUSE_DOWN], byte 1     ; do draw mouse
1040
	call  windowactivate
1046
	call  windowactivate
1041
 
1047
 
1042
	; update screen info
1048
	; update screen info
1043
	pushad
1049
	pushad
1044
	mov   edi, [TASK_COUNT] ; the last process (number)
1050
	mov   edi, [TASK_COUNT] ; the last process (number)
1045
	movzx esi, word [WIN_POS + edi * 2]
1051
	movzx esi, word [WIN_POS + edi * 2]
1046
	shl   esi, 5
1052
	shl   esi, 5
1047
	add   esi, window_data
1053
	add   esi, window_data
1048
 
1054
 
1049
	; coordinates of the upper window
1055
	; coordinates of the upper window
1050
    mov   eax, [esi + WDATA.box.left]	; cx
1056
    mov   eax, [esi + WDATA.box.left]	; cx
1051
    mov   ebx, [esi + WDATA.box.top]	; cy
1057
    mov   ebx, [esi + WDATA.box.top]	; cy
1052
    mov   ecx, [esi + WDATA.box.width]	; sx
1058
    mov   ecx, [esi + WDATA.box.width]	; sx
1053
    mov   edx, [esi + WDATA.box.height] ; sy
1059
    mov   edx, [esi + WDATA.box.height] ; sy
1054
 
1060
 
1055
	add   ecx, eax	     ; ecx = x_end
1061
	add   ecx, eax	     ; ecx = x_end
1056
	add   edx, ebx	     ; edx = y_end
1062
	add   edx, ebx	     ; edx = y_end
1057
 
1063
 
1058
	mov   edi, [TASK_COUNT]
1064
	mov   edi, [TASK_COUNT]
1059
	movzx esi, word [WIN_POS + edi * 2]
1065
	movzx esi, word [WIN_POS + edi * 2]
1060
	call  setscreen
1066
	call  setscreen
1061
	popad
1067
	popad
1062
 
1068
 
1063
    mov   [edi + WDATA.fl_redraw], 1  ; redraw flag for app
1069
    mov   [edi + WDATA.fl_redraw], 1  ; redraw flag for app
1064
    mov   [MOUSE_DOWN],byte 0		  ; mouse down checks
1070
    mov   [MOUSE_DOWN],byte 0		  ; mouse down checks
1065
 
1071
 
1066
	ret
1072
	ret
1067
 
1073
 
1068
     .do_not_draw:
1074
     .do_not_draw:
1069
 
1075
 
1070
	popad
1076
	popad
1071
 
1077
 
1072
	call  windowactivate
1078
	call  windowactivate
1073
	mov   [MOUSE_DOWN],byte 0  ; mouse down checks
1079
	mov   [MOUSE_DOWN],byte 0  ; mouse down checks
1074
	mov   [MOUSE_BACKGROUND],byte 0  ; no mouse background
1080
	mov   [MOUSE_BACKGROUND],byte 0  ; no mouse background
1075
	mov   [DONT_DRAW_MOUSE],byte 0	; draw mouse
1081
	mov   [DONT_DRAW_MOUSE],byte 0	; draw mouse
1076
	ret
1082
	ret
1077
 
1083
 
1078
 
1084
 
1079
; eax = window number on screen
1085
; eax = window number on screen
1080
; corrupts registers and [dl*]
1086
; corrupts registers and [dl*]
1081
minimize_window:
1087
minimize_window:
1082
	movzx eax, word [WIN_POS+eax*2]
1088
	movzx eax, word [WIN_POS+eax*2]
1083
	shl   eax, 5
1089
	shl   eax, 5
1084
	add   eax, window_data
1090
	add   eax, window_data
1085
	test  [eax+WDATA.fl_wstate], WSTATE_MINIMIZED
1091
	test  [eax+WDATA.fl_wstate], WSTATE_MINIMIZED
1086
	jnz   .skip_redrawings
1092
	jnz   .skip_redrawings
1087
	pushfd
1093
	pushfd
1088
	cli
1094
	cli
1089
	or    [eax+WDATA.fl_wstate], WSTATE_MINIMIZED
1095
	or    [eax+WDATA.fl_wstate], WSTATE_MINIMIZED
1090
	mov   edi, eax
1096
	mov   edi, eax
1091
	;call  calculatescreen
1097
	;call  calculatescreen
1092
	mov   eax, [edi+WDATA.box.left]
1098
	mov   eax, [edi+WDATA.box.left]
1093
	mov   [dlx], eax
1099
	mov   [dlx], eax
1094
	mov   ecx, eax
1100
	mov   ecx, eax
1095
	add   ecx, [edi+WDATA.box.width]
1101
	add   ecx, [edi+WDATA.box.width]
1096
	mov   [dlxe], ecx
1102
	mov   [dlxe], ecx
1097
	mov   ebx, [edi+WDATA.box.top]
1103
	mov   ebx, [edi+WDATA.box.top]
1098
	mov   [dly], ebx
1104
	mov   [dly], ebx
1099
	mov   edx, ebx
1105
	mov   edx, ebx
1100
	add   edx, [edi+WDATA.box.height]
1106
	add   edx, [edi+WDATA.box.height]
1101
	mov   [dlye], edx
1107
	mov   [dlye], edx
1102
	call  calculatescreen
1108
	call  calculatescreen
1103
	xor   esi, esi
1109
	xor   esi, esi
1104
	xor   eax, eax
1110
	xor   eax, eax
1105
	call  redrawscreen
1111
	call  redrawscreen
1106
	popfd
1112
	popfd
1107
.skip_redrawings:
1113
.skip_redrawings:
1108
	ret
1114
	ret
1109
 
1115
 
1110
; eax = window number on screen
1116
; eax = window number on screen
1111
; corrupts registers and [dl*]
1117
; corrupts registers and [dl*]
1112
restore_minimized_window:
1118
restore_minimized_window:
1113
	pushfd
1119
	pushfd
1114
	cli
1120
	cli
1115
	movzx esi, word [WIN_POS+eax*2]
1121
	movzx esi, word [WIN_POS+eax*2]
1116
	mov   edi, esi
1122
	mov   edi, esi
1117
	shl   edi, 5
1123
	shl   edi, 5
1118
	add   edi, window_data
1124
	add   edi, window_data
1119
	test  [edi+WDATA.fl_wstate], WSTATE_MINIMIZED
1125
	test  [edi+WDATA.fl_wstate], WSTATE_MINIMIZED
1120
	jz    .skip_redrawings
1126
	jz    .skip_redrawings
1121
	mov   [edi+WDATA.fl_redraw], 1
1127
	mov   [edi+WDATA.fl_redraw], 1
1122
	and   [edi+WDATA.fl_wstate], not WSTATE_MINIMIZED
1128
	and   [edi+WDATA.fl_wstate], not WSTATE_MINIMIZED
1123
	cmp   eax, [TASK_COUNT] ; the uppermost window
1129
	cmp   eax, [TASK_COUNT] ; the uppermost window
1124
	jnz   .no_uppermost
1130
	jnz   .no_uppermost
1125
	mov   eax, [edi+WDATA.box.left]
1131
	mov   eax, [edi+WDATA.box.left]
1126
	mov   ebx, [edi+WDATA.box.top]
1132
	mov   ebx, [edi+WDATA.box.top]
1127
	mov   ecx, eax
1133
	mov   ecx, eax
1128
	mov   edx, ebx
1134
	mov   edx, ebx
1129
	add   ecx, [edi+WDATA.box.width]
1135
	add   ecx, [edi+WDATA.box.width]
1130
	add   edx, [edi+WDATA.box.height]
1136
	add   edx, [edi+WDATA.box.height]
1131
	call  setscreen
1137
	call  setscreen
1132
	jmp   .done
1138
	jmp   .done
1133
.no_uppermost:
1139
.no_uppermost:
1134
	mov   eax, [edi+WDATA.box.left]
1140
	mov   eax, [edi+WDATA.box.left]
1135
	mov   ebx, [edi+WDATA.box.top]
1141
	mov   ebx, [edi+WDATA.box.top]
1136
	mov   ecx, eax
1142
	mov   ecx, eax
1137
	mov   edx, ebx
1143
	mov   edx, ebx
1138
	add   ecx, [edi+WDATA.box.width]
1144
	add   ecx, [edi+WDATA.box.width]
1139
	add   edx, [edi+WDATA.box.height]
1145
	add   edx, [edi+WDATA.box.height]
1140
	call  calculatescreen
1146
	call  calculatescreen
1141
.done:
1147
.done:
1142
	mov   [MOUSE_BACKGROUND],byte 0 ; no mouse under
1148
	mov   [MOUSE_BACKGROUND],byte 0 ; no mouse under
1143
.skip_redrawings:
1149
.skip_redrawings:
1144
	popfd
1150
	popfd
1145
	ret
1151
	ret
1146
 
1152
 
1147
 
1153
 
1148
iglobal
1154
iglobal
1149
  window_moving   db 'K : Window - move/resize',13,10,0
1155
  window_moving   db 'K : Window - move/resize',13,10,0
1150
  window_moved	  db 'K : Window - done',13,10,0
1156
  window_moved	  db 'K : Window - done',13,10,0
1151
endg
1157
endg
1152
 
1158
 
1153
; check window touch
1159
; check window touch
1154
align 4
1160
align 4
1155
checkwindows:
1161
checkwindows:
1156
	pushad
1162
	pushad
1157
 
1163
 
1158
	cmp   [window_minimize], 0
1164
	cmp   [window_minimize], 0
1159
	je    .no_minimizing
1165
	je    .no_minimizing
1160
	mov   eax, [TASK_COUNT]       ; the uppermost window
1166
	mov   eax, [TASK_COUNT]       ; the uppermost window
1161
	mov   bl, 0
1167
	mov   bl, 0
1162
	xchg  [window_minimize], bl
1168
	xchg  [window_minimize], bl
1163
	cmp   bl, 1
1169
	cmp   bl, 1
1164
	jne   .restore
1170
	jne   .restore
1165
	call  minimize_window
1171
	call  minimize_window
1166
	jmp   .continue
1172
	jmp   .continue
1167
  .restore:
1173
  .restore:
1168
	call  restore_minimized_window
1174
	call  restore_minimized_window
1169
  .continue:
1175
  .continue:
1170
  .no_minimizing:
1176
  .no_minimizing:
1171
 
1177
 
1172
	cmp   [BTN_DOWN],byte 0    ; mouse buttons pressed ?
1178
	cmp   [BTN_DOWN],byte 0    ; mouse buttons pressed ?
1173
	jne  .mouse_buttons_pressed
1179
	jne  .mouse_buttons_pressed
1174
;..................................... start 1/4 : modified by vhanla .................
1180
;..................................... start 1/4 : modified by vhanla .................
1175
	mov [bPressedMouseXY_W],0
1181
	mov [bPressedMouseXY_W],0
1176
;..................................... end 1/4 : modified by vhanla ...................
1182
;..................................... end 1/4 : modified by vhanla ...................
1177
	popad
1183
	popad
1178
	ret
1184
	ret
1179
    .mouse_buttons_pressed:
1185
    .mouse_buttons_pressed:
1180
;..................................... start 2/4 : modified by vhanla .................
1186
;..................................... start 2/4 : modified by vhanla .................
1181
	jmp @f
1187
	jmp @f
1182
	bPressedMouseXY_W db 0x0
1188
	bPressedMouseXY_W db 0x0
1183
	@@:
1189
	@@:
1184
;..................................... end 2/4 : modified by vhanla ...................
1190
;..................................... end 2/4 : modified by vhanla ...................
1185
	mov   esi,[TASK_COUNT]
1191
	mov   esi,[TASK_COUNT]
1186
	inc   esi
1192
	inc   esi
1187
 
1193
 
1188
;..................................... start 3/4 : modified by vhanla .................
1194
;..................................... start 3/4 : modified by vhanla .................
1189
	push ax
1195
	push ax
1190
	cmp [bPressedMouseXY_W],0
1196
	cmp [bPressedMouseXY_W],0
1191
	jnz @f
1197
	jnz @f
1192
	mov [bPressedMouseXY_W],1
1198
	mov [bPressedMouseXY_W],1
1193
	mov ax,[MOUSE_X]
1199
	mov ax,[MOUSE_X]
1194
	mov [mx],ax
1200
	mov [mx],ax
1195
	mov ax,[MOUSE_Y]
1201
	mov ax,[MOUSE_Y]
1196
	mov [my],ax
1202
	mov [my],ax
1197
	@@:
1203
	@@:
1198
	pop ax
1204
	pop ax
1199
;..................................... end 3/4 : modified by vhanla ...................
1205
;..................................... end 3/4 : modified by vhanla ...................
1200
 
1206
 
1201
      cwloop:
1207
      cwloop:
1202
	cmp   esi,2
1208
	cmp   esi,2
1203
	jb   .exit
1209
	jb   .exit
1204
 
1210
 
1205
	dec   esi
1211
	dec   esi
1206
	movzx edi, word [WIN_POS + esi * 2] ; ebx
1212
	movzx edi, word [WIN_POS + esi * 2] ; ebx
1207
	shl   edi, 5
1213
	shl   edi, 5
1208
	add   edi, window_data
1214
	add   edi, window_data
1209
;        mov   edi, ebx
1215
;        mov   edi, ebx
1210
    mov   ecx, [edi + WDATA.box.left]
1216
    mov   ecx, [edi + WDATA.box.left]
1211
    mov   edx, [edi + WDATA.box.top]
1217
    mov   edx, [edi + WDATA.box.top]
1212
 
1218
 
1213
	mov   eax,ecx
1219
	mov   eax,ecx
1214
	mov   ebx,edx
1220
	mov   ebx,edx
1215
	test	[edi+WDATA.fl_wstate],WSTATE_MINIMIZED
1221
	test	[edi+WDATA.fl_wstate],WSTATE_MINIMIZED
1216
	jnz	cwloop
1222
	jnz	cwloop
1217
 
1223
 
1218
;..................................... start 4/4 : modified by vhanla .................
1224
;..................................... start 4/4 : modified by vhanla .................
1219
       movzx  eax, word [mx]; movzx eax,word[MOUSE_X]
1225
       movzx  eax, word [mx]; movzx eax,word[MOUSE_X]
1220
       movzx  ebx, word [my]; movzx ebx,word[MOUSE_Y]
1226
       movzx  ebx, word [my]; movzx ebx,word[MOUSE_Y]
1221
;..................................... endt 4/4 : modified by vhanla ..................
1227
;..................................... endt 4/4 : modified by vhanla ..................
1222
	cmp   ecx, eax
1228
	cmp   ecx, eax
1223
	jae   cwloop
1229
	jae   cwloop
1224
	cmp   edx, ebx
1230
	cmp   edx, ebx
1225
	jae   cwloop
1231
	jae   cwloop
1226
    add   ecx, [edi + WDATA.box.width]
1232
    add   ecx, [edi + WDATA.box.width]
1227
    add   edx, [edi + WDATA.box.height]
1233
    add   edx, [edi + WDATA.box.height]
1228
	cmp   eax, ecx
1234
	cmp   eax, ecx
1229
	jae   cwloop
1235
	jae   cwloop
1230
	cmp   ebx, edx
1236
	cmp   ebx, edx
1231
	jae   cwloop
1237
	jae   cwloop
1232
 
1238
 
1233
	pushad
1239
	pushad
1234
	mov   eax, esi
1240
	mov   eax, esi
1235
	mov   ebx, [TASK_COUNT]
1241
	mov   ebx, [TASK_COUNT]
1236
	cmp   eax, ebx	    ; is this window active?
1242
	cmp   eax, ebx	    ; is this window active?
1237
	jz    .move_resize_window
1243
	jz    .move_resize_window
1238
 
1244
 
1239
	; eax = position in windowing stack
1245
	; eax = position in windowing stack
1240
	; redraw must ?
1246
	; redraw must ?
1241
	lea   esi, [WIN_POS + esi * 2]
1247
	lea   esi, [WIN_POS + esi * 2]
1242
	call  waredraw
1248
	call  waredraw
1243
	add   esp, 32
1249
	add   esp, 32
1244
 
1250
 
1245
      .exit:
1251
      .exit:
1246
	popad
1252
	popad
1247
	ret
1253
	ret
1248
 
1254
 
1249
   .move_resize_window:    ; MOVE OR RESIZE WINDOW
1255
   .move_resize_window:    ; MOVE OR RESIZE WINDOW
1250
	popad
1256
	popad
1251
 
1257
 
1252
	; Check for user enabled fixed window
1258
	; Check for user enabled fixed window
1253
    mov   edx, [edi + WDATA.cl_titlebar]
1259
    mov   edx, [edi + WDATA.cl_titlebar]
1254
	and   edx, 0x0f000000
1260
	and   edx, 0x0f000000
1255
	cmp   edx, 0x01000000
1261
	cmp   edx, 0x01000000
1256
	jne   .window_move_enabled_for_user
1262
	jne   .window_move_enabled_for_user
1257
	popad
1263
	popad
1258
	ret
1264
	ret
1259
      .window_move_enabled_for_user:
1265
      .window_move_enabled_for_user:
1260
 
1266
 
1261
    test    [edi+WDATA.fl_wstate],WSTATE_ROLLEDUP
1267
    test    [edi+WDATA.fl_wstate],WSTATE_ROLLEDUP
1262
	jnz	.no_resize_2
1268
	jnz	.no_resize_2
1263
 
1269
 
1264
	mov   [do_resize_from_corner],byte 0   ; resize for skinned window
1270
	mov   [do_resize_from_corner],byte 0   ; resize for skinned window
1265
    mov   edx, [edi + WDATA.cl_workarea]
1271
    mov   edx, [edi + WDATA.cl_workarea]
1266
	and   edx, 0x0f000000
1272
	and   edx, 0x0f000000
-
 
1273
	cmp   edx, 0x00000000						;{test for resized}
-
 
1274
	je    .no_resize_2
-
 
1275
	cmp   edx, 0x01000000						;{test for resized}
-
 
1276
	je    .no_resize_2
1267
	cmp   edx, 0x02000000
1277
	cmp   edx, 0x04000000						;{test for resized}					
-
 
1278
	je    .no_resize_2
1268
	jb    .no_resize_2 ; not type 2 wnd
1279
;	jb    .no_resize_2 ; not type 2 wnd
1269
 
1280
 
1270
    mov   edx, [edi + WDATA.box.top]
1281
    mov   edx, [edi + WDATA.box.top]
1271
    add   edx, [edi + WDATA.box.height]
1282
    add   edx, [edi + WDATA.box.height]
1272
	sub   edx, 6	   ; edx = y_end - 6
1283
	sub   edx, 6	   ; edx = y_end - 6
1273
	cmp   ebx, edx	   ; ebx = mouse_y
1284
	cmp   ebx, edx	   ; ebx = mouse_y
1274
	jb    .no_resize_2
1285
	jb    .no_resize_2
1275
	mov   [do_resize_from_corner],byte 1
1286
	mov   [do_resize_from_corner],byte 1
1276
	jmp   .continue
1287
	jmp   .continue
1277
      .no_resize_2:
1288
      .no_resize_2:
1278
 
1289
 
1279
	push	eax
1290
	push	eax
1280
	call	get_titlebar_height
1291
	call	get_titlebar_height
1281
    add     eax,[edi + WDATA.box.top]
1292
    add     eax,[edi + WDATA.box.top]
1282
	cmp	ebx,eax
1293
	cmp	ebx,eax
1283
	pop	eax
1294
	pop	eax
1284
	jae	.exit
1295
	jae	.exit
1285
 
1296
 
1286
     .continue:
1297
     .continue:
1287
 
1298
 
1288
	push  esi
1299
	push  esi
1289
	mov   esi, window_moving
1300
	mov   esi, window_moving
1290
	call  sys_msg_board_str
1301
	call  sys_msg_board_str
1291
	pop   esi
1302
	pop   esi
1292
 
1303
 
1293
	mov   ecx, [timer_ticks]     ; double-click ?
1304
	mov   ecx, [timer_ticks]     ; double-click ?
1294
	mov   edx, ecx
1305
	mov   edx, ecx
1295
	sub   edx, [latest_window_touch]
1306
	sub   edx, [latest_window_touch]
1296
	mov   [latest_window_touch], ecx
1307
	mov   [latest_window_touch], ecx
1297
	mov   [latest_window_touch_delta], edx
1308
	mov   [latest_window_touch_delta], edx
1298
 
1309
 
1299
	mov   cl, [BTN_DOWN]	 ; save for shade check
1310
	mov   cl, [BTN_DOWN]	 ; save for shade check
1300
	mov   [do_resize], cl
1311
	mov   [do_resize], cl
1301
     no_emulation_righ_button:
1312
     no_emulation_righ_button:
1302
    mov   ecx, [edi + WDATA.box.left]
1313
    mov   ecx, [edi + WDATA.box.left]
1303
    mov   edx, [edi + WDATA.box.top]
1314
    mov   edx, [edi + WDATA.box.top]
1304
 
1315
 
1305
	push  eax ecx edx
1316
	push  eax ecx edx
1306
	mov   [dlx], ecx      ; save for drawlimits
1317
	mov   [dlx], ecx      ; save for drawlimits
1307
	mov   [dly], edx
1318
	mov   [dly], edx
1308
    mov   eax, [edi + WDATA.box.width]
1319
    mov   eax, [edi + WDATA.box.width]
1309
	add   ecx, eax
1320
	add   ecx, eax
1310
    mov   eax, [edi + WDATA.box.height]
1321
    mov   eax, [edi + WDATA.box.height]
1311
	add   edx, eax
1322
	add   edx, eax
1312
	mov   [dlxe], ecx
1323
	mov   [dlxe], ecx
1313
	mov   [dlye], edx
1324
	mov   [dlye], edx
1314
	pop   edx ecx eax
1325
	pop   edx ecx eax
1315
 
1326
 
1316
	sub   eax, ecx
1327
	sub   eax, ecx
1317
	sub   ebx, edx
1328
	sub   ebx, edx
1318
 
1329
 
1319
	mov   esi, [MOUSE_X]
1330
	mov   esi, [MOUSE_X]
1320
	mov   [WIN_TEMP_XY], esi
1331
	mov   [WIN_TEMP_XY], esi
1321
 
1332
 
1322
	pushad		 ; wait for putimages to finish
1333
	pushad		 ; wait for putimages to finish
1323
;        mov   eax,5
1334
;        mov   eax,5
1324
;        call  delay_hs
1335
;        call  delay_hs
1325
    mov   eax,[edi + WDATA.box.left]
1336
    mov   eax,[edi + WDATA.box.left]
1326
	mov   [npx],eax
1337
	mov   [npx],eax
1327
    mov   eax,[edi + WDATA.box.top]
1338
    mov   eax,[edi + WDATA.box.top]
1328
	mov   [npy],eax
1339
	mov   [npy],eax
1329
	popad
1340
	popad
1330
 
1341
 
1331
	push eax		  ; save old coordinates
1342
	push eax		  ; save old coordinates
1332
    mov   ax, word [edi + WDATA.box.left]
1343
    mov   ax, word [edi + WDATA.box.left]
1333
	mov   word [oldc+BOX.left],ax
1344
	mov   word [oldc+BOX.left],ax
1334
    mov   ax, word [edi + WDATA.box.top]
1345
    mov   ax, word [edi + WDATA.box.top]
1335
	mov   word [oldc+BOX.top],ax
1346
	mov   word [oldc+BOX.top],ax
1336
    mov   ax, word [edi + WDATA.box.width]
1347
    mov   ax, word [edi + WDATA.box.width]
1337
	mov   word [oldc+BOX.width],ax
1348
	mov   word [oldc+BOX.width],ax
1338
	mov   word [npxe],ax
1349
	mov   word [npxe],ax
1339
    mov   ax, word [edi + WDATA.box.height]
1350
    mov   ax, word [edi + WDATA.box.height]
1340
	mov   word [oldc+BOX.height],ax
1351
	mov   word [oldc+BOX.height],ax
1341
	mov   word [npye],ax
1352
	mov   word [npye],ax
1342
	pop eax
1353
	pop eax
1343
 
1354
 
1344
	call  drawwindowframes
1355
	call  drawwindowframes
1345
 
1356
 
1346
	mov   [reposition],0
1357
	mov   [reposition],0
1347
	mov   [MOUSE_DOWN],byte 1   ; no reaction to mouse up/down
1358
	mov   [MOUSE_DOWN],byte 1   ; no reaction to mouse up/down
1348
 
1359
 
1349
	; move window
1360
	; move window
1350
 
1361
 
1351
      newchm:
1362
      newchm:
1352
 
1363
 
1353
	mov   [DONT_DRAW_MOUSE],byte 1
1364
	mov   [DONT_DRAW_MOUSE],byte 1
1354
 
1365
 
1355
	call  checkidle
1366
	call  checkidle
1356
 
1367
 
1357
	call  checkVga_N13
1368
	call  checkVga_N13
1358
 
1369
 
1359
	mov   [MOUSE_BACKGROUND],byte 0
1370
	mov   [MOUSE_BACKGROUND],byte 0
1360
 
1371
 
1361
	call  [draw_pointer]
1372
	call  [draw_pointer]
1362
 
1373
 
1363
	pushad
1374
	pushad
1364
	call   stack_handler
1375
	call   stack_handler
1365
	popad
1376
	popad
1366
 
1377
 
1367
	mov   esi,[WIN_TEMP_XY]
1378
	mov   esi,[WIN_TEMP_XY]
1368
	cmp   esi,[MOUSE_X]
1379
	cmp   esi,[MOUSE_X]
1369
	je    cwb
1380
	je    cwb
1370
 
1381
 
1371
	mov   cx,[MOUSE_X]
1382
	mov   cx,[MOUSE_X]
1372
	mov   dx,[MOUSE_Y]
1383
	mov   dx,[MOUSE_Y]
1373
	sub   cx,ax
1384
	sub   cx,ax
1374
	sub   dx,bx
1385
	sub   dx,bx
1375
 
1386
 
1376
	push  ax
1387
	push  ax
1377
	push  bx
1388
	push  bx
1378
 
1389
 
1379
	call  drawwindowframes
1390
	call  drawwindowframes
1380
 
1391
 
1381
	mov   ax,[ScreenWidth]
1392
	mov   ax,[ScreenWidth]
1382
	mov   bx,[ScreenHeight]
1393
	mov   bx,[ScreenHeight]
1383
 
1394
 
1384
	cmp   [do_resize_from_corner],1
1395
	cmp   [do_resize_from_corner],1
1385
	je    no_new_position
1396
	je    no_new_position
1386
 
1397
 
1387
	mov   word [npx],word 0     ; x repos ?
1398
	mov   word [npx],word 0     ; x repos ?
1388
	cmp   ax,cx
1399
	cmp   ax,cx
1389
	jb    noreposx
1400
	jb    noreposx
1390
	mov   [reposition],1
1401
	mov   [reposition],1
1391
	sub   ax,word [npxe]
1402
	sub   ax,word [npxe]
1392
	mov   word [npx],ax
1403
	mov   word [npx],ax
1393
	cmp   ax,cx
1404
	cmp   ax,cx
1394
	jb    noreposx
1405
	jb    noreposx
1395
	mov   word [npx],cx
1406
	mov   word [npx],cx
1396
      noreposx:
1407
      noreposx:
1397
 
1408
 
1398
	mov   word [npy],word 0     ; y repos ?
1409
	mov   word [npy],word 0     ; y repos ?
1399
	cmp   bx,dx
1410
	cmp   bx,dx
1400
	jb    noreposy
1411
	jb    noreposy
1401
	mov   [reposition],1
1412
	mov   [reposition],1
1402
	sub   bx,word [npye]
1413
	sub   bx,word [npye]
1403
	mov   word [npy],bx
1414
	mov   word [npy],bx
1404
	cmp   bx,dx
1415
	cmp   bx,dx
1405
	jb    noreposy
1416
	jb    noreposy
1406
	mov   word [npy],dx
1417
	mov   word [npy],dx
1407
      noreposy:
1418
      noreposy:
1408
 
1419
 
1409
      no_new_position:
1420
      no_new_position:
1410
 
1421
 
1411
	cmp   [do_resize_from_corner],0    ; resize from right corner
1422
	cmp   [do_resize_from_corner],0    ; resize from right corner
1412
	je    norepos_size
1423
	je    norepos_size
1413
	pushad
1424
	pushad
1414
 
1425
 
1415
	mov   edx,edi
1426
	mov   edx,edi
1416
	sub   edx,window_data
1427
	sub   edx,window_data
1417
	;shr   edx,5
1428
	;shr   edx,5
1418
	;shl   edx,8
1429
	;shl   edx,8
1419
	;add   edx,0x80000                 ; process base at 0x80000+
1430
	;add   edx,0x80000                 ; process base at 0x80000+
1420
    lea   edx, [SLOT_BASE + edx*8]
1431
    lea   edx, [SLOT_BASE + edx*8]
1421
 
1432
 
1422
	movzx eax,word [MOUSE_X]
1433
	movzx eax,word [MOUSE_X]
1423
    cmp   eax,[edi + WDATA.box.left]
1434
    cmp   eax,[edi + WDATA.box.left]
1424
	jb    nnepx
1435
	jb    nnepx
1425
    sub   eax,[edi + WDATA.box.left]
1436
    sub   eax,[edi + WDATA.box.left]
1426
	cmp   eax,32 ; [edx+0x90+8]
1437
	cmp   eax,32 ; [edx+0x90+8]
1427
	jge   nnepx2
1438
	jge   nnepx2
1428
	mov   eax,32 ; [edx+0x90+8]
1439
	mov   eax,32 ; [edx+0x90+8]
1429
      nnepx2:
1440
      nnepx2:
1430
	mov   [npxe],eax
1441
	mov   [npxe],eax
1431
      nnepx:
1442
      nnepx:
1432
 
1443
 
1433
	call	get_rolledup_height
1444
	call	get_rolledup_height
1434
	mov	ebx,eax
1445
	mov	ebx,eax
1435
	movzx eax,word [MOUSE_Y]
1446
	movzx eax,word [MOUSE_Y]
1436
    cmp   eax,[edi + WDATA.box.top]
1447
    cmp   eax,[edi + WDATA.box.top]
1437
	jb    nnepy
1448
	jb    nnepy
1438
    sub   eax,[edi + WDATA.box.top]
1449
    sub   eax,[edi + WDATA.box.top]
1439
	cmp	eax,ebx ; [edx+0x90+12]
1450
	cmp	eax,ebx ; [edx+0x90+12]
1440
	jge	nnepy2
1451
	jge	nnepy2
1441
	mov	eax,ebx ; [edx+0x90+12]
1452
	mov	eax,ebx ; [edx+0x90+12]
1442
      nnepy2:
1453
      nnepy2:
1443
	mov   [npye],eax
1454
	mov   [npye],eax
1444
      nnepy:
1455
      nnepy:
1445
 
1456
 
1446
	mov   [reposition],1
1457
	mov   [reposition],1
1447
 
1458
 
1448
	popad
1459
	popad
1449
      norepos_size:
1460
      norepos_size:
1450
 
1461
 
1451
	pop   bx
1462
	pop   bx
1452
	pop   ax
1463
	pop   ax
1453
	call  drawwindowframes
1464
	call  drawwindowframes
1454
 
1465
 
1455
	mov   esi,[MOUSE_X]
1466
	mov   esi,[MOUSE_X]
1456
	mov   [WIN_TEMP_XY],esi
1467
	mov   [WIN_TEMP_XY],esi
1457
 
1468
 
1458
      cwb:
1469
      cwb:
1459
	cmp   [BTN_DOWN],byte 0
1470
	cmp   [BTN_DOWN],byte 0
1460
	jne   newchm
1471
	jne   newchm
1461
				     ; new position done
1472
				     ; new position done
1462
	mov	[DONT_DRAW_MOUSE],byte 1
1473
	mov	[DONT_DRAW_MOUSE],byte 1
1463
	mov	cl,0
1474
	mov	cl,0
1464
	test	[edi+WDATA.fl_wstate],WSTATE_MAXIMIZED
1475
	test	[edi+WDATA.fl_wstate],WSTATE_MAXIMIZED
1465
	jnz	@f
1476
	jnz	@f
1466
	mov	cl,[reposition]
1477
	mov	cl,[reposition]
1467
	call	drawwindowframes
1478
	call	drawwindowframes
1468
 
1479
 
1469
	mov   eax,[npx]
1480
	mov   eax,[npx]
1470
    mov   [edi + WDATA.box.left],eax
1481
    mov   [edi + WDATA.box.left],eax
1471
	mov   eax,[npy]
1482
	mov   eax,[npy]
1472
    mov   [edi + WDATA.box.top],eax
1483
    mov   [edi + WDATA.box.top],eax
1473
	mov   eax,[npxe]
1484
	mov   eax,[npxe]
1474
    mov   [edi + WDATA.box.width],eax
1485
    mov   [edi + WDATA.box.width],eax
1475
	mov   eax,[npye]
1486
	mov   eax,[npye]
1476
    mov   [edi + WDATA.box.height],eax
1487
    mov   [edi + WDATA.box.height],eax
1477
	call	set_window_clientbox
1488
	call	set_window_clientbox
1478
 
1489
 
1479
    @@: mov	[reposition],cl
1490
    @@: mov	[reposition],cl
1480
 
1491
 
1481
	cmp   [reposition],1	     ; save new position and size
1492
	cmp   [reposition],1	     ; save new position and size
1482
	jne   no_bounds_save
1493
	jne   no_bounds_save
1483
	push  esi edi ecx
1494
	push  esi edi ecx
1484
	mov   esi,edi
1495
	mov   esi,edi
1485
	mov   ecx,2
1496
	mov   ecx,2
1486
	test  [edi+WDATA.fl_wstate],WSTATE_ROLLEDUP or WSTATE_MAXIMIZED
1497
	test  [edi+WDATA.fl_wstate],WSTATE_ROLLEDUP or WSTATE_MAXIMIZED
1487
	jnz   @f
1498
	jnz   @f
1488
	add   ecx,2
1499
	add   ecx,2
1489
    @@: sub   edi,window_data
1500
    @@: sub   edi,window_data
1490
	shr   edi,5
1501
	shr   edi,5
1491
	shl   edi,8
1502
	shl   edi,8
1492
	add   edi,SLOT_BASE+APPDATA.saved_box
1503
	add   edi,SLOT_BASE+APPDATA.saved_box
1493
	cld
1504
	cld
1494
	rep   movsd
1505
	rep   movsd
1495
	pop   ecx edi esi
1506
	pop   ecx edi esi
1496
      no_bounds_save:
1507
      no_bounds_save:
1497
 
1508
 
1498
	pushad				   ; WINDOW SHADE/FULLSCREEN
1509
	pushad				   ; WINDOW SHADE/FULLSCREEN
-
 
1510
 
-
 
1511
	;{doule click not worked for 4 type window}
-
 
1512
    mov   edx, [edi + WDATA.cl_workarea]
-
 
1513
	and   edx, 0x0f000000
-
 
1514
	cmp   edx, 0x00000000
-
 
1515
	je    no_fullscreen_restore
-
 
1516
	cmp   edx, 0x01000000
-
 
1517
	je    no_fullscreen_restore
-
 
1518
	cmp   edx, 0x04000000
-
 
1519
	je    no_fullscreen_restore
1499
 
1520
 
1500
	cmp   [reposition],1
1521
	cmp   [reposition],1
1501
	je    no_window_sizing
1522
	je    no_window_sizing
1502
	mov   edx,edi
1523
	mov   edx,edi
1503
	sub   edx,window_data
1524
	sub   edx,window_data
1504
	shr   edx,5
1525
	shr   edx,5
1505
	shl   edx,8
1526
	shl   edx,8
1506
	add   edx,SLOT_BASE		    ; process base at 0x80000+
1527
	add   edx,SLOT_BASE		    ; process base at 0x80000+
1507
 
1528
 
1508
	cmp   [do_resize],2		  ; window shade ?
1529
	cmp   [do_resize],2		  ; window shade ?
1509
	jne   no_window_shade
1530
	jne   no_window_shade
1510
	mov   [reposition],1
1531
	mov   [reposition],1
1511
 
1532
 
1512
	test	[edi+WDATA.fl_wstate],WSTATE_ROLLEDUP
1533
	test	[edi+WDATA.fl_wstate],WSTATE_ROLLEDUP
1513
	jnz	wnd_rolldown
1534
	jnz	wnd_rolldown
1514
  wnd_rollup:
1535
  wnd_rollup:
1515
	or	[edi+WDATA.fl_wstate],WSTATE_ROLLEDUP
1536
	or	[edi+WDATA.fl_wstate],WSTATE_ROLLEDUP
1516
	call	get_rolledup_height
1537
	call	get_rolledup_height
1517
	jmp	@f
1538
	jmp	@f
1518
  wnd_rolldown:
1539
  wnd_rolldown:
1519
	and	[edi+WDATA.fl_wstate],not WSTATE_ROLLEDUP
1540
	and	[edi+WDATA.fl_wstate],not WSTATE_ROLLEDUP
1520
    mov     eax,[edx + APPDATA.saved_box.height] ; 0x90+BOX.height
1541
    mov     eax,[edx + APPDATA.saved_box.height] ; 0x90+BOX.height
1521
	test	[edi+WDATA.fl_wstate],WSTATE_MAXIMIZED
1542
	test	[edi+WDATA.fl_wstate],WSTATE_MAXIMIZED
1522
	jz	@f
1543
	jz	@f
1523
	mov	eax,[screen_workarea.bottom]
1544
	mov	eax,[screen_workarea.bottom]
1524
	sub	eax,[screen_workarea.top]
1545
	sub	eax,[screen_workarea.top]
1525
    @@: mov	[edi+WDATA.box.height],eax
1546
    @@: mov	[edi+WDATA.box.height],eax
1526
	call	set_window_clientbox
1547
	call	set_window_clientbox
1527
 
1548
 
1528
      no_window_shade:
1549
      no_window_shade:
1529
 
1550
 
1530
	cmp   [do_resize],1		  ; fullscreen/restore ?
1551
	cmp   [do_resize],1		  ; fullscreen/restore ?
1531
	jne   no_fullscreen_restore
1552
	jne   no_fullscreen_restore
1532
	cmp   [latest_window_touch_delta],dword 50
1553
	cmp   [latest_window_touch_delta],dword 50
1533
	jg    no_fullscreen_restore
1554
	jg    no_fullscreen_restore
1534
	mov   [reposition],1
1555
	mov   [reposition],1
1535
	test	[edi+WDATA.fl_wstate],WSTATE_MAXIMIZED
1556
	test	[edi+WDATA.fl_wstate],WSTATE_MAXIMIZED
1536
	jnz	restore_from_fullscreen
1557
	jnz	restore_from_fullscreen
1537
	or	[edi+WDATA.fl_wstate],WSTATE_MAXIMIZED
1558
	or	[edi+WDATA.fl_wstate],WSTATE_MAXIMIZED
1538
	mov	eax,[screen_workarea.left]
1559
	mov	eax,[screen_workarea.left]
1539
	mov	[edi+WDATA.box.left],eax
1560
	mov	[edi+WDATA.box.left],eax
1540
	sub	eax,[screen_workarea.right]
1561
	sub	eax,[screen_workarea.right]
1541
	neg	eax
1562
	neg	eax
1542
	mov	[edi+WDATA.box.width],eax
1563
	mov	[edi+WDATA.box.width],eax
1543
	mov	eax,[screen_workarea.top]
1564
	mov	eax,[screen_workarea.top]
1544
	mov	[edi+WDATA.box.top],eax
1565
	mov	[edi+WDATA.box.top],eax
1545
	test	[edi+WDATA.fl_wstate],WSTATE_ROLLEDUP
1566
	test	[edi+WDATA.fl_wstate],WSTATE_ROLLEDUP
1546
	jnz	@f
1567
	jnz	@f
1547
	sub	eax,[screen_workarea.bottom]
1568
	sub	eax,[screen_workarea.bottom]
1548
	neg	eax
1569
	neg	eax
1549
	mov	[edi+WDATA.box.height],eax
1570
	mov	[edi+WDATA.box.height],eax
1550
    @@:
1571
    @@:
1551
	jmp	restore_from_fullscreen.clientbox
1572
	jmp	restore_from_fullscreen.clientbox
1552
      restore_from_fullscreen:
1573
      restore_from_fullscreen:
1553
	and	[edi+WDATA.fl_wstate],not WSTATE_MAXIMIZED
1574
	and	[edi+WDATA.fl_wstate],not WSTATE_MAXIMIZED
1554
	push	[edi+WDATA.box.height]
1575
	push	[edi+WDATA.box.height]
1555
	push  edi			  ; restore
1576
	push  edi			  ; restore
1556
	lea   esi, [edx + APPDATA.saved_box]
1577
	lea   esi, [edx + APPDATA.saved_box]
1557
	mov   ecx,4
1578
	mov   ecx,4
1558
	cld
1579
	cld
1559
	rep   movsd
1580
	rep   movsd
1560
	pop   edi
1581
	pop   edi
1561
	pop	eax
1582
	pop	eax
1562
	test	[edi+WDATA.fl_wstate],WSTATE_ROLLEDUP
1583
	test	[edi+WDATA.fl_wstate],WSTATE_ROLLEDUP
1563
	jz	@f
1584
	jz	@f
1564
	mov	[edi+WDATA.box.height],eax
1585
	mov	[edi+WDATA.box.height],eax
1565
    @@:
1586
    @@:
1566
    .clientbox:
1587
    .clientbox:
1567
	call	set_window_clientbox
1588
	call	set_window_clientbox
1568
 
1589
 
1569
      no_fullscreen_restore:
1590
      no_fullscreen_restore:
1570
 
1591
 
1571
	mov   eax,[edi+WDATA.box.top]		      ; check Y inside screen
1592
	mov   eax,[edi+WDATA.box.top]		      ; check Y inside screen
1572
	add   eax,[edi+WDATA.box.height]
1593
	add   eax,[edi+WDATA.box.height]
1573
	cmp   eax,[ScreenHeight]
1594
	cmp   eax,[ScreenHeight]
1574
	jbe   no_window_sizing
1595
	jbe   no_window_sizing
1575
	mov   eax,[edi+WDATA.box.left]		       ; check X inside screen
1596
	mov   eax,[edi+WDATA.box.left]		       ; check X inside screen
1576
	add   eax,[edi+WDATA.box.width]
1597
	add   eax,[edi+WDATA.box.width]
1577
	cmp   eax,[ScreenWidth]
1598
	cmp   eax,[ScreenWidth]
1578
	jbe   no_window_sizing
1599
	jbe   no_window_sizing
1579
	mov   eax,[ScreenWidth]
1600
	mov   eax,[ScreenWidth]
1580
	sub   eax,[edi+WDATA.box.width]
1601
	sub   eax,[edi+WDATA.box.width]
1581
	mov   [edi+WDATA.box.left],eax
1602
	mov   [edi+WDATA.box.left],eax
1582
	mov   eax,[ScreenHeight]
1603
	mov   eax,[ScreenHeight]
1583
	sub   eax,[edi+WDATA.box.height]
1604
	sub   eax,[edi+WDATA.box.height]
1584
	mov   [edi+WDATA.box.top],eax
1605
	mov   [edi+WDATA.box.top],eax
1585
	call  set_window_clientbox
1606
	call  set_window_clientbox
1586
      no_window_sizing:
1607
      no_window_sizing:
1587
 
1608
 
1588
	popad
1609
	popad
1589
 
1610
 
1590
	cmp   [reposition],0
1611
	cmp   [reposition],0
1591
	je    retwm
1612
	je    retwm
1592
 
1613
 
1593
	mov   [DONT_DRAW_MOUSE],byte 1 ; no mouse
1614
	mov   [DONT_DRAW_MOUSE],byte 1 ; no mouse
1594
 
1615
 
1595
 
1616
 
1596
	push  eax ebx ecx edx
1617
	push  eax ebx ecx edx
1597
	mov   eax,[edi+WDATA.box.left]
1618
	mov   eax,[edi+WDATA.box.left]
1598
	mov   ebx,[edi+WDATA.box.top]
1619
	mov   ebx,[edi+WDATA.box.top]
1599
	mov   ecx,[edi+WDATA.box.width]
1620
	mov   ecx,[edi+WDATA.box.width]
1600
	mov   edx,[edi+WDATA.box.height]
1621
	mov   edx,[edi+WDATA.box.height]
1601
	add   ecx,eax
1622
	add   ecx,eax
1602
	add   edx,ebx
1623
	add   edx,ebx
1603
	call  calculatescreen
1624
	call  calculatescreen
1604
 
1625
 
1605
	mov   eax,[oldc+BOX.left]
1626
	mov   eax,[oldc+BOX.left]
1606
	mov   ebx,[oldc+BOX.top]
1627
	mov   ebx,[oldc+BOX.top]
1607
	mov   ecx,[oldc+BOX.width]
1628
	mov   ecx,[oldc+BOX.width]
1608
	mov   edx,[oldc+BOX.height]
1629
	mov   edx,[oldc+BOX.height]
1609
	add   ecx,eax
1630
	add   ecx,eax
1610
	add   edx,ebx
1631
	add   edx,ebx
1611
	call  calculatescreen
1632
	call  calculatescreen
1612
	pop   edx ecx ebx eax
1633
	pop   edx ecx ebx eax
1613
 
1634
 
1614
	mov   eax,edi
1635
	mov   eax,edi
1615
	call  redrawscreen
1636
	call  redrawscreen
1616
 
1637
 
1617
 
1638
 
1618
	mov	[edi+WDATA.fl_redraw],1
1639
	mov	[edi+WDATA.fl_redraw],1
1619
 
1640
 
1620
	mov   ecx,100	      ; wait to avoid mouse residuals
1641
	mov   ecx,100	      ; wait to avoid mouse residuals
1621
      waitre2:
1642
      waitre2:
1622
	mov   [DONT_DRAW_MOUSE],byte 1
1643
	mov   [DONT_DRAW_MOUSE],byte 1
1623
	call  checkidle
1644
	call  checkidle
1624
	cmp	[edi+WDATA.fl_redraw],0
1645
	cmp	[edi+WDATA.fl_redraw],0
1625
	jz    retwm
1646
	jz    retwm
1626
	loop  waitre2
1647
	loop  waitre2
1627
 
1648
 
1628
      retwm:
1649
      retwm:
1629
 
1650
 
1630
	mov   [DONT_DRAW_MOUSE],byte 0 ; mouse pointer
1651
	mov   [DONT_DRAW_MOUSE],byte 0 ; mouse pointer
1631
	mov   [MOUSE_BACKGROUND],byte 0 ; no mouse under
1652
	mov   [MOUSE_BACKGROUND],byte 0 ; no mouse under
1632
	mov   [MOUSE_DOWN],byte 0 ; react to mouse up/down
1653
	mov   [MOUSE_DOWN],byte 0 ; react to mouse up/down
1633
 
1654
 
1634
	mov    esi,window_moved
1655
	mov    esi,window_moved
1635
	call   sys_msg_board_str
1656
	call   sys_msg_board_str
1636
 
1657
 
1637
	popad
1658
	popad
1638
 
1659
 
1639
	ret
1660
	ret
1640
 
1661
 
1641
 
1662
 
1642
uglobal
1663
uglobal
1643
  add_window_data	     dd  0
1664
  add_window_data	     dd  0
1644
  do_resize_from_corner      db  0x0
1665
  do_resize_from_corner      db  0x0
1645
  reposition		     db  0x0
1666
  reposition		     db  0x0
1646
  latest_window_touch	     dd  0x0
1667
  latest_window_touch	     dd  0x0
1647
  latest_window_touch_delta  dd  0x0
1668
  latest_window_touch_delta  dd  0x0
1648
 
1669
 
1649
  do_resize db 0x0
1670
  do_resize db 0x0
1650
 
1671
 
1651
  oldc	  dd 0x0,0x0,0x0,0x0
1672
  oldc	  dd 0x0,0x0,0x0,0x0
1652
 
1673
 
1653
  dlx	  dd 0x0
1674
  dlx	  dd 0x0
1654
  dly	  dd 0x0
1675
  dly	  dd 0x0
1655
  dlxe	  dd 0x0
1676
  dlxe	  dd 0x0
1656
  dlye	  dd 0x0
1677
  dlye	  dd 0x0
1657
 
1678
 
1658
  npx	  dd 0x0
1679
  npx	  dd 0x0
1659
  npy	  dd 0x0
1680
  npy	  dd 0x0
1660
  npxe	  dd 0x0
1681
  npxe	  dd 0x0
1661
  npye	  dd 0x0
1682
  npye	  dd 0x0
1662
 
1683
 
1663
  mpx	  dd 0x0
1684
  mpx	  dd 0x0
1664
  mpy	  dd 0x0
1685
  mpy	  dd 0x0
1665
endg
1686
endg
1666
 
1687
 
1667
 
1688
 
1668
; draw negative window frames
1689
; draw negative window frames
1669
drawwindowframes2:
1690
drawwindowframes2:
1670
	pushad
1691
	pushad
1671
	cli
1692
	cli
1672
	jmp	drawwindowframes.do
1693
	jmp	drawwindowframes.do
1673
drawwindowframes:
1694
drawwindowframes:
1674
	pushad
1695
	pushad
1675
	cli
1696
	cli
1676
 
1697
 
1677
	test	[edi+WDATA.fl_wstate],WSTATE_MAXIMIZED
1698
	test	[edi+WDATA.fl_wstate],WSTATE_MAXIMIZED
1678
	jnz	.ret
1699
	jnz	.ret
1679
	mov	eax, [npx]
1700
	mov	eax, [npx]
1680
	cmp	eax, [edi+WDATA.box.left]
1701
	cmp	eax, [edi+WDATA.box.left]
1681
	jnz	.nowndframe
1702
	jnz	.nowndframe
1682
	mov	eax, [npxe]
1703
	mov	eax, [npxe]
1683
	cmp	eax, [edi+WDATA.box.width]
1704
	cmp	eax, [edi+WDATA.box.width]
1684
	jnz	.nowndframe
1705
	jnz	.nowndframe
1685
	mov	eax, [npy]
1706
	mov	eax, [npy]
1686
	cmp	eax, [edi+WDATA.box.top]
1707
	cmp	eax, [edi+WDATA.box.top]
1687
	jnz	.nowndframe
1708
	jnz	.nowndframe
1688
	mov	eax, [npye]
1709
	mov	eax, [npye]
1689
	cmp	eax, [edi+WDATA.box.height]
1710
	cmp	eax, [edi+WDATA.box.height]
1690
	jnz	.nowndframe
1711
	jnz	.nowndframe
1691
	xor	[edi+WDATA.fl_wdrawn], 2
1712
	xor	[edi+WDATA.fl_wdrawn], 2
1692
	test	[edi+WDATA.fl_wdrawn], 4
1713
	test	[edi+WDATA.fl_wdrawn], 4
1693
	jnz	.ret
1714
	jnz	.ret
1694
 
1715
 
1695
.nowndframe:
1716
.nowndframe:
1696
.do:
1717
.do:
1697
	mov	edi, 1
1718
	mov	edi, 1
1698
	mov	ecx, 0x01000000
1719
	mov	ecx, 0x01000000
1699
	mov   eax,[npx]
1720
	mov   eax,[npx]
1700
	shl   eax,16
1721
	shl   eax,16
1701
	add   eax,[npx]
1722
	add   eax,[npx]
1702
	add   eax,[npxe]
1723
	add   eax,[npxe]
1703
	add   eax,65536*1-1
1724
	add   eax,65536*1-1
1704
	mov   ebx,[npy]
1725
	mov   ebx,[npy]
1705
	shl   ebx,16
1726
	shl   ebx,16
1706
	add   ebx,[npy]
1727
	add   ebx,[npy]
1707
	call  [draw_line]
1728
	call  [draw_line]
1708
 
1729
 
1709
	mov   eax,[npx]
1730
	mov   eax,[npx]
1710
	shl   eax,16
1731
	shl   eax,16
1711
	add   eax,[npx]
1732
	add   eax,[npx]
1712
	add   eax,[npxe]
1733
	add   eax,[npxe]
1713
	add   eax,65536*1-1
1734
	add   eax,65536*1-1
1714
	mov   ebx,[npy]
1735
	mov   ebx,[npy]
1715
	add   ebx,[npye]
1736
	add   ebx,[npye]
1716
	shl   ebx,16
1737
	shl   ebx,16
1717
	add   ebx,[npy]
1738
	add   ebx,[npy]
1718
	add   ebx,[npye]
1739
	add   ebx,[npye]
1719
	call  [draw_line]
1740
	call  [draw_line]
1720
 
1741
 
1721
	mov   eax,[npx]
1742
	mov   eax,[npx]
1722
	shl   eax,16
1743
	shl   eax,16
1723
	add   eax,[npx]
1744
	add   eax,[npx]
1724
	mov   ebx,[npy]
1745
	mov   ebx,[npy]
1725
	shl   ebx,16
1746
	shl   ebx,16
1726
	add   ebx,[npy]
1747
	add   ebx,[npy]
1727
	add   ebx,[npye]
1748
	add   ebx,[npye]
1728
	call  [draw_line]
1749
	call  [draw_line]
1729
 
1750
 
1730
	mov   eax,[npx]
1751
	mov   eax,[npx]
1731
	add   eax,[npxe]
1752
	add   eax,[npxe]
1732
	shl   eax,16
1753
	shl   eax,16
1733
	add   eax,[npx]
1754
	add   eax,[npx]
1734
	add   eax,[npxe]
1755
	add   eax,[npxe]
1735
	mov   ebx,[npy]
1756
	mov   ebx,[npy]
1736
	shl   ebx,16
1757
	shl   ebx,16
1737
	add   ebx,[npy]
1758
	add   ebx,[npy]
1738
	add   ebx,[npye]
1759
	add   ebx,[npye]
1739
	call  [draw_line]
1760
	call  [draw_line]
1740
 
1761
 
1741
.ret:
1762
.ret:
1742
	sti
1763
	sti
1743
	popad
1764
	popad
1744
	ret
1765
	ret
1745
 
1766
 
1746
 
1767
 
1747
 
1768
 
1748
random_shaped_window:
1769
random_shaped_window:
1749
 
1770
 
1750
;
1771
;
1751
;  eax = 0    giving address of data area
1772
;  eax = 0    giving address of data area
1752
;      ebx    address
1773
;      ebx    address
1753
;  eax = 1    shape area scale
1774
;  eax = 1    shape area scale
1754
;      ebx    2^ebx scale
1775
;      ebx    2^ebx scale
1755
 
1776
 
1756
     test eax, eax
1777
     test eax, eax
1757
     jne  rsw_no_address
1778
     jne  rsw_no_address
1758
     mov  eax,[current_slot]
1779
     mov  eax,[current_slot]
1759
     mov  [eax+APPDATA.wnd_shape],ebx
1780
     mov  [eax+APPDATA.wnd_shape],ebx
1760
rsw_no_address:
1781
rsw_no_address:
1761
 
1782
 
1762
     cmp  eax,1
1783
     cmp  eax,1
1763
     jne  rsw_no_scale
1784
     jne  rsw_no_scale
1764
     mov  eax,[current_slot]
1785
     mov  eax,[current_slot]
1765
     mov  byte [eax+APPDATA.wnd_shape_scale], bl
1786
     mov  byte [eax+APPDATA.wnd_shape_scale], bl
1766
rsw_no_scale:
1787
rsw_no_scale:
1767
 
1788
 
1768
     ret
1789
     ret