Subversion Repositories Kolibri OS

Rev

Rev 2430 | Rev 2443 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2430 Rev 2436
Line 4... Line 4...
4
;; Copyright (C) MenuetOS 2000-2004 Ville Mikael Turjanmaa      ;;
4
;; Copyright (C) MenuetOS 2000-2004 Ville Mikael Turjanmaa      ;;
5
;; Distributed under terms of the GNU General Public License    ;;
5
;; Distributed under terms of the GNU General Public License    ;;
6
;;                                                              ;;
6
;;                                                              ;;
7
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
7
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Line 8... Line 8...
8
 
8
 
Line 9... Line 9...
9
$Revision: 2430 $
9
$Revision: 2436 $
10
 
10
 
11
;==============================================================================
11
;==============================================================================
Line 50... Line 50...
50
        jnz     @f
50
        jnz     @f
Line 51... Line 51...
51
 
51
 
52
        ; type I - original style
52
        ; type I - original style
53
        call    drawwindow_I
53
        call    drawwindow_I
-
 
54
        jmp     window._.draw_window_caption.2
54
        jmp     window._.draw_window_caption.2
55
;--------------------------------------
55
 
56
align 4
56
    @@:
57
@@:
57
        dec     al
58
        dec     al
Line 58... Line 59...
58
        jnz     @f
59
        jnz     @f
59
 
60
 
60
        ; type II - only reserve area, no draw
61
        ; type II - only reserve area, no draw
61
        call    sys_window_mouse
62
;        call    sys_window_mouse
-
 
63
        call    [draw_pointer]
62
        call    [draw_pointer]
64
        jmp     .exit
63
        jmp     .exit
65
;--------------------------------------
64
 
66
align 4
65
    @@:
67
@@:
Line 66... Line 68...
66
        dec     al
68
        dec     al
67
        jnz     @f
69
        jnz     @f
68
 
70
 
Line 69... Line 71...
69
        ; type III  - new style
71
        ; type III  - new style
-
 
72
        call    drawwindow_III
-
 
73
        jmp     window._.draw_window_caption.2
70
        call    drawwindow_III
74
 
71
        jmp     window._.draw_window_caption.2
75
        ; type IV & V - skinned window (resizable & not)
72
 
76
;--------------------------------------
73
        ; type IV & V - skinned window (resizable & not)
77
align 4
74
    @@:
78
@@:
75
        mov     eax, [TASK_COUNT]
79
        mov     eax, [TASK_COUNT]
76
        movzx   eax, word[WIN_POS + eax * 2]
80
        movzx   eax, word[WIN_POS + eax * 2]
77
        cmp     eax, [CURRENT_TASK]
81
        cmp     eax, [CURRENT_TASK]
78
        setz    al
82
        setz    al
-
 
83
        movzx   eax, al
79
        movzx   eax, al
84
        push    eax
80
        push    eax
85
        call    drawwindow_IV
81
        call    drawwindow_IV
86
        jmp     window._.draw_window_caption.2
82
        jmp     window._.draw_window_caption.2
-
 
-
 
87
;--------------------------------------
83
 
88
align 4
84
  .exit:
89
.exit:
85
        ret
90
        ret
86
 
91
;------------------------------------------------------------------------------
87
align 4
92
align 4
Line 130... Line 135...
130
;> eax = FS error code
135
;> eax = FS error code
131
;------------------------------------------------------------------------------
136
;------------------------------------------------------------------------------
132
        cmp     ebx, .sizeof.ftable / 4
137
        cmp     ebx, .sizeof.ftable / 4
133
        ja      @f
138
        ja      @f
134
        jmp     [.ftable + ebx * 4]
139
        jmp     [.ftable + ebx * 4]
-
 
140
;--------------------------------------
-
 
141
align 4
135
    @@:
142
@@:
136
        ret
143
        ret
137
 
-
 
138
 
-
 
-
 
144
;------------------------------------------------------------------------------
139
align 4
145
align 4
140
syscall_display_settings.00:
146
syscall_display_settings.00:
141
        xor     eax, eax
147
        xor     eax, eax
142
        inc     ebx
148
        inc     ebx
143
        cmp     [windowtypechanged], ebx
149
        cmp     [windowtypechanged], ebx
144
        jne     .exit
150
        jne     .exit
145
        mov     [windowtypechanged], eax
151
        mov     [windowtypechanged], eax
Line 146... Line 152...
146
 
152
 
-
 
153
        jmp     syscall_display_settings._.redraw_whole_screen
147
        jmp     syscall_display_settings._.redraw_whole_screen
154
;--------------------------------------
148
 
155
align 4
149
  .exit:
156
.exit:
150
        ret
-
 
-
 
157
        ret
151
 
158
;------------------------------------------------------------------------------
152
align 4
159
align 4
153
syscall_display_settings.01:
160
syscall_display_settings.01:
154
        and     ecx, 1
161
        and     ecx, 1
155
        cmp     ecx, [buttontype]
162
        cmp     ecx, [buttontype]
156
        je      .exit
163
        je      .exit
157
        mov     [buttontype], ecx
164
        mov     [buttontype], ecx
-
 
165
        mov     [windowtypechanged], ebx
158
        mov     [windowtypechanged], ebx
166
;--------------------------------------
159
 
167
align 4
160
  .exit:
168
  .exit:
161
        ret
-
 
-
 
169
        ret
162
 
170
;------------------------------------------------------------------------------
163
align 4
171
align 4
164
syscall_display_settings.02:
172
syscall_display_settings.02:
165
        dec     ebx
173
        dec     ebx
166
        mov     esi, ecx
174
        mov     esi, ecx
167
        and     edx, 127
175
        and     edx, 127
168
        mov     edi, common_colours
176
        mov     edi, common_colours
169
        mov     ecx, edx
177
        mov     ecx, edx
170
        rep movsb
178
        rep movsb
171
        mov     [windowtypechanged], ebx
179
        mov     [windowtypechanged], ebx
172
        ret
-
 
-
 
180
        ret
173
 
181
;------------------------------------------------------------------------------
174
align 4
182
align 4
175
syscall_display_settings.03:
183
syscall_display_settings.03:
176
        mov     edi, ecx
184
        mov     edi, ecx
177
        and     edx, 127
185
        and     edx, 127
178
        mov     esi, common_colours
186
        mov     esi, common_colours
179
        mov     ecx, edx
187
        mov     ecx, edx
180
        rep movsb
188
        rep movsb
181
        ret
-
 
-
 
189
        ret
182
 
190
;------------------------------------------------------------------------------
183
align 4
191
align 4
184
syscall_display_settings.04:
192
syscall_display_settings.04:
185
        mov     eax, [_skinh]
193
        mov     eax, [_skinh]
186
        mov     [esp + 32], eax
194
        mov     [esp + 32], eax
187
        ret
-
 
-
 
195
        ret
188
 
196
;------------------------------------------------------------------------------
189
align 4
197
align 4
190
syscall_display_settings.05:
198
syscall_display_settings.05:
191
        mov     eax, [screen_workarea.left - 2]
199
        mov     eax, [screen_workarea.left - 2]
192
        mov     ax, word[screen_workarea.right]
200
        mov     ax, word[screen_workarea.right]
193
        mov     [esp + 32], eax
201
        mov     [esp + 32], eax
194
        mov     eax, [screen_workarea.top - 2]
202
        mov     eax, [screen_workarea.top - 2]
195
        mov     ax, word[screen_workarea.bottom]
203
        mov     ax, word[screen_workarea.bottom]
196
        mov     [esp + 20], eax
204
        mov     [esp + 20], eax
197
        ret
-
 
-
 
205
        ret
198
 
206
;------------------------------------------------------------------------------
199
align 4
207
align 4
200
syscall_display_settings.06:
208
syscall_display_settings.06:
Line 201... Line 209...
201
        xor     esi, esi
209
        xor     esi, esi
Line 208... Line 216...
208
        jge     .check_horizontal
216
        jge     .check_horizontal
209
        inc     esi
217
        inc     esi
210
        or      eax, eax
218
        or      eax, eax
211
        jge     @f
219
        jge     @f
212
        xor     eax, eax
220
        xor     eax, eax
-
 
221
;--------------------------------------
-
 
222
align 4
213
    @@:
223
@@:
214
        mov     [screen_workarea.left], eax
224
        mov     [screen_workarea.left], eax
215
        cmp     ebx, edi
225
        cmp     ebx, edi
216
        jle     @f
226
        jle     @f
217
        mov     ebx, edi
227
        mov     ebx, edi
-
 
228
;--------------------------------------
-
 
229
align 4
218
    @@:
230
@@:
219
        mov     [screen_workarea.right], ebx
231
        mov     [screen_workarea.right], ebx
-
 
232
;--------------------------------------
220
 
233
align 4
221
  .check_horizontal:
234
.check_horizontal:
222
        mov     edi, [Screen_Max_Y]
235
        mov     edi, [Screen_Max_Y]
223
        mov     eax, edx
236
        mov     eax, edx
224
        movsx   ebx, ax
237
        movsx   ebx, ax
225
        sar     eax, 16
238
        sar     eax, 16
Line 227... Line 240...
227
        jge     .check_if_redraw_needed
240
        jge     .check_if_redraw_needed
228
        inc     esi
241
        inc     esi
229
        or      eax, eax
242
        or      eax, eax
230
        jge     @f
243
        jge     @f
231
        xor     eax, eax
244
        xor     eax, eax
-
 
245
;--------------------------------------
-
 
246
align 4
232
    @@:
247
@@:
233
        mov     [screen_workarea.top], eax
248
        mov     [screen_workarea.top], eax
234
        cmp     ebx, edi
249
        cmp     ebx, edi
235
        jle     @f
250
        jle     @f
236
        mov     ebx, edi
251
        mov     ebx, edi
-
 
252
;--------------------------------------
-
 
253
align 4
237
    @@:
254
@@:
238
        mov     [screen_workarea.bottom], ebx
255
        mov     [screen_workarea.bottom], ebx
-
 
256
;--------------------------------------
239
 
257
align 4
240
  .check_if_redraw_needed:
258
.check_if_redraw_needed:
241
        or      esi, esi
259
        or      esi, esi
242
        jz      .exit
260
        jz      .exit
Line 243... Line 261...
243
 
261
 
244
        call    repos_windows
262
        call    repos_windows
-
 
263
        jmp     syscall_display_settings._.calculate_whole_screen
245
        jmp     syscall_display_settings._.calculate_whole_screen
264
;--------------------------------------
246
 
265
align 4
247
  .exit:
266
.exit:
248
        ret
-
 
-
 
267
        ret
249
 
268
;------------------------------------------------------------------------------
250
align 4
269
align 4
251
syscall_display_settings.07:
270
syscall_display_settings.07:
252
        mov     eax, [_skinmargins + 0]
271
        mov     eax, [_skinmargins + 0]
253
        mov     [esp + 32], eax
272
        mov     [esp + 32], eax
254
        mov     eax, [_skinmargins + 4]
273
        mov     eax, [_skinmargins + 4]
255
        mov     [esp + 20], eax
274
        mov     [esp + 20], eax
256
        ret
-
 
-
 
275
        ret
257
 
276
;------------------------------------------------------------------------------
258
align 4
277
align 4
259
syscall_display_settings.08:
278
syscall_display_settings.08:
260
        mov     ebx, ecx
279
        mov     ebx, ecx
261
        call    read_skin_file
280
        call    read_skin_file
262
        mov     [esp + 32], eax
281
        mov     [esp + 32], eax
263
        test    eax, eax
282
        test    eax, eax
Line 264... Line 283...
264
        jnz     .exit
283
        jnz     .exit
265
 
284
 
-
 
285
        call    syscall_display_settings._.calculate_whole_screen
266
        call    syscall_display_settings._.calculate_whole_screen
286
        jmp     syscall_display_settings._.redraw_whole_screen
267
        jmp     syscall_display_settings._.redraw_whole_screen
287
;--------------------------------------
268
 
288
align 4
-
 
289
.exit:
269
  .exit:
290
        ret
270
        ret
291
;------------------------------------------------------------------------------
271
 
292
align 4
272
syscall_display_settings._.calculate_whole_screen:
293
syscall_display_settings._.calculate_whole_screen:
273
        xor     eax, eax
294
        xor     eax, eax
274
        xor     ebx, ebx
295
        xor     ebx, ebx
275
        mov     ecx, [Screen_Max_X]
296
        mov     ecx, [Screen_Max_X]
-
 
297
        mov     edx, [Screen_Max_Y]
276
        mov     edx, [Screen_Max_Y]
298
        jmp     calculatescreen
277
        jmp     calculatescreen
299
;------------------------------------------------------------------------------
278
 
300
align 4
279
syscall_display_settings._.redraw_whole_screen:
301
syscall_display_settings._.redraw_whole_screen:
280
        xor     eax, eax
302
        xor     eax, eax
281
        mov     [draw_limits.left], eax
303
        mov     [draw_limits.left], eax
282
        mov     [draw_limits.top], eax
304
        mov     [draw_limits.top], eax
283
        mov     eax, [Screen_Max_X]
305
        mov     eax, [Screen_Max_X]
284
        mov     [draw_limits.right], eax
306
        mov     [draw_limits.right], eax
285
        mov     eax, [Screen_Max_Y]
307
        mov     eax, [Screen_Max_Y]
286
        mov     [draw_limits.bottom], eax
308
        mov     [draw_limits.bottom], eax
287
        mov     eax, window_data
-
 
-
 
309
        mov     eax, window_data
288
        jmp     redrawscreen
310
        jmp     redrawscreen
289
 
311
;------------------------------------------------------------------------------
290
align 4
312
align 4
291
;------------------------------------------------------------------------------
313
;------------------------------------------------------------------------------
292
syscall_set_window_shape: ;///// system function 50 ///////////////////////////
314
syscall_set_window_shape: ;///// system function 50 ///////////////////////////
Line 302... Line 324...
302
        mov     edi, [current_slot]
324
        mov     edi, [current_slot]
Line 303... Line 325...
303
 
325
 
304
        test    ebx, ebx
326
        test    ebx, ebx
305
        jne     .shape_scale
327
        jne     .shape_scale
-
 
328
        mov     [edi + APPDATA.wnd_shape], ecx
306
        mov     [edi + APPDATA.wnd_shape], ecx
329
;--------------------------------------
307
 
330
align 4
308
  .shape_scale:
331
.shape_scale:
309
        dec     ebx
332
        dec     ebx
310
        jnz     .exit
333
        jnz     .exit
-
 
334
        mov     [edi + APPDATA.wnd_shape_scale], ecx
311
        mov     [edi + APPDATA.wnd_shape_scale], ecx
335
;--------------------------------------
312
 
336
align 4
313
  .exit:
337
.exit:
314
        ret
-
 
-
 
338
        ret
315
 
339
;------------------------------------------------------------------------------
316
align 4
340
align 4
317
;------------------------------------------------------------------------------
341
;------------------------------------------------------------------------------
318
syscall_move_window: ;///// system function 67 ////////////////////////////////
342
syscall_move_window: ;///// system function 67 ////////////////////////////////
319
;------------------------------------------------------------------------------
343
;------------------------------------------------------------------------------
Line 330... Line 354...
330
        jnz     .exit
354
        jnz     .exit
Line 331... Line 355...
331
 
355
 
332
        cmp     ebx, -1
356
        cmp     ebx, -1
333
        jne     @f
357
        jne     @f
-
 
358
        mov     ebx, [edi + WDATA.box.left]
-
 
359
;--------------------------------------
334
        mov     ebx, [edi + WDATA.box.left]
360
align 4
335
    @@:
361
@@:
336
        cmp     ecx, -1
362
        cmp     ecx, -1
337
        jne     @f
363
        jne     @f
-
 
364
        mov     ecx, [edi + WDATA.box.top]
-
 
365
;--------------------------------------
338
        mov     ecx, [edi + WDATA.box.top]
366
align 4
339
    @@:
367
@@:
340
        cmp     edx, -1
368
        cmp     edx, -1
341
        jne     @f
369
        jne     @f
-
 
370
        mov     edx, [edi + WDATA.box.width]
-
 
371
;--------------------------------------
342
        mov     edx, [edi + WDATA.box.width]
372
align 4
343
    @@:
373
@@:
344
        cmp     esi, -1
374
        cmp     esi, -1
345
        jne     @f
375
        jne     @f
-
 
376
        mov     esi, [edi + WDATA.box.height]
346
        mov     esi, [edi + WDATA.box.height]
377
;--------------------------------------
347
 
378
align 4
348
    @@:
379
@@:
349
        push    esi edx ecx ebx
380
        push    esi edx ecx ebx
350
        mov     eax, esp
381
        mov     eax, esp
351
        mov     bl, [edi + WDATA.fl_wstate]
382
        mov     bl, [edi + WDATA.fl_wstate]
Line 357... Line 388...
357
;       mov     byte[MOUSE_BACKGROUND], 0 ; no mouse under
388
;       mov     byte[MOUSE_BACKGROUND], 0 ; no mouse under
358
;       mov     byte[MOUSE_DOWN], 0 ; react to mouse up/down
389
;       mov     byte[MOUSE_DOWN], 0 ; react to mouse up/down
Line 359... Line 390...
359
 
390
 
360
        ; NOTE: do we really need this? to be reworked
391
        ; NOTE: do we really need this? to be reworked
-
 
392
;       call    [draw_pointer]
361
;       call    [draw_pointer]
393
;--------------------------------------
362
 
394
align 4
363
  .exit:
395
.exit:
364
        ret
-
 
-
 
396
        ret
365
 
397
;------------------------------------------------------------------------------
366
align 4
398
align 4
367
;------------------------------------------------------------------------------
399
;------------------------------------------------------------------------------
368
syscall_window_settings: ;///// system function 71 /////////////////////////////
400
syscall_window_settings: ;///// system function 71 /////////////////////////////
369
;------------------------------------------------------------------------------
401
;------------------------------------------------------------------------------
Line 389... Line 421...
389
;  .get_window_caption:
421
;  .get_window_caption:
390
;        dec     eax     ; subfunction #2 - get window caption
422
;        dec     eax     ; subfunction #2 - get window caption
391
;        jnz     .exit_fail
423
;        jnz     .exit_fail
Line 392... Line 424...
392
 
424
 
-
 
425
        ; not implemented yet
393
        ; not implemented yet
426
;--------------------------------------
394
 
427
align 4
395
  .exit_fail:
428
.exit_fail:
396
        xor     eax, eax
429
        xor     eax, eax
397
        inc     eax     ; eax = 1 (fail)
430
        inc     eax     ; eax = 1 (fail)
398
        ret
-
 
-
 
431
        ret
399
 
432
;------------------------------------------------------------------------------
400
align 4
433
align 4
401
;------------------------------------------------------------------------------
434
;------------------------------------------------------------------------------
402
set_window_defaults: ;/////////////////////////////////////////////////////////
435
set_window_defaults: ;/////////////////////////////////////////////////////////
403
;------------------------------------------------------------------------------
436
;------------------------------------------------------------------------------
404
;? 
437
;? 
405
;------------------------------------------------------------------------------
438
;------------------------------------------------------------------------------
406
        mov     byte [window_data + 0x20 + WDATA.cl_titlebar + 3], 1 ; desktop is not movable
439
        mov     byte [window_data + 0x20 + WDATA.cl_titlebar + 3], 1 ; desktop is not movable
407
        push    eax ecx
440
        push    eax ecx
408
        xor     eax, eax
441
        xor     eax, eax
-
 
442
        mov     ecx, WIN_STACK
-
 
443
;--------------------------------------
409
        mov     ecx, WIN_STACK
444
align 4
410
    @@:
445
@@:
411
        inc     eax
446
        inc     eax
412
        add     ecx, 2
447
        add     ecx, 2
413
        ; process no
448
        ; process no
Line 416... Line 451...
416
        mov     [ecx + 0x400], ax
451
        mov     [ecx + 0x400], ax
417
        cmp     ecx, WIN_POS - 2
452
        cmp     ecx, WIN_POS - 2
418
        jne     @b
453
        jne     @b
419
        pop     ecx eax
454
        pop     ecx eax
420
        ret
455
        ret
421
 
-
 
-
 
456
;------------------------------------------------------------------------------
422
align 4
457
align 4
423
;------------------------------------------------------------------------------
458
;------------------------------------------------------------------------------
424
calculatescreen: ;/////////////////////////////////////////////////////////////
459
calculatescreen: ;/////////////////////////////////////////////////////////////
425
;------------------------------------------------------------------------------
460
;------------------------------------------------------------------------------
426
;? Scan all windows from bottom to top, calling `setscreen` for each one
461
;? Scan all windows from bottom to top, calling `setscreen` for each one
Line 443... Line 478...
443
        mov     ebp, [TASK_COUNT]
478
        mov     ebp, [TASK_COUNT]
444
        cmp     ebp, 1
479
        cmp     ebp, 1
445
        jbe     .exit
480
        jbe     .exit
Line 446... Line 481...
446
 
481
 
-
 
482
        push    edx ecx ebx eax
447
        push    edx ecx ebx eax
483
;--------------------------------------
448
 
484
align 4
449
  .next_window:
485
.next_window:
450
        movzx   edi, word[WIN_POS + esi * 2]
486
        movzx   edi, word[WIN_POS + esi * 2]
Line 451... Line 487...
451
        shl     edi, 5
487
        shl     edi, 5
Line 473... Line 509...
473
        jl      .skip_window
509
        jl      .skip_window
Line 474... Line 510...
474
 
510
 
475
        cmp     eax, [esp + RECT.left]
511
        cmp     eax, [esp + RECT.left]
476
        jae     @f
512
        jae     @f
-
 
513
        mov     eax, [esp + RECT.left]
-
 
514
;--------------------------------------
477
        mov     eax, [esp + RECT.left]
515
align 4
478
    @@:
516
@@:
479
        cmp     ebx, [esp + RECT.top]
517
        cmp     ebx, [esp + RECT.top]
480
        jae     @f
518
        jae     @f
-
 
519
        mov     ebx, [esp + RECT.top]
-
 
520
;--------------------------------------
481
        mov     ebx, [esp + RECT.top]
521
align 4
482
    @@:
522
@@:
483
        cmp     ecx, [esp + RECT.right]
523
        cmp     ecx, [esp + RECT.right]
484
        jbe     @f
524
        jbe     @f
-
 
525
        mov     ecx, [esp + RECT.right]
-
 
526
;--------------------------------------
485
        mov     ecx, [esp + RECT.right]
527
align 4
486
    @@:
528
@@:
487
        cmp     edx, [esp + RECT.bottom]
529
        cmp     edx, [esp + RECT.bottom]
488
        jbe     @f
530
        jbe     @f
-
 
531
        mov     edx, [esp + RECT.bottom]
489
        mov     edx, [esp + RECT.bottom]
532
;--------------------------------------
490
 
533
align 4
491
    @@:
534
@@:
492
        push    esi
535
        push    esi
493
        movzx   esi, word[WIN_POS + esi * 2]
536
        movzx   esi, word[WIN_POS + esi * 2]
494
        call    window._.set_screen
537
        call    window._.set_screen
-
 
538
        pop     esi
495
        pop     esi
539
;--------------------------------------
496
 
540
align 4
497
  .skip_window:
541
.skip_window:
498
        inc     esi
542
        inc     esi
499
        dec     ebp
543
        dec     ebp
Line 500... Line 544...
500
        jnz     .next_window
544
        jnz     .next_window
-
 
545
 
501
 
546
        pop     eax ebx ecx edx
502
        pop     eax ebx ecx edx
547
;--------------------------------------
503
 
548
align 4
504
  .exit:
549
.exit:
505
        pop     ebp
550
        pop     ebp
506
        popfd
551
        popfd
507
        pop     esi
-
 
-
 
552
        pop     esi
508
        ret
553
        ret
509
 
554
;------------------------------------------------------------------------------
510
align 4
555
align 4
511
;------------------------------------------------------------------------------
556
;------------------------------------------------------------------------------
512
repos_windows: ;///////////////////////////////////////////////////////////////
557
repos_windows: ;///////////////////////////////////////////////////////////////
Line 516... Line 561...
516
        mov     ecx, [TASK_COUNT]
561
        mov     ecx, [TASK_COUNT]
517
        mov     edi, window_data + sizeof.WDATA * 2
562
        mov     edi, window_data + sizeof.WDATA * 2
518
        call    force_redraw_background
563
        call    force_redraw_background
519
        dec     ecx
564
        dec     ecx
520
        jle     .exit
565
        jle     .exit
-
 
566
;--------------------------------------
521
 
567
align 4
522
  .next_window:
568
.next_window:
523
        mov     [edi + WDATA.fl_redraw], 1
569
        mov     [edi + WDATA.fl_redraw], 1
524
        test    [edi + WDATA.fl_wstate], WSTATE_MAXIMIZED
570
        test    [edi + WDATA.fl_wstate], WSTATE_MAXIMIZED
525
        jnz     .fix_maximized
571
        jnz     .fix_maximized
Line 531... Line 577...
531
        jle     .fix_vertical
577
        jle     .fix_vertical
532
        mov     eax, [edi + WDATA.box.width]
578
        mov     eax, [edi + WDATA.box.width]
533
        sub     eax, ebx
579
        sub     eax, ebx
534
        jle     @f
580
        jle     @f
535
        mov     [edi + WDATA.box.width], ebx
581
        mov     [edi + WDATA.box.width], ebx
-
 
582
;--------------------------------------
-
 
583
align 4
536
    @@:
584
@@:
537
        sub     ebx, [edi + WDATA.box.width]
585
        sub     ebx, [edi + WDATA.box.width]
538
        mov     [edi + WDATA.box.left], ebx
586
        mov     [edi + WDATA.box.left], ebx
-
 
587
;--------------------------------------
539
 
588
align 4
540
  .fix_vertical:
589
.fix_vertical:
541
        mov     eax, [edi + WDATA.box.top]
590
        mov     eax, [edi + WDATA.box.top]
542
        add     eax, [edi + WDATA.box.height]
591
        add     eax, [edi + WDATA.box.height]
543
        mov     ebx, [Screen_Max_Y]
592
        mov     ebx, [Screen_Max_Y]
544
        cmp     eax, ebx
593
        cmp     eax, ebx
545
        jle     .fix_client_box
594
        jle     .fix_client_box
546
        mov     eax, [edi + WDATA.box.height]
595
        mov     eax, [edi + WDATA.box.height]
547
        sub     eax, ebx
596
        sub     eax, ebx
548
        jle     @f
597
        jle     @f
549
        mov     [edi + WDATA.box.height], ebx
598
        mov     [edi + WDATA.box.height], ebx
-
 
599
;--------------------------------------
-
 
600
align 4
550
    @@:
601
@@:
551
        sub     ebx, [edi + WDATA.box.height]
602
        sub     ebx, [edi + WDATA.box.height]
552
        mov     [edi + WDATA.box.top], ebx
603
        mov     [edi + WDATA.box.top], ebx
-
 
604
;--------------------------------------
-
 
605
align 4
-
 
606
.fix_client_box:
-
 
607
        call    window._.set_window_clientbox
-
 
608
        add     edi, sizeof.WDATA
553
        jmp     .fix_client_box
609
        loop    .next_window
-
 
610
;--------------------------------------
-
 
611
align 4
554
 
612
.exit:
-
 
613
        ret
-
 
614
;--------------------------------------
-
 
615
align 4
555
  .fix_maximized:
616
.fix_maximized:
556
        mov     eax, [screen_workarea.left]
617
        mov     eax, [screen_workarea.left]
557
        mov     [edi + WDATA.box.left], eax
618
        mov     [edi + WDATA.box.left], eax
558
        sub     eax, [screen_workarea.right]
619
        sub     eax, [screen_workarea.right]
559
        neg     eax
620
        neg     eax
Line 563... Line 624...
563
        test    [edi + WDATA.fl_wstate], WSTATE_ROLLEDUP
624
        test    [edi + WDATA.fl_wstate], WSTATE_ROLLEDUP
564
        jnz     .fix_client_box
625
        jnz     .fix_client_box
565
        sub     eax, [screen_workarea.bottom]
626
        sub     eax, [screen_workarea.bottom]
566
        neg     eax
627
        neg     eax
567
        mov     [edi + WDATA.box.height], eax
628
        mov     [edi + WDATA.box.height], eax
568
 
-
 
569
  .fix_client_box:
-
 
570
        call    window._.set_window_clientbox
-
 
571
 
-
 
572
        add     edi, sizeof.WDATA
-
 
573
        loop    .next_window
629
        jmp     .fix_client_box
574
 
-
 
575
  .exit:
-
 
576
        ret
-
 
577
 
-
 
578
align 4
-
 
579
;------------------------------------------------------------------------------
630
;------------------------------------------------------------------------------
-
 
631
;align 4
-
 
632
;------------------------------------------------------------------------------
580
sys_window_mouse: ;////////////////////////////////////////////////////////////
633
;sys_window_mouse: ;////////////////////////////////////////////////////////////
581
;------------------------------------------------------------------------------
634
;------------------------------------------------------------------------------
582
;? 
635
;? 
583
;------------------------------------------------------------------------------
636
;------------------------------------------------------------------------------
584
        ; NOTE: commented out since doesn't provide necessary functionality
637
        ; NOTE: commented out since doesn't provide necessary functionality
585
        ;       anyway, to be reworked
638
        ;       anyway, to be reworked
Line 594... Line 647...
594
;
647
;
595
;       mov     [new_window_starting], eax
648
;       mov     [new_window_starting], eax
596
;
649
;
597
; .exit:
650
; .exit:
598
;       pop     eax
651
;       pop     eax
599
        ret
652
;        ret
600
 
-
 
-
 
653
;------------------------------------------------------------------------------
601
align 4
654
align 4
602
;------------------------------------------------------------------------------
655
;------------------------------------------------------------------------------
603
draw_rectangle: ;//////////////////////////////////////////////////////////////
656
draw_rectangle: ;//////////////////////////////////////////////////////////////
604
;------------------------------------------------------------------------------
657
;------------------------------------------------------------------------------
605
;> eax = pack[16(left), 16(right)]
658
;> eax = pack[16(left), 16(right)]
Line 610... Line 663...
610
;                      ;           for example drawwindow_III and drawwindow_IV
663
;                      ;           for example drawwindow_III and drawwindow_IV
611
;------------------------------------------------------------------------------
664
;------------------------------------------------------------------------------
612
        push    eax ebx ecx edi
665
        push    eax ebx ecx edi
Line 613... Line 666...
613
 
666
 
-
 
667
        xor     edi, edi
614
        xor     edi, edi
668
;--------------------------------------
615
 
669
align 4
616
  .flags_set:
670
.flags_set:
Line 617... Line 671...
617
        push    ebx
671
        push    ebx
618
 
672
 
619
        ; set line color
-
 
620
        mov     ecx, esi
673
        ; set line color
621
;        sub     esi, 1 shl 25
674
        mov     ecx, esi
622
        ; draw top border
675
        ; draw top border
623
        rol     ebx, 16
676
        rol     ebx, 16
624
        push    ebx
677
        push    ebx
625
        rol     ebx, 16
678
        rol     ebx, 16
626
        pop     bx
679
        pop     bx
627
        test    ecx, 1 shl 25
680
        test    ecx, 1 shl 25
628
        jnz     @f
681
        jnz     @f
-
 
682
        sub     ecx, 1 shl 25
-
 
683
        call    [draw_line]
629
        sub     ecx, 1 shl 25
684
;--------------------------------------
630
        call    [draw_line]
685
align 4
631
@@:
686
@@:
632
        ; draw bottom border
687
        ; draw bottom border
633
        mov     ebx, [esp - 2]
688
        mov     ebx, [esp - 2]
Line 649... Line 704...
649
        pop     ax
704
        pop     ax
650
        call    [draw_line]
705
        call    [draw_line]
Line 651... Line 706...
651
 
706
 
652
        pop     edi ecx ebx eax
707
        pop     edi ecx ebx eax
-
 
708
        ret
653
        ret
709
;--------------------------------------
654
 
710
align 4
655
  .forced:
711
.forced:
656
        push    eax ebx ecx edi
712
        push    eax ebx ecx edi
657
        xor     edi, edi
713
        xor     edi, edi
658
        inc     edi
714
        inc     edi
659
        jmp     .flags_set
-
 
-
 
715
        jmp     .flags_set
660
 
716
;------------------------------------------------------------------------------
661
align 4
717
align 4
662
;------------------------------------------------------------------------------
718
;------------------------------------------------------------------------------
663
drawwindow_I_caption: ;////////////////////////////////////////////////////////
719
drawwindow_I_caption: ;////////////////////////////////////////////////////////
664
;------------------------------------------------------------------------------
720
;------------------------------------------------------------------------------
Line 674... Line 730...
674
        add     eax, [esi + WDATA.box.height]
730
        add     eax, [esi + WDATA.box.height]
Line 675... Line 731...
675
 
731
 
676
        cmp     ebx, eax
732
        cmp     ebx, eax
677
        jbe     @f
733
        jbe     @f
-
 
734
        mov     ebx, eax
-
 
735
;--------------------------------------
678
        mov     ebx, eax
736
align 4
679
    @@:
737
@@:
Line 680... Line 738...
680
        push    ebx
738
        push    ebx
-
 
739
 
681
 
740
        xor     edi, edi
682
        xor     edi, edi
741
;--------------------------------------
683
 
742
align 4
684
  .next_line:
743
.next_line:
685
        mov     ebx, edx
744
        mov     ebx, edx
686
        shl     ebx, 16
745
        shl     ebx, 16
Line 694... Line 753...
694
        mov     ecx, [esi + WDATA.cl_titlebar]
753
        mov     ecx, [esi + WDATA.cl_titlebar]
695
        test    ecx, 0x80000000
754
        test    ecx, 0x80000000
696
        jz      @f
755
        jz      @f
697
        sub     ecx, 0x00040404
756
        sub     ecx, 0x00040404
698
        mov     [esi + WDATA.cl_titlebar], ecx
757
        mov     [esi + WDATA.cl_titlebar], ecx
-
 
758
;--------------------------------------
-
 
759
align 4
699
    @@:
760
@@:
700
        and     ecx, 0x00ffffff
761
        and     ecx, 0x00ffffff
701
        call    [draw_line]
762
        call    [draw_line]
702
        inc     edx
763
        inc     edx
703
        cmp     edx, [esp]
764
        cmp     edx, [esp]
704
        jb      .next_line
765
        jb      .next_line
Line 705... Line 766...
705
 
766
 
706
        add     esp, 4
767
        add     esp, 4
707
        pop     [esi + WDATA.cl_titlebar]
768
        pop     [esi + WDATA.cl_titlebar]
708
        ret
-
 
-
 
769
        ret
709
 
770
;------------------------------------------------------------------------------
710
align 4
771
align 4
711
;------------------------------------------------------------------------------
772
;------------------------------------------------------------------------------
712
drawwindow_I: ;////////////////////////////////////////////////////////////////
773
drawwindow_I: ;////////////////////////////////////////////////////////////////
713
;------------------------------------------------------------------------------
774
;------------------------------------------------------------------------------
Line 750... Line 811...
750
        mov     eax, 1
811
        mov     eax, 1
751
        mov     ebx, 21
812
        mov     ebx, 21
752
        mov     ecx, [esi + WDATA.box.width]
813
        mov     ecx, [esi + WDATA.box.width]
753
        mov     edx, [esi + WDATA.box.height]
814
        mov     edx, [esi + WDATA.box.height]
754
        call    [drawbar]
815
        call    [drawbar]
-
 
816
;--------------------------------------
755
 
817
align 4
756
  .exit:
818
.exit:
757
        popad
819
        popad
758
        ret
820
        ret
759
 
-
 
-
 
821
;------------------------------------------------------------------------------
760
align 4
822
align 4
761
;------------------------------------------------------------------------------
823
;------------------------------------------------------------------------------
762
drawwindow_III_caption: ;/////////////////////////////////////////////////////
824
drawwindow_III_caption: ;/////////////////////////////////////////////////////
763
;------------------------------------------------------------------------------
825
;------------------------------------------------------------------------------
764
;? 
826
;? 
Line 774... Line 836...
774
        add     eax, [esi + WDATA.box.height]
836
        add     eax, [esi + WDATA.box.height]
Line 775... Line 837...
775
 
837
 
776
        cmp     ebx, eax
838
        cmp     ebx, eax
777
        jb      @f
839
        jb      @f
-
 
840
        mov     ebx, eax
-
 
841
;--------------------------------------
778
        mov     ebx, eax
842
align 4
779
    @@:
843
@@:
Line 780... Line 844...
780
        push    ebx
844
        push    ebx
-
 
845
 
781
 
846
        xor     edi, edi
782
        xor     edi, edi
847
;--------------------------------------
783
 
848
align 4
784
  .next_line:
849
.next_line:
785
        mov     ebx, edx
850
        mov     ebx, edx
786
        shl     ebx, 16
851
        shl     ebx, 16
Line 792... Line 857...
792
        add     eax, 4 * 65536 - 4
857
        add     eax, 4 * 65536 - 4
793
        mov     ecx, [esi + WDATA.cl_titlebar]
858
        mov     ecx, [esi + WDATA.cl_titlebar]
794
        test    ecx, 0x40000000
859
        test    ecx, 0x40000000
795
        jz      @f
860
        jz      @f
796
        add     ecx, 0x00040404
861
        add     ecx, 0x00040404
-
 
862
;--------------------------------------
-
 
863
align 4
797
    @@:
864
@@:
798
        test    ecx, 0x80000000
865
        test    ecx, 0x80000000
799
        jz      @f
866
        jz      @f
800
        sub     ecx, 0x00040404
867
        sub     ecx, 0x00040404
-
 
868
;--------------------------------------
-
 
869
align 4
801
    @@:
870
@@:
802
        mov     [esi + WDATA.cl_titlebar], ecx
871
        mov     [esi + WDATA.cl_titlebar], ecx
803
        and     ecx, 0x00ffffff
872
        and     ecx, 0x00ffffff
804
        call    [draw_line]
873
        call    [draw_line]
805
        inc     edx
874
        inc     edx
Line 807... Line 876...
807
        jb      .next_line
876
        jb      .next_line
Line 808... Line 877...
808
 
877
 
809
        add     esp, 4
878
        add     esp, 4
810
        pop     [esi + WDATA.cl_titlebar]
879
        pop     [esi + WDATA.cl_titlebar]
811
        ret
-
 
-
 
880
        ret
812
 
881
;------------------------------------------------------------------------------
813
align 4
882
align 4
814
;------------------------------------------------------------------------------
883
;------------------------------------------------------------------------------
815
drawwindow_III: ;//////////////////////////////////////////////////////////////
884
drawwindow_III: ;//////////////////////////////////////////////////////////////
816
;------------------------------------------------------------------------------
885
;------------------------------------------------------------------------------
Line 839... Line 908...
839
 
908
 
840
        push    esi
909
        push    esi
841
        mov     ecx, 3
910
        mov     ecx, 3
842
        mov     esi, [edx + WDATA.cl_frames]
911
        mov     esi, [edx + WDATA.cl_frames]
-
 
912
        or      esi, 1 shl 25; 0x02000000 used for draw_rectangle without top line
843
        or      esi, 1 shl 25; 0x02000000 used for draw_rectangle without top line
913
;--------------------------------------
844
 
914
align 4
845
  .next_frame:
915
.next_frame:
846
        add     eax, 1 * 65536 - 1
916
        add     eax, 1 * 65536 - 1
847
        add     ebx, 0 * 65536 - 1
917
        add     ebx, 0 * 65536 - 1
848
        call    draw_rectangle
918
        call    draw_rectangle
Line 879... Line 949...
879
        mov     ecx, [esi + WDATA.box.width]
949
        mov     ecx, [esi + WDATA.box.width]
880
        mov     edx, [esi + WDATA.box.height]
950
        mov     edx, [esi + WDATA.box.height]
881
        sub     ecx, 4
951
        sub     ecx, 4
882
        sub     edx, 4
952
        sub     edx, 4
883
        call    [drawbar]
953
        call    [drawbar]
-
 
954
;--------------------------------------
884
 
955
align 4
885
  .exit:
956
.exit:
886
        popad
957
        popad
887
        ret
958
        ret
888
 
-
 
-
 
959
;------------------------------------------------------------------------------
889
align 4
960
align 4
890
;------------------------------------------------------------------------------
961
;------------------------------------------------------------------------------
891
waredraw: ;////////////////////////////////////////////////////////////////////
962
waredraw: ;////////////////////////////////////////////////////////////////////
892
;------------------------------------------------------------------------------
963
;------------------------------------------------------------------------------
893
;? Activate window, redrawing if necessary
964
;? Activate window, redrawing if necessary
Line 931... Line 1002...
931
 
1002
 
932
        ; tell application to redraw itself
1003
        ; tell application to redraw itself
933
        mov     [edi + WDATA.fl_redraw], 1
1004
        mov     [edi + WDATA.fl_redraw], 1
934
        xor     eax, eax
1005
        xor     eax, eax
-
 
1006
        jmp     .exit
935
        jmp     .exit
1007
;--------------------------------------
936
 
1008
align 4
937
  .do_not_draw:
1009
.do_not_draw:
938
        ; no it's not, just activate the window
1010
        ; no it's not, just activate the window
939
        call    window._.window_activate
1011
        call    window._.window_activate
940
        xor     eax, eax
1012
        xor     eax, eax
941
        mov     byte[MOUSE_BACKGROUND], al
1013
        mov     byte[MOUSE_BACKGROUND], al
942
        mov     byte[DONT_DRAW_MOUSE], al
-
 
-
 
1014
        mov     byte[DONT_DRAW_MOUSE], al
943
 
1015
;--------------------------------------
944
 
1016
align 4
945
  .exit:
1017
.exit:
946
        mov     byte[MOUSE_DOWN], 0
1018
        mov     byte[MOUSE_DOWN], 0
947
        inc     eax
1019
        inc     eax
948
        ret
-
 
-
 
1020
        ret
949
 
1021
;------------------------------------------------------------------------------
950
align 4
1022
align 4
951
;------------------------------------------------------------------------------
1023
;------------------------------------------------------------------------------
952
minimize_window: ;/////////////////////////////////////////////////////////////
1024
minimize_window: ;/////////////////////////////////////////////////////////////
953
;------------------------------------------------------------------------------
1025
;------------------------------------------------------------------------------
Line 984... Line 1056...
984
        xor     esi, esi
1056
        xor     esi, esi
985
        xor     eax, eax
1057
        xor     eax, eax
986
        call    redrawscreen
1058
        call    redrawscreen
Line 987... Line 1059...
987
 
1059
 
-
 
1060
        pop     esi edx ecx ebx eax
988
        pop     esi edx ecx ebx eax
1061
;--------------------------------------
989
 
1062
align 4
990
  .exit:
1063
.exit:
991
        popfd
1064
        popfd
992
        pop     edi
1065
        pop     edi
993
        ret
-
 
-
 
1066
        ret
994
 
1067
;------------------------------------------------------------------------------
995
align 4
1068
align 4
996
;------------------------------------------------------------------------------
1069
;------------------------------------------------------------------------------
997
restore_minimized_window: ;////////////////////////////////////////////////////
1070
restore_minimized_window: ;////////////////////////////////////////////////////
998
;------------------------------------------------------------------------------
1071
;------------------------------------------------------------------------------
Line 1017... Line 1090...
1017
        and     [edi + WDATA.fl_wstate], not WSTATE_MINIMIZED
1090
        and     [edi + WDATA.fl_wstate], not WSTATE_MINIMIZED
1018
        mov     ebp, window._.set_screen
1091
        mov     ebp, window._.set_screen
1019
        cmp     eax, [TASK_COUNT]
1092
        cmp     eax, [TASK_COUNT]
1020
        jz      @f
1093
        jz      @f
1021
        mov     ebp, calculatescreen
1094
        mov     ebp, calculatescreen
-
 
1095
;--------------------------------------
-
 
1096
align 4
1022
    @@:
1097
@@:
1023
        mov     eax, [edi + WDATA.box.left]
1098
        mov     eax, [edi + WDATA.box.left]
1024
        mov     ebx, [edi + WDATA.box.top]
1099
        mov     ebx, [edi + WDATA.box.top]
1025
        mov     ecx, [edi + WDATA.box.width]
1100
        mov     ecx, [edi + WDATA.box.width]
1026
        mov     edx, [edi + WDATA.box.height]
1101
        mov     edx, [edi + WDATA.box.height]
1027
        add     ecx, eax
1102
        add     ecx, eax
1028
        add     edx, ebx
1103
        add     edx, ebx
1029
        call    ebp
1104
        call    ebp
Line 1030... Line 1105...
1030
 
1105
 
-
 
1106
        mov     byte[MOUSE_BACKGROUND], 0
1031
        mov     byte[MOUSE_BACKGROUND], 0
1107
;--------------------------------------
1032
 
1108
align 4
1033
  .exit:
1109
.exit:
1034
        popfd
1110
        popfd
1035
        popad
1111
        popad
1036
        ret
-
 
-
 
1112
        ret
1037
 
1113
;------------------------------------------------------------------------------
1038
align 4
1114
align 4
1039
; TODO: remove this proc
1115
; TODO: remove this proc
1040
;------------------------------------------------------------------------------
1116
;------------------------------------------------------------------------------
1041
window_check_events: ;/////////////////////////////////////////////////////////
1117
window_check_events: ;/////////////////////////////////////////////////////////
Line 1052... Line 1128...
1052
        xchg    [window_minimize], bl
1128
        xchg    [window_minimize], bl
1053
        dec     bl
1129
        dec     bl
1054
        jnz     @f
1130
        jnz     @f
1055
        call    minimize_window
1131
        call    minimize_window
1056
        jmp     .exit
1132
        jmp     .exit
-
 
1133
;--------------------------------------
1057
 
1134
align 4
1058
    @@:
1135
@@:
1059
        call    restore_minimized_window
1136
        call    restore_minimized_window
-
 
1137
;--------------------------------------
1060
 
1138
align 4
1061
  .exit:
1139
.exit:
1062
        ret
1140
        ret
1063
 
-
 
-
 
1141
;------------------------------------------------------------------------------
1064
align 4
1142
align 4
1065
;------------------------------------------------------------------------------
1143
;------------------------------------------------------------------------------
1066
sys_window_maximize_handler: ;/////////////////////////////////////////////////
1144
sys_window_maximize_handler: ;/////////////////////////////////////////////////
1067
;------------------------------------------------------------------------------
1145
;------------------------------------------------------------------------------
1068
;? 
1146
;? 
Line 1095... Line 1173...
1095
                eax
1173
                eax
1096
        sub     [esp + BOX.width], eax
1174
        sub     [esp + BOX.width], eax
1097
        sub     [esp + BOX.height], ecx
1175
        sub     [esp + BOX.height], ecx
1098
        mov     eax, esp
1176
        mov     eax, esp
1099
        jmp     .set_box
1177
        jmp     .set_box
-
 
1178
;--------------------------------------
1100
 
1179
align 4
1101
  .restore_size:
1180
.restore_size:
1102
        mov     eax, esi
1181
        mov     eax, esi
1103
        shl     eax, 8
1182
        shl     eax, 8
1104
        add     eax, SLOT_BASE + APPDATA.saved_box
1183
        add     eax, SLOT_BASE + APPDATA.saved_box
1105
        push    [eax + BOX.height] \
1184
        push    [eax + BOX.height] \
1106
                [eax + BOX.width] \
1185
                [eax + BOX.width] \
1107
                [eax + BOX.top] \
1186
                [eax + BOX.top] \
1108
                [eax + BOX.left]
1187
                [eax + BOX.left]
1109
        mov     eax, esp
1188
        mov     eax, esp
-
 
1189
;--------------------------------------
1110
 
1190
align 4
1111
  .set_box:
1191
.set_box:
1112
        test    bl, WSTATE_ROLLEDUP
1192
        test    bl, WSTATE_ROLLEDUP
1113
        jz      @f
1193
        jz      @f
Line 1114... Line 1194...
1114
 
1194
 
1115
        xchg    eax, ecx
1195
        xchg    eax, ecx
1116
        call    window._.get_rolledup_height
1196
        call    window._.get_rolledup_height
1117
        mov     [ecx + BOX.height], eax
1197
        mov     [ecx + BOX.height], eax
-
 
1198
        xchg    eax, ecx
1118
        xchg    eax, ecx
1199
;--------------------------------------
1119
 
1200
align 4
1120
    @@:
1201
@@:
1121
        call    window._.set_window_box
1202
        call    window._.set_window_box
-
 
1203
        add     esp, sizeof.BOX
1122
        add     esp, sizeof.BOX
1204
;--------------------------------------
1123
 
1205
align 4
1124
  .exit:
1206
.exit:
1125
        ret
-
 
-
 
1207
        ret
1126
 
1208
;------------------------------------------------------------------------------
1127
align 4
1209
align 4
1128
;------------------------------------------------------------------------------
1210
;------------------------------------------------------------------------------
1129
sys_window_rollup_handler: ;///////////////////////////////////////////////////
1211
sys_window_rollup_handler: ;///////////////////////////////////////////////////
1130
;------------------------------------------------------------------------------
1212
;------------------------------------------------------------------------------
Line 1149... Line 1231...
1149
                [edi + WDATA.box.width] \
1231
                [edi + WDATA.box.width] \
1150
                [edi + WDATA.box.top] \
1232
                [edi + WDATA.box.top] \
1151
                [edi + WDATA.box.left]
1233
                [edi + WDATA.box.left]
1152
        mov     eax, esp
1234
        mov     eax, esp
1153
        jmp     .set_box
1235
        jmp     .set_box
-
 
1236
;--------------------------------------
1154
 
1237
align 4
1155
  .restore_size:
1238
.restore_size:
1156
        test    bl, WSTATE_MAXIMIZED
1239
        test    bl, WSTATE_MAXIMIZED
1157
        jnz     @f
1240
        jnz     @f
1158
        add     esp, -sizeof.BOX
1241
        add     esp, -sizeof.BOX
1159
        lea     eax, [edx + APPDATA.saved_box]
1242
        lea     eax, [edx + APPDATA.saved_box]
1160
        jmp     .set_box
1243
        jmp     .set_box
-
 
1244
;--------------------------------------
1161
 
1245
align 4
1162
    @@:
1246
@@:
1163
        mov     eax, [screen_workarea.top]
1247
        mov     eax, [screen_workarea.top]
1164
        push    [screen_workarea.bottom] \
1248
        push    [screen_workarea.bottom] \
1165
                [edi + WDATA.box.width] \
1249
                [edi + WDATA.box.width] \
1166
                eax \
1250
                eax \
1167
                [edi + WDATA.box.left]
1251
                [edi + WDATA.box.left]
1168
        sub     [esp + BOX.height], eax
1252
        sub     [esp + BOX.height], eax
1169
        mov     eax, esp
1253
        mov     eax, esp
-
 
1254
;--------------------------------------
1170
 
1255
align 4
1171
  .set_box:
1256
.set_box:
1172
        call    window._.set_window_box
1257
        call    window._.set_window_box
1173
        add     esp, sizeof.BOX
1258
        add     esp, sizeof.BOX
1174
 
-
 
1175
        ret
1259
        ret
1176
 
-
 
-
 
1260
;------------------------------------------------------------------------------
1177
align 4
1261
align 4
1178
;------------------------------------------------------------------------------
1262
;------------------------------------------------------------------------------
1179
sys_window_start_moving_handler: ;/////////////////////////////////////////////
1263
sys_window_start_moving_handler: ;/////////////////////////////////////////////
1180
;------------------------------------------------------------------------------
1264
;------------------------------------------------------------------------------
1181
;? 
1265
;? 
Line 1183... Line 1267...
1183
;> eax = old (original) window box
1267
;> eax = old (original) window box
1184
;> esi = process slot
1268
;> esi = process slot
1185
;------------------------------------------------------------------------------
1269
;------------------------------------------------------------------------------
1186
        mov     edi, eax
1270
        mov     edi, eax
1187
        call    window._.draw_negative_box
1271
        call    window._.draw_negative_box
1188
 
-
 
1189
        ret
1272
        ret
1190
 
-
 
-
 
1273
;------------------------------------------------------------------------------
1191
align 4
1274
align 4
1192
;------------------------------------------------------------------------------
1275
;------------------------------------------------------------------------------
1193
sys_window_end_moving_handler: ;///////////////////////////////////////////////
1276
sys_window_end_moving_handler: ;///////////////////////////////////////////////
1194
;------------------------------------------------------------------------------
1277
;------------------------------------------------------------------------------
1195
;? 
1278
;? 
Line 1207... Line 1290...
1207
 
1290
 
1208
        mov     eax, ebx
1291
        mov     eax, ebx
1209
        mov     bl, [edi + WDATA.fl_wstate]
1292
        mov     bl, [edi + WDATA.fl_wstate]
1210
        call    window._.set_window_box
1293
        call    window._.set_window_box
1211
        ret
-
 
-
 
1294
        ret
1212
 
1295
;------------------------------------------------------------------------------
1213
align 4
1296
align 4
1214
;------------------------------------------------------------------------------
1297
;------------------------------------------------------------------------------
1215
sys_window_moving_handler: ;///////////////////////////////////////////////////
1298
sys_window_moving_handler: ;///////////////////////////////////////////////////
1216
;------------------------------------------------------------------------------
1299
;------------------------------------------------------------------------------
Line 1223... Line 1306...
1223
        mov     edi, eax
1306
        mov     edi, eax
1224
        call    window._.draw_negative_box
1307
        call    window._.draw_negative_box
1225
        mov     edi, ebx
1308
        mov     edi, ebx
1226
        call    window._.draw_negative_box
1309
        call    window._.draw_negative_box
1227
        ret
1310
        ret
1228
 
-
 
1229
;==============================================================================
1311
;==============================================================================
1230
;///// private functions //////////////////////////////////////////////////////
1312
;///// private functions //////////////////////////////////////////////////////
1231
;==============================================================================
1313
;==============================================================================
Line 1232... Line 1314...
1232
 
1314
 
Line 1246... Line 1328...
1246
;uglobal
1328
;uglobal
1247
  ; NOTE: commented out since doesn't provide necessary functionality anyway,
1329
  ; NOTE: commented out since doesn't provide necessary functionality anyway,
1248
  ;       to be reworked
1330
  ;       to be reworked
1249
; new_window_starting       dd ?
1331
; new_window_starting       dd ?
1250
;endg
1332
;endg
1251
 
-
 
-
 
1333
;------------------------------------------------------------------------------
1252
align 4
1334
align 4
1253
;------------------------------------------------------------------------------
1335
;------------------------------------------------------------------------------
1254
window._.invalidate_screen: ;//////////////////////////////////////////////////
1336
window._.invalidate_screen: ;//////////////////////////////////////////////////
1255
;------------------------------------------------------------------------------
1337
;------------------------------------------------------------------------------
1256
;? 
1338
;? 
Line 1266... Line 1348...
1266
        mov     ecx, [eax + BOX.left]
1348
        mov     ecx, [eax + BOX.left]
1267
        mov     edx, [ebx + BOX.left]
1349
        mov     edx, [ebx + BOX.left]
1268
        cmp     ecx, edx
1350
        cmp     ecx, edx
1269
        jle     @f
1351
        jle     @f
1270
        mov     ecx, edx
1352
        mov     ecx, edx
-
 
1353
;--------------------------------------
-
 
1354
align 4
1271
    @@:
1355
@@:
1272
        mov     [draw_limits.left], ecx
1356
        mov     [draw_limits.left], ecx
1273
        mov     ecx, [eax + BOX.left]
1357
        mov     ecx, [eax + BOX.left]
1274
        add     ecx, [eax + BOX.width]
1358
        add     ecx, [eax + BOX.width]
1275
        add     edx, [ebx + BOX.width]
1359
        add     edx, [ebx + BOX.width]
1276
        cmp     ecx, edx
1360
        cmp     ecx, edx
1277
        jae     @f
1361
        jae     @f
1278
        mov     ecx, edx
1362
        mov     ecx, edx
-
 
1363
;--------------------------------------
-
 
1364
align 4
1279
    @@:
1365
@@:
1280
        mov     [draw_limits.right], ecx
1366
        mov     [draw_limits.right], ecx
1281
        mov     ecx, [eax + BOX.top]
1367
        mov     ecx, [eax + BOX.top]
1282
        mov     edx, [ebx + BOX.top]
1368
        mov     edx, [ebx + BOX.top]
1283
        cmp     ecx, edx
1369
        cmp     ecx, edx
1284
        jle     @f
1370
        jle     @f
1285
        mov     ecx, edx
1371
        mov     ecx, edx
-
 
1372
;--------------------------------------
-
 
1373
align 4
1286
    @@:
1374
@@:
1287
        mov     [draw_limits.top], ecx
1375
        mov     [draw_limits.top], ecx
1288
        mov     ecx, [eax + BOX.top]
1376
        mov     ecx, [eax + BOX.top]
1289
        add     ecx, [eax + BOX.height]
1377
        add     ecx, [eax + BOX.height]
1290
        add     edx, [ebx + BOX.height]
1378
        add     edx, [ebx + BOX.height]
1291
        cmp     ecx, edx
1379
        cmp     ecx, edx
1292
        jae     @f
1380
        jae     @f
1293
        mov     ecx, edx
1381
        mov     ecx, edx
-
 
1382
;--------------------------------------
-
 
1383
align 4
1294
    @@:
1384
@@:
1295
        mov     [draw_limits.bottom], ecx
1385
        mov     [draw_limits.bottom], ecx
1296
 
-
 
1297
        ; recalculate screen buffer at old position
1386
        ; recalculate screen buffer at old position
1298
        push    ebx
1387
        push    ebx
1299
        mov     edx, [eax + BOX.height]
1388
        mov     edx, [eax + BOX.height]
1300
        mov     ecx, [eax + BOX.width]
1389
        mov     ecx, [eax + BOX.width]
1301
        mov     ebx, [eax + BOX.top]
1390
        mov     ebx, [eax + BOX.top]
1302
        mov     eax, [eax + BOX.left]
1391
        mov     eax, [eax + BOX.left]
1303
        add     ecx, eax
1392
        add     ecx, eax
1304
        add     edx, ebx
1393
        add     edx, ebx
1305
        call    calculatescreen
1394
        call    calculatescreen
1306
        pop     eax
1395
        pop     eax
1307
 
-
 
1308
        ; recalculate screen buffer at new position
1396
        ; recalculate screen buffer at new position
1309
        mov     edx, [eax + BOX.height]
1397
        mov     edx, [eax + BOX.height]
1310
        mov     ecx, [eax + BOX.width]
1398
        mov     ecx, [eax + BOX.width]
1311
        mov     ebx, [eax + BOX.top]
1399
        mov     ebx, [eax + BOX.top]
1312
        mov     eax, [eax + BOX.left]
1400
        mov     eax, [eax + BOX.left]
Line 1320... Line 1408...
1320
        ; tell window to redraw itself
1408
        ; tell window to redraw itself
1321
        mov     [edi + WDATA.fl_redraw], 1
1409
        mov     [edi + WDATA.fl_redraw], 1
Line 1322... Line 1410...
1322
 
1410
 
1323
        pop     ebx eax
1411
        pop     ebx eax
1324
        ret
-
 
-
 
1412
        ret
1325
 
1413
;------------------------------------------------------------------------------
1326
align 4
1414
align 4
1327
;------------------------------------------------------------------------------
1415
;------------------------------------------------------------------------------
1328
window._.set_window_box: ;/////////////////////////////////////////////////////
1416
window._.set_window_box: ;/////////////////////////////////////////////////////
1329
;------------------------------------------------------------------------------
1417
;------------------------------------------------------------------------------
Line 1345... Line 1433...
1345
end if
1433
end if
1346
        mov     ecx, 4
1434
        mov     ecx, 4
1347
        repz cmpsd
1435
        repz cmpsd
1348
        pop     edi
1436
        pop     edi
1349
        jz      .exit
1437
        jz      .exit
-
 
1438
;--------------------------------------
-
 
1439
align 4
1350
@@:
1440
@@:
1351
 
-
 
1352
        add     esp, -sizeof.BOX
1441
        add     esp, -sizeof.BOX
1353
 
-
 
1354
        mov     ebx, esp
1442
        mov     ebx, esp
1355
if WDATA.box
1443
if WDATA.box
1356
        lea     esi, [edi + WDATA.box]
1444
        lea     esi, [edi + WDATA.box]
1357
else
1445
else
1358
        mov     esi, edi ; optimization for WDATA.box = 0
1446
        mov     esi, edi ; optimization for WDATA.box = 0
Line 1397... Line 1485...
1397
 
1485
 
1398
        test    ch, WSTATE_ROLLEDUP
1486
        test    ch, WSTATE_ROLLEDUP
Line 1399... Line 1487...
1399
        jnz     .exit
1487
        jnz     .exit
-
 
1488
 
1400
 
1489
        mov     [eax + APPDATA.saved_box.height], edx
1401
        mov     [eax + APPDATA.saved_box.height], edx
1490
;--------------------------------------
1402
 
1491
align 4
1403
  .exit:
1492
.exit:
1404
        pop     esi ebx eax
-
 
-
 
1493
        pop     esi ebx eax
1405
        ret
1494
        ret
1406
 
1495
;------------------------------------------------------------------------------
1407
align 4
1496
align 4
1408
;------------------------------------------------------------------------------
1497
;------------------------------------------------------------------------------
1409
window._.set_window_clientbox: ;///////////////////////////////////////////////
1498
window._.set_window_clientbox: ;///////////////////////////////////////////////
Line 1442... Line 1531...
1442
        sub     eax, [esp]
1531
        sub     eax, [esp]
1443
        add     eax, [ecx + WDATA.box.height]
1532
        add     eax, [ecx + WDATA.box.height]
1444
        mov     [edi + SLOT_BASE + APPDATA.wnd_clientbox.height], eax
1533
        mov     [edi + SLOT_BASE + APPDATA.wnd_clientbox.height], eax
1445
        add     esp, 4
1534
        add     esp, 4
1446
        jmp     .exit
1535
        jmp     .exit
-
 
1536
;--------------------------------------
1447
 
1537
align 4
1448
  .whole_window:
1538
.whole_window:
1449
        xor     eax, eax
1539
        xor     eax, eax
1450
        mov     [edi + SLOT_BASE + APPDATA.wnd_clientbox.left], eax
1540
        mov     [edi + SLOT_BASE + APPDATA.wnd_clientbox.left], eax
1451
        mov     [edi + SLOT_BASE + APPDATA.wnd_clientbox.top], eax
1541
        mov     [edi + SLOT_BASE + APPDATA.wnd_clientbox.top], eax
1452
        mov     eax, [ecx + WDATA.box.width]
1542
        mov     eax, [ecx + WDATA.box.width]
1453
        mov     [edi + SLOT_BASE + APPDATA.wnd_clientbox.width], eax
1543
        mov     [edi + SLOT_BASE + APPDATA.wnd_clientbox.width], eax
1454
        mov     eax, [ecx + WDATA.box.height]
1544
        mov     eax, [ecx + WDATA.box.height]
1455
        mov     [edi + SLOT_BASE + APPDATA.wnd_clientbox.height], eax
1545
        mov     [edi + SLOT_BASE + APPDATA.wnd_clientbox.height], eax
-
 
1546
;--------------------------------------
1456
 
1547
align 4
1457
  .exit:
1548
.exit:
1458
        pop     edi ecx eax
1549
        pop     edi ecx eax
1459
        ret
1550
        ret
1460
 
-
 
-
 
1551
;------------------------------------------------------------------------------
1461
align 4
1552
align 4
1462
;------------------------------------------------------------------------------
1553
;------------------------------------------------------------------------------
1463
window._.sys_set_window: ;/////////////////////////////////////////////////////
1554
window._.sys_set_window: ;/////////////////////////////////////////////////////
1464
;------------------------------------------------------------------------------
1555
;------------------------------------------------------------------------------
1465
;? 
1556
;? 
Line 1514... Line 1605...
1514
        je      @f
1605
        je      @f
1515
        cmp     cl, 4
1606
        cmp     cl, 4
1516
        je      @f
1607
        je      @f
Line 1517... Line 1608...
1517
 
1608
 
-
 
1609
        xor     eax, eax
1518
        xor     eax, eax
1610
;--------------------------------------
1519
 
1611
align 4
1520
    @@:
1612
@@:
Line 1521... Line 1613...
1521
        mov     [edi + APPDATA.wnd_caption], eax
1613
        mov     [edi + APPDATA.wnd_caption], eax
1522
 
1614
 
Line 1542... Line 1634...
1542
        add     edx, ebx
1634
        add     edx, ebx
1543
        call    calculatescreen
1635
        call    calculatescreen
Line 1544... Line 1636...
1544
 
1636
 
1545
        mov     byte[KEY_COUNT], 0           ; empty keyboard buffer
1637
        mov     byte[KEY_COUNT], 0           ; empty keyboard buffer
-
 
1638
        mov     byte[BTN_COUNT], 0           ; empty button buffer
1546
        mov     byte[BTN_COUNT], 0           ; empty button buffer
1639
;--------------------------------------
1547
 
1640
align 4
1548
  .set_client_box:
1641
.set_client_box:
1549
        ; update window client box coordinates
1642
        ; update window client box coordinates
Line 1550... Line 1643...
1550
        call    window._.set_window_clientbox
1643
        call    window._.set_window_clientbox
1551
 
1644
 
1552
        ; reset window redraw flag and exit
1645
        ; reset window redraw flag and exit
1553
        mov     [edi + WDATA.fl_redraw], 0
1646
        mov     [edi + WDATA.fl_redraw], 0
1554
        mov     edx, edi
-
 
-
 
1647
        mov     edx, edi
1555
        ret
1648
        ret
1556
 
1649
;------------------------------------------------------------------------------
1557
align 4
1650
align 4
1558
;------------------------------------------------------------------------------
1651
;------------------------------------------------------------------------------
1559
window._.check_window_position: ;//////////////////////////////////////////////
1652
window._.check_window_position: ;//////////////////////////////////////////////
Line 1570... Line 1663...
1570
        mov     edx, [edi + WDATA.box.height]
1663
        mov     edx, [edi + WDATA.box.height]
Line 1571... Line 1664...
1571
 
1664
 
1572
        mov     esi, [Screen_Max_X]
1665
        mov     esi, [Screen_Max_X]
1573
        cmp     ecx, esi
1666
        cmp     ecx, esi
-
 
1667
        ja      .fix_width_high
1574
        ja      .fix_width_high
1668
;--------------------------------------
1575
 
1669
align 4
1576
  .check_left:
1670
.check_left:
1577
        or      eax, eax
1671
        or      eax, eax
1578
        jl      .fix_left_low
1672
        jl      .fix_left_low
1579
        add     eax, ecx
1673
        add     eax, ecx
1580
        cmp     eax, esi
1674
        cmp     eax, esi
-
 
1675
        jg      .fix_left_high
1581
        jg      .fix_left_high
1676
;--------------------------------------
1582
 
1677
align 4
1583
  .check_height:
1678
.check_height:
1584
        mov     esi, [Screen_Max_Y]
1679
        mov     esi, [Screen_Max_Y]
1585
        cmp     edx, esi
1680
        cmp     edx, esi
-
 
1681
        ja      .fix_height_high
1586
        ja      .fix_height_high
1682
;--------------------------------------
1587
 
1683
align 4
1588
  .check_top:
1684
.check_top:
1589
        or      ebx, ebx
1685
        or      ebx, ebx
1590
        jl      .fix_top_low
1686
        jl      .fix_top_low
1591
        add     ebx, edx
1687
        add     ebx, edx
1592
        cmp     ebx, esi
1688
        cmp     ebx, esi
-
 
1689
        jg      .fix_top_high
1593
        jg      .fix_top_high
1690
;--------------------------------------
1594
 
1691
align 4
1595
  .exit:
1692
.exit:
1596
        pop     esi edx ecx ebx eax
1693
        pop     esi edx ecx ebx eax
-
 
1694
        ret
1597
        ret
1695
;--------------------------------------
1598
 
1696
align 4
1599
  .fix_width_high:
1697
.fix_width_high:
1600
        mov     ecx, esi
1698
        mov     ecx, esi
1601
        mov     [edi + WDATA.box.width], esi
1699
        mov     [edi + WDATA.box.width], esi
-
 
1700
        jmp     .check_left
1602
        jmp     .check_left
1701
;--------------------------------------
1603
 
1702
align 4
1604
  .fix_left_low:
1703
.fix_left_low:
1605
        xor     eax, eax
1704
        xor     eax, eax
1606
        mov     [edi + WDATA.box.left], eax
1705
        mov     [edi + WDATA.box.left], eax
-
 
1706
        jmp     .check_height
1607
        jmp     .check_height
1707
;--------------------------------------
1608
 
1708
align 4
1609
  .fix_left_high:
1709
.fix_left_high:
1610
        mov     eax, esi
1710
        mov     eax, esi
1611
        sub     eax, ecx
1711
        sub     eax, ecx
1612
        mov     [edi + WDATA.box.left], eax
1712
        mov     [edi + WDATA.box.left], eax
-
 
1713
        jmp     .check_height
1613
        jmp     .check_height
1714
;--------------------------------------
1614
 
1715
align 4
1615
  .fix_height_high:
1716
.fix_height_high:
1616
        mov     edx, esi
1717
        mov     edx, esi
1617
        mov     [edi + WDATA.box.height], esi
1718
        mov     [edi + WDATA.box.height], esi
-
 
1719
        jmp     .check_top
1618
        jmp     .check_top
1720
;--------------------------------------
1619
 
1721
align 4
1620
  .fix_top_low:
1722
.fix_top_low:
1621
        xor     ebx, ebx
1723
        xor     ebx, ebx
1622
        mov     [edi + WDATA.box.top], ebx
1724
        mov     [edi + WDATA.box.top], ebx
-
 
1725
        jmp     .exit
1623
        jmp     .exit
1726
;--------------------------------------
1624
 
1727
align 4
1625
  .fix_top_high:
1728
.fix_top_high:
1626
        mov     ebx, esi
1729
        mov     ebx, esi
1627
        sub     ebx, edx
1730
        sub     ebx, edx
1628
        mov     [edi + WDATA.box.top], ebx
1731
        mov     [edi + WDATA.box.top], ebx
1629
        jmp     .exit
-
 
-
 
1732
        jmp     .exit
1630
 
1733
;------------------------------------------------------------------------------
1631
align 4
1734
align 4
1632
;------------------------------------------------------------------------------
1735
;------------------------------------------------------------------------------
1633
window._.get_titlebar_height: ;////////////////////////////////////////////////
1736
window._.get_titlebar_height: ;////////////////////////////////////////////////
1634
;------------------------------------------------------------------------------
1737
;------------------------------------------------------------------------------
Line 1640... Line 1743...
1640
        and     al, 0x0f
1743
        and     al, 0x0f
1641
        cmp     al, 0x03
1744
        cmp     al, 0x03
1642
        jne     @f
1745
        jne     @f
1643
        mov     eax, [_skinh]
1746
        mov     eax, [_skinh]
1644
        ret
1747
        ret
-
 
1748
;--------------------------------------
-
 
1749
align 4
1645
    @@:
1750
@@:
1646
        mov     eax, 21
1751
        mov     eax, 21
1647
        ret
1752
        ret
1648
 
-
 
-
 
1753
;------------------------------------------------------------------------------
1649
align 4
1754
align 4
1650
;------------------------------------------------------------------------------
1755
;------------------------------------------------------------------------------
1651
window._.get_rolledup_height: ;////////////////////////////////////////////////
1756
window._.get_rolledup_height: ;////////////////////////////////////////////////
1652
;------------------------------------------------------------------------------
1757
;------------------------------------------------------------------------------
1653
;? 
1758
;? 
Line 1659... Line 1764...
1659
        cmp     al, 0x03
1764
        cmp     al, 0x03
1660
        jb      @f
1765
        jb      @f
1661
        mov     eax, [_skinh]
1766
        mov     eax, [_skinh]
1662
        add     eax, 3
1767
        add     eax, 3
1663
        ret
1768
        ret
-
 
1769
;--------------------------------------
-
 
1770
align 4
1664
    @@:
1771
@@:
1665
        or      al, al
1772
        or      al, al
1666
        jnz     @f
1773
        jnz     @f
1667
        mov     eax, 21
1774
        mov     eax, 21
1668
        ret
1775
        ret
-
 
1776
;--------------------------------------
-
 
1777
align 4
1669
    @@:
1778
@@:
1670
        mov     eax, 21 + 2
1779
        mov     eax, 21 + 2
1671
        ret
1780
        ret
1672
 
-
 
-
 
1781
;------------------------------------------------------------------------------
1673
align 4
1782
align 4
1674
;------------------------------------------------------------------------------
1783
;------------------------------------------------------------------------------
1675
window._.set_screen: ;/////////////////////////////////////////////////////////
1784
window._.set_screen: ;/////////////////////////////////////////////////////////
1676
;------------------------------------------------------------------------------
1785
;------------------------------------------------------------------------------
1677
;? Reserve window area in screen buffer
1786
;? Reserve window area in screen buffer
Line 1699... Line 1808...
1699
        shl     edi, 5
1808
        shl     edi, 5
1700
        cmp     [window_data + edi + WDATA.box.width], 0
1809
        cmp     [window_data + edi + WDATA.box.width], 0
1701
        jnz     .check_for_shaped_window
1810
        jnz     .check_for_shaped_window
1702
        cmp     [window_data + edi + WDATA.box.height], 0
1811
        cmp     [window_data + edi + WDATA.box.height], 0
1703
        jz      .exit
1812
        jz      .exit
-
 
1813
;--------------------------------------
1704
 
1814
align 4
1705
  .check_for_shaped_window:
1815
.check_for_shaped_window:
1706
        mov     edi, esi
1816
        mov     edi, esi
1707
        shl     edi, 8
1817
        shl     edi, 8
1708
        add     edi, SLOT_BASE
1818
        add     edi, SLOT_BASE
1709
        cmp     [edi + APPDATA.wnd_shape], 0
1819
        cmp     [edi + APPDATA.wnd_shape], 0
Line 1726... Line 1836...
1726
        pop     eax
1836
        pop     eax
1727
        mov     ah, al
1837
        mov     ah, al
1728
        push    ax
1838
        push    ax
1729
        shl     eax, 16
1839
        shl     eax, 16
1730
        pop     ax
1840
        pop     ax
-
 
1841
;--------------------------------------
1731
 
1842
align 4
1732
  .next_line:
1843
.next_line:
1733
        push    ecx
1844
        push    ecx
1734
        shr     ecx, 2
1845
        shr     ecx, 2
1735
        rep stosd
1846
        rep stosd
1736
        mov     ecx, [esp]
1847
        mov     ecx, [esp]
Line 1741... Line 1852...
1741
        sub     edi, ecx
1852
        sub     edi, ecx
1742
        dec     edx
1853
        dec     edx
1743
        jnz     .next_line
1854
        jnz     .next_line
Line 1744... Line 1855...
1744
 
1855
 
-
 
1856
        jmp     .exit
1745
        jmp     .exit
1857
;--------------------------------------
1746
 
1858
align 4
1747
  .shaped_window:
1859
.shaped_window:
1748
        ;  for (y=0; y <= x_size; y++)
1860
        ;  for (y=0; y <= x_size; y++)
1749
        ;      for (x=0; x <= x_size; x++)
1861
        ;      for (x=0; x <= x_size; x++)
1750
        ;          if (shape[coord(x,y,scale)]==1)
1862
        ;          if (shape[coord(x,y,scale)]==1)
Line 1789... Line 1901...
1789
 
1901
 
1790
        add     [ff_xsz], eax
1902
        add     [ff_xsz], eax
Line 1791... Line 1903...
1791
        add     [ff_ysz], ebx
1903
        add     [ff_ysz], ebx
-
 
1904
 
1792
 
1905
        mov     ebx, [ff_y]
1793
        mov     ebx, [ff_y]
1906
;--------------------------------------
1794
 
1907
align 4
-
 
1908
.ff_new_y:
1795
  .ff_new_y:
1909
        mov     edx, [ff_x]
1796
        mov     edx, [ff_x]
1910
;--------------------------------------
1797
 
1911
align 4
1798
  .ff_new_x:
1912
.ff_new_x:
1799
        ; -- body --
1913
        ; -- body --
1800
        mov     ecx, [ff_scale]
1914
        mov     ecx, [ff_scale]
Line 1812... Line 1926...
1812
        test    al, al
1926
        test    al, al
1813
        jz      @f
1927
        jz      @f
1814
        mov     eax, esi
1928
        mov     eax, esi
1815
        mov     [ebp], al
1929
        mov     [ebp], al
1816
        ; -- end body --
1930
        ; -- end body --
-
 
1931
;--------------------------------------
-
 
1932
align 4
1817
    @@:
1933
@@:
1818
        inc     ebp
1934
        inc     ebp
1819
        inc     edx
1935
        inc     edx
1820
        cmp     edx, [ff_xsz]
1936
        cmp     edx, [ff_xsz]
1821
        jb      .ff_new_x
1937
        jb      .ff_new_x
Line 1827... Line 1943...
1827
        inc     ebx
1943
        inc     ebx
1828
        cmp     ebx, [ff_ysz]
1944
        cmp     ebx, [ff_ysz]
1829
        jb      .ff_new_y
1945
        jb      .ff_new_y
Line 1830... Line 1946...
1830
 
1946
 
-
 
1947
        add     esp, 24
1831
        add     esp, 24
1948
;--------------------------------------
1832
 
1949
align 4
1833
  .exit:
1950
.exit:
1834
        popad
1951
        popad
-
 
1952
        ret
1835
        ret
1953
;--------------------------------------
1836
 
1954
align 4
1837
  .read_byte:
1955
.read_byte:
1838
        ; eax - address
1956
        ; eax - address
1839
        ; esi - slot
1957
        ; esi - slot
1840
        push    eax ecx edx esi
1958
        push    eax ecx edx esi
1841
        xchg    eax, esi
1959
        xchg    eax, esi
1842
        lea     ecx, [esp + 12]
1960
        lea     ecx, [esp + 12]
1843
        mov     edx, 1
1961
        mov     edx, 1
1844
        call    read_process_memory
1962
        call    read_process_memory
1845
        pop     esi edx ecx eax
1963
        pop     esi edx ecx eax
1846
        ret
-
 
-
 
1964
        ret
1847
 
1965
;------------------------------------------------------------------------------
1848
align 4
1966
align 4
1849
;------------------------------------------------------------------------------
1967
;------------------------------------------------------------------------------
1850
window._.window_activate: ;////////////////////////////////////////////////////
1968
window._.window_activate: ;////////////////////////////////////////////////////
1851
;------------------------------------------------------------------------------
1969
;------------------------------------------------------------------------------
Line 1867... Line 1985...
1867
        and     al, 0x0f
1985
        and     al, 0x0f
1868
        cmp     al, 0x03
1986
        cmp     al, 0x03
1869
        je      .set_window_redraw_flag
1987
        je      .set_window_redraw_flag
1870
        cmp     al, 0x04
1988
        cmp     al, 0x04
1871
        jne     .move_others_down
1989
        jne     .move_others_down
-
 
1990
;--------------------------------------
1872
 
1991
align 4
1873
  .set_window_redraw_flag:
1992
.set_window_redraw_flag:
1874
        mov     [window_data + ebx + WDATA.fl_redraw], 1
1993
        mov     [window_data + ebx + WDATA.fl_redraw], 1
-
 
1994
;--------------------------------------
1875
 
1995
align 4
1876
  .move_others_down:
1996
.move_others_down:
1877
        ; ax <- process no
1997
        ; ax <- process no
1878
        movzx   ebx, word[esi]
1998
        movzx   ebx, word[esi]
1879
        ; ax <- position in window stack
1999
        ; ax <- position in window stack
1880
        movzx   ebx, word[WIN_STACK + ebx * 2]
2000
        movzx   ebx, word[WIN_STACK + ebx * 2]
Line 1881... Line 2001...
1881
 
2001
 
1882
        ; drop others
2002
        ; drop others
-
 
2003
        xor     eax, eax
1883
        xor     eax, eax
2004
;--------------------------------------
1884
 
2005
align 4
1885
  .next_stack_window:
2006
.next_stack_window:
1886
        cmp     eax, [TASK_COUNT]
2007
        cmp     eax, [TASK_COUNT]
1887
        jae     .move_self_up
2008
        jae     .move_self_up
Line 1895... Line 2016...
1895
        
2016
        
1896
        cmp     [WIN_STACK + eax * 2], bx
2017
        cmp     [WIN_STACK + eax * 2], bx
1897
        jbe     .next_stack_window
2018
        jbe     .next_stack_window
1898
        dec     word[WIN_STACK + eax * 2]
2019
        dec     word[WIN_STACK + eax * 2]
-
 
2020
        jmp     .next_stack_window
1899
        jmp     .next_stack_window
2021
;--------------------------------------
1900
 
2022
align 4
1901
  .move_self_up:
2023
.move_self_up:
1902
        movzx   ebx, word[esi]
2024
        movzx   ebx, word[esi]
1903
        ; number of processes
2025
        ; number of processes
1904
        mov     ax, [TASK_COUNT]
2026
        mov     ax, [TASK_COUNT]
1905
        ; this is the last (and the upper)
2027
        ; this is the last (and the upper)
Line 1906... Line 2028...
1906
        mov     [WIN_STACK + ebx * 2], ax
2028
        mov     [WIN_STACK + ebx * 2], ax
1907
 
2029
 
-
 
2030
        ; update on screen - window stack
1908
        ; update on screen - window stack
2031
        xor     eax, eax
1909
        xor     eax, eax
2032
;--------------------------------------
1910
 
2033
align 4
1911
  .next_window_pos:
2034
.next_window_pos:
1912
        cmp     eax, [TASK_COUNT]
2035
        cmp     eax, [TASK_COUNT]
1913
        jae     .reset_vars
2036
        jae     .reset_vars
1914
        inc     eax
2037
        inc     eax
1915
        movzx   ebx, word[WIN_STACK + eax * 2]
2038
        movzx   ebx, word[WIN_STACK + eax * 2]
-
 
2039
        mov     [WIN_POS + ebx * 2], ax
1916
        mov     [WIN_POS + ebx * 2], ax
2040
        jmp     .next_window_pos
1917
        jmp     .next_window_pos
2041
;--------------------------------------
1918
 
2042
align 4
1919
  .reset_vars:
2043
.reset_vars:
1920
        mov     byte[KEY_COUNT], 0
2044
        mov     byte[KEY_COUNT], 0
1921
        mov     byte[BTN_COUNT], 0
2045
        mov     byte[BTN_COUNT], 0
Line 1922... Line 2046...
1922
        mov     word[MOUSE_SCROLL_H], 0
2046
        mov     word[MOUSE_SCROLL_H], 0
1923
        mov     word[MOUSE_SCROLL_V], 0
2047
        mov     word[MOUSE_SCROLL_V], 0
1924
 
-
 
1925
        pop     ebx eax
2048
 
1926
        ret
2049
        pop     ebx eax
1927
 
2050
        ret
1928
;------------------------------------------------------------------------------
2051
;------------------------------------------------------------------------------
1929
window._.window_deactivate: ;////////////////////////////////////////////////////
2052
window._.window_deactivate: ;////////////////////////////////////////////////////
1930
;------------------------------------------------------------------------------
2053
;------------------------------------------------------------------------------
1931
;? Deactivate window
2054
;? Deactivate window
1932
;------------------------------------------------------------------------------
2055
;------------------------------------------------------------------------------
1933
;> esi = pointer to WIN_POS+ window data
2056
;> esi = pointer to WIN_POS+ window data
-
 
2057
;------------------------------------------------------------------------------
1934
;------------------------------------------------------------------------------
2058
        push    eax ebx
1935
        push    eax ebx
2059
;--------------------------------------
1936
;------------------------------------------------------------------------------
2060
align 4
1937
.move_others_up:
2061
.move_others_up:
1938
        ; ax <- process no
2062
        ; ax <- process no
1939
        movzx   ebx, word[esi]
2063
        movzx   ebx, word[esi]
1940
        ; ax <- position in window stack
2064
        ; ax <- position in window stack
-
 
2065
        movzx   ebx, word[WIN_STACK + ebx * 2]
-
 
2066
        ; up others
1941
        movzx   ebx, word[WIN_STACK + ebx * 2]
2067
        xor     eax, eax
1942
        ; up others
2068
;--------------------------------------
1943
        xor     eax, eax
2069
align 4
1944
.next_stack_window:
2070
.next_stack_window:
1945
        cmp     eax, [TASK_COUNT]
2071
        cmp     eax, [TASK_COUNT]
1946
        jae     .move_self_down
2072
        jae     .move_self_down
1947
        inc     eax
2073
        inc     eax
1948
        cmp     [WIN_STACK + eax * 2], bx
2074
        cmp     [WIN_STACK + eax * 2], bx
1949
        jae     .next_stack_window
2075
        jae     .next_stack_window
-
 
2076
        inc     word[WIN_STACK + eax * 2]
1950
        inc     word[WIN_STACK + eax * 2]
2077
        jmp     .next_stack_window
1951
        jmp     .next_stack_window
2078
;--------------------------------------
1952
;----------------------------------------------
2079
align 4
1953
.move_self_down:
2080
.move_self_down:
1954
        movzx   ebx, word[esi]
2081
        movzx   ebx, word[esi]
1955
        ; this is the last (and the low)
2082
        ; this is the last (and the low)
-
 
2083
        mov     [WIN_STACK + ebx * 2], word 1
-
 
2084
        ; update on screen - window stack
1956
        mov     [WIN_STACK + ebx * 2], word 1
2085
        xor     eax, eax
1957
        ; update on screen - window stack
2086
;--------------------------------------
1958
        xor     eax, eax
2087
align 4
1959
.next_window_pos:
2088
.next_window_pos:
1960
        cmp     eax, [TASK_COUNT]
2089
        cmp     eax, [TASK_COUNT]
1961
        jae     .reset_vars
2090
        jae     .reset_vars
1962
        inc     eax
2091
        inc     eax
1963
        movzx   ebx, word[WIN_STACK + eax * 2]
2092
        movzx   ebx, word[WIN_STACK + eax * 2]
-
 
2093
        mov     [WIN_POS + ebx * 2], ax
1964
        mov     [WIN_POS + ebx * 2], ax
2094
        jmp     .next_window_pos
1965
        jmp     .next_window_pos
2095
;--------------------------------------
1966
;-----------------------------------------------
2096
align 4
1967
.reset_vars:
2097
.reset_vars:
1968
        mov     byte[KEY_COUNT], 0
2098
        mov     byte[KEY_COUNT], 0
Line 1993... Line 2123...
1993
        sub     eax, window_data
2123
        sub     eax, window_data
1994
        shr     eax, 5
2124
        shr     eax, 5
Line 1995... Line 2125...
1995
 
2125
 
1996
        movzx   eax, word[WIN_STACK + eax * 2]  ; get value of the curr process
2126
        movzx   eax, word[WIN_STACK + eax * 2]  ; get value of the curr process
-
 
2127
        lea     esi, [WIN_POS + eax * 2]        ; get address of this process at 0xC400
1997
        lea     esi, [WIN_POS + eax * 2]        ; get address of this process at 0xC400
2128
;--------------------------------------
1998
 
2129
align 4
1999
  .next_window:
2130
.next_window:
Line 2000... Line 2131...
2000
        add     esi, 2
2131
        add     esi, 2
2001
 
2132
 
Line 2031... Line 2162...
2031
        add     ecx, [window_data + edx + WDATA.box.width]
2162
        add     ecx, [window_data + edx + WDATA.box.width]
2032
        cmp     eax, ecx
2163
        cmp     eax, ecx
2033
        jge     .next_window
2164
        jge     .next_window
Line 2034... Line 2165...
2034
 
2165
 
-
 
2166
        pop     esi edx ebx eax
2035
        pop     esi edx ebx eax
2167
;--------------------------------------
2036
 
2168
align 4
2037
  .exit.redraw:
2169
.exit.redraw:
2038
        xor     ecx, ecx
2170
        xor     ecx, ecx
2039
        inc     ecx
2171
        inc     ecx
-
 
2172
        ret
2040
        ret
2173
;--------------------------------------
2041
 
2174
align 4
2042
  .exit.no_redraw:
2175
.exit.no_redraw:
2043
        pop     esi edx ebx eax
2176
        pop     esi edx ebx eax
2044
        xor     ecx, ecx
2177
        xor     ecx, ecx
2045
        ret
-
 
-
 
2178
        ret
2046
 
2179
;------------------------------------------------------------------------------
2047
align 4
2180
align 4
2048
;------------------------------------------------------------------------------
2181
;------------------------------------------------------------------------------
2049
window._.draw_window_caption: ;////////////////////////////////////////////////
2182
window._.draw_window_caption: ;////////////////////////////////////////////////
2050
;------------------------------------------------------------------------------
2183
;------------------------------------------------------------------------------
Line 2054... Line 2187...
2054
        mov     edx, [TASK_COUNT]
2187
        mov     edx, [TASK_COUNT]
2055
        movzx   edx, word[WIN_POS + edx * 2]
2188
        movzx   edx, word[WIN_POS + edx * 2]
2056
        cmp     edx, [CURRENT_TASK]
2189
        cmp     edx, [CURRENT_TASK]
2057
        jne     @f
2190
        jne     @f
2058
        inc     eax
2191
        inc     eax
-
 
2192
;--------------------------------------
-
 
2193
align 4
2059
    @@:
2194
@@:
2060
        mov     edx, [CURRENT_TASK]
2195
        mov     edx, [CURRENT_TASK]
2061
        shl     edx, 5
2196
        shl     edx, 5
2062
        add     edx, window_data
2197
        add     edx, window_data
2063
        movzx   ebx, [edx + WDATA.fl_wstyle]
2198
        movzx   ebx, [edx + WDATA.fl_wstyle]
Line 2066... Line 2201...
2066
        je      .draw_caption_style_3
2201
        je      .draw_caption_style_3
2067
        cmp     bl, 4
2202
        cmp     bl, 4
2068
        je      .draw_caption_style_3
2203
        je      .draw_caption_style_3
Line 2069... Line 2204...
2069
 
2204
 
-
 
2205
        jmp     .not_style_3
2070
        jmp     .not_style_3
2206
;--------------------------------------
2071
 
2207
align 4
2072
  .draw_caption_style_3:
2208
.draw_caption_style_3:
2073
        push    edx
2209
        push    edx
2074
        call    drawwindow_IV_caption
2210
        call    drawwindow_IV_caption
2075
        add     esp, 4
2211
        add     esp, 4
-
 
2212
        jmp     .2
2076
        jmp     .2
2213
;--------------------------------------
2077
 
2214
align 4
2078
  .not_style_3:
2215
.not_style_3:
2079
        cmp     bl, 2
2216
        cmp     bl, 2
Line 2080... Line 2217...
2080
        jne     .not_style_2
2217
        jne     .not_style_2
2081
 
2218
 
-
 
2219
        call    drawwindow_III_caption
2082
        call    drawwindow_III_caption
2220
        jmp     .2
2083
        jmp     .2
2221
;--------------------------------------
2084
 
2222
align 4
2085
  .not_style_2:
2223
.not_style_2:
Line 2086... Line 2224...
2086
        cmp     bl, 0
2224
        cmp     bl, 0
-
 
2225
        jne     .2
2087
        jne     .2
2226
 
2088
 
2227
        call    drawwindow_I_caption
2089
        call    drawwindow_I_caption
2228
;--------------------------------------
2090
 
2229
align 4
2091
  .2:
2230
.2:
2092
        mov     edi, [CURRENT_TASK]
2231
        mov     edi, [CURRENT_TASK]
Line 2103... Line 2242...
2103
        je      .skinned
2242
        je      .skinned
2104
        cmp     al, 4
2243
        cmp     al, 4
2105
        je      .skinned
2244
        je      .skinned
Line 2106... Line 2245...
2106
 
2245
 
-
 
2246
        jmp     .not_skinned
2107
        jmp     .not_skinned
2247
;--------------------------------------
2108
 
2248
align 4
2109
  .skinned:
2249
.skinned:
2110
        mov     ebp, [edi + window_data + WDATA.box.left - 2]
2250
        mov     ebp, [edi + window_data + WDATA.box.left - 2]
2111
        mov     bp, word[edi + window_data + WDATA.box.top]
2251
        mov     bp, word[edi + window_data + WDATA.box.top]
2112
        movzx   eax, word[edi + window_data + WDATA.box.width]
2252
        movzx   eax, word[edi + window_data + WDATA.box.width]
Line 2130... Line 2270...
2130
        adc     bx, 0
2270
        adc     bx, 0
2131
        add     bx, [_skinmargins.top]
2271
        add     bx, [_skinmargins.top]
2132
        add     bx, -3
2272
        add     bx, -3
2133
        add     ebx, ebp
2273
        add     ebx, ebp
2134
        jmp     .dodraw
2274
        jmp     .dodraw
-
 
2275
;--------------------------------------
2135
 
2276
align 4
2136
  .not_skinned:
2277
.not_skinned:
2137
        cmp     al, 1
2278
        cmp     al, 1
2138
        je      .exit
2279
        je      .exit
Line 2139... Line 2280...
2139
 
2280
 
Line 2151... Line 2292...
2151
        js      .exit
2292
        js      .exit
Line 2152... Line 2293...
2152
 
2293
 
2153
        mov     esi, eax
2294
        mov     esi, eax
2154
        mov     ebx, 0x00080007
2295
        mov     ebx, 0x00080007
-
 
2296
        add     ebx, ebp
2155
        add     ebx, ebp
2297
;--------------------------------------
2156
 
2298
align 4
2157
  .dodraw:
2299
.dodraw:
2158
        mov     ecx, [common_colours + 16]
2300
        mov     ecx, [common_colours + 16]
2159
        or      ecx, 0x80000000
2301
        or      ecx, 0x80000000
2160
        xor     edi, edi
2302
        xor     edi, edi
-
 
2303
        call    dtext_asciiz_esi
2161
        call    dtext_asciiz_esi
2304
;--------------------------------------
2162
 
2305
align 4
2163
  .exit:
2306
.exit:
2164
        call    [draw_pointer]
2307
        call    [draw_pointer]
2165
        ret
-
 
-
 
2308
        ret
2166
 
2309
;------------------------------------------------------------------------------
2167
align 4
2310
align 4
2168
;------------------------------------------------------------------------------
2311
;------------------------------------------------------------------------------
2169
window._.draw_negative_box: ;//////////////////////////////////////////////////
2312
window._.draw_negative_box: ;//////////////////////////////////////////////////
2170
;------------------------------------------------------------------------------
2313
;------------------------------------------------------------------------------
2171
;? Draw negative box
2314
;? Draw negative box
2172
;------------------------------------------------------------------------------
2315
;------------------------------------------------------------------------------
2173
;> edi = pointer to BOX struct
2316
;> edi = pointer to BOX struct
2174
;------------------------------------------------------------------------------
2317
;------------------------------------------------------------------------------
2175
        push    eax ebx esi
2318
        push    eax ebx esi
-
 
2319
        mov     esi, 0x01000000
-
 
2320
;--------------------------------------
2176
        mov     esi, 0x01000000
2321
align 4
2177
.1:
2322
.1:
2178
        mov     eax, [edi + BOX.left - 2]
2323
        mov     eax, [edi + BOX.left - 2]
2179
        mov     ax, word[edi + BOX.left]
2324
        mov     ax, word[edi + BOX.left]
2180
        add     ax, word[edi + BOX.width]
2325
        add     ax, word[edi + BOX.width]
Line 2183... Line 2328...
2183
        add     bx, word[edi + BOX.height]
2328
        add     bx, word[edi + BOX.height]
2184
        call    draw_rectangle.forced
2329
        call    draw_rectangle.forced
2185
        pop     esi ebx eax
2330
        pop     esi ebx eax
2186
        ret
2331
        ret
2187
;------------------------------------------------------------------------------
2332
;------------------------------------------------------------------------------
-
 
2333
align 4
-
 
2334
;------------------------------------------------------------------------------
2188
window._.end_moving__box: ;//////////////////////////////////////////////////
2335
window._.end_moving__box: ;//////////////////////////////////////////////////
2189
;------------------------------------------------------------------------------
2336
;------------------------------------------------------------------------------
2190
;? Draw positive box
2337
;? Draw positive box
2191
;------------------------------------------------------------------------------
2338
;------------------------------------------------------------------------------
2192
;> edi = pointer to BOX struct
2339
;> edi = pointer to BOX struct
2193
;------------------------------------------------------------------------------
2340
;------------------------------------------------------------------------------
2194
        push    eax ebx esi
2341
        push    eax ebx esi
2195
        xor     esi, esi
2342
        xor     esi, esi
2196
        jmp     window._.draw_negative_box.1
2343
        jmp     window._.draw_negative_box.1
2197
 
-
 
-
 
2344
;------------------------------------------------------------------------------
2198
 
2345
align 4
2199
;------------------------------------------------------------------------------
2346
;------------------------------------------------------------------------------
2200
window._.get_rect: ;/////////////////////////////////////////////////////
2347
window._.get_rect: ;/////////////////////////////////////////////////////
2201
;------------------------------------------------------------------------------
2348
;------------------------------------------------------------------------------
2202
;?   void __fastcall get_window_rect(struct RECT* rc);
2349
;?   void __fastcall get_window_rect(struct RECT* rc);
2203
;------------------------------------------------------------------------------
2350
;------------------------------------------------------------------------------
Line 2214... Line 2361...
2214
        mov     edx, [eax-twdw + WDATA.box.top]
2361
        mov     edx, [eax-twdw + WDATA.box.top]
2215
        mov     [ecx+RECT.top], edx
2362
        mov     [ecx+RECT.top], edx
Line 2216... Line 2363...
2216
 
2363
 
2217
        add     edx, [eax-twdw + WDATA.box.height]
2364
        add     edx, [eax-twdw + WDATA.box.height]
2218
        mov     [ecx+RECT.bottom], edx
-
 
2219
 
2365
        mov     [ecx+RECT.bottom], edx
2220
        ret
-
 
-
 
2366
        ret