Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add X Macro for fun and for profit #9667

Merged
3 commits merged into from
Mar 31, 2021
Merged

Add X Macro for fun and for profit #9667

3 commits merged into from
Mar 31, 2021

Commits on Mar 30, 2021

  1. Did you know about X Macros? Now you do!

    **Summary of the Pull Request**
    
    This PR adds an X Macro for defining our ShortcutActions. This means that you can add the action in one place, and have the macro synthesize all sorts of boilerplate for you!
    
    From the `AllShortcutActions.h` file:
    
    > For a clearer explanation of how this file should be used, see:
    > https://en.wikipedia.org/wiki/X_Macro
    >
    > Include this file to be able to quickly define some code in the exact same
    > way for _every single shortcut action_. To use:
    >
    > 1. Include this file
    > 2. Define the ON_ALL_ACTIONS macro with what you want each action to show up
    >    as. Ex:
    >
    >    #define ON_ALL_ACTIONS(action) void action##Handler();
    >
    > 3. Then, use the ALL_SHORTCUT_ACTIONS macro to get the ON_ALL_ACTIONS marcro
    >    repeated once for every ShortcutAction
    >
    > This is used in KeyMapping.idl, ShortcutAction.*, TerminalPage.*, etc. to
    > reduce the number of places where we must copy-paste boiler-plate code for
    > each action. This is _NOT_ something that should be used when any individual
    > case should be customized.
    
    **PR Checklist**
    * [x] Scratches an itch
    * [x] I work here
    * [x] Tests passed
    * [n/a] Requires documentation to be updated
    
    **Detailed Description of the Pull Request / Additional comments**
    
    Originally I had this blocked as a follow up to #9662. However, I've grown tired after a month of merging main into this branch, and I'm just shipping it separately. It will inevitably conflict with anyone who has actions in flight currently.
    
    **Validation Steps Performed**
    The code still builds exactly as before!
    zadjii-msft committed Mar 30, 2021
    1 Configuration menu
    Copy the full SHA
    d972c6a View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    dab9a0a View commit details
    Browse the repository at this point in the history

Commits on Mar 31, 2021

  1. Configuration menu
    Copy the full SHA
    90afa91 View commit details
    Browse the repository at this point in the history