Mac users can use 'cmd' key as macro modifier #1289
Draft
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Feature
On mac system it is common to use 'command' key to be a modifier of hotkeys. This PR does OS checking and allows Mac users to create macro with 'command' key.
Changes of file
macros.xml
Mac
A new property
cmd
will be added intoMacro
tag when users run ClassicUO at MacOS.Windows
There is no change on Windows.
A corner case: If users copy&replace a mac copy.
cmd
properties are remained, however macros using 'cmd' key won't work. Users have to re-assigned them to make them work again.This is a arguable implementation. The reason I don't remove
cmd
property: I don't want to break user's data without any notification. I think a better solution is that to pop out a notification, suggesting users to reassign hotkeys for those effectted macros. Another solution could be popping out the macro editing GUI to force users to re-assign hotkeys. Please advice me.Test
I have tested on Mac and Windows 10.
Please backup the
macros.xml
file before test. Although I don't think there is any risk, just in case any bug to destory your macros.Off-topic: I find that the parse error will cause recreation of
macros.xml
. It is an issue in my optionion, as users will lost all of defined macros without any notification. According to my experience, users will copy macros time to time. There is chance of tag missing during copy&parse. Maybe we could create a backup before recreation? I will submit a issue later for discussion.OS checking variables
Three OS checking variables under namespace
Utility.Platforms.PlatformHelper
for MacOS detection.I find that there are two usage of
SDL.SDL_GetPlatform()
and one usage ofRuntimeInformation.IsOSPlatform()
in this project. I think it is better to use uniform OS checking. So that I will commit a PR later to apply those OS checking variables globally. Please advice me if it is a good practice.