Subversion Repositories Kolibri OS

Rev

Rev 5565 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 5565 Rev 5984
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: 5565 $
9
$Revision: 5984 $
10
 
10
 
11
;==============================================================================
11
;==============================================================================
Line 28... Line 28...
28
uglobal
28
uglobal
29
  common_colours rd 48
29
  common_colours rd 48
30
  draw_limits    RECT
30
  draw_limits    RECT
31
endg
31
endg
Line 32... Line -...
32
 
-
 
33
align 4
32
 
34
;------------------------------------------------------------------------------
33
;------------------------------------------------------------------------------
35
syscall_draw_window: ;///// system function 0 /////////////////////////////////
34
syscall_draw_window: ;///// system function 0 /////////////////////////////////
36
;------------------------------------------------------------------------------
-
 
37
;? .
-
 
38
;------------------------------------------------------------------------------
35
;------------------------------------------------------------------------------
39
        mov     eax, edx
36
        mov     eax, edx
40
        shr     eax, 24
37
        shr     eax, 24
41
        and     al, 0x0f
38
        and     al, 0x0f
42
        cmp     al, 5
39
        cmp     al, 5
Line 51... Line 48...
51
 
48
 
52
        ; type I - original style
49
; type I - original style
53
        call    drawwindow_I
50
        call    drawwindow_I
54
        jmp     window._.draw_window_caption.2
51
        jmp     window._.draw_window_caption.2
55
;--------------------------------------
-
 
56
align 4
52
;--------------------------------------
57
@@:
53
@@:
58
        dec     al
54
        dec     al
Line 59... Line 55...
59
        jnz     @f
55
        jnz     @f
60
 
-
 
61
        ; type II - only reserve area, no draw
-
 
62
;        call    sys_window_mouse
56
 
63
;        call    [draw_pointer]
57
; type II - only reserve area, no draw
64
        call    __sys_draw_pointer
58
        call    __sys_draw_pointer
65
        jmp     .exit
-
 
66
;--------------------------------------
59
        jmp     .exit
67
align 4
60
;--------------------------------------
68
@@:
61
@@:
Line 69... Line 62...
69
        dec     al
62
        dec     al
70
        jnz     @f
63
        jnz     @f
71
 
64
 
72
        ; type III  - new style
-
 
73
        call    drawwindow_III
-
 
74
        jmp     window._.draw_window_caption.2
65
; type III  - new style
75
 
-
 
76
        ; type IV & V - skinned window (resizable & not)
66
        call    drawwindow_III
-
 
67
        jmp     window._.draw_window_caption.2
77
;--------------------------------------
68
;--------------------------------------
78
align 4
69
@@:
79
@@:
70
; type IV & V - skinned window (resizable & not)
80
        mov     eax, [TASK_COUNT]
71
        mov     eax, [TASK_COUNT]
81
        movzx   eax, word[WIN_POS + eax * 2]
72
        movzx   eax, word[WIN_POS + eax * 2]
82
        cmp     eax, [CURRENT_TASK]
73
        cmp     eax, [CURRENT_TASK]
83
        setz    al
74
        setz    al
84
        movzx   eax, al
75
        movzx   eax, al
85
        push    eax
76
        push    eax
86
        call    drawwindow_IV
-
 
87
        jmp     window._.draw_window_caption.2
77
        call    drawwindow_IV
88
;--------------------------------------
78
        jmp     window._.draw_window_caption.2
89
align 4
79
;--------------------------------------
90
.exit:
-
 
91
        ret
-
 
92
;------------------------------------------------------------------------------
80
.exit:
93
align 4
81
        ret
94
;------------------------------------------------------------------------------
82
;------------------------------------------------------------------------------
95
syscall_display_settings: ;///// system function 48 ///////////////////////////
83
syscall_display_settings: ;///// system function 48 ///////////////////////////
96
;------------------------------------------------------------------------------
84
;------------------------------------------------------------------------------
Line 132... Line 120...
132
; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
120
; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
133
;; Set skin:
121
;; Set skin:
134
;< ebx = 8
122
;< ebx = 8
135
;< ecx = pointer to FileInfoBlock struct
123
;< ecx = pointer to FileInfoBlock struct
136
;> eax = FS error code
124
;> eax = FS error code
-
 
125
; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
 
126
;; Get font smoothing:
-
 
127
;< ebx = 9
-
 
128
;> eax = 0 — off, 1 — on, 2 — subpixel
-
 
129
; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
 
130
;; Set font smoothing:
-
 
131
;< ebx = 10
-
 
132
;< ecx = 0 — off, 1 — on, 2 — subpixel
-
 
133
; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
 
134
;; Get font size:
-
 
135
;< ebx = 11
-
 
136
;> eax = height in pixels
-
 
137
; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
 
138
;; Set font size:
-
 
139
;< ebx = 12
-
 
140
;< ecx = height in pixels
137
;------------------------------------------------------------------------------
141
;------------------------------------------------------------------------------
138
        cmp     ebx, .sizeof.ftable / 4
142
        cmp     ebx, .sizeof.ftable / 4
139
        ja      @f
143
        ja      @f
140
        jmp     [.ftable + ebx * 4]
144
        jmp     [.ftable + ebx * 4]
141
;--------------------------------------
-
 
142
align 4
-
 
143
@@:
-
 
144
        ret
-
 
145
;------------------------------------------------------------------------------
145
;------------------------------------------------------------------------------
146
align 4
-
 
147
syscall_display_settings.00:
146
syscall_display_settings.00:
148
        xor     eax, eax
147
        xor     eax, eax
149
        inc     ebx
148
        inc     ebx
150
        cmp     [windowtypechanged], ebx
149
        cmp     [windowtypechanged], ebx
151
        jne     .exit
150
        jne     @f
152
        mov     [windowtypechanged], eax
151
        mov     [windowtypechanged], eax
153
 
-
 
154
        jmp     syscall_display_settings._.redraw_whole_screen
152
        jmp     syscall_display_settings._.redraw_whole_screen
155
;--------------------------------------
-
 
156
align 4
-
 
157
.exit:
-
 
158
        ret
-
 
159
;------------------------------------------------------------------------------
153
;------------------------------------------------------------------------------
160
align 4
-
 
161
syscall_display_settings.01:
154
syscall_display_settings.01:
162
        and     ecx, 1
155
        and     ecx, 1
163
        cmp     ecx, [buttontype]
156
        cmp     ecx, [buttontype]
164
        je      .exit
157
        je      @f
165
        mov     [buttontype], ecx
158
        mov     [buttontype], ecx
166
        mov     [windowtypechanged], ebx
159
        mov     [windowtypechanged], ebx
167
;--------------------------------------
-
 
168
align 4
-
 
169
  .exit:
160
@@:
170
        ret
161
        ret
171
;------------------------------------------------------------------------------
162
;------------------------------------------------------------------------------
172
align 4
-
 
173
syscall_display_settings.02:
163
syscall_display_settings.02:
174
        dec     ebx
164
        dec     ebx
175
        mov     esi, ecx
165
        mov     esi, ecx
176
        cmp     edx, 192
166
        cmp     edx, 192
177
        jnae    @f
167
        jnae    @f
Line 181... Line 171...
181
        mov     ecx, edx
171
        mov     ecx, edx
182
        rep movsb
172
        rep movsb
183
        mov     [windowtypechanged], ebx
173
        mov     [windowtypechanged], ebx
184
        ret
174
        ret
185
;------------------------------------------------------------------------------
175
;------------------------------------------------------------------------------
186
align 4
-
 
187
syscall_display_settings.03:
176
syscall_display_settings.03:
188
        mov     edi, ecx
177
        mov     edi, ecx
189
        cmp     edx, 192
178
        cmp     edx, 192
190
        jnae    @f
179
        jnae    @f
191
        mov     edx, 192 ; max size
180
        mov     edx, 192 ; max size
Line 193... Line 182...
193
        mov     esi, common_colours
182
        mov     esi, common_colours
194
        mov     ecx, edx
183
        mov     ecx, edx
195
        rep movsb
184
        rep movsb
196
        ret
185
        ret
197
;------------------------------------------------------------------------------
186
;------------------------------------------------------------------------------
198
align 4
-
 
199
syscall_display_settings.04:
187
syscall_display_settings.04:
200
        mov     eax, [_skinh]
188
        mov     eax, [_skinh]
201
        mov     [esp + 32], eax
189
        mov     [esp + 32], eax
202
        ret
190
        ret
203
;------------------------------------------------------------------------------
191
;------------------------------------------------------------------------------
204
align 4
-
 
205
syscall_display_settings.05:
192
syscall_display_settings.05:
206
        mov     eax, [screen_workarea.left - 2]
193
        mov     eax, [screen_workarea.left - 2]
207
        mov     ax, word[screen_workarea.right]
194
        mov     ax, word[screen_workarea.right]
208
        mov     [esp + 32], eax
195
        mov     [esp + 32], eax
209
        mov     eax, [screen_workarea.top - 2]
196
        mov     eax, [screen_workarea.top - 2]
210
        mov     ax, word[screen_workarea.bottom]
197
        mov     ax, word[screen_workarea.bottom]
211
        mov     [esp + 20], eax
198
        mov     [esp + 20], eax
212
        ret
199
        ret
213
;------------------------------------------------------------------------------
200
;------------------------------------------------------------------------------
214
align 4
-
 
215
syscall_display_settings.06:
201
syscall_display_settings.06:
216
        xor     esi, esi
202
        xor     esi, esi
217
 
-
 
218
        mov     edi, [_display.width]
203
        mov     edi, [_display.width]
219
        dec     edi
204
        dec     edi
220
        mov     eax, ecx
205
        mov     eax, ecx
221
        movsx   ebx, ax
206
        movsx   ebx, ax
222
        sar     eax, 16
207
        sar     eax, 16
Line 224... Line 209...
224
        jge     .check_horizontal
209
        jge     .check_horizontal
225
        inc     esi
210
        inc     esi
226
        or      eax, eax
211
        or      eax, eax
227
        jge     @f
212
        jge     @f
228
        xor     eax, eax
213
        xor     eax, eax
229
;--------------------------------------
-
 
230
align 4
-
 
231
@@:
214
@@:
232
        mov     [screen_workarea.left], eax
215
        mov     [screen_workarea.left], eax
233
        cmp     ebx, edi
216
        cmp     ebx, edi
234
        jle     @f
217
        jle     @f
235
        mov     ebx, edi
218
        mov     ebx, edi
236
;--------------------------------------
-
 
237
align 4
-
 
238
@@:
219
@@:
239
        mov     [screen_workarea.right], ebx
220
        mov     [screen_workarea.right], ebx
240
;--------------------------------------
-
 
241
align 4
-
 
242
.check_horizontal:
221
.check_horizontal:
243
        mov     edi, [_display.height]
222
        mov     edi, [_display.height]
244
        dec     edi
223
        dec     edi
245
        mov     eax, edx
224
        mov     eax, edx
246
        movsx   ebx, ax
225
        movsx   ebx, ax
Line 249... Line 228...
249
        jge     .check_if_redraw_needed
228
        jge     .check_if_redraw_needed
250
        inc     esi
229
        inc     esi
251
        or      eax, eax
230
        or      eax, eax
252
        jge     @f
231
        jge     @f
253
        xor     eax, eax
232
        xor     eax, eax
254
;--------------------------------------
-
 
255
align 4
-
 
256
@@:
233
@@:
257
        mov     [screen_workarea.top], eax
234
        mov     [screen_workarea.top], eax
258
        cmp     ebx, edi
235
        cmp     ebx, edi
259
        jle     @f
236
        jle     @f
260
        mov     ebx, edi
237
        mov     ebx, edi
261
;--------------------------------------
-
 
262
align 4
-
 
263
@@:
238
@@:
264
        mov     [screen_workarea.bottom], ebx
239
        mov     [screen_workarea.bottom], ebx
265
;--------------------------------------
-
 
266
align 4
-
 
267
.check_if_redraw_needed:
240
.check_if_redraw_needed:
268
        or      esi, esi
241
        or      esi, esi
269
        jz      .exit
242
        jz      @f
Line 270... Line 243...
270
 
243
 
271
        call    repos_windows
244
        call    repos_windows
272
        jmp     syscall_display_settings._.calculate_whole_screen
-
 
273
;--------------------------------------
-
 
274
align 4
-
 
275
.exit:
-
 
276
        ret
245
        jmp     syscall_display_settings._.calculate_whole_screen
277
;------------------------------------------------------------------------------
-
 
278
align 4
246
;------------------------------------------------------------------------------
279
syscall_display_settings.07:
247
syscall_display_settings.07:
280
        mov     eax, [_skinmargins + 0]
248
        mov     eax, [_skinmargins + 0]
281
        mov     [esp + 32], eax
249
        mov     [esp + 32], eax
282
        mov     eax, [_skinmargins + 4]
250
        mov     eax, [_skinmargins + 4]
-
 
251
        mov     [esp + 20], eax
283
        mov     [esp + 20], eax
252
@@:
284
        ret
253
        ret
285
;------------------------------------------------------------------------------
-
 
286
align 4
254
;------------------------------------------------------------------------------
287
syscall_display_settings.08:
255
syscall_display_settings.08:
288
        mov     ebx, ecx
256
        mov     ebx, ecx
289
        call    read_skin_file
257
        call    read_skin_file
290
        mov     [esp + 32], eax
258
        mov     [esp + 32], eax
291
        test    eax, eax
259
        test    eax, eax
Line 292... Line 260...
292
        jnz     .exit
260
        jnz     @b
293
 
261
 
-
 
262
        call    syscall_display_settings._.calculate_whole_screen
-
 
263
        jmp     syscall_display_settings._.redraw_whole_screen
-
 
264
;------------------------------------------------------------------------------
-
 
265
syscall_display_settings.09:
-
 
266
        xor     eax, eax
-
 
267
        mov     al, [fontSmoothing]
294
        call    syscall_display_settings._.calculate_whole_screen
268
        mov     [esp + 32], eax
-
 
269
        ret
-
 
270
;------------------------------------------------------------------------------
295
        jmp     syscall_display_settings._.redraw_whole_screen
271
syscall_display_settings.10:
-
 
272
        mov     [fontSmoothing], cl
-
 
273
        ret
-
 
274
;------------------------------------------------------------------------------
-
 
275
syscall_display_settings.11:
-
 
276
        xor     eax, eax
296
;--------------------------------------
277
        mov     al, [fontSize]
-
 
278
        mov     [esp + 32], eax
-
 
279
        ret
-
 
280
;------------------------------------------------------------------------------
297
align 4
281
syscall_display_settings.12:
298
.exit:
282
        mov     [fontSize], cl
299
        ret
-
 
300
;------------------------------------------------------------------------------
283
        ret
301
align 4
284
;------------------------------------------------------------------------------
302
syscall_display_settings._.calculate_whole_screen:
285
syscall_display_settings._.calculate_whole_screen:
303
        xor     eax, eax
286
        xor     eax, eax
304
        xor     ebx, ebx
287
        xor     ebx, ebx
305
        mov     ecx, [_display.width]
288
        mov     ecx, [_display.width]
306
        mov     edx, [_display.height]
289
        mov     edx, [_display.height]
307
        dec     ecx
290
        dec     ecx
308
        dec     edx
291
        dec     edx
309
        jmp     calculatescreen
-
 
310
;------------------------------------------------------------------------------
292
        jmp     calculatescreen
311
align 4
293
;------------------------------------------------------------------------------
312
syscall_display_settings._.redraw_whole_screen:
294
syscall_display_settings._.redraw_whole_screen:
313
        xor     eax, eax
295
        xor     eax, eax
314
        mov     [draw_limits.left], eax
296
        mov     [draw_limits.left], eax
Line 320... Line 302...
320
        dec     eax
302
        dec     eax
321
        mov     [draw_limits.bottom], eax
303
        mov     [draw_limits.bottom], eax
322
        mov     eax, window_data
304
        mov     eax, window_data
323
        jmp     redrawscreen
305
        jmp     redrawscreen
324
;------------------------------------------------------------------------------
306
;------------------------------------------------------------------------------
325
align 4
-
 
326
;------------------------------------------------------------------------------
-
 
327
syscall_set_window_shape: ;///// system function 50 ///////////////////////////
307
syscall_set_window_shape: ;///// system function 50 ///////////////////////////
328
;------------------------------------------------------------------------------
308
;------------------------------------------------------------------------------
329
;; Set window shape address:
309
;; Set window shape address:
330
;> ebx = 0
310
;> ebx = 0
331
;> ecx = shape data address
311
;> ecx = shape data address
Line 404... Line 384...
404
align 4
384
align 4
405
@@:
385
@@:
406
        call    window._.set_window_box
386
        call    window._.set_window_box
407
        add     esp, sizeof.BOX
387
        add     esp, sizeof.BOX
Line 408... Line -...
408
 
-
 
409
        ; NOTE: do we really need this? to be reworked
-
 
410
;       mov     byte[DONT_DRAW_MOUSE], 0 ; mouse pointer
-
 
411
;       mov     byte[MOUSE_BACKGROUND], 0 ; no mouse under
-
 
412
;       mov     byte[MOUSE_DOWN], 0 ; react to mouse up/down
-
 
413
 
-
 
414
        ; NOTE: do we really need this? to be reworked
-
 
415
;       call    [draw_pointer]
-
 
416
;--------------------------------------
-
 
417
align 4
388
 
418
.exit:
389
.exit:
419
        ret
390
        ret
420
;------------------------------------------------------------------------------
-
 
421
align 4
-
 
422
;------------------------------------------------------------------------------
391
;------------------------------------------------------------------------------
423
syscall_window_settings: ;///// system function 71 /////////////////////////////
392
syscall_window_settings: ;///// system function 71 ////////////////////////////
424
;------------------------------------------------------------------------------
-
 
425
;? 
-
 
426
;------------------------------------------------------------------------------
-
 
427
        dec     ebx     ; subfunction #1 - set window caption
-
 
428
        jnz     .exit_fail
-
 
429
 
-
 
430
        ; NOTE: only window owner thread can set its caption,
-
 
431
        ;       so there's no parameter for PID/TID
-
 
432
 
393
;------------------------------------------------------------------------------
433
        mov     edi, [CURRENT_TASK]
394
        mov     edi, [CURRENT_TASK]
434
        shl     edi, 5
-
 
435
 
395
        shl     edi, 5
436
        mov     [edi * 8 + SLOT_BASE + APPDATA.wnd_caption], ecx
396
        mov     [edi * 8 + SLOT_BASE + APPDATA.wnd_caption], ecx
437
        or      [edi + window_data + WDATA.fl_wstyle], WSTYLE_HASCAPTION
-
 
438
 
397
        or      [edi + window_data + WDATA.fl_wstyle], WSTYLE_HASCAPTION
439
        call    window._.draw_window_caption
-
 
440
 
-
 
441
        xor     eax, eax ; eax = 0 (success)
-
 
442
        ret
-
 
443
 
-
 
444
;  .get_window_caption:
-
 
445
;        dec     eax     ; subfunction #2 - get window caption
-
 
446
;        jnz     .exit_fail
-
 
447
 
-
 
448
        ; not implemented yet
-
 
449
;--------------------------------------
-
 
450
align 4
-
 
451
.exit_fail:
-
 
452
        xor     eax, eax
-
 
453
        inc     eax     ; eax = 1 (fail)
-
 
454
        ret
398
        jmp     window._.draw_window_caption
455
;------------------------------------------------------------------------------
399
;------------------------------------------------------------------------------
456
align 4
-
 
457
;------------------------------------------------------------------------------
400
align 4
458
set_window_defaults: ;/////////////////////////////////////////////////////////
401
set_window_defaults: ;/////////////////////////////////////////////////////////
459
;------------------------------------------------------------------------------
-
 
460
;? 
-
 
461
;------------------------------------------------------------------------------
402
;------------------------------------------------------------------------------
462
        mov     byte [window_data + 0x20 + WDATA.cl_titlebar + 3], 1 ; desktop is not movable
403
        mov     byte [window_data + 0x20 + WDATA.cl_titlebar + 3], 1 ; desktop is not movable
463
        push    eax ecx
404
        push    eax ecx
464
        xor     eax, eax
405
        xor     eax, eax
465
        mov     ecx, WIN_STACK
406
        mov     ecx, WIN_STACK
Line 475... Line 416...
475
        cmp     ecx, WIN_POS - 2
416
        cmp     ecx, WIN_POS - 2
476
        jne     @b
417
        jne     @b
477
        pop     ecx eax
418
        pop     ecx eax
478
        ret
419
        ret
479
;------------------------------------------------------------------------------
420
;------------------------------------------------------------------------------
-
 
421
 
480
align 4
422
align 4
481
;------------------------------------------------------------------------------
423
;------------------------------------------------------------------------------
482
calculatescreen: ;/////////////////////////////////////////////////////////////
424
calculatescreen: ;/////////////////////////////////////////////////////////////
483
;------------------------------------------------------------------------------
425
;------------------------------------------------------------------------------
484
;? Scan all windows from bottom to top, calling `setscreen` for each one
426
;? Scan all windows from bottom to top, calling `setscreen` for each one
Line 500... Line 442...
500
 
442
 
501
        mov     ebp, [TASK_COUNT]
443
        mov     ebp, [TASK_COUNT]
502
        cmp     ebp, 1
444
        cmp     ebp, 1
Line -... Line 445...
-
 
445
        jbe     .exit
-
 
446
 
503
        jbe     .exit
447
        push    eax ;for num layout
-
 
448
 
-
 
449
        push    edx ecx ebx eax
-
 
450
 
-
 
451
        mov     dword[esp+10h], ZPOS_DESKTOP
-
 
452
;--------------------------------------
-
 
453
align 4
-
 
454
.layout:
504
 
455
        mov     esi, 1          ; = num in window stack
505
        push    edx ecx ebx eax
456
        mov     ebp, [TASK_COUNT]
506
;--------------------------------------
457
;--------------------------------------
507
align 4
458
align 4
508
.next_window:
459
.next_window:
Line 509... Line 460...
509
        movzx   edi, word[WIN_POS + esi * 2]
460
        movzx   edi, word[WIN_POS + esi * 2]
510
        shl     edi, 5
461
        shl     edi, 5                  ;size of TASKDATA and WDATA = 32 bytes
Line 511... Line 462...
511
 
462
 
512
        cmp     [CURRENT_TASK + edi + TASKDATA.state], TSTATE_FREE
463
        cmp     [CURRENT_TASK + edi + TASKDATA.state], TSTATE_FREE
513
        je      .skip_window
464
        je      .skip_window
Line -... Line 465...
-
 
465
 
-
 
466
        add     edi, window_data
-
 
467
        test    [edi + WDATA.fl_wstate], WSTATE_MINIMIZED
-
 
468
        jnz     .skip_window
514
 
469
 
515
        add     edi, window_data
470
        mov     eax, [esp+10h]
516
        test    [edi + WDATA.fl_wstate], WSTATE_MINIMIZED
471
        cmp     [edi + WDATA.z_modif], al
517
        jnz     .skip_window
472
        jne     .skip_window
518
 
473
 
Line 563... Line 518...
563
align 4
518
align 4
564
.skip_window:
519
.skip_window:
565
        inc     esi
520
        inc     esi
566
        dec     ebp
521
        dec     ebp
567
        jnz     .next_window
522
        jnz     .next_window
-
 
523
;---------------------------------------------
-
 
524
        inc     dword[esp+10h]
-
 
525
        cmp     dword[esp+10h], ZPOS_ALWAYS_TOP
-
 
526
        jle     .layout
-
 
527
;---------------------------------------------
-
 
528
        mov     esi, [TASK_COUNT]
-
 
529
        movzx   edi, word[WIN_POS + esi * 2]
-
 
530
        shl     edi, 5
-
 
531
        add     edi, window_data
Line 568... Line 532...
568
 
532
 
-
 
533
        pop     eax ebx ecx edx
569
        pop     eax ebx ecx edx
534
        pop     ebp     ;del num layout
570
;--------------------------------------
535
;--------------------------------------
571
align 4
536
align 4
572
.exit:
537
.exit:
573
        pop     ebp
538
        pop     ebp
Line 1017... Line 982...
1017
        add     edx, ebx
982
        add     edx, ebx
Line 1018... Line 983...
1018
 
983
 
1019
        mov     edi, [TASK_COUNT]
984
        mov     edi, [TASK_COUNT]
1020
        movzx   esi, word[WIN_POS + edi * 2]
985
        movzx   esi, word[WIN_POS + edi * 2]
-
 
986
        call    window._.set_screen
-
 
987
 
-
 
988
        call    window._.set_top_wnd
1021
        call    window._.set_screen
989
 
1022
        inc     [_display.mask_seqno]
990
        inc     [_display.mask_seqno]
Line 1023... Line 991...
1023
        popad
991
        popad
1024
 
992
 
Line 1186... Line 1154...
1186
        mov     ecx, [edi + WDATA.box.width]
1154
        mov     ecx, [edi + WDATA.box.width]
1187
        mov     edx, [edi + WDATA.box.height]
1155
        mov     edx, [edi + WDATA.box.height]
1188
        add     ecx, eax
1156
        add     ecx, eax
1189
        add     edx, ebx
1157
        add     edx, ebx
1190
        call    ebp
1158
        call    ebp
-
 
1159
 
-
 
1160
        cmp     ebp, window._.set_screen
-
 
1161
        jne     @f
-
 
1162
        call    window._.set_top_wnd
-
 
1163
    @@:
1191
        inc     [_display.mask_seqno]
1164
        inc     [_display.mask_seqno]
1192
;--------------------------------------
1165
;--------------------------------------
1193
align 4
1166
align 4
1194
.exit:
1167
.exit:
1195
        popfd
1168
        popfd
Line 1372... Line 1345...
1372
 
1345
 
1373
        mov     edi, esi
1346
        mov     edi, esi
1374
        shl     edi, 5
1347
        shl     edi, 5
Line -... Line 1348...
-
 
1348
        add     edi, window_data
-
 
1349
 
-
 
1350
        test    [fl_moving], 1
-
 
1351
        jz      @f
-
 
1352
 
-
 
1353
        push    edi
-
 
1354
        mov     edi, ebx
-
 
1355
        call    window._.draw_negative_box
-
 
1356
        pop     edi
1375
        add     edi, window_data
1357
    @@:
1376
 
1358
 
1377
        mov     eax, ebx
1359
        mov     eax, ebx
1378
        mov     bl, [edi + WDATA.fl_wstate]
1360
        mov     bl, [edi + WDATA.fl_wstate]
1379
        call    window._.set_window_box
1361
        call    window._.set_window_box
Line 1398... Line 1380...
1398
;///// private functions //////////////////////////////////////////////////////
1380
;///// private functions //////////////////////////////////////////////////////
1399
;==============================================================================
1381
;==============================================================================
Line 1400... Line 1382...
1400
 
1382
 
1401
iglobal
1383
iglobal
1402
  FuncTable syscall_display_settings, ftable, \
1384
  FuncTable syscall_display_settings, ftable, \
Line 1403... Line 1385...
1403
    00, 01, 02, 03, 04, 05, 06, 07, 08
1385
    00, 01, 02, 03, 04, 05, 06, 07, 08, 09, 10, 11, 12
1404
 
1386
 
1405
  align 4
1387
  align 4
1406
  window_topleft dd \
1388
  window_topleft dd \
Line 1509... Line 1491...
1509
        xchg    eax, esi
1491
        xchg    eax, esi
1510
        xchg    ebx, esi
1492
        xchg    ebx, esi
1511
        call    memmove
1493
        call    memmove
1512
        mov     eax, ebx
1494
        mov     eax, ebx
1513
        mov     ebx, esi
1495
        mov     ebx, esi
1514
 
-
 
1515
        call    window._.check_window_position
1496
        call    window._.check_window_position
1516
        call    window._.set_window_clientbox
1497
        call    window._.set_window_clientbox
1517
        call    window._.invalidate_screen
1498
        call    window._.invalidate_screen
Line 1518... Line 1499...
1518
 
1499
 
Line 1616... Line 1597...
1616
;< edx = pointer to WDATA struct
1597
;< edx = pointer to WDATA struct
1617
;------------------------------------------------------------------------------
1598
;------------------------------------------------------------------------------
1618
        mov     eax, [CURRENT_TASK]
1599
        mov     eax, [CURRENT_TASK]
1619
        shl     eax, 5
1600
        shl     eax, 5
1620
        add     eax, window_data
1601
        add     eax, window_data
1621
 
-
 
1622
        ; save window colors
1602
; save window colors
1623
        mov     [eax + WDATA.cl_workarea], edx
1603
        mov     [eax + WDATA.cl_workarea], edx
1624
        mov     [eax + WDATA.cl_titlebar], esi
1604
        mov     [eax + WDATA.cl_titlebar], esi
1625
        mov     [eax + WDATA.cl_frames], edi
1605
        mov     [eax + WDATA.cl_frames], edi
1626
 
-
 
1627
        mov     edi, eax
1606
        mov     edi, eax
1628
 
-
 
1629
        ; was it already defined before?
1607
; Was it already defined before?
1630
        test    [edi + WDATA.fl_wdrawn], 1
1608
        test    [edi + WDATA.fl_wdrawn], 1
1631
        jnz     .set_client_box
1609
        jnz     .set_client_box
1632
        or      [edi + WDATA.fl_wdrawn], 1
-
 
1633
; After first draw_window we need redraw mouse necessarily!
1610
; No, it wasn't. After first draw_window we need redraw mouse necessarily!
1634
; Otherwise the user can see cursor specified by f.37.5 from another window.
1611
; Otherwise the user can see cursor specified by f.37.5 from another window.
1635
; He will be really unhappy! He is terrible in rage - usually he throws stones!
1612
; He will be really unhappy! Usually, he will be enraged!
-
 
1613
        or      [edi + WDATA.fl_wdrawn], 1
1636
        mov     [redrawmouse_unconditional], 1
1614
        mov     [redrawmouse_unconditional], 1
1637
        call    wakeup_osloop
1615
        call    wakeup_osloop
1638
        ; NOTE: commented out since doesn't provide necessary functionality
-
 
1639
        ;       anyway, to be reworked
-
 
1640
;       mov     eax, [timer_ticks] ; [0xfdf0]
-
 
1641
;       add     eax, 100
-
 
1642
;       mov     [new_window_starting], eax
-
 
1643
 
-
 
1644
        ; no it wasn't, performing initial window definition
1616
; performing initial window definition
1645
        movzx   eax, bx
1617
        movzx   eax, bx
1646
        mov     [edi + WDATA.box.width], eax
1618
        mov     [edi + WDATA.box.width], eax
1647
        movzx   eax, cx
1619
        movzx   eax, cx
1648
        mov     [edi + WDATA.box.height], eax
1620
        mov     [edi + WDATA.box.height], eax
1649
        sar     ebx, 16
1621
        sar     ebx, 16
Line 2294... Line 2266...
2294
        jz      .exit
2266
        jz      .exit
2295
        mov     edx, [edi * 8 + SLOT_BASE + APPDATA.wnd_caption]
2267
        mov     edx, [edi * 8 + SLOT_BASE + APPDATA.wnd_caption]
2296
        or      edx, edx
2268
        or      edx, edx
2297
        jz      .exit
2269
        jz      .exit
Line -... Line 2270...
-
 
2270
 
-
 
2271
        mov     ebp, [edi + window_data + WDATA.box.left - 2]
2298
 
2272
        mov     bp, word[edi + window_data + WDATA.box.top]
2299
        movzx   eax, [edi + window_data + WDATA.fl_wstyle]
2273
        movzx   eax, [edi + window_data + WDATA.fl_wstyle]
2300
        and     al, 0x0F
2274
        and     al, 0x0F
2301
        cmp     al, 3
2275
        cmp     al, 3
2302
        je      .skinned
2276
        je      .skinned
Line 2305... Line 2279...
2305
 
2279
 
2306
        jmp     .not_skinned
2280
        jmp     .not_skinned
2307
;--------------------------------------
2281
;--------------------------------------
2308
align 4
2282
align 4
2309
.skinned:
-
 
2310
        mov     ebp, [edi + window_data + WDATA.box.left - 2]
-
 
2311
        mov     bp, word[edi + window_data + WDATA.box.top]
2283
.skinned:
2312
        movzx   eax, word[edi + window_data + WDATA.box.width]
2284
        movzx   eax, word[edi + window_data + WDATA.box.width]
2313
        sub     ax, [_skinmargins.left]
2285
        sub     ax, [_skinmargins.left]
2314
        sub     ax, [_skinmargins.right]
-
 
2315
        push    edx
-
 
2316
        cwde
-
 
2317
        cdq
-
 
2318
        mov     ebx, 6
-
 
2319
        idiv    ebx
-
 
2320
        pop     edx
-
 
2321
        or      eax, eax
2286
        sub     ax, [_skinmargins.right]
2322
        js      .exit
-
 
2323
 
-
 
2324
        mov     esi, eax
2287
        js      .exit
2325
        mov     ebx, dword[_skinmargins.left - 2]
2288
        mov     ebx, dword[_skinmargins.left - 2]
2326
        mov     bx, word[_skinh]
2289
        mov     bx, word[_skinh]
2327
        sub     bx, [_skinmargins.bottom]
2290
        sub     bx, [_skinmargins.bottom]
2328
        sub     bx, [_skinmargins.top]
2291
        sub     bx, [_skinmargins.top]
2329
        sar     bx, 1
-
 
2330
        adc     bx, 0
2292
        sar     bx, 1
2331
        add     bx, [_skinmargins.top]
2293
        add     bx, [_skinmargins.top]
2332
        add     bx, -3
-
 
2333
        add     ebx, ebp
2294
        sub     bx, 8
2334
        jmp     .dodraw
2295
        jmp     .dodraw
2335
;--------------------------------------
2296
;--------------------------------------
2336
align 4
2297
align 4
2337
.not_skinned:
2298
.not_skinned:
2338
        cmp     al, 1
2299
        cmp     al, 1
2339
        je      .exit
-
 
2340
 
-
 
2341
        mov     ebp, [edi + window_data + WDATA.box.left - 2]
-
 
2342
        mov     bp, word[edi + window_data + WDATA.box.top]
2300
        je      .exit
2343
        movzx   eax, word[edi + window_data + WDATA.box.width]
2301
        movzx   eax, word[edi + window_data + WDATA.box.width]
2344
        sub     eax, 16
-
 
2345
        push    edx
-
 
2346
        cwde
-
 
2347
        cdq
-
 
2348
        mov     ebx, 6
-
 
2349
        idiv    ebx
-
 
2350
        pop     edx
-
 
2351
        or      eax, eax
2302
        sub     eax, 16
-
 
2303
        js      .exit
2352
        js      .exit
2304
        mov     ebx, 80002h
-
 
2305
.dodraw:
2353
 
2306
        shr     eax, 3
2354
        mov     esi, eax
-
 
2355
        mov     ebx, 0x00080007
2307
        mov     esi, eax
2356
        add     ebx, ebp
-
 
2357
;--------------------------------------
-
 
2358
align 4
-
 
2359
.dodraw:
2308
        add     ebx, ebp
-
 
2309
        mov     ecx, [common_colours + 16]
-
 
2310
        mov     al, 1
-
 
2311
        cmp     byte [edx], 4
-
 
2312
        jnc     @f
-
 
2313
        mov     al, [edx]
-
 
2314
        test    al, al
-
 
2315
        jz      .exit
-
 
2316
        inc     edx
-
 
2317
@@:
2360
        mov     ecx, [common_colours + 16]
2318
        shl     eax, 28
2361
        or      ecx, 0x80000000
2319
        or      ecx, eax
2362
        xor     edi, edi
2320
        xor     edi, edi
2363
        call    dtext_asciiz_esi
-
 
2364
;--------------------------------------
-
 
2365
align 4
2321
        call    dtext
2366
.exit:
-
 
2367
;        call    [draw_pointer]
2322
.exit:
2368
        call    __sys_draw_pointer
-
 
2369
        ret
2323
        jmp     __sys_draw_pointer
2370
;------------------------------------------------------------------------------
2324
;------------------------------------------------------------------------------
2371
align 4
2325
align 4
2372
;------------------------------------------------------------------------------
2326
;------------------------------------------------------------------------------
2373
window._.draw_negative_box: ;//////////////////////////////////////////////////
2327
window._.draw_negative_box: ;//////////////////////////////////////////////////
Line 2424... Line 2378...
2424
 
2378
 
2425
        add     edx, [eax-twdw + WDATA.box.height]
2379
        add     edx, [eax-twdw + WDATA.box.height]
2426
        mov     [ecx+RECT.bottom], edx
2380
        mov     [ecx+RECT.bottom], edx
2427
        ret
2381
        ret
-
 
2382
;------------------------------------------------------------------------------
-
 
2383
align 4
-
 
2384
;------------------------------------------------------------------------------
-
 
2385
window._.redraw_top_wnd: ;////////////////////////////////////////////////////////
-
 
2386
;------------------------------------------------------------------------------
-
 
2387
;? redraw all windows one above the window
-
 
2388
;------------------------------------------------------------------------------
-
 
2389
;> eax = left
-
 
2390
;> ebx = top
-
 
2391
;> ecx = right
-
 
2392
;> edx = bottom
-
 
2393
;> esi = process number
-
 
2394
;! corrupted edi
-
 
2395
;------------------------------------------------------------------------------
-
 
2396
        push    0
-
 
2397
        jmp     window._.set_top_wnd.go
-
 
2398
 
-
 
2399
align 4
-
 
2400
;------------------------------------------------------------------------------
-
 
2401
window._.set_top_wnd: ;////////////////////////////////////////////////////////
-
 
2402
;------------------------------------------------------------------------------
-
 
2403
;? call set_screen for all windows one above the window
-
 
2404
;------------------------------------------------------------------------------
-
 
2405
;> eax = left
-
 
2406
;> ebx = top
-
 
2407
;> ecx = right
-
 
2408
;> edx = bottom
-
 
2409
;> esi = process number
-
 
2410
;! corrupted edi
-
 
2411
;------------------------------------------------------------------------------
-
 
2412
 
-
 
2413
        push    1
-
 
2414
.go:
-
 
2415
        push    esi
-
 
2416
        pushfd
-
 
2417
        cli
-
 
2418
 
-
 
2419
        push    ebp
-
 
2420
        mov     ebp, [TASK_COUNT]
-
 
2421
        cmp     ebp, 1
-
 
2422
        jbe     .exit
-
 
2423
 
-
 
2424
        shl     esi, 5
-
 
2425
        cmp     [esi + window_data + WDATA.z_modif], ZPOS_ALWAYS_TOP
-
 
2426
        je      .exit
-
 
2427
 
-
 
2428
        push    eax ;for num layout
-
 
2429
        push    edx ecx ebx eax
-
 
2430
 
-
 
2431
        movsx   eax, byte [esi + window_data + WDATA.z_modif]
-
 
2432
        inc     eax
-
 
2433
        mov     dword[esp+10h], eax
-
 
2434
;--------------------------------------
-
 
2435
align 4
-
 
2436
.layout:
-
 
2437
        mov     esi, 1        ; = num in window stack
-
 
2438
        mov     ebp, [TASK_COUNT]
-
 
2439
;--------------------------------------
-
 
2440
align 4
-
 
2441
.next_window:
-
 
2442
        movzx   edi, word[WIN_POS + esi * 2]
-
 
2443
        shl     edi, 5                  ;size of TASKDATA and WDATA = 32 bytes
-
 
2444
 
-
 
2445
        cmp     [CURRENT_TASK + edi + TASKDATA.state], TSTATE_FREE
-
 
2446
        je      .skip_window
-
 
2447
 
-
 
2448
        add     edi, window_data
-
 
2449
        test    [edi + WDATA.fl_wstate], WSTATE_MINIMIZED
-
 
2450
        jnz     .skip_window
-
 
2451
 
-
 
2452
        mov     eax, [esp+10h]
-
 
2453
        cmp     [edi + WDATA.z_modif], al
-
 
2454
        jne     .skip_window
-
 
2455
 
-
 
2456
        mov     eax, [edi + WDATA.box.left]
-
 
2457
        cmp     eax, [esp + RECT.right]
-
 
2458
        jg      .skip_window
-
 
2459
        mov     ebx, [edi + WDATA.box.top]
-
 
2460
        cmp     ebx, [esp + RECT.bottom]
-
 
2461
        jg      .skip_window
-
 
2462
        mov     ecx, [edi + WDATA.box.width]
-
 
2463
        add     ecx, eax
-
 
2464
        cmp     ecx, [esp + RECT.left]
-
 
2465
        jl      .skip_window
-
 
2466
        mov     edx, [edi + WDATA.box.height]
-
 
2467
        add     edx, ebx
-
 
2468
        cmp     edx, [esp + RECT.top]
-
 
2469
        jl      .skip_window
-
 
2470
 
-
 
2471
        cmp     eax, [esp + RECT.left]
-
 
2472
        jae     @f
-
 
2473
        mov     eax, [esp + RECT.left]
-
 
2474
;--------------------------------------
-
 
2475
align 4
-
 
2476
@@:
-
 
2477
        cmp     ebx, [esp + RECT.top]
-
 
2478
        jae     @f
-
 
2479
        mov     ebx, [esp + RECT.top]
-
 
2480
;--------------------------------------
-
 
2481
align 4
-
 
2482
@@:
-
 
2483
        cmp     ecx, [esp + RECT.right]
-
 
2484
        jbe     @f
-
 
2485
        mov     ecx, [esp + RECT.right]
-
 
2486
;--------------------------------------
-
 
2487
align 4
-
 
2488
@@:
-
 
2489
        cmp     edx, [esp + RECT.bottom]
-
 
2490
        jbe     @f
-
 
2491
        mov     edx, [esp + RECT.bottom]
-
 
2492
;--------------------------------------
-
 
2493
align 4
-
 
2494
@@:
-
 
2495
        cmp     dword[esp+32], 0
-
 
2496
        je      .set_fl_redraw
-
 
2497
 
-
 
2498
        push    esi
-
 
2499
        movzx   esi, word[WIN_POS + esi * 2]
-
 
2500
        call    window._.set_screen
-
 
2501
        pop     esi
-
 
2502
        jmp     @f
-
 
2503
.set_fl_redraw:
-
 
2504
        mov     [edi + WDATA.fl_redraw], 1      ;set redraw flag
-
 
2505
     @@:
-
 
2506
;--------------------------------------
-
 
2507
align 4
-
 
2508
.skip_window:
-
 
2509
        inc     esi
-
 
2510
        dec     ebp
-
 
2511
        jnz     .next_window
-
 
2512
;--------------------------------------
-
 
2513
        inc     dword[esp+10h]
-
 
2514
        cmp     byte[esp+10h], ZPOS_ALWAYS_TOP
-
 
2515
        jle     .layout
-
 
2516
;-------------------------------------
-
 
2517
 
-
 
2518
        pop     eax ebx ecx edx
-
 
2519
        pop     ebp     ;del num layout
-
 
2520
;-------------------------------------
-
 
2521
align 4
-
 
2522
.exit:
-
 
2523
 
-
 
2524
        pop     ebp
-
 
2525
        popfd
-
 
2526
        pop     esi
-
 
2527
 
-
 
2528
        add     esp, 4   ;dword for 0/1 - set_screen/fl_redraw
-
 
2529
        ret
-
 
2530
-
 
2531