2010-01-05 02:28:11 +01:00
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
;; ;;
|
2015-01-08 21:10:22 +01:00
|
|
|
;; Copyright (C) KolibriOS team 2004-2015. All rights reserved. ;;
|
2010-01-05 02:28:11 +01:00
|
|
|
;; Copyright (C) MenuetOS 2000-2004 Ville Mikael Turjanmaa ;;
|
|
|
|
;; Distributed under terms of the GNU General Public License ;;
|
|
|
|
;; ;;
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
|
|
|
$Revision$
|
|
|
|
|
|
|
|
;==============================================================================
|
|
|
|
;///// public functions ///////////////////////////////////////////////////////
|
|
|
|
;==============================================================================
|
|
|
|
|
2010-02-06 20:08:19 +01:00
|
|
|
window.BORDER_SIZE = 5
|
|
|
|
|
|
|
|
macro FuncTable name, table_name, [label]
|
2010-01-05 02:28:11 +01:00
|
|
|
{
|
|
|
|
common
|
|
|
|
align 4
|
2010-02-06 20:08:19 +01:00
|
|
|
\label name#.#table_name dword
|
2010-01-05 02:28:11 +01:00
|
|
|
forward
|
|
|
|
dd name#.#label
|
|
|
|
common
|
2010-02-06 20:08:19 +01:00
|
|
|
name#.sizeof.#table_name = $ - name#.#table_name
|
2010-01-05 02:28:11 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
uglobal
|
2014-04-06 12:06:51 +02:00
|
|
|
common_colours rd 48
|
2010-02-06 20:08:19 +01:00
|
|
|
draw_limits RECT
|
2010-01-05 02:28:11 +01:00
|
|
|
endg
|
|
|
|
|
2010-02-06 20:08:19 +01:00
|
|
|
align 4
|
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
syscall_draw_window: ;///// system function 0 /////////////////////////////////
|
|
|
|
;------------------------------------------------------------------------------
|
2014-04-06 12:20:38 +02:00
|
|
|
;? <description>.
|
2010-02-06 20:08:19 +01:00
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
mov eax, edx
|
|
|
|
shr eax, 24
|
|
|
|
and al, 0x0f
|
|
|
|
cmp al, 5
|
|
|
|
jae .exit
|
|
|
|
|
|
|
|
push eax
|
|
|
|
call window._.sys_set_window
|
|
|
|
pop eax
|
|
|
|
|
|
|
|
or al, al
|
|
|
|
jnz @f
|
|
|
|
|
|
|
|
; type I - original style
|
|
|
|
call drawwindow_I
|
|
|
|
jmp window._.draw_window_caption.2
|
2012-03-08 14:45:18 +01:00
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
|
|
|
@@:
|
2011-10-14 23:38:50 +02:00
|
|
|
dec al
|
2010-02-06 20:08:19 +01:00
|
|
|
jnz @f
|
|
|
|
|
|
|
|
; type II - only reserve area, no draw
|
2012-03-08 14:45:18 +01:00
|
|
|
; call sys_window_mouse
|
2012-03-12 19:26:37 +01:00
|
|
|
; call [draw_pointer]
|
|
|
|
call __sys_draw_pointer
|
2010-02-06 20:08:19 +01:00
|
|
|
jmp .exit
|
2012-03-08 14:45:18 +01:00
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
|
|
|
@@:
|
2011-10-14 23:38:50 +02:00
|
|
|
dec al
|
2010-02-06 20:08:19 +01:00
|
|
|
jnz @f
|
|
|
|
|
|
|
|
; type III - new style
|
|
|
|
call drawwindow_III
|
|
|
|
jmp window._.draw_window_caption.2
|
|
|
|
|
|
|
|
; type IV & V - skinned window (resizable & not)
|
2012-03-08 14:45:18 +01:00
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
|
|
|
@@:
|
2011-10-14 23:38:50 +02:00
|
|
|
mov eax, [TASK_COUNT]
|
2010-02-06 20:08:19 +01:00
|
|
|
movzx eax, word[WIN_POS + eax * 2]
|
|
|
|
cmp eax, [CURRENT_TASK]
|
|
|
|
setz al
|
|
|
|
movzx eax, al
|
|
|
|
push eax
|
|
|
|
call drawwindow_IV
|
|
|
|
jmp window._.draw_window_caption.2
|
2012-03-08 14:45:18 +01:00
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
|
|
|
.exit:
|
2010-02-06 20:08:19 +01:00
|
|
|
ret
|
2012-03-08 14:45:18 +01:00
|
|
|
;------------------------------------------------------------------------------
|
2010-01-05 02:28:11 +01:00
|
|
|
align 4
|
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
syscall_display_settings: ;///// system function 48 ///////////////////////////
|
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
;; Redraw screen:
|
|
|
|
;< ebx = 0
|
|
|
|
; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
;; Set button style:
|
|
|
|
;< ebx = 1
|
|
|
|
;< ecx = 0 (flat) or 1 (with gradient)
|
|
|
|
; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
;; Set system color palette:
|
|
|
|
;< ebx = 2
|
|
|
|
;< ecx = pointer to color table
|
|
|
|
;< edx = size of color table
|
|
|
|
; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
;; Get system color palette:
|
|
|
|
;< ebx = 3
|
|
|
|
;< ecx = pointer to color table buffer
|
|
|
|
;< edx = size of color table buffer
|
|
|
|
; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
;; Get skinned caption height:
|
|
|
|
;< ebx = 4
|
|
|
|
;> eax = height in pixels
|
|
|
|
; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
;; Get screen working area:
|
|
|
|
;< ebx = 5
|
|
|
|
;> eax = pack[16(left), 16(right)]
|
|
|
|
;> ebx = pack[16(top), 16(bottom)]
|
|
|
|
; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
;; Set screen working area:
|
|
|
|
;< ebx = 6
|
|
|
|
;< ecx = pack[16(left), 16(right)]
|
|
|
|
;< edx = pack[16(top), 16(bottom)]
|
|
|
|
; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
;; Get skin margins:
|
|
|
|
;< ebx = 7
|
|
|
|
;> eax = pack[16(left), 16(right)]
|
|
|
|
;> ebx = pack[16(top), 16(bottom)]
|
|
|
|
; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
;; Set skin:
|
|
|
|
;< ebx = 8
|
|
|
|
;< ecx = pointer to FileInfoBlock struct
|
|
|
|
;> eax = FS error code
|
2015-08-03 14:38:30 +02:00
|
|
|
; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
;; Set font smoothing:
|
|
|
|
;< ebx = 9
|
|
|
|
;< ecx = 0 (off) or !0 (on)
|
2010-01-05 02:28:11 +01:00
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
cmp ebx, .sizeof.ftable / 4
|
|
|
|
ja @f
|
|
|
|
jmp [.ftable + ebx * 4]
|
2012-03-08 14:45:18 +01:00
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
|
|
|
@@:
|
2011-10-14 23:38:50 +02:00
|
|
|
ret
|
2012-03-08 14:45:18 +01:00
|
|
|
;------------------------------------------------------------------------------
|
2010-01-05 02:28:11 +01:00
|
|
|
align 4
|
|
|
|
syscall_display_settings.00:
|
|
|
|
xor eax, eax
|
|
|
|
inc ebx
|
|
|
|
cmp [windowtypechanged], ebx
|
|
|
|
jne .exit
|
|
|
|
mov [windowtypechanged], eax
|
|
|
|
|
|
|
|
jmp syscall_display_settings._.redraw_whole_screen
|
2012-03-08 14:45:18 +01:00
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
|
|
|
.exit:
|
2010-01-05 02:28:11 +01:00
|
|
|
ret
|
2012-03-08 14:45:18 +01:00
|
|
|
;------------------------------------------------------------------------------
|
2010-01-05 02:28:11 +01:00
|
|
|
align 4
|
|
|
|
syscall_display_settings.01:
|
|
|
|
and ecx, 1
|
|
|
|
cmp ecx, [buttontype]
|
|
|
|
je .exit
|
|
|
|
mov [buttontype], ecx
|
|
|
|
mov [windowtypechanged], ebx
|
2012-03-08 14:45:18 +01:00
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
2010-01-05 02:28:11 +01:00
|
|
|
.exit:
|
|
|
|
ret
|
2012-03-08 14:45:18 +01:00
|
|
|
;------------------------------------------------------------------------------
|
2010-01-05 02:28:11 +01:00
|
|
|
align 4
|
|
|
|
syscall_display_settings.02:
|
|
|
|
dec ebx
|
|
|
|
mov esi, ecx
|
2014-04-08 09:40:38 +02:00
|
|
|
cmp edx, 192
|
|
|
|
jnae @f
|
|
|
|
mov edx, 192 ; max size
|
|
|
|
@@:
|
2010-01-05 02:28:11 +01:00
|
|
|
mov edi, common_colours
|
|
|
|
mov ecx, edx
|
2011-10-14 23:38:50 +02:00
|
|
|
rep movsb
|
2010-01-05 02:28:11 +01:00
|
|
|
mov [windowtypechanged], ebx
|
|
|
|
ret
|
2012-03-08 14:45:18 +01:00
|
|
|
;------------------------------------------------------------------------------
|
2010-01-05 02:28:11 +01:00
|
|
|
align 4
|
|
|
|
syscall_display_settings.03:
|
|
|
|
mov edi, ecx
|
2014-04-08 09:40:38 +02:00
|
|
|
cmp edx, 192
|
|
|
|
jnae @f
|
|
|
|
mov edx, 192 ; max size
|
|
|
|
@@:
|
2010-01-05 02:28:11 +01:00
|
|
|
mov esi, common_colours
|
|
|
|
mov ecx, edx
|
2011-10-14 23:38:50 +02:00
|
|
|
rep movsb
|
2010-01-05 02:28:11 +01:00
|
|
|
ret
|
2012-03-08 14:45:18 +01:00
|
|
|
;------------------------------------------------------------------------------
|
2010-01-05 02:28:11 +01:00
|
|
|
align 4
|
|
|
|
syscall_display_settings.04:
|
|
|
|
mov eax, [_skinh]
|
|
|
|
mov [esp + 32], eax
|
|
|
|
ret
|
2012-03-08 14:45:18 +01:00
|
|
|
;------------------------------------------------------------------------------
|
2010-01-05 02:28:11 +01:00
|
|
|
align 4
|
|
|
|
syscall_display_settings.05:
|
|
|
|
mov eax, [screen_workarea.left - 2]
|
|
|
|
mov ax, word[screen_workarea.right]
|
|
|
|
mov [esp + 32], eax
|
|
|
|
mov eax, [screen_workarea.top - 2]
|
|
|
|
mov ax, word[screen_workarea.bottom]
|
|
|
|
mov [esp + 20], eax
|
|
|
|
ret
|
2012-03-08 14:45:18 +01:00
|
|
|
;------------------------------------------------------------------------------
|
2010-01-05 02:28:11 +01:00
|
|
|
align 4
|
|
|
|
syscall_display_settings.06:
|
|
|
|
xor esi, esi
|
|
|
|
|
2015-01-05 18:18:45 +01:00
|
|
|
mov edi, [_display.width]
|
|
|
|
dec edi
|
2010-01-05 02:28:11 +01:00
|
|
|
mov eax, ecx
|
|
|
|
movsx ebx, ax
|
|
|
|
sar eax, 16
|
|
|
|
cmp eax, ebx
|
|
|
|
jge .check_horizontal
|
|
|
|
inc esi
|
|
|
|
or eax, eax
|
|
|
|
jge @f
|
|
|
|
xor eax, eax
|
2012-03-08 14:45:18 +01:00
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
|
|
|
@@:
|
2011-10-14 23:38:50 +02:00
|
|
|
mov [screen_workarea.left], eax
|
2010-01-05 02:28:11 +01:00
|
|
|
cmp ebx, edi
|
|
|
|
jle @f
|
|
|
|
mov ebx, edi
|
2012-03-08 14:45:18 +01:00
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
|
|
|
@@:
|
2011-10-14 23:38:50 +02:00
|
|
|
mov [screen_workarea.right], ebx
|
2012-03-08 14:45:18 +01:00
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
|
|
|
.check_horizontal:
|
2015-01-05 18:18:45 +01:00
|
|
|
mov edi, [_display.height]
|
|
|
|
dec edi
|
2010-01-05 02:28:11 +01:00
|
|
|
mov eax, edx
|
|
|
|
movsx ebx, ax
|
|
|
|
sar eax, 16
|
|
|
|
cmp eax, ebx
|
|
|
|
jge .check_if_redraw_needed
|
|
|
|
inc esi
|
|
|
|
or eax, eax
|
|
|
|
jge @f
|
|
|
|
xor eax, eax
|
2012-03-08 14:45:18 +01:00
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
|
|
|
@@:
|
2011-10-14 23:38:50 +02:00
|
|
|
mov [screen_workarea.top], eax
|
2010-01-05 02:28:11 +01:00
|
|
|
cmp ebx, edi
|
|
|
|
jle @f
|
|
|
|
mov ebx, edi
|
2012-03-08 14:45:18 +01:00
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
|
|
|
@@:
|
2011-10-14 23:38:50 +02:00
|
|
|
mov [screen_workarea.bottom], ebx
|
2012-03-08 14:45:18 +01:00
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
|
|
|
.check_if_redraw_needed:
|
2010-01-05 02:28:11 +01:00
|
|
|
or esi, esi
|
|
|
|
jz .exit
|
|
|
|
|
|
|
|
call repos_windows
|
|
|
|
jmp syscall_display_settings._.calculate_whole_screen
|
2012-03-08 14:45:18 +01:00
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
|
|
|
.exit:
|
2010-01-05 02:28:11 +01:00
|
|
|
ret
|
2012-03-08 14:45:18 +01:00
|
|
|
;------------------------------------------------------------------------------
|
2010-01-05 02:28:11 +01:00
|
|
|
align 4
|
|
|
|
syscall_display_settings.07:
|
|
|
|
mov eax, [_skinmargins + 0]
|
|
|
|
mov [esp + 32], eax
|
|
|
|
mov eax, [_skinmargins + 4]
|
|
|
|
mov [esp + 20], eax
|
|
|
|
ret
|
2012-03-08 14:45:18 +01:00
|
|
|
;------------------------------------------------------------------------------
|
2010-01-05 02:28:11 +01:00
|
|
|
align 4
|
|
|
|
syscall_display_settings.08:
|
|
|
|
mov ebx, ecx
|
|
|
|
call read_skin_file
|
|
|
|
mov [esp + 32], eax
|
|
|
|
test eax, eax
|
|
|
|
jnz .exit
|
|
|
|
|
|
|
|
call syscall_display_settings._.calculate_whole_screen
|
|
|
|
jmp syscall_display_settings._.redraw_whole_screen
|
2012-03-08 14:45:18 +01:00
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
|
|
|
.exit:
|
2010-01-05 02:28:11 +01:00
|
|
|
ret
|
2012-03-08 14:45:18 +01:00
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
align 4
|
2015-08-03 14:38:30 +02:00
|
|
|
syscall_display_settings.09:
|
|
|
|
mov [fontSmoothing], cl
|
|
|
|
ret
|
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
align 4
|
2010-01-05 02:28:11 +01:00
|
|
|
syscall_display_settings._.calculate_whole_screen:
|
|
|
|
xor eax, eax
|
|
|
|
xor ebx, ebx
|
2015-01-05 18:18:45 +01:00
|
|
|
mov ecx, [_display.width]
|
|
|
|
mov edx, [_display.height]
|
|
|
|
dec ecx
|
|
|
|
dec edx
|
2010-01-05 02:28:11 +01:00
|
|
|
jmp calculatescreen
|
2012-03-08 14:45:18 +01:00
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
align 4
|
2010-01-05 02:28:11 +01:00
|
|
|
syscall_display_settings._.redraw_whole_screen:
|
|
|
|
xor eax, eax
|
|
|
|
mov [draw_limits.left], eax
|
|
|
|
mov [draw_limits.top], eax
|
2015-01-05 18:18:45 +01:00
|
|
|
mov eax, [_display.width]
|
|
|
|
dec eax
|
2010-01-05 02:28:11 +01:00
|
|
|
mov [draw_limits.right], eax
|
2015-01-05 18:18:45 +01:00
|
|
|
mov eax, [_display.height]
|
|
|
|
dec eax
|
2010-01-05 02:28:11 +01:00
|
|
|
mov [draw_limits.bottom], eax
|
|
|
|
mov eax, window_data
|
|
|
|
jmp redrawscreen
|
2012-03-08 14:45:18 +01:00
|
|
|
;------------------------------------------------------------------------------
|
2010-01-05 02:28:11 +01:00
|
|
|
align 4
|
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
syscall_set_window_shape: ;///// system function 50 ///////////////////////////
|
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
;; Set window shape address:
|
2010-01-08 13:39:50 +01:00
|
|
|
;> ebx = 0
|
|
|
|
;> ecx = shape data address
|
2010-01-05 02:28:11 +01:00
|
|
|
; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
;; Set window shape scale:
|
2010-01-08 13:39:50 +01:00
|
|
|
;> ebx = 1
|
|
|
|
;> ecx = scale power (resulting scale is 2^ebx)
|
2010-01-05 02:28:11 +01:00
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
mov edi, [current_slot]
|
|
|
|
|
2010-01-08 13:39:50 +01:00
|
|
|
test ebx, ebx
|
2010-01-05 02:28:11 +01:00
|
|
|
jne .shape_scale
|
2010-01-08 13:39:50 +01:00
|
|
|
mov [edi + APPDATA.wnd_shape], ecx
|
2012-03-08 14:45:18 +01:00
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
|
|
|
.shape_scale:
|
2010-01-08 13:39:50 +01:00
|
|
|
dec ebx
|
2010-01-05 02:28:11 +01:00
|
|
|
jnz .exit
|
2010-01-08 13:39:50 +01:00
|
|
|
mov [edi + APPDATA.wnd_shape_scale], ecx
|
2012-03-08 14:45:18 +01:00
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
|
|
|
.exit:
|
2010-01-05 02:28:11 +01:00
|
|
|
ret
|
2012-03-08 14:45:18 +01:00
|
|
|
;------------------------------------------------------------------------------
|
2010-02-06 20:08:19 +01:00
|
|
|
align 4
|
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
syscall_move_window: ;///// system function 67 ////////////////////////////////
|
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
;? <description>
|
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
mov edi, [CURRENT_TASK]
|
|
|
|
shl edi, 5
|
|
|
|
add edi, window_data
|
|
|
|
|
2010-08-08 23:43:40 +02:00
|
|
|
test [edi + WDATA.fl_wdrawn], 1
|
|
|
|
jz .exit
|
|
|
|
|
2010-02-06 20:08:19 +01:00
|
|
|
test [edi + WDATA.fl_wstate], WSTATE_MAXIMIZED
|
|
|
|
jnz .exit
|
|
|
|
|
|
|
|
cmp ebx, -1
|
|
|
|
jne @f
|
|
|
|
mov ebx, [edi + WDATA.box.left]
|
2012-03-08 14:45:18 +01:00
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
|
|
|
@@:
|
2011-10-14 23:38:50 +02:00
|
|
|
cmp ecx, -1
|
2010-02-06 20:08:19 +01:00
|
|
|
jne @f
|
|
|
|
mov ecx, [edi + WDATA.box.top]
|
2012-03-08 14:45:18 +01:00
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
|
|
|
@@:
|
2011-10-14 23:38:50 +02:00
|
|
|
cmp edx, -1
|
2010-02-06 20:08:19 +01:00
|
|
|
jne @f
|
|
|
|
mov edx, [edi + WDATA.box.width]
|
2012-03-08 14:45:18 +01:00
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
|
|
|
@@:
|
2011-10-14 23:38:50 +02:00
|
|
|
cmp esi, -1
|
2010-02-06 20:08:19 +01:00
|
|
|
jne @f
|
|
|
|
mov esi, [edi + WDATA.box.height]
|
2012-03-08 14:45:18 +01:00
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
|
|
|
@@:
|
2011-10-14 23:38:50 +02:00
|
|
|
push esi edx ecx ebx
|
2010-02-06 20:08:19 +01:00
|
|
|
mov eax, esp
|
|
|
|
mov bl, [edi + WDATA.fl_wstate]
|
2013-04-06 00:16:17 +02:00
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
|
|
|
@@:
|
|
|
|
cmp [REDRAW_BACKGROUND], byte 0
|
|
|
|
jz @f
|
|
|
|
call change_task
|
|
|
|
jmp @b
|
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
|
|
|
@@:
|
2010-02-06 20:08:19 +01:00
|
|
|
call window._.set_window_box
|
2012-02-22 16:46:09 +01:00
|
|
|
add esp, sizeof.BOX
|
2010-02-06 20:08:19 +01:00
|
|
|
|
|
|
|
; NOTE: do we really need this? to be reworked
|
|
|
|
; mov byte[DONT_DRAW_MOUSE], 0 ; mouse pointer
|
|
|
|
; mov byte[MOUSE_BACKGROUND], 0 ; no mouse under
|
|
|
|
; mov byte[MOUSE_DOWN], 0 ; react to mouse up/down
|
|
|
|
|
|
|
|
; NOTE: do we really need this? to be reworked
|
|
|
|
; call [draw_pointer]
|
2012-03-08 14:45:18 +01:00
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
|
|
|
.exit:
|
2010-02-06 20:08:19 +01:00
|
|
|
ret
|
2012-03-08 14:45:18 +01:00
|
|
|
;------------------------------------------------------------------------------
|
2010-02-06 20:08:19 +01:00
|
|
|
align 4
|
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
syscall_window_settings: ;///// system function 71 /////////////////////////////
|
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
;? <description>
|
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
dec ebx ; subfunction #1 - set window caption
|
|
|
|
jnz .exit_fail
|
|
|
|
|
|
|
|
; NOTE: only window owner thread can set its caption,
|
|
|
|
; so there's no parameter for PID/TID
|
|
|
|
|
|
|
|
mov edi, [CURRENT_TASK]
|
|
|
|
shl edi, 5
|
|
|
|
|
|
|
|
mov [edi * 8 + SLOT_BASE + APPDATA.wnd_caption], ecx
|
|
|
|
or [edi + window_data + WDATA.fl_wstyle], WSTYLE_HASCAPTION
|
|
|
|
|
|
|
|
call window._.draw_window_caption
|
|
|
|
|
|
|
|
xor eax, eax ; eax = 0 (success)
|
|
|
|
ret
|
|
|
|
|
|
|
|
; .get_window_caption:
|
|
|
|
; dec eax ; subfunction #2 - get window caption
|
|
|
|
; jnz .exit_fail
|
|
|
|
|
|
|
|
; not implemented yet
|
2012-03-08 14:45:18 +01:00
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
|
|
|
.exit_fail:
|
2010-02-06 20:08:19 +01:00
|
|
|
xor eax, eax
|
|
|
|
inc eax ; eax = 1 (fail)
|
|
|
|
ret
|
2012-03-08 14:45:18 +01:00
|
|
|
;------------------------------------------------------------------------------
|
2010-01-05 02:28:11 +01:00
|
|
|
align 4
|
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
set_window_defaults: ;/////////////////////////////////////////////////////////
|
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
;? <description>
|
|
|
|
;------------------------------------------------------------------------------
|
2010-07-30 23:38:08 +02:00
|
|
|
mov byte [window_data + 0x20 + WDATA.cl_titlebar + 3], 1 ; desktop is not movable
|
2010-01-05 02:28:11 +01:00
|
|
|
push eax ecx
|
|
|
|
xor eax, eax
|
|
|
|
mov ecx, WIN_STACK
|
2012-03-08 14:45:18 +01:00
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
|
|
|
@@:
|
2011-10-14 23:38:50 +02:00
|
|
|
inc eax
|
2010-01-05 02:28:11 +01:00
|
|
|
add ecx, 2
|
|
|
|
; process no
|
|
|
|
mov [ecx + 0x000], ax
|
|
|
|
; positions in stack
|
|
|
|
mov [ecx + 0x400], ax
|
|
|
|
cmp ecx, WIN_POS - 2
|
|
|
|
jne @b
|
|
|
|
pop ecx eax
|
|
|
|
ret
|
2012-03-08 14:45:18 +01:00
|
|
|
;------------------------------------------------------------------------------
|
2010-01-05 02:28:11 +01:00
|
|
|
align 4
|
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
calculatescreen: ;/////////////////////////////////////////////////////////////
|
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
;? Scan all windows from bottom to top, calling `setscreen` for each one
|
|
|
|
;? intersecting given screen area
|
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
;> eax = left
|
|
|
|
;> ebx = top
|
|
|
|
;> ecx = right
|
|
|
|
;> edx = bottom
|
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
push esi
|
|
|
|
pushfd
|
|
|
|
cli
|
|
|
|
|
|
|
|
mov esi, 1
|
|
|
|
call window._.set_screen
|
|
|
|
|
|
|
|
push ebp
|
|
|
|
|
|
|
|
mov ebp, [TASK_COUNT]
|
|
|
|
cmp ebp, 1
|
|
|
|
jbe .exit
|
|
|
|
|
|
|
|
push edx ecx ebx eax
|
2012-03-08 14:45:18 +01:00
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
|
|
|
.next_window:
|
2010-01-05 02:28:11 +01:00
|
|
|
movzx edi, word[WIN_POS + esi * 2]
|
|
|
|
shl edi, 5
|
|
|
|
|
|
|
|
cmp [CURRENT_TASK + edi + TASKDATA.state], TSTATE_FREE
|
|
|
|
je .skip_window
|
|
|
|
|
|
|
|
add edi, window_data
|
|
|
|
test [edi + WDATA.fl_wstate], WSTATE_MINIMIZED
|
|
|
|
jnz .skip_window
|
|
|
|
|
|
|
|
mov eax, [edi + WDATA.box.left]
|
|
|
|
cmp eax, [esp + RECT.right]
|
2010-01-08 13:20:53 +01:00
|
|
|
jg .skip_window
|
2010-01-05 02:28:11 +01:00
|
|
|
mov ebx, [edi + WDATA.box.top]
|
|
|
|
cmp ebx, [esp + RECT.bottom]
|
2010-01-08 13:20:53 +01:00
|
|
|
jg .skip_window
|
2010-01-05 02:28:11 +01:00
|
|
|
mov ecx, [edi + WDATA.box.width]
|
|
|
|
add ecx, eax
|
|
|
|
cmp ecx, [esp + RECT.left]
|
2010-01-08 13:20:53 +01:00
|
|
|
jl .skip_window
|
2010-01-05 02:28:11 +01:00
|
|
|
mov edx, [edi + WDATA.box.height]
|
|
|
|
add edx, ebx
|
|
|
|
cmp edx, [esp + RECT.top]
|
2010-01-08 13:20:53 +01:00
|
|
|
jl .skip_window
|
2010-01-05 02:28:11 +01:00
|
|
|
|
|
|
|
cmp eax, [esp + RECT.left]
|
|
|
|
jae @f
|
|
|
|
mov eax, [esp + RECT.left]
|
2012-03-08 14:45:18 +01:00
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
|
|
|
@@:
|
2011-10-14 23:38:50 +02:00
|
|
|
cmp ebx, [esp + RECT.top]
|
2010-01-05 02:28:11 +01:00
|
|
|
jae @f
|
|
|
|
mov ebx, [esp + RECT.top]
|
2012-03-08 14:45:18 +01:00
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
|
|
|
@@:
|
2011-10-14 23:38:50 +02:00
|
|
|
cmp ecx, [esp + RECT.right]
|
2010-01-05 02:28:11 +01:00
|
|
|
jbe @f
|
|
|
|
mov ecx, [esp + RECT.right]
|
2012-03-08 14:45:18 +01:00
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
|
|
|
@@:
|
2011-10-14 23:38:50 +02:00
|
|
|
cmp edx, [esp + RECT.bottom]
|
2010-01-05 02:28:11 +01:00
|
|
|
jbe @f
|
|
|
|
mov edx, [esp + RECT.bottom]
|
2012-03-08 14:45:18 +01:00
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
|
|
|
@@:
|
2011-10-14 23:38:50 +02:00
|
|
|
push esi
|
2010-01-05 02:28:11 +01:00
|
|
|
movzx esi, word[WIN_POS + esi * 2]
|
|
|
|
call window._.set_screen
|
|
|
|
pop esi
|
2012-03-08 14:45:18 +01:00
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
|
|
|
.skip_window:
|
2010-01-05 02:28:11 +01:00
|
|
|
inc esi
|
|
|
|
dec ebp
|
|
|
|
jnz .next_window
|
|
|
|
|
|
|
|
pop eax ebx ecx edx
|
2012-03-08 14:45:18 +01:00
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
|
|
|
.exit:
|
2010-01-05 02:28:11 +01:00
|
|
|
pop ebp
|
2012-03-09 16:50:49 +01:00
|
|
|
inc [_display.mask_seqno]
|
2010-01-05 02:28:11 +01:00
|
|
|
popfd
|
|
|
|
pop esi
|
|
|
|
ret
|
2012-03-08 14:45:18 +01:00
|
|
|
;------------------------------------------------------------------------------
|
2010-01-05 02:28:11 +01:00
|
|
|
align 4
|
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
repos_windows: ;///////////////////////////////////////////////////////////////
|
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
;? <description>
|
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
mov ecx, [TASK_COUNT]
|
2012-02-22 16:46:09 +01:00
|
|
|
mov edi, window_data + sizeof.WDATA * 2
|
2010-01-05 02:28:11 +01:00
|
|
|
call force_redraw_background
|
|
|
|
dec ecx
|
|
|
|
jle .exit
|
2012-03-08 14:45:18 +01:00
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
|
|
|
.next_window:
|
2010-01-05 02:28:11 +01:00
|
|
|
mov [edi + WDATA.fl_redraw], 1
|
|
|
|
test [edi + WDATA.fl_wstate], WSTATE_MAXIMIZED
|
|
|
|
jnz .fix_maximized
|
|
|
|
|
|
|
|
mov eax, [edi + WDATA.box.left]
|
|
|
|
add eax, [edi + WDATA.box.width]
|
2015-01-05 18:18:45 +01:00
|
|
|
mov ebx, [_display.width]
|
2010-01-05 02:28:11 +01:00
|
|
|
cmp eax, ebx
|
2015-01-05 18:18:45 +01:00
|
|
|
jl .fix_vertical
|
2010-01-05 02:28:11 +01:00
|
|
|
mov eax, [edi + WDATA.box.width]
|
|
|
|
sub eax, ebx
|
2015-01-05 18:18:45 +01:00
|
|
|
jl @f
|
2010-01-05 02:28:11 +01:00
|
|
|
mov [edi + WDATA.box.width], ebx
|
2012-03-08 14:45:18 +01:00
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
|
|
|
@@:
|
2011-10-14 23:38:50 +02:00
|
|
|
sub ebx, [edi + WDATA.box.width]
|
2010-01-05 02:28:11 +01:00
|
|
|
mov [edi + WDATA.box.left], ebx
|
2012-03-08 14:45:18 +01:00
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
|
|
|
.fix_vertical:
|
2010-01-05 02:28:11 +01:00
|
|
|
mov eax, [edi + WDATA.box.top]
|
|
|
|
add eax, [edi + WDATA.box.height]
|
2015-01-05 18:18:45 +01:00
|
|
|
mov ebx, [_display.height]
|
2010-01-05 02:28:11 +01:00
|
|
|
cmp eax, ebx
|
2015-01-05 18:18:45 +01:00
|
|
|
jl .fix_client_box
|
2010-01-05 02:28:11 +01:00
|
|
|
mov eax, [edi + WDATA.box.height]
|
|
|
|
sub eax, ebx
|
2015-01-05 18:18:45 +01:00
|
|
|
jl @f
|
2010-01-05 02:28:11 +01:00
|
|
|
mov [edi + WDATA.box.height], ebx
|
2012-03-08 14:45:18 +01:00
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
|
|
|
@@:
|
2011-10-14 23:38:50 +02:00
|
|
|
sub ebx, [edi + WDATA.box.height]
|
2010-01-05 02:28:11 +01:00
|
|
|
mov [edi + WDATA.box.top], ebx
|
2012-03-08 14:45:18 +01:00
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
|
|
|
.fix_client_box:
|
|
|
|
call window._.set_window_clientbox
|
|
|
|
add edi, sizeof.WDATA
|
|
|
|
loop .next_window
|
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
|
|
|
.exit:
|
|
|
|
ret
|
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
|
|
|
.fix_maximized:
|
2010-01-05 02:28:11 +01:00
|
|
|
mov eax, [screen_workarea.left]
|
|
|
|
mov [edi + WDATA.box.left], eax
|
|
|
|
sub eax, [screen_workarea.right]
|
|
|
|
neg eax
|
|
|
|
mov [edi + WDATA.box.width], eax
|
|
|
|
mov eax, [screen_workarea.top]
|
|
|
|
mov [edi + WDATA.box.top], eax
|
|
|
|
test [edi + WDATA.fl_wstate], WSTATE_ROLLEDUP
|
|
|
|
jnz .fix_client_box
|
|
|
|
sub eax, [screen_workarea.bottom]
|
|
|
|
neg eax
|
|
|
|
mov [edi + WDATA.box.height], eax
|
2012-03-08 14:45:18 +01:00
|
|
|
jmp .fix_client_box
|
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
;align 4
|
2010-01-05 02:28:11 +01:00
|
|
|
;------------------------------------------------------------------------------
|
2012-03-08 14:45:18 +01:00
|
|
|
;sys_window_mouse: ;////////////////////////////////////////////////////////////
|
2010-01-05 02:28:11 +01:00
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
;? <description>
|
|
|
|
;------------------------------------------------------------------------------
|
2010-02-06 20:08:19 +01:00
|
|
|
; NOTE: commented out since doesn't provide necessary functionality
|
|
|
|
; anyway, to be reworked
|
|
|
|
; push eax
|
|
|
|
;
|
|
|
|
; mov eax, [timer_ticks]
|
|
|
|
; cmp [new_window_starting], eax
|
|
|
|
; jb .exit
|
|
|
|
;
|
|
|
|
; mov byte[MOUSE_BACKGROUND], 0
|
|
|
|
; mov byte[DONT_DRAW_MOUSE], 0
|
|
|
|
;
|
|
|
|
; mov [new_window_starting], eax
|
|
|
|
;
|
|
|
|
; .exit:
|
|
|
|
; pop eax
|
2012-03-08 14:45:18 +01:00
|
|
|
; ret
|
|
|
|
;------------------------------------------------------------------------------
|
2010-01-05 02:28:11 +01:00
|
|
|
align 4
|
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
draw_rectangle: ;//////////////////////////////////////////////////////////////
|
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
;> eax = pack[16(left), 16(right)]
|
|
|
|
;> ebx = pack[16(top), 16(bottom)]
|
|
|
|
;> esi = color
|
2012-03-01 00:03:13 +01:00
|
|
|
; ?? RR GG BB ; 0x01000000 negation
|
|
|
|
; ; 0x02000000 used for draw_rectangle without top line
|
|
|
|
; ; for example drawwindow_III and drawwindow_IV
|
2010-01-05 02:28:11 +01:00
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
push eax ebx ecx edi
|
|
|
|
|
|
|
|
xor edi, edi
|
2012-03-08 14:45:18 +01:00
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
|
|
|
.flags_set:
|
2010-01-05 02:28:11 +01:00
|
|
|
push ebx
|
|
|
|
|
|
|
|
; set line color
|
|
|
|
mov ecx, esi
|
|
|
|
; draw top border
|
|
|
|
rol ebx, 16
|
|
|
|
push ebx
|
|
|
|
rol ebx, 16
|
|
|
|
pop bx
|
2012-03-01 00:03:13 +01:00
|
|
|
test ecx, 1 shl 25
|
|
|
|
jnz @f
|
|
|
|
sub ecx, 1 shl 25
|
2012-03-12 19:26:37 +01:00
|
|
|
; call [draw_line]
|
|
|
|
call __sys_draw_line
|
2012-03-08 14:45:18 +01:00
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
2012-03-01 00:03:13 +01:00
|
|
|
@@:
|
2010-01-05 02:28:11 +01:00
|
|
|
; draw bottom border
|
|
|
|
mov ebx, [esp - 2]
|
|
|
|
pop bx
|
2012-03-12 19:26:37 +01:00
|
|
|
; call [draw_line]
|
|
|
|
call __sys_draw_line
|
2010-01-05 02:28:11 +01:00
|
|
|
|
|
|
|
pop ebx
|
|
|
|
add ebx, 1 * 65536 - 1
|
|
|
|
|
|
|
|
; draw left border
|
|
|
|
rol eax, 16
|
|
|
|
push eax
|
|
|
|
rol eax, 16
|
|
|
|
pop ax
|
2012-03-12 19:26:37 +01:00
|
|
|
; call [draw_line]
|
|
|
|
call __sys_draw_line
|
2010-01-05 02:28:11 +01:00
|
|
|
|
|
|
|
; draw right border
|
|
|
|
mov eax, [esp - 2]
|
|
|
|
pop ax
|
2012-03-12 19:26:37 +01:00
|
|
|
; call [draw_line]
|
|
|
|
call __sys_draw_line
|
2010-01-05 02:28:11 +01:00
|
|
|
|
|
|
|
pop edi ecx ebx eax
|
|
|
|
ret
|
2012-03-08 14:45:18 +01:00
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
|
|
|
.forced:
|
2010-01-05 02:28:11 +01:00
|
|
|
push eax ebx ecx edi
|
|
|
|
xor edi, edi
|
|
|
|
inc edi
|
|
|
|
jmp .flags_set
|
2012-03-08 14:45:18 +01:00
|
|
|
;------------------------------------------------------------------------------
|
2010-01-05 02:28:11 +01:00
|
|
|
align 4
|
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
drawwindow_I_caption: ;////////////////////////////////////////////////////////
|
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
;? <description>
|
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
push [edx + WDATA.cl_titlebar]
|
|
|
|
mov esi, edx
|
|
|
|
|
|
|
|
mov edx, [esi + WDATA.box.top]
|
|
|
|
mov eax, edx
|
|
|
|
lea ebx, [edx + 21]
|
|
|
|
inc edx
|
|
|
|
add eax, [esi + WDATA.box.height]
|
|
|
|
|
|
|
|
cmp ebx, eax
|
|
|
|
jbe @f
|
|
|
|
mov ebx, eax
|
2012-03-08 14:45:18 +01:00
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
|
|
|
@@:
|
2011-10-14 23:38:50 +02:00
|
|
|
push ebx
|
2010-01-05 02:28:11 +01:00
|
|
|
|
|
|
|
xor edi, edi
|
2012-03-08 14:45:18 +01:00
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
|
|
|
.next_line:
|
2010-01-05 02:28:11 +01:00
|
|
|
mov ebx, edx
|
|
|
|
shl ebx, 16
|
|
|
|
add ebx, edx
|
|
|
|
mov eax, [esi + WDATA.box.left]
|
|
|
|
inc eax
|
|
|
|
shl eax, 16
|
|
|
|
add eax, [esi + WDATA.box.left]
|
|
|
|
add eax, [esi + WDATA.box.width]
|
|
|
|
dec eax
|
|
|
|
mov ecx, [esi + WDATA.cl_titlebar]
|
|
|
|
test ecx, 0x80000000
|
|
|
|
jz @f
|
|
|
|
sub ecx, 0x00040404
|
|
|
|
mov [esi + WDATA.cl_titlebar], ecx
|
2012-03-08 14:45:18 +01:00
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
|
|
|
@@:
|
2011-10-14 23:38:50 +02:00
|
|
|
and ecx, 0x00ffffff
|
2012-03-12 19:26:37 +01:00
|
|
|
; call [draw_line]
|
|
|
|
call __sys_draw_line
|
2010-01-05 02:28:11 +01:00
|
|
|
inc edx
|
|
|
|
cmp edx, [esp]
|
|
|
|
jb .next_line
|
|
|
|
|
|
|
|
add esp, 4
|
|
|
|
pop [esi + WDATA.cl_titlebar]
|
|
|
|
ret
|
2012-03-08 14:45:18 +01:00
|
|
|
;------------------------------------------------------------------------------
|
2010-01-05 02:28:11 +01:00
|
|
|
align 4
|
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
drawwindow_I: ;////////////////////////////////////////////////////////////////
|
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
;? <description>
|
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
pushad
|
|
|
|
|
|
|
|
; window border
|
|
|
|
|
|
|
|
mov eax, [edx + WDATA.box.left - 2]
|
|
|
|
mov ax, word[edx + WDATA.box.left]
|
|
|
|
add ax, word[edx + WDATA.box.width]
|
|
|
|
mov ebx, [edx + WDATA.box.top - 2]
|
|
|
|
mov bx, word[edx + WDATA.box.top]
|
|
|
|
add bx, word[edx + WDATA.box.height]
|
|
|
|
|
|
|
|
mov esi, [edx + WDATA.cl_frames]
|
|
|
|
call draw_rectangle
|
|
|
|
|
|
|
|
; window caption
|
|
|
|
|
|
|
|
call drawwindow_I_caption
|
|
|
|
|
|
|
|
; window client area
|
|
|
|
|
|
|
|
; do we need to draw it?
|
|
|
|
mov edi, [esi + WDATA.cl_workarea]
|
|
|
|
test edi, 0x40000000
|
|
|
|
jnz .exit
|
|
|
|
|
|
|
|
; does client area have a positive size on screen?
|
2014-02-18 18:49:35 +01:00
|
|
|
cmp [esi + WDATA.box.height], 21
|
|
|
|
jle .exit
|
2010-01-05 02:28:11 +01:00
|
|
|
|
|
|
|
; okay, let's draw it
|
|
|
|
mov eax, 1
|
|
|
|
mov ebx, 21
|
|
|
|
mov ecx, [esi + WDATA.box.width]
|
|
|
|
mov edx, [esi + WDATA.box.height]
|
2012-03-12 19:26:37 +01:00
|
|
|
; call [drawbar]
|
|
|
|
call vesa20_drawbar
|
2012-03-08 14:45:18 +01:00
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
|
|
|
.exit:
|
2010-01-05 02:28:11 +01:00
|
|
|
popad
|
|
|
|
ret
|
2012-03-08 14:45:18 +01:00
|
|
|
;------------------------------------------------------------------------------
|
2010-01-05 02:28:11 +01:00
|
|
|
align 4
|
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
drawwindow_III_caption: ;/////////////////////////////////////////////////////
|
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
;? <description>
|
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
mov ecx, [edx + WDATA.cl_titlebar]
|
|
|
|
push ecx
|
|
|
|
mov esi, edx
|
|
|
|
mov edx, [esi + WDATA.box.top]
|
|
|
|
add edx, 4
|
|
|
|
mov ebx, [esi + WDATA.box.top]
|
|
|
|
add ebx, 20
|
|
|
|
mov eax, [esi + WDATA.box.top]
|
|
|
|
add eax, [esi + WDATA.box.height]
|
|
|
|
|
|
|
|
cmp ebx, eax
|
|
|
|
jb @f
|
|
|
|
mov ebx, eax
|
2012-03-08 14:45:18 +01:00
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
|
|
|
@@:
|
2011-10-14 23:38:50 +02:00
|
|
|
push ebx
|
2010-01-05 02:28:11 +01:00
|
|
|
|
|
|
|
xor edi, edi
|
2012-03-08 14:45:18 +01:00
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
|
|
|
.next_line:
|
2010-01-05 02:28:11 +01:00
|
|
|
mov ebx, edx
|
|
|
|
shl ebx, 16
|
|
|
|
add ebx, edx
|
|
|
|
mov eax, [esi + WDATA.box.left]
|
|
|
|
shl eax, 16
|
|
|
|
add eax, [esi + WDATA.box.left]
|
|
|
|
add eax, [esi + WDATA.box.width]
|
|
|
|
add eax, 4 * 65536 - 4
|
|
|
|
mov ecx, [esi + WDATA.cl_titlebar]
|
|
|
|
test ecx, 0x40000000
|
|
|
|
jz @f
|
|
|
|
add ecx, 0x00040404
|
2012-03-08 14:45:18 +01:00
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
|
|
|
@@:
|
2011-10-14 23:38:50 +02:00
|
|
|
test ecx, 0x80000000
|
2010-01-05 02:28:11 +01:00
|
|
|
jz @f
|
|
|
|
sub ecx, 0x00040404
|
2012-03-08 14:45:18 +01:00
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
|
|
|
@@:
|
2011-10-14 23:38:50 +02:00
|
|
|
mov [esi + WDATA.cl_titlebar], ecx
|
2010-01-05 02:28:11 +01:00
|
|
|
and ecx, 0x00ffffff
|
2012-03-12 19:26:37 +01:00
|
|
|
; call [draw_line]
|
|
|
|
call __sys_draw_line
|
2010-01-05 02:28:11 +01:00
|
|
|
inc edx
|
|
|
|
cmp edx, [esp]
|
|
|
|
jb .next_line
|
|
|
|
|
|
|
|
add esp, 4
|
|
|
|
pop [esi + WDATA.cl_titlebar]
|
|
|
|
ret
|
2012-03-08 14:45:18 +01:00
|
|
|
;------------------------------------------------------------------------------
|
2010-01-05 02:28:11 +01:00
|
|
|
align 4
|
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
drawwindow_III: ;//////////////////////////////////////////////////////////////
|
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
;? <description>
|
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
pushad
|
|
|
|
|
|
|
|
; window border
|
|
|
|
|
|
|
|
mov eax, [edx + WDATA.box.left - 2]
|
|
|
|
mov ax, word[edx + WDATA.box.left]
|
|
|
|
add ax, word[edx + WDATA.box.width]
|
|
|
|
mov ebx, [edx + WDATA.box.top - 2]
|
|
|
|
mov bx, word[edx + WDATA.box.top]
|
|
|
|
add bx, word[edx + WDATA.box.height]
|
|
|
|
|
|
|
|
mov esi, [edx + WDATA.cl_frames]
|
|
|
|
shr esi, 1
|
|
|
|
and esi, 0x007f7f7f
|
|
|
|
call draw_rectangle
|
|
|
|
|
|
|
|
push esi
|
|
|
|
mov ecx, 3
|
|
|
|
mov esi, [edx + WDATA.cl_frames]
|
2012-03-08 14:45:18 +01:00
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
|
|
|
.next_frame:
|
2010-01-05 02:28:11 +01:00
|
|
|
add eax, 1 * 65536 - 1
|
2012-03-14 10:29:38 +01:00
|
|
|
add ebx, 1 * 65536 - 1
|
2010-01-05 02:28:11 +01:00
|
|
|
call draw_rectangle
|
|
|
|
dec ecx
|
|
|
|
jnz .next_frame
|
|
|
|
|
|
|
|
pop esi
|
|
|
|
add eax, 1 * 65536 - 1
|
2012-03-14 10:29:38 +01:00
|
|
|
add ebx, 1 * 65536 - 1
|
2010-01-05 02:28:11 +01:00
|
|
|
call draw_rectangle
|
|
|
|
|
|
|
|
; window caption
|
|
|
|
|
|
|
|
call drawwindow_III_caption
|
|
|
|
|
|
|
|
; window client area
|
|
|
|
|
|
|
|
; do we need to draw it?
|
|
|
|
mov edi, [esi + WDATA.cl_workarea]
|
|
|
|
test edi, 0x40000000
|
|
|
|
jnz .exit
|
|
|
|
|
|
|
|
; does client area have a positive size on screen?
|
|
|
|
mov edx, [esi + WDATA.box.top]
|
|
|
|
add edx, 21 + 5
|
|
|
|
mov ebx, [esi + WDATA.box.top]
|
|
|
|
add ebx, [esi + WDATA.box.height]
|
|
|
|
cmp edx, ebx
|
|
|
|
jg .exit
|
|
|
|
|
|
|
|
; okay, let's draw it
|
|
|
|
mov eax, 5
|
|
|
|
mov ebx, 20
|
|
|
|
mov ecx, [esi + WDATA.box.width]
|
|
|
|
mov edx, [esi + WDATA.box.height]
|
|
|
|
sub ecx, 4
|
|
|
|
sub edx, 4
|
2012-03-12 19:26:37 +01:00
|
|
|
; call [drawbar]
|
|
|
|
call vesa20_drawbar
|
2012-03-08 14:45:18 +01:00
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
|
|
|
.exit:
|
2010-01-05 02:28:11 +01:00
|
|
|
popad
|
|
|
|
ret
|
2012-03-08 14:45:18 +01:00
|
|
|
;------------------------------------------------------------------------------
|
2010-01-05 02:28:11 +01:00
|
|
|
align 4
|
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
waredraw: ;////////////////////////////////////////////////////////////////////
|
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
;? Activate window, redrawing if necessary
|
|
|
|
;------------------------------------------------------------------------------
|
2010-05-24 08:34:12 +02:00
|
|
|
push -1
|
2010-02-06 20:08:19 +01:00
|
|
|
mov eax, [TASK_COUNT]
|
|
|
|
lea eax, [WIN_POS + eax * 2]
|
|
|
|
cmp eax, esi
|
2010-05-24 08:34:12 +02:00
|
|
|
pop eax
|
2010-02-06 20:08:19 +01:00
|
|
|
je .exit
|
|
|
|
|
2010-01-05 02:28:11 +01:00
|
|
|
; is it overlapped by another window now?
|
|
|
|
push ecx
|
|
|
|
call window._.check_window_draw
|
|
|
|
test ecx, ecx
|
|
|
|
pop ecx
|
|
|
|
jz .do_not_draw
|
|
|
|
|
|
|
|
; yes it is, activate and update screen buffer
|
|
|
|
call window._.window_activate
|
|
|
|
|
|
|
|
pushad
|
|
|
|
mov edi, [TASK_COUNT]
|
|
|
|
movzx esi, word[WIN_POS + edi * 2]
|
|
|
|
shl esi, 5
|
|
|
|
add esi, window_data
|
|
|
|
|
|
|
|
mov eax, [esi + WDATA.box.left]
|
|
|
|
mov ebx, [esi + WDATA.box.top]
|
|
|
|
mov ecx, [esi + WDATA.box.width]
|
|
|
|
mov edx, [esi + WDATA.box.height]
|
|
|
|
|
|
|
|
add ecx, eax
|
|
|
|
add edx, ebx
|
|
|
|
|
|
|
|
mov edi, [TASK_COUNT]
|
|
|
|
movzx esi, word[WIN_POS + edi * 2]
|
|
|
|
call window._.set_screen
|
2012-03-09 16:50:49 +01:00
|
|
|
inc [_display.mask_seqno]
|
2010-01-05 02:28:11 +01:00
|
|
|
popad
|
|
|
|
|
|
|
|
; tell application to redraw itself
|
|
|
|
mov [edi + WDATA.fl_redraw], 1
|
2010-02-06 20:08:19 +01:00
|
|
|
xor eax, eax
|
|
|
|
jmp .exit
|
2012-03-08 14:45:18 +01:00
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
|
|
|
.do_not_draw:
|
2010-01-05 02:28:11 +01:00
|
|
|
; no it's not, just activate the window
|
|
|
|
call window._.window_activate
|
2010-02-06 20:08:19 +01:00
|
|
|
xor eax, eax
|
2013-05-30 07:24:54 +02:00
|
|
|
ret
|
|
|
|
|
2012-03-08 14:45:18 +01:00
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
|
|
|
.exit:
|
2010-02-06 20:08:19 +01:00
|
|
|
inc eax
|
2010-01-05 02:28:11 +01:00
|
|
|
ret
|
2012-03-08 14:45:18 +01:00
|
|
|
;------------------------------------------------------------------------------
|
2010-01-05 02:28:11 +01:00
|
|
|
align 4
|
|
|
|
;------------------------------------------------------------------------------
|
2012-04-26 16:21:46 +02:00
|
|
|
minimize_all_window:
|
|
|
|
push ebx ecx edx esi edi
|
|
|
|
pushfd
|
|
|
|
cli
|
|
|
|
xor edx, edx
|
|
|
|
mov eax, 2 ; we do not minimize the kernel thread N1
|
|
|
|
mov ebx, [TASK_COUNT]
|
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
|
|
|
.loop:
|
|
|
|
movzx edi, word[WIN_POS + eax * 2]
|
|
|
|
shl edi, 5
|
|
|
|
; it is a unused slot?
|
|
|
|
cmp dword [edi+CURRENT_TASK+TASKDATA.state], 9
|
|
|
|
je @f
|
|
|
|
; it is a hidden thread?
|
|
|
|
lea esi, [edi*8+SLOT_BASE+APPDATA.app_name]
|
|
|
|
cmp [esi], byte '@'
|
|
|
|
je @f
|
|
|
|
; is it already minimized?
|
|
|
|
test [edi + window_data+WDATA.fl_wstate], WSTATE_MINIMIZED
|
|
|
|
jnz @f
|
|
|
|
; no it's not, let's do that
|
|
|
|
or [edi + window_data+WDATA.fl_wstate], WSTATE_MINIMIZED
|
|
|
|
inc edx
|
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
|
|
|
@@:
|
|
|
|
inc eax
|
|
|
|
cmp eax, ebx
|
|
|
|
jbe .loop
|
|
|
|
; If nothing has changed
|
|
|
|
test edx, edx
|
|
|
|
jz @f
|
|
|
|
|
|
|
|
push edx
|
|
|
|
call syscall_display_settings._.calculate_whole_screen
|
|
|
|
call syscall_display_settings._.redraw_whole_screen
|
|
|
|
pop edx
|
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
|
|
|
@@:
|
|
|
|
mov eax, edx
|
|
|
|
popfd
|
|
|
|
pop edi esi edx ecx ebx
|
|
|
|
ret
|
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
align 4
|
|
|
|
;------------------------------------------------------------------------------
|
2010-01-05 02:28:11 +01:00
|
|
|
minimize_window: ;/////////////////////////////////////////////////////////////
|
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
;> eax = window number on screen
|
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
;# corrupts [dl*]
|
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
push edi
|
|
|
|
pushfd
|
|
|
|
cli
|
|
|
|
|
|
|
|
; is it already minimized?
|
|
|
|
movzx edi, word[WIN_POS + eax * 2]
|
|
|
|
shl edi, 5
|
|
|
|
add edi, window_data
|
|
|
|
test [edi + WDATA.fl_wstate], WSTATE_MINIMIZED
|
|
|
|
jnz .exit
|
|
|
|
|
|
|
|
push eax ebx ecx edx esi
|
|
|
|
|
|
|
|
; no it's not, let's do that
|
|
|
|
or [edi + WDATA.fl_wstate], WSTATE_MINIMIZED
|
2012-04-17 18:32:18 +02:00
|
|
|
; If the window width is 0, then the action is not needed.
|
|
|
|
cmp [edi + WDATA.box.width], dword 0
|
|
|
|
je @f
|
|
|
|
; If the window height is 0, then the action is not needed.
|
|
|
|
cmp [edi + WDATA.box.height], dword 0
|
|
|
|
je @f
|
|
|
|
|
2010-01-05 02:28:11 +01:00
|
|
|
mov eax, [edi + WDATA.box.left]
|
|
|
|
mov [draw_limits.left], eax
|
|
|
|
mov ecx, eax
|
|
|
|
add ecx, [edi + WDATA.box.width]
|
|
|
|
mov [draw_limits.right], ecx
|
|
|
|
mov ebx, [edi + WDATA.box.top]
|
|
|
|
mov [draw_limits.top], ebx
|
|
|
|
mov edx, ebx
|
|
|
|
add edx, [edi + WDATA.box.height]
|
|
|
|
mov [draw_limits.bottom], edx
|
2012-04-17 18:32:18 +02:00
|
|
|
|
|
|
|
; DEBUGF 1, "K : minimize_window\n"
|
|
|
|
; DEBUGF 1, "K : dl_left %x\n",[draw_limits.left]
|
|
|
|
; DEBUGF 1, "K : dl_right %x\n",[draw_limits.right]
|
|
|
|
; DEBUGF 1, "K : dl_top %x\n",[draw_limits.top]
|
|
|
|
; DEBUGF 1, "K : dl_bottom %x\n",[draw_limits.bottom]
|
2010-01-05 02:28:11 +01:00
|
|
|
call calculatescreen
|
2012-04-17 18:32:18 +02:00
|
|
|
; xor esi, esi
|
|
|
|
; xor eax, eax
|
|
|
|
mov eax, edi
|
2010-01-05 02:28:11 +01:00
|
|
|
call redrawscreen
|
2012-04-17 18:32:18 +02:00
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
|
|
|
@@:
|
2010-01-05 02:28:11 +01:00
|
|
|
pop esi edx ecx ebx eax
|
2012-03-08 14:45:18 +01:00
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
|
|
|
.exit:
|
2010-01-05 02:28:11 +01:00
|
|
|
popfd
|
|
|
|
pop edi
|
|
|
|
ret
|
2012-03-08 14:45:18 +01:00
|
|
|
;------------------------------------------------------------------------------
|
2010-01-05 02:28:11 +01:00
|
|
|
align 4
|
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
restore_minimized_window: ;////////////////////////////////////////////////////
|
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
;> eax = window number on screen
|
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
;# corrupts [dl*]
|
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
pushad
|
|
|
|
pushfd
|
|
|
|
cli
|
|
|
|
|
|
|
|
; is it already restored?
|
|
|
|
movzx esi, word[WIN_POS + eax * 2]
|
|
|
|
mov edi, esi
|
|
|
|
shl edi, 5
|
|
|
|
add edi, window_data
|
|
|
|
test [edi + WDATA.fl_wstate], WSTATE_MINIMIZED
|
|
|
|
jz .exit
|
|
|
|
|
|
|
|
; no it's not, let's do that
|
|
|
|
mov [edi + WDATA.fl_redraw], 1
|
|
|
|
and [edi + WDATA.fl_wstate], not WSTATE_MINIMIZED
|
|
|
|
mov ebp, window._.set_screen
|
|
|
|
cmp eax, [TASK_COUNT]
|
|
|
|
jz @f
|
|
|
|
mov ebp, calculatescreen
|
2012-03-08 14:45:18 +01:00
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
|
|
|
@@:
|
2011-10-14 23:38:50 +02:00
|
|
|
mov eax, [edi + WDATA.box.left]
|
2010-01-05 02:28:11 +01:00
|
|
|
mov ebx, [edi + WDATA.box.top]
|
|
|
|
mov ecx, [edi + WDATA.box.width]
|
|
|
|
mov edx, [edi + WDATA.box.height]
|
|
|
|
add ecx, eax
|
|
|
|
add edx, ebx
|
|
|
|
call ebp
|
2012-03-09 16:50:49 +01:00
|
|
|
inc [_display.mask_seqno]
|
2012-03-08 14:45:18 +01:00
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
|
|
|
.exit:
|
2010-01-05 02:28:11 +01:00
|
|
|
popfd
|
|
|
|
popad
|
|
|
|
ret
|
2012-03-08 14:45:18 +01:00
|
|
|
;------------------------------------------------------------------------------
|
2010-01-05 02:28:11 +01:00
|
|
|
align 4
|
2010-02-06 20:08:19 +01:00
|
|
|
; TODO: remove this proc
|
2010-01-05 02:28:11 +01:00
|
|
|
;------------------------------------------------------------------------------
|
2010-02-06 20:08:19 +01:00
|
|
|
window_check_events: ;/////////////////////////////////////////////////////////
|
2010-01-05 02:28:11 +01:00
|
|
|
;------------------------------------------------------------------------------
|
2010-02-06 20:08:19 +01:00
|
|
|
;? <description>
|
2010-01-05 02:28:11 +01:00
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
; do we have window minimize/restore request?
|
|
|
|
cmp [window_minimize], 0
|
2010-02-06 20:08:19 +01:00
|
|
|
je .exit
|
2010-01-05 02:28:11 +01:00
|
|
|
|
|
|
|
; okay, minimize or restore top-most window and exit
|
|
|
|
mov eax, [TASK_COUNT]
|
|
|
|
mov bl, 0
|
|
|
|
xchg [window_minimize], bl
|
|
|
|
dec bl
|
|
|
|
jnz @f
|
|
|
|
call minimize_window
|
|
|
|
jmp .exit
|
2012-03-08 14:45:18 +01:00
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
|
|
|
@@:
|
2011-10-14 23:38:50 +02:00
|
|
|
call restore_minimized_window
|
2012-03-08 14:45:18 +01:00
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
|
|
|
.exit:
|
2010-02-06 20:08:19 +01:00
|
|
|
ret
|
2012-03-08 14:45:18 +01:00
|
|
|
;------------------------------------------------------------------------------
|
2010-02-06 20:08:19 +01:00
|
|
|
align 4
|
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
sys_window_maximize_handler: ;/////////////////////////////////////////////////
|
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
;? <description>
|
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
;> esi = process slot
|
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
mov edi, esi
|
2010-01-05 02:28:11 +01:00
|
|
|
shl edi, 5
|
|
|
|
add edi, window_data
|
|
|
|
|
2010-02-06 20:08:19 +01:00
|
|
|
; can window change its height?
|
2010-07-25 23:57:38 +02:00
|
|
|
; only types 2 and 3 can be resized
|
2010-01-05 02:28:11 +01:00
|
|
|
mov dl, [edi + WDATA.fl_wstyle]
|
2010-07-25 23:57:38 +02:00
|
|
|
test dl, 2
|
|
|
|
jz .exit
|
2010-01-05 02:28:11 +01:00
|
|
|
|
2010-02-06 20:08:19 +01:00
|
|
|
; toggle normal/maximized window state
|
|
|
|
mov bl, [edi + WDATA.fl_wstate]
|
|
|
|
xor bl, WSTATE_MAXIMIZED
|
2010-01-05 02:28:11 +01:00
|
|
|
|
2010-02-06 20:08:19 +01:00
|
|
|
; calculate and set appropriate window bounds
|
|
|
|
test bl, WSTATE_MAXIMIZED
|
|
|
|
jz .restore_size
|
2010-01-05 02:28:11 +01:00
|
|
|
|
2010-02-06 20:08:19 +01:00
|
|
|
mov eax, [screen_workarea.left]
|
|
|
|
mov ecx, [screen_workarea.top]
|
|
|
|
push [screen_workarea.bottom] \
|
|
|
|
[screen_workarea.right] \
|
|
|
|
ecx \
|
|
|
|
eax
|
|
|
|
sub [esp + BOX.width], eax
|
|
|
|
sub [esp + BOX.height], ecx
|
|
|
|
mov eax, esp
|
|
|
|
jmp .set_box
|
2012-03-08 14:45:18 +01:00
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
|
|
|
.restore_size:
|
2010-02-06 20:08:19 +01:00
|
|
|
mov eax, esi
|
|
|
|
shl eax, 8
|
|
|
|
add eax, SLOT_BASE + APPDATA.saved_box
|
|
|
|
push [eax + BOX.height] \
|
|
|
|
[eax + BOX.width] \
|
|
|
|
[eax + BOX.top] \
|
|
|
|
[eax + BOX.left]
|
|
|
|
mov eax, esp
|
2012-03-08 14:45:18 +01:00
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
|
|
|
.set_box:
|
2010-02-06 20:08:19 +01:00
|
|
|
test bl, WSTATE_ROLLEDUP
|
|
|
|
jz @f
|
2010-01-05 02:28:11 +01:00
|
|
|
|
2010-02-06 20:08:19 +01:00
|
|
|
xchg eax, ecx
|
|
|
|
call window._.get_rolledup_height
|
|
|
|
mov [ecx + BOX.height], eax
|
|
|
|
xchg eax, ecx
|
2012-03-08 14:45:18 +01:00
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
|
|
|
@@:
|
2011-10-14 23:38:50 +02:00
|
|
|
call window._.set_window_box
|
2012-02-22 16:46:09 +01:00
|
|
|
add esp, sizeof.BOX
|
2012-03-08 14:45:18 +01:00
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
|
|
|
.exit:
|
2012-03-09 16:50:49 +01:00
|
|
|
inc [_display.mask_seqno]
|
2010-02-06 20:08:19 +01:00
|
|
|
ret
|
2012-03-08 14:45:18 +01:00
|
|
|
;------------------------------------------------------------------------------
|
2010-02-06 20:08:19 +01:00
|
|
|
align 4
|
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
sys_window_rollup_handler: ;///////////////////////////////////////////////////
|
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
;? <description>
|
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
;> esi = process slot
|
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
mov edx, esi
|
|
|
|
shl edx, 8
|
|
|
|
add edx, SLOT_BASE
|
2010-01-05 02:28:11 +01:00
|
|
|
|
2010-02-06 20:08:19 +01:00
|
|
|
; toggle normal/rolled up window state
|
|
|
|
mov bl, [edi + WDATA.fl_wstate]
|
|
|
|
xor bl, WSTATE_ROLLEDUP
|
2010-01-05 02:28:11 +01:00
|
|
|
|
2010-02-06 20:08:19 +01:00
|
|
|
; calculate and set appropriate window bounds
|
|
|
|
test bl, WSTATE_ROLLEDUP
|
|
|
|
jz .restore_size
|
2010-01-05 02:28:11 +01:00
|
|
|
|
2010-02-06 20:08:19 +01:00
|
|
|
call window._.get_rolledup_height
|
|
|
|
push eax \
|
|
|
|
[edi + WDATA.box.width] \
|
|
|
|
[edi + WDATA.box.top] \
|
|
|
|
[edi + WDATA.box.left]
|
|
|
|
mov eax, esp
|
|
|
|
jmp .set_box
|
2012-03-08 14:45:18 +01:00
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
|
|
|
.restore_size:
|
2010-02-06 20:08:19 +01:00
|
|
|
test bl, WSTATE_MAXIMIZED
|
|
|
|
jnz @f
|
2012-02-22 16:46:09 +01:00
|
|
|
add esp, -sizeof.BOX
|
2010-02-06 20:08:19 +01:00
|
|
|
lea eax, [edx + APPDATA.saved_box]
|
|
|
|
jmp .set_box
|
2012-03-08 14:45:18 +01:00
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
|
|
|
@@:
|
2011-10-14 23:38:50 +02:00
|
|
|
mov eax, [screen_workarea.top]
|
2010-02-06 20:08:19 +01:00
|
|
|
push [screen_workarea.bottom] \
|
|
|
|
[edi + WDATA.box.width] \
|
|
|
|
eax \
|
|
|
|
[edi + WDATA.box.left]
|
|
|
|
sub [esp + BOX.height], eax
|
|
|
|
mov eax, esp
|
2012-03-08 14:45:18 +01:00
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
|
|
|
.set_box:
|
2010-02-06 20:08:19 +01:00
|
|
|
call window._.set_window_box
|
2012-02-22 16:46:09 +01:00
|
|
|
add esp, sizeof.BOX
|
2010-02-06 20:08:19 +01:00
|
|
|
ret
|
2012-03-08 14:45:18 +01:00
|
|
|
;------------------------------------------------------------------------------
|
2010-02-06 20:08:19 +01:00
|
|
|
align 4
|
|
|
|
;------------------------------------------------------------------------------
|
2012-05-24 00:29:15 +02:00
|
|
|
;sys_window_start_moving_handler: ;/////////////////////////////////////////////
|
2010-02-06 20:08:19 +01:00
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
;? <description>
|
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
;> eax = old (original) window box
|
|
|
|
;> esi = process slot
|
|
|
|
;------------------------------------------------------------------------------
|
2012-05-24 00:29:15 +02:00
|
|
|
; mov edi, eax
|
|
|
|
; call window._.draw_negative_box
|
|
|
|
; ret
|
2012-03-08 14:45:18 +01:00
|
|
|
;------------------------------------------------------------------------------
|
2010-02-06 20:08:19 +01:00
|
|
|
align 4
|
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
sys_window_end_moving_handler: ;///////////////////////////////////////////////
|
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
;? <description>
|
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
;> eax = old (original) window box
|
|
|
|
;> ebx = new (final) window box
|
|
|
|
;> esi = process slot
|
|
|
|
;------------------------------------------------------------------------------
|
2012-05-24 00:29:15 +02:00
|
|
|
; mov edi, ebx
|
|
|
|
; call window._.end_moving__box
|
2010-01-05 02:28:11 +01:00
|
|
|
|
2010-02-06 20:08:19 +01:00
|
|
|
mov edi, esi
|
|
|
|
shl edi, 5
|
|
|
|
add edi, window_data
|
2010-01-05 02:28:11 +01:00
|
|
|
|
2010-02-06 20:08:19 +01:00
|
|
|
mov eax, ebx
|
|
|
|
mov bl, [edi + WDATA.fl_wstate]
|
|
|
|
call window._.set_window_box
|
|
|
|
ret
|
2012-03-08 14:45:18 +01:00
|
|
|
;------------------------------------------------------------------------------
|
2010-02-06 20:08:19 +01:00
|
|
|
align 4
|
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
sys_window_moving_handler: ;///////////////////////////////////////////////////
|
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
;? <description>
|
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
;> eax = old (from previous call) window box
|
|
|
|
;> ebx = new (current) window box
|
|
|
|
;> esi = process_slot
|
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
mov edi, eax
|
|
|
|
call window._.draw_negative_box
|
|
|
|
mov edi, ebx
|
|
|
|
call window._.draw_negative_box
|
|
|
|
ret
|
|
|
|
;==============================================================================
|
|
|
|
;///// private functions //////////////////////////////////////////////////////
|
|
|
|
;==============================================================================
|
2010-01-05 02:28:11 +01:00
|
|
|
|
2010-02-06 20:08:19 +01:00
|
|
|
iglobal
|
|
|
|
FuncTable syscall_display_settings, ftable, \
|
2015-08-03 14:38:30 +02:00
|
|
|
00, 01, 02, 03, 04, 05, 06, 07, 08, 09
|
2010-01-05 02:28:11 +01:00
|
|
|
|
2010-02-06 20:08:19 +01:00
|
|
|
align 4
|
|
|
|
window_topleft dd \
|
|
|
|
1, 21, \ ;type 0
|
|
|
|
0, 0, \ ;type 1
|
|
|
|
5, 20, \ ;type 2
|
|
|
|
5, ?, \ ;type 3 {set by skin}
|
|
|
|
5, ? ;type 4 {set by skin}
|
|
|
|
endg
|
2010-01-05 02:28:11 +01:00
|
|
|
|
2010-02-06 20:08:19 +01:00
|
|
|
;uglobal
|
|
|
|
; NOTE: commented out since doesn't provide necessary functionality anyway,
|
|
|
|
; to be reworked
|
|
|
|
; new_window_starting dd ?
|
|
|
|
;endg
|
2012-03-08 14:45:18 +01:00
|
|
|
;------------------------------------------------------------------------------
|
2010-02-06 20:08:19 +01:00
|
|
|
align 4
|
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
window._.invalidate_screen: ;//////////////////////////////////////////////////
|
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
;? <description>
|
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
;> eax = old (original) window box
|
|
|
|
;> ebx = new (final) window box
|
|
|
|
;> edi = pointer to WDATA struct
|
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
push eax ebx
|
2010-01-05 02:28:11 +01:00
|
|
|
|
2010-02-06 20:08:19 +01:00
|
|
|
; TODO: do we really need `draw_limits`?
|
2010-08-02 01:15:10 +02:00
|
|
|
; Yes, they are used by background drawing code.
|
2012-03-28 15:26:34 +02:00
|
|
|
|
|
|
|
; we need only to restore the background windows at the old place!
|
|
|
|
mov ecx, [ebx + BOX.left]
|
2011-10-14 23:38:50 +02:00
|
|
|
mov [draw_limits.left], ecx
|
2012-03-28 15:26:34 +02:00
|
|
|
add ecx, [ebx + BOX.width]
|
2011-10-14 23:38:50 +02:00
|
|
|
mov [draw_limits.right], ecx
|
2012-03-28 15:26:34 +02:00
|
|
|
mov ecx, [ebx + BOX.top]
|
2011-10-14 23:38:50 +02:00
|
|
|
mov [draw_limits.top], ecx
|
2012-03-28 15:26:34 +02:00
|
|
|
add ecx, [ebx + BOX.height]
|
2011-10-14 23:38:50 +02:00
|
|
|
mov [draw_limits.bottom], ecx
|
2012-03-28 15:26:34 +02:00
|
|
|
; recalculate screen buffer at old position
|
2010-02-06 20:08:19 +01:00
|
|
|
push ebx
|
|
|
|
mov edx, [eax + BOX.height]
|
|
|
|
mov ecx, [eax + BOX.width]
|
|
|
|
mov ebx, [eax + BOX.top]
|
|
|
|
mov eax, [eax + BOX.left]
|
|
|
|
add ecx, eax
|
|
|
|
add edx, ebx
|
|
|
|
call calculatescreen
|
|
|
|
pop eax
|
2012-03-28 15:26:34 +02:00
|
|
|
; recalculate screen buffer at new position
|
2010-02-06 20:08:19 +01:00
|
|
|
mov edx, [eax + BOX.height]
|
|
|
|
mov ecx, [eax + BOX.width]
|
|
|
|
mov ebx, [eax + BOX.top]
|
|
|
|
mov eax, [eax + BOX.left]
|
|
|
|
add ecx, eax
|
|
|
|
add edx, ebx
|
|
|
|
call calculatescreen
|
2010-01-05 02:28:11 +01:00
|
|
|
|
2010-02-06 20:08:19 +01:00
|
|
|
mov eax, edi
|
|
|
|
call redrawscreen
|
2010-01-05 02:28:11 +01:00
|
|
|
|
2010-02-06 20:08:19 +01:00
|
|
|
; tell window to redraw itself
|
|
|
|
mov [edi + WDATA.fl_redraw], 1
|
2010-01-05 02:28:11 +01:00
|
|
|
|
|
|
|
pop ebx eax
|
2010-02-06 20:08:19 +01:00
|
|
|
ret
|
2012-03-08 14:45:18 +01:00
|
|
|
;------------------------------------------------------------------------------
|
2010-02-06 20:08:19 +01:00
|
|
|
align 4
|
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
window._.set_window_box: ;/////////////////////////////////////////////////////
|
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
;? <description>
|
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
;> eax = pointer to BOX struct
|
|
|
|
;> bl = new window state flags
|
|
|
|
;> edi = pointer to WDATA struct
|
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
push eax ebx esi
|
2010-01-05 02:28:11 +01:00
|
|
|
|
2010-05-30 20:19:10 +02:00
|
|
|
; don't do anything if the new box is identical to the old
|
2011-10-14 23:38:50 +02:00
|
|
|
cmp bl, [edi + WDATA.fl_wstate]
|
|
|
|
jnz @f
|
|
|
|
mov esi, eax
|
|
|
|
push edi
|
2010-05-30 20:19:10 +02:00
|
|
|
if WDATA.box
|
2011-10-14 23:38:50 +02:00
|
|
|
add edi, WDATA.box
|
2010-05-30 20:19:10 +02:00
|
|
|
end if
|
2011-10-14 23:38:50 +02:00
|
|
|
mov ecx, 4
|
|
|
|
repz cmpsd
|
|
|
|
pop edi
|
|
|
|
jz .exit
|
2012-03-08 14:45:18 +01:00
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
2010-05-30 20:19:10 +02:00
|
|
|
@@:
|
2012-02-22 16:46:09 +01:00
|
|
|
add esp, -sizeof.BOX
|
2010-02-06 20:08:19 +01:00
|
|
|
mov ebx, esp
|
2010-02-28 17:06:46 +01:00
|
|
|
if WDATA.box
|
2010-02-06 20:08:19 +01:00
|
|
|
lea esi, [edi + WDATA.box]
|
2010-02-28 17:06:46 +01:00
|
|
|
else
|
2011-10-14 23:38:50 +02:00
|
|
|
mov esi, edi ; optimization for WDATA.box = 0
|
2010-02-28 17:06:46 +01:00
|
|
|
end if
|
2010-02-06 20:08:19 +01:00
|
|
|
xchg eax, esi
|
2012-02-22 16:46:09 +01:00
|
|
|
mov ecx, sizeof.BOX
|
2010-02-06 20:08:19 +01:00
|
|
|
call memmove
|
|
|
|
xchg eax, esi
|
|
|
|
xchg ebx, esi
|
|
|
|
call memmove
|
2010-02-28 17:06:46 +01:00
|
|
|
mov eax, ebx
|
|
|
|
mov ebx, esi
|
2010-01-05 02:28:11 +01:00
|
|
|
|
2010-02-06 20:08:19 +01:00
|
|
|
call window._.check_window_position
|
|
|
|
call window._.set_window_clientbox
|
|
|
|
call window._.invalidate_screen
|
2010-01-05 02:28:11 +01:00
|
|
|
|
2012-02-22 16:46:09 +01:00
|
|
|
add esp, sizeof.BOX
|
2010-01-05 02:28:11 +01:00
|
|
|
|
2010-02-06 20:08:19 +01:00
|
|
|
mov cl, [esp + 4]
|
|
|
|
mov ch, cl
|
|
|
|
xchg cl, [edi + WDATA.fl_wstate]
|
2010-01-05 02:28:11 +01:00
|
|
|
|
2010-02-06 20:08:19 +01:00
|
|
|
or cl, ch
|
|
|
|
test cl, WSTATE_MAXIMIZED
|
|
|
|
jnz .exit
|
2010-01-05 02:28:11 +01:00
|
|
|
|
2010-02-06 20:08:19 +01:00
|
|
|
mov eax, edi
|
|
|
|
sub eax, window_data
|
|
|
|
shl eax, 3
|
|
|
|
add eax, SLOT_BASE
|
2010-01-05 02:28:11 +01:00
|
|
|
|
2010-02-06 20:08:19 +01:00
|
|
|
lea ebx, [edi + WDATA.box]
|
|
|
|
xchg esp, ebx
|
2010-01-05 02:28:11 +01:00
|
|
|
|
2010-02-06 20:08:19 +01:00
|
|
|
pop [eax + APPDATA.saved_box.left] \
|
|
|
|
[eax + APPDATA.saved_box.top] \
|
|
|
|
[eax + APPDATA.saved_box.width] \
|
|
|
|
edx
|
2010-01-05 02:28:11 +01:00
|
|
|
|
2010-02-06 20:08:19 +01:00
|
|
|
xchg esp, ebx
|
2010-01-05 02:28:11 +01:00
|
|
|
|
2010-02-06 20:08:19 +01:00
|
|
|
test ch, WSTATE_ROLLEDUP
|
|
|
|
jnz .exit
|
2010-01-05 02:28:11 +01:00
|
|
|
|
2010-02-06 20:08:19 +01:00
|
|
|
mov [eax + APPDATA.saved_box.height], edx
|
2012-03-08 14:45:18 +01:00
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
|
|
|
.exit:
|
2010-02-06 20:08:19 +01:00
|
|
|
pop esi ebx eax
|
|
|
|
ret
|
2012-03-08 14:45:18 +01:00
|
|
|
;------------------------------------------------------------------------------
|
2010-02-06 20:08:19 +01:00
|
|
|
align 4
|
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
window._.set_window_clientbox: ;///////////////////////////////////////////////
|
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
;? <description>
|
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
;> edi = pointer to WDATA struct
|
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
push eax ecx edi
|
2010-01-05 02:28:11 +01:00
|
|
|
|
2010-02-06 20:08:19 +01:00
|
|
|
mov eax, [_skinh]
|
|
|
|
mov [window_topleft + 8 * 3 + 4], eax
|
|
|
|
mov [window_topleft + 8 * 4 + 4], eax
|
|
|
|
|
|
|
|
mov ecx, edi
|
|
|
|
sub edi, window_data
|
|
|
|
shl edi, 3
|
|
|
|
test [ecx + WDATA.fl_wstyle], WSTYLE_CLIENTRELATIVE
|
|
|
|
jz .whole_window
|
|
|
|
|
|
|
|
movzx eax, [ecx + WDATA.fl_wstyle]
|
|
|
|
and eax, 0x0F
|
|
|
|
mov eax, [eax * 8 + window_topleft + 0]
|
|
|
|
mov [edi + SLOT_BASE + APPDATA.wnd_clientbox.left], eax
|
|
|
|
shl eax, 1
|
|
|
|
neg eax
|
|
|
|
add eax, [ecx + WDATA.box.width]
|
|
|
|
mov [edi + SLOT_BASE + APPDATA.wnd_clientbox.width], eax
|
|
|
|
|
|
|
|
movzx eax, [ecx + WDATA.fl_wstyle]
|
|
|
|
and eax, 0x0F
|
|
|
|
push [eax * 8 + window_topleft + 0]
|
|
|
|
mov eax, [eax * 8 + window_topleft + 4]
|
|
|
|
mov [edi + SLOT_BASE + APPDATA.wnd_clientbox.top], eax
|
|
|
|
neg eax
|
|
|
|
sub eax, [esp]
|
|
|
|
add eax, [ecx + WDATA.box.height]
|
|
|
|
mov [edi + SLOT_BASE + APPDATA.wnd_clientbox.height], eax
|
|
|
|
add esp, 4
|
|
|
|
jmp .exit
|
2012-03-08 14:45:18 +01:00
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
|
|
|
.whole_window:
|
2010-02-06 20:08:19 +01:00
|
|
|
xor eax, eax
|
|
|
|
mov [edi + SLOT_BASE + APPDATA.wnd_clientbox.left], eax
|
|
|
|
mov [edi + SLOT_BASE + APPDATA.wnd_clientbox.top], eax
|
|
|
|
mov eax, [ecx + WDATA.box.width]
|
|
|
|
mov [edi + SLOT_BASE + APPDATA.wnd_clientbox.width], eax
|
|
|
|
mov eax, [ecx + WDATA.box.height]
|
|
|
|
mov [edi + SLOT_BASE + APPDATA.wnd_clientbox.height], eax
|
2012-03-08 14:45:18 +01:00
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
|
|
|
.exit:
|
2010-02-06 20:08:19 +01:00
|
|
|
pop edi ecx eax
|
|
|
|
ret
|
2012-03-08 14:45:18 +01:00
|
|
|
;------------------------------------------------------------------------------
|
2010-02-06 20:08:19 +01:00
|
|
|
align 4
|
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
window._.sys_set_window: ;/////////////////////////////////////////////////////
|
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
;? <description>
|
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
;< edx = pointer to WDATA struct
|
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
mov eax, [CURRENT_TASK]
|
|
|
|
shl eax, 5
|
|
|
|
add eax, window_data
|
2010-01-05 02:28:11 +01:00
|
|
|
|
2010-02-06 20:08:19 +01:00
|
|
|
; save window colors
|
|
|
|
mov [eax + WDATA.cl_workarea], edx
|
|
|
|
mov [eax + WDATA.cl_titlebar], esi
|
|
|
|
mov [eax + WDATA.cl_frames], edi
|
|
|
|
|
|
|
|
mov edi, eax
|
|
|
|
|
|
|
|
; was it already defined before?
|
|
|
|
test [edi + WDATA.fl_wdrawn], 1
|
|
|
|
jnz .set_client_box
|
2010-08-08 23:43:40 +02:00
|
|
|
or [edi + WDATA.fl_wdrawn], 1
|
2012-03-23 21:13:09 +01:00
|
|
|
; After first draw_window we need redraw mouse necessarily!
|
|
|
|
; Otherwise the user can see cursor specified by f.37.5 from another window.
|
|
|
|
; He will be really unhappy! He is terrible in rage - usually he throws stones!
|
|
|
|
mov [redrawmouse_unconditional], 1
|
2013-05-27 11:02:35 +02:00
|
|
|
call wakeup_osloop
|
2010-02-06 20:08:19 +01:00
|
|
|
; NOTE: commented out since doesn't provide necessary functionality
|
|
|
|
; anyway, to be reworked
|
|
|
|
; mov eax, [timer_ticks] ; [0xfdf0]
|
|
|
|
; add eax, 100
|
|
|
|
; mov [new_window_starting], eax
|
|
|
|
|
|
|
|
; no it wasn't, performing initial window definition
|
|
|
|
movzx eax, bx
|
2010-01-05 02:28:11 +01:00
|
|
|
mov [edi + WDATA.box.width], eax
|
2010-02-06 20:08:19 +01:00
|
|
|
movzx eax, cx
|
2010-01-05 02:28:11 +01:00
|
|
|
mov [edi + WDATA.box.height], eax
|
2010-02-06 20:08:19 +01:00
|
|
|
sar ebx, 16
|
|
|
|
sar ecx, 16
|
|
|
|
mov [edi + WDATA.box.left], ebx
|
|
|
|
mov [edi + WDATA.box.top], ecx
|
2010-01-05 02:28:11 +01:00
|
|
|
|
2010-02-06 20:08:19 +01:00
|
|
|
call window._.check_window_position
|
2010-01-05 02:28:11 +01:00
|
|
|
|
2010-02-06 20:08:19 +01:00
|
|
|
push ecx edi
|
2010-01-05 02:28:11 +01:00
|
|
|
|
2010-02-06 20:08:19 +01:00
|
|
|
mov cl, [edi + WDATA.fl_wstyle]
|
|
|
|
mov eax, [edi + WDATA.cl_frames]
|
2010-01-05 02:28:11 +01:00
|
|
|
|
2010-02-06 20:08:19 +01:00
|
|
|
sub edi, window_data
|
|
|
|
shl edi, 3
|
|
|
|
add edi, SLOT_BASE
|
2010-01-05 02:28:11 +01:00
|
|
|
|
2010-02-06 20:08:19 +01:00
|
|
|
and cl, 0x0F
|
|
|
|
cmp cl, 3
|
|
|
|
je @f
|
|
|
|
cmp cl, 4
|
|
|
|
je @f
|
2010-01-05 02:28:11 +01:00
|
|
|
|
2010-02-06 20:08:19 +01:00
|
|
|
xor eax, eax
|
2012-03-08 14:45:18 +01:00
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
|
|
|
@@:
|
2011-10-14 23:38:50 +02:00
|
|
|
mov [edi + APPDATA.wnd_caption], eax
|
2010-01-05 02:28:11 +01:00
|
|
|
|
2010-02-06 20:08:19 +01:00
|
|
|
mov esi, [esp]
|
|
|
|
add edi, APPDATA.saved_box
|
|
|
|
movsd
|
|
|
|
movsd
|
|
|
|
movsd
|
|
|
|
movsd
|
|
|
|
|
|
|
|
pop edi ecx
|
|
|
|
|
|
|
|
mov esi, [CURRENT_TASK]
|
|
|
|
movzx esi, word[WIN_STACK + esi * 2]
|
|
|
|
lea esi, [WIN_POS + esi * 2]
|
|
|
|
call waredraw
|
2010-01-05 02:28:11 +01:00
|
|
|
|
|
|
|
mov eax, [edi + WDATA.box.left]
|
|
|
|
mov ebx, [edi + WDATA.box.top]
|
|
|
|
mov ecx, [edi + WDATA.box.width]
|
|
|
|
mov edx, [edi + WDATA.box.height]
|
|
|
|
add ecx, eax
|
|
|
|
add edx, ebx
|
|
|
|
call calculatescreen
|
|
|
|
|
2010-02-06 20:08:19 +01:00
|
|
|
mov byte[KEY_COUNT], 0 ; empty keyboard buffer
|
|
|
|
mov byte[BTN_COUNT], 0 ; empty button buffer
|
2012-03-08 14:45:18 +01:00
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
|
|
|
.set_client_box:
|
2010-02-06 20:08:19 +01:00
|
|
|
; update window client box coordinates
|
|
|
|
call window._.set_window_clientbox
|
2010-01-05 02:28:11 +01:00
|
|
|
|
2010-02-06 20:08:19 +01:00
|
|
|
; reset window redraw flag and exit
|
|
|
|
mov [edi + WDATA.fl_redraw], 0
|
|
|
|
mov edx, edi
|
|
|
|
ret
|
2012-03-08 14:45:18 +01:00
|
|
|
;------------------------------------------------------------------------------
|
2010-02-06 20:08:19 +01:00
|
|
|
align 4
|
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
window._.check_window_position: ;//////////////////////////////////////////////
|
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
;? Check if window is inside screen area
|
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
;> edi = pointer to WDATA
|
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
push eax ebx ecx edx esi
|
|
|
|
|
|
|
|
mov eax, [edi + WDATA.box.left]
|
|
|
|
mov ebx, [edi + WDATA.box.top]
|
|
|
|
mov ecx, [edi + WDATA.box.width]
|
|
|
|
mov edx, [edi + WDATA.box.height]
|
2010-01-05 02:28:11 +01:00
|
|
|
|
2015-01-05 18:18:45 +01:00
|
|
|
mov esi, [_display.width]
|
2010-02-06 20:08:19 +01:00
|
|
|
cmp ecx, esi
|
2015-01-05 18:18:45 +01:00
|
|
|
jae .fix_width_high
|
2012-03-08 14:45:18 +01:00
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
|
|
|
.check_left:
|
2010-02-06 20:08:19 +01:00
|
|
|
or eax, eax
|
|
|
|
jl .fix_left_low
|
|
|
|
add eax, ecx
|
|
|
|
cmp eax, esi
|
2015-01-05 18:18:45 +01:00
|
|
|
jge .fix_left_high
|
2012-03-08 14:45:18 +01:00
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
|
|
|
.check_height:
|
2015-01-05 18:18:45 +01:00
|
|
|
mov esi, [_display.height]
|
2010-02-06 20:08:19 +01:00
|
|
|
cmp edx, esi
|
2015-01-05 18:18:45 +01:00
|
|
|
jae .fix_height_high
|
2012-03-08 14:45:18 +01:00
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
|
|
|
.check_top:
|
2010-02-06 20:08:19 +01:00
|
|
|
or ebx, ebx
|
|
|
|
jl .fix_top_low
|
|
|
|
add ebx, edx
|
|
|
|
cmp ebx, esi
|
2015-01-05 18:18:45 +01:00
|
|
|
jge .fix_top_high
|
2012-03-08 14:45:18 +01:00
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
|
|
|
.exit:
|
2010-02-06 20:08:19 +01:00
|
|
|
pop esi edx ecx ebx eax
|
2010-01-05 02:28:11 +01:00
|
|
|
ret
|
2012-03-08 14:45:18 +01:00
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
|
|
|
.fix_width_high:
|
2010-02-06 20:08:19 +01:00
|
|
|
mov ecx, esi
|
|
|
|
mov [edi + WDATA.box.width], esi
|
|
|
|
jmp .check_left
|
2012-03-08 14:45:18 +01:00
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
|
|
|
.fix_left_low:
|
2010-02-06 20:08:19 +01:00
|
|
|
xor eax, eax
|
|
|
|
mov [edi + WDATA.box.left], eax
|
|
|
|
jmp .check_height
|
2012-03-08 14:45:18 +01:00
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
|
|
|
.fix_left_high:
|
2010-02-06 20:08:19 +01:00
|
|
|
mov eax, esi
|
|
|
|
sub eax, ecx
|
|
|
|
mov [edi + WDATA.box.left], eax
|
|
|
|
jmp .check_height
|
2012-03-08 14:45:18 +01:00
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
|
|
|
.fix_height_high:
|
2010-02-06 20:08:19 +01:00
|
|
|
mov edx, esi
|
|
|
|
mov [edi + WDATA.box.height], esi
|
|
|
|
jmp .check_top
|
2012-03-08 14:45:18 +01:00
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
|
|
|
.fix_top_low:
|
2010-02-06 20:08:19 +01:00
|
|
|
xor ebx, ebx
|
|
|
|
mov [edi + WDATA.box.top], ebx
|
|
|
|
jmp .exit
|
2012-03-08 14:45:18 +01:00
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
|
|
|
.fix_top_high:
|
2010-02-06 20:08:19 +01:00
|
|
|
mov ebx, esi
|
|
|
|
sub ebx, edx
|
|
|
|
mov [edi + WDATA.box.top], ebx
|
|
|
|
jmp .exit
|
2012-03-08 14:45:18 +01:00
|
|
|
;------------------------------------------------------------------------------
|
2010-01-05 02:28:11 +01:00
|
|
|
align 4
|
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
window._.get_titlebar_height: ;////////////////////////////////////////////////
|
|
|
|
;------------------------------------------------------------------------------
|
2010-02-06 20:08:19 +01:00
|
|
|
;? <description>
|
|
|
|
;------------------------------------------------------------------------------
|
2010-01-05 02:28:11 +01:00
|
|
|
;> edi = pointer to WDATA
|
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
mov al, [edi + WDATA.fl_wstyle]
|
|
|
|
and al, 0x0f
|
|
|
|
cmp al, 0x03
|
|
|
|
jne @f
|
|
|
|
mov eax, [_skinh]
|
|
|
|
ret
|
2012-03-08 14:45:18 +01:00
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
|
|
|
@@:
|
2011-10-14 23:38:50 +02:00
|
|
|
mov eax, 21
|
2010-01-05 02:28:11 +01:00
|
|
|
ret
|
2012-03-08 14:45:18 +01:00
|
|
|
;------------------------------------------------------------------------------
|
2010-01-05 02:28:11 +01:00
|
|
|
align 4
|
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
window._.get_rolledup_height: ;////////////////////////////////////////////////
|
|
|
|
;------------------------------------------------------------------------------
|
2010-02-06 20:08:19 +01:00
|
|
|
;? <description>
|
|
|
|
;------------------------------------------------------------------------------
|
2010-01-05 02:28:11 +01:00
|
|
|
;> edi = pointer to WDATA
|
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
mov al, [edi + WDATA.fl_wstyle]
|
|
|
|
and al, 0x0f
|
|
|
|
cmp al, 0x03
|
|
|
|
jb @f
|
|
|
|
mov eax, [_skinh]
|
|
|
|
add eax, 3
|
|
|
|
ret
|
2012-03-08 14:45:18 +01:00
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
|
|
|
@@:
|
2011-10-14 23:38:50 +02:00
|
|
|
or al, al
|
2010-01-05 02:28:11 +01:00
|
|
|
jnz @f
|
|
|
|
mov eax, 21
|
|
|
|
ret
|
2012-03-08 14:45:18 +01:00
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
|
|
|
@@:
|
2011-10-14 23:38:50 +02:00
|
|
|
mov eax, 21 + 2
|
2010-01-05 02:28:11 +01:00
|
|
|
ret
|
2012-03-08 14:45:18 +01:00
|
|
|
;------------------------------------------------------------------------------
|
2010-01-05 02:28:11 +01:00
|
|
|
align 4
|
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
window._.set_screen: ;/////////////////////////////////////////////////////////
|
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
;? Reserve window area in screen buffer
|
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
;> eax = left
|
|
|
|
;> ebx = top
|
|
|
|
;> ecx = right
|
|
|
|
;> edx = bottom
|
|
|
|
;> esi = process number
|
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
virtual at esp
|
|
|
|
ff_x dd ?
|
|
|
|
ff_y dd ?
|
|
|
|
ff_width dd ?
|
|
|
|
ff_xsz dd ?
|
|
|
|
ff_ysz dd ?
|
|
|
|
ff_scale dd ?
|
|
|
|
end virtual
|
|
|
|
|
|
|
|
pushad
|
|
|
|
|
|
|
|
cmp esi, 1
|
|
|
|
jz .check_for_shaped_window
|
|
|
|
mov edi, esi
|
|
|
|
shl edi, 5
|
|
|
|
cmp [window_data + edi + WDATA.box.width], 0
|
|
|
|
jnz .check_for_shaped_window
|
|
|
|
cmp [window_data + edi + WDATA.box.height], 0
|
|
|
|
jz .exit
|
2012-03-08 14:45:18 +01:00
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
|
|
|
.check_for_shaped_window:
|
2010-01-05 02:28:11 +01:00
|
|
|
mov edi, esi
|
|
|
|
shl edi, 8
|
|
|
|
add edi, SLOT_BASE
|
|
|
|
cmp [edi + APPDATA.wnd_shape], 0
|
|
|
|
jne .shaped_window
|
|
|
|
|
|
|
|
; get x&y size
|
|
|
|
sub ecx, eax
|
|
|
|
sub edx, ebx
|
|
|
|
inc ecx
|
|
|
|
inc edx
|
|
|
|
|
|
|
|
; get WinMap start
|
2010-01-08 13:20:53 +01:00
|
|
|
push esi
|
2014-01-02 20:43:51 +01:00
|
|
|
mov esi, [_display.width]
|
2012-03-10 12:37:42 +01:00
|
|
|
mov edi, [d_width_calc_area + ebx*4]
|
|
|
|
|
2010-01-05 02:28:11 +01:00
|
|
|
add edi, eax
|
2015-01-05 18:59:03 +01:00
|
|
|
add edi, [_display.win_map]
|
2010-01-08 13:20:53 +01:00
|
|
|
pop eax
|
|
|
|
mov ah, al
|
|
|
|
push ax
|
|
|
|
shl eax, 16
|
|
|
|
pop ax
|
2012-03-08 14:45:18 +01:00
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
|
|
|
.next_line:
|
2010-01-05 02:28:11 +01:00
|
|
|
push ecx
|
2010-01-08 13:20:53 +01:00
|
|
|
shr ecx, 2
|
2011-10-14 23:38:50 +02:00
|
|
|
rep stosd
|
2010-01-08 13:20:53 +01:00
|
|
|
mov ecx, [esp]
|
|
|
|
and ecx, 3
|
2011-10-14 23:38:50 +02:00
|
|
|
rep stosb
|
2010-01-05 02:28:11 +01:00
|
|
|
pop ecx
|
2010-01-08 13:20:53 +01:00
|
|
|
add edi, esi
|
2010-01-05 02:28:11 +01:00
|
|
|
sub edi, ecx
|
|
|
|
dec edx
|
|
|
|
jnz .next_line
|
|
|
|
|
|
|
|
jmp .exit
|
2012-03-08 14:45:18 +01:00
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
|
|
|
.shaped_window:
|
2010-01-05 02:28:11 +01:00
|
|
|
; for (y=0; y <= x_size; y++)
|
|
|
|
; for (x=0; x <= x_size; x++)
|
|
|
|
; if (shape[coord(x,y,scale)]==1)
|
|
|
|
; set_pixel(x, y, process_number);
|
|
|
|
|
|
|
|
sub ecx, eax
|
|
|
|
sub edx, ebx
|
|
|
|
inc ecx
|
|
|
|
inc edx
|
|
|
|
|
|
|
|
push [edi + APPDATA.wnd_shape_scale] ; push scale first -> for loop
|
|
|
|
|
|
|
|
; get WinMap start -> ebp
|
|
|
|
push eax
|
2012-03-10 12:37:42 +01:00
|
|
|
mov eax, [d_width_calc_area + ebx*4]
|
|
|
|
|
2010-01-05 02:28:11 +01:00
|
|
|
add eax, [esp]
|
2015-01-05 18:59:03 +01:00
|
|
|
add eax, [_display.win_map]
|
2010-01-05 02:28:11 +01:00
|
|
|
mov ebp, eax
|
|
|
|
|
|
|
|
mov edi, [edi + APPDATA.wnd_shape]
|
|
|
|
pop eax
|
|
|
|
|
|
|
|
; eax = x_start
|
|
|
|
; ebx = y_start
|
|
|
|
; ecx = x_size
|
|
|
|
; edx = y_size
|
|
|
|
; esi = process_number
|
|
|
|
; edi = &shape
|
|
|
|
; [scale]
|
|
|
|
push edx ecx ; for loop - x,y size
|
|
|
|
|
|
|
|
mov ecx, esi
|
|
|
|
shl ecx, 5
|
|
|
|
mov edx, [window_data + ecx + WDATA.box.top]
|
|
|
|
push [window_data + ecx + WDATA.box.width] ; for loop - width
|
|
|
|
mov ecx, [window_data + ecx + WDATA.box.left]
|
|
|
|
sub ebx, edx
|
|
|
|
sub eax, ecx
|
|
|
|
push ebx eax ; for loop - x,y
|
|
|
|
|
|
|
|
add [ff_xsz], eax
|
|
|
|
add [ff_ysz], ebx
|
|
|
|
|
|
|
|
mov ebx, [ff_y]
|
2012-03-08 14:45:18 +01:00
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
|
|
|
.ff_new_y:
|
2010-01-05 02:28:11 +01:00
|
|
|
mov edx, [ff_x]
|
2012-03-08 14:45:18 +01:00
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
|
|
|
.ff_new_x:
|
2010-01-05 02:28:11 +01:00
|
|
|
; -- body --
|
|
|
|
mov ecx, [ff_scale]
|
|
|
|
mov eax, [ff_width]
|
|
|
|
inc eax
|
|
|
|
shr eax, cl
|
|
|
|
push ebx edx
|
|
|
|
shr ebx, cl
|
|
|
|
shr edx, cl
|
|
|
|
imul eax, ebx
|
|
|
|
add eax, edx
|
|
|
|
pop edx ebx
|
|
|
|
add eax, edi
|
|
|
|
call .read_byte
|
2011-10-14 23:38:50 +02:00
|
|
|
test al, al
|
2010-01-05 02:28:11 +01:00
|
|
|
jz @f
|
|
|
|
mov eax, esi
|
|
|
|
mov [ebp], al
|
|
|
|
; -- end body --
|
2012-03-08 14:45:18 +01:00
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
|
|
|
@@:
|
2011-10-14 23:38:50 +02:00
|
|
|
inc ebp
|
2010-01-05 02:28:11 +01:00
|
|
|
inc edx
|
|
|
|
cmp edx, [ff_xsz]
|
|
|
|
jb .ff_new_x
|
|
|
|
|
|
|
|
sub ebp, [ff_xsz]
|
|
|
|
add ebp, [ff_x]
|
2015-01-05 18:18:45 +01:00
|
|
|
add ebp, [_display.width] ; screen.x
|
2010-01-05 02:28:11 +01:00
|
|
|
inc ebx
|
|
|
|
cmp ebx, [ff_ysz]
|
|
|
|
jb .ff_new_y
|
|
|
|
|
|
|
|
add esp, 24
|
2012-03-08 14:45:18 +01:00
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
|
|
|
.exit:
|
2010-01-05 02:28:11 +01:00
|
|
|
popad
|
2012-03-09 16:50:49 +01:00
|
|
|
inc [_display.mask_seqno]
|
2010-01-05 02:28:11 +01:00
|
|
|
ret
|
2012-03-08 14:45:18 +01:00
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
|
|
|
.read_byte:
|
2010-01-05 02:28:11 +01:00
|
|
|
; eax - address
|
|
|
|
; esi - slot
|
|
|
|
push eax ecx edx esi
|
|
|
|
xchg eax, esi
|
|
|
|
lea ecx, [esp + 12]
|
|
|
|
mov edx, 1
|
|
|
|
call read_process_memory
|
|
|
|
pop esi edx ecx eax
|
|
|
|
ret
|
2012-03-08 14:45:18 +01:00
|
|
|
;------------------------------------------------------------------------------
|
2010-01-05 02:28:11 +01:00
|
|
|
align 4
|
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
window._.window_activate: ;////////////////////////////////////////////////////
|
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
;? Activate window
|
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
;> esi = pointer to WIN_POS+ window data
|
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
push eax ebx
|
|
|
|
|
|
|
|
; if type of current active window is 3 or 4, it must be redrawn
|
2010-01-08 13:20:53 +01:00
|
|
|
mov ebx, [TASK_COUNT]
|
2015-01-05 18:18:45 +01:00
|
|
|
|
2011-10-14 23:38:50 +02:00
|
|
|
; DEBUGF 1, "K : TASK_COUNT (0x%x)\n", ebx
|
2015-01-05 18:18:45 +01:00
|
|
|
|
2010-01-08 13:20:53 +01:00
|
|
|
movzx ebx, word[WIN_POS + ebx * 2]
|
|
|
|
shl ebx, 5
|
2010-01-05 02:28:11 +01:00
|
|
|
add eax, window_data
|
2010-01-08 13:20:53 +01:00
|
|
|
mov al, [window_data + ebx + WDATA.fl_wstyle]
|
|
|
|
and al, 0x0f
|
|
|
|
cmp al, 0x03
|
2010-01-05 02:28:11 +01:00
|
|
|
je .set_window_redraw_flag
|
2010-01-08 13:20:53 +01:00
|
|
|
cmp al, 0x04
|
|
|
|
jne .move_others_down
|
2012-03-08 14:45:18 +01:00
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
|
|
|
.set_window_redraw_flag:
|
2010-01-08 13:20:53 +01:00
|
|
|
mov [window_data + ebx + WDATA.fl_redraw], 1
|
2012-03-08 14:45:18 +01:00
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
|
|
|
.move_others_down:
|
2010-01-05 02:28:11 +01:00
|
|
|
; ax <- process no
|
2010-01-08 13:20:53 +01:00
|
|
|
movzx ebx, word[esi]
|
2010-01-05 02:28:11 +01:00
|
|
|
; ax <- position in window stack
|
2010-01-08 13:20:53 +01:00
|
|
|
movzx ebx, word[WIN_STACK + ebx * 2]
|
2010-01-05 02:28:11 +01:00
|
|
|
|
|
|
|
; drop others
|
2010-01-08 13:20:53 +01:00
|
|
|
xor eax, eax
|
2012-03-08 14:45:18 +01:00
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
|
|
|
.next_stack_window:
|
2010-01-08 13:20:53 +01:00
|
|
|
cmp eax, [TASK_COUNT]
|
2010-01-05 02:28:11 +01:00
|
|
|
jae .move_self_up
|
2010-01-08 13:20:53 +01:00
|
|
|
inc eax
|
2015-01-05 18:18:45 +01:00
|
|
|
|
2011-10-14 23:38:50 +02:00
|
|
|
; push ebx
|
|
|
|
; xor ebx,ebx
|
|
|
|
; mov bx,[WIN_STACK + eax * 2]
|
|
|
|
; DEBUGF 1, "K : DEC WIN_STACK (0x%x)\n",ebx
|
|
|
|
; pop ebx
|
2015-01-05 18:18:45 +01:00
|
|
|
|
2010-01-08 13:20:53 +01:00
|
|
|
cmp [WIN_STACK + eax * 2], bx
|
2010-01-05 02:28:11 +01:00
|
|
|
jbe .next_stack_window
|
2010-01-08 13:20:53 +01:00
|
|
|
dec word[WIN_STACK + eax * 2]
|
2010-01-05 02:28:11 +01:00
|
|
|
jmp .next_stack_window
|
2012-03-08 14:45:18 +01:00
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
|
|
|
.move_self_up:
|
2010-01-08 13:20:53 +01:00
|
|
|
movzx ebx, word[esi]
|
2010-01-05 02:28:11 +01:00
|
|
|
; number of processes
|
2010-01-08 13:20:53 +01:00
|
|
|
mov ax, [TASK_COUNT]
|
2010-01-05 02:28:11 +01:00
|
|
|
; this is the last (and the upper)
|
2010-01-08 13:20:53 +01:00
|
|
|
mov [WIN_STACK + ebx * 2], ax
|
2010-01-05 02:28:11 +01:00
|
|
|
|
|
|
|
; update on screen - window stack
|
2010-01-08 13:20:53 +01:00
|
|
|
xor eax, eax
|
2012-03-08 14:45:18 +01:00
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
|
|
|
.next_window_pos:
|
2010-01-08 13:20:53 +01:00
|
|
|
cmp eax, [TASK_COUNT]
|
2010-01-05 02:28:11 +01:00
|
|
|
jae .reset_vars
|
2010-01-08 13:20:53 +01:00
|
|
|
inc eax
|
|
|
|
movzx ebx, word[WIN_STACK + eax * 2]
|
|
|
|
mov [WIN_POS + ebx * 2], ax
|
2010-01-05 02:28:11 +01:00
|
|
|
jmp .next_window_pos
|
2012-03-08 14:45:18 +01:00
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
|
|
|
.reset_vars:
|
2010-01-05 02:28:11 +01:00
|
|
|
mov byte[KEY_COUNT], 0
|
|
|
|
mov byte[BTN_COUNT], 0
|
|
|
|
mov word[MOUSE_SCROLL_H], 0
|
|
|
|
mov word[MOUSE_SCROLL_V], 0
|
|
|
|
|
|
|
|
pop ebx eax
|
|
|
|
ret
|
2011-09-27 09:08:12 +02:00
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
window._.window_deactivate: ;////////////////////////////////////////////////////
|
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
;? Deactivate window
|
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
;> esi = pointer to WIN_POS+ window data
|
|
|
|
;------------------------------------------------------------------------------
|
2011-10-14 23:38:50 +02:00
|
|
|
push eax ebx
|
2012-03-08 14:45:18 +01:00
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
2011-09-27 09:08:12 +02:00
|
|
|
.move_others_up:
|
2011-10-14 23:38:50 +02:00
|
|
|
; ax <- process no
|
|
|
|
movzx ebx, word[esi]
|
|
|
|
; ax <- position in window stack
|
|
|
|
movzx ebx, word[WIN_STACK + ebx * 2]
|
|
|
|
; up others
|
|
|
|
xor eax, eax
|
2012-03-08 14:45:18 +01:00
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
2011-09-27 09:08:12 +02:00
|
|
|
.next_stack_window:
|
2011-10-14 23:38:50 +02:00
|
|
|
cmp eax, [TASK_COUNT]
|
|
|
|
jae .move_self_down
|
|
|
|
inc eax
|
|
|
|
cmp [WIN_STACK + eax * 2], bx
|
|
|
|
jae .next_stack_window
|
|
|
|
inc word[WIN_STACK + eax * 2]
|
|
|
|
jmp .next_stack_window
|
2012-03-08 14:45:18 +01:00
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
2011-09-27 09:08:12 +02:00
|
|
|
.move_self_down:
|
2011-10-14 23:38:50 +02:00
|
|
|
movzx ebx, word[esi]
|
|
|
|
; this is the last (and the low)
|
|
|
|
mov [WIN_STACK + ebx * 2], word 1
|
|
|
|
; update on screen - window stack
|
|
|
|
xor eax, eax
|
2012-03-08 14:45:18 +01:00
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
2011-09-27 09:08:12 +02:00
|
|
|
.next_window_pos:
|
2011-10-14 23:38:50 +02:00
|
|
|
cmp eax, [TASK_COUNT]
|
|
|
|
jae .reset_vars
|
|
|
|
inc eax
|
|
|
|
movzx ebx, word[WIN_STACK + eax * 2]
|
|
|
|
mov [WIN_POS + ebx * 2], ax
|
|
|
|
jmp .next_window_pos
|
2012-03-08 14:45:18 +01:00
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
2011-09-27 09:08:12 +02:00
|
|
|
.reset_vars:
|
2011-10-14 23:38:50 +02:00
|
|
|
mov byte[KEY_COUNT], 0
|
|
|
|
mov byte[BTN_COUNT], 0
|
|
|
|
mov word[MOUSE_SCROLL_H], 0
|
|
|
|
mov word[MOUSE_SCROLL_V], 0
|
|
|
|
pop ebx eax
|
|
|
|
ret
|
2015-01-05 18:18:45 +01:00
|
|
|
;------------------------------------------------------------------------------
|
2010-01-05 02:28:11 +01:00
|
|
|
align 4
|
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
window._.check_window_draw: ;//////////////////////////////////////////////////
|
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
;? Check if window is necessary to draw
|
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
;> edi = pointer to WDATA
|
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
mov cl, [edi + WDATA.fl_wstyle]
|
|
|
|
and cl, 0x0f
|
2010-02-06 20:08:19 +01:00
|
|
|
cmp cl, 3
|
2010-01-05 02:28:11 +01:00
|
|
|
je .exit.redraw ; window type 3
|
2010-02-06 20:08:19 +01:00
|
|
|
cmp cl, 4
|
2010-01-05 02:28:11 +01:00
|
|
|
je .exit.redraw ; window type 4
|
|
|
|
|
|
|
|
push eax ebx edx esi
|
|
|
|
|
|
|
|
mov eax, edi
|
|
|
|
sub eax, window_data
|
|
|
|
shr eax, 5
|
|
|
|
|
|
|
|
movzx eax, word[WIN_STACK + eax * 2] ; get value of the curr process
|
|
|
|
lea esi, [WIN_POS + eax * 2] ; get address of this process at 0xC400
|
2012-03-08 14:45:18 +01:00
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
|
|
|
.next_window:
|
2010-01-05 02:28:11 +01:00
|
|
|
add esi, 2
|
|
|
|
|
|
|
|
mov eax, [TASK_COUNT]
|
|
|
|
lea eax, word[WIN_POS + eax * 2] ; number of the upper window
|
|
|
|
|
|
|
|
cmp esi, eax
|
|
|
|
ja .exit.no_redraw
|
|
|
|
|
|
|
|
movzx edx, word[esi]
|
|
|
|
shl edx, 5
|
|
|
|
cmp [CURRENT_TASK + edx + TASKDATA.state], TSTATE_FREE
|
|
|
|
je .next_window
|
|
|
|
|
|
|
|
mov eax, [edi + WDATA.box.top]
|
|
|
|
mov ebx, [edi + WDATA.box.height]
|
|
|
|
add ebx, eax
|
|
|
|
|
|
|
|
mov ecx, [window_data + edx + WDATA.box.top]
|
|
|
|
cmp ecx, ebx
|
|
|
|
jge .next_window
|
|
|
|
add ecx, [window_data + edx + WDATA.box.height]
|
|
|
|
cmp eax, ecx
|
|
|
|
jge .next_window
|
|
|
|
|
|
|
|
mov eax, [edi + WDATA.box.left]
|
|
|
|
mov ebx, [edi + WDATA.box.width]
|
|
|
|
add ebx, eax
|
|
|
|
|
|
|
|
mov ecx, [window_data + edx + WDATA.box.left]
|
|
|
|
cmp ecx, ebx
|
|
|
|
jge .next_window
|
|
|
|
add ecx, [window_data + edx + WDATA.box.width]
|
|
|
|
cmp eax, ecx
|
|
|
|
jge .next_window
|
|
|
|
|
|
|
|
pop esi edx ebx eax
|
2012-03-08 14:45:18 +01:00
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
|
|
|
.exit.redraw:
|
2010-01-05 02:28:11 +01:00
|
|
|
xor ecx, ecx
|
|
|
|
inc ecx
|
|
|
|
ret
|
2012-03-08 14:45:18 +01:00
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
|
|
|
.exit.no_redraw:
|
2010-01-05 02:28:11 +01:00
|
|
|
pop esi edx ebx eax
|
|
|
|
xor ecx, ecx
|
|
|
|
ret
|
2012-03-08 14:45:18 +01:00
|
|
|
;------------------------------------------------------------------------------
|
2010-01-05 02:28:11 +01:00
|
|
|
align 4
|
|
|
|
;------------------------------------------------------------------------------
|
2010-02-06 20:08:19 +01:00
|
|
|
window._.draw_window_caption: ;////////////////////////////////////////////////
|
2010-01-05 02:28:11 +01:00
|
|
|
;------------------------------------------------------------------------------
|
2010-02-06 20:08:19 +01:00
|
|
|
;? <description>
|
2010-01-05 02:28:11 +01:00
|
|
|
;------------------------------------------------------------------------------
|
2010-02-06 20:08:19 +01:00
|
|
|
xor eax, eax
|
|
|
|
mov edx, [TASK_COUNT]
|
|
|
|
movzx edx, word[WIN_POS + edx * 2]
|
|
|
|
cmp edx, [CURRENT_TASK]
|
|
|
|
jne @f
|
|
|
|
inc eax
|
2012-03-08 14:45:18 +01:00
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
|
|
|
@@:
|
2011-10-14 23:38:50 +02:00
|
|
|
mov edx, [CURRENT_TASK]
|
2010-02-06 20:08:19 +01:00
|
|
|
shl edx, 5
|
|
|
|
add edx, window_data
|
|
|
|
movzx ebx, [edx + WDATA.fl_wstyle]
|
|
|
|
and bl, 0x0F
|
|
|
|
cmp bl, 3
|
|
|
|
je .draw_caption_style_3
|
|
|
|
cmp bl, 4
|
|
|
|
je .draw_caption_style_3
|
|
|
|
|
|
|
|
jmp .not_style_3
|
2012-03-08 14:45:18 +01:00
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
|
|
|
.draw_caption_style_3:
|
2010-02-06 20:08:19 +01:00
|
|
|
push edx
|
|
|
|
call drawwindow_IV_caption
|
|
|
|
add esp, 4
|
|
|
|
jmp .2
|
2012-03-08 14:45:18 +01:00
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
|
|
|
.not_style_3:
|
2010-02-06 20:08:19 +01:00
|
|
|
cmp bl, 2
|
|
|
|
jne .not_style_2
|
|
|
|
|
|
|
|
call drawwindow_III_caption
|
|
|
|
jmp .2
|
2012-03-08 14:45:18 +01:00
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
|
|
|
.not_style_2:
|
2010-02-06 20:08:19 +01:00
|
|
|
cmp bl, 0
|
|
|
|
jne .2
|
|
|
|
|
|
|
|
call drawwindow_I_caption
|
2012-03-08 14:45:18 +01:00
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
|
|
|
.2:
|
2011-10-14 23:38:50 +02:00
|
|
|
mov edi, [CURRENT_TASK]
|
2010-02-06 20:08:19 +01:00
|
|
|
shl edi, 5
|
|
|
|
test [edi + window_data + WDATA.fl_wstyle], WSTYLE_HASCAPTION
|
|
|
|
jz .exit
|
|
|
|
mov edx, [edi * 8 + SLOT_BASE + APPDATA.wnd_caption]
|
|
|
|
or edx, edx
|
|
|
|
jz .exit
|
|
|
|
|
|
|
|
movzx eax, [edi + window_data + WDATA.fl_wstyle]
|
|
|
|
and al, 0x0F
|
|
|
|
cmp al, 3
|
|
|
|
je .skinned
|
|
|
|
cmp al, 4
|
|
|
|
je .skinned
|
|
|
|
|
|
|
|
jmp .not_skinned
|
2012-03-08 14:45:18 +01:00
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
|
|
|
.skinned:
|
2010-02-06 20:08:19 +01:00
|
|
|
mov ebp, [edi + window_data + WDATA.box.left - 2]
|
|
|
|
mov bp, word[edi + window_data + WDATA.box.top]
|
|
|
|
movzx eax, word[edi + window_data + WDATA.box.width]
|
|
|
|
sub ax, [_skinmargins.left]
|
|
|
|
sub ax, [_skinmargins.right]
|
|
|
|
push edx
|
|
|
|
cwde
|
|
|
|
cdq
|
|
|
|
mov ebx, 6
|
|
|
|
idiv ebx
|
|
|
|
pop edx
|
|
|
|
or eax, eax
|
|
|
|
js .exit
|
|
|
|
|
|
|
|
mov esi, eax
|
|
|
|
mov ebx, dword[_skinmargins.left - 2]
|
|
|
|
mov bx, word[_skinh]
|
|
|
|
sub bx, [_skinmargins.bottom]
|
|
|
|
sub bx, [_skinmargins.top]
|
|
|
|
sar bx, 1
|
|
|
|
adc bx, 0
|
|
|
|
add bx, [_skinmargins.top]
|
|
|
|
add bx, -3
|
|
|
|
add ebx, ebp
|
|
|
|
jmp .dodraw
|
2012-03-08 14:45:18 +01:00
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
|
|
|
.not_skinned:
|
2010-02-06 20:08:19 +01:00
|
|
|
cmp al, 1
|
|
|
|
je .exit
|
|
|
|
|
|
|
|
mov ebp, [edi + window_data + WDATA.box.left - 2]
|
|
|
|
mov bp, word[edi + window_data + WDATA.box.top]
|
|
|
|
movzx eax, word[edi + window_data + WDATA.box.width]
|
|
|
|
sub eax, 16
|
|
|
|
push edx
|
|
|
|
cwde
|
|
|
|
cdq
|
|
|
|
mov ebx, 6
|
|
|
|
idiv ebx
|
|
|
|
pop edx
|
|
|
|
or eax, eax
|
|
|
|
js .exit
|
|
|
|
|
|
|
|
mov esi, eax
|
|
|
|
mov ebx, 0x00080007
|
|
|
|
add ebx, ebp
|
2012-03-08 14:45:18 +01:00
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
|
|
|
.dodraw:
|
2010-02-06 20:08:19 +01:00
|
|
|
mov ecx, [common_colours + 16]
|
|
|
|
or ecx, 0x80000000
|
|
|
|
xor edi, edi
|
|
|
|
call dtext_asciiz_esi
|
2012-03-08 14:45:18 +01:00
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
|
|
|
.exit:
|
2012-03-12 19:26:37 +01:00
|
|
|
; call [draw_pointer]
|
|
|
|
call __sys_draw_pointer
|
2010-01-05 02:28:11 +01:00
|
|
|
ret
|
2012-03-08 14:45:18 +01:00
|
|
|
;------------------------------------------------------------------------------
|
2010-02-06 20:08:19 +01:00
|
|
|
align 4
|
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
window._.draw_negative_box: ;//////////////////////////////////////////////////
|
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
;? Draw negative box
|
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
;> edi = pointer to BOX struct
|
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
push eax ebx esi
|
2011-09-23 04:33:18 +02:00
|
|
|
mov esi, 0x01000000
|
2012-03-08 14:45:18 +01:00
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
2011-09-23 04:33:18 +02:00
|
|
|
.1:
|
2010-02-06 20:08:19 +01:00
|
|
|
mov eax, [edi + BOX.left - 2]
|
|
|
|
mov ax, word[edi + BOX.left]
|
|
|
|
add ax, word[edi + BOX.width]
|
|
|
|
mov ebx, [edi + BOX.top - 2]
|
|
|
|
mov bx, word[edi + BOX.top]
|
|
|
|
add bx, word[edi + BOX.height]
|
|
|
|
call draw_rectangle.forced
|
|
|
|
pop esi ebx eax
|
|
|
|
ret
|
2011-09-23 04:33:18 +02:00
|
|
|
;------------------------------------------------------------------------------
|
2012-05-24 00:29:15 +02:00
|
|
|
;align 4
|
2012-03-08 14:45:18 +01:00
|
|
|
;------------------------------------------------------------------------------
|
2012-05-24 00:29:15 +02:00
|
|
|
;window._.end_moving__box: ;//////////////////////////////////////////////////
|
2011-09-23 04:33:18 +02:00
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
;? Draw positive box
|
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
;> edi = pointer to BOX struct
|
|
|
|
;------------------------------------------------------------------------------
|
2012-05-24 00:29:15 +02:00
|
|
|
; push eax ebx esi
|
|
|
|
; xor esi, esi
|
|
|
|
; jmp window._.draw_negative_box.1
|
2012-03-08 14:45:18 +01:00
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
align 4
|
2012-02-02 09:42:35 +01:00
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
window._.get_rect: ;/////////////////////////////////////////////////////
|
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
;? <description> void __fastcall get_window_rect(struct RECT* rc);
|
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
;> ecx = pointer to RECT
|
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
mov eax, [TASK_BASE]
|
|
|
|
|
|
|
|
mov edx, [eax-twdw + WDATA.box.left]
|
|
|
|
mov [ecx+RECT.left], edx
|
|
|
|
|
|
|
|
add edx, [eax-twdw + WDATA.box.width]
|
|
|
|
mov [ecx+RECT.right], edx
|
|
|
|
|
|
|
|
mov edx, [eax-twdw + WDATA.box.top]
|
|
|
|
mov [ecx+RECT.top], edx
|
|
|
|
|
|
|
|
add edx, [eax-twdw + WDATA.box.height]
|
|
|
|
mov [ecx+RECT.bottom], edx
|
|
|
|
ret
|
2012-03-08 14:45:18 +01:00
|
|
|
;------------------------------------------------------------------------------
|