Added f18.25: the ability to make a window on top of all and behind all

git-svn-id: svn://kolibrios.org@5836 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
GerdtR 2015-10-09 13:59:11 +00:00
parent 2fadaa9c40
commit b4331f8494
6 changed files with 302 additions and 3 deletions

View File

@ -581,7 +581,7 @@ destroy_thread:
mov [esi+WDATA.cl_workarea], eax
mov [esi+WDATA.cl_titlebar], eax
mov [esi+WDATA.cl_frames], eax
mov dword [esi+WDATA.reserved], eax; clear all flags: wstate, redraw, wdrawn
mov dword [esi+WDATA.z_modif], eax; clear all flags: z_modif, wstate, redraw, wdrawn
lea edi, [esi-window_data+draw_data]
mov ecx, 32/4
rep stosd

View File

@ -1144,6 +1144,37 @@ dd 1675
* Размеры указываемые в функции не должны превышать размеры текущего
видеорежима, иначе функция ничего не изменит.
======================================================================
===================== Функция 18, подфункция 25 ======================
======== Управление положением окна относительно других окон. ========
======================================================================
------------- Подподфункция 1 - получить положение ------------------
Параметры:
* eax = 18 - номер функции
* ebx = 25 - номер подфункции
* ecx = 1 - номер подподфункции
* edx = -1(для текущего окна) или PID приложения
Возвращаемое значение:
* eax = одна из констант положения окна
------------- Подподфункция 2 - установить положение ----------------
Параметры:
* eax = 18 - номер функции
* ebx = 25 - номер подфункции
* ecx = 2 - номер подподфункции
* edx = -1(для текущего окна) или PID приложения
* esi = новое положение окна (одна из констант ниже)
Возвращаемое значение:
* eax = 0 - неудача
* eax = 1 - успех
Константы положения окна относительно других окон:
ZPOS_NORMAL = 0 - обычное
ZPOS_ALWAYS_BACK = 1 - позади всех окон
ZPOS_DESKTOP = 2 - на самом заднем плане
ZPOS_ALWAYS_TOP = 3 - поверх всех окон
======================================================================
==================== Функция 20 - интерфейс MIDI. ====================
======================================================================

View File

@ -1144,6 +1144,37 @@ Remarks:
of the current video mode, otherwise the function will not change
anything.
======================================================================
===================== Function 18, subfunction 25 ====================
===== Control position of the window relative to other windows. ======
======================================================================
------------- Subsubfunction 1 - get position -----------------------
Parameters:
* eax = 18 - function number
* ebx = 25 - subfunction number
* ecx = 1 - subsubfunction number
* edx = -1(for current window) or PID application
Returned value:
* eax = one of the constants window position
------------- Subsubfunction 2 - set position -----------------------
Parameters:
* eax = 18 - function number
* ebx = 25 - subfunction number
* ecx = 2 - subsubfunction number
* edx = -1(for current window) or PID application
* esi = new window position (one of the constants below)
Returned value:
* eax = 0 - error
* eax = 1 - success
Constant position of the window relative to other windows:
ZPOS_NORMAL = 0 - normal
ZPOS_ALWAYS_BACK = 1 - behind all the windows
ZPOS_DESKTOP = 2 - on the background
ZPOS_ALWAYS_TOP = 3 - on top of all windows
======================================================================
==================== Function 20 - MIDI interface. ===================
======================================================================

View File

@ -486,6 +486,12 @@ align 4
pop ecx eax
ret
;------------------------------------------------------------------------------
iglobal
win_zmodi db ZPOS_DESKTOP,\
ZPOS_ALWAYS_BACK,\
ZPOS_NORMAL,\
ZPOS_ALWAYS_TOP
endg
align 4
;------------------------------------------------------------------------------
calculatescreen: ;/////////////////////////////////////////////////////////////
@ -511,12 +517,21 @@ calculatescreen: ;/////////////////////////////////////////////////////////////
cmp ebp, 1
jbe .exit
push eax ;for num layout
push edx ecx ebx eax
mov dword[esp+14], 0
;--------------------------------------
align 4
.layout:
mov esi, 1 ; = num in window stack
mov ebp, [TASK_COUNT]
;--------------------------------------
align 4
.next_window:
movzx edi, word[WIN_POS + esi * 2]
shl edi, 5
shl edi, 5 ;size of TASKDATA and WDATA = 32 bytes
cmp [CURRENT_TASK + edi + TASKDATA.state], TSTATE_FREE
je .skip_window
@ -525,6 +540,11 @@ align 4
test [edi + WDATA.fl_wstate], WSTATE_MINIMIZED
jnz .skip_window
mov eax, [esp+14]
mov al, [eax+win_zmodi]
cmp [edi + WDATA.z_modif], al
jne .skip_window
mov eax, [edi + WDATA.box.left]
cmp eax, [esp + RECT.right]
jg .skip_window
@ -574,8 +594,18 @@ align 4
inc esi
dec ebp
jnz .next_window
;---------------------------------------------
inc dword[esp+14]
cmp dword[esp+14], ZPOS_ALWAYS_TOP
jbe .layout
;---------------------------------------------
mov esi, [TASK_COUNT]
movzx edi, word[WIN_POS + esi * 2]
shl edi, 5
add edi, window_data
pop eax ebx ecx edx
pop ebp ;del num layout
;--------------------------------------
align 4
.exit:
@ -1028,6 +1058,9 @@ waredraw: ;////////////////////////////////////////////////////////////////////
mov edi, [TASK_COUNT]
movzx esi, word[WIN_POS + edi * 2]
call window._.set_screen
call window._.set_top_wnd ;Fantomer
inc [_display.mask_seqno]
popad
@ -1197,6 +1230,11 @@ align 4
add ecx, eax
add edx, ebx
call ebp
cmp ebp, window._.set_screen
jne @f
call window._.set_top_wnd
@@:
inc [_display.mask_seqno]
;--------------------------------------
align 4
@ -1379,6 +1417,9 @@ sys_window_end_moving_handler: ;///////////////////////////////////////////////
; mov edi, ebx
; call window._.end_moving__box
mov edi, ebx
call window._.draw_negative_box
mov edi, esi
shl edi, 5
add edi, window_data
@ -2435,3 +2476,132 @@ window._.get_rect: ;/////////////////////////////////////////////////////
mov [ecx+RECT.bottom], edx
ret
;------------------------------------------------------------------------------
align 4
;------------------------------------------------------------------------------
window._.set_top_wnd: ;////////////////////////////////////////////////////////
;------------------------------------------------------------------------------
;? updates all windows one above the window
;------------------------------------------------------------------------------
;> eax = left
;> ebx = top
;> ecx = right
;> edx = bottom
;> esi = process number
;! corrupted edi
;------------------------------------------------------------------------------
movzx edi, word[WIN_POS + esi * 2]
shl edi, 5
cmp [edi + window_data + WDATA.z_modif], ZPOS_ALWAYS_TOP
jne @f
ret
@@:
push esi
pushfd
cli
push ebp
mov ebp, [TASK_COUNT]
cmp ebp, 1
jbe .exit
push eax ;for num layout
push edx ecx ebx eax
movzx eax, byte [edi + window_data + WDATA.z_modif]
inc eax
mov dword[esp+14], eax
;--------------------------------------
align 4
.layout:
mov esi, 1 ; = num in window stack
mov ebp, [TASK_COUNT]
;--------------------------------------
align 4
.next_window:
movzx edi, word[WIN_POS + esi * 2]
shl edi, 5 ;size of TASKDATA and WDATA = 32 bytes
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, [esp+14]
mov al, [eax+win_zmodi]
cmp [edi + WDATA.z_modif], al
jne .skip_window
mov eax, [edi + WDATA.box.left]
cmp eax, [esp + RECT.right]
jg .skip_window
mov ebx, [edi + WDATA.box.top]
cmp ebx, [esp + RECT.bottom]
jg .skip_window
mov ecx, [edi + WDATA.box.width]
add ecx, eax
cmp ecx, [esp + RECT.left]
jl .skip_window
mov edx, [edi + WDATA.box.height]
add edx, ebx
cmp edx, [esp + RECT.top]
jl .skip_window
cmp eax, [esp + RECT.left]
jae @f
mov eax, [esp + RECT.left]
;--------------------------------------
align 4
@@:
cmp ebx, [esp + RECT.top]
jae @f
mov ebx, [esp + RECT.top]
;--------------------------------------
align 4
@@:
cmp ecx, [esp + RECT.right]
jbe @f
mov ecx, [esp + RECT.right]
;--------------------------------------
align 4
@@:
cmp edx, [esp + RECT.bottom]
jbe @f
mov edx, [esp + RECT.bottom]
;--------------------------------------
align 4
@@:
push esi
movzx esi, word[WIN_POS + esi * 2]
call window._.set_screen
pop esi
mov [edi + WDATA.fl_redraw], 1 ;set redraw flag
;--------------------------------------
align 4
.skip_window:
inc esi
dec ebp
jnz .next_window
;--------------------------------------
inc dword[esp+14]
cmp dword[esp+14], ZPOS_ALWAYS_TOP
jbe .layout
;-------------------------------------
pop eax ebx ecx edx
pop ebp ;del num layout
;-------------------------------------
align 4
.exit:
pop ebp
popfd
pop esi
ret

View File

@ -2231,6 +2231,8 @@ sys_system_table:
dd sysfn_min_rest_window ; 22 = minimize and restore any window
dd sysfn_min_windows ; 23 = minimize all windows
dd sysfn_set_screen_sizes ; 24 = set screen sizes for Vesa
dd sysfn_zmodif ; 25 = get/set window z modifier ;Fantomer
sysfn_num = ($ - sys_system_table)/4
endg
;------------------------------------------------------------------------------
@ -2390,6 +2392,67 @@ sysfn_activate: ; 18.3 = ACTIVATE WINDOW
.nowindowactivate:
ret
;------------------------------------------------------------------------------
align 4 ;Fantomer
sysfn_zmodif:
;18,25,1 - get z_modif
;18,25,2 - set z_modif
;edx = -1(for current task) or TID
;esi(for 2) = new value z_modif
;return:
;1: eax = z_modif
;2: eax=0(fail),1(success) for set z_modif
xor eax, eax
cmp edx, -1
jne @f
mov edx, [CURRENT_TASK]
@@:
cmp edx, [TASK_COUNT]
ja .exit
cmp edx, 1
je .exit
shl edx, 5
cmp [edx + CURRENT_TASK + TASKDATA.state], 9
je .exit
cmp ecx, 1
jnz .set_zmod
mov al, [edx + window_data + WDATA.z_modif]
jmp .exit
align 4
.set_zmod:
cmp ecx, 2
jnz .exit
mov eax, esi
mov esi, edx
cmp al, ZPOS_ALWAYS_TOP
ja .exit
mov [edx + window_data + WDATA.z_modif], al
mov eax, [edx + window_data + WDATA.box.left]
mov ebx, [edx + window_data + WDATA.box.top]
mov ecx, [edx + window_data + WDATA.box.width]
mov edx, [edx + window_data + WDATA.box.height]
add ecx, eax
add edx, ebx
call window._.set_top_wnd
mov eax, 1
align 4
.exit:
mov [esp+32], eax
ret
;------------------------------------------------------------------------------
sysfn_getidletime: ; 18.4 = GET IDLETIME
mov eax, [CURRENT_TASK+32+TASKDATA.cpu_usage]
mov [esp+32], eax

View File

@ -76,13 +76,17 @@ TSTATE_TERMINATING = 4
TSTATE_WAITING = 5
TSTATE_FREE = 9
ZPOS_NORMAL = 0
ZPOS_ALWAYS_BACK = 1
ZPOS_DESKTOP = 2
ZPOS_ALWAYS_TOP = 3 ;ZPOS_ALWAYS_TOP is always last and has max number!
; structures definition
struct WDATA
box BOX
cl_workarea dd ?
cl_titlebar dd ?
cl_frames dd ?
reserved db ?
z_modif db ?
fl_wstate db ?
fl_wdrawn db ?
fl_redraw db ?