Subversion Repositories Kolibri OS

Rev

Rev 5926 | Rev 6802 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 5926 Rev 6800
1
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2
;;                                                              ;;
2
;;                                                              ;;
3
;; Copyright (C) KolibriOS team 2004-2015. All rights reserved. ;;
3
;; Copyright (C) KolibriOS team 2004-2015. All rights reserved. ;;
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
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
8
 
8
 
9
$Revision: 5926 $
9
$Revision: 6800 $
10
 
10
 
11
;==============================================================================
11
;==============================================================================
12
;///// public functions ///////////////////////////////////////////////////////
12
;///// public functions ///////////////////////////////////////////////////////
13
;==============================================================================
13
;==============================================================================
14
 
14
 
15
window.BORDER_SIZE = 5
15
window.BORDER_SIZE = 5
16
 
-
 
17
macro FuncTable name, table_name, [label]
-
 
18
{
-
 
19
  common
-
 
20
    align 4
-
 
21
    \label name#.#table_name dword
-
 
22
  forward
-
 
23
    dd name#.#label
-
 
24
  common
-
 
25
    name#.sizeof.#table_name = $ - name#.#table_name
-
 
26
}
-
 
27
 
16
 
28
uglobal
17
uglobal
29
  common_colours rd 48
18
  common_colours rd 48
30
  draw_limits    RECT
19
  draw_limits    RECT
31
endg
20
endg
32
 
21
 
33
;------------------------------------------------------------------------------
22
;------------------------------------------------------------------------------
34
syscall_draw_window: ;///// system function 0 /////////////////////////////////
23
syscall_draw_window: ;///// system function 0 /////////////////////////////////
35
;------------------------------------------------------------------------------
24
;------------------------------------------------------------------------------
36
        mov     eax, edx
25
        mov     eax, edx
37
        shr     eax, 24
26
        shr     eax, 24
38
        and     al, 0x0f
27
        and     al, 0x0f
39
        cmp     al, 5
28
        cmp     al, 5
40
        jae     .exit
29
        jae     .exit
41
 
30
 
42
        push    eax
31
        push    eax
43
        call    window._.sys_set_window
32
        call    window._.sys_set_window
44
        pop     eax
33
        pop     eax
45
 
34
 
46
        or      al, al
35
        or      al, al
47
        jnz     @f
36
        jnz     @f
48
 
37
 
49
; type I - original style
38
; type I - original style
50
        call    drawwindow_I
39
        call    drawwindow_I
51
        jmp     window._.draw_window_caption.2
40
        jmp     window._.draw_window_caption.2
52
;--------------------------------------
41
;--------------------------------------
53
@@:
42
@@:
54
        dec     al
43
        dec     al
55
        jnz     @f
44
        jnz     @f
56
 
45
 
57
; type II - only reserve area, no draw
46
; type II - only reserve area, no draw
58
        call    __sys_draw_pointer
47
        call    __sys_draw_pointer
59
        jmp     .exit
48
        jmp     .exit
60
;--------------------------------------
49
;--------------------------------------
61
@@:
50
@@:
62
        dec     al
51
        dec     al
63
        jnz     @f
52
        jnz     @f
64
 
53
 
65
; type III  - new style
54
; type III  - new style
66
        call    drawwindow_III
55
        call    drawwindow_III
67
        jmp     window._.draw_window_caption.2
56
        jmp     window._.draw_window_caption.2
68
;--------------------------------------
57
;--------------------------------------
69
@@:
58
@@:
70
; type IV & V - skinned window (resizable & not)
59
; type IV & V - skinned window (resizable & not)
71
        mov     eax, [TASK_COUNT]
60
        mov     eax, [TASK_COUNT]
72
        movzx   eax, word[WIN_POS + eax * 2]
61
        movzx   eax, word[WIN_POS + eax * 2]
73
        cmp     eax, [CURRENT_TASK]
62
        cmp     eax, [CURRENT_TASK]
74
        setz    al
63
        setz    al
75
        movzx   eax, al
64
        movzx   eax, al
76
        push    eax
65
        push    eax
77
        call    drawwindow_IV
66
        call    drawwindow_IV
78
        jmp     window._.draw_window_caption.2
67
        jmp     window._.draw_window_caption.2
79
;--------------------------------------
68
;--------------------------------------
80
.exit:
69
.exit:
81
        ret
70
        ret
82
;------------------------------------------------------------------------------
71
;------------------------------------------------------------------------------
83
syscall_display_settings: ;///// system function 48 ///////////////////////////
72
syscall_display_settings: ;///// system function 48 ///////////////////////////
84
;------------------------------------------------------------------------------
73
;------------------------------------------------------------------------------
85
;; Redraw screen:
-
 
86
;< ebx = 0
-
 
87
; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
 
88
;; Set button style:
-
 
89
;< ebx = 1
-
 
90
;< ecx = 0 (flat) or 1 (with gradient)
-
 
91
; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
 
92
;; Set system color palette:
-
 
93
;< ebx = 2
-
 
94
;< ecx = pointer to color table
-
 
95
;< edx = size of color table
-
 
96
; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
 
97
;; Get system color palette:
-
 
98
;< ebx = 3
-
 
99
;< ecx = pointer to color table buffer
-
 
100
;< edx = size of color table buffer
-
 
101
; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
 
102
;; Get skinned caption height:
-
 
103
;< ebx = 4
-
 
104
;> eax = height in pixels
-
 
105
; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
 
106
;; Get screen working area:
-
 
107
;< ebx = 5
-
 
108
;> eax = pack[16(left), 16(right)]
-
 
109
;> ebx = pack[16(top), 16(bottom)]
-
 
110
; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
 
111
;; Set screen working area:
-
 
112
;< ebx = 6
-
 
113
;< ecx = pack[16(left), 16(right)]
-
 
114
;< edx = pack[16(top), 16(bottom)]
-
 
115
; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
 
116
;; Get skin margins:
-
 
117
;< ebx = 7
-
 
118
;> eax = pack[16(left), 16(right)]
-
 
119
;> ebx = pack[16(top), 16(bottom)]
-
 
120
; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
 
121
;; Set skin:
-
 
122
;< ebx = 8
-
 
123
;< ecx = pointer to FileInfoBlock struct
-
 
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
-
 
141
;------------------------------------------------------------------------------
-
 
142
        cmp     ebx, .sizeof.ftable / 4
74
        cmp     ebx, 13
143
        ja      @f
75
        ja      @f
144
        jmp     [.ftable + ebx * 4]
76
        jmp     dword[.ftable + ebx*4]
-
 
77
 
-
 
78
align 4
-
 
79
.ftable:
-
 
80
dd  .redrawWholeScreen
-
 
81
dd  .setButtonStyle
-
 
82
dd  .setSystemColors
-
 
83
dd  .getSystemColors
-
 
84
dd  .getCaptionHeight
145
;------------------------------------------------------------------------------
85
dd  .getScreenWorkingArea
146
syscall_display_settings.00:
86
dd  .setScreenWorkingArea
-
 
87
dd  .getSkinMargins
-
 
88
dd  .setSkin
-
 
89
dd  .getFontSmoothing
-
 
90
dd  .setFontSmoothing
-
 
91
dd  .getFontSize
-
 
92
dd  .setFontSize
-
 
93
dd  .setSkinUnicode
-
 
94
 
-
 
95
.redrawWholeScreen:
147
        xor     eax, eax
96
        xor     eax, eax
148
        inc     ebx
97
        inc     ebx
149
        cmp     [windowtypechanged], ebx
98
        cmp     [windowtypechanged], ebx
150
        jne     @f
99
        jne     .ret
151
        mov     [windowtypechanged], eax
100
        mov     [windowtypechanged], eax
-
 
101
.redrawScreen:
-
 
102
        xor     eax, eax
-
 
103
        mov     [draw_limits.left], eax
-
 
104
        mov     [draw_limits.top], eax
-
 
105
        mov     eax, [_display.width]
-
 
106
        dec     eax
-
 
107
        mov     [draw_limits.right], eax
152
        jmp     syscall_display_settings._.redraw_whole_screen
108
        mov     eax, [_display.height]
-
 
109
        dec     eax
153
;------------------------------------------------------------------------------
110
        mov     [draw_limits.bottom], eax
-
 
111
        mov     eax, window_data
154
syscall_display_settings.01:
112
        jmp     redrawscreen
-
 
113
 
-
 
114
.setButtonStyle:
-
 
115
; in: ecx: 0 = flat, 1 = with gradient
155
        and     ecx, 1
116
        and     ecx, 1
156
        cmp     ecx, [buttontype]
117
        cmp     ecx, [buttontype]
157
        je      @f
118
        je      .ret
158
        mov     [buttontype], ecx
119
        mov     [buttontype], ecx
159
        mov     [windowtypechanged], ebx
120
        mov     [windowtypechanged], ebx
160
@@:
121
.ret:
161
        ret
122
        ret
162
;------------------------------------------------------------------------------
-
 
-
 
123
 
163
syscall_display_settings.02:
124
.setSystemColors:
-
 
125
; in: ecx = pointer to color table, edx = size of color table
164
        dec     ebx
126
        dec     ebx
165
        mov     esi, ecx
127
        mov     esi, ecx
166
        cmp     edx, 192
128
        cmp     edx, 192
167
        jnae    @f
129
        jnae    @f
168
        mov     edx, 192 ; max size
130
        mov     edx, 192 ; max size
169
@@:
131
@@:
170
        mov     edi, common_colours
132
        mov     edi, common_colours
171
        mov     ecx, edx
133
        mov     ecx, edx
172
        rep movsb
134
        rep movsb
173
        mov     [windowtypechanged], ebx
135
        mov     [windowtypechanged], ebx
174
        ret
136
        ret
175
;------------------------------------------------------------------------------
-
 
-
 
137
 
176
syscall_display_settings.03:
138
.getSystemColors:
-
 
139
; in: ecx = pointer to color table, edx = size of color table
177
        mov     edi, ecx
140
        mov     edi, ecx
178
        cmp     edx, 192
141
        cmp     edx, 192
179
        jnae    @f
142
        jnae    @f
180
        mov     edx, 192 ; max size
143
        mov     edx, 192 ; max size
181
@@:
144
@@:
182
        mov     esi, common_colours
145
        mov     esi, common_colours
183
        mov     ecx, edx
146
        mov     ecx, edx
184
        rep movsb
147
        rep movsb
185
        ret
148
        ret
186
;------------------------------------------------------------------------------
-
 
-
 
149
 
187
syscall_display_settings.04:
150
.getCaptionHeight:
188
        mov     eax, [_skinh]
151
        mov     eax, [_skinh]
189
        mov     [esp + 32], eax
152
        mov     [esp + 32], eax
190
        ret
153
        ret
191
;------------------------------------------------------------------------------
-
 
-
 
154
 
192
syscall_display_settings.05:
155
.getScreenWorkingArea:
-
 
156
; out: eax = pack[left, right], ebx = pack[top, bottom]
193
        mov     eax, [screen_workarea.left - 2]
157
        mov     eax, [screen_workarea.left - 2]
194
        mov     ax, word[screen_workarea.right]
158
        mov     ax, word[screen_workarea.right]
195
        mov     [esp + 32], eax
159
        mov     [esp + 32], eax
196
        mov     eax, [screen_workarea.top - 2]
160
        mov     eax, [screen_workarea.top - 2]
197
        mov     ax, word[screen_workarea.bottom]
161
        mov     ax, word[screen_workarea.bottom]
198
        mov     [esp + 20], eax
162
        mov     [esp + 20], eax
199
        ret
163
        ret
200
;------------------------------------------------------------------------------
-
 
-
 
164
 
201
syscall_display_settings.06:
165
.setScreenWorkingArea:
-
 
166
; in: ecx = pack[left, right], edx = pack[top, bottom]
202
        xor     esi, esi
167
        xor     esi, esi
203
        mov     edi, [_display.width]
168
        mov     edi, [_display.width]
204
        dec     edi
169
        dec     edi
205
        mov     eax, ecx
170
        mov     eax, ecx
206
        movsx   ebx, ax
171
        movsx   ebx, ax
207
        sar     eax, 16
172
        sar     eax, 16
208
        cmp     eax, ebx
173
        cmp     eax, ebx
209
        jge     .check_horizontal
174
        jge     .check_horizontal
210
        inc     esi
175
        inc     esi
211
        or      eax, eax
176
        or      eax, eax
212
        jge     @f
177
        jge     @f
213
        xor     eax, eax
178
        xor     eax, eax
214
@@:
179
@@:
215
        mov     [screen_workarea.left], eax
180
        mov     [screen_workarea.left], eax
216
        cmp     ebx, edi
181
        cmp     ebx, edi
217
        jle     @f
182
        jle     @f
218
        mov     ebx, edi
183
        mov     ebx, edi
219
@@:
184
@@:
220
        mov     [screen_workarea.right], ebx
185
        mov     [screen_workarea.right], ebx
221
.check_horizontal:
186
.check_horizontal:
222
        mov     edi, [_display.height]
187
        mov     edi, [_display.height]
223
        dec     edi
188
        dec     edi
224
        mov     eax, edx
189
        mov     eax, edx
225
        movsx   ebx, ax
190
        movsx   ebx, ax
226
        sar     eax, 16
191
        sar     eax, 16
227
        cmp     eax, ebx
192
        cmp     eax, ebx
228
        jge     .check_if_redraw_needed
193
        jge     .check_if_redraw_needed
229
        inc     esi
194
        inc     esi
230
        or      eax, eax
195
        or      eax, eax
231
        jge     @f
196
        jge     @f
232
        xor     eax, eax
197
        xor     eax, eax
233
@@:
198
@@:
234
        mov     [screen_workarea.top], eax
199
        mov     [screen_workarea.top], eax
235
        cmp     ebx, edi
200
        cmp     ebx, edi
236
        jle     @f
201
        jle     @f
237
        mov     ebx, edi
202
        mov     ebx, edi
238
@@:
203
@@:
239
        mov     [screen_workarea.bottom], ebx
204
        mov     [screen_workarea.bottom], ebx
240
.check_if_redraw_needed:
205
.check_if_redraw_needed:
241
        or      esi, esi
206
        or      esi, esi
242
        jz      @f
207
        jz      @f
243
 
-
 
244
        call    repos_windows
208
        call    repos_windows
-
 
209
.calculateScreen:
-
 
210
        xor     eax, eax
-
 
211
        xor     ebx, ebx
245
        jmp     syscall_display_settings._.calculate_whole_screen
212
        mov     ecx, [_display.width]
246
;------------------------------------------------------------------------------
213
        mov     edx, [_display.height]
-
 
214
        dec     ecx
-
 
215
        dec     edx
-
 
216
        jmp     calculatescreen
-
 
217
 
247
syscall_display_settings.07:
218
.getSkinMargins:
-
 
219
; out: eax = pack[left, right], ebx = pack[top, bottom]
248
        mov     eax, [_skinmargins + 0]
220
        mov     eax, [_skinmargins + 0]
249
        mov     [esp + 32], eax
221
        mov     [esp + 32], eax
250
        mov     eax, [_skinmargins + 4]
222
        mov     eax, [_skinmargins + 4]
251
        mov     [esp + 20], eax
223
        mov     [esp + 20], eax
252
@@:
-
 
253
        ret
224
        ret
254
;------------------------------------------------------------------------------
-
 
-
 
225
 
-
 
226
.setSkin:
255
syscall_display_settings.08:
227
; in: ecx -> file path string
256
        mov     ebx, ecx
228
        mov     ebx, ecx
257
        call    read_skin_file
229
        call    read_skin_file
258
        mov     [esp + 32], eax
230
        mov     [esp + 32], eax
259
        test    eax, eax
231
        test    eax, eax
260
        jnz     @b
232
        jnz     .ret
-
 
233
        call    .calculateScreen
-
 
234
        jmp     .redrawScreen
261
 
-
 
262
        call    syscall_display_settings._.calculate_whole_screen
-
 
263
        jmp     syscall_display_settings._.redraw_whole_screen
-
 
264
;------------------------------------------------------------------------------
235
 
265
syscall_display_settings.09:
236
.getFontSmoothing:
266
        xor     eax, eax
237
        xor     eax, eax
267
        mov     al, [fontSmoothing]
238
        mov     al, [fontSmoothing]
268
        mov     [esp + 32], eax
239
        mov     [esp + 32], eax
269
        ret
240
        ret
270
;------------------------------------------------------------------------------
-
 
-
 
241
 
271
syscall_display_settings.10:
242
.setFontSmoothing:
272
        mov     [fontSmoothing], cl
243
        mov     [fontSmoothing], cl
273
        ret
244
        ret
274
;------------------------------------------------------------------------------
-
 
-
 
245
 
275
syscall_display_settings.11:
246
.getFontSize:
276
        xor     eax, eax
247
        xor     eax, eax
277
        mov     al, [fontSize]
248
        mov     al, [fontSize]
278
        mov     [esp + 32], eax
249
        mov     [esp + 32], eax
279
        ret
250
        ret
280
;------------------------------------------------------------------------------
-
 
-
 
251
 
281
syscall_display_settings.12:
252
.setFontSize:
282
        mov     [fontSize], cl
253
        mov     [fontSize], cl
283
        ret
254
        ret
284
;------------------------------------------------------------------------------
-
 
-
 
255
 
285
syscall_display_settings._.calculate_whole_screen:
256
.setSkinUnicode:
286
        xor     eax, eax
257
; in: ecx -> file path string, edx = string encoding
287
        xor     ebx, ebx
258
        push    ecx edx
288
        mov     ecx, [_display.width]
259
        stdcall kernel_alloc, maxPathLength
289
        mov     edx, [_display.height]
260
        mov     edi, eax
290
        dec     ecx
261
        pop     eax esi
291
        dec     edx
262
        push    edi
292
        jmp     calculatescreen
263
        call    getFullPath
293
;------------------------------------------------------------------------------
-
 
294
syscall_display_settings._.redraw_whole_screen:
-
 
295
        xor     eax, eax
264
        test    eax, eax
296
        mov     [draw_limits.left], eax
-
 
297
        mov     [draw_limits.top], eax
265
        jz      @f
298
        mov     eax, [_display.width]
266
        mov     ebx, [esp]
299
        dec     eax
267
        call    read_skin_file
300
        mov     [draw_limits.right], eax
268
        mov     [esp + 32 + 4], eax
301
        mov     eax, [_display.height]
-
 
-
 
269
@@:
302
        dec     eax
270
        call    kernel_free
303
        mov     [draw_limits.bottom], eax
-
 
304
        mov     eax, window_data
271
        call    .calculateScreen
305
        jmp     redrawscreen
272
        jmp     .redrawScreen
-
 
273
 
306
;------------------------------------------------------------------------------
274
;------------------------------------------------------------------------------
307
syscall_set_window_shape: ;///// system function 50 ///////////////////////////
275
syscall_set_window_shape: ;///// system function 50 ///////////////////////////
308
;------------------------------------------------------------------------------
276
;------------------------------------------------------------------------------
309
;; Set window shape address:
277
;; Set window shape address:
310
;> ebx = 0
278
;> ebx = 0
311
;> ecx = shape data address
279
;> ecx = shape data address
312
; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
280
; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
313
;; Set window shape scale:
281
;; Set window shape scale:
314
;> ebx = 1
282
;> ebx = 1
315
;> ecx = scale power (resulting scale is 2^ebx)
283
;> ecx = scale power (resulting scale is 2^ebx)
316
;------------------------------------------------------------------------------
284
;------------------------------------------------------------------------------
317
        mov     edi, [current_slot]
285
        mov     edi, [current_slot]
318
 
286
 
319
        test    ebx, ebx
287
        test    ebx, ebx
320
        jne     .shape_scale
288
        jne     .shape_scale
321
        mov     [edi + APPDATA.wnd_shape], ecx
289
        mov     [edi + APPDATA.wnd_shape], ecx
322
;--------------------------------------
290
;--------------------------------------
323
align 4
291
align 4
324
.shape_scale:
292
.shape_scale:
325
        dec     ebx
293
        dec     ebx
326
        jnz     .exit
294
        jnz     .exit
327
        mov     [edi + APPDATA.wnd_shape_scale], ecx
295
        mov     [edi + APPDATA.wnd_shape_scale], ecx
328
;--------------------------------------
296
;--------------------------------------
329
align 4
297
align 4
330
.exit:
298
.exit:
331
        ret
299
        ret
332
;------------------------------------------------------------------------------
300
;------------------------------------------------------------------------------
333
align 4
301
align 4
334
;------------------------------------------------------------------------------
302
;------------------------------------------------------------------------------
335
syscall_move_window: ;///// system function 67 ////////////////////////////////
303
syscall_move_window: ;///// system function 67 ////////////////////////////////
336
;------------------------------------------------------------------------------
304
;------------------------------------------------------------------------------
337
;? 
305
;? 
338
;------------------------------------------------------------------------------
306
;------------------------------------------------------------------------------
339
        mov     edi, [CURRENT_TASK]
307
        mov     edi, [CURRENT_TASK]
340
        shl     edi, 5
308
        shl     edi, 5
341
        add     edi, window_data
309
        add     edi, window_data
342
 
310
 
343
        test    [edi + WDATA.fl_wdrawn], 1
311
        test    [edi + WDATA.fl_wdrawn], 1
344
        jz      .exit
312
        jz      .exit
345
 
313
 
346
        test    [edi + WDATA.fl_wstate], WSTATE_MAXIMIZED
314
        test    [edi + WDATA.fl_wstate], WSTATE_MAXIMIZED
347
        jnz     .exit
315
        jnz     .exit
348
 
316
 
349
        cmp     ebx, -1
317
        cmp     ebx, -1
350
        jne     @f
318
        jne     @f
351
        mov     ebx, [edi + WDATA.box.left]
319
        mov     ebx, [edi + WDATA.box.left]
352
;--------------------------------------
320
;--------------------------------------
353
align 4
321
align 4
354
@@:
322
@@:
355
        cmp     ecx, -1
323
        cmp     ecx, -1
356
        jne     @f
324
        jne     @f
357
        mov     ecx, [edi + WDATA.box.top]
325
        mov     ecx, [edi + WDATA.box.top]
358
;--------------------------------------
326
;--------------------------------------
359
align 4
327
align 4
360
@@:
328
@@:
361
        cmp     edx, -1
329
        cmp     edx, -1
362
        jne     @f
330
        jne     @f
363
        mov     edx, [edi + WDATA.box.width]
331
        mov     edx, [edi + WDATA.box.width]
364
;--------------------------------------
332
;--------------------------------------
365
align 4
333
align 4
366
@@:
334
@@:
367
        cmp     esi, -1
335
        cmp     esi, -1
368
        jne     @f
336
        jne     @f
369
        mov     esi, [edi + WDATA.box.height]
337
        mov     esi, [edi + WDATA.box.height]
370
;--------------------------------------
338
;--------------------------------------
371
align 4
339
align 4
372
@@:
340
@@:
373
        push    esi edx ecx ebx
341
        push    esi edx ecx ebx
374
        mov     eax, esp
342
        mov     eax, esp
375
        mov     bl, [edi + WDATA.fl_wstate]
343
        mov     bl, [edi + WDATA.fl_wstate]
376
;--------------------------------------
344
;--------------------------------------
377
align 4
345
align 4
378
@@:
346
@@:
379
        cmp     [REDRAW_BACKGROUND], byte 0
347
        cmp     [REDRAW_BACKGROUND], byte 0
380
        jz      @f
348
        jz      @f
381
        call    change_task
349
        call    change_task
382
        jmp     @b
350
        jmp     @b
383
;--------------------------------------
351
;--------------------------------------
384
align 4
352
align 4
385
@@:
353
@@:
386
        call    window._.set_window_box
354
        call    window._.set_window_box
387
        add     esp, sizeof.BOX
355
        add     esp, sizeof.BOX
388
 
356
 
389
.exit:
357
.exit:
390
        ret
358
        ret
391
;------------------------------------------------------------------------------
359
;------------------------------------------------------------------------------
392
syscall_window_settings: ;///// system function 71 ////////////////////////////
360
syscall_window_settings: ;///// system function 71 ////////////////////////////
393
;------------------------------------------------------------------------------
361
;------------------------------------------------------------------------------
394
        mov     edi, [CURRENT_TASK]
362
        mov     edi, [CURRENT_TASK]
395
        shl     edi, 5
363
        shl     edi, 5
396
        mov     [edi * 8 + SLOT_BASE + APPDATA.wnd_caption], ecx
364
        mov     [edi * 8 + SLOT_BASE + APPDATA.wnd_caption], ecx
397
        or      [edi + window_data + WDATA.fl_wstyle], WSTYLE_HASCAPTION
365
        or      [edi + window_data + WDATA.fl_wstyle], WSTYLE_HASCAPTION
398
        jmp     window._.draw_window_caption
366
        jmp     window._.draw_window_caption
399
;------------------------------------------------------------------------------
367
;------------------------------------------------------------------------------
400
align 4
368
align 4
401
set_window_defaults: ;/////////////////////////////////////////////////////////
369
set_window_defaults: ;/////////////////////////////////////////////////////////
402
;------------------------------------------------------------------------------
370
;------------------------------------------------------------------------------
403
        mov     byte [window_data + 0x20 + WDATA.cl_titlebar + 3], 1 ; desktop is not movable
371
        mov     byte [window_data + 0x20 + WDATA.cl_titlebar + 3], 1 ; desktop is not movable
404
        push    eax ecx
372
        push    eax ecx
405
        xor     eax, eax
373
        xor     eax, eax
406
        mov     ecx, WIN_STACK
374
        mov     ecx, WIN_STACK
407
;--------------------------------------
375
;--------------------------------------
408
align 4
376
align 4
409
@@:
377
@@:
410
        inc     eax
378
        inc     eax
411
        add     ecx, 2
379
        add     ecx, 2
412
        ; process no
380
        ; process no
413
        mov     [ecx + 0x000], ax
381
        mov     [ecx + 0x000], ax
414
        ; positions in stack
382
        ; positions in stack
415
        mov     [ecx + 0x400], ax
383
        mov     [ecx + 0x400], ax
416
        cmp     ecx, WIN_POS - 2
384
        cmp     ecx, WIN_POS - 2
417
        jne     @b
385
        jne     @b
418
        pop     ecx eax
386
        pop     ecx eax
419
        ret
387
        ret
420
;------------------------------------------------------------------------------
388
;------------------------------------------------------------------------------
421
 
389
 
422
align 4
390
align 4
423
;------------------------------------------------------------------------------
391
;------------------------------------------------------------------------------
424
calculatescreen: ;/////////////////////////////////////////////////////////////
392
calculatescreen: ;/////////////////////////////////////////////////////////////
425
;------------------------------------------------------------------------------
393
;------------------------------------------------------------------------------
426
;? Scan all windows from bottom to top, calling `setscreen` for each one
394
;? Scan all windows from bottom to top, calling `setscreen` for each one
427
;? intersecting given screen area
395
;? intersecting given screen area
428
;------------------------------------------------------------------------------
396
;------------------------------------------------------------------------------
429
;> eax = left
397
;> eax = left
430
;> ebx = top
398
;> ebx = top
431
;> ecx = right
399
;> ecx = right
432
;> edx = bottom
400
;> edx = bottom
433
;------------------------------------------------------------------------------
401
;------------------------------------------------------------------------------
434
        push    esi
402
        push    esi
435
        pushfd
403
        pushfd
436
        cli
404
        cli
437
 
405
 
438
        mov     esi, 1
406
        mov     esi, 1
439
        call    window._.set_screen
407
        call    window._.set_screen
440
 
408
 
441
        push    ebp
409
        push    ebp
442
 
410
 
443
        mov     ebp, [TASK_COUNT]
411
        mov     ebp, [TASK_COUNT]
444
        cmp     ebp, 1
412
        cmp     ebp, 1
445
        jbe     .exit
413
        jbe     .exit
446
 
414
 
447
        push    eax ;for num layout
415
        push    eax ;for num layout
448
 
416
 
449
        push    edx ecx ebx eax
417
        push    edx ecx ebx eax
450
 
418
 
451
        mov     dword[esp+10h], ZPOS_DESKTOP
419
        mov     dword[esp+10h], ZPOS_DESKTOP
452
;--------------------------------------
420
;--------------------------------------
453
align 4
421
align 4
454
.layout:
422
.layout:
455
        mov     esi, 1          ; = num in window stack
423
        mov     esi, 1          ; = num in window stack
456
        mov     ebp, [TASK_COUNT]
424
        mov     ebp, [TASK_COUNT]
457
;--------------------------------------
425
;--------------------------------------
458
align 4
426
align 4
459
.next_window:
427
.next_window:
460
        movzx   edi, word[WIN_POS + esi * 2]
428
        movzx   edi, word[WIN_POS + esi * 2]
461
        shl     edi, 5                  ;size of TASKDATA and WDATA = 32 bytes
429
        shl     edi, 5                  ;size of TASKDATA and WDATA = 32 bytes
462
 
430
 
463
        cmp     [CURRENT_TASK + edi + TASKDATA.state], TSTATE_FREE
431
        cmp     [CURRENT_TASK + edi + TASKDATA.state], TSTATE_FREE
464
        je      .skip_window
432
        je      .skip_window
465
 
433
 
466
        add     edi, window_data
434
        add     edi, window_data
467
        test    [edi + WDATA.fl_wstate], WSTATE_MINIMIZED
435
        test    [edi + WDATA.fl_wstate], WSTATE_MINIMIZED
468
        jnz     .skip_window
436
        jnz     .skip_window
469
 
437
 
470
        mov     eax, [esp+10h]
438
        mov     eax, [esp+10h]
471
        cmp     [edi + WDATA.z_modif], al
439
        cmp     [edi + WDATA.z_modif], al
472
        jne     .skip_window
440
        jne     .skip_window
473
 
441
 
474
        mov     eax, [edi + WDATA.box.left]
442
        mov     eax, [edi + WDATA.box.left]
475
        cmp     eax, [esp + RECT.right]
443
        cmp     eax, [esp + RECT.right]
476
        jg      .skip_window
444
        jg      .skip_window
477
        mov     ebx, [edi + WDATA.box.top]
445
        mov     ebx, [edi + WDATA.box.top]
478
        cmp     ebx, [esp + RECT.bottom]
446
        cmp     ebx, [esp + RECT.bottom]
479
        jg      .skip_window
447
        jg      .skip_window
480
        mov     ecx, [edi + WDATA.box.width]
448
        mov     ecx, [edi + WDATA.box.width]
481
        add     ecx, eax
449
        add     ecx, eax
482
        cmp     ecx, [esp + RECT.left]
450
        cmp     ecx, [esp + RECT.left]
483
        jl      .skip_window
451
        jl      .skip_window
484
        mov     edx, [edi + WDATA.box.height]
452
        mov     edx, [edi + WDATA.box.height]
485
        add     edx, ebx
453
        add     edx, ebx
486
        cmp     edx, [esp + RECT.top]
454
        cmp     edx, [esp + RECT.top]
487
        jl      .skip_window
455
        jl      .skip_window
488
 
456
 
489
        cmp     eax, [esp + RECT.left]
457
        cmp     eax, [esp + RECT.left]
490
        jae     @f
458
        jae     @f
491
        mov     eax, [esp + RECT.left]
459
        mov     eax, [esp + RECT.left]
492
;--------------------------------------
460
;--------------------------------------
493
align 4
461
align 4
494
@@:
462
@@:
495
        cmp     ebx, [esp + RECT.top]
463
        cmp     ebx, [esp + RECT.top]
496
        jae     @f
464
        jae     @f
497
        mov     ebx, [esp + RECT.top]
465
        mov     ebx, [esp + RECT.top]
498
;--------------------------------------
466
;--------------------------------------
499
align 4
467
align 4
500
@@:
468
@@:
501
        cmp     ecx, [esp + RECT.right]
469
        cmp     ecx, [esp + RECT.right]
502
        jbe     @f
470
        jbe     @f
503
        mov     ecx, [esp + RECT.right]
471
        mov     ecx, [esp + RECT.right]
504
;--------------------------------------
472
;--------------------------------------
505
align 4
473
align 4
506
@@:
474
@@:
507
        cmp     edx, [esp + RECT.bottom]
475
        cmp     edx, [esp + RECT.bottom]
508
        jbe     @f
476
        jbe     @f
509
        mov     edx, [esp + RECT.bottom]
477
        mov     edx, [esp + RECT.bottom]
510
;--------------------------------------
478
;--------------------------------------
511
align 4
479
align 4
512
@@:
480
@@:
513
        push    esi
481
        push    esi
514
        movzx   esi, word[WIN_POS + esi * 2]
482
        movzx   esi, word[WIN_POS + esi * 2]
515
        call    window._.set_screen
483
        call    window._.set_screen
516
        pop     esi
484
        pop     esi
517
;--------------------------------------
485
;--------------------------------------
518
align 4
486
align 4
519
.skip_window:
487
.skip_window:
520
        inc     esi
488
        inc     esi
521
        dec     ebp
489
        dec     ebp
522
        jnz     .next_window
490
        jnz     .next_window
523
;---------------------------------------------
491
;---------------------------------------------
524
        inc     dword[esp+10h]
492
        inc     dword[esp+10h]
525
        cmp     dword[esp+10h], ZPOS_ALWAYS_TOP
493
        cmp     dword[esp+10h], ZPOS_ALWAYS_TOP
526
        jle     .layout
494
        jle     .layout
527
;---------------------------------------------
495
;---------------------------------------------
528
        mov     esi, [TASK_COUNT]
496
        mov     esi, [TASK_COUNT]
529
        movzx   edi, word[WIN_POS + esi * 2]
497
        movzx   edi, word[WIN_POS + esi * 2]
530
        shl     edi, 5
498
        shl     edi, 5
531
        add     edi, window_data
499
        add     edi, window_data
532
 
500
 
533
        pop     eax ebx ecx edx
501
        pop     eax ebx ecx edx
534
        pop     ebp     ;del num layout
502
        pop     ebp     ;del num layout
535
;--------------------------------------
503
;--------------------------------------
536
align 4
504
align 4
537
.exit:
505
.exit:
538
        pop     ebp
506
        pop     ebp
539
        inc     [_display.mask_seqno]
507
        inc     [_display.mask_seqno]
540
        popfd
508
        popfd
541
        pop     esi
509
        pop     esi
542
        ret
510
        ret
543
;------------------------------------------------------------------------------
511
;------------------------------------------------------------------------------
544
align 4
512
align 4
545
;------------------------------------------------------------------------------
513
;------------------------------------------------------------------------------
546
repos_windows: ;///////////////////////////////////////////////////////////////
514
repos_windows: ;///////////////////////////////////////////////////////////////
547
;------------------------------------------------------------------------------
515
;------------------------------------------------------------------------------
548
;? 
516
;? 
549
;------------------------------------------------------------------------------
517
;------------------------------------------------------------------------------
550
        mov     ecx, [TASK_COUNT]
518
        mov     ecx, [TASK_COUNT]
551
        mov     edi, window_data + sizeof.WDATA * 2
519
        mov     edi, window_data + sizeof.WDATA * 2
552
        call    force_redraw_background
520
        call    force_redraw_background
553
        dec     ecx
521
        dec     ecx
554
        jle     .exit
522
        jle     .exit
555
;--------------------------------------
523
;--------------------------------------
556
align 4
524
align 4
557
.next_window:
525
.next_window:
558
        mov     [edi + WDATA.fl_redraw], 1
526
        mov     [edi + WDATA.fl_redraw], 1
559
        test    [edi + WDATA.fl_wstate], WSTATE_MAXIMIZED
527
        test    [edi + WDATA.fl_wstate], WSTATE_MAXIMIZED
560
        jnz     .fix_maximized
528
        jnz     .fix_maximized
561
 
529
 
562
        mov     eax, [edi + WDATA.box.left]
530
        mov     eax, [edi + WDATA.box.left]
563
        add     eax, [edi + WDATA.box.width]
531
        add     eax, [edi + WDATA.box.width]
564
        mov     ebx, [_display.width]
532
        mov     ebx, [_display.width]
565
        cmp     eax, ebx
533
        cmp     eax, ebx
566
        jl      .fix_vertical
534
        jl      .fix_vertical
567
        mov     eax, [edi + WDATA.box.width]
535
        mov     eax, [edi + WDATA.box.width]
568
        sub     eax, ebx
536
        sub     eax, ebx
569
        jl      @f
537
        jl      @f
570
        mov     [edi + WDATA.box.width], ebx
538
        mov     [edi + WDATA.box.width], ebx
571
;--------------------------------------
539
;--------------------------------------
572
align 4
540
align 4
573
@@:
541
@@:
574
        sub     ebx, [edi + WDATA.box.width]
542
        sub     ebx, [edi + WDATA.box.width]
575
        mov     [edi + WDATA.box.left], ebx
543
        mov     [edi + WDATA.box.left], ebx
576
;--------------------------------------
544
;--------------------------------------
577
align 4
545
align 4
578
.fix_vertical:
546
.fix_vertical:
579
        mov     eax, [edi + WDATA.box.top]
547
        mov     eax, [edi + WDATA.box.top]
580
        add     eax, [edi + WDATA.box.height]
548
        add     eax, [edi + WDATA.box.height]
581
        mov     ebx, [_display.height]
549
        mov     ebx, [_display.height]
582
        cmp     eax, ebx
550
        cmp     eax, ebx
583
        jl      .fix_client_box
551
        jl      .fix_client_box
584
        mov     eax, [edi + WDATA.box.height]
552
        mov     eax, [edi + WDATA.box.height]
585
        sub     eax, ebx
553
        sub     eax, ebx
586
        jl      @f
554
        jl      @f
587
        mov     [edi + WDATA.box.height], ebx
555
        mov     [edi + WDATA.box.height], ebx
588
;--------------------------------------
556
;--------------------------------------
589
align 4
557
align 4
590
@@:
558
@@:
591
        sub     ebx, [edi + WDATA.box.height]
559
        sub     ebx, [edi + WDATA.box.height]
592
        mov     [edi + WDATA.box.top], ebx
560
        mov     [edi + WDATA.box.top], ebx
593
;--------------------------------------
561
;--------------------------------------
594
align 4
562
align 4
595
.fix_client_box:
563
.fix_client_box:
596
        call    window._.set_window_clientbox
564
        call    window._.set_window_clientbox
597
        add     edi, sizeof.WDATA
565
        add     edi, sizeof.WDATA
598
        loop    .next_window
566
        loop    .next_window
599
;--------------------------------------
567
;--------------------------------------
600
align 4
568
align 4
601
.exit:
569
.exit:
602
        ret
570
        ret
603
;--------------------------------------
571
;--------------------------------------
604
align 4
572
align 4
605
.fix_maximized:
573
.fix_maximized:
606
        mov     eax, [screen_workarea.left]
574
        mov     eax, [screen_workarea.left]
607
        mov     [edi + WDATA.box.left], eax
575
        mov     [edi + WDATA.box.left], eax
608
        sub     eax, [screen_workarea.right]
576
        sub     eax, [screen_workarea.right]
609
        neg     eax
577
        neg     eax
610
        mov     [edi + WDATA.box.width], eax
578
        mov     [edi + WDATA.box.width], eax
611
        mov     eax, [screen_workarea.top]
579
        mov     eax, [screen_workarea.top]
612
        mov     [edi + WDATA.box.top], eax
580
        mov     [edi + WDATA.box.top], eax
613
        test    [edi + WDATA.fl_wstate], WSTATE_ROLLEDUP
581
        test    [edi + WDATA.fl_wstate], WSTATE_ROLLEDUP
614
        jnz     .fix_client_box
582
        jnz     .fix_client_box
615
        sub     eax, [screen_workarea.bottom]
583
        sub     eax, [screen_workarea.bottom]
616
        neg     eax
584
        neg     eax
617
        mov     [edi + WDATA.box.height], eax
585
        mov     [edi + WDATA.box.height], eax
618
        jmp     .fix_client_box
586
        jmp     .fix_client_box
619
;------------------------------------------------------------------------------
587
;------------------------------------------------------------------------------
620
;align 4
-
 
621
;------------------------------------------------------------------------------
-
 
622
;sys_window_mouse: ;////////////////////////////////////////////////////////////
-
 
623
;------------------------------------------------------------------------------
-
 
624
;? 
-
 
625
;------------------------------------------------------------------------------
-
 
626
        ; NOTE: commented out since doesn't provide necessary functionality
-
 
627
        ;       anyway, to be reworked
-
 
628
;       push    eax
-
 
629
;
-
 
630
;       mov     eax, [timer_ticks]
-
 
631
;       cmp     [new_window_starting], eax
-
 
632
;       jb      .exit
-
 
633
;
-
 
634
;       mov     byte[MOUSE_BACKGROUND], 0
-
 
635
;       mov     byte[DONT_DRAW_MOUSE], 0
-
 
636
;
-
 
637
;       mov     [new_window_starting], eax
-
 
638
;
-
 
639
; .exit:
-
 
640
;       pop     eax
-
 
641
;        ret
-
 
642
;------------------------------------------------------------------------------
-
 
643
align 4
588
align 4
644
;------------------------------------------------------------------------------
589
;------------------------------------------------------------------------------
645
draw_rectangle: ;//////////////////////////////////////////////////////////////
590
draw_rectangle: ;//////////////////////////////////////////////////////////////
646
;------------------------------------------------------------------------------
591
;------------------------------------------------------------------------------
647
;> eax = pack[16(left), 16(right)]
592
;> eax = pack[16(left), 16(right)]
648
;> ebx = pack[16(top), 16(bottom)]
593
;> ebx = pack[16(top), 16(bottom)]
649
;> esi = color
594
;> esi = color
650
;       ?? RR GG BB    ; 0x01000000 negation
595
;       ?? RR GG BB    ; 0x01000000 negation
651
;                      ; 0x02000000 used for draw_rectangle without top line
596
;                      ; 0x02000000 used for draw_rectangle without top line
652
;                      ;           for example drawwindow_III and drawwindow_IV
597
;                      ;           for example drawwindow_III and drawwindow_IV
653
;------------------------------------------------------------------------------
598
;------------------------------------------------------------------------------
654
        push    eax ebx ecx edi
599
        push    eax ebx ecx edi
655
 
600
 
656
        xor     edi, edi
601
        xor     edi, edi
657
;--------------------------------------
602
;--------------------------------------
658
align 4
603
align 4
659
.flags_set:
604
.flags_set:
660
        push    ebx
605
        push    ebx
661
 
606
 
662
        ; set line color
607
        ; set line color
663
        mov     ecx, esi
608
        mov     ecx, esi
664
        ; draw top border
609
        ; draw top border
665
        rol     ebx, 16
610
        rol     ebx, 16
666
        push    ebx
611
        push    ebx
667
        rol     ebx, 16
612
        rol     ebx, 16
668
        pop     bx
613
        pop     bx
669
        test    ecx, 1 shl 25
614
        test    ecx, 1 shl 25
670
        jnz     @f
615
        jnz     @f
671
        sub     ecx, 1 shl 25
616
        sub     ecx, 1 shl 25
672
;        call    [draw_line]
617
;        call    [draw_line]
673
        call    __sys_draw_line
618
        call    __sys_draw_line
674
;--------------------------------------
619
;--------------------------------------
675
align 4
620
align 4
676
@@:
621
@@:
677
        ; draw bottom border
622
        ; draw bottom border
678
        mov     ebx, [esp - 2]
623
        mov     ebx, [esp - 2]
679
        pop     bx
624
        pop     bx
680
;        call    [draw_line]
625
;        call    [draw_line]
681
        call    __sys_draw_line
626
        call    __sys_draw_line
682
 
627
 
683
        pop     ebx
628
        pop     ebx
684
        add     ebx, 1 * 65536 - 1
629
        add     ebx, 1 * 65536 - 1
685
 
630
 
686
        ; draw left border
631
        ; draw left border
687
        rol     eax, 16
632
        rol     eax, 16
688
        push    eax
633
        push    eax
689
        rol     eax, 16
634
        rol     eax, 16
690
        pop     ax
635
        pop     ax
691
;        call    [draw_line]
636
;        call    [draw_line]
692
        call    __sys_draw_line
637
        call    __sys_draw_line
693
 
638
 
694
        ; draw right border
639
        ; draw right border
695
        mov     eax, [esp - 2]
640
        mov     eax, [esp - 2]
696
        pop     ax
641
        pop     ax
697
;        call    [draw_line]
642
;        call    [draw_line]
698
        call    __sys_draw_line
643
        call    __sys_draw_line
699
 
644
 
700
        pop     edi ecx ebx eax
645
        pop     edi ecx ebx eax
701
        ret
646
        ret
702
;--------------------------------------
647
;--------------------------------------
703
align 4
648
align 4
704
.forced:
649
.forced:
705
        push    eax ebx ecx edi
650
        push    eax ebx ecx edi
706
        xor     edi, edi
651
        xor     edi, edi
707
        inc     edi
652
        inc     edi
708
        jmp     .flags_set
653
        jmp     .flags_set
709
;------------------------------------------------------------------------------
654
;------------------------------------------------------------------------------
710
align 4
655
align 4
711
;------------------------------------------------------------------------------
656
;------------------------------------------------------------------------------
712
drawwindow_I_caption: ;////////////////////////////////////////////////////////
657
drawwindow_I_caption: ;////////////////////////////////////////////////////////
713
;------------------------------------------------------------------------------
658
;------------------------------------------------------------------------------
714
;? 
659
;? 
715
;------------------------------------------------------------------------------
660
;------------------------------------------------------------------------------
716
        push    [edx + WDATA.cl_titlebar]
661
        push    [edx + WDATA.cl_titlebar]
717
        mov     esi, edx
662
        mov     esi, edx
718
 
663
 
719
        mov     edx, [esi + WDATA.box.top]
664
        mov     edx, [esi + WDATA.box.top]
720
        mov     eax, edx
665
        mov     eax, edx
721
        lea     ebx, [edx + 21]
666
        lea     ebx, [edx + 21]
722
        inc     edx
667
        inc     edx
723
        add     eax, [esi + WDATA.box.height]
668
        add     eax, [esi + WDATA.box.height]
724
 
669
 
725
        cmp     ebx, eax
670
        cmp     ebx, eax
726
        jbe     @f
671
        jbe     @f
727
        mov     ebx, eax
672
        mov     ebx, eax
728
;--------------------------------------
673
;--------------------------------------
729
align 4
674
align 4
730
@@:
675
@@:
731
        push    ebx
676
        push    ebx
732
 
677
 
733
        xor     edi, edi
678
        xor     edi, edi
734
;--------------------------------------
679
;--------------------------------------
735
align 4
680
align 4
736
.next_line:
681
.next_line:
737
        mov     ebx, edx
682
        mov     ebx, edx
738
        shl     ebx, 16
683
        shl     ebx, 16
739
        add     ebx, edx
684
        add     ebx, edx
740
        mov     eax, [esi + WDATA.box.left]
685
        mov     eax, [esi + WDATA.box.left]
741
        inc     eax
686
        inc     eax
742
        shl     eax, 16
687
        shl     eax, 16
743
        add     eax, [esi + WDATA.box.left]
688
        add     eax, [esi + WDATA.box.left]
744
        add     eax, [esi + WDATA.box.width]
689
        add     eax, [esi + WDATA.box.width]
745
        dec     eax
690
        dec     eax
746
        mov     ecx, [esi + WDATA.cl_titlebar]
691
        mov     ecx, [esi + WDATA.cl_titlebar]
747
        test    ecx, 0x80000000
692
        test    ecx, 0x80000000
748
        jz      @f
693
        jz      @f
749
        sub     ecx, 0x00040404
694
        sub     ecx, 0x00040404
750
        mov     [esi + WDATA.cl_titlebar], ecx
695
        mov     [esi + WDATA.cl_titlebar], ecx
751
;--------------------------------------
696
;--------------------------------------
752
align 4
697
align 4
753
@@:
698
@@:
754
        and     ecx, 0x00ffffff
699
        and     ecx, 0x00ffffff
755
;        call    [draw_line]
700
;        call    [draw_line]
756
        call    __sys_draw_line
701
        call    __sys_draw_line
757
        inc     edx
702
        inc     edx
758
        cmp     edx, [esp]
703
        cmp     edx, [esp]
759
        jb      .next_line
704
        jb      .next_line
760
 
705
 
761
        add     esp, 4
706
        add     esp, 4
762
        pop     [esi + WDATA.cl_titlebar]
707
        pop     [esi + WDATA.cl_titlebar]
763
        ret
708
        ret
764
;------------------------------------------------------------------------------
709
;------------------------------------------------------------------------------
765
align 4
710
align 4
766
;------------------------------------------------------------------------------
711
;------------------------------------------------------------------------------
767
drawwindow_I: ;////////////////////////////////////////////////////////////////
712
drawwindow_I: ;////////////////////////////////////////////////////////////////
768
;------------------------------------------------------------------------------
713
;------------------------------------------------------------------------------
769
;? 
714
;? 
770
;------------------------------------------------------------------------------
715
;------------------------------------------------------------------------------
771
        pushad
716
        pushad
772
 
717
 
773
        ; window border
718
        ; window border
774
 
719
 
775
        mov     eax, [edx + WDATA.box.left - 2]
720
        mov     eax, [edx + WDATA.box.left - 2]
776
        mov     ax, word[edx + WDATA.box.left]
721
        mov     ax, word[edx + WDATA.box.left]
777
        add     ax, word[edx + WDATA.box.width]
722
        add     ax, word[edx + WDATA.box.width]
778
        mov     ebx, [edx + WDATA.box.top - 2]
723
        mov     ebx, [edx + WDATA.box.top - 2]
779
        mov     bx, word[edx + WDATA.box.top]
724
        mov     bx, word[edx + WDATA.box.top]
780
        add     bx, word[edx + WDATA.box.height]
725
        add     bx, word[edx + WDATA.box.height]
781
 
726
 
782
        mov     esi, [edx + WDATA.cl_frames]
727
        mov     esi, [edx + WDATA.cl_frames]
783
        call    draw_rectangle
728
        call    draw_rectangle
784
 
729
 
785
        ; window caption
730
        ; window caption
786
 
731
 
787
        call    drawwindow_I_caption
732
        call    drawwindow_I_caption
788
 
733
 
789
        ; window client area
734
        ; window client area
790
 
735
 
791
        ; do we need to draw it?
736
        ; do we need to draw it?
792
        mov     edi, [esi + WDATA.cl_workarea]
737
        mov     edi, [esi + WDATA.cl_workarea]
793
        test    edi, 0x40000000
738
        test    edi, 0x40000000
794
        jnz     .exit
739
        jnz     .exit
795
 
740
 
796
        ; does client area have a positive size on screen?
741
        ; does client area have a positive size on screen?
797
        cmp     [esi + WDATA.box.height], 21
742
        cmp     [esi + WDATA.box.height], 21
798
        jle     .exit
743
        jle     .exit
799
 
744
 
800
        ; okay, let's draw it
745
        ; okay, let's draw it
801
        mov     eax, 1
746
        mov     eax, 1
802
        mov     ebx, 21
747
        mov     ebx, 21
803
        mov     ecx, [esi + WDATA.box.width]
748
        mov     ecx, [esi + WDATA.box.width]
804
        mov     edx, [esi + WDATA.box.height]
749
        mov     edx, [esi + WDATA.box.height]
805
;        call    [drawbar]
750
;        call    [drawbar]
806
        call    vesa20_drawbar
751
        call    vesa20_drawbar
807
;--------------------------------------
752
;--------------------------------------
808
align 4
753
align 4
809
.exit:
754
.exit:
810
        popad
755
        popad
811
        ret
756
        ret
812
;------------------------------------------------------------------------------
757
;------------------------------------------------------------------------------
813
align 4
758
align 4
814
;------------------------------------------------------------------------------
759
;------------------------------------------------------------------------------
815
drawwindow_III_caption: ;/////////////////////////////////////////////////////
760
drawwindow_III_caption: ;/////////////////////////////////////////////////////
816
;------------------------------------------------------------------------------
761
;------------------------------------------------------------------------------
817
;? 
762
;? 
818
;------------------------------------------------------------------------------
763
;------------------------------------------------------------------------------
819
        mov     ecx, [edx + WDATA.cl_titlebar]
764
        mov     ecx, [edx + WDATA.cl_titlebar]
820
        push    ecx
765
        push    ecx
821
        mov     esi, edx
766
        mov     esi, edx
822
        mov     edx, [esi + WDATA.box.top]
767
        mov     edx, [esi + WDATA.box.top]
823
        add     edx, 4
768
        add     edx, 4
824
        mov     ebx, [esi + WDATA.box.top]
769
        mov     ebx, [esi + WDATA.box.top]
825
        add     ebx, 20
770
        add     ebx, 20
826
        mov     eax, [esi + WDATA.box.top]
771
        mov     eax, [esi + WDATA.box.top]
827
        add     eax, [esi + WDATA.box.height]
772
        add     eax, [esi + WDATA.box.height]
828
 
773
 
829
        cmp     ebx, eax
774
        cmp     ebx, eax
830
        jb      @f
775
        jb      @f
831
        mov     ebx, eax
776
        mov     ebx, eax
832
;--------------------------------------
777
;--------------------------------------
833
align 4
778
align 4
834
@@:
779
@@:
835
        push    ebx
780
        push    ebx
836
 
781
 
837
        xor     edi, edi
782
        xor     edi, edi
838
;--------------------------------------
783
;--------------------------------------
839
align 4
784
align 4
840
.next_line:
785
.next_line:
841
        mov     ebx, edx
786
        mov     ebx, edx
842
        shl     ebx, 16
787
        shl     ebx, 16
843
        add     ebx, edx
788
        add     ebx, edx
844
        mov     eax, [esi + WDATA.box.left]
789
        mov     eax, [esi + WDATA.box.left]
845
        shl     eax, 16
790
        shl     eax, 16
846
        add     eax, [esi + WDATA.box.left]
791
        add     eax, [esi + WDATA.box.left]
847
        add     eax, [esi + WDATA.box.width]
792
        add     eax, [esi + WDATA.box.width]
848
        add     eax, 4 * 65536 - 4
793
        add     eax, 4 * 65536 - 4
849
        mov     ecx, [esi + WDATA.cl_titlebar]
794
        mov     ecx, [esi + WDATA.cl_titlebar]
850
        test    ecx, 0x40000000
795
        test    ecx, 0x40000000
851
        jz      @f
796
        jz      @f
852
        add     ecx, 0x00040404
797
        add     ecx, 0x00040404
853
;--------------------------------------
798
;--------------------------------------
854
align 4
799
align 4
855
@@:
800
@@:
856
        test    ecx, 0x80000000
801
        test    ecx, 0x80000000
857
        jz      @f
802
        jz      @f
858
        sub     ecx, 0x00040404
803
        sub     ecx, 0x00040404
859
;--------------------------------------
804
;--------------------------------------
860
align 4
805
align 4
861
@@:
806
@@:
862
        mov     [esi + WDATA.cl_titlebar], ecx
807
        mov     [esi + WDATA.cl_titlebar], ecx
863
        and     ecx, 0x00ffffff
808
        and     ecx, 0x00ffffff
864
;        call    [draw_line]
809
;        call    [draw_line]
865
        call    __sys_draw_line
810
        call    __sys_draw_line
866
        inc     edx
811
        inc     edx
867
        cmp     edx, [esp]
812
        cmp     edx, [esp]
868
        jb      .next_line
813
        jb      .next_line
869
 
814
 
870
        add     esp, 4
815
        add     esp, 4
871
        pop     [esi + WDATA.cl_titlebar]
816
        pop     [esi + WDATA.cl_titlebar]
872
        ret
817
        ret
873
;------------------------------------------------------------------------------
818
;------------------------------------------------------------------------------
874
align 4
819
align 4
875
;------------------------------------------------------------------------------
820
;------------------------------------------------------------------------------
876
drawwindow_III: ;//////////////////////////////////////////////////////////////
821
drawwindow_III: ;//////////////////////////////////////////////////////////////
877
;------------------------------------------------------------------------------
822
;------------------------------------------------------------------------------
878
;? 
823
;? 
879
;------------------------------------------------------------------------------
824
;------------------------------------------------------------------------------
880
        pushad
825
        pushad
881
 
826
 
882
        ; window border
827
        ; window border
883
 
828
 
884
        mov     eax, [edx + WDATA.box.left - 2]
829
        mov     eax, [edx + WDATA.box.left - 2]
885
        mov     ax, word[edx + WDATA.box.left]
830
        mov     ax, word[edx + WDATA.box.left]
886
        add     ax, word[edx + WDATA.box.width]
831
        add     ax, word[edx + WDATA.box.width]
887
        mov     ebx, [edx + WDATA.box.top - 2]
832
        mov     ebx, [edx + WDATA.box.top - 2]
888
        mov     bx, word[edx + WDATA.box.top]
833
        mov     bx, word[edx + WDATA.box.top]
889
        add     bx, word[edx + WDATA.box.height]
834
        add     bx, word[edx + WDATA.box.height]
890
 
835
 
891
        mov     esi, [edx + WDATA.cl_frames]
836
        mov     esi, [edx + WDATA.cl_frames]
892
        shr     esi, 1
837
        shr     esi, 1
893
        and     esi, 0x007f7f7f
838
        and     esi, 0x007f7f7f
894
        call    draw_rectangle
839
        call    draw_rectangle
895
 
840
 
896
        push    esi
841
        push    esi
897
        mov     ecx, 3
842
        mov     ecx, 3
898
        mov     esi, [edx + WDATA.cl_frames]
843
        mov     esi, [edx + WDATA.cl_frames]
899
;--------------------------------------
844
;--------------------------------------
900
align 4
845
align 4
901
.next_frame:
846
.next_frame:
902
        add     eax, 1 * 65536 - 1
847
        add     eax, 1 * 65536 - 1
903
        add     ebx, 1 * 65536 - 1
848
        add     ebx, 1 * 65536 - 1
904
        call    draw_rectangle
849
        call    draw_rectangle
905
        dec     ecx
850
        dec     ecx
906
        jnz     .next_frame
851
        jnz     .next_frame
907
 
852
 
908
        pop     esi
853
        pop     esi
909
        add     eax, 1 * 65536 - 1
854
        add     eax, 1 * 65536 - 1
910
        add     ebx, 1 * 65536 - 1
855
        add     ebx, 1 * 65536 - 1
911
        call    draw_rectangle
856
        call    draw_rectangle
912
 
857
 
913
        ; window caption
858
        ; window caption
914
 
859
 
915
        call    drawwindow_III_caption
860
        call    drawwindow_III_caption
916
 
861
 
917
        ; window client area
862
        ; window client area
918
 
863
 
919
        ; do we need to draw it?
864
        ; do we need to draw it?
920
        mov     edi, [esi + WDATA.cl_workarea]
865
        mov     edi, [esi + WDATA.cl_workarea]
921
        test    edi, 0x40000000
866
        test    edi, 0x40000000
922
        jnz     .exit
867
        jnz     .exit
923
 
868
 
924
        ; does client area have a positive size on screen?
869
        ; does client area have a positive size on screen?
925
        mov     edx, [esi + WDATA.box.top]
870
        mov     edx, [esi + WDATA.box.top]
926
        add     edx, 21 + 5
871
        add     edx, 21 + 5
927
        mov     ebx, [esi + WDATA.box.top]
872
        mov     ebx, [esi + WDATA.box.top]
928
        add     ebx, [esi + WDATA.box.height]
873
        add     ebx, [esi + WDATA.box.height]
929
        cmp     edx, ebx
874
        cmp     edx, ebx
930
        jg      .exit
875
        jg      .exit
931
 
876
 
932
        ; okay, let's draw it
877
        ; okay, let's draw it
933
        mov     eax, 5
878
        mov     eax, 5
934
        mov     ebx, 20
879
        mov     ebx, 20
935
        mov     ecx, [esi + WDATA.box.width]
880
        mov     ecx, [esi + WDATA.box.width]
936
        mov     edx, [esi + WDATA.box.height]
881
        mov     edx, [esi + WDATA.box.height]
937
        sub     ecx, 4
882
        sub     ecx, 4
938
        sub     edx, 4
883
        sub     edx, 4
939
;        call    [drawbar]
884
;        call    [drawbar]
940
        call    vesa20_drawbar
885
        call    vesa20_drawbar
941
;--------------------------------------
886
;--------------------------------------
942
align 4
887
align 4
943
.exit:
888
.exit:
944
        popad
889
        popad
945
        ret
890
        ret
946
;------------------------------------------------------------------------------
891
;------------------------------------------------------------------------------
947
align 4
892
align 4
948
;------------------------------------------------------------------------------
893
;------------------------------------------------------------------------------
949
waredraw: ;////////////////////////////////////////////////////////////////////
894
waredraw: ;////////////////////////////////////////////////////////////////////
950
;------------------------------------------------------------------------------
895
;------------------------------------------------------------------------------
951
;? Activate window, redrawing if necessary
896
;? Activate window, redrawing if necessary
952
;------------------------------------------------------------------------------
897
;------------------------------------------------------------------------------
953
        push    -1
898
        push    -1
954
        mov     eax, [TASK_COUNT]
899
        mov     eax, [TASK_COUNT]
955
        lea     eax, [WIN_POS + eax * 2]
900
        lea     eax, [WIN_POS + eax * 2]
956
        cmp     eax, esi
901
        cmp     eax, esi
957
        pop     eax
902
        pop     eax
958
        je      .exit
903
        je      .exit
959
 
904
 
960
        ; is it overlapped by another window now?
905
        ; is it overlapped by another window now?
961
        push    ecx
906
        push    ecx
962
        call    window._.check_window_draw
907
        call    window._.check_window_draw
963
        test    ecx, ecx
908
        test    ecx, ecx
964
        pop     ecx
909
        pop     ecx
965
        jz      .do_not_draw
910
        jz      .do_not_draw
966
 
911
 
967
        ; yes it is, activate and update screen buffer
912
        ; yes it is, activate and update screen buffer
968
        call    window._.window_activate
913
        call    window._.window_activate
969
 
914
 
970
        pushad
915
        pushad
971
        mov     edi, [TASK_COUNT]
916
        mov     edi, [TASK_COUNT]
972
        movzx   esi, word[WIN_POS + edi * 2]
917
        movzx   esi, word[WIN_POS + edi * 2]
973
        shl     esi, 5
918
        shl     esi, 5
974
        add     esi, window_data
919
        add     esi, window_data
975
 
920
 
976
        mov     eax, [esi + WDATA.box.left]
921
        mov     eax, [esi + WDATA.box.left]
977
        mov     ebx, [esi + WDATA.box.top]
922
        mov     ebx, [esi + WDATA.box.top]
978
        mov     ecx, [esi + WDATA.box.width]
923
        mov     ecx, [esi + WDATA.box.width]
979
        mov     edx, [esi + WDATA.box.height]
924
        mov     edx, [esi + WDATA.box.height]
980
 
925
 
981
        add     ecx, eax
926
        add     ecx, eax
982
        add     edx, ebx
927
        add     edx, ebx
983
 
928
 
984
        mov     edi, [TASK_COUNT]
929
        mov     edi, [TASK_COUNT]
985
        movzx   esi, word[WIN_POS + edi * 2]
930
        movzx   esi, word[WIN_POS + edi * 2]
986
        call    window._.set_screen
931
        call    window._.set_screen
987
 
932
 
988
        call    window._.set_top_wnd
933
        call    window._.set_top_wnd
989
 
934
 
990
        inc     [_display.mask_seqno]
935
        inc     [_display.mask_seqno]
991
        popad
936
        popad
992
 
937
 
993
        ; tell application to redraw itself
938
        ; tell application to redraw itself
994
        mov     [edi + WDATA.fl_redraw], 1
939
        mov     [edi + WDATA.fl_redraw], 1
995
        xor     eax, eax
940
        xor     eax, eax
996
        jmp     .exit
941
        jmp     .exit
997
;--------------------------------------
942
;--------------------------------------
998
align 4
943
align 4
999
.do_not_draw:
944
.do_not_draw:
1000
        ; no it's not, just activate the window
945
        ; no it's not, just activate the window
1001
        call    window._.window_activate
946
        call    window._.window_activate
1002
        xor     eax, eax
947
        xor     eax, eax
1003
        ret
948
        ret
1004
 
949
 
1005
;--------------------------------------
950
;--------------------------------------
1006
align 4
951
align 4
1007
.exit:
952
.exit:
1008
        inc     eax
953
        inc     eax
1009
        ret
954
        ret
1010
;------------------------------------------------------------------------------
955
;------------------------------------------------------------------------------
1011
align 4
956
align 4
1012
;------------------------------------------------------------------------------
957
;------------------------------------------------------------------------------
1013
minimize_all_window:
958
minimize_all_window:
1014
        push    ebx ecx edx esi edi
959
        push    ebx ecx edx esi edi
1015
        pushfd
960
        pushfd
1016
        cli
961
        cli
1017
        xor     edx, edx
962
        xor     edx, edx
1018
        mov     eax, 2  ; we do not minimize the kernel thread N1
963
        mov     eax, 2  ; we do not minimize the kernel thread N1
1019
        mov     ebx, [TASK_COUNT]
964
        mov     ebx, [TASK_COUNT]
1020
;--------------------------------------
965
;--------------------------------------
1021
align 4
966
align 4
1022
.loop:
967
.loop:
1023
        movzx   edi, word[WIN_POS + eax * 2]
968
        movzx   edi, word[WIN_POS + eax * 2]
1024
        shl     edi, 5
969
        shl     edi, 5
1025
; it is a unused slot?
970
; it is a unused slot?
1026
        cmp     dword [edi+CURRENT_TASK+TASKDATA.state], 9
971
        cmp     dword [edi+CURRENT_TASK+TASKDATA.state], 9
1027
        je      @f
972
        je      @f
1028
; it is a hidden thread?
973
; it is a hidden thread?
1029
        lea     esi, [edi*8+SLOT_BASE+APPDATA.app_name]
974
        lea     esi, [edi*8+SLOT_BASE+APPDATA.app_name]
1030
        cmp     [esi], byte '@'
975
        cmp     [esi], byte '@'
1031
        je      @f
976
        je      @f
1032
; is it already minimized?
977
; is it already minimized?
1033
        test    [edi + window_data+WDATA.fl_wstate], WSTATE_MINIMIZED
978
        test    [edi + window_data+WDATA.fl_wstate], WSTATE_MINIMIZED
1034
        jnz     @f
979
        jnz     @f
1035
; no it's not, let's do that
980
; no it's not, let's do that
1036
        or      [edi + window_data+WDATA.fl_wstate], WSTATE_MINIMIZED
981
        or      [edi + window_data+WDATA.fl_wstate], WSTATE_MINIMIZED
1037
        inc     edx
982
        inc     edx
1038
;--------------------------------------
983
;--------------------------------------
1039
align 4
984
align 4
1040
@@:
985
@@:
1041
        inc     eax
986
        inc     eax
1042
        cmp     eax, ebx
987
        cmp     eax, ebx
1043
        jbe     .loop
988
        jbe     .loop
1044
; If nothing has changed
989
; If nothing has changed
1045
        test    edx, edx
990
        test    edx, edx
1046
        jz      @f
991
        jz      @f
1047
 
992
 
1048
        push    edx
993
        push    edx
1049
        call    syscall_display_settings._.calculate_whole_screen
994
        call    syscall_display_settings.calculateScreen
1050
        call    syscall_display_settings._.redraw_whole_screen
995
        call    syscall_display_settings.redrawScreen
1051
        pop     edx
996
        pop     edx
1052
;--------------------------------------
997
;--------------------------------------
1053
align 4
998
align 4
1054
@@:
999
@@:
1055
        mov     eax, edx
1000
        mov     eax, edx
1056
        popfd
1001
        popfd
1057
        pop     edi esi edx ecx ebx
1002
        pop     edi esi edx ecx ebx
1058
        ret
1003
        ret
1059
;------------------------------------------------------------------------------
1004
;------------------------------------------------------------------------------
1060
align 4
1005
align 4
1061
;------------------------------------------------------------------------------
1006
;------------------------------------------------------------------------------
1062
minimize_window: ;/////////////////////////////////////////////////////////////
1007
minimize_window: ;/////////////////////////////////////////////////////////////
1063
;------------------------------------------------------------------------------
1008
;------------------------------------------------------------------------------
1064
;> eax = window number on screen
1009
;> eax = window number on screen
1065
;------------------------------------------------------------------------------
1010
;------------------------------------------------------------------------------
1066
;# corrupts [dl*]
1011
;# corrupts [dl*]
1067
;------------------------------------------------------------------------------
1012
;------------------------------------------------------------------------------
1068
        push    edi
1013
        push    edi
1069
        pushfd
1014
        pushfd
1070
        cli
1015
        cli
1071
 
1016
 
1072
        ; is it already minimized?
1017
        ; is it already minimized?
1073
        movzx   edi, word[WIN_POS + eax * 2]
1018
        movzx   edi, word[WIN_POS + eax * 2]
1074
        shl     edi, 5
1019
        shl     edi, 5
1075
        add     edi, window_data
1020
        add     edi, window_data
1076
        test    [edi + WDATA.fl_wstate], WSTATE_MINIMIZED
1021
        test    [edi + WDATA.fl_wstate], WSTATE_MINIMIZED
1077
        jnz     .exit
1022
        jnz     .exit
1078
 
1023
 
1079
        push    eax ebx ecx edx esi
1024
        push    eax ebx ecx edx esi
1080
 
1025
 
1081
        ; no it's not, let's do that
1026
        ; no it's not, let's do that
1082
        or      [edi + WDATA.fl_wstate], WSTATE_MINIMIZED
1027
        or      [edi + WDATA.fl_wstate], WSTATE_MINIMIZED
1083
; If the window width is 0, then the action is not needed.
1028
; If the window width is 0, then the action is not needed.
1084
        cmp     [edi + WDATA.box.width], dword 0
1029
        cmp     [edi + WDATA.box.width], dword 0
1085
        je      @f
1030
        je      @f
1086
; If the window height is 0, then the action is not needed.
1031
; If the window height is 0, then the action is not needed.
1087
        cmp     [edi + WDATA.box.height], dword 0
1032
        cmp     [edi + WDATA.box.height], dword 0
1088
        je      @f
1033
        je      @f
1089
 
1034
 
1090
        mov     eax, [edi + WDATA.box.left]
1035
        mov     eax, [edi + WDATA.box.left]
1091
        mov     [draw_limits.left], eax
1036
        mov     [draw_limits.left], eax
1092
        mov     ecx, eax
1037
        mov     ecx, eax
1093
        add     ecx, [edi + WDATA.box.width]
1038
        add     ecx, [edi + WDATA.box.width]
1094
        mov     [draw_limits.right], ecx
1039
        mov     [draw_limits.right], ecx
1095
        mov     ebx, [edi + WDATA.box.top]
1040
        mov     ebx, [edi + WDATA.box.top]
1096
        mov     [draw_limits.top], ebx
1041
        mov     [draw_limits.top], ebx
1097
        mov     edx, ebx
1042
        mov     edx, ebx
1098
        add     edx, [edi + WDATA.box.height]
1043
        add     edx, [edi + WDATA.box.height]
1099
        mov     [draw_limits.bottom], edx
1044
        mov     [draw_limits.bottom], edx
1100
 
1045
 
1101
;        DEBUGF  1, "K : minimize_window\n"
1046
;        DEBUGF  1, "K : minimize_window\n"
1102
;        DEBUGF  1, "K : dl_left %x\n",[draw_limits.left]
1047
;        DEBUGF  1, "K : dl_left %x\n",[draw_limits.left]
1103
;        DEBUGF  1, "K : dl_right %x\n",[draw_limits.right]
1048
;        DEBUGF  1, "K : dl_right %x\n",[draw_limits.right]
1104
;        DEBUGF  1, "K : dl_top %x\n",[draw_limits.top]
1049
;        DEBUGF  1, "K : dl_top %x\n",[draw_limits.top]
1105
;        DEBUGF  1, "K : dl_bottom %x\n",[draw_limits.bottom]
1050
;        DEBUGF  1, "K : dl_bottom %x\n",[draw_limits.bottom]
1106
        call    calculatescreen
1051
        call    calculatescreen
1107
;        xor     esi, esi
1052
;        xor     esi, esi
1108
;        xor     eax, eax
1053
;        xor     eax, eax
1109
        mov     eax, edi
1054
        mov     eax, edi
1110
        call    redrawscreen
1055
        call    redrawscreen
1111
;--------------------------------------
1056
;--------------------------------------
1112
align 4
1057
align 4
1113
@@:
1058
@@:
1114
        pop     esi edx ecx ebx eax
1059
        pop     esi edx ecx ebx eax
1115
;--------------------------------------
1060
;--------------------------------------
1116
align 4
1061
align 4
1117
.exit:
1062
.exit:
1118
        popfd
1063
        popfd
1119
        pop     edi
1064
        pop     edi
1120
        ret
1065
        ret
1121
;------------------------------------------------------------------------------
1066
;------------------------------------------------------------------------------
1122
align 4
1067
align 4
1123
;------------------------------------------------------------------------------
1068
;------------------------------------------------------------------------------
1124
restore_minimized_window: ;////////////////////////////////////////////////////
1069
restore_minimized_window: ;////////////////////////////////////////////////////
1125
;------------------------------------------------------------------------------
1070
;------------------------------------------------------------------------------
1126
;> eax = window number on screen
1071
;> eax = window number on screen
1127
;------------------------------------------------------------------------------
1072
;------------------------------------------------------------------------------
1128
;# corrupts [dl*]
1073
;# corrupts [dl*]
1129
;------------------------------------------------------------------------------
1074
;------------------------------------------------------------------------------
1130
        pushad
1075
        pushad
1131
        pushfd
1076
        pushfd
1132
        cli
1077
        cli
1133
 
1078
 
1134
        ; is it already restored?
1079
        ; is it already restored?
1135
        movzx   esi, word[WIN_POS + eax * 2]
1080
        movzx   esi, word[WIN_POS + eax * 2]
1136
        mov     edi, esi
1081
        mov     edi, esi
1137
        shl     edi, 5
1082
        shl     edi, 5
1138
        add     edi, window_data
1083
        add     edi, window_data
1139
        test    [edi + WDATA.fl_wstate], WSTATE_MINIMIZED
1084
        test    [edi + WDATA.fl_wstate], WSTATE_MINIMIZED
1140
        jz      .exit
1085
        jz      .exit
1141
 
1086
 
1142
        ; no it's not, let's do that
1087
        ; no it's not, let's do that
1143
        mov     [edi + WDATA.fl_redraw], 1
1088
        mov     [edi + WDATA.fl_redraw], 1
1144
        and     [edi + WDATA.fl_wstate], not WSTATE_MINIMIZED
1089
        and     [edi + WDATA.fl_wstate], not WSTATE_MINIMIZED
1145
        mov     ebp, window._.set_screen
1090
        mov     ebp, window._.set_screen
1146
        cmp     eax, [TASK_COUNT]
1091
        cmp     eax, [TASK_COUNT]
1147
        jz      @f
1092
        jz      @f
1148
        mov     ebp, calculatescreen
1093
        mov     ebp, calculatescreen
1149
;--------------------------------------
1094
;--------------------------------------
1150
align 4
1095
align 4
1151
@@:
1096
@@:
1152
        mov     eax, [edi + WDATA.box.left]
1097
        mov     eax, [edi + WDATA.box.left]
1153
        mov     ebx, [edi + WDATA.box.top]
1098
        mov     ebx, [edi + WDATA.box.top]
1154
        mov     ecx, [edi + WDATA.box.width]
1099
        mov     ecx, [edi + WDATA.box.width]
1155
        mov     edx, [edi + WDATA.box.height]
1100
        mov     edx, [edi + WDATA.box.height]
1156
        add     ecx, eax
1101
        add     ecx, eax
1157
        add     edx, ebx
1102
        add     edx, ebx
1158
        call    ebp
1103
        call    ebp
1159
 
1104
 
1160
        cmp     ebp, window._.set_screen
1105
        cmp     ebp, window._.set_screen
1161
        jne     @f
1106
        jne     @f
1162
        call    window._.set_top_wnd
1107
        call    window._.set_top_wnd
1163
    @@:
1108
    @@:
1164
        inc     [_display.mask_seqno]
1109
        inc     [_display.mask_seqno]
1165
;--------------------------------------
1110
;--------------------------------------
1166
align 4
1111
align 4
1167
.exit:
1112
.exit:
1168
        popfd
1113
        popfd
1169
        popad
1114
        popad
1170
        ret
1115
        ret
1171
;------------------------------------------------------------------------------
1116
;------------------------------------------------------------------------------
1172
align 4
1117
align 4
1173
; TODO: remove this proc
1118
; TODO: remove this proc
1174
;------------------------------------------------------------------------------
1119
;------------------------------------------------------------------------------
1175
window_check_events: ;/////////////////////////////////////////////////////////
1120
window_check_events: ;/////////////////////////////////////////////////////////
1176
;------------------------------------------------------------------------------
1121
;------------------------------------------------------------------------------
1177
;? 
1122
;? 
1178
;------------------------------------------------------------------------------
1123
;------------------------------------------------------------------------------
1179
        ; do we have window minimize/restore request?
1124
        ; do we have window minimize/restore request?
1180
        cmp     [window_minimize], 0
1125
        cmp     [window_minimize], 0
1181
        je      .exit
1126
        je      .exit
1182
 
1127
 
1183
        ; okay, minimize or restore top-most window and exit
1128
        ; okay, minimize or restore top-most window and exit
1184
        mov     eax, [TASK_COUNT]
1129
        mov     eax, [TASK_COUNT]
1185
        mov     bl, 0
1130
        mov     bl, 0
1186
        xchg    [window_minimize], bl
1131
        xchg    [window_minimize], bl
1187
        dec     bl
1132
        dec     bl
1188
        jnz     @f
1133
        jnz     @f
1189
        call    minimize_window
1134
        call    minimize_window
1190
        jmp     .exit
1135
        jmp     .exit
1191
;--------------------------------------
1136
;--------------------------------------
1192
align 4
1137
align 4
1193
@@:
1138
@@:
1194
        call    restore_minimized_window
1139
        call    restore_minimized_window
1195
;--------------------------------------
1140
;--------------------------------------
1196
align 4
1141
align 4
1197
.exit:
1142
.exit:
1198
        ret
1143
        ret
1199
;------------------------------------------------------------------------------
1144
;------------------------------------------------------------------------------
1200
align 4
1145
align 4
1201
;------------------------------------------------------------------------------
1146
;------------------------------------------------------------------------------
1202
sys_window_maximize_handler: ;/////////////////////////////////////////////////
1147
sys_window_maximize_handler: ;/////////////////////////////////////////////////
1203
;------------------------------------------------------------------------------
1148
;------------------------------------------------------------------------------
1204
;? 
1149
;? 
1205
;------------------------------------------------------------------------------
1150
;------------------------------------------------------------------------------
1206
;> esi = process slot
1151
;> esi = process slot
1207
;------------------------------------------------------------------------------
1152
;------------------------------------------------------------------------------
1208
        mov     edi, esi
1153
        mov     edi, esi
1209
        shl     edi, 5
1154
        shl     edi, 5
1210
        add     edi, window_data
1155
        add     edi, window_data
1211
 
1156
 
1212
        ; can window change its height?
1157
        ; can window change its height?
1213
        ; only types 2 and 3 can be resized
1158
        ; only types 2 and 3 can be resized
1214
        mov     dl, [edi + WDATA.fl_wstyle]
1159
        mov     dl, [edi + WDATA.fl_wstyle]
1215
        test    dl, 2
1160
        test    dl, 2
1216
        jz      .exit
1161
        jz      .exit
1217
 
1162
 
1218
        ; toggle normal/maximized window state
1163
        ; toggle normal/maximized window state
1219
        mov     bl, [edi + WDATA.fl_wstate]
1164
        mov     bl, [edi + WDATA.fl_wstate]
1220
        xor     bl, WSTATE_MAXIMIZED
1165
        xor     bl, WSTATE_MAXIMIZED
1221
 
1166
 
1222
        ; calculate and set appropriate window bounds
1167
        ; calculate and set appropriate window bounds
1223
        test    bl, WSTATE_MAXIMIZED
1168
        test    bl, WSTATE_MAXIMIZED
1224
        jz      .restore_size
1169
        jz      .restore_size
1225
 
1170
 
1226
        mov     eax, [screen_workarea.left]
1171
        mov     eax, [screen_workarea.left]
1227
        mov     ecx, [screen_workarea.top]
1172
        mov     ecx, [screen_workarea.top]
1228
        push    [screen_workarea.bottom] \
1173
        push    [screen_workarea.bottom] \
1229
                [screen_workarea.right] \
1174
                [screen_workarea.right] \
1230
                ecx \
1175
                ecx \
1231
                eax
1176
                eax
1232
        sub     [esp + BOX.width], eax
1177
        sub     [esp + BOX.width], eax
1233
        sub     [esp + BOX.height], ecx
1178
        sub     [esp + BOX.height], ecx
1234
        mov     eax, esp
1179
        mov     eax, esp
1235
        jmp     .set_box
1180
        jmp     .set_box
1236
;--------------------------------------
1181
;--------------------------------------
1237
align 4
1182
align 4
1238
.restore_size:
1183
.restore_size:
1239
        mov     eax, esi
1184
        mov     eax, esi
1240
        shl     eax, 8
1185
        shl     eax, 8
1241
        add     eax, SLOT_BASE + APPDATA.saved_box
1186
        add     eax, SLOT_BASE + APPDATA.saved_box
1242
        push    [eax + BOX.height] \
1187
        push    [eax + BOX.height] \
1243
                [eax + BOX.width] \
1188
                [eax + BOX.width] \
1244
                [eax + BOX.top] \
1189
                [eax + BOX.top] \
1245
                [eax + BOX.left]
1190
                [eax + BOX.left]
1246
        mov     eax, esp
1191
        mov     eax, esp
1247
;--------------------------------------
1192
;--------------------------------------
1248
align 4
1193
align 4
1249
.set_box:
1194
.set_box:
1250
        test    bl, WSTATE_ROLLEDUP
1195
        test    bl, WSTATE_ROLLEDUP
1251
        jz      @f
1196
        jz      @f
1252
 
1197
 
1253
        xchg    eax, ecx
1198
        xchg    eax, ecx
1254
        call    window._.get_rolledup_height
1199
        call    window._.get_rolledup_height
1255
        mov     [ecx + BOX.height], eax
1200
        mov     [ecx + BOX.height], eax
1256
        xchg    eax, ecx
1201
        xchg    eax, ecx
1257
;--------------------------------------
1202
;--------------------------------------
1258
align 4
1203
align 4
1259
@@:
1204
@@:
1260
        call    window._.set_window_box
1205
        call    window._.set_window_box
1261
        add     esp, sizeof.BOX
1206
        add     esp, sizeof.BOX
1262
;--------------------------------------
1207
;--------------------------------------
1263
align 4
1208
align 4
1264
.exit:
1209
.exit:
1265
        inc     [_display.mask_seqno]
1210
        inc     [_display.mask_seqno]
1266
        ret
1211
        ret
1267
;------------------------------------------------------------------------------
1212
;------------------------------------------------------------------------------
1268
align 4
1213
align 4
1269
;------------------------------------------------------------------------------
1214
;------------------------------------------------------------------------------
1270
sys_window_rollup_handler: ;///////////////////////////////////////////////////
1215
sys_window_rollup_handler: ;///////////////////////////////////////////////////
1271
;------------------------------------------------------------------------------
1216
;------------------------------------------------------------------------------
1272
;? 
1217
;? 
1273
;------------------------------------------------------------------------------
1218
;------------------------------------------------------------------------------
1274
;> esi = process slot
1219
;> esi = process slot
1275
;------------------------------------------------------------------------------
1220
;------------------------------------------------------------------------------
1276
        mov     edx, esi
1221
        mov     edx, esi
1277
        shl     edx, 8
1222
        shl     edx, 8
1278
        add     edx, SLOT_BASE
1223
        add     edx, SLOT_BASE
1279
 
1224
 
1280
        ; toggle normal/rolled up window state
1225
        ; toggle normal/rolled up window state
1281
        mov     bl, [edi + WDATA.fl_wstate]
1226
        mov     bl, [edi + WDATA.fl_wstate]
1282
        xor     bl, WSTATE_ROLLEDUP
1227
        xor     bl, WSTATE_ROLLEDUP
1283
 
1228
 
1284
        ; calculate and set appropriate window bounds
1229
        ; calculate and set appropriate window bounds
1285
        test    bl, WSTATE_ROLLEDUP
1230
        test    bl, WSTATE_ROLLEDUP
1286
        jz      .restore_size
1231
        jz      .restore_size
1287
 
1232
 
1288
        call    window._.get_rolledup_height
1233
        call    window._.get_rolledup_height
1289
        push    eax \
1234
        push    eax \
1290
                [edi + WDATA.box.width] \
1235
                [edi + WDATA.box.width] \
1291
                [edi + WDATA.box.top] \
1236
                [edi + WDATA.box.top] \
1292
                [edi + WDATA.box.left]
1237
                [edi + WDATA.box.left]
1293
        mov     eax, esp
1238
        mov     eax, esp
1294
        jmp     .set_box
1239
        jmp     .set_box
1295
;--------------------------------------
1240
;--------------------------------------
1296
align 4
1241
align 4
1297
.restore_size:
1242
.restore_size:
1298
        test    bl, WSTATE_MAXIMIZED
1243
        test    bl, WSTATE_MAXIMIZED
1299
        jnz     @f
1244
        jnz     @f
1300
        add     esp, -sizeof.BOX
1245
        add     esp, -sizeof.BOX
1301
        lea     eax, [edx + APPDATA.saved_box]
1246
        lea     eax, [edx + APPDATA.saved_box]
1302
        jmp     .set_box
1247
        jmp     .set_box
1303
;--------------------------------------
1248
;--------------------------------------
1304
align 4
1249
align 4
1305
@@:
1250
@@:
1306
        mov     eax, [screen_workarea.top]
1251
        mov     eax, [screen_workarea.top]
1307
        push    [screen_workarea.bottom] \
1252
        push    [screen_workarea.bottom] \
1308
                [edi + WDATA.box.width] \
1253
                [edi + WDATA.box.width] \
1309
                eax \
1254
                eax \
1310
                [edi + WDATA.box.left]
1255
                [edi + WDATA.box.left]
1311
        sub     [esp + BOX.height], eax
1256
        sub     [esp + BOX.height], eax
1312
        mov     eax, esp
1257
        mov     eax, esp
1313
;--------------------------------------
1258
;--------------------------------------
1314
align 4
1259
align 4
1315
.set_box:
1260
.set_box:
1316
        call    window._.set_window_box
1261
        call    window._.set_window_box
1317
        add     esp, sizeof.BOX
1262
        add     esp, sizeof.BOX
1318
        ret
1263
        ret
1319
;------------------------------------------------------------------------------
1264
;------------------------------------------------------------------------------
1320
align 4
1265
align 4
1321
;------------------------------------------------------------------------------
1266
;------------------------------------------------------------------------------
1322
;sys_window_start_moving_handler: ;/////////////////////////////////////////////
1267
;sys_window_start_moving_handler: ;/////////////////////////////////////////////
1323
;------------------------------------------------------------------------------
1268
;------------------------------------------------------------------------------
1324
;? 
1269
;? 
1325
;------------------------------------------------------------------------------
1270
;------------------------------------------------------------------------------
1326
;> eax = old (original) window box
1271
;> eax = old (original) window box
1327
;> esi = process slot
1272
;> esi = process slot
1328
;------------------------------------------------------------------------------
1273
;------------------------------------------------------------------------------
1329
;        mov     edi, eax
1274
;        mov     edi, eax
1330
;        call    window._.draw_negative_box
1275
;        call    window._.draw_negative_box
1331
;        ret
1276
;        ret
1332
;------------------------------------------------------------------------------
1277
;------------------------------------------------------------------------------
1333
align 4
1278
align 4
1334
;------------------------------------------------------------------------------
1279
;------------------------------------------------------------------------------
1335
sys_window_end_moving_handler: ;///////////////////////////////////////////////
1280
sys_window_end_moving_handler: ;///////////////////////////////////////////////
1336
;------------------------------------------------------------------------------
1281
;------------------------------------------------------------------------------
1337
;? 
1282
;? 
1338
;------------------------------------------------------------------------------
1283
;------------------------------------------------------------------------------
1339
;> eax = old (original) window box
1284
;> eax = old (original) window box
1340
;> ebx = new (final) window box
1285
;> ebx = new (final) window box
1341
;> esi = process slot
1286
;> esi = process slot
1342
;------------------------------------------------------------------------------
1287
;------------------------------------------------------------------------------
1343
;        mov     edi, ebx
1288
;        mov     edi, ebx
1344
;        call    window._.end_moving__box
1289
;        call    window._.end_moving__box
1345
 
1290
 
1346
        mov     edi, esi
1291
        mov     edi, esi
1347
        shl     edi, 5
1292
        shl     edi, 5
1348
        add     edi, window_data
1293
        add     edi, window_data
1349
 
1294
 
1350
        test    [fl_moving], 1
1295
        test    [fl_moving], 1
1351
        jz      @f
1296
        jz      @f
1352
 
1297
 
1353
        push    edi
1298
        push    edi
1354
        mov     edi, ebx
1299
        mov     edi, ebx
1355
        call    window._.draw_negative_box
1300
        call    window._.draw_negative_box
1356
        pop     edi
1301
        pop     edi
1357
    @@:
1302
    @@:
1358
 
1303
 
1359
        mov     eax, ebx
1304
        mov     eax, ebx
1360
        mov     bl, [edi + WDATA.fl_wstate]
1305
        mov     bl, [edi + WDATA.fl_wstate]
1361
        call    window._.set_window_box
1306
        call    window._.set_window_box
1362
        ret
1307
        ret
1363
;------------------------------------------------------------------------------
1308
;------------------------------------------------------------------------------
1364
align 4
1309
align 4
1365
;------------------------------------------------------------------------------
1310
;------------------------------------------------------------------------------
1366
sys_window_moving_handler: ;///////////////////////////////////////////////////
1311
sys_window_moving_handler: ;///////////////////////////////////////////////////
1367
;------------------------------------------------------------------------------
1312
;------------------------------------------------------------------------------
1368
;? 
1313
;? 
1369
;------------------------------------------------------------------------------
1314
;------------------------------------------------------------------------------
1370
;> eax = old (from previous call) window box
1315
;> eax = old (from previous call) window box
1371
;> ebx = new (current) window box
1316
;> ebx = new (current) window box
1372
;> esi = process_slot
1317
;> esi = process_slot
1373
;------------------------------------------------------------------------------
1318
;------------------------------------------------------------------------------
1374
        mov     edi, eax
1319
        mov     edi, eax
1375
        call    window._.draw_negative_box
1320
        call    window._.draw_negative_box
1376
        mov     edi, ebx
1321
        mov     edi, ebx
1377
        call    window._.draw_negative_box
1322
        call    window._.draw_negative_box
1378
        ret
1323
        ret
1379
;==============================================================================
1324
;==============================================================================
1380
;///// private functions //////////////////////////////////////////////////////
1325
;///// private functions //////////////////////////////////////////////////////
1381
;==============================================================================
1326
;==============================================================================
1382
 
1327
 
1383
iglobal
1328
iglobal
1384
  FuncTable syscall_display_settings, ftable, \
-
 
1385
    00, 01, 02, 03, 04, 05, 06, 07, 08, 09, 10, 11, 12
-
 
1386
 
-
 
1387
  align 4
1329
align 4
1388
  window_topleft dd \
1330
window_topleft  dd \
1389
    1, 21, \ ;type 0
1331
    1, 21, \ ;type 0
1390
    0,  0, \ ;type 1
1332
    0,  0, \ ;type 1
1391
    5, 20, \ ;type 2
1333
    5, 20, \ ;type 2
1392
    5,  ?, \ ;type 3 {set by skin}
1334
    5,  ?, \ ;type 3 {set by skin}
1393
    5,  ?    ;type 4 {set by skin}
1335
    5,  ?    ;type 4 {set by skin}
1394
endg
1336
endg
1395
 
-
 
1396
;uglobal
-
 
1397
  ; NOTE: commented out since doesn't provide necessary functionality anyway,
-
 
1398
  ;       to be reworked
-
 
1399
; new_window_starting       dd ?
-
 
1400
;endg
1337
 
1401
;------------------------------------------------------------------------------
1338
;------------------------------------------------------------------------------
1402
align 4
1339
align 4
1403
;------------------------------------------------------------------------------
1340
;------------------------------------------------------------------------------
1404
window._.invalidate_screen: ;//////////////////////////////////////////////////
1341
window._.invalidate_screen: ;//////////////////////////////////////////////////
1405
;------------------------------------------------------------------------------
1342
;------------------------------------------------------------------------------
1406
;? 
1343
;? 
1407
;------------------------------------------------------------------------------
1344
;------------------------------------------------------------------------------
1408
;> eax = old (original) window box
1345
;> eax = old (original) window box
1409
;> ebx = new (final) window box
1346
;> ebx = new (final) window box
1410
;> edi = pointer to WDATA struct
1347
;> edi = pointer to WDATA struct
1411
;------------------------------------------------------------------------------
1348
;------------------------------------------------------------------------------
1412
        push    eax ebx
1349
        push    eax ebx
1413
 
1350
 
1414
        ; TODO: do we really need `draw_limits`?
1351
        ; TODO: do we really need `draw_limits`?
1415
        ; Yes, they are used by background drawing code.
1352
        ; Yes, they are used by background drawing code.
1416
 
1353
 
1417
; we need only to restore the background windows at the old place!
1354
; we need only to restore the background windows at the old place!
1418
        mov     ecx, [ebx + BOX.left]
1355
        mov     ecx, [ebx + BOX.left]
1419
        mov     [draw_limits.left], ecx
1356
        mov     [draw_limits.left], ecx
1420
        add     ecx, [ebx + BOX.width]
1357
        add     ecx, [ebx + BOX.width]
1421
        mov     [draw_limits.right], ecx
1358
        mov     [draw_limits.right], ecx
1422
        mov     ecx, [ebx + BOX.top]
1359
        mov     ecx, [ebx + BOX.top]
1423
        mov     [draw_limits.top], ecx
1360
        mov     [draw_limits.top], ecx
1424
        add     ecx, [ebx + BOX.height]
1361
        add     ecx, [ebx + BOX.height]
1425
        mov     [draw_limits.bottom], ecx
1362
        mov     [draw_limits.bottom], ecx
1426
; recalculate screen buffer at old position
1363
; recalculate screen buffer at old position
1427
        push    ebx
1364
        push    ebx
1428
        mov     edx, [eax + BOX.height]
1365
        mov     edx, [eax + BOX.height]
1429
        mov     ecx, [eax + BOX.width]
1366
        mov     ecx, [eax + BOX.width]
1430
        mov     ebx, [eax + BOX.top]
1367
        mov     ebx, [eax + BOX.top]
1431
        mov     eax, [eax + BOX.left]
1368
        mov     eax, [eax + BOX.left]
1432
        add     ecx, eax
1369
        add     ecx, eax
1433
        add     edx, ebx
1370
        add     edx, ebx
1434
        call    calculatescreen
1371
        call    calculatescreen
1435
        pop     eax
1372
        pop     eax
1436
; recalculate screen buffer at new position
1373
; recalculate screen buffer at new position
1437
        mov     edx, [eax + BOX.height]
1374
        mov     edx, [eax + BOX.height]
1438
        mov     ecx, [eax + BOX.width]
1375
        mov     ecx, [eax + BOX.width]
1439
        mov     ebx, [eax + BOX.top]
1376
        mov     ebx, [eax + BOX.top]
1440
        mov     eax, [eax + BOX.left]
1377
        mov     eax, [eax + BOX.left]
1441
        add     ecx, eax
1378
        add     ecx, eax
1442
        add     edx, ebx
1379
        add     edx, ebx
1443
        call    calculatescreen
1380
        call    calculatescreen
1444
 
1381
 
1445
        mov     eax, edi
1382
        mov     eax, edi
1446
        call    redrawscreen
1383
        call    redrawscreen
1447
 
1384
 
1448
        ; tell window to redraw itself
1385
        ; tell window to redraw itself
1449
        mov     [edi + WDATA.fl_redraw], 1
1386
        mov     [edi + WDATA.fl_redraw], 1
1450
 
1387
 
1451
        pop     ebx eax
1388
        pop     ebx eax
1452
        ret
1389
        ret
1453
;------------------------------------------------------------------------------
1390
;------------------------------------------------------------------------------
1454
align 4
1391
align 4
1455
;------------------------------------------------------------------------------
1392
;------------------------------------------------------------------------------
1456
window._.set_window_box: ;/////////////////////////////////////////////////////
1393
window._.set_window_box: ;/////////////////////////////////////////////////////
1457
;------------------------------------------------------------------------------
1394
;------------------------------------------------------------------------------
1458
;? 
1395
;? 
1459
;------------------------------------------------------------------------------
1396
;------------------------------------------------------------------------------
1460
;> eax = pointer to BOX struct
1397
;> eax = pointer to BOX struct
1461
;> bl = new window state flags
1398
;> bl = new window state flags
1462
;> edi = pointer to WDATA struct
1399
;> edi = pointer to WDATA struct
1463
;------------------------------------------------------------------------------
1400
;------------------------------------------------------------------------------
1464
        push    eax ebx esi
1401
        push    eax ebx esi
1465
 
1402
 
1466
; don't do anything if the new box is identical to the old
1403
; don't do anything if the new box is identical to the old
1467
        cmp     bl, [edi + WDATA.fl_wstate]
1404
        cmp     bl, [edi + WDATA.fl_wstate]
1468
        jnz     @f
1405
        jnz     @f
1469
        mov     esi, eax
1406
        mov     esi, eax
1470
        push    edi
1407
        push    edi
1471
if WDATA.box
1408
if WDATA.box
1472
        add     edi, WDATA.box
1409
        add     edi, WDATA.box
1473
end if
1410
end if
1474
        mov     ecx, 4
1411
        mov     ecx, 4
1475
        repz cmpsd
1412
        repz cmpsd
1476
        pop     edi
1413
        pop     edi
1477
        jz      .exit
1414
        jz      .exit
1478
;--------------------------------------
1415
;--------------------------------------
1479
align 4
1416
align 4
1480
@@:
1417
@@:
1481
        add     esp, -sizeof.BOX
1418
        add     esp, -sizeof.BOX
1482
        mov     ebx, esp
1419
        mov     ebx, esp
1483
if WDATA.box
1420
if WDATA.box
1484
        lea     esi, [edi + WDATA.box]
1421
        lea     esi, [edi + WDATA.box]
1485
else
1422
else
1486
        mov     esi, edi ; optimization for WDATA.box = 0
1423
        mov     esi, edi ; optimization for WDATA.box = 0
1487
end if
1424
end if
1488
        xchg    eax, esi
1425
        xchg    eax, esi
1489
        mov     ecx, sizeof.BOX
1426
        mov     ecx, sizeof.BOX
1490
        call    memmove
1427
        call    memmove
1491
        xchg    eax, esi
1428
        xchg    eax, esi
1492
        xchg    ebx, esi
1429
        xchg    ebx, esi
1493
        call    memmove
1430
        call    memmove
1494
        mov     eax, ebx
1431
        mov     eax, ebx
1495
        mov     ebx, esi
1432
        mov     ebx, esi
1496
        call    window._.check_window_position
1433
        call    window._.check_window_position
1497
        call    window._.set_window_clientbox
1434
        call    window._.set_window_clientbox
1498
        call    window._.invalidate_screen
1435
        call    window._.invalidate_screen
1499
 
1436
 
1500
        add     esp, sizeof.BOX
1437
        add     esp, sizeof.BOX
1501
 
1438
 
1502
        mov     cl, [esp + 4]
1439
        mov     cl, [esp + 4]
1503
        mov     ch, cl
1440
        mov     ch, cl
1504
        xchg    cl, [edi + WDATA.fl_wstate]
1441
        xchg    cl, [edi + WDATA.fl_wstate]
1505
 
1442
 
1506
        or      cl, ch
1443
        or      cl, ch
1507
        test    cl, WSTATE_MAXIMIZED
1444
        test    cl, WSTATE_MAXIMIZED
1508
        jnz     .exit
1445
        jnz     .exit
1509
 
1446
 
1510
        mov     eax, edi
1447
        mov     eax, edi
1511
        sub     eax, window_data
1448
        sub     eax, window_data
1512
        shl     eax, 3
1449
        shl     eax, 3
1513
        add     eax, SLOT_BASE
1450
        add     eax, SLOT_BASE
1514
 
1451
 
1515
        lea     ebx, [edi + WDATA.box]
1452
        lea     ebx, [edi + WDATA.box]
1516
        xchg    esp, ebx
1453
        xchg    esp, ebx
1517
 
1454
 
1518
        pop     [eax + APPDATA.saved_box.left] \
1455
        pop     [eax + APPDATA.saved_box.left] \
1519
                [eax + APPDATA.saved_box.top] \
1456
                [eax + APPDATA.saved_box.top] \
1520
                [eax + APPDATA.saved_box.width] \
1457
                [eax + APPDATA.saved_box.width] \
1521
                edx
1458
                edx
1522
 
1459
 
1523
        xchg    esp, ebx
1460
        xchg    esp, ebx
1524
 
1461
 
1525
        test    ch, WSTATE_ROLLEDUP
1462
        test    ch, WSTATE_ROLLEDUP
1526
        jnz     .exit
1463
        jnz     .exit
1527
 
1464
 
1528
        mov     [eax + APPDATA.saved_box.height], edx
1465
        mov     [eax + APPDATA.saved_box.height], edx
1529
;--------------------------------------
1466
;--------------------------------------
1530
align 4
1467
align 4
1531
.exit:
1468
.exit:
1532
        pop     esi ebx eax
1469
        pop     esi ebx eax
1533
        ret
1470
        ret
1534
;------------------------------------------------------------------------------
1471
;------------------------------------------------------------------------------
1535
align 4
1472
align 4
1536
;------------------------------------------------------------------------------
1473
;------------------------------------------------------------------------------
1537
window._.set_window_clientbox: ;///////////////////////////////////////////////
1474
window._.set_window_clientbox: ;///////////////////////////////////////////////
1538
;------------------------------------------------------------------------------
1475
;------------------------------------------------------------------------------
1539
;? 
1476
;? 
1540
;------------------------------------------------------------------------------
1477
;------------------------------------------------------------------------------
1541
;> edi = pointer to WDATA struct
1478
;> edi = pointer to WDATA struct
1542
;------------------------------------------------------------------------------
1479
;------------------------------------------------------------------------------
1543
        push    eax ecx edi
1480
        push    eax ecx edi
1544
 
1481
 
1545
        mov     eax, [_skinh]
1482
        mov     eax, [_skinh]
1546
        mov     [window_topleft + 8 * 3 + 4], eax
1483
        mov     [window_topleft + 8 * 3 + 4], eax
1547
        mov     [window_topleft + 8 * 4 + 4], eax
1484
        mov     [window_topleft + 8 * 4 + 4], eax
1548
 
1485
 
1549
        mov     ecx, edi
1486
        mov     ecx, edi
1550
        sub     edi, window_data
1487
        sub     edi, window_data
1551
        shl     edi, 3
1488
        shl     edi, 3
1552
        test    [ecx + WDATA.fl_wstyle], WSTYLE_CLIENTRELATIVE
1489
        test    [ecx + WDATA.fl_wstyle], WSTYLE_CLIENTRELATIVE
1553
        jz      .whole_window
1490
        jz      .whole_window
1554
 
1491
 
1555
        movzx   eax, [ecx + WDATA.fl_wstyle]
1492
        movzx   eax, [ecx + WDATA.fl_wstyle]
1556
        and     eax, 0x0F
1493
        and     eax, 0x0F
1557
        mov     eax, [eax * 8 + window_topleft + 0]
1494
        mov     eax, [eax * 8 + window_topleft + 0]
1558
        mov     [edi + SLOT_BASE + APPDATA.wnd_clientbox.left], eax
1495
        mov     [edi + SLOT_BASE + APPDATA.wnd_clientbox.left], eax
1559
        shl     eax, 1
1496
        shl     eax, 1
1560
        neg     eax
1497
        neg     eax
1561
        add     eax, [ecx + WDATA.box.width]
1498
        add     eax, [ecx + WDATA.box.width]
1562
        mov     [edi + SLOT_BASE + APPDATA.wnd_clientbox.width], eax
1499
        mov     [edi + SLOT_BASE + APPDATA.wnd_clientbox.width], eax
1563
 
1500
 
1564
        movzx   eax, [ecx + WDATA.fl_wstyle]
1501
        movzx   eax, [ecx + WDATA.fl_wstyle]
1565
        and     eax, 0x0F
1502
        and     eax, 0x0F
1566
        push    [eax * 8 + window_topleft + 0]
1503
        push    [eax * 8 + window_topleft + 0]
1567
        mov     eax, [eax * 8 + window_topleft + 4]
1504
        mov     eax, [eax * 8 + window_topleft + 4]
1568
        mov     [edi + SLOT_BASE + APPDATA.wnd_clientbox.top], eax
1505
        mov     [edi + SLOT_BASE + APPDATA.wnd_clientbox.top], eax
1569
        neg     eax
1506
        neg     eax
1570
        sub     eax, [esp]
1507
        sub     eax, [esp]
1571
        add     eax, [ecx + WDATA.box.height]
1508
        add     eax, [ecx + WDATA.box.height]
1572
        mov     [edi + SLOT_BASE + APPDATA.wnd_clientbox.height], eax
1509
        mov     [edi + SLOT_BASE + APPDATA.wnd_clientbox.height], eax
1573
        add     esp, 4
1510
        add     esp, 4
1574
        jmp     .exit
1511
        jmp     .exit
1575
;--------------------------------------
1512
;--------------------------------------
1576
align 4
1513
align 4
1577
.whole_window:
1514
.whole_window:
1578
        xor     eax, eax
1515
        xor     eax, eax
1579
        mov     [edi + SLOT_BASE + APPDATA.wnd_clientbox.left], eax
1516
        mov     [edi + SLOT_BASE + APPDATA.wnd_clientbox.left], eax
1580
        mov     [edi + SLOT_BASE + APPDATA.wnd_clientbox.top], eax
1517
        mov     [edi + SLOT_BASE + APPDATA.wnd_clientbox.top], eax
1581
        mov     eax, [ecx + WDATA.box.width]
1518
        mov     eax, [ecx + WDATA.box.width]
1582
        mov     [edi + SLOT_BASE + APPDATA.wnd_clientbox.width], eax
1519
        mov     [edi + SLOT_BASE + APPDATA.wnd_clientbox.width], eax
1583
        mov     eax, [ecx + WDATA.box.height]
1520
        mov     eax, [ecx + WDATA.box.height]
1584
        mov     [edi + SLOT_BASE + APPDATA.wnd_clientbox.height], eax
1521
        mov     [edi + SLOT_BASE + APPDATA.wnd_clientbox.height], eax
1585
;--------------------------------------
1522
;--------------------------------------
1586
align 4
1523
align 4
1587
.exit:
1524
.exit:
1588
        pop     edi ecx eax
1525
        pop     edi ecx eax
1589
        ret
1526
        ret
1590
;------------------------------------------------------------------------------
1527
;------------------------------------------------------------------------------
1591
align 4
1528
align 4
1592
;------------------------------------------------------------------------------
1529
;------------------------------------------------------------------------------
1593
window._.sys_set_window: ;/////////////////////////////////////////////////////
1530
window._.sys_set_window: ;/////////////////////////////////////////////////////
1594
;------------------------------------------------------------------------------
1531
;------------------------------------------------------------------------------
1595
;? 
1532
;? 
1596
;------------------------------------------------------------------------------
1533
;------------------------------------------------------------------------------
1597
;< edx = pointer to WDATA struct
1534
;< edx = pointer to WDATA struct
1598
;------------------------------------------------------------------------------
1535
;------------------------------------------------------------------------------
1599
        mov     eax, [CURRENT_TASK]
1536
        mov     eax, [CURRENT_TASK]
1600
        shl     eax, 5
1537
        shl     eax, 5
1601
        add     eax, window_data
1538
        add     eax, window_data
1602
; save window colors
1539
; save window colors
1603
        mov     [eax + WDATA.cl_workarea], edx
1540
        mov     [eax + WDATA.cl_workarea], edx
1604
        mov     [eax + WDATA.cl_titlebar], esi
1541
        mov     [eax + WDATA.cl_titlebar], esi
1605
        mov     [eax + WDATA.cl_frames], edi
1542
        mov     [eax + WDATA.cl_frames], edi
1606
        mov     edi, eax
1543
        mov     edi, eax
1607
; Was it already defined before?
1544
; Was it already defined before?
1608
        test    [edi + WDATA.fl_wdrawn], 1
1545
        test    [edi + WDATA.fl_wdrawn], 1
1609
        jnz     .set_client_box
1546
        jnz     .set_client_box
1610
; No, it wasn't. After first draw_window we need redraw mouse necessarily!
1547
; No, it wasn't. After first draw_window we need redraw mouse necessarily!
1611
; Otherwise the user can see cursor specified by f.37.5 from another window.
1548
; Otherwise the user can see cursor specified by f.37.5 from another window.
1612
; He will be really unhappy! Usually, he will be enraged!
1549
; He will be really unhappy! Usually, he will be enraged!
1613
        or      [edi + WDATA.fl_wdrawn], 1
1550
        or      [edi + WDATA.fl_wdrawn], 1
1614
        mov     [redrawmouse_unconditional], 1
1551
        mov     [redrawmouse_unconditional], 1
1615
        call    wakeup_osloop
1552
        call    wakeup_osloop
1616
; performing initial window definition
1553
; performing initial window definition
1617
        movzx   eax, bx
1554
        movzx   eax, bx
1618
        mov     [edi + WDATA.box.width], eax
1555
        mov     [edi + WDATA.box.width], eax
1619
        movzx   eax, cx
1556
        movzx   eax, cx
1620
        mov     [edi + WDATA.box.height], eax
1557
        mov     [edi + WDATA.box.height], eax
1621
        sar     ebx, 16
1558
        sar     ebx, 16
1622
        sar     ecx, 16
1559
        sar     ecx, 16
1623
        mov     [edi + WDATA.box.left], ebx
1560
        mov     [edi + WDATA.box.left], ebx
1624
        mov     [edi + WDATA.box.top], ecx
1561
        mov     [edi + WDATA.box.top], ecx
1625
 
1562
 
1626
        call    window._.check_window_position
1563
        call    window._.check_window_position
1627
 
1564
 
1628
        push    ecx edi
1565
        push    ecx edi
1629
 
1566
 
1630
        mov     cl, [edi + WDATA.fl_wstyle]
1567
        mov     cl, [edi + WDATA.fl_wstyle]
1631
        mov     eax, [edi + WDATA.cl_frames]
1568
        mov     eax, [edi + WDATA.cl_frames]
1632
 
1569
 
1633
        sub     edi, window_data
1570
        sub     edi, window_data
1634
        shl     edi, 3
1571
        shl     edi, 3
1635
        add     edi, SLOT_BASE
1572
        add     edi, SLOT_BASE
1636
 
1573
 
1637
        and     cl, 0x0F
1574
        and     cl, 0x0F
1638
        cmp     cl, 3
1575
        cmp     cl, 3
1639
        je      @f
1576
        je      @f
1640
        cmp     cl, 4
1577
        cmp     cl, 4
1641
        je      @f
1578
        je      @f
1642
 
1579
 
1643
        xor     eax, eax
1580
        xor     eax, eax
1644
;--------------------------------------
1581
;--------------------------------------
1645
align 4
1582
align 4
1646
@@:
1583
@@:
1647
        mov     [edi + APPDATA.wnd_caption], eax
1584
        mov     [edi + APPDATA.wnd_caption], eax
1648
 
1585
 
1649
        mov     esi, [esp]
1586
        mov     esi, [esp]
1650
        add     edi, APPDATA.saved_box
1587
        add     edi, APPDATA.saved_box
1651
        movsd
1588
        movsd
1652
        movsd
1589
        movsd
1653
        movsd
1590
        movsd
1654
        movsd
1591
        movsd
1655
 
1592
 
1656
        pop     edi ecx
1593
        pop     edi ecx
1657
 
1594
 
1658
        mov     esi, [CURRENT_TASK]
1595
        mov     esi, [CURRENT_TASK]
1659
        movzx   esi, word[WIN_STACK + esi * 2]
1596
        movzx   esi, word[WIN_STACK + esi * 2]
1660
        lea     esi, [WIN_POS + esi * 2]
1597
        lea     esi, [WIN_POS + esi * 2]
1661
        call    waredraw
1598
        call    waredraw
1662
 
1599
 
1663
        mov     eax, [edi + WDATA.box.left]
1600
        mov     eax, [edi + WDATA.box.left]
1664
        mov     ebx, [edi + WDATA.box.top]
1601
        mov     ebx, [edi + WDATA.box.top]
1665
        mov     ecx, [edi + WDATA.box.width]
1602
        mov     ecx, [edi + WDATA.box.width]
1666
        mov     edx, [edi + WDATA.box.height]
1603
        mov     edx, [edi + WDATA.box.height]
1667
        add     ecx, eax
1604
        add     ecx, eax
1668
        add     edx, ebx
1605
        add     edx, ebx
1669
        call    calculatescreen
1606
        call    calculatescreen
1670
 
1607
 
1671
        mov     byte[KEY_COUNT], 0           ; empty keyboard buffer
1608
        mov     byte[KEY_COUNT], 0           ; empty keyboard buffer
1672
        mov     byte[BTN_COUNT], 0           ; empty button buffer
1609
        mov     byte[BTN_COUNT], 0           ; empty button buffer
1673
;--------------------------------------
1610
;--------------------------------------
1674
align 4
1611
align 4
1675
.set_client_box:
1612
.set_client_box:
1676
        ; update window client box coordinates
1613
        ; update window client box coordinates
1677
        call    window._.set_window_clientbox
1614
        call    window._.set_window_clientbox
1678
 
1615
 
1679
        ; reset window redraw flag and exit
1616
        ; reset window redraw flag and exit
1680
        mov     [edi + WDATA.fl_redraw], 0
1617
        mov     [edi + WDATA.fl_redraw], 0
1681
        mov     edx, edi
1618
        mov     edx, edi
1682
        ret
1619
        ret
1683
;------------------------------------------------------------------------------
1620
;------------------------------------------------------------------------------
1684
align 4
1621
align 4
1685
;------------------------------------------------------------------------------
1622
;------------------------------------------------------------------------------
1686
window._.check_window_position: ;//////////////////////////////////////////////
1623
window._.check_window_position: ;//////////////////////////////////////////////
1687
;------------------------------------------------------------------------------
1624
;------------------------------------------------------------------------------
1688
;? Check if window is inside screen area
1625
;? Check if window is inside screen area
1689
;------------------------------------------------------------------------------
1626
;------------------------------------------------------------------------------
1690
;> edi = pointer to WDATA
1627
;> edi = pointer to WDATA
1691
;------------------------------------------------------------------------------
1628
;------------------------------------------------------------------------------
1692
        push    eax ebx ecx edx esi
1629
        push    eax ebx ecx edx esi
1693
 
1630
 
1694
        mov     eax, [edi + WDATA.box.left]
1631
        mov     eax, [edi + WDATA.box.left]
1695
        mov     ebx, [edi + WDATA.box.top]
1632
        mov     ebx, [edi + WDATA.box.top]
1696
        mov     ecx, [edi + WDATA.box.width]
1633
        mov     ecx, [edi + WDATA.box.width]
1697
        mov     edx, [edi + WDATA.box.height]
1634
        mov     edx, [edi + WDATA.box.height]
1698
 
1635
 
1699
        mov     esi, [_display.width]
1636
        mov     esi, [_display.width]
1700
        cmp     ecx, esi
1637
        cmp     ecx, esi
1701
        jae     .fix_width_high
1638
        jae     .fix_width_high
1702
;--------------------------------------
1639
;--------------------------------------
1703
align 4
1640
align 4
1704
.check_left:
1641
.check_left:
1705
        or      eax, eax
1642
        or      eax, eax
1706
        jl      .fix_left_low
1643
        jl      .fix_left_low
1707
        add     eax, ecx
1644
        add     eax, ecx
1708
        cmp     eax, esi
1645
        cmp     eax, esi
1709
        jge     .fix_left_high
1646
        jge     .fix_left_high
1710
;--------------------------------------
1647
;--------------------------------------
1711
align 4
1648
align 4
1712
.check_height:
1649
.check_height:
1713
        mov     esi, [_display.height]
1650
        mov     esi, [_display.height]
1714
        cmp     edx, esi
1651
        cmp     edx, esi
1715
        jae     .fix_height_high
1652
        jae     .fix_height_high
1716
;--------------------------------------
1653
;--------------------------------------
1717
align 4
1654
align 4
1718
.check_top:
1655
.check_top:
1719
        or      ebx, ebx
1656
        or      ebx, ebx
1720
        jl      .fix_top_low
1657
        jl      .fix_top_low
1721
        add     ebx, edx
1658
        add     ebx, edx
1722
        cmp     ebx, esi
1659
        cmp     ebx, esi
1723
        jge     .fix_top_high
1660
        jge     .fix_top_high
1724
;--------------------------------------
1661
;--------------------------------------
1725
align 4
1662
align 4
1726
.exit:
1663
.exit:
1727
        pop     esi edx ecx ebx eax
1664
        pop     esi edx ecx ebx eax
1728
        ret
1665
        ret
1729
;--------------------------------------
1666
;--------------------------------------
1730
align 4
1667
align 4
1731
.fix_width_high:
1668
.fix_width_high:
1732
        mov     ecx, esi
1669
        mov     ecx, esi
1733
        mov     [edi + WDATA.box.width], esi
1670
        mov     [edi + WDATA.box.width], esi
1734
        jmp     .check_left
1671
        jmp     .check_left
1735
;--------------------------------------
1672
;--------------------------------------
1736
align 4
1673
align 4
1737
.fix_left_low:
1674
.fix_left_low:
1738
        xor     eax, eax
1675
        xor     eax, eax
1739
        mov     [edi + WDATA.box.left], eax
1676
        mov     [edi + WDATA.box.left], eax
1740
        jmp     .check_height
1677
        jmp     .check_height
1741
;--------------------------------------
1678
;--------------------------------------
1742
align 4
1679
align 4
1743
.fix_left_high:
1680
.fix_left_high:
1744
        mov     eax, esi
1681
        mov     eax, esi
1745
        sub     eax, ecx
1682
        sub     eax, ecx
1746
        mov     [edi + WDATA.box.left], eax
1683
        mov     [edi + WDATA.box.left], eax
1747
        jmp     .check_height
1684
        jmp     .check_height
1748
;--------------------------------------
1685
;--------------------------------------
1749
align 4
1686
align 4
1750
.fix_height_high:
1687
.fix_height_high:
1751
        mov     edx, esi
1688
        mov     edx, esi
1752
        mov     [edi + WDATA.box.height], esi
1689
        mov     [edi + WDATA.box.height], esi
1753
        jmp     .check_top
1690
        jmp     .check_top
1754
;--------------------------------------
1691
;--------------------------------------
1755
align 4
1692
align 4
1756
.fix_top_low:
1693
.fix_top_low:
1757
        xor     ebx, ebx
1694
        xor     ebx, ebx
1758
        mov     [edi + WDATA.box.top], ebx
1695
        mov     [edi + WDATA.box.top], ebx
1759
        jmp     .exit
1696
        jmp     .exit
1760
;--------------------------------------
1697
;--------------------------------------
1761
align 4
1698
align 4
1762
.fix_top_high:
1699
.fix_top_high:
1763
        mov     ebx, esi
1700
        mov     ebx, esi
1764
        sub     ebx, edx
1701
        sub     ebx, edx
1765
        mov     [edi + WDATA.box.top], ebx
1702
        mov     [edi + WDATA.box.top], ebx
1766
        jmp     .exit
1703
        jmp     .exit
1767
;------------------------------------------------------------------------------
1704
;------------------------------------------------------------------------------
1768
align 4
1705
align 4
1769
;------------------------------------------------------------------------------
1706
;------------------------------------------------------------------------------
1770
window._.get_titlebar_height: ;////////////////////////////////////////////////
1707
window._.get_titlebar_height: ;////////////////////////////////////////////////
1771
;------------------------------------------------------------------------------
1708
;------------------------------------------------------------------------------
1772
;? 
1709
;? 
1773
;------------------------------------------------------------------------------
1710
;------------------------------------------------------------------------------
1774
;> edi = pointer to WDATA
1711
;> edi = pointer to WDATA
1775
;------------------------------------------------------------------------------
1712
;------------------------------------------------------------------------------
1776
        mov     al, [edi + WDATA.fl_wstyle]
1713
        mov     al, [edi + WDATA.fl_wstyle]
1777
        and     al, 0x0f
1714
        and     al, 0x0f
1778
        cmp     al, 0x03
1715
        cmp     al, 0x03
1779
        jne     @f
1716
        jne     @f
1780
        mov     eax, [_skinh]
1717
        mov     eax, [_skinh]
1781
        ret
1718
        ret
1782
;--------------------------------------
1719
;--------------------------------------
1783
align 4
1720
align 4
1784
@@:
1721
@@:
1785
        mov     eax, 21
1722
        mov     eax, 21
1786
        ret
1723
        ret
1787
;------------------------------------------------------------------------------
1724
;------------------------------------------------------------------------------
1788
align 4
1725
align 4
1789
;------------------------------------------------------------------------------
1726
;------------------------------------------------------------------------------
1790
window._.get_rolledup_height: ;////////////////////////////////////////////////
1727
window._.get_rolledup_height: ;////////////////////////////////////////////////
1791
;------------------------------------------------------------------------------
1728
;------------------------------------------------------------------------------
1792
;? 
1729
;? 
1793
;------------------------------------------------------------------------------
1730
;------------------------------------------------------------------------------
1794
;> edi = pointer to WDATA
1731
;> edi = pointer to WDATA
1795
;------------------------------------------------------------------------------
1732
;------------------------------------------------------------------------------
1796
        mov     al, [edi + WDATA.fl_wstyle]
1733
        mov     al, [edi + WDATA.fl_wstyle]
1797
        and     al, 0x0f
1734
        and     al, 0x0f
1798
        cmp     al, 0x03
1735
        cmp     al, 0x03
1799
        jb      @f
1736
        jb      @f
1800
        mov     eax, [_skinh]
1737
        mov     eax, [_skinh]
1801
        add     eax, 3
1738
        add     eax, 3
1802
        ret
1739
        ret
1803
;--------------------------------------
1740
;--------------------------------------
1804
align 4
1741
align 4
1805
@@:
1742
@@:
1806
        or      al, al
1743
        or      al, al
1807
        jnz     @f
1744
        jnz     @f
1808
        mov     eax, 21
1745
        mov     eax, 21
1809
        ret
1746
        ret
1810
;--------------------------------------
1747
;--------------------------------------
1811
align 4
1748
align 4
1812
@@:
1749
@@:
1813
        mov     eax, 21 + 2
1750
        mov     eax, 21 + 2
1814
        ret
1751
        ret
1815
;------------------------------------------------------------------------------
1752
;------------------------------------------------------------------------------
1816
align 4
1753
align 4
1817
;------------------------------------------------------------------------------
1754
;------------------------------------------------------------------------------
1818
window._.set_screen: ;/////////////////////////////////////////////////////////
1755
window._.set_screen: ;/////////////////////////////////////////////////////////
1819
;------------------------------------------------------------------------------
1756
;------------------------------------------------------------------------------
1820
;? Reserve window area in screen buffer
1757
;? Reserve window area in screen buffer
1821
;------------------------------------------------------------------------------
1758
;------------------------------------------------------------------------------
1822
;> eax = left
1759
;> eax = left
1823
;> ebx = top
1760
;> ebx = top
1824
;> ecx = right
1761
;> ecx = right
1825
;> edx = bottom
1762
;> edx = bottom
1826
;> esi = process number
1763
;> esi = process number
1827
;------------------------------------------------------------------------------
1764
;------------------------------------------------------------------------------
1828
virtual at esp
1765
virtual at esp
1829
  ff_x     dd ?
1766
  ff_x     dd ?
1830
  ff_y     dd ?
1767
  ff_y     dd ?
1831
  ff_width dd ?
1768
  ff_width dd ?
1832
  ff_xsz   dd ?
1769
  ff_xsz   dd ?
1833
  ff_ysz   dd ?
1770
  ff_ysz   dd ?
1834
  ff_scale dd ?
1771
  ff_scale dd ?
1835
end virtual
1772
end virtual
1836
 
1773
 
1837
        pushad
1774
        pushad
1838
 
1775
 
1839
        cmp     esi, 1
1776
        cmp     esi, 1
1840
        jz      .check_for_shaped_window
1777
        jz      .check_for_shaped_window
1841
        mov     edi, esi
1778
        mov     edi, esi
1842
        shl     edi, 5
1779
        shl     edi, 5
1843
        cmp     [window_data + edi + WDATA.box.width], 0
1780
        cmp     [window_data + edi + WDATA.box.width], 0
1844
        jnz     .check_for_shaped_window
1781
        jnz     .check_for_shaped_window
1845
        cmp     [window_data + edi + WDATA.box.height], 0
1782
        cmp     [window_data + edi + WDATA.box.height], 0
1846
        jz      .exit
1783
        jz      .exit
1847
;--------------------------------------
1784
;--------------------------------------
1848
align 4
1785
align 4
1849
.check_for_shaped_window:
1786
.check_for_shaped_window:
1850
        mov     edi, esi
1787
        mov     edi, esi
1851
        shl     edi, 8
1788
        shl     edi, 8
1852
        add     edi, SLOT_BASE
1789
        add     edi, SLOT_BASE
1853
        cmp     [edi + APPDATA.wnd_shape], 0
1790
        cmp     [edi + APPDATA.wnd_shape], 0
1854
        jne     .shaped_window
1791
        jne     .shaped_window
1855
 
1792
 
1856
        ; get x&y size
1793
        ; get x&y size
1857
        sub     ecx, eax
1794
        sub     ecx, eax
1858
        sub     edx, ebx
1795
        sub     edx, ebx
1859
        inc     ecx
1796
        inc     ecx
1860
        inc     edx
1797
        inc     edx
1861
 
1798
 
1862
        ; get WinMap start
1799
        ; get WinMap start
1863
        push    esi
1800
        push    esi
1864
        mov     esi, [_display.width]
1801
        mov     esi, [_display.width]
1865
        mov     edi, [d_width_calc_area + ebx*4]
1802
        mov     edi, [d_width_calc_area + ebx*4]
1866
 
1803
 
1867
        add     edi, eax
1804
        add     edi, eax
1868
        add     edi, [_display.win_map]
1805
        add     edi, [_display.win_map]
1869
        pop     eax
1806
        pop     eax
1870
        mov     ah, al
1807
        mov     ah, al
1871
        push    ax
1808
        push    ax
1872
        shl     eax, 16
1809
        shl     eax, 16
1873
        pop     ax
1810
        pop     ax
1874
;--------------------------------------
1811
;--------------------------------------
1875
align 4
1812
align 4
1876
.next_line:
1813
.next_line:
1877
        push    ecx
1814
        push    ecx
1878
        shr     ecx, 2
1815
        shr     ecx, 2
1879
        rep stosd
1816
        rep stosd
1880
        mov     ecx, [esp]
1817
        mov     ecx, [esp]
1881
        and     ecx, 3
1818
        and     ecx, 3
1882
        rep stosb
1819
        rep stosb
1883
        pop     ecx
1820
        pop     ecx
1884
        add     edi, esi
1821
        add     edi, esi
1885
        sub     edi, ecx
1822
        sub     edi, ecx
1886
        dec     edx
1823
        dec     edx
1887
        jnz     .next_line
1824
        jnz     .next_line
1888
 
1825
 
1889
        jmp     .exit
1826
        jmp     .exit
1890
;--------------------------------------
1827
;--------------------------------------
1891
align 4
1828
align 4
1892
.shaped_window:
1829
.shaped_window:
1893
        ;  for (y=0; y <= x_size; y++)
1830
        ;  for (y=0; y <= x_size; y++)
1894
        ;      for (x=0; x <= x_size; x++)
1831
        ;      for (x=0; x <= x_size; x++)
1895
        ;          if (shape[coord(x,y,scale)]==1)
1832
        ;          if (shape[coord(x,y,scale)]==1)
1896
        ;             set_pixel(x, y, process_number);
1833
        ;             set_pixel(x, y, process_number);
1897
 
1834
 
1898
        sub     ecx, eax
1835
        sub     ecx, eax
1899
        sub     edx, ebx
1836
        sub     edx, ebx
1900
        inc     ecx
1837
        inc     ecx
1901
        inc     edx
1838
        inc     edx
1902
 
1839
 
1903
        push    [edi + APPDATA.wnd_shape_scale]  ; push scale first -> for loop
1840
        push    [edi + APPDATA.wnd_shape_scale]  ; push scale first -> for loop
1904
 
1841
 
1905
        ; get WinMap start  -> ebp
1842
        ; get WinMap start  -> ebp
1906
        push    eax
1843
        push    eax
1907
        mov     eax, [d_width_calc_area + ebx*4]
1844
        mov     eax, [d_width_calc_area + ebx*4]
1908
 
1845
 
1909
        add     eax, [esp]
1846
        add     eax, [esp]
1910
        add     eax, [_display.win_map]
1847
        add     eax, [_display.win_map]
1911
        mov     ebp, eax
1848
        mov     ebp, eax
1912
 
1849
 
1913
        mov     edi, [edi + APPDATA.wnd_shape]
1850
        mov     edi, [edi + APPDATA.wnd_shape]
1914
        pop     eax
1851
        pop     eax
1915
 
1852
 
1916
        ; eax = x_start
1853
        ; eax = x_start
1917
        ; ebx = y_start
1854
        ; ebx = y_start
1918
        ; ecx = x_size
1855
        ; ecx = x_size
1919
        ; edx = y_size
1856
        ; edx = y_size
1920
        ; esi = process_number
1857
        ; esi = process_number
1921
        ; edi = &shape
1858
        ; edi = &shape
1922
        ;       [scale]
1859
        ;       [scale]
1923
        push    edx ecx ; for loop - x,y size
1860
        push    edx ecx ; for loop - x,y size
1924
 
1861
 
1925
        mov     ecx, esi
1862
        mov     ecx, esi
1926
        shl     ecx, 5
1863
        shl     ecx, 5
1927
        mov     edx, [window_data + ecx + WDATA.box.top]
1864
        mov     edx, [window_data + ecx + WDATA.box.top]
1928
        push    [window_data + ecx + WDATA.box.width]           ; for loop - width
1865
        push    [window_data + ecx + WDATA.box.width]           ; for loop - width
1929
        mov     ecx, [window_data + ecx + WDATA.box.left]
1866
        mov     ecx, [window_data + ecx + WDATA.box.left]
1930
        sub     ebx, edx
1867
        sub     ebx, edx
1931
        sub     eax, ecx
1868
        sub     eax, ecx
1932
        push    ebx eax ; for loop - x,y
1869
        push    ebx eax ; for loop - x,y
1933
 
1870
 
1934
        add     [ff_xsz], eax
1871
        add     [ff_xsz], eax
1935
        add     [ff_ysz], ebx
1872
        add     [ff_ysz], ebx
1936
 
1873
 
1937
        mov     ebx, [ff_y]
1874
        mov     ebx, [ff_y]
1938
;--------------------------------------
1875
;--------------------------------------
1939
align 4
1876
align 4
1940
.ff_new_y:
1877
.ff_new_y:
1941
        mov     edx, [ff_x]
1878
        mov     edx, [ff_x]
1942
;--------------------------------------
1879
;--------------------------------------
1943
align 4
1880
align 4
1944
.ff_new_x:
1881
.ff_new_x:
1945
        ; -- body --
1882
        ; -- body --
1946
        mov     ecx, [ff_scale]
1883
        mov     ecx, [ff_scale]
1947
        mov     eax, [ff_width]
1884
        mov     eax, [ff_width]
1948
        inc     eax
1885
        inc     eax
1949
        shr     eax, cl
1886
        shr     eax, cl
1950
        push    ebx edx
1887
        push    ebx edx
1951
        shr     ebx, cl
1888
        shr     ebx, cl
1952
        shr     edx, cl
1889
        shr     edx, cl
1953
        imul    eax, ebx
1890
        imul    eax, ebx
1954
        add     eax, edx
1891
        add     eax, edx
1955
        pop     edx ebx
1892
        pop     edx ebx
1956
        add     eax, edi
1893
        add     eax, edi
1957
        call    .read_byte
1894
        call    .read_byte
1958
        test    al, al
1895
        test    al, al
1959
        jz      @f
1896
        jz      @f
1960
        mov     eax, esi
1897
        mov     eax, esi
1961
        mov     [ebp], al
1898
        mov     [ebp], al
1962
        ; -- end body --
1899
        ; -- end body --
1963
;--------------------------------------
1900
;--------------------------------------
1964
align 4
1901
align 4
1965
@@:
1902
@@:
1966
        inc     ebp
1903
        inc     ebp
1967
        inc     edx
1904
        inc     edx
1968
        cmp     edx, [ff_xsz]
1905
        cmp     edx, [ff_xsz]
1969
        jb      .ff_new_x
1906
        jb      .ff_new_x
1970
 
1907
 
1971
        sub     ebp, [ff_xsz]
1908
        sub     ebp, [ff_xsz]
1972
        add     ebp, [ff_x]
1909
        add     ebp, [ff_x]
1973
        add     ebp, [_display.width]  ; screen.x
1910
        add     ebp, [_display.width]  ; screen.x
1974
        inc     ebx
1911
        inc     ebx
1975
        cmp     ebx, [ff_ysz]
1912
        cmp     ebx, [ff_ysz]
1976
        jb      .ff_new_y
1913
        jb      .ff_new_y
1977
 
1914
 
1978
        add     esp, 24
1915
        add     esp, 24
1979
;--------------------------------------
1916
;--------------------------------------
1980
align 4
1917
align 4
1981
.exit:
1918
.exit:
1982
        popad
1919
        popad
1983
        inc     [_display.mask_seqno]
1920
        inc     [_display.mask_seqno]
1984
        ret
1921
        ret
1985
;--------------------------------------
1922
;--------------------------------------
1986
align 4
1923
align 4
1987
.read_byte:
1924
.read_byte:
1988
        ; eax - address
1925
        ; eax - address
1989
        ; esi - slot
1926
        ; esi - slot
1990
        push    eax ecx edx esi
1927
        push    eax ecx edx esi
1991
        xchg    eax, esi
1928
        xchg    eax, esi
1992
        lea     ecx, [esp + 12]
1929
        lea     ecx, [esp + 12]
1993
        mov     edx, 1
1930
        mov     edx, 1
1994
        call    read_process_memory
1931
        call    read_process_memory
1995
        pop     esi edx ecx eax
1932
        pop     esi edx ecx eax
1996
        ret
1933
        ret
1997
;------------------------------------------------------------------------------
1934
;------------------------------------------------------------------------------
1998
align 4
1935
align 4
1999
;------------------------------------------------------------------------------
1936
;------------------------------------------------------------------------------
2000
window._.window_activate: ;////////////////////////////////////////////////////
1937
window._.window_activate: ;////////////////////////////////////////////////////
2001
;------------------------------------------------------------------------------
1938
;------------------------------------------------------------------------------
2002
;? Activate window
1939
;? Activate window
2003
;------------------------------------------------------------------------------
1940
;------------------------------------------------------------------------------
2004
;> esi = pointer to WIN_POS+ window data
1941
;> esi = pointer to WIN_POS+ window data
2005
;------------------------------------------------------------------------------
1942
;------------------------------------------------------------------------------
2006
        push    eax ebx
1943
        push    eax ebx
2007
 
1944
 
2008
        ; if type of current active window is 3 or 4, it must be redrawn
1945
        ; if type of current active window is 3 or 4, it must be redrawn
2009
        mov     ebx, [TASK_COUNT]
1946
        mov     ebx, [TASK_COUNT]
2010
 
1947
 
2011
;       DEBUGF  1, "K : TASK_COUNT (0x%x)\n", ebx
1948
;       DEBUGF  1, "K : TASK_COUNT (0x%x)\n", ebx
2012
 
1949
 
2013
        movzx   ebx, word[WIN_POS + ebx * 2]
1950
        movzx   ebx, word[WIN_POS + ebx * 2]
2014
        shl     ebx, 5
1951
        shl     ebx, 5
2015
        add     eax, window_data
1952
        add     eax, window_data
2016
        mov     al, [window_data + ebx + WDATA.fl_wstyle]
1953
        mov     al, [window_data + ebx + WDATA.fl_wstyle]
2017
        and     al, 0x0f
1954
        and     al, 0x0f
2018
        cmp     al, 0x03
1955
        cmp     al, 0x03
2019
        je      .set_window_redraw_flag
1956
        je      .set_window_redraw_flag
2020
        cmp     al, 0x04
1957
        cmp     al, 0x04
2021
        jne     .move_others_down
1958
        jne     .move_others_down
2022
;--------------------------------------
1959
;--------------------------------------
2023
align 4
1960
align 4
2024
.set_window_redraw_flag:
1961
.set_window_redraw_flag:
2025
        mov     [window_data + ebx + WDATA.fl_redraw], 1
1962
        mov     [window_data + ebx + WDATA.fl_redraw], 1
2026
;--------------------------------------
1963
;--------------------------------------
2027
align 4
1964
align 4
2028
.move_others_down:
1965
.move_others_down:
2029
        ; ax <- process no
1966
        ; ax <- process no
2030
        movzx   ebx, word[esi]
1967
        movzx   ebx, word[esi]
2031
        ; ax <- position in window stack
1968
        ; ax <- position in window stack
2032
        movzx   ebx, word[WIN_STACK + ebx * 2]
1969
        movzx   ebx, word[WIN_STACK + ebx * 2]
2033
 
1970
 
2034
        ; drop others
1971
        ; drop others
2035
        xor     eax, eax
1972
        xor     eax, eax
2036
;--------------------------------------
1973
;--------------------------------------
2037
align 4
1974
align 4
2038
.next_stack_window:
1975
.next_stack_window:
2039
        cmp     eax, [TASK_COUNT]
1976
        cmp     eax, [TASK_COUNT]
2040
        jae     .move_self_up
1977
        jae     .move_self_up
2041
        inc     eax
1978
        inc     eax
2042
 
1979
 
2043
;       push    ebx
1980
;       push    ebx
2044
;       xor     ebx,ebx
1981
;       xor     ebx,ebx
2045
;       mov     bx,[WIN_STACK + eax * 2]
1982
;       mov     bx,[WIN_STACK + eax * 2]
2046
;       DEBUGF  1, "K : DEC WIN_STACK (0x%x)\n",ebx
1983
;       DEBUGF  1, "K : DEC WIN_STACK (0x%x)\n",ebx
2047
;       pop     ebx
1984
;       pop     ebx
2048
 
1985
 
2049
        cmp     [WIN_STACK + eax * 2], bx
1986
        cmp     [WIN_STACK + eax * 2], bx
2050
        jbe     .next_stack_window
1987
        jbe     .next_stack_window
2051
        dec     word[WIN_STACK + eax * 2]
1988
        dec     word[WIN_STACK + eax * 2]
2052
        jmp     .next_stack_window
1989
        jmp     .next_stack_window
2053
;--------------------------------------
1990
;--------------------------------------
2054
align 4
1991
align 4
2055
.move_self_up:
1992
.move_self_up:
2056
        movzx   ebx, word[esi]
1993
        movzx   ebx, word[esi]
2057
        ; number of processes
1994
        ; number of processes
2058
        mov     ax, [TASK_COUNT]
1995
        mov     ax, [TASK_COUNT]
2059
        ; this is the last (and the upper)
1996
        ; this is the last (and the upper)
2060
        mov     [WIN_STACK + ebx * 2], ax
1997
        mov     [WIN_STACK + ebx * 2], ax
2061
 
1998
 
2062
        ; update on screen - window stack
1999
        ; update on screen - window stack
2063
        xor     eax, eax
2000
        xor     eax, eax
2064
;--------------------------------------
2001
;--------------------------------------
2065
align 4
2002
align 4
2066
.next_window_pos:
2003
.next_window_pos:
2067
        cmp     eax, [TASK_COUNT]
2004
        cmp     eax, [TASK_COUNT]
2068
        jae     .reset_vars
2005
        jae     .reset_vars
2069
        inc     eax
2006
        inc     eax
2070
        movzx   ebx, word[WIN_STACK + eax * 2]
2007
        movzx   ebx, word[WIN_STACK + eax * 2]
2071
        mov     [WIN_POS + ebx * 2], ax
2008
        mov     [WIN_POS + ebx * 2], ax
2072
        jmp     .next_window_pos
2009
        jmp     .next_window_pos
2073
;--------------------------------------
2010
;--------------------------------------
2074
align 4
2011
align 4
2075
.reset_vars:
2012
.reset_vars:
2076
        mov     byte[KEY_COUNT], 0
2013
        mov     byte[KEY_COUNT], 0
2077
        mov     byte[BTN_COUNT], 0
2014
        mov     byte[BTN_COUNT], 0
2078
        mov     word[MOUSE_SCROLL_H], 0
2015
        mov     word[MOUSE_SCROLL_H], 0
2079
        mov     word[MOUSE_SCROLL_V], 0
2016
        mov     word[MOUSE_SCROLL_V], 0
2080
 
2017
 
2081
        pop     ebx eax
2018
        pop     ebx eax
2082
        ret
2019
        ret
2083
;------------------------------------------------------------------------------
2020
;------------------------------------------------------------------------------
2084
window._.window_deactivate: ;////////////////////////////////////////////////////
2021
window._.window_deactivate: ;////////////////////////////////////////////////////
2085
;------------------------------------------------------------------------------
2022
;------------------------------------------------------------------------------
2086
;? Deactivate window
2023
;? Deactivate window
2087
;------------------------------------------------------------------------------
2024
;------------------------------------------------------------------------------
2088
;> esi = pointer to WIN_POS+ window data
2025
;> esi = pointer to WIN_POS+ window data
2089
;------------------------------------------------------------------------------
2026
;------------------------------------------------------------------------------
2090
        push    eax ebx
2027
        push    eax ebx
2091
;--------------------------------------
2028
;--------------------------------------
2092
align 4
2029
align 4
2093
.move_others_up:
2030
.move_others_up:
2094
        ; ax <- process no
2031
        ; ax <- process no
2095
        movzx   ebx, word[esi]
2032
        movzx   ebx, word[esi]
2096
        ; ax <- position in window stack
2033
        ; ax <- position in window stack
2097
        movzx   ebx, word[WIN_STACK + ebx * 2]
2034
        movzx   ebx, word[WIN_STACK + ebx * 2]
2098
        ; up others
2035
        ; up others
2099
        xor     eax, eax
2036
        xor     eax, eax
2100
;--------------------------------------
2037
;--------------------------------------
2101
align 4
2038
align 4
2102
.next_stack_window:
2039
.next_stack_window:
2103
        cmp     eax, [TASK_COUNT]
2040
        cmp     eax, [TASK_COUNT]
2104
        jae     .move_self_down
2041
        jae     .move_self_down
2105
        inc     eax
2042
        inc     eax
2106
        cmp     [WIN_STACK + eax * 2], bx
2043
        cmp     [WIN_STACK + eax * 2], bx
2107
        jae     .next_stack_window
2044
        jae     .next_stack_window
2108
        inc     word[WIN_STACK + eax * 2]
2045
        inc     word[WIN_STACK + eax * 2]
2109
        jmp     .next_stack_window
2046
        jmp     .next_stack_window
2110
;--------------------------------------
2047
;--------------------------------------
2111
align 4
2048
align 4
2112
.move_self_down:
2049
.move_self_down:
2113
        movzx   ebx, word[esi]
2050
        movzx   ebx, word[esi]
2114
        ; this is the last (and the low)
2051
        ; this is the last (and the low)
2115
        mov     [WIN_STACK + ebx * 2], word 1
2052
        mov     [WIN_STACK + ebx * 2], word 1
2116
        ; update on screen - window stack
2053
        ; update on screen - window stack
2117
        xor     eax, eax
2054
        xor     eax, eax
2118
;--------------------------------------
2055
;--------------------------------------
2119
align 4
2056
align 4
2120
.next_window_pos:
2057
.next_window_pos:
2121
        cmp     eax, [TASK_COUNT]
2058
        cmp     eax, [TASK_COUNT]
2122
        jae     .reset_vars
2059
        jae     .reset_vars
2123
        inc     eax
2060
        inc     eax
2124
        movzx   ebx, word[WIN_STACK + eax * 2]
2061
        movzx   ebx, word[WIN_STACK + eax * 2]
2125
        mov     [WIN_POS + ebx * 2], ax
2062
        mov     [WIN_POS + ebx * 2], ax
2126
        jmp     .next_window_pos
2063
        jmp     .next_window_pos
2127
;--------------------------------------
2064
;--------------------------------------
2128
align 4
2065
align 4
2129
.reset_vars:
2066
.reset_vars:
2130
        mov     byte[KEY_COUNT], 0
2067
        mov     byte[KEY_COUNT], 0
2131
        mov     byte[BTN_COUNT], 0
2068
        mov     byte[BTN_COUNT], 0
2132
        mov     word[MOUSE_SCROLL_H], 0
2069
        mov     word[MOUSE_SCROLL_H], 0
2133
        mov     word[MOUSE_SCROLL_V], 0
2070
        mov     word[MOUSE_SCROLL_V], 0
2134
        pop     ebx eax
2071
        pop     ebx eax
2135
        ret
2072
        ret
2136
;------------------------------------------------------------------------------
2073
;------------------------------------------------------------------------------
2137
align 4
2074
align 4
2138
;------------------------------------------------------------------------------
2075
;------------------------------------------------------------------------------
2139
window._.check_window_draw: ;//////////////////////////////////////////////////
2076
window._.check_window_draw: ;//////////////////////////////////////////////////
2140
;------------------------------------------------------------------------------
2077
;------------------------------------------------------------------------------
2141
;? Check if window is necessary to draw
2078
;? Check if window is necessary to draw
2142
;------------------------------------------------------------------------------
2079
;------------------------------------------------------------------------------
2143
;> edi = pointer to WDATA
2080
;> edi = pointer to WDATA
2144
;------------------------------------------------------------------------------
2081
;------------------------------------------------------------------------------
2145
        mov     cl, [edi + WDATA.fl_wstyle]
2082
        mov     cl, [edi + WDATA.fl_wstyle]
2146
        and     cl, 0x0f
2083
        and     cl, 0x0f
2147
        cmp     cl, 3
2084
        cmp     cl, 3
2148
        je      .exit.redraw      ; window type 3
2085
        je      .exit.redraw      ; window type 3
2149
        cmp     cl, 4
2086
        cmp     cl, 4
2150
        je      .exit.redraw      ; window type 4
2087
        je      .exit.redraw      ; window type 4
2151
 
2088
 
2152
        push    eax ebx edx esi
2089
        push    eax ebx edx esi
2153
 
2090
 
2154
        mov     eax, edi
2091
        mov     eax, edi
2155
        sub     eax, window_data
2092
        sub     eax, window_data
2156
        shr     eax, 5
2093
        shr     eax, 5
2157
 
2094
 
2158
        movzx   eax, word[WIN_STACK + eax * 2]  ; get value of the curr process
2095
        movzx   eax, word[WIN_STACK + eax * 2]  ; get value of the curr process
2159
        lea     esi, [WIN_POS + eax * 2]        ; get address of this process at 0xC400
2096
        lea     esi, [WIN_POS + eax * 2]        ; get address of this process at 0xC400
2160
;--------------------------------------
2097
;--------------------------------------
2161
align 4
2098
align 4
2162
.next_window:
2099
.next_window:
2163
        add     esi, 2
2100
        add     esi, 2
2164
 
2101
 
2165
        mov     eax, [TASK_COUNT]
2102
        mov     eax, [TASK_COUNT]
2166
        lea     eax, word[WIN_POS + eax * 2] ; number of the upper window
2103
        lea     eax, word[WIN_POS + eax * 2] ; number of the upper window
2167
 
2104
 
2168
        cmp     esi, eax
2105
        cmp     esi, eax
2169
        ja      .exit.no_redraw
2106
        ja      .exit.no_redraw
2170
 
2107
 
2171
        movzx   edx, word[esi]
2108
        movzx   edx, word[esi]
2172
        shl     edx, 5
2109
        shl     edx, 5
2173
        cmp     [CURRENT_TASK + edx + TASKDATA.state], TSTATE_FREE
2110
        cmp     [CURRENT_TASK + edx + TASKDATA.state], TSTATE_FREE
2174
        je      .next_window
2111
        je      .next_window
2175
 
2112
 
2176
        mov     eax, [edi + WDATA.box.top]
2113
        mov     eax, [edi + WDATA.box.top]
2177
        mov     ebx, [edi + WDATA.box.height]
2114
        mov     ebx, [edi + WDATA.box.height]
2178
        add     ebx, eax
2115
        add     ebx, eax
2179
 
2116
 
2180
        mov     ecx, [window_data + edx + WDATA.box.top]
2117
        mov     ecx, [window_data + edx + WDATA.box.top]
2181
        cmp     ecx, ebx
2118
        cmp     ecx, ebx
2182
        jge     .next_window
2119
        jge     .next_window
2183
        add     ecx, [window_data + edx + WDATA.box.height]
2120
        add     ecx, [window_data + edx + WDATA.box.height]
2184
        cmp     eax, ecx
2121
        cmp     eax, ecx
2185
        jge     .next_window
2122
        jge     .next_window
2186
 
2123
 
2187
        mov     eax, [edi + WDATA.box.left]
2124
        mov     eax, [edi + WDATA.box.left]
2188
        mov     ebx, [edi + WDATA.box.width]
2125
        mov     ebx, [edi + WDATA.box.width]
2189
        add     ebx, eax
2126
        add     ebx, eax
2190
 
2127
 
2191
        mov     ecx, [window_data + edx + WDATA.box.left]
2128
        mov     ecx, [window_data + edx + WDATA.box.left]
2192
        cmp     ecx, ebx
2129
        cmp     ecx, ebx
2193
        jge     .next_window
2130
        jge     .next_window
2194
        add     ecx, [window_data + edx + WDATA.box.width]
2131
        add     ecx, [window_data + edx + WDATA.box.width]
2195
        cmp     eax, ecx
2132
        cmp     eax, ecx
2196
        jge     .next_window
2133
        jge     .next_window
2197
 
2134
 
2198
        pop     esi edx ebx eax
2135
        pop     esi edx ebx eax
2199
;--------------------------------------
2136
;--------------------------------------
2200
align 4
2137
align 4
2201
.exit.redraw:
2138
.exit.redraw:
2202
        xor     ecx, ecx
2139
        xor     ecx, ecx
2203
        inc     ecx
2140
        inc     ecx
2204
        ret
2141
        ret
2205
;--------------------------------------
2142
;--------------------------------------
2206
align 4
2143
align 4
2207
.exit.no_redraw:
2144
.exit.no_redraw:
2208
        pop     esi edx ebx eax
2145
        pop     esi edx ebx eax
2209
        xor     ecx, ecx
2146
        xor     ecx, ecx
2210
        ret
2147
        ret
2211
;------------------------------------------------------------------------------
2148
;------------------------------------------------------------------------------
2212
align 4
2149
align 4
2213
;------------------------------------------------------------------------------
2150
;------------------------------------------------------------------------------
2214
window._.draw_window_caption: ;////////////////////////////////////////////////
2151
window._.draw_window_caption: ;////////////////////////////////////////////////
2215
;------------------------------------------------------------------------------
2152
;------------------------------------------------------------------------------
2216
;? 
2153
;? 
2217
;------------------------------------------------------------------------------
2154
;------------------------------------------------------------------------------
2218
        xor     eax, eax
2155
        xor     eax, eax
2219
        mov     edx, [TASK_COUNT]
2156
        mov     edx, [TASK_COUNT]
2220
        movzx   edx, word[WIN_POS + edx * 2]
2157
        movzx   edx, word[WIN_POS + edx * 2]
2221
        cmp     edx, [CURRENT_TASK]
2158
        cmp     edx, [CURRENT_TASK]
2222
        jne     @f
2159
        jne     @f
2223
        inc     eax
2160
        inc     eax
2224
;--------------------------------------
2161
;--------------------------------------
2225
align 4
2162
align 4
2226
@@:
2163
@@:
2227
        mov     edx, [CURRENT_TASK]
2164
        mov     edx, [CURRENT_TASK]
2228
        shl     edx, 5
2165
        shl     edx, 5
2229
        add     edx, window_data
2166
        add     edx, window_data
2230
        movzx   ebx, [edx + WDATA.fl_wstyle]
2167
        movzx   ebx, [edx + WDATA.fl_wstyle]
2231
        and     bl, 0x0F
2168
        and     bl, 0x0F
2232
        cmp     bl, 3
2169
        cmp     bl, 3
2233
        je      .draw_caption_style_3
2170
        je      .draw_caption_style_3
2234
        cmp     bl, 4
2171
        cmp     bl, 4
2235
        je      .draw_caption_style_3
2172
        je      .draw_caption_style_3
2236
 
2173
 
2237
        jmp     .not_style_3
2174
        jmp     .not_style_3
2238
;--------------------------------------
2175
;--------------------------------------
2239
align 4
2176
align 4
2240
.draw_caption_style_3:
2177
.draw_caption_style_3:
2241
        push    edx
2178
        push    edx
2242
        call    drawwindow_IV_caption
2179
        call    drawwindow_IV_caption
2243
        add     esp, 4
2180
        add     esp, 4
2244
        jmp     .2
2181
        jmp     .2
2245
;--------------------------------------
2182
;--------------------------------------
2246
align 4
2183
align 4
2247
.not_style_3:
2184
.not_style_3:
2248
        cmp     bl, 2
2185
        cmp     bl, 2
2249
        jne     .not_style_2
2186
        jne     .not_style_2
2250
 
2187
 
2251
        call    drawwindow_III_caption
2188
        call    drawwindow_III_caption
2252
        jmp     .2
2189
        jmp     .2
2253
;--------------------------------------
2190
;--------------------------------------
2254
align 4
2191
align 4
2255
.not_style_2:
2192
.not_style_2:
2256
        cmp     bl, 0
2193
        cmp     bl, 0
2257
        jne     .2
2194
        jne     .2
2258
 
2195
 
2259
        call    drawwindow_I_caption
2196
        call    drawwindow_I_caption
2260
;--------------------------------------
2197
;--------------------------------------
2261
align 4
2198
align 4
2262
.2:
2199
.2:
2263
        mov     edi, [CURRENT_TASK]
2200
        mov     edi, [CURRENT_TASK]
2264
        shl     edi, 5
2201
        shl     edi, 5
2265
        test    [edi + window_data + WDATA.fl_wstyle], WSTYLE_HASCAPTION
2202
        test    [edi + window_data + WDATA.fl_wstyle], WSTYLE_HASCAPTION
2266
        jz      .exit
2203
        jz      .exit
2267
        mov     edx, [edi * 8 + SLOT_BASE + APPDATA.wnd_caption]
2204
        mov     edx, [edi * 8 + SLOT_BASE + APPDATA.wnd_caption]
2268
        or      edx, edx
2205
        or      edx, edx
2269
        jz      .exit
2206
        jz      .exit
2270
 
2207
 
2271
        mov     ebp, [edi + window_data + WDATA.box.left - 2]
2208
        mov     ebp, [edi + window_data + WDATA.box.left - 2]
2272
        mov     bp, word[edi + window_data + WDATA.box.top]
2209
        mov     bp, word[edi + window_data + WDATA.box.top]
2273
        movzx   eax, [edi + window_data + WDATA.fl_wstyle]
2210
        movzx   eax, [edi + window_data + WDATA.fl_wstyle]
2274
        and     al, 0x0F
2211
        and     al, 0x0F
2275
        cmp     al, 3
2212
        cmp     al, 3
2276
        je      .skinned
2213
        je      .skinned
2277
        cmp     al, 4
2214
        cmp     al, 4
2278
        je      .skinned
2215
        je      .skinned
2279
 
2216
 
2280
        jmp     .not_skinned
2217
        jmp     .not_skinned
2281
;--------------------------------------
2218
;--------------------------------------
2282
align 4
2219
align 4
2283
.skinned:
2220
.skinned:
2284
        movzx   eax, word[edi + window_data + WDATA.box.width]
2221
        movzx   eax, word[edi + window_data + WDATA.box.width]
2285
        sub     ax, [_skinmargins.left]
2222
        sub     ax, [_skinmargins.left]
2286
        sub     ax, [_skinmargins.right]
2223
        sub     ax, [_skinmargins.right]
2287
        js      .exit
2224
        js      .exit
2288
        mov     ebx, dword[_skinmargins.left - 2]
2225
        mov     ebx, dword[_skinmargins.left - 2]
2289
        mov     bx, word[_skinh]
2226
        mov     bx, word[_skinh]
2290
        sub     bx, [_skinmargins.bottom]
2227
        sub     bx, [_skinmargins.bottom]
2291
        sub     bx, [_skinmargins.top]
2228
        sub     bx, [_skinmargins.top]
2292
        sar     bx, 1
2229
        sar     bx, 1
2293
        add     bx, [_skinmargins.top]
2230
        add     bx, [_skinmargins.top]
2294
        sub     bx, 8
2231
        sub     bx, 8
2295
        jmp     .dodraw
2232
        jmp     .dodraw
2296
;--------------------------------------
2233
;--------------------------------------
2297
align 4
2234
align 4
2298
.not_skinned:
2235
.not_skinned:
2299
        cmp     al, 1
2236
        cmp     al, 1
2300
        je      .exit
2237
        je      .exit
2301
        movzx   eax, word[edi + window_data + WDATA.box.width]
2238
        movzx   eax, word[edi + window_data + WDATA.box.width]
2302
        sub     eax, 16
2239
        sub     eax, 16
2303
        js      .exit
2240
        js      .exit
2304
        mov     ebx, 80002h
2241
        mov     ebx, 80002h
2305
.dodraw:
2242
.dodraw:
2306
        shr     eax, 3
2243
        shr     eax, 3
2307
        mov     esi, eax
2244
        mov     esi, eax
2308
        add     ebx, ebp
2245
        add     ebx, ebp
2309
        mov     ecx, [common_colours + 16]
2246
        mov     ecx, [common_colours + 16]
2310
        mov     al, 1
2247
        mov     al, 1
2311
        cmp     byte [edx], 4
2248
        cmp     byte [edx], 4
2312
        jnc     @f
2249
        jnc     @f
2313
        mov     al, [edx]
2250
        mov     al, [edx]
2314
        test    al, al
2251
        test    al, al
2315
        jz      .exit
2252
        jz      .exit
2316
        inc     edx
2253
        inc     edx
2317
@@:
2254
@@:
2318
        shl     eax, 28
2255
        shl     eax, 28
2319
        or      ecx, eax
2256
        or      ecx, eax
2320
        xor     edi, edi
2257
        xor     edi, edi
2321
        call    dtext
2258
        call    dtext
2322
.exit:
2259
.exit:
2323
        jmp     __sys_draw_pointer
2260
        jmp     __sys_draw_pointer
2324
;------------------------------------------------------------------------------
2261
;------------------------------------------------------------------------------
2325
align 4
2262
align 4
2326
;------------------------------------------------------------------------------
2263
;------------------------------------------------------------------------------
2327
window._.draw_negative_box: ;//////////////////////////////////////////////////
2264
window._.draw_negative_box: ;//////////////////////////////////////////////////
2328
;------------------------------------------------------------------------------
2265
;------------------------------------------------------------------------------
2329
;? Draw negative box
2266
;? Draw negative box
2330
;------------------------------------------------------------------------------
2267
;------------------------------------------------------------------------------
2331
;> edi = pointer to BOX struct
2268
;> edi = pointer to BOX struct
2332
;------------------------------------------------------------------------------
2269
;------------------------------------------------------------------------------
2333
        push    eax ebx esi
2270
        push    eax ebx esi
2334
        mov     esi, 0x01000000
2271
        mov     esi, 0x01000000
2335
;--------------------------------------
2272
;--------------------------------------
2336
align 4
2273
align 4
2337
.1:
2274
.1:
2338
        mov     eax, [edi + BOX.left - 2]
2275
        mov     eax, [edi + BOX.left - 2]
2339
        mov     ax, word[edi + BOX.left]
2276
        mov     ax, word[edi + BOX.left]
2340
        add     ax, word[edi + BOX.width]
2277
        add     ax, word[edi + BOX.width]
2341
        mov     ebx, [edi + BOX.top - 2]
2278
        mov     ebx, [edi + BOX.top - 2]
2342
        mov     bx, word[edi + BOX.top]
2279
        mov     bx, word[edi + BOX.top]
2343
        add     bx, word[edi + BOX.height]
2280
        add     bx, word[edi + BOX.height]
2344
        call    draw_rectangle.forced
2281
        call    draw_rectangle.forced
2345
        pop     esi ebx eax
2282
        pop     esi ebx eax
2346
        ret
2283
        ret
2347
;------------------------------------------------------------------------------
2284
;------------------------------------------------------------------------------
2348
;align 4
2285
;align 4
2349
;------------------------------------------------------------------------------
2286
;------------------------------------------------------------------------------
2350
;window._.end_moving__box: ;//////////////////////////////////////////////////
2287
;window._.end_moving__box: ;//////////////////////////////////////////////////
2351
;------------------------------------------------------------------------------
2288
;------------------------------------------------------------------------------
2352
;? Draw positive box
2289
;? Draw positive box
2353
;------------------------------------------------------------------------------
2290
;------------------------------------------------------------------------------
2354
;> edi = pointer to BOX struct
2291
;> edi = pointer to BOX struct
2355
;------------------------------------------------------------------------------
2292
;------------------------------------------------------------------------------
2356
;        push    eax ebx esi
2293
;        push    eax ebx esi
2357
;        xor     esi, esi
2294
;        xor     esi, esi
2358
;        jmp     window._.draw_negative_box.1
2295
;        jmp     window._.draw_negative_box.1
2359
;------------------------------------------------------------------------------
2296
;------------------------------------------------------------------------------
2360
align 4
2297
align 4
2361
;------------------------------------------------------------------------------
2298
;------------------------------------------------------------------------------
2362
window._.get_rect: ;/////////////////////////////////////////////////////
2299
window._.get_rect: ;/////////////////////////////////////////////////////
2363
;------------------------------------------------------------------------------
2300
;------------------------------------------------------------------------------
2364
;?   void __fastcall get_window_rect(struct RECT* rc);
2301
;?   void __fastcall get_window_rect(struct RECT* rc);
2365
;------------------------------------------------------------------------------
2302
;------------------------------------------------------------------------------
2366
;> ecx = pointer to RECT
2303
;> ecx = pointer to RECT
2367
;------------------------------------------------------------------------------
2304
;------------------------------------------------------------------------------
2368
        mov     eax, [TASK_BASE]
2305
        mov     eax, [TASK_BASE]
2369
 
2306
 
2370
        mov     edx, [eax-twdw + WDATA.box.left]
2307
        mov     edx, [eax-twdw + WDATA.box.left]
2371
        mov     [ecx+RECT.left], edx
2308
        mov     [ecx+RECT.left], edx
2372
 
2309
 
2373
        add     edx, [eax-twdw + WDATA.box.width]
2310
        add     edx, [eax-twdw + WDATA.box.width]
2374
        mov     [ecx+RECT.right], edx
2311
        mov     [ecx+RECT.right], edx
2375
 
2312
 
2376
        mov     edx, [eax-twdw + WDATA.box.top]
2313
        mov     edx, [eax-twdw + WDATA.box.top]
2377
        mov     [ecx+RECT.top], edx
2314
        mov     [ecx+RECT.top], edx
2378
 
2315
 
2379
        add     edx, [eax-twdw + WDATA.box.height]
2316
        add     edx, [eax-twdw + WDATA.box.height]
2380
        mov     [ecx+RECT.bottom], edx
2317
        mov     [ecx+RECT.bottom], edx
2381
        ret
2318
        ret
2382
;------------------------------------------------------------------------------
2319
;------------------------------------------------------------------------------
2383
align 4
2320
align 4
2384
;------------------------------------------------------------------------------
2321
;------------------------------------------------------------------------------
2385
window._.redraw_top_wnd: ;////////////////////////////////////////////////////////
2322
window._.redraw_top_wnd: ;////////////////////////////////////////////////////////
2386
;------------------------------------------------------------------------------
2323
;------------------------------------------------------------------------------
2387
;? redraw all windows one above the window
2324
;? redraw all windows one above the window
2388
;------------------------------------------------------------------------------
2325
;------------------------------------------------------------------------------
2389
;> eax = left
2326
;> eax = left
2390
;> ebx = top
2327
;> ebx = top
2391
;> ecx = right
2328
;> ecx = right
2392
;> edx = bottom
2329
;> edx = bottom
2393
;> esi = process number
2330
;> esi = process number
2394
;! corrupted edi
2331
;! corrupted edi
2395
;------------------------------------------------------------------------------
2332
;------------------------------------------------------------------------------
2396
        push    0
2333
        push    0
2397
        jmp     window._.set_top_wnd.go
2334
        jmp     window._.set_top_wnd.go
2398
 
2335
 
2399
align 4
2336
align 4
2400
;------------------------------------------------------------------------------
2337
;------------------------------------------------------------------------------
2401
window._.set_top_wnd: ;////////////////////////////////////////////////////////
2338
window._.set_top_wnd: ;////////////////////////////////////////////////////////
2402
;------------------------------------------------------------------------------
2339
;------------------------------------------------------------------------------
2403
;? call set_screen for all windows one above the window
2340
;? call set_screen for all windows one above the window
2404
;------------------------------------------------------------------------------
2341
;------------------------------------------------------------------------------
2405
;> eax = left
2342
;> eax = left
2406
;> ebx = top
2343
;> ebx = top
2407
;> ecx = right
2344
;> ecx = right
2408
;> edx = bottom
2345
;> edx = bottom
2409
;> esi = process number
2346
;> esi = process number
2410
;! corrupted edi
2347
;! corrupted edi
2411
;------------------------------------------------------------------------------
2348
;------------------------------------------------------------------------------
2412
 
2349
 
2413
        push    1
2350
        push    1
2414
.go:
2351
.go:
2415
        push    esi
2352
        push    esi
2416
        pushfd
2353
        pushfd
2417
        cli
2354
        cli
2418
 
2355
 
2419
        push    ebp
2356
        push    ebp
2420
        mov     ebp, [TASK_COUNT]
2357
        mov     ebp, [TASK_COUNT]
2421
        cmp     ebp, 1
2358
        cmp     ebp, 1
2422
        jbe     .exit
2359
        jbe     .exit
2423
 
2360
 
2424
        shl     esi, 5
2361
        shl     esi, 5
2425
        cmp     [esi + window_data + WDATA.z_modif], ZPOS_ALWAYS_TOP
2362
        cmp     [esi + window_data + WDATA.z_modif], ZPOS_ALWAYS_TOP
2426
        je      .exit
2363
        je      .exit
2427
 
2364
 
2428
        push    eax ;for num layout
2365
        push    eax ;for num layout
2429
        push    edx ecx ebx eax
2366
        push    edx ecx ebx eax
2430
 
2367
 
2431
        movsx   eax, byte [esi + window_data + WDATA.z_modif]
2368
        movsx   eax, byte [esi + window_data + WDATA.z_modif]
2432
        inc     eax
2369
        inc     eax
2433
        mov     dword[esp+10h], eax
2370
        mov     dword[esp+10h], eax
2434
;--------------------------------------
2371
;--------------------------------------
2435
align 4
2372
align 4
2436
.layout:
2373
.layout:
2437
        mov     esi, 1        ; = num in window stack
2374
        mov     esi, 1        ; = num in window stack
2438
        mov     ebp, [TASK_COUNT]
2375
        mov     ebp, [TASK_COUNT]
2439
;--------------------------------------
2376
;--------------------------------------
2440
align 4
2377
align 4
2441
.next_window:
2378
.next_window:
2442
        movzx   edi, word[WIN_POS + esi * 2]
2379
        movzx   edi, word[WIN_POS + esi * 2]
2443
        shl     edi, 5                  ;size of TASKDATA and WDATA = 32 bytes
2380
        shl     edi, 5                  ;size of TASKDATA and WDATA = 32 bytes
2444
 
2381
 
2445
        cmp     [CURRENT_TASK + edi + TASKDATA.state], TSTATE_FREE
2382
        cmp     [CURRENT_TASK + edi + TASKDATA.state], TSTATE_FREE
2446
        je      .skip_window
2383
        je      .skip_window
2447
 
2384
 
2448
        add     edi, window_data
2385
        add     edi, window_data
2449
        test    [edi + WDATA.fl_wstate], WSTATE_MINIMIZED
2386
        test    [edi + WDATA.fl_wstate], WSTATE_MINIMIZED
2450
        jnz     .skip_window
2387
        jnz     .skip_window
2451
 
2388
 
2452
        mov     eax, [esp+10h]
2389
        mov     eax, [esp+10h]
2453
        cmp     [edi + WDATA.z_modif], al
2390
        cmp     [edi + WDATA.z_modif], al
2454
        jne     .skip_window
2391
        jne     .skip_window
2455
 
2392
 
2456
        mov     eax, [edi + WDATA.box.left]
2393
        mov     eax, [edi + WDATA.box.left]
2457
        cmp     eax, [esp + RECT.right]
2394
        cmp     eax, [esp + RECT.right]
2458
        jg      .skip_window
2395
        jg      .skip_window
2459
        mov     ebx, [edi + WDATA.box.top]
2396
        mov     ebx, [edi + WDATA.box.top]
2460
        cmp     ebx, [esp + RECT.bottom]
2397
        cmp     ebx, [esp + RECT.bottom]
2461
        jg      .skip_window
2398
        jg      .skip_window
2462
        mov     ecx, [edi + WDATA.box.width]
2399
        mov     ecx, [edi + WDATA.box.width]
2463
        add     ecx, eax
2400
        add     ecx, eax
2464
        cmp     ecx, [esp + RECT.left]
2401
        cmp     ecx, [esp + RECT.left]
2465
        jl      .skip_window
2402
        jl      .skip_window
2466
        mov     edx, [edi + WDATA.box.height]
2403
        mov     edx, [edi + WDATA.box.height]
2467
        add     edx, ebx
2404
        add     edx, ebx
2468
        cmp     edx, [esp + RECT.top]
2405
        cmp     edx, [esp + RECT.top]
2469
        jl      .skip_window
2406
        jl      .skip_window
2470
 
2407
 
2471
        cmp     eax, [esp + RECT.left]
2408
        cmp     eax, [esp + RECT.left]
2472
        jae     @f
2409
        jae     @f
2473
        mov     eax, [esp + RECT.left]
2410
        mov     eax, [esp + RECT.left]
2474
;--------------------------------------
2411
;--------------------------------------
2475
align 4
2412
align 4
2476
@@:
2413
@@:
2477
        cmp     ebx, [esp + RECT.top]
2414
        cmp     ebx, [esp + RECT.top]
2478
        jae     @f
2415
        jae     @f
2479
        mov     ebx, [esp + RECT.top]
2416
        mov     ebx, [esp + RECT.top]
2480
;--------------------------------------
2417
;--------------------------------------
2481
align 4
2418
align 4
2482
@@:
2419
@@:
2483
        cmp     ecx, [esp + RECT.right]
2420
        cmp     ecx, [esp + RECT.right]
2484
        jbe     @f
2421
        jbe     @f
2485
        mov     ecx, [esp + RECT.right]
2422
        mov     ecx, [esp + RECT.right]
2486
;--------------------------------------
2423
;--------------------------------------
2487
align 4
2424
align 4
2488
@@:
2425
@@:
2489
        cmp     edx, [esp + RECT.bottom]
2426
        cmp     edx, [esp + RECT.bottom]
2490
        jbe     @f
2427
        jbe     @f
2491
        mov     edx, [esp + RECT.bottom]
2428
        mov     edx, [esp + RECT.bottom]
2492
;--------------------------------------
2429
;--------------------------------------
2493
align 4
2430
align 4
2494
@@:
2431
@@:
2495
        cmp     dword[esp+32], 0
2432
        cmp     dword[esp+32], 0
2496
        je      .set_fl_redraw
2433
        je      .set_fl_redraw
2497
 
2434
 
2498
        push    esi
2435
        push    esi
2499
        movzx   esi, word[WIN_POS + esi * 2]
2436
        movzx   esi, word[WIN_POS + esi * 2]
2500
        call    window._.set_screen
2437
        call    window._.set_screen
2501
        pop     esi
2438
        pop     esi
2502
        jmp     @f
2439
        jmp     @f
2503
.set_fl_redraw:
2440
.set_fl_redraw:
2504
        mov     [edi + WDATA.fl_redraw], 1      ;set redraw flag
2441
        mov     [edi + WDATA.fl_redraw], 1      ;set redraw flag
2505
     @@:
2442
     @@:
2506
;--------------------------------------
2443
;--------------------------------------
2507
align 4
2444
align 4
2508
.skip_window:
2445
.skip_window:
2509
        inc     esi
2446
        inc     esi
2510
        dec     ebp
2447
        dec     ebp
2511
        jnz     .next_window
2448
        jnz     .next_window
2512
;--------------------------------------
2449
;--------------------------------------
2513
        inc     dword[esp+10h]
2450
        inc     dword[esp+10h]
2514
        cmp     byte[esp+10h], ZPOS_ALWAYS_TOP
2451
        cmp     byte[esp+10h], ZPOS_ALWAYS_TOP
2515
        jle     .layout
2452
        jle     .layout
2516
;-------------------------------------
2453
;-------------------------------------
2517
 
2454
 
2518
        pop     eax ebx ecx edx
2455
        pop     eax ebx ecx edx
2519
        pop     ebp     ;del num layout
2456
        pop     ebp     ;del num layout
2520
;-------------------------------------
2457
;-------------------------------------
2521
align 4
2458
align 4
2522
.exit:
2459
.exit:
2523
 
2460
 
2524
        pop     ebp
2461
        pop     ebp
2525
        popfd
2462
        popfd
2526
        pop     esi
2463
        pop     esi
2527
 
2464
 
2528
        add     esp, 4   ;dword for 0/1 - set_screen/fl_redraw
2465
        add     esp, 4   ;dword for 0/1 - set_screen/fl_redraw
2529
        ret
2466
        ret