Commit 32f2e389 authored by ROOL's avatar ROOL 🤖 Committed by Robert Sprowson
Browse files

New Wimp_Extend subreason

Detail:
  Subreason 14 gives a means to read the validation string from a window/icon that is not in the current task. This is useful for determining whether clipboard operations should be allowed.
Admin:
  Submission for Clipboard Support bounty.

Version 5.64. Tagged as 'Wimp-5_64'
parent 87ea8ac2
......@@ -12,5 +12,5 @@
| See the License for the specific language governing permissions and
| limitations under the License.
|
WimpSlot -min 12K -max 12K
WimpSlot -min 64K -max 64K
/<Obey$Dir>.!RunImage
......@@ -9,12 +9,12 @@
GBLS Module_ApplicationDate
GBLS Module_HelpVersion
GBLS Module_ComponentName
Module_MajorVersion SETS "5.63"
Module_Version SETA 563
Module_MajorVersion SETS "5.64"
Module_Version SETA 564
Module_MinorVersion SETS ""
Module_Date SETS "05 Jun 2019"
Module_ApplicationDate SETS "05-Jun-19"
Module_Date SETS "22 Jun 2019"
Module_ApplicationDate SETS "22-Jun-19"
Module_ComponentName SETS "Wimp"
Module_FullVersion SETS "5.63"
Module_HelpVersion SETS "5.63 (05 Jun 2019)"
Module_FullVersion SETS "5.64"
Module_HelpVersion SETS "5.64 (22 Jun 2019)"
END
/* (5.63)
/* (5.64)
*
* This file is automatically maintained by srccommit, do not edit manually.
*
*/
#define Module_MajorVersion_CMHG 5.63
#define Module_MajorVersion_CMHG 5.64
#define Module_MinorVersion_CMHG
#define Module_Date_CMHG 05 Jun 2019
#define Module_Date_CMHG 22 Jun 2019
#define Module_MajorVersion "5.63"
#define Module_Version 563
#define Module_MajorVersion "5.64"
#define Module_Version 564
#define Module_MinorVersion ""
#define Module_Date "05 Jun 2019"
#define Module_Date "22 Jun 2019"
#define Module_ApplicationDate "05-Jun-19"
#define Module_ApplicationDate "22-Jun-19"
#define Module_ComponentName "Wimp"
#define Module_FullVersion "5.63"
#define Module_HelpVersion "5.63 (05 Jun 2019)"
#define Module_LibraryVersionInfo "5:63"
#define Module_FullVersion "5.64"
#define Module_HelpVersion "5.64 (22 Jun 2019)"
#define Module_LibraryVersionInfo "5:64"
......@@ -203,6 +203,8 @@ WimpExtend_SiblingBehind # 1 ; 10
WimpExtend_GetBorderInfo # 1 ; 11 Wimp 3.99 onwards
WimpExtend_NCErrorPointerSuspend # 1 ; 12 Private/STB-only
WimpExtend_SpriteSuffix # 1 ; 13 Wimp 4.85 onwards
WimpExtend_GetValidationString # 1 ; 14 Wimp 5.64 onwards
WimpExtend_MAX # 0
WimpExtend_SpriteSuffix_ROL * 257 ; ROOL Wimp 5.35 onwards
......@@ -273,6 +275,7 @@ WimpValidationKey_Arrow * 'A' ; Handle arrow keys
WimpValidationKey_Tab * 'T' ; Handle tab key
WimpValidationKey_Edit * 'D' ; Notify task of editing keys
WimpValidationKey_Any * 'N' ; Notify task of any key
WimpValidationKey_NoClipboard * 'C' ; Disable clipboard keyboard shortcuts for this icon
MACRO
$label BL_Wimp $n
......
......@@ -573,6 +573,7 @@ SWIWimp_Extend ROUT
B extend_getborderinfo
B extend_ncerrorpointersuspend
B extend_spritesuffix
B extend_getvalidationstring
ASSERT . - %BT00 = WimpExtend_MAX*4
extend_more
......@@ -1067,4 +1068,86 @@ extend_getborderinfo ROUT
STR cx0, furnblock_left
B ExitWimp ; all done
LTORG
extend_getvalidationstring ROUT
; Retrieve a validation string for an icon
; tricky to do by transferblock as there's no length information easily available
; On entry:
; R1 = window handle
; R2 = icon handle
; R3 -> buffer for data (must not be in application space or will get paged out!)
; R4 = buffer size
; On exit:
; R0 and V set if error
; R4 = bytes free in buffer
; So to find length of validation string first, call with R4 = 0.
; If returns with R4 = 0 then there's no validation string.
Push "R1-R3,R5-R6,handle,R14"
MOV handle,R1
BL checkhandle
Pull "R1-R3,R5-R6,handle,R14",VS
BVS ExitWimp
; check if icon is valid
LDR R6,[handle,#w_nicons]
CMP R2,R6
BHS %FT99
LDR R14,[handle,#w_taskhandle] ; ready for task paging
LDR R10,[handle,#w_icons]
ADD R10,R10,R2,LSL #i_shift
; R10 -> icon data block
LDR R5,[R10,#i_flags]
TST R5,#if_text
TSTNE R5,#if_indirected ; only IsT have validation
MOVEQ R5,#0
LDRNE R5,[R10,#i_data+4] ; pointer to validation string
AcceptLoosePointer_NegOrZero R5,-1
CMP R5,R5,ASR #31
MOVEQ R4,#0
BEQ %FT30 ; nothing to do
18
LDR R6,taskhandle
Push "R6" ; current task
; page in task
Task R14,,"Get validation string"
; R5 -> validation string
; count length
MOV R1,R5
MOV R6,#0
19
LDRB R0,[R1],#1
ADD R6,R6,#1
CMP R0,#32
BGE %BT19
20
; R6 = length inc terminator
; copy validation string
; enough room?
SUBS R4,R4,R6
BMI %FT29 ; no, so return the space needed
21
LDRB R0,[R5],#1
CMP R0,#32
MOVLT R0,#0 ; force the terminator to be 0
STRB R0,[R3],#1
BGE %BT21
29
; page out if necessary
Pull "R14"
Task R14,,"Restore after get validation string"
30
Pull "R1-R3,R5-R6,handle,R14"
MOV R0,#WimpExtend_GetValidationString
B ExitWimp2
99
; bad icon
Pull "R1-R3,R5-R6,handle,R14"
MyXError WimpBadIconHandle,,L
B ExitWimp
END
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment