Subversion Repositories Kolibri OS

Rev

Rev 5363 | Rev 5836 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

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