Subversion Repositories Kolibri OS

Rev

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

Rev 9477 Rev 9709
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: 9477 $
9
$Revision: 9709 $
10
 
10
 
11
;==============================================================================
11
;==============================================================================
Line 76... Line 76...
76
; system function 1
76
; system function 1
77
syscall_setpixel:  
77
syscall_setpixel:  
78
        mov     eax, ebx
78
        mov     eax, ebx
79
        mov     ebx, ecx
79
        mov     ebx, ecx
80
        mov     ecx, edx
80
        mov     ecx, edx
81
        mov     edx, [TASK_BASE]
81
        mov     edx, [current_slot_idx]
-
 
82
        shl     edx, BSF sizeof.WDATA
82
        add     eax, [edx-twdw+WDATA.box.left]
83
        add     eax, [edx + window_data + WDATA.box.left]
83
        add     ebx, [edx-twdw+WDATA.box.top]
84
        add     ebx, [edx + window_data + WDATA.box.top]
84
        mov     edi, [current_slot]
85
        mov     edi, [current_slot]
85
        add     eax, [edi+APPDATA.wnd_clientbox.left]
86
        add     eax, [edi+APPDATA.wnd_clientbox.left]
86
        add     ebx, [edi+APPDATA.wnd_clientbox.top]
87
        add     ebx, [edi+APPDATA.wnd_clientbox.top]
87
        xor     edi, edi ; no force
88
        xor     edi, edi ; no force
88
        and     ecx, 0xFBFFFFFF  ;negate 0x04000000 save to mouseunder area
89
        and     ecx, 0xFBFFFFFF  ;negate 0x04000000 save to mouseunder area
Line 101... Line 102...
101
@@:
102
@@:
102
        stdcall is_region_userspace, edx, esi
103
        stdcall is_region_userspace, edx, esi
103
        pop     esi
104
        pop     esi
104
        jnz     .err
105
        jnz     .err
Line 105... Line 106...
105
 
106
 
-
 
107
        mov     eax, [current_slot_idx]
106
        mov     eax, [TASK_BASE]
108
        shl     eax, BSF sizeof.WDATA
107
        mov     ebp, [eax-twdw+WDATA.box.left]
109
        mov     ebp, [eax + window_data + WDATA.box.left]
108
        push    esi
110
        push    esi
109
        mov     esi, [current_slot]
111
        mov     esi, [current_slot]
110
        add     ebp, [esi+APPDATA.wnd_clientbox.left]
112
        add     ebp, [esi+APPDATA.wnd_clientbox.left]
111
        shl     ebp, 16
113
        shl     ebp, 16
112
        add     ebp, [eax-twdw+WDATA.box.top]
114
        add     ebp, [eax + window_data + WDATA.box.top]
113
        add     bp, word[esi+APPDATA.wnd_clientbox.top]
115
        add     bp, word[esi+APPDATA.wnd_clientbox.top]
114
        pop     esi
116
        pop     esi
115
        test    ecx, 0x08000000  ; redirect the output to the user area
117
        test    ecx, 0x08000000  ; redirect the output to the user area
116
        jnz     @f
118
        jnz     @f
Line 161... Line 163...
161
;------------------------------------------------------------------------------
163
;------------------------------------------------------------------------------
Line 162... Line 164...
162
 
164
 
163
align 4
165
align 4
164
; system function 38
166
; system function 38
165
syscall_drawline:
167
syscall_drawline:
-
 
168
        mov     edi, [current_slot_idx]
166
        mov     edi, [TASK_BASE]
169
        shl     edi, BSF sizeof.WDATA
167
        movzx   eax, word[edi-twdw+WDATA.box.left]
170
        movzx   eax, word[edi + window_data + WDATA.box.left]
168
        mov     ebp, eax
171
        mov     ebp, eax
169
        mov     esi, [current_slot]
172
        mov     esi, [current_slot]
170
        add     ebp, [esi+APPDATA.wnd_clientbox.left]
173
        add     ebp, [esi+APPDATA.wnd_clientbox.left]
171
        add     ax, word[esi+APPDATA.wnd_clientbox.left]
174
        add     ax, word[esi+APPDATA.wnd_clientbox.left]
172
        add     ebp, ebx
175
        add     ebp, ebx
173
        shl     eax, 16
176
        shl     eax, 16
174
        movzx   ebx, word[edi-twdw+WDATA.box.top]
177
        movzx   ebx, word[edi + window_data + WDATA.box.top]
175
        add     eax, ebp
178
        add     eax, ebp
176
        mov     ebp, ebx
179
        mov     ebp, ebx
177
        add     ebp, [esi+APPDATA.wnd_clientbox.top]
180
        add     ebp, [esi+APPDATA.wnd_clientbox.top]
178
        add     bx, word[esi+APPDATA.wnd_clientbox.top]
181
        add     bx, word[esi+APPDATA.wnd_clientbox.top]
Line 427... Line 430...
427
 
430
 
428
align 4
431
align 4
429
;     system function 67 
432
;     system function 67 
430
syscall_move_window: 
433
syscall_move_window: 
431
        mov     edi, [current_slot_idx]
434
        mov     edi, [current_slot_idx]
432
        shl     edi, 5
435
        shl     edi, BSF sizeof.WDATA
Line 433... Line 436...
433
        add     edi, window_data
436
        add     edi, window_data
434
 
437
 
Line 483... Line 486...
483
;------------------------------------------------------------------------------
486
;------------------------------------------------------------------------------
Line 484... Line 487...
484
 
487
 
485
; system function 71
488
; system function 71
486
syscall_window_settings: 
489
syscall_window_settings: 
487
        mov     edi, [current_slot_idx]
490
        mov     edi, [current_slot_idx]
488
        shl     edi, 5
491
        shl     edi, BSF sizeof.WDATA
489
        or      [edi + window_data + WDATA.fl_wstyle], WSTYLE_HASCAPTION
492
        or      [edi + window_data + WDATA.fl_wstyle], WSTYLE_HASCAPTION
490
        cmp     ebx, 2
493
        cmp     ebx, 2
491
        jz      @f
494
        jz      @f
492
        xor     edx, edx
495
        xor     edx, edx
Line 554... Line 557...
554
        mov     ebp, [thread_count]
557
        mov     ebp, [thread_count]
555
;--------------------------------------
558
;--------------------------------------
556
align 4
559
align 4
557
.next_window:
560
.next_window:
558
        movzx   edi, word[WIN_POS + esi * 2]
561
        movzx   edi, word[WIN_POS + esi * 2]
559
        shl     edi, 5                  ;size of TASKDATA and WDATA = 32 bytes
562
        shl     edi, BSF sizeof.WDATA        ;size of TASKDATA and WDATA = 32 bytes
Line 560... Line 563...
560
 
563
 
561
        cmp     byte [TASK_TABLE + edi + TASKDATA.state], TSTATE_FREE
564
        cmp     byte [SLOT_BASE + edi*8 + APPDATA.state], TSTATE_FREE
Line 562... Line 565...
562
        je      .skip_window
565
        je      .skip_window
563
 
566
 
564
        add     edi, window_data
567
        add     edi, window_data
Line 623... Line 626...
623
        cmp     dword[esp+10h], ZPOS_ALWAYS_TOP
626
        cmp     dword[esp+10h], ZPOS_ALWAYS_TOP
624
        jle     .layout
627
        jle     .layout
625
;---------------------------------------------
628
;---------------------------------------------
626
        mov     esi, [thread_count]
629
        mov     esi, [thread_count]
627
        movzx   edi, word[WIN_POS + esi * 2]
630
        movzx   edi, word[WIN_POS + esi * 2]
628
        shl     edi, 5
631
        shl     edi, BSF sizeof.WDATA
629
        add     edi, window_data
632
        add     edi, window_data
Line 630... Line 633...
630
 
633
 
631
        pop     eax ebx ecx edx
634
        pop     eax ebx ecx edx
632
        pop     ebp     ;del num layout
635
        pop     ebp     ;del num layout
Line 1031... Line 1034...
1031
        call    window._.window_activate
1034
        call    window._.window_activate
Line 1032... Line 1035...
1032
 
1035
 
1033
        pushad
1036
        pushad
1034
        mov     edi, [thread_count]
1037
        mov     edi, [thread_count]
1035
        movzx   esi, word[WIN_POS + edi * 2]
1038
        movzx   esi, word[WIN_POS + edi * 2]
1036
        shl     esi, 5
1039
        shl     esi, BSF sizeof.WDATA
Line 1037... Line 1040...
1037
        add     esi, window_data
1040
        add     esi, window_data
1038
 
1041
 
1039
        mov     eax, [esi + WDATA.box.left]
1042
        mov     eax, [esi + WDATA.box.left]
Line 1083... Line 1086...
1083
        mov     ebx, [thread_count]
1086
        mov     ebx, [thread_count]
1084
;--------------------------------------
1087
;--------------------------------------
1085
align 4
1088
align 4
1086
.loop:
1089
.loop:
1087
        movzx   edi, word[WIN_POS + eax * 2]
1090
        movzx   edi, word[WIN_POS + eax * 2]
1088
        shl     edi, 5
1091
        shl     edi, BSF sizeof.WDATA
1089
; it is a unused slot?
1092
; it is a unused slot?
1090
        cmp     byte [edi+TASK_TABLE+TASKDATA.state], TSTATE_FREE
1093
        cmp     byte [edi*8 + SLOT_BASE + APPDATA.state], TSTATE_FREE
1091
        je      @f
1094
        je      @f
1092
; it is a hidden thread?
1095
; it is a hidden thread?
1093
        lea     esi, [edi*8+SLOT_BASE+APPDATA.app_name]
1096
        lea     esi, [edi*8+SLOT_BASE+APPDATA.app_name]
1094
        cmp     [esi], byte '@'
1097
        cmp     [esi], byte '@'
1095
        je      @f
1098
        je      @f
Line 1131... Line 1134...
1131
        pushfd
1134
        pushfd
1132
        cli
1135
        cli
Line 1133... Line 1136...
1133
 
1136
 
1134
        ; is it already minimized?
1137
        ; is it already minimized?
1135
        movzx   edi, word[WIN_POS + eax * 2]
1138
        movzx   edi, word[WIN_POS + eax * 2]
1136
        shl     edi, 5
1139
        shl     edi, BSF sizeof.WDATA
1137
        add     edi, window_data
1140
        add     edi, window_data
1138
        test    [edi + WDATA.fl_wstate], WSTATE_MINIMIZED
1141
        test    [edi + WDATA.fl_wstate], WSTATE_MINIMIZED
Line 1139... Line 1142...
1139
        jnz     .exit
1142
        jnz     .exit
Line 1192... Line 1195...
1192
        cli
1195
        cli
Line 1193... Line 1196...
1193
 
1196
 
1194
        ; is it already restored?
1197
        ; is it already restored?
1195
        movzx   esi, word[WIN_POS + eax * 2]
1198
        movzx   esi, word[WIN_POS + eax * 2]
1196
        mov     edi, esi
1199
        mov     edi, esi
1197
        shl     edi, 5
1200
        shl     edi, BSF sizeof.WDATA
1198
        add     edi, window_data
1201
        add     edi, window_data
1199
        test    [edi + WDATA.fl_wstate], WSTATE_MINIMIZED
1202
        test    [edi + WDATA.fl_wstate], WSTATE_MINIMIZED
Line 1200... Line 1203...
1200
        jz      .exit
1203
        jz      .exit
Line 1260... Line 1263...
1260
 
1263
 
1261
align 4
1264
align 4
1262
;> esi = process slot
1265
;> esi = process slot
1263
sys_window_maximize_handler:
1266
sys_window_maximize_handler:
1264
        mov     edi, esi
1267
        mov     edi, esi
1265
        shl     edi, 5
1268
        shl     edi, BSF sizeof.WDATA
Line 1266... Line 1269...
1266
        add     edi, window_data
1269
        add     edi, window_data
1267
 
1270
 
1268
        ; can window change its height?
1271
        ; can window change its height?
Line 1291... Line 1294...
1291
        jmp     .set_box
1294
        jmp     .set_box
1292
;--------------------------------------
1295
;--------------------------------------
1293
align 4
1296
align 4
1294
.restore_size:
1297
.restore_size:
1295
        mov     eax, esi
1298
        mov     eax, esi
1296
        shl     eax, 8
1299
        shl     eax, BSF sizeof.APPDATA
1297
        add     eax, SLOT_BASE + APPDATA.saved_box
1300
        add     eax, SLOT_BASE + APPDATA.saved_box
1298
        push    [eax + BOX.height] \
1301
        push    [eax + BOX.height] \
1299
                [eax + BOX.width] \
1302
                [eax + BOX.width] \
1300
                [eax + BOX.top] \
1303
                [eax + BOX.top] \
1301
                [eax + BOX.left]
1304
                [eax + BOX.left]
Line 1325... Line 1328...
1325
 
1328
 
1326
align 4
1329
align 4
1327
;> esi = process slot
1330
;> esi = process slot
1328
sys_window_rollup_handler:
1331
sys_window_rollup_handler:
1329
        mov     edx, esi
1332
        mov     edx, esi
1330
        shl     edx, 8
1333
        shl     edx, BSF sizeof.APPDATA
Line 1331... Line 1334...
1331
        add     edx, SLOT_BASE
1334
        add     edx, SLOT_BASE
1332
 
1335
 
1333
        ; toggle normal/rolled up window state
1336
        ; toggle normal/rolled up window state
Line 1392... Line 1395...
1392
sys_window_end_moving_handler:
1395
sys_window_end_moving_handler:
1393
;        mov     edi, ebx
1396
;        mov     edi, ebx
1394
;        call    window._.end_moving__box
1397
;        call    window._.end_moving__box
Line 1395... Line 1398...
1395
 
1398
 
1396
        mov     edi, esi
1399
        mov     edi, esi
1397
        shl     edi, 5
1400
        shl     edi, BSF sizeof.WDATA
Line 1398... Line 1401...
1398
        add     edi, window_data
1401
        add     edi, window_data
1399
 
1402
 
Line 1628... Line 1631...
1628
 
1631
 
1629
align 4
1632
align 4
1630
;< edx = pointer to WDATA struct
1633
;< edx = pointer to WDATA struct
1631
window._.sys_set_window:
1634
window._.sys_set_window:
1632
        mov     eax, [current_slot_idx]
1635
        mov     eax, [current_slot_idx]
1633
        shl     eax, 5
1636
        shl     eax, BSF sizeof.WDATA
1634
        add     eax, window_data
1637
        add     eax, window_data
1635
; save window colors
1638
; save window colors
1636
        mov     [eax + WDATA.cl_workarea], edx
1639
        mov     [eax + WDATA.cl_workarea], edx
1637
        mov     [eax + WDATA.cl_titlebar], esi
1640
        mov     [eax + WDATA.cl_titlebar], esi
Line 1864... Line 1867...
1864
        pushad
1867
        pushad
Line 1865... Line 1868...
1865
 
1868
 
1866
        cmp     esi, 1
1869
        cmp     esi, 1
1867
        jz      .check_for_shaped_window
1870
        jz      .check_for_shaped_window
1868
        mov     edi, esi
1871
        mov     edi, esi
1869
        shl     edi, 5
1872
        shl     edi, BSF sizeof.WDATA
1870
        cmp     [window_data + edi + WDATA.box.width], 0
1873
        cmp     [window_data + edi + WDATA.box.width], 0
1871
        jnz     .check_for_shaped_window
1874
        jnz     .check_for_shaped_window
1872
        cmp     [window_data + edi + WDATA.box.height], 0
1875
        cmp     [window_data + edi + WDATA.box.height], 0
1873
        jz      .exit
1876
        jz      .exit
1874
;--------------------------------------
1877
;--------------------------------------
1875
align 4
1878
align 4
1876
.check_for_shaped_window:
1879
.check_for_shaped_window:
1877
        mov     edi, esi
1880
        mov     edi, esi
1878
        shl     edi, 8
1881
        shl     edi, BSF sizeof.APPDATA
1879
        add     edi, SLOT_BASE
1882
        add     edi, SLOT_BASE
1880
        cmp     [edi + APPDATA.wnd_shape], 0
1883
        cmp     [edi + APPDATA.wnd_shape], 0
Line 1881... Line 1884...
1881
        jne     .shaped_window
1884
        jne     .shaped_window
Line 1948... Line 1951...
1948
        ; edi = &shape
1951
        ; edi = &shape
1949
        ;       [scale]
1952
        ;       [scale]
1950
        push    edx ecx ; for loop - x,y size
1953
        push    edx ecx ; for loop - x,y size
Line 1951... Line 1954...
1951
 
1954
 
1952
        mov     ecx, esi
1955
        mov     ecx, esi
1953
        shl     ecx, 5
1956
        shl     ecx, BSF sizeof.WDATA
1954
        mov     edx, [window_data + ecx + WDATA.box.top]
1957
        mov     edx, [window_data + ecx + WDATA.box.top]
1955
        push    [window_data + ecx + WDATA.box.width]           ; for loop - width
1958
        push    [window_data + ecx + WDATA.box.width]           ; for loop - width
1956
        mov     ecx, [window_data + ecx + WDATA.box.left]
1959
        mov     ecx, [window_data + ecx + WDATA.box.left]
1957
        sub     ebx, edx
1960
        sub     ebx, edx
Line 2034... Line 2037...
2034
        mov     ebx, [thread_count]
2037
        mov     ebx, [thread_count]
Line 2035... Line 2038...
2035
 
2038
 
Line 2036... Line 2039...
2036
;       DEBUGF  1, "K : thread_count (0x%x)\n", ebx
2039
;       DEBUGF  1, "K : thread_count (0x%x)\n", ebx
2037
 
2040
 
2038
        movzx   ebx, word[WIN_POS + ebx * 2]
2041
        movzx   ebx, word[WIN_POS + ebx * 2]
2039
        shl     ebx, 5
2042
        shl     ebx, BSF sizeof.WDATA
2040
        add     eax, window_data
2043
        add     eax, window_data
2041
        mov     al, [window_data + ebx + WDATA.fl_wstyle]
2044
        mov     al, [window_data + ebx + WDATA.fl_wstyle]
2042
        and     al, 0x0f
2045
        and     al, 0x0f
Line 2189... Line 2192...
2189
 
2192
 
2190
        cmp     esi, eax
2193
        cmp     esi, eax
Line 2191... Line 2194...
2191
        ja      .exit.no_redraw
2194
        ja      .exit.no_redraw
2192
 
2195
 
2193
        movzx   edx, word[esi]
2196
        movzx   edx, word[esi]
2194
        shl     edx, 5 ; size of TASKDATA and WDATA is 32 bytes
2197
        shl     edx, BSF sizeof.WDATA ; size of TASKDATA and WDATA is 32 bytes
Line 2195... Line 2198...
2195
        cmp     byte [TASK_TABLE + edx + TASKDATA.state], TSTATE_FREE
2198
        cmp     byte [SLOT_BASE + edx*8 - sizeof.APPDATA + APPDATA.state], TSTATE_FREE
2196
        je      .next_window
2199
        je      .next_window
2197
 
2200
 
Line 2281... Line 2284...
2281
        call    drawwindow_I_caption
2284
        call    drawwindow_I_caption
2282
;--------------------------------------
2285
;--------------------------------------
2283
align 4
2286
align 4
2284
.2:
2287
.2:
2285
        mov     edi, [current_slot_idx]
2288
        mov     edi, [current_slot_idx]
2286
        shl     edi, 5
2289
        shl     edi, BSF sizeof.WDATA
2287
        test    [edi + window_data + WDATA.fl_wstyle], WSTYLE_HASCAPTION
2290
        test    [edi + window_data + WDATA.fl_wstyle], WSTYLE_HASCAPTION
2288
        jz      .exit
2291
        jz      .exit
2289
        mov     edx, [edi * 8 + SLOT_BASE + APPDATA.wnd_caption]
2292
        mov     edx, [edi * 8 + SLOT_BASE + APPDATA.wnd_caption]
2290
        or      edx, edx
2293
        or      edx, edx
2291
        jz      .exit
2294
        jz      .exit
Line 2385... Line 2388...
2385
 
2388
 
2386
align 4
2389
align 4
2387
; void __fastcall get_window_rect(struct RECT* rc);
2390
; void __fastcall get_window_rect(struct RECT* rc);
2388
; ecx = pointer to RECT
2391
; ecx = pointer to RECT
2389
window._.get_rect:
2392
window._.get_rect:
-
 
2393
        mov     eax, [current_slot_idx]
Line 2390... Line 2394...
2390
        mov     eax, [TASK_BASE]
2394
        shl     eax, BSF sizeof.WDATA
2391
 
2395
 
Line 2392... Line 2396...
2392
        mov     edx, [eax-twdw + WDATA.box.left]
2396
        mov     edx, [eax + window_data + WDATA.box.left]
2393
        mov     [ecx+RECT.left], edx
2397
        mov     [ecx+RECT.left], edx
Line 2394... Line 2398...
2394
 
2398
 
2395
        add     edx, [eax-twdw + WDATA.box.width]
2399
        add     edx, [eax + window_data + WDATA.box.width]
Line 2396... Line 2400...
2396
        mov     [ecx+RECT.right], edx
2400
        mov     [ecx+RECT.right], edx
2397
 
2401
 
2398
        mov     edx, [eax-twdw + WDATA.box.top]
2402
        mov     edx, [eax +window_data + WDATA.box.top]
2399
        mov     [ecx+RECT.top], edx
2403
        mov     [ecx+RECT.top], edx
Line 2436... Line 2440...
2436
        push    ebp
2440
        push    ebp
2437
        mov     ebp, [thread_count]
2441
        mov     ebp, [thread_count]
2438
        cmp     ebp, 1
2442
        cmp     ebp, 1
2439
        jbe     .exit
2443
        jbe     .exit
Line 2440... Line 2444...
2440
 
2444
 
2441
        shl     esi, 5
2445
        shl     esi, BSF sizeof.WDATA
2442
        cmp     [esi + window_data + WDATA.z_modif], ZPOS_ALWAYS_TOP
2446
        cmp     [esi + window_data + WDATA.z_modif], ZPOS_ALWAYS_TOP
Line 2443... Line 2447...
2443
        je      .exit
2447
        je      .exit
2444
 
2448
 
Line 2455... Line 2459...
2455
        mov     ebp, [thread_count]
2459
        mov     ebp, [thread_count]
2456
;--------------------------------------
2460
;--------------------------------------
2457
align 4
2461
align 4
2458
.next_window:
2462
.next_window:
2459
        movzx   edi, word[WIN_POS + esi * 2]
2463
        movzx   edi, word[WIN_POS + esi * 2]
2460
        shl     edi, 5                  ;size of TASKDATA and WDATA = 32 bytes
2464
        shl     edi, BSF sizeof.WDATA         ;size of TASKDATA and WDATA = 32 bytes
Line 2461... Line 2465...
2461
 
2465
 
2462
        cmp     byte [TASK_TABLE + edi + TASKDATA.state], TSTATE_FREE
2466
        cmp     byte [SLOT_BASE + edi*8 + APPDATA.state], TSTATE_FREE
Line 2463... Line 2467...
2463
        je      .skip_window
2467
        je      .skip_window
2464
 
2468
 
2465
        add     edi, window_data
2469
        add     edi, window_data