Subversion Repositories Kolibri OS

Rev

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

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