Subversion Repositories Kolibri OS

Rev

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

Rev 9926 Rev 9930
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: 9926 $
9
$Revision: 9930 $
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, [current_slot_idx]
81
        mov     edx, [current_slot]
82
        shl     edx, BSF sizeof.WDATA
82
        mov     edx, [edx + APPDATA.window]
83
        add     eax, [window_data + edx + WDATA.box.left]
83
        add     eax, [edx + WDATA.box.left]
84
        add     ebx, [window_data + edx + WDATA.box.top]
84
        add     ebx, [edx + WDATA.box.top]
85
        add     eax, [window_data + edx + WDATA.clientbox.left]
85
        add     eax, [edx + WDATA.clientbox.left]
86
        add     ebx, [window_data + edx + WDATA.clientbox.top]
86
        add     ebx, [edx + WDATA.clientbox.top]
87
        xor     edi, edi ; no force
87
        xor     edi, edi ; no force
88
        and     ecx, 0xFBFFFFFF  ;negate 0x04000000 save to mouseunder area
88
        and     ecx, 0xFBFFFFFF  ;negate 0x04000000 save to mouseunder area
89
        jmp     __sys_putpixel
89
        jmp     __sys_putpixel
90
;------------------------------------------------------------------------------
90
;------------------------------------------------------------------------------
Line 101... Line 101...
101
@@:
101
@@:
102
        stdcall is_region_userspace, edx, esi
102
        stdcall is_region_userspace, edx, esi
103
        pop     esi
103
        pop     esi
104
        jnz     .err
104
        jnz     .err
Line 105... Line 105...
105
 
105
 
106
        mov     eax, [current_slot_idx]
106
        mov     eax, [current_slot]
107
        shl     eax, BSF sizeof.WDATA
107
        mov     eax, [eax + APPDATA.window]
108
        mov     ebp, [window_data + eax + WDATA.box.left]
108
        mov     ebp, [eax + WDATA.box.left]
109
        add     ebp, [window_data + eax + WDATA.clientbox.left]
109
        add     ebp, [eax + WDATA.clientbox.left]
110
        shl     ebp, 16
110
        shl     ebp, 16
111
        add     ebp, [window_data + eax + WDATA.box.top]
111
        add     ebp, [eax + WDATA.box.top]
112
        add     bp, word[window_data + eax + WDATA.clientbox.top]
112
        add     bp, word[eax + WDATA.clientbox.top]
113
        test    ecx, 0x08000000  ; redirect the output to the user area
113
        test    ecx, 0x08000000  ; redirect the output to the user area
114
        jnz     @f
114
        jnz     @f
115
        add     ebx, ebp
115
        add     ebx, ebp
116
align 4
116
align 4
Line 145... Line 145...
145
 
145
 
146
        movzx   ecx, ax ; ecx - x.size
146
        movzx   ecx, ax ; ecx - x.size
147
        shr     eax, 16 ; eax - x.coord
147
        shr     eax, 16 ; eax - x.coord
148
        movzx   edx, bx ; edx - y.size
148
        movzx   edx, bx ; edx - y.size
149
        shr     ebx, 16 ; ebx - y.coord
149
        shr     ebx, 16 ; ebx - y.coord
150
        mov     esi, [current_slot_idx]
150
        mov     esi, [current_slot]
151
        shl     esi, BSF sizeof.WDATA
151
        mov     esi, [esi + APPDATA.window]
152
        add     eax, [window_data + esi + WDATA.clientbox.left]
152
        add     eax, [esi + WDATA.clientbox.left]
153
        add     ebx, [window_data + esi + WDATA.clientbox.top]
153
        add     ebx, [esi + WDATA.clientbox.top]
154
        add     ecx, eax
154
        add     ecx, eax
155
        add     edx, ebx
155
        add     edx, ebx
156
        jmp     vesa20_drawbar
156
        jmp     vesa20_drawbar
157
.drectr:
157
.drectr:
158
        ret
158
        ret
Line 159... Line 159...
159
;------------------------------------------------------------------------------
159
;------------------------------------------------------------------------------
160
 
160
 
161
align 4
161
align 4
162
; system function 38
162
; system function 38
163
syscall_drawline:
163
syscall_drawline:
164
        mov     edi, [current_slot_idx]
164
        mov     edi, [current_slot]
165
        shl     edi, BSF sizeof.WDATA
165
        mov     edi, [edi + APPDATA.window]
166
        movzx   eax, word[window_data + edi + WDATA.box.left]
166
        movzx   eax, word[edi + WDATA.box.left]
167
        mov     ebp, eax
167
        mov     ebp, eax
168
        add     ebp, [window_data + edi + WDATA.clientbox.left]
168
        add     ebp, [edi + WDATA.clientbox.left]
169
        add     ax, word[window_data + edi + WDATA.clientbox.left]
169
        add     ax, word[edi + WDATA.clientbox.left]
170
        add     ebp, ebx
170
        add     ebp, ebx
171
        shl     eax, 16
171
        shl     eax, 16
172
        movzx   ebx, word[window_data + edi + WDATA.box.top]
172
        movzx   ebx, word[edi + WDATA.box.top]
173
        add     eax, ebp
173
        add     eax, ebp
174
        mov     ebp, ebx
174
        mov     ebp, ebx
175
        add     ebp, [window_data + edi + WDATA.clientbox.top]
175
        add     ebp, [edi + WDATA.clientbox.top]
176
        add     bx, word[window_data + edi + WDATA.clientbox.top]
176
        add     bx, word[edi + WDATA.clientbox.top]
177
        add     ebp, ecx
177
        add     ebp, ecx
178
        shl     ebx, 16
178
        shl     ebx, 16
179
        xor     edi, edi
179
        xor     edi, edi
Line 481... Line 481...
481
        ret
481
        ret
482
;------------------------------------------------------------------------------
482
;------------------------------------------------------------------------------
Line 483... Line 483...
483
 
483
 
484
; system function 71
484
; system function 71
485
syscall_window_settings: 
485
syscall_window_settings: 
486
        mov     edi, [current_slot_idx]
486
        mov     edi, [current_slot]
487
        shl     edi, BSF sizeof.WDATA
487
        mov     edi, [edi + APPDATA.window]
488
        or      [edi + window_data + WDATA.fl_wstyle], WSTYLE_HASCAPTION
488
        or      [edi + WDATA.fl_wstyle], WSTYLE_HASCAPTION
489
        cmp     ebx, 2
489
        cmp     ebx, 2
490
        jz      @f
490
        jz      @f
491
        xor     edx, edx
491
        xor     edx, edx
492
@@:
492
@@:
493
        cmp     dl, 4
493
        cmp     dl, 4
494
        jc      @f
494
        jc      @f
495
        xor     edx, edx
495
        xor     edx, edx
496
@@:
496
@@:
497
        mov     [window_data + edi + WDATA.caption], ecx
497
        mov     [edi + WDATA.caption], ecx
498
        mov     [window_data + edi + WDATA.captionEncoding], dl
498
        mov     [edi + WDATA.captionEncoding], dl
499
        jmp     window._.draw_window_caption
499
        jmp     window._.draw_window_caption
Line 500... Line 500...
500
;------------------------------------------------------------------------------
500
;------------------------------------------------------------------------------
501
 
501
 
502
align 4
502
align 4
503
set_window_defaults:
503
set_window_defaults:
504
        mov     byte [window_data + sizeof.WDATA + WDATA.cl_titlebar + 3], 1 ; desktop is not movable
504
        mov     byte [background_window + WDATA.cl_titlebar + 3], 1 ; desktop is not movable
505
        push    eax ecx
505
        push    eax ecx
506
        xor     eax, eax
506
        xor     eax, eax
507
        mov     ecx, WIN_STACK
507
        mov     ecx, WIN_STACK
Line 553... Line 553...
553
        mov     ebp, [thread_count]
553
        mov     ebp, [thread_count]
554
;--------------------------------------
554
;--------------------------------------
555
align 4
555
align 4
556
.next_window:
556
.next_window:
557
        movzx   edi, word[WIN_POS + esi * 2]
557
        movzx   edi, word[WIN_POS + esi * 2]
558
        shl     edi, BSF sizeof.WDATA        ;size of TASKDATA and WDATA = 32 bytes
558
        shl     edi, BSF sizeof.WDATA
Line 559... Line 559...
559
 
559
 
560
        cmp     byte [SLOT_BASE + edi*(sizeof.APPDATA/sizeof.WDATA) + APPDATA.state], TSTATE_FREE
560
        test    byte [window_data + edi + WDATA.fl_wstate], WSTATE_USED
Line 561... Line 561...
561
        je      .skip_window
561
        jz      .skip_window
562
 
562
 
563
        add     edi, window_data
563
        add     edi, window_data
Line 1084... Line 1084...
1084
align 4
1084
align 4
1085
.loop:
1085
.loop:
1086
        movzx   edi, word[WIN_POS + eax * 2]
1086
        movzx   edi, word[WIN_POS + eax * 2]
1087
        shl     edi, BSF sizeof.WDATA
1087
        shl     edi, BSF sizeof.WDATA
1088
; it is a unused slot?
1088
; it is a unused slot?
1089
        cmp     byte [SLOT_BASE + edi*(sizeof.APPDATA/sizeof.WDATA) + APPDATA.state], TSTATE_FREE
1089
        test    byte [window_data + edi + WDATA.fl_wstate], WSTATE_USED
1090
        je      @f
1090
        jz      @f
1091
; it is a hidden thread?
1091
; it is a hidden thread?
1092
        lea     esi, [SLOT_BASE + edi*(sizeof.APPDATA/sizeof.WDATA) + APPDATA.app_name]
1092
        lea     esi, [SLOT_BASE + edi*(sizeof.APPDATA/sizeof.WDATA) + APPDATA.app_name]
1093
        cmp     [esi], byte '@'
1093
        cmp     [esi], byte '@'
1094
        je      @f
1094
        je      @f
1095
; is it already minimized?
1095
; is it already minimized?
1096
        test    [edi + window_data+WDATA.fl_wstate], WSTATE_MINIMIZED
1096
        test    [window_data + edi + WDATA.fl_wstate], WSTATE_MINIMIZED
1097
        jnz     @f
1097
        jnz     @f
1098
; no it's not, let's do that
1098
; no it's not, let's do that
1099
        or      [edi + window_data+WDATA.fl_wstate], WSTATE_MINIMIZED
1099
        or      [window_data + edi + WDATA.fl_wstate], WSTATE_MINIMIZED
1100
        inc     edx
1100
        inc     edx
1101
;--------------------------------------
1101
;--------------------------------------
1102
align 4
1102
align 4
1103
@@:
1103
@@:
1104
        inc     eax
1104
        inc     eax
Line 1289... Line 1289...
1289
        mov     eax, esp
1289
        mov     eax, esp
1290
        jmp     .set_box
1290
        jmp     .set_box
1291
;--------------------------------------
1291
;--------------------------------------
1292
align 4
1292
align 4
1293
.restore_size:
1293
.restore_size:
1294
        mov     eax, esi
-
 
1295
        shl     eax, BSF sizeof.APPDATA
-
 
1296
        add     eax, SLOT_BASE + APPDATA.saved_box
-
 
1297
        push    [eax + BOX.height] \
1294
        push    [edi + WDATA.saved_box.height] \
1298
                [eax + BOX.width] \
1295
                [edi + WDATA.saved_box.width] \
1299
                [eax + BOX.top] \
1296
                [edi + WDATA.saved_box.top] \
1300
                [eax + BOX.left]
1297
                [edi + WDATA.saved_box.left]
1301
        mov     eax, esp
1298
        mov     eax, esp
1302
;--------------------------------------
1299
;--------------------------------------
1303
align 4
1300
align 4
1304
.set_box:
1301
.set_box:
1305
        test    bl, WSTATE_ROLLEDUP
1302
        test    bl, WSTATE_ROLLEDUP
Line 1323... Line 1320...
1323
 
1320
 
1324
 
1321
 
1325
align 4
1322
align 4
1326
;> esi = process slot
-
 
1327
sys_window_rollup_handler:
-
 
1328
        mov     edx, esi
-
 
1329
        shl     edx, BSF sizeof.APPDATA
-
 
1330
        add     edx, SLOT_BASE
1323
;> esi = process slot
1331
 
1324
sys_window_rollup_handler:
1332
        ; toggle normal/rolled up window state
1325
        ; toggle normal/rolled up window state
Line 1333... Line 1326...
1333
        mov     bl, [edi + WDATA.fl_wstate]
1326
        mov     bl, [edi + WDATA.fl_wstate]
Line 1348... Line 1341...
1348
align 4
1341
align 4
1349
.restore_size:
1342
.restore_size:
1350
        test    bl, WSTATE_MAXIMIZED
1343
        test    bl, WSTATE_MAXIMIZED
1351
        jnz     @f
1344
        jnz     @f
1352
        add     esp, -sizeof.BOX
1345
        add     esp, -sizeof.BOX
1353
        lea     eax, [edx + APPDATA.saved_box]
1346
        lea     eax, [edi + WDATA.saved_box]
1354
        jmp     .set_box
1347
        jmp     .set_box
1355
;--------------------------------------
1348
;--------------------------------------
1356
align 4
1349
align 4
1357
@@:
1350
@@:
1358
        mov     eax, [screen_workarea.top]
1351
        mov     eax, [screen_workarea.top]
Line 1541... Line 1534...
1541
 
1534
 
1542
        or      cl, ch
1535
        or      cl, ch
1543
        test    cl, WSTATE_MAXIMIZED
1536
        test    cl, WSTATE_MAXIMIZED
Line 1544... Line -...
1544
        jnz     .exit
-
 
1545
 
-
 
1546
        mov     eax, edi
-
 
1547
        sub     eax, window_data
-
 
1548
        shl     eax, (BSF sizeof.APPDATA - BSF sizeof.WDATA)
-
 
1549
        add     eax, SLOT_BASE
1537
        jnz     .exit
1550
 
1538
 
Line 1551... Line 1539...
1551
        lea     ebx, [edi + WDATA.box]
1539
        lea     ebx, [edi + WDATA.box]
1552
        xchg    esp, ebx
1540
        xchg    esp, ebx
1553
 
1541
 
1554
        pop     [eax + APPDATA.saved_box.left] \
1542
        pop     [edi + WDATA.saved_box.left] \
Line 1555... Line 1543...
1555
                [eax + APPDATA.saved_box.top] \
1543
                [edi + WDATA.saved_box.top] \
Line 1556... Line 1544...
1556
                [eax + APPDATA.saved_box.width] \
1544
                [edi + WDATA.saved_box.width] \
1557
                edx
1545
                edx
Line 1558... Line 1546...
1558
 
1546
 
1559
        xchg    esp, ebx
1547
        xchg    esp, ebx
1560
 
1548
 
1561
        test    ch, WSTATE_ROLLEDUP
1549
        test    ch, WSTATE_ROLLEDUP
1562
        jnz     .exit
1550
        jnz     .exit
1563
 
1551
 
Line 1659... Line 1647...
1659
 
1647
 
1660
        mov     cl, [edi + WDATA.fl_wstyle]
1648
        mov     cl, [edi + WDATA.fl_wstyle]
Line 1661... Line 1649...
1661
        mov     eax, [edi + WDATA.cl_frames]
1649
        mov     eax, [edi + WDATA.cl_frames]
1662
 
-
 
1663
        mov     esi, [esp]
-
 
Line 1664... Line 1650...
1664
        sub     edi, window_data
1650
 
1665
        shl     edi, (BSF sizeof.APPDATA - BSF sizeof.WDATA)
1651
        mov     esi, [esp]
1666
 
1652
 
1667
        and     cl, 0x0F
1653
        and     cl, 0x0F
Line 1674... Line 1660...
1674
;--------------------------------------
1660
;--------------------------------------
1675
align 4
1661
align 4
1676
@@:
1662
@@:
1677
        mov     [esi + WDATA.caption], eax
1663
        mov     [esi + WDATA.caption], eax
Line 1678... Line 1664...
1678
 
1664
 
1679
        add     edi, SLOT_BASE + APPDATA.saved_box
1665
        add     edi, WDATA.saved_box
1680
        movsd
1666
        movsd
1681
        movsd
1667
        movsd
1682
        movsd
1668
        movsd
Line 2184... Line 2170...
2184
 
2170
 
2185
        cmp     esi, eax
2171
        cmp     esi, eax
Line 2186... Line 2172...
2186
        ja      .exit.no_redraw
2172
        ja      .exit.no_redraw
2187
 
2173
 
2188
        movzx   edx, word[esi]
2174
        movzx   edx, word[esi]
2189
        shl     edx, BSF sizeof.WDATA ; size of TASKDATA and WDATA is 32 bytes
2175
        shl     edx, BSF sizeof.WDATA
Line 2190... Line 2176...
2190
        cmp     byte [SLOT_BASE + edx*(sizeof.APPDATA/sizeof.WDATA) - sizeof.APPDATA + APPDATA.state], TSTATE_FREE
2176
        cmp     byte [SLOT_BASE + edx*(sizeof.APPDATA/sizeof.WDATA) - sizeof.APPDATA + APPDATA.state], TSTATE_FREE
2191
        je      .next_window
2177
        je      .next_window
Line 2451... Line 2437...
2451
        mov     ebp, [thread_count]
2437
        mov     ebp, [thread_count]
2452
;--------------------------------------
2438
;--------------------------------------
2453
align 4
2439
align 4
2454
.next_window:
2440
.next_window:
2455
        movzx   edi, word[WIN_POS + esi * 2]
2441
        movzx   edi, word[WIN_POS + esi * 2]
2456
        shl     edi, BSF sizeof.WDATA         ;size of TASKDATA and WDATA = 32 bytes
2442
        shl     edi, BSF sizeof.WDATA
Line 2457... Line 2443...
2457
 
2443
 
2458
        cmp     byte [SLOT_BASE + edi*(sizeof.APPDATA/sizeof.WDATA) + APPDATA.state], TSTATE_FREE
2444
        test    byte [window_data + edi + WDATA.fl_wstate], WSTATE_USED
Line 2459... Line 2445...
2459
        je      .skip_window
2445
        jz      .skip_window
2460
 
2446
 
2461
        add     edi, window_data
2447
        add     edi, window_data