Subversion Repositories Kolibri OS

Rev

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

Rev 9710 Rev 9715
Line 1... Line 1...
1
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2
;;
2
;;
3
;; Copyright (C) KolibriOS team 2004-2021. All rights reserved.
3
;; Copyright (C) KolibriOS team 2004-2022. All rights reserved.
4
;; PROGRAMMING:
4
;; PROGRAMMING:
5
;; Ivan Poddubny
5
;; Ivan Poddubny
6
;; Marat Zakiyanov (Mario79)
6
;; Marat Zakiyanov (Mario79)
7
;; VaStaNi
7
;; VaStaNi
8
;; Trans
8
;; Trans
Line 75... Line 75...
75
format binary as "mnt"
75
format binary as "mnt"
Line 76... Line 76...
76
 
76
 
77
include 'macros.inc'
77
include 'macros.inc'
Line 78... Line 78...
78
include 'struct.inc'
78
include 'struct.inc'
Line 79... Line 79...
79
 
79
 
80
$Revision: 9710 $
80
$Revision: 9715 $
Line 1544... Line 1544...
1544
        mov     ebx, [esp+64+32-8+4]
1544
        mov     ebx, [esp+64+32-8+4]
1545
; add window start x & y
1545
; add window start x & y
Line 1546... Line 1546...
1546
 
1546
 
1547
        mov     edi, [current_slot_idx]
1547
        mov     edi, [current_slot_idx]
1548
        mov     ecx, edi
1548
        mov     ecx, edi
1549
        shl     edi, 8
1549
        shl     edi, BSF sizeof.APPDATA
Line 1550... Line 1550...
1550
        shl     ecx, 5
1550
        shl     ecx, BSF sizeof.WDATA
1551
 
1551
 
1552
        mov     eax, [ecx+window_data+WDATA.box.left]
1552
        mov     eax, [window_data + ecx + WDATA.box.left]
1553
        add     eax, [edi+SLOT_BASE+APPDATA.wnd_clientbox.left]
1553
        add     eax, [SLOT_BASE + edi + APPDATA.wnd_clientbox.left]
1554
        shl     eax, 16
1554
        shl     eax, 16
1555
        add     eax, [ecx+window_data+WDATA.box.top]
1555
        add     eax, [window_data + ecx + WDATA.box.top]
1556
        add     eax, [edi+SLOT_BASE+APPDATA.wnd_clientbox.top]
1556
        add     eax, [SLOT_BASE + edi + APPDATA.wnd_clientbox.top]
1557
        add     ebx, eax
1557
        add     ebx, eax
1558
        mov     ecx, [esp+64+32-12+4]
1558
        mov     ecx, [esp+64+32-12+4]
1559
        mov     eax, [esp+64+8]         ; background color (if given)
1559
        mov     eax, [esp+64+8]         ; background color (if given)
Line 1938... Line 1938...
1938
        mov     eax, [d_width_calc_area + eax*4]
1938
        mov     eax, [d_width_calc_area + eax*4]
Line 1939... Line 1939...
1939
 
1939
 
1940
        add     eax, [_display.win_map]
1940
        add     eax, [_display.win_map]
1941
        movzx   edx, byte [ebx+eax]
1941
        movzx   edx, byte [ebx + eax]
1942
        shl     edx, BSF sizeof.APPDATA
1942
        shl     edx, BSF sizeof.APPDATA
Line 1943... Line 1943...
1943
        mov     esi, [edx+SLOT_BASE+APPDATA.cursor]
1943
        mov     esi, [SLOT_BASE + edx + APPDATA.cursor]
1944
 
1944
 
Line 1945... Line 1945...
1945
        cmp     esi, [current_cursor]
1945
        cmp     esi, [current_cursor]
Line 2144... Line 2144...
2144
        movzx   esi, word [WIN_STACK + ecx*2]
2144
        movzx   esi, word [WIN_STACK + ecx*2]
2145
        cmp     esi, [thread_count]
2145
        cmp     esi, [thread_count]
2146
        je      .nowindowactivate; already active
2146
        je      .nowindowactivate; already active
Line 2147... Line 2147...
2147
 
2147
 
2148
        mov     edi, ecx
2148
        mov     edi, ecx
2149
        shl     edi, 5
2149
        shl     edi, BSF sizeof.WDATA
2150
        add     edi, window_data
2150
        add     edi, window_data
2151
        movzx   esi, word [WIN_STACK + ecx * 2]
2151
        movzx   esi, word [WIN_STACK + ecx * 2]
2152
        lea     esi, [WIN_POS + esi * 2]
2152
        lea     esi, [WIN_POS + esi * 2]
2153
        call    waredraw
2153
        call    waredraw
Line 2172... Line 2172...
2172
        ja      .fail
2172
        ja      .fail
2173
        cmp     edx, 1
2173
        cmp     edx, 1
2174
        je      .fail
2174
        je      .fail
Line 2175... Line 2175...
2175
 
2175
 
2176
        mov     eax, edx
2176
        mov     eax, edx
Line 2177... Line 2177...
2177
        shl     edx, 5
2177
        shl     edx, BSF sizeof.WDATA
2178
 
2178
 
Line 2179... Line 2179...
2179
        cmp     [edx*8 + SLOT_BASE + APPDATA.state], TSTATE_FREE
2179
        cmp     [edx*8 + SLOT_BASE + APPDATA.state], TSTATE_FREE
2180
        je      .fail
2180
        je      .fail
Line 2181... Line 2181...
2181
 
2181
 
2182
        cmp     ecx, 1
2182
        cmp     ecx, 1
Line 2183... Line 2183...
2183
        jnz     .set_zmod
2183
        jnz     .set_zmod
2184
 
2184
 
2185
        mov     al, [edx + window_data + WDATA.z_modif]
2185
        mov     al, [window_data + edx + WDATA.z_modif]
Line 2193... Line 2193...
2193
        mov     esi, eax
2193
        mov     esi, eax
Line 2194... Line 2194...
2194
 
2194
 
2195
        cmp     bl, ZPOS_ALWAYS_TOP
2195
        cmp     bl, ZPOS_ALWAYS_TOP
Line 2196... Line 2196...
2196
        jg      .fail
2196
        jg      .fail
Line 2197... Line 2197...
2197
 
2197
 
2198
        mov     [edx + window_data + WDATA.z_modif], bl
2198
        mov     [window_data + edx + WDATA.z_modif], bl
2199
 
2199
 
2200
        mov     eax, [edx + window_data + WDATA.box.left]
2200
        mov     eax, [window_data + edx + WDATA.box.left]
2201
        mov     ebx, [edx + window_data + WDATA.box.top]
2201
        mov     ebx, [window_data + edx + WDATA.box.top]
2202
        mov     ecx, [edx + window_data + WDATA.box.width]
2202
        mov     ecx, [window_data + edx + WDATA.box.width]
2203
        mov     edx, [edx + window_data + WDATA.box.height]
2203
        mov     edx, [window_data + edx + WDATA.box.height]
2204
        add     ecx, eax
2204
        add     ecx, eax
2205
        add     edx, ebx
2205
        add     edx, ebx
Line 2206... Line 2206...
2206
        call    window._.set_screen
2206
        call    window._.set_screen
2207
        call    window._.set_top_wnd
2207
        call    window._.set_top_wnd
Line 2208... Line 2208...
2208
        call    window._.redraw_top_wnd
2208
        call    window._.redraw_top_wnd
2209
 
2209
 
Line 2601... Line 2601...
2601
; +6: word: number of the thread slot, which window has in the window stack
2601
; +6: word: number of the thread slot, which window has in the window stack
2602
;           position ecx (has no relation to the specific thread)
2602
;           position ecx (has no relation to the specific thread)
2603
        mov     ax, [WIN_POS + ecx * 2]
2603
        mov     ax, [WIN_POS + ecx * 2]
2604
        mov     [ebx+6], ax
2604
        mov     [ebx+6], ax
Line 2605... Line 2605...
2605
 
2605
 
Line 2606... Line 2606...
2606
        shl     ecx, 8   ;5=32 8=256
2606
        shl     ecx, BSF sizeof.APPDATA
2607
 
2607
 
2608
; +0: dword: memory usage
2608
; +0: dword: memory usage
2609
        ;mov     eax, [ecx+TASK_TABLE+TASKDATA.cpu_usage]
2609
        ;mov     eax, [ecx+TASK_TABLE+TASKDATA.cpu_usage]
2610
        mov     eax, [ecx-sizeof.APPDATA+SLOT_BASE+APPDATA.cpu_usage]
2610
        mov     eax, [SLOT_BASE + ecx - sizeof.APPDATA + APPDATA.cpu_usage]
2611
        mov     [ebx], eax
2611
        mov     [ebx], eax
2612
; +10: 11 bytes: name of the process
2612
; +10: 11 bytes: name of the process
2613
        push    ecx
2613
        push    ecx
2614
        lea     eax, [ecx+SLOT_BASE+APPDATA.app_name]
2614
        lea     eax, [SLOT_BASE + ecx + APPDATA.app_name]
2615
        add     ebx, 10
2615
        add     ebx, 10
2616
        mov     ecx, 11
2616
        mov     ecx, 11
Line 2633... Line 2633...
2633
        stosd
2633
        stosd
2634
        lea     eax, [edx-1]
2634
        lea     eax, [edx-1]
2635
        stosd
2635
        stosd
Line 2636... Line 2636...
2636
 
2636
 
2637
; +30: PID/TID
2637
; +30: PID/TID
2638
        mov     eax, [ecx*8 + SLOT_BASE + APPDATA.tid]
2638
        mov     eax, [SLOT_BASE + ecx*8 + APPDATA.tid]
Line 2639... Line 2639...
2639
        stosd
2639
        stosd
2640
 
2640
 
2641
    ; window position and size
2641
    ; window position and size
2642
        push    esi
2642
        push    esi
2643
        lea     esi, [ecx + window_data + WDATA.box]
2643
        lea     esi, [window_data + ecx + WDATA.box]
2644
        movsd
2644
        movsd
2645
        movsd
2645
        movsd
Line 2646... Line 2646...
2646
        movsd
2646
        movsd
2647
        movsd
2647
        movsd
2648
 
2648
 
Line 2649... Line 2649...
2649
    ; Process state (+50)
2649
    ; Process state (+50)
2650
        movzx   eax, byte [ecx*8 + SLOT_BASE + APPDATA.state]
2650
        movzx   eax, byte [SLOT_BASE + ecx*8 + APPDATA.state]
2651
        stosd
2651
        stosd
2652
 
2652
 
2653
    ; Window client area box
2653
    ; Window client area box
2654
        lea     esi, [ecx*8 + SLOT_BASE + APPDATA.wnd_clientbox]
2654
        lea     esi, [SLOT_BASE + ecx*8 + APPDATA.wnd_clientbox]
Line 2655... Line 2655...
2655
        movsd
2655
        movsd
2656
        movsd
2656
        movsd
2657
        movsd
2657
        movsd
Line 2658... Line 2658...
2658
        movsd
2658
        movsd
2659
 
2659
 
2660
    ; Window state
2660
    ; Window state
Line 2661... Line 2661...
2661
        mov     al, [ecx+window_data+WDATA.fl_wstate]
2661
        mov     al, [window_data + ecx + WDATA.fl_wstate]
2662
        stosb
2662
        stosb
2663
 
2663
 
Line 2664... Line 2664...
2664
    ; Event mask (+71)
2664
    ; Event mask (+71)
2665
        mov     EAX, dword [ecx*8 + SLOT_BASE + APPDATA.event_mask]
2665
        mov     EAX, dword [SLOT_BASE + ecx*8 + APPDATA.event_mask]
Line 2726... Line 2726...
2726
 
2726
 
2727
        cmp     ebx, 2
2727
        cmp     ebx, 2
Line 2728... Line 2728...
2728
        jnz     srl1
2728
        jnz     srl1
2729
 
2729
 
2730
        mov     edx, [current_slot_idx]      ; return whole screen draw area for this app
2730
        mov     edx, [current_slot_idx]      ; return whole screen draw area for this app
2731
        shl     edx, 5
2731
        shl     edx, 5     ;?
2732
        add     edx, draw_data
2732
        add     edx, draw_data
2733
        mov     [edx + RECT.left], 0
2733
        mov     [edx + RECT.left], 0
2734
        mov     [edx + RECT.top], 0
2734
        mov     [edx + RECT.top], 0
Line 2904... Line 2904...
2904
;--------------------------------------
2904
;--------------------------------------
2905
align 4
2905
align 4
2906
.set_mouse_event:
2906
.set_mouse_event:
2907
        add     edi, sizeof.APPDATA
2907
        add     edi, sizeof.APPDATA
2908
        add     ebx, sizeof.WDATA
2908
        add     ebx, sizeof.WDATA
2909
        test    [edi + SLOT_BASE + APPDATA.event_mask], 0x80000000
2909
        test    [SLOT_BASE + edi + APPDATA.event_mask], 0x80000000
2910
        jz      .pos_filter
2910
        jz      .pos_filter
Line 2911... Line 2911...
2911
 
2911
 
2912
        cmp     edi, [esp]                      ; skip if filtration active
2912
        cmp     edi, [esp]                      ; skip if filtration active
2913
        jne     .skip
2913
        jne     .skip
2914
;--------------------------------------
2914
;--------------------------------------
2915
align 4
2915
align 4
2916
.pos_filter:
2916
.pos_filter:
2917
        test    [edi + SLOT_BASE + APPDATA.event_mask], 0x40000000
2917
        test    [SLOT_BASE + edi + APPDATA.event_mask], 0x40000000
Line 2918... Line 2918...
2918
        jz      .set
2918
        jz      .set
2919
 
2919
 
2920
        mov     esi, [ebx + WDATA.box.left]
2920
        mov     esi, [ebx + WDATA.box.left]
Line 2931... Line 2931...
2931
        cmp     edx, esi
2931
        cmp     edx, esi
2932
        ja      .skip
2932
        ja      .skip
2933
;--------------------------------------
2933
;--------------------------------------
2934
align 4
2934
align 4
2935
.set:
2935
.set:
2936
        or      [edi+SLOT_BASE+APPDATA.occurred_events], EVENT_MOUSE
2936
        or      [SLOT_BASE + edi + APPDATA.occurred_events], EVENT_MOUSE
2937
;--------------------------------------
2937
;--------------------------------------
2938
align 4
2938
align 4
2939
.skip:
2939
.skip:
2940
        loop    .set_mouse_event
2940
        loop    .set_mouse_event
Line 2973... Line 2973...
2973
align 4
2973
align 4
2974
set_bgr_event:
2974
set_bgr_event:
2975
        add     edi, sizeof.APPDATA
2975
        add     edi, sizeof.APPDATA
2976
        mov     eax, [BG_Rect_X_left_right]
2976
        mov     eax, [BG_Rect_X_left_right]
2977
        mov     edx, [BG_Rect_Y_top_bottom]
2977
        mov     edx, [BG_Rect_Y_top_bottom]
2978
        cmp     [edi+SLOT_BASE+APPDATA.draw_bgr_x], 0
2978
        cmp     [SLOT_BASE + edi + APPDATA.draw_bgr_x], 0
2979
        jz      .set
2979
        jz      .set
2980
.join:
2980
.join:
2981
        cmp     word [edi+SLOT_BASE+APPDATA.draw_bgr_x], ax
2981
        cmp     word [SLOT_BASE + edi + APPDATA.draw_bgr_x], ax
2982
        jae     @f
2982
        jae     @f
2983
        mov     word [edi+SLOT_BASE+APPDATA.draw_bgr_x], ax
2983
        mov     word [SLOT_BASE + edi + APPDATA.draw_bgr_x], ax
2984
@@:
2984
@@:
2985
        shr     eax, 16
2985
        shr     eax, 16
2986
        cmp     word [edi+SLOT_BASE+APPDATA.draw_bgr_x+2], ax
2986
        cmp     word [SLOT_BASE + edi + APPDATA.draw_bgr_x + 2], ax
2987
        jbe     @f
2987
        jbe     @f
2988
        mov     word [edi+SLOT_BASE+APPDATA.draw_bgr_x+2], ax
2988
        mov     word [SLOT_BASE + edi + APPDATA.draw_bgr_x + 2], ax
2989
@@:
2989
@@:
2990
        cmp     word [edi+SLOT_BASE+APPDATA.draw_bgr_y], dx
2990
        cmp     word [SLOT_BASE + edi + APPDATA.draw_bgr_y], dx
2991
        jae     @f
2991
        jae     @f
2992
        mov     word [edi+SLOT_BASE+APPDATA.draw_bgr_y], dx
2992
        mov     word [SLOT_BASE + edi + APPDATA.draw_bgr_y], dx
2993
@@:
2993
@@:
2994
        shr     edx, 16
2994
        shr     edx, 16
2995
        cmp     word [edi+SLOT_BASE+APPDATA.draw_bgr_y+2], dx
2995
        cmp     word [SLOT_BASE + edi + APPDATA.draw_bgr_y+2], dx
2996
        jbe     @f
2996
        jbe     @f
2997
        mov     word [edi+SLOT_BASE+APPDATA.draw_bgr_y+2], dx
2997
        mov     word [SLOT_BASE + edi + APPDATA.draw_bgr_y+2], dx
2998
@@:
2998
@@:
2999
        jmp     .common
2999
        jmp     .common
3000
.set:
3000
.set:
3001
        mov     [edi+SLOT_BASE+APPDATA.draw_bgr_x], eax
3001
        mov     [SLOT_BASE + edi + APPDATA.draw_bgr_x], eax
3002
        mov     [edi+SLOT_BASE+APPDATA.draw_bgr_y], edx
3002
        mov     [SLOT_BASE + edi + APPDATA.draw_bgr_y], edx
3003
.common:
3003
.common:
3004
        or      [edi+SLOT_BASE+APPDATA.occurred_events], EVENT_BACKGROUND
3004
        or      [SLOT_BASE + edi + APPDATA.occurred_events], EVENT_BACKGROUND
3005
        loop    set_bgr_event
3005
        loop    set_bgr_event
3006
        pop     edi ecx
3006
        pop     edi ecx
3007
;--------- set event 5 stop -----------
3007
;--------- set event 5 stop -----------
3008
        dec     [REDRAW_BACKGROUND]     ; got new update request?
3008
        dec     [REDRAW_BACKGROUND]     ; got new update request?
3009
        jnz     backgr
3009
        jnz     backgr
Line 3064... Line 3064...
3064
        mov     esi, 1
3064
        mov     esi, 1
3065
;--------------------------------------
3065
;--------------------------------------
3066
align 4
3066
align 4
3067
newct:
3067
newct:
3068
        mov     cl, [ebx]
3068
        mov     cl, [ebx]
3069
        cmp     cl, byte 3
3069
        cmp     cl, TSTATE_ZOMBIE
3070
        jz      .terminate
3070
        jz      .terminate
Line 3071... Line 3071...
3071
 
3071
 
3072
        cmp     cl, byte 4
3072
        cmp     cl, TSTATE_TERMINATING
3073
        jnz     .noterminate
3073
        jnz     .noterminate
3074
.terminate:
3074
.terminate:
3075
        pushad
3075
        pushad
3076
        mov     ecx, eax
3076
        mov     ecx, eax
3077
        shl     ecx, 8
3077
        shl     ecx, BSF sizeof.APPDATA
3078
        add     ecx, SLOT_BASE
3078
        add     ecx, SLOT_BASE
3079
        call    restore_default_cursor_before_killing
3079
        call    restore_default_cursor_before_killing
Line 3080... Line 3080...
3080
        popad
3080
        popad
Line 3111... Line 3111...
3111
newdw2:
3111
newdw2:
3112
        inc     ecx
3112
        inc     ecx
3113
        push    ecx
3113
        push    ecx
Line 3114... Line 3114...
3114
 
3114
 
3115
        mov     eax, ecx
3115
        mov     eax, ecx
3116
        shl     eax, 5
3116
        shl     eax, BSF sizeof.WDATA
Line 3117... Line 3117...
3117
        add     eax, window_data
3117
        add     eax, window_data
3118
 
3118
 
3119
        cmp     eax, [esp+4]
3119
        cmp     eax, [esp+4]
Line 3739... Line 3739...
3739
        pop     ecx
3739
        pop     ecx
3740
        jnz     sys_putimage.exit
3740
        jnz     sys_putimage.exit
Line 3741... Line 3741...
3741
 
3741
 
3742
        mov     eax, [current_slot_idx]
3742
        mov     eax, [current_slot_idx]
3743
        shl     eax, 8
3743
        shl     eax, 8
3744
        add     dx, word [eax+SLOT_BASE+APPDATA.wnd_clientbox.top]
3744
        add     dx, word [SLOT_BASE + eax + APPDATA.wnd_clientbox.top]
3745
        rol     edx, 16
3745
        rol     edx, 16
3746
        add     dx, word [eax+SLOT_BASE+APPDATA.wnd_clientbox.left]
3746
        add     dx, word [SLOT_BASE + eax + APPDATA.wnd_clientbox.left]
3747
        rol     edx, 16
3747
        rol     edx, 16
3748
;--------------------------------------
3748
;--------------------------------------
3749
align 4
3749
align 4
3750
.forced:
3750
.forced:
Line 4299... Line 4299...
4299
        or      eax, -1
4299
        or      eax, -1
4300
        ret
4300
        ret
4301
;-----------------------------------------------------------------------------
4301
;-----------------------------------------------------------------------------
4302
align 4
4302
align 4
4303
.1:
4303
.1:
4304
        shl     edi, 8
4304
        shl     edi, BSF sizeof.APPDATA
4305
        mov     [edi+SLOT_BASE + APPDATA.keyboard_mode], cl
4305
        mov     [SLOT_BASE + edi + APPDATA.keyboard_mode], cl
Line 4306... Line 4306...
4306
 
4306
 
4307
        ret
4307
        ret
4308
;-----------------------------------------------------------------------------
4308
;-----------------------------------------------------------------------------
4309
align 4
4309
align 4
4310
.2:                             ; 2 = get keyboard mode
4310
.2:                             ; 2 = get keyboard mode
4311
        shl     edi, 8
4311
        shl     edi, BSF sizeof.APPDATA
4312
        movzx   eax, byte [SLOT_BASE+edi + APPDATA.keyboard_mode]
4312
        movzx   eax, byte [SLOT_BASE + edi + APPDATA.keyboard_mode]
4313
        mov     [esp+32], eax
4313
        mov     [esp+32], eax
4314
        ret
4314
        ret
4315
;-----------------------------------------------------------------------------
4315
;-----------------------------------------------------------------------------