mirror of
https://github.com/switchbrew/libnx.git
synced 2025-06-23 13:22:40 +02:00
Add missing applet focus states and handling modes
This commit is contained in:
parent
50d16023eb
commit
c8f732fda8
@ -36,17 +36,17 @@ typedef enum {
|
|||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
AppletFocusState_Focused = 1, ///< Applet is focused.
|
AppletFocusState_Focused = 1, ///< Applet is focused.
|
||||||
AppletFocusState_NotFocusedUnknown = 2, ///< Out of focus - unknown reason (LibraryApplet open?).
|
AppletFocusState_NotFocusedLibraryApplet = 2, ///< Out of focus - LibraryApplet open.
|
||||||
AppletFocusState_NotFocusedHomeSleep = 3 ///< Out of focus - HOME menu is open / console is sleeping.
|
AppletFocusState_NotFocusedHomeSleep = 3 ///< Out of focus - HOME menu open / console is sleeping.
|
||||||
} AppletFocusState;
|
} AppletFocusState;
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
AppletFocusHandlingMode_Suspend1 = 0, ///< Suspend when out of focus.
|
AppletFocusHandlingMode_SuspendHomeSleep = 0, ///< Suspend only when HOME menu is open / console is sleeping (default).
|
||||||
AppletFocusHandlingMode_NoSuspend, ///< Don't suspend when out of focus.
|
AppletFocusHandlingMode_NoSuspend, ///< Don't suspend when out of focus.
|
||||||
AppletFocusHandlingMode_Suspend2, ///< Suspend when out of focus (unknown variant 1).
|
AppletFocusHandlingMode_SuspendHomeSleepNotify, ///< Suspend only when HOME menu is open / console is sleeping but still receive OnFocusState hook.
|
||||||
AppletFocusHandlingMode_Suspend3, ///< Suspend when out of focus (unknown variant 2).
|
AppletFocusHandlingMode_AlwaysSuspend, ///< Always suspend when out of focus, regardless of the reason.
|
||||||
|
|
||||||
AppletFocusHandlingMode_Max, //< Number of focus handling modes
|
AppletFocusHandlingMode_Max, ///< Number of focus handling modes.
|
||||||
} AppletFocusHandlingMode;
|
} AppletFocusHandlingMode;
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
|
@ -227,7 +227,7 @@ Result appletInitialize(void)
|
|||||||
rc = _appletAcquireForegroundRights();
|
rc = _appletAcquireForegroundRights();
|
||||||
|
|
||||||
if (R_SUCCEEDED(rc))
|
if (R_SUCCEEDED(rc))
|
||||||
rc = appletSetFocusHandlingMode(AppletFocusHandlingMode_Suspend1);
|
rc = appletSetFocusHandlingMode(AppletFocusHandlingMode_SuspendHomeSleep);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (R_SUCCEEDED(rc) && __nx_applet_auto_notifyrunning)
|
if (R_SUCCEEDED(rc) && __nx_applet_auto_notifyrunning)
|
||||||
@ -393,13 +393,13 @@ Result appletSetFocusHandlingMode(AppletFocusHandlingMode mode) {
|
|||||||
|
|
||||||
memset(invals, 0, sizeof(invals));
|
memset(invals, 0, sizeof(invals));
|
||||||
|
|
||||||
if ((mode == AppletFocusHandlingMode_Suspend1) || (mode == AppletFocusHandlingMode_Suspend3)) {
|
if ((mode == AppletFocusHandlingMode_SuspendHomeSleep) || (mode == AppletFocusHandlingMode_AlwaysSuspend)) {
|
||||||
invals[0] = 0;
|
invals[0] = 0;
|
||||||
invals[1] = 0;
|
invals[1] = 0;
|
||||||
invals[2] = 1;
|
invals[2] = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mode != AppletFocusHandlingMode_Suspend3) {
|
if (mode != AppletFocusHandlingMode_AlwaysSuspend) {
|
||||||
invals[3] = 0;
|
invals[3] = 0;
|
||||||
|
|
||||||
if (mode == AppletFocusHandlingMode_NoSuspend) {
|
if (mode == AppletFocusHandlingMode_NoSuspend) {
|
||||||
@ -407,7 +407,7 @@ Result appletSetFocusHandlingMode(AppletFocusHandlingMode mode) {
|
|||||||
invals[1] = 1;
|
invals[1] = 1;
|
||||||
invals[2] = 0;
|
invals[2] = 0;
|
||||||
}
|
}
|
||||||
else if (mode == AppletFocusHandlingMode_Suspend2) {
|
else if (mode == AppletFocusHandlingMode_SuspendHomeSleepNotify) {
|
||||||
invals[0] = 1;
|
invals[0] = 1;
|
||||||
invals[1] = 0;
|
invals[1] = 0;
|
||||||
invals[2] = 1;
|
invals[2] = 1;
|
||||||
|
Loading…
Reference in New Issue
Block a user