Menu

#327 OSD + Hotkeys

future
open
nobody
UI (9)
5
2014-10-29
2014-09-02
No

Very annoying thing is that the volume can only be adjusted through the complicated menu system.
Mousey thinks similarly with speed control...

So I created a patch to an UI independent OSD and hotkey system.
We have a lot of key for Symbol shift: ALT, CTRL, Meta, Hyper, Super(Win) and Mode_switch. So we can use Super and Menu keys for hotkey shift.

Implemented hotkeys:
* Hotkey Shift (Super or Win or Menu) + i -> information
* H + j -> joystick type
* H + y -> joystick connectivity
* H + s -> take a screenshot
* H + z -> select screenshot scaler
* H + m -> mute, unmute all volume (Beeper, AY, SpecDrum)
* Keypad slash (/) -> decrease volume
* KP * -> increase volume
* KP - -> select volume (Beeper, AY, SpecDrum)
Note: when volume OSD is on, H + m -> mute, unmute actual volume
* H + [ -> decrease emulation speed
* H + ]
-> increase emulation speed
* H + \ -> switch between 100% and last set emulation speed

1st part

diff.nkey_01.patch - extend the 'native_keys'
- input.h, keysyms.dat - fill the 'holes' of INPUT_KEY's, and add virtual modifiers (Kepad and Hotkey)
- keyboard.{h,c} - move the 'keysyms_native_remap' from sdl UI to here for a general use
- keysyms.pl - handle 'native_keys' for GTK, SDL, SVGA, X and W32 UIs
- ui/gtk/gtkkeyboard.c, ui/xlib/xkeyboard.c, ui/win32/win32keyboard.c - deal with modifiers
- ui/sdl/sdlkeyboard.{c,h}, ui/sdl/sdlui.c - keysyms_native_remap, hash, etc moved to upper level (keyboard.c)

With this patch with a 'widget' UI we can save files with name like 'save_1000@12[3].scl' ;-)

2nd part

diff.nosd_01.patch - on screen display routines
- Makefile.am - extend source tree with osd.c and osdfont.c, add rule to build osdfont.c
- mkosdfont.pl - script to generate OSD font (8x8) from spectrum 48k ROM and some additional special characters from osd.font.sbf
- osd.font.sbf - special characters for OSD (ASCII 0x80-..)
- osd.{h,c} - OSD routines
- display.c - hook OSD overlay to 'update_ui_screen()'

3rd part

diff.nhot_01.patch - hotkey handling routines
- Makefile.am - add 'hotkey.c' to source tree
- input.c - hook hotkey handler into 'keypress()'
- sound.{h,c} - a new function, to update sound volumes without stop/start sound system
- hotkey.{h,c} - hotkey 'system'

3 Attachments

Related

Feature Requests: #92
Wiki: Fuse 1.2 Release Plan
Wiki: Fuse 1.2.2 Release Plan
Wiki: Fuse 1.3.0 Release Plan
Wiki: Fuse 1.3.1 Release Plan
Wiki: Fuse 1.3.2 Release Plan
Wiki: Fuse 1.3.3 Plan
Wiki: Fuse 1.3.4 Release Plan
Wiki: Fuse 1.3.5 Release Plan
Wiki: Fuse 1.3.6 Release Plan
Wiki: Fuse 1.3.7 Release Plan
Wiki: Fuse 1.3.8 Release Plan
Wiki: Fuse 1.4.0 Release Plan
Wiki: Fuse 1.4.1 Release Plan
Wiki: Fuse 1.5.0 Release Plan
Wiki: Fuse 1.5.1 Release Plan
Wiki: Fuse 1.5.2 Release Plan
Wiki: Fuse 1.5.3 Release Plan
Wiki: Fuse 1.5.4 Release Plan
Wiki: Fuse 1.5.5 Release Plan
Wiki: Fuse 1.5.6 Release Plan
Wiki: Fuse 1.5.7 Release Plan
Wiki: Fuse 1.6.0 Release Plan
Wiki: Fuse Next Release Plan

Discussion

  • Gergely Szasz

    Gergely Szasz - 2014-09-05

    Here is some little improvements:
    --osd-position and --osd-color command line switches to select from 9 predefined OSD position and OSD color scheme.

    H + o -> select OSD position,
    H + c -> select OSD color
    H + k -> switch 'on/off' joystick emulation

    And an all-in-one patch.

     
  • Sergio Baldoví

    Sergio Baldoví - 2014-09-05

    Looks interesting and it is nice the use spectrum font and colours.

    I've some thoughts about my preferences, but they are not necessarily the best ones (just another point of view).

    1. An option to disable OSD/hotkeys would be handy. Not everyone will like OSD.

    2. osd-color options would be more intuitive with 1 - blue, 2 - red, 3 - magenta, etc.

    3. We should use osd-colour instead of osd-color (British English).

    4. When OSD position is at bottom-right the status bar icons are shown over the OSD. The OSD show temporarily information so it should be appear over the icons?

    5. mkosdfont.pl generate OSD font from 48k ROM. ROMs are not always distributed in source packages (e.g., Debian)

    6. Hotkey selection. I think Super hotkeys are widely used by OS/desktop manager, e.g., Super+M open the mail on my Linux distro and minimize all windows on Windows. If we could detect left/right Control or left/right Shift maybe we could choose another modifier?

    7. With my keyboard layout "[" has no direct access, I need "Super + Alt Gr + [". Still better than emacs, though :-) Moreover, my laptop doesn't have a keypad. Hotkeys might not work and, again, an option for customizing would be handy.

    8. Super(Win) hotkeys don't work on Windows, that is a bug.

    9. Emulation speed: I find speed increments and the limit of 600% very small.
      -- My mind can foresee the result of double/half the speed better than an increment of 5%, so I would choose speed % of 25, 50, 100, 200, 400, 800, 1600, 3200, 6400, etc.
      -- My computer can perform upto 5000%. I would put a high limit, but I would prevent speeding up if the actual speed is lower than selected speed.
      -- Again, these are my thoughts for reviewing long RZX files and skipping boring parts. It may not fit for other purposes.

    10. I would love to see the current running time of a RZX playback permanently in the OSD.

     
  • Gergely Szasz

    Gergely Szasz - 2014-09-08

    Here is an improved patch:

    1 An option ...

    --osd/--no-osd and F1->Options->General->OSD + Hotke(y)s

    2 osd-color options

    now we can use numbers 0-8 or blue, red, ... or full name e.g: "cyan/red"

    3 We should use osd-colour instead

    fixed

    4 When OSD position is at

    WIP

    5 Hotkey selection.

    WIP

    7 With my keyboard layout "[" has no direct access,

    WIP

    8 Super(Win) hotkeys don't work on Windows,

    Hmm.. i test only in wine, but as i see we cannot get keypress event with WIN keys...???

    9 Emulation speed: I find

    Now we use a table with this speeds... just a try...

    10 I would love to see the current running time of a RZX

    implemented

    New:
    H + t -> show emulation time (hhh:mm:ss / sec / frames),
    H + r -> show RZX playback (if RZX playback running) time... what we want to see if RZX playback is ended?
    1., nothing (OSD off)
    2., 0:0:0.0
    3. last time
    4. time running.
    Now counter go on, but if we switch off OSD we cannot switch on, because RZX playback is over.

    H + n -> set OSD mini mode (On/Off). We see only an 1 line status. (Some controls havn't get mini mode)

    Now the OSD display time is corrected with the emulation speed (correction with the current speed is not so easy, so we use the desired speed)

     
  • Sergio Baldoví

    Sergio Baldoví - 2014-09-08

    Hmm.. i test only in wine, but as i see we cannot get keypress event with WIN keys...???

    I have had a look in a virtual machine, the SUPER key is detected but UI is raising "SUPER + I" instead of "SUPER + i". The hotkey never match.

    Funnily, if I activate CAPS LOCK on Linux hotkeys are not working. I think hotkeys should be case insensitive.

    I still think that SUPER is a bad choice on Windows (and maybe other OS). It is a system-wide hot key and the message first deal with the system and then with the application.

    H + r -> show RZX playback (if RZX playback running) time... what we want to see if RZX playback is ended?

    The last time (total running time) is a valuable information. Otherwise nothing.

     

    Last edit: Sergio Baldoví 2014-09-08
  • Gergely Szasz

    Gergely Szasz - 2014-09-10

    Here is a new patch:

    The old 4th point:

    When OSD position is at bottom-right the status bar icons are shown over the OSD. The OSD show temporarily information so it should be appear over the icons?

    The "over the statusbar icons" is not so easy solution, because the statusbar composed by the UI over the spectrum screen. The OSD is rendered on the spectrum screen, so statusbar practically always over the OSD.
    So my fix is, to correct the bottom position if UI rendering statusbar in order to OSD does not overlap with it.

    The old 7th point:

    With my keyboard layout "[" has no direct access, I need "Super + Alt Gr + [". Still better than emacs, though :-) Moreover, my laptop doesn't have a keypad. Hotkeys might not work and, again, an option for customizing would be handy.

    Now there are 3 predefinet hotkey set
    - "1" or "pc" for a US PC keyboard
    - "2" or "laptop" for a keypadless US (laptop) keyboard
    - "3" or "minimal" for other keyboards, only letters used (+ space and enter)
    - and user can define their own hotkeys:
    H + Enter -> fuse ask for press all hotkey one by one

    The old 9th point:

    Emulation speed: I find speed increments and the limit of 600% very small.
    -- My mind can foresee the result of double/half the speed better than an increment of 5%, so I would choose speed % of 25, 50, 100, 200, 400, 800, 1600, 3200, 6400, etc.

    Now we multiply or divide by 2 the actual speed between 25% - 6400% (below 25% substract or add 5%). Note: do not check if estimated speed lower than desired speed...

    Others:
    - Now hotkeys are case insensitives (hotkey() convert A..Z -> a..z).
    - RZX time now show the last time/sec/frame after playback stopped
    - if OSD on, H+o or H+c move the current OSD around and change current OSD's color...

    Now i start to solve hotkey shift selection...

     
  • Gergely Szasz

    Gergely Szasz - 2014-10-22

    Back again :)

    Here is a new patch. I hope i fixed all mentioned issues...

    Sum:
    1. --osd/--no-osd and F1->Options->General->OSD + Hotke(y)s
    2. we can use numbers: 0-8, short names: blue, red, or full name e.g: "cyan/red"
    3. osd-colour instead of osd-colur
    4. OSD bottom position fixed
    5. fixed, now if no roms, fuse use the Rom.bin from the distributed font files (data/osd/*.bin)
    6. hotkey selection: now the default hotkey is ALT (left and right) and user can select other with H + Enter, H + Enter or F1->Options->Hotkey shift
    7. now there are 3 predefinet hotkey set, and H + Enter or F1->Options->Hotkeys
    8. (case sensitiveness) fixed
    9. may an acceptable fix: fuse multiplies or divides by 2 the actual speed between 25% - 6400% (below 25% substracts or adds 5%)
    10. RZX time and emulation time are permanently displayed on OSD (H + space close)

    new configure option:
    --with-osdfont=<ROM|name|?> select default OSD font

    Command line switches:
    --osd/--no-osd : enable/disable OSD and hotkeys
    --osd-position <0..9> : OSD position top-left, top-center ..
    --osd-colour <0..9|color name>: set OSD colors
    --osd-font <fontname>: select OSD font file (first 96 char)
    --hotkeys <1..3|pc|laptop|minimal>: set hotkeys
    --hotkey-shift <hks> : set hotkey shift(s), where "hks" a comma separated list of case insensitive "ctrl", "alt", "meta", "super", "hyper", "mode" or C, A, M, S, H, O, preceeded with l - left, r - right, or nothing - both (e.g. lalt,rctrl,mode - select left ALT, right CTRL, and MODE_SWITCH for H)

    Hotkeys (predefined PC QWERTY):
    H + Enter -> setup hotkeys / setup hotkey shift
    H + space -> OSD off/on
    H + n -> OSD mini mode on/off
    H + o -> OSD position
    H + c -> OSD colour
    H + i -> information
    H + t -> emulation time (o:m:s/sec/frames)
    H + r -> RZX time (o:m:s/sec/frames)
    H + j -> joystick type
    H + y -> joystick connectivity
    H + k -> joystick off/on
    H + s -> take a screenshot
    H + z -> select screenshot scaler
    Keypad slash (/) -> decrease volume
    KP * -> increase volume
    KP - -> select volume (Beeper, AY, SpecDrum)
    H + m -> mute, unmute all volume (Beeper, AY, SpecDrum)
    Note: when volume OSD is on, H + m -> mute/unmute actual volume
    H + [ -> decrease emulation speed
    * H + ]
    -> increase emulation speed
    * H + \ -> switch between 100% and last set emulation speed

    Predefined laptop (QWERTY) hotkeys:
    Enter, space, n, o, c, i, t, r, j, y, k, s, z, -, = backspace, [, ], \

    Predefined "minimal" hotkeys:
    Enter, space, n, o, c, i, t, r, j, y, k, s, z, f, g, v, m, q, w, e

    We can select OSD
    - hotkeys
    - hotkey shifts
    with command line and menu (only predefined) and with OSD
    can select
    - position
    - color
    with command line and with OSD
    can select
    - font
    with command line (so we can use OSD with our favorite game(s) font..;-)

    What not implemented yet:
    - predefined hotkeys for AZRTY or other keyboards
    - hotkey and hotkey shift selection with menus
    - osd font selection with menus
    (we need new widgets and a lot of new things...)
    - to use OSD for error (warning) messages and others (e.g. RZX replay end message)

    But IMHO present state is good enough for first commit...

     
  • Sergio Baldoví

    Sergio Baldoví - 2014-10-29

    This patch brings a big improvement in usability.

    My preferred combination is minimal set and RCTRL shift. I have seen that ALT+space open the client menu on GTK+ UI. ALT shift also activates menu mnemonics on Windows so I will avoid ALT shift.

    I'm a bit concerned about adding 173 binary fonts. Perhaps we should state that these files are not covered by the GNU GPL (like the roms dir) and specify from whom they come from.

    It would be interesting to extract the SE Basic IV font as it is GPLv2:
    https://github.com/cheveron/sebasic4/blob/master/modules/15_font.asm

    What not implemented yet:
    - hotkey and hotkey shift selection with menus

    It is already done on GTK+ UI, isn't it?

    But IMHO present state is good enough for first commit...

    I wonder what other people think about these features. Looks fine?

    I'm keen to do a branch, fix the Windows build and polish the details.

     
    • Gergely Szasz

      Gergely Szasz - 2014-10-31

      I have seen that ALT+space open the client menu on GTK+ UI.

      Hmm... this is rather the window/desktop managers hotkey than GTKs. At least with GTK2 and fwvm there isn't pop-pup any menu...

      I'm a bit concerned about adding 173 binary fonts. Perhaps we should state that these files are not covered by the GNU GPL (like the roms dir) and specify from whom they come from.

      There is a README.font file in the directory. The questionable part is the 65 "Imported Fonts" ( http://www.worldofspectrum.org/infoseekid.cgi?id=0025283). As description says: All the fonts extracted from "commercial" games and (some of them?) completed... I did not check all games: what is the legal state? (or the legal state of the fonts of the games)
      But who want to see the OSD with "Typewriter" (from ZX-ALPHA) instead with a font of "Codename MAT", "Saboteur" or "Quazatron"???

      It would be interesting to extract the SE Basic IV font as it is GPLv2:
      https://github.com/cheveron/sebasic4/blob/master/modules/15_font.asm

      The font file: https://github.com/cheveron/sebasic4/blob/master/data/geneva-mono.bin can be used "as is" in the font directory... :-)
      I attach a patch with this font included.

      What not implemented yet:
      - hotkey and hotkey shift selection with menus

      It is already done on GTK+ UI, isn't it?

      Not really, the menu options (Options/Hotkeys/Define hotkeys... and Options/Hotkey Shift/Define Hotkey Shift) just start the key selection "with OSD". At this point i thinking about a "full menu driven" selection like the "joystick setup"... But for this, we need some new widgets, etc... (so, a lot of works for a little improvement)

      I'm keen to do a branch, fix the Windows build and polish the details.

      Thanks a lot...

       

Log in to post a comment.