-
Notifications
You must be signed in to change notification settings - Fork 6.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FindMyMouse]Do not activate on game mode (#13990)
* [FindMyMouse] Do not activate on game mode * Add settings scaffolding * fix spellchecker * Address PR comments * Adress UI feedback
- Loading branch information
1 parent
db90802
commit af8366f
Showing
14 changed files
with
248 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#pragma once | ||
#include <shellapi.h> | ||
|
||
inline bool detect_game_mode() | ||
{ | ||
QUERY_USER_NOTIFICATION_STATE notification_state; | ||
if (SHQueryUserNotificationState(¬ification_state) != S_OK) | ||
{ | ||
return false; | ||
} | ||
return (notification_state == QUNS_RUNNING_D3D_FULL_SCREEN); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
src/settings-ui/Microsoft.PowerToys.Settings.UI.Library/FindMyMouseProperties.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// Copyright (c) Microsoft Corporation | ||
// The Microsoft Corporation licenses this file to you under the MIT license. | ||
// See the LICENSE file in the project root for more information. | ||
|
||
using System.Text.Json.Serialization; | ||
|
||
namespace Microsoft.PowerToys.Settings.UI.Library | ||
{ | ||
public class FindMyMouseProperties | ||
{ | ||
[JsonPropertyName("do_not_activate_on_game_mode")] | ||
public BoolProperty DoNotActivateOnGameMode { get; set; } | ||
|
||
public FindMyMouseProperties() | ||
{ | ||
DoNotActivateOnGameMode = new BoolProperty(true); | ||
} | ||
} | ||
} |
35 changes: 35 additions & 0 deletions
35
src/settings-ui/Microsoft.PowerToys.Settings.UI.Library/FindMyMouseSettings.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// Copyright (c) Microsoft Corporation | ||
// The Microsoft Corporation licenses this file to you under the MIT license. | ||
// See the LICENSE file in the project root for more information. | ||
|
||
using System.Text.Json.Serialization; | ||
using Microsoft.PowerToys.Settings.UI.Library.Interfaces; | ||
|
||
namespace Microsoft.PowerToys.Settings.UI.Library | ||
{ | ||
public class FindMyMouseSettings : BasePTModuleSettings, ISettingsConfig | ||
{ | ||
public const string ModuleName = "Find My Mouse"; | ||
|
||
[JsonPropertyName("properties")] | ||
public FindMyMouseProperties Properties { get; set; } | ||
|
||
public FindMyMouseSettings() | ||
{ | ||
Name = ModuleName; | ||
Properties = new FindMyMouseProperties(); | ||
Version = "1.0"; | ||
} | ||
|
||
public string GetModuleName() | ||
{ | ||
return Name; | ||
} | ||
|
||
// This can be utilized in the future if the settings.json file is to be modified/deleted. | ||
public bool UpgradeSettingsConfiguration() | ||
{ | ||
return false; | ||
} | ||
} | ||
} |
29 changes: 29 additions & 0 deletions
29
src/settings-ui/Microsoft.PowerToys.Settings.UI.Library/FindMyMouseSettingsIPCMessage.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// Copyright (c) Microsoft Corporation | ||
// The Microsoft Corporation licenses this file to you under the MIT license. | ||
// See the LICENSE file in the project root for more information. | ||
|
||
using System.Text.Json; | ||
using System.Text.Json.Serialization; | ||
|
||
namespace Microsoft.PowerToys.Settings.UI.Library | ||
{ | ||
public class FindMyMouseSettingsIPCMessage | ||
{ | ||
[JsonPropertyName("powertoys")] | ||
public SndFindMyMouseSettings Powertoys { get; set; } | ||
|
||
public FindMyMouseSettingsIPCMessage() | ||
{ | ||
} | ||
|
||
public FindMyMouseSettingsIPCMessage(SndFindMyMouseSettings settings) | ||
{ | ||
this.Powertoys = settings; | ||
} | ||
|
||
public string ToJsonString() | ||
{ | ||
return JsonSerializer.Serialize(this); | ||
} | ||
} | ||
} |
29 changes: 29 additions & 0 deletions
29
src/settings-ui/Microsoft.PowerToys.Settings.UI.Library/SndFindMyMouseSettings.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// Copyright (c) Microsoft Corporation | ||
// The Microsoft Corporation licenses this file to you under the MIT license. | ||
// See the LICENSE file in the project root for more information. | ||
|
||
using System.Text.Json; | ||
using System.Text.Json.Serialization; | ||
|
||
namespace Microsoft.PowerToys.Settings.UI.Library | ||
{ | ||
public class SndFindMyMouseSettings | ||
{ | ||
[JsonPropertyName("FindMyMouse")] | ||
public FindMyMouseSettings FindMyMouse { get; set; } | ||
|
||
public SndFindMyMouseSettings() | ||
{ | ||
} | ||
|
||
public SndFindMyMouseSettings(FindMyMouseSettings settings) | ||
{ | ||
FindMyMouse = settings; | ||
} | ||
|
||
public string ToJsonString() | ||
{ | ||
return JsonSerializer.Serialize(this); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.