c-jo / cpython

RISC OS port of the Python programming language
https://www.python.org/
Other
7 stars 3 forks source link

Taskwindow not working while !Hyper viewer is open #26

Open riscman opened 11 months ago

riscman commented 11 months ago

When !Hyper is run via !Hyper.DemoFiles.!Run and is shows the Tool_2 cards, the RISC OS Task window and command line is not available via Ctrl-f12 or f12. An attempt to create a task window via the menu in StrongED also fails. when the Hyper window is closed the task widow becomes available again.

gerph commented 11 months ago

I imagine that means that the window is configured as a key window and isn't passing on the keys when a key press event is arriving?

riscman commented 11 months ago

Looking at the Res file I can see that the HyperViewer window has a 'Hot keys' flag on and has property Default input focus: invisible caret. But how can hyper block F12 when the window does not have focus? Also it is stopping StrongED and !Edit from launching task windows via their menus when no keystrokes are involved. The Hyper !RunImage itselfdoes not have any code to handle keystroke.

gerph commented 11 months ago

I think this was meant to be in the repo: https://github.com/c-jo/riscos-toolbox/

Agreed that the code looks ok... maybe it's the effect of masking the keyboard shortcuts that does it?

The original code is:

     /* not interested in nulls or keypresses- the toolbox handles 
        all our keyboard shortcuts */

     event_set_mask(1+256);

... to set the mask. To be clearer, it should be (1<<0) | (1<<8) or Wimp_Poll_NullMask | Wimp_Poll_KeyPressedMask.

Whereas the code in the toolbox does:

        reason,sender = swi.swi(
            'Wimp_Poll','II;I.I',
            0b1, ctypes.addressof(poll_buffer))

... so it always masks off nulls but never gives you anything else. Maybe it should allow the mask to be set, like the original eventlib did.

@c-jo Maybe there should be an app.set_event_mask or something?

gerph commented 11 months ago

For reference, StrongEd's menu triggers a taskwindow by triggering a key press. See sTxt.Menu line 2094, in the "create file for given mode" function...

        ;------ Taskwindow. Emulate Ctrl-F12

        MOV     R0,#&1EC
        SWI     "Wimp_ProcessKey"
        B       post_menu

So the key is involved.