diff --git a/Documentation.md b/Documentation.md index c03c314..0197403 100644 --- a/Documentation.md +++ b/Documentation.md @@ -449,14 +449,15 @@ X: WGPendingViewAction -####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. diff --git a/applesoft.s b/applesoft.s index a55e3b8..cfe3caa 100644 --- a/applesoft.s +++ b/applesoft.s @@ -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 diff --git a/mouse.s b/mouse.s index f664cf7..179a1e0 100644 --- a/mouse.s +++ b/mouse.s @@ -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 diff --git a/views.s b/views.s index 7ea425c..03a8c24 100644 --- a/views.s +++ b/views.s @@ -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 diff --git a/weegui.dsk b/weegui.dsk index 90accd6..84c9bd4 100644 Binary files a/weegui.dsk and b/weegui.dsk differ
AssemblyApplesoft
-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
 
Not available