Mouse driver improvements

-Removed use of PARAMn from interrupt handler
- Events now processed with location, not view ID
This commit is contained in:
Quinn Dunki 2015-02-03 11:01:09 -08:00
parent 766072a3c2
commit 7feec071c1
5 changed files with 34 additions and 20 deletions

View File

@ -449,14 +449,15 @@ X: WGPendingViewAction
</table>
####WGPendingView
Returns the currently pending view, if any. This is a way to peek into the state of the mouse event system, to see if the user is trying to do something with the mouse. Most programs shouldn't need this.
####WGPendingClick
Returns the currently pending click, if any. This is a way to peek into the state of the mouse event system, to see if the user is trying to do something with the pointer. Most programs shouldn't need this, but you can use it to do your own low-level click handling if you wish.
<table width="100%">
<tr><th>Assembly</th><th>Applesoft</th></tr><tr><td><pre>
X: WGPendingView
X: WGPendingClick
Returns in A: View ID
Returns in X: X coordinate of click, or $ff if none
Returns in Y: Y coordinate of click, if any
</td><td>
Not available
</td></tr>

View File

@ -848,7 +848,7 @@ WGAmpersand_MOUSEoff:
; Performs any pending view action
; &PDACT
WGAmpersand_PDACT:
lda WG_PENDINGACTIONVIEW
lda WG_MOUSECLICK_X
bmi WGAmpersand_PDACTdone
jsr WGPendingViewAction

16
mouse.s
View File

@ -339,15 +339,11 @@ WGMouseInterruptHandler_button:
bit WG_MOUSE_STAT ; Check for rising edge of button state
bpl WGMouseInterruptHandler_intDone
lda WG_MOUSEPOS_X ; Where did we click?
sta PARAM0
; Button was clicked, so make a note of location for later
lda WG_MOUSEPOS_X
sta WG_MOUSECLICK_X
lda WG_MOUSEPOS_Y
sta PARAM1
jsr WGViewFromPoint
bmi WGMouseInterruptHandler_intDone
; Button was clicked in a view, so make a note of it for later
sta WG_PENDINGACTIONVIEW
sta WG_MOUSECLICK_Y
WGMouseInterruptHandler_intDone:
pla ; Restore text bank
@ -542,6 +538,10 @@ WG_MOUSE_SLOT:
WG_MOUSE_SLOTSHIFTED:
.byte 0
WG_MOUSECLICK_X:
.byte $ff
WG_MOUSECLICK_Y:
.byte 0
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; ProDOS system call parameter blocks

27
views.s
View File

@ -819,9 +819,17 @@ WGViewFocusAction_knownRTS:
WGPendingViewAction:
SAVE_AY
lda WG_PENDINGACTIONVIEW
lda WG_MOUSECLICK_X
bmi WGPendingViewAction_done
sta PARAM0
lda WG_MOUSECLICK_Y
sta PARAM1
jsr WGViewFromPoint
sta WG_PENDINGACTIONVIEW
cmp #$ff
beq WGPendingViewAction_done
and #$f ; Select view in question
jsr WGSelectView
LDY_ACTIVEVIEW
@ -859,9 +867,10 @@ WGPendingViewAction_hasCallback:
jsr WGViewFocus
jsr WGViewFocusAction ; Trigger application to redraw contents
WGPendingViewAction_done: ; Centralized for branch range
WGPendingViewAction_done: ; Located here for branch range
lda #$ff
sta WG_PENDINGACTIONVIEW
sta WG_MOUSECLICK_X
RESTORE_AY
rts
@ -900,12 +909,16 @@ WGPendingViewAction_content:
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; WGPendingView
; Returns the view that is currently pending
; OUT A : Pending view ID, or $ff if none
; WGPendingClick
; Returns the mouse click that is currently pending
; OUT X,Y : Mouse coordinates, or $ff in X if none
;
WGPendingView:
lda WG_PENDINGACTIONVIEW
WGPendingClick:
ldx WG_MOUSECLICK_X
bmi WGPendingClick_done
ldy WG_MOUSECLICK_Y
WGPendingClick_done:
rts

Binary file not shown.