Keyboard setup window - is there a magic word to specify "open menu"
Andrew Rawnsley (492) 1445 posts |
Hi folks, I’m trying to update things to avoid Keymapper, and want to ensure 2-button mouse users can still use RISC OS sensibly. This means that I want to be able to make the menu key on the keyboard open a menu. The keyboard setup plugin allows for actions to be set for the menu key. However, it is mostly about running programs. Part of me thinks that there a “magic word” to make menu open a menu, but I can’t recall. Am I being too hopeful, or is there something magic that can remove the need to keymap? |
Steve Pampling (1551) 8172 posts |
Wouldn’t it be better to modify the OS to include the functionality? This below, for example (bugs and all – doesn’t fall over on RPCEmu though) adds mouse related functionality to the desktop. (It’s a mod to the Filer.s.Keypress file) Anyway, be gentle when pointing the failings. Especially Rick :P Look for the ; Special keys (&180+) subtract &180 for easy handling SUB r2, r0, #&180 ; Function keys TEQ r2, #&1 ; F1 BEQ DecodeMenu_File_Help ; F1 key action => display help on object if available (like RO6/QFiler/Windows) TEQ r2, #&11 ; Shift-F1 BEQ key_info ; Shift-F1 key action => display Info on object if available (RO6) TEQ r2, #&5 ; F5 BEQ DecodeMenu_Refresh ; F5 key action => force refresh of directory view (RO6/Windows) TEQ r2, #&A ; TAB ;ROOL option BEQ key_next_dir ; TAB key action => step through the stack of filer windows TEQ r2, #&1A ; Shift-TAB ;ROOL option BEQ key_prev_dir ; Shift-TAB key action => step backward through stack of filer windows TEQ r2, #&22 ; Ctrl-F2 BEQ key_close_dir ; ROOL option matches RO6 ;If this is added to Filer it's only active when Filer has focus ; Mouse move codes TEQ r2, #&2C ; Ctrl-LeftArrow &1AC (&2C) BEQ key_leftarrow ; Ctrl-LeftArrow Action => Move mouse pointer left TEQ r2, #&2D ; Ctrl-RightArrow &1AD (&2D) BEQ key_rightarrow ; Ctrl-RightArrow action => Move mouse pointer right TEQ r2, #&2E ; Ctrl-DownArrow &1AE (&2E) BEQ key_downarrow ; Ctrl-DownArrow action => Move mouse pointer down TEQ r2, #&2F ; Ctrl-UpArrow &1AF (&2F) BEQ key_uparrow ; Ctrl-UpArrow action => Move mouse pointer up ; If this is added to Filer it's only active when Filer has focus ; Mouse buttons on keyboard TEQ r2, #&40 ; Logo &1C0 (&40) BEQ key_mbselect ; Logo action => imitate mouse select button TEQ r2, #&50 ; Sh-Logo &1D0 (&50) BEQ key_mbadjust ; Sh-Logo action => imitate mouse adjust button TEQ r2, #&60 ; Ctrl-Logo &1E0 (&60) BEQ key_mbmenu ; Ctrl-Logo action => imitate mouse menu button key_mbselect ; Logo &1C0 (&40) MOV R5,#&4 ; setup for an imitated select button click (mouse#4) MOV R6,#&0 ; and the clearance BL mssetup EXIT ; If this is added to Filer it's only active when Filer has focus key_mbadjust ; Sh-Logo &1D0 (&50) MOV R5,#&1 ; setup for an imitated adjust button click (mouse#1) MOV R6,#&0 ; and the clearance BL mssetup EXIT ; If this is added to Filer it's only active when Filer has focus key_mbmenu ; Ctrl-Logo &1E0 (&60) MOV R5,#&2 ; setup for an imitated menu button click (mouse#2) MOV R6,#&0 ; and the clearance mssetup ; If this is added to Filer it's only active when Filer has focus ADR R1, mousedata ; SGP this should point to mouse move data block SWI XWimp_GetPointerInfo ; STRB R5,[R1,#8] ; shove our button data in the mouse button status LDR R2,[R1,#&0C] ; =12 (block posn 12 = Window handle under pointer put into r2 msclickevent ; generate mouse click event ; If this is added to Filer it's only active when Filer has focus MOV r0, #6 ; mouse click event = 6 SWI XWimp_SendMessage ; send event STRB R6,[R1,#8] ; clear EXIT ;;;;;;;;;;;; key_info ; TODO EXIT ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; If this is added to Filer it's only active when Filer has focus key_leftarrow MVN R4,#16 MVN R5,#0 B moveptr EXIT key_rightarrow MOV R4,#16 MVN R5,#0 B moveptr EXIT key_downarrow MOV R4,#0 MVN R5,#16 B moveptr EXIT key_uparrow MOV R4,#0 MOV R5,#16 B moveptr EXIT moveptr ; r1 -> mousedata block ; r4 = x change in pixels ; r5 = y change in pixels Push "r14" ADR R1, mousedata ; SGP this should point to mouse move data block (this is mouseblk in Wimp04) SWI XWimp_GetPointerInfo LDMIA R1,{R7-R8} ; r7 = mouse x, r8 = mouse y MOV R0,#-1 ; -1 current mode TEQ R4,#0 ; MOVNE R1,#4 SWINE XOS_ReadModeVariable ; get the XEigFactor if left or right movement MOVNE R4,R4,LSL R2 ; R4 = OS hor. move TEQ R5,#0 MOVNE R1,#5 SWINE XOS_ReadModeVariable ; get the YEigFactor if up or down movement MOVNE R5,R5,lsl R2 ; R5 = OS vert. move ADD R2,R7,R4 ; r2 = r7 (old mouse x) + r4 (x move value) ADD R3,R8,R5 ; r3 = r8 (old mouse y) + r5 (y move value) BL setptr ; could do the set code here, but it might be a useful routine Pull "r14" EXIT setptr ; moves the pointer to a given position STMFD R13!,{R0-R2,R14} ADR R1, mousedata MOV R0,#3 STRB R0,[R1,#0] STRB R2,[R1,#1] MOV R0,R2,lsr #8 STRB R0,[R1,#2] STRB R3,[R1,#3] MOV R0,R3,lsr #8 STRB R0,[R1,#4] MOV R0,#21 SWI XOS_Word ; OS_Word 21_ move pointer LDMFD R13!,{R0-R2,PC} ;;;;;;;;;;;;;;;;;;;;;;;;;;; |
Rick Murray (539) 13851 posts |
Filer is a strange place to put it…….but, hey, if it works…. ;-) PS: Well done for bothering to check the Eigen values to move consistently. |
Steve Pampling (1551) 8172 posts |
Actually it was just an extension of the stuff I was playing with on Filer shortcut keys1 and at the time I couldn’t be Besides soft loading a new Filer module you can do with an Obey file to kill and load a replacement. 1 There’s a bit of evidence of some in that above that I forgot to trim out. Some of those just call existing code – don’t reinvent etc. 2 That was the origin of my comment about semi-random register use – similar stuff in different modules different registers. |
Steve Fryatt (216) 2105 posts |
But given that it’s just grabbing keypresses, it could be an application all to itself, couldn’t it? That would be the cleanest way to do it. |
Steve Pampling (1551) 8172 posts |
Well for that particular item, possibly. I did rather feel it should be in the OS ROM though. So the facility “just works” out of the box. With regard to the other key shortcuts I alluded to, well they borrow code from elsewhere in the Filer, and they are actually Filer shortcuts. Yes, the whole can be done outside the OS – I believe you will recognise the name QuickFiler? QFiler has to work a bit more since it’s accessing the OS features from outside. The cursor key stuff is me getting sidetracked from the main task I set myself. and then there’s: “Plus having something like alt-rightarrow, alt-leftarrow etc as the keys would be nice. Hit Alt-L there’s a key code, hit alt-arrow – nix” |
Steve Fryatt (216) 2105 posts |
That doesn’t stop it being a stand-alone item, though. If it’s not related to the Filer, keep it separate and both become easier to maintain in the future.
I do, but since QuickFiler is a patch to the Filer, that’s not relevant to my comment. If you’re adding functionality to the Filer, then the Filer is the place to do it. Otherwise, keep it separate. |
Steve Pampling (1551) 8172 posts |
I used slightly different words earlier, but I was being idle in using the Keypress element of the Filer source to hack in my modification. You’re quite correct it’s a WIMP function really (the “P” in WIMP). I’m quite surprised no one made any other comments as yet. I felt sure there was something wrong in there that I hadn’t had a crash on. Testing purely on RPCEmu does leave open the newer processor differences as a crash and burn opportunity. |
Steve Pampling (1551) 8172 posts |
Or, you can look at the OS keyboard handling. |
Steve Pampling (1551) 8172 posts |
Well, that’s been “fun” I think I’m beginning to understand a few things1 – like the fact that Function key definitions (which is the classification cursor keys fall in) don’t include Alt modified values (actually large parts of the keyboard don’t). For those that care, IKHG doesn’t seem to have a 26/32 problem but it relied on hacking the old binary table setup and the format has changed. There’s a cheery message in the source directory: 1 Firstly, you can pass a large amount of time figuring out how the keymap setup works… |