This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -573,6 +573,12 @@ SWIWimp_Extend ROUT
B extend_getborderinfo
B extend_ncerrorpointersuspend
B extend_spritesuffix
B extend_getvalidationstring
[ ExtendReadSlotSize
B extend_readslotsize
B badextend
ASSERT . - %BT00 = WimpExtend_MAX*4
......@@ -1067,4 +1073,106 @@ extend_getborderinfo ROUT
STR cx0, furnblock_left
B ExitWimp ; all done
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]
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
LDRNE R5,[R10,#i_data+4] ; pointer to validation string
AcceptLoosePointer_NegOrZero R5,-1
CMP R5,R5,ASR #31
BEQ %FT30 ; nothing to do
LDR R6,taskhandle
Push "R6" ; current task
; page in task
Task R14,,"Get validation string"
; R5 -> validation string
; count length
MOV R6,#0
LDRB R0,[R1],#1
ADD R6,R6,#1
CMP R0,#32
; R6 = length inc terminator
; copy validation string
; enough room?
BMI %FT29 ; no, so return the space needed
LDRB R0,[R5],#1
CMP R0,#32
MOVLT R0,#0 ; force the terminator to be 0
STRB R0,[R3],#1
; page out if necessary
Pull "R14"
Task R14,,"Restore after get validation string"
Pull "R1-R3,R5-R6,handle,R14"
MOV R0,#WimpExtend_GetValidationString
B ExitWimp2
; bad icon
Pull "R1-R3,R5-R6,handle,R14"
MyXError WimpBadIconHandle,,L
B ExitWimp
[ ExtendReadSlotSize
extend_readslotsize ROUT
; Read current + next + free memory values (as per Wimp_SlotSize), but
; return values are in units of pages
LDRB R0,osdynamicarea27
MOV R1,#-1
SWI XOS_DynamicArea
BVS ExitWimp
CMP R0,#DAReason_ReturnFree
MOVEQ R2,R2,LSR #12 ; Assume 4K pages
LDR R1,slotsize ; Already page count
MOV R0,#MemoryLimit ; may not actually be full slot size
MOV R1,#0 ; (eg. if Twin is running above)
SWI XOS_ChangeEnvironment
SUBVC R0,R1,#ApplicationStart ; R0 = actual slot size
B ExitWimp
......@@ -56,11 +56,13 @@ Module_BaseAddr
GET hdr:Switcher
GET hdr:PDriver
GET hdr:ScrBlank
GET hdr:OsBytes
GET hdr:OsWords
GET hdr:Countries
GET hdr:Internatio
GET hdr:VFPSupport
GET hdr:OSMem
GET VersionASM
......@@ -109,4 +111,9 @@ LoadWimpOptions SETS "GET Options.s.$Options"
GET Trace.s
[ CnP
GET Clipboard.s
GET CBTask.s
This diff is collapsed.
......@@ -3519,6 +3519,31 @@ setfontcolours
Pull "R0-R3, PC"
[ CnP
;; If we have a parked Message_DataLoad, certain calls need to clear it
;; but only if the recipient task hasn't called Wimp_Poll
;; (which will set the poll word)
Push "R0,R14"
LDR R14,clipboard_spritearea_addr
TEQ R14,#0
Pull "R0,PC",EQ ; no system in use, skip check
ADRL R14,clipboard_pollword
LDR R0,[R14]
TST R0,#clipboard_pw_dataload_flag
Pull "R0,PC",NE ; is active, do not touch
MOV R0,#0
LDR R14,clipboard_spritearea_addr
ADD R14,R14,#cnp_message_dataload_park
STR R0,[R14] ; clear the parked message
Pull "R0,PC"
;; Force_Redraw - mark specified region invalid - will be redrawn later
;; Entry: R0 = window handle (if -1, then consider whole screen)
......@@ -3537,6 +3562,10 @@ SWIWimp_ForceRedraw
BVS ExitWimp ; this is pointless
[ CnP
BL cnp_clear_parked_dataload
MOV handle,R0 ; now only -1 => redraw whole screen
CMP handle,#-1 ; (-2 => redraw icon bar)
......@@ -3775,7 +3804,9 @@ crw5e
[ CnP
MOV R14, #nullptr
STR R14, [handle, #w_seldata] ; no icon contains a selection
STR R14, [handle, #w_seldata+wselicon] ; no icon contains a selection
MOV R14, #bignum
STR R14, [handle,#w_seldata+wselxoverride] ; no offset
; Window is now completely valid
......@@ -4287,11 +4318,23 @@ int_delete_window
BL byemessages ; R0 = window handle
; don't deliver messages for this one
[ CnP
Push "R11"
MOV R11,R0
BL clipboard_check_current_drag_op ; abort any selection drag in progress
Pull "R11"
MOV handle,R0
BL checkhandle
BLVC nocaret ; R0,handle = rel/abs handles
Pull "R1-R9,PC",VS
[ CnP
Push "R2"
MOV R2,#-1
BL cbtask_check_abort_drag ; abort any current icon text export drag
Pull "R2"
LDR R14,pending_window
TEQ R14,R0
......@@ -4412,11 +4455,47 @@ int_deleteicon
Rel R0,handle
LDR R14,caretdata
TEQ R14,R0
LDREQ R14,caretdata+4
LDREQ R14,caretdata+careticon
TEQEQ R14,R2 ; R2 not null!
MOVEQ R0,#nullptr
BLEQ int_set_caret_position ; turn off caret if nec.
[ CnP
BL cbtask_check_abort_drag ; stop any drag export if there's one running for this icon
LDR R14,ghostcaretdata
TEQ R14,R0
LDREQ R14,ghostcaretdata+ghostcareticon
Push "R2,R3"
MOV R0,#nullptr
LDR R2,=taskidentifier
MOV R3,#crf_ghostcaret
BL int_set_caret_position ; turn off ghost caret if nec.
Pull "R2,R3"
LDR R14,[R6,#w_seldata+wselicon] ; text selection in this icon?
TEQ R14,R2
BNE %FT10 ; nope
; was this window the currently active selection?
LDR R14,selectionwindow
TEQ R14,R0 ; well, was it?
; kill the selection fully
Push "R2,R3"
MOV R0,#nullptr
LDR R2,=taskidentifier
MOV R3,#crf_selection
BL int_set_caret_position
Pull "R2,R3"
MOV R0,#nullptr
STR R0,[R6,#w_seldata+wselicon] ; clear selection data in this window as the icon is going away
MOV handle,R6 ; Restore window handle
LDR R3,[handle,#w_nicons]
LDR R0,[handle,#w_icons]
......@@ -7756,13 +7835,51 @@ SWIWimp_CloseWindow
; In R0 = relative window handle of window being closed
; [caretdata+0] = relative window handle of window with caret
; Out [caretdata+0] = -1 if this window was closed
; [caretdata+caretwindow] = relative window handle of window with caret
; Out [caretdata+caretwindow] = -1 if this window was closed
; [menucaretwindow] = -1 likewise
[ CnP
; In [ghostcaretdata+ghostcaretwindow] = relative handle of ghost caret window
; [selectionwindow] = current unshaded selection
; Out [ghostcaretdata+ghostcaretwindow] =-1 if this window closed
; [selectionwindow] =-1 if this window closed
Push "R0,R1,handle,LR"
[ CnP
; clear any selection in the window
Abs handle,R0
MOV R14,#nullptr
STR R14,[handle,#w_seldata+wselicon]
; ghost caret check
[ ChildWindows
LDR handle,ghostcaretdata
BL isparentof ; EQ if R0 is a parent of handle
MOVEQ R0,handle
LDR R14,ghostcaretdata ; turn caret off if nec.
TEQ R0,R14
MOVEQ R14,#nullptr
STREQ R14,ghostcaretdata
; check if it's the current active selection window
[ ChildWindows
LDR handle,selectionwindow
BL isparentof
MOVEQ R0,handle
LDR R14,selectionwindow
TEQ R0,R14
MOVEQ R14,#nullptr
STREQ R14,selectionwindow
[ ChildWindows
LDR handle,caretdata
BL isparentof ; EQ if R0 is a parent of handle
......@@ -7788,8 +7905,11 @@ nocaret
MOVEQ R14,#nullptr
STREQ R14,menucaretwindow
01 MOV R14,#0
[ :LNOT: CnP
MOV R14,#0
STR R14,caretscrollx
STRVS R0,[R13]
Pull "R0,R1,handle,PC"
......@@ -8042,6 +8162,10 @@ int_redraw_window
MOV R14,#-1
STR R14,hascaret ; -1 ==> icons do NOT have the caret
[ CnP
STR R14,hasselection ; no selection in border
STR R14,hasghostcaret ; no ghost caret in border
; set ecf origin to top-left of window border
......@@ -9540,6 +9664,10 @@ SWIWimp_UpdateWindow
LDR handle,[userblk]
BL checkhandle_owner
BVS ExitWimp
[ CnP
BL cnp_clear_parked_dataload
ADD R14,userblk,#u_wax0
LDMIA R14,{x0,y0,x1,y1}
MOV R0,#getrect_firstrect:OR:getrect_updating
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -863,6 +863,84 @@ checkformessage
Entry "R0-R4"
[ CnP
; check to see if we are sending a Message_DataLoad to a writeable icon
; if so, we may need to handle this separately later on for drag/drop purposes
LDR R14,[R2,#ms_action + msb_size]
TEQ R14,#Message_DataLoad
ADRL R14,clipboard_taskhandle
LDR R14,[R14]
TEQ R5,R14
BEQ %FT90 ; no need to mess with messages to us
LDR R14,[R2,#ms_taskhandle + msb_size]
TEQ R5,R14
BEQ %FT90 ; we sent it, so no need to interfere
LDR R14,[R2,#msDataTransfer_filetype + msb_size]
LDR R4,=FileType_Text
TEQ R4,R14
BNE %FT90 ; not a Text file, so ignore
Push "handle"
LDR handle,[R2,#msDataTransfer_window + msb_size]
BL checkhandle
BVC %FT10 ; window handle in the message is valid
B %FT89 ; suppress error if handle not valid and continue message delivery as normal
LDR R14,[R2,#msDataTransfer_icon + msb_size]
LDR R4,[handle,#w_nicons]
CMP R14,R4
BHS %FT89 ; icon handle not valid, so abort and continue message delivery as normal
LDR R4,[handle,#w_icons]
ADD R4,R4,R14,LSL #i_shift
LDR R4,[R4,#i_flags]
AND R4,R4,#if_buttontype
TEQ R4,#ibt_writeable :SHL: ib_buttontype
TEQNE R4,#ibt_dwritable :SHL: ib_buttontype
BNE %FT89 ; icon is not writeable, so no need to interfere
; we're possibly going to interfere with this message
; for now, take a copy of the message and allow it to propagate as normal
; if the message is not handled then we'll pick it up later on
LDR R0,clipboard_spritearea_addr
TEQ R0,#0
BEQ %FT89 ; no valid store for message, so give up
; is it the original or a bounce?
LDR R14,[R2,#16] ; gets wimp_poll reason code
; if it's a bounce, we block it. We will take over handling and will fake a bounce if need be.
TEQ R14,#User_Message_Acknowledge
ANDEQ R5,R5,#msf_broadcast
Pull "handle",EQ
ADRL R14,clipboard_pollword
LDR R1,[R14]
BIC R1,R1,#clipboard_pw_dataload_flag
STR R1,[R14] ; dataload flag is clear at the moment
; copy the message to our store area
Push "R2-R3"
ADD R2,R2,#msb_size
LDR R1,[R2,#ms_size] ; number of bytes to copy
ADD R0,R0,#cnp_message_dataload_park
LDR R3,[R2],#4
STR R3,[R0],#4
SUBS R1,R1,#4
Pull "R2-R3"
Pull "handle"
LDR R0,[R3,#task_messages]
LDR R1,[R3,#task_messagessize]
CMP R0,#nullptr ; are all messages enabled?
......@@ -1079,8 +1079,9 @@ mastertoactive ROUT
LDRHI R14,modeflags
ASSERT ModeFlag_DataFormatSub_RGB > 8
ANDHI R14,R14,#ModeFlag_DataFormatSub_RGB
ORRHI R5,R14,R5 ; force table creation for RGB (but not BGR) 32bpp
ASSERT ModeFlag_DataFormatSub_Alpha > 8
ANDHI R14,R14,#ModeFlag_DataFormatSub_RGB+ModeFlag_DataFormatSub_Alpha
ORRHI R5,R14,R5 ; force table creation for non-BGR 32bpp
LDR R2,ttt_activeset_at
TEQ R2,#0