mirror of https://gitlab.com/nakst/essence
add EsSystemShutdown
This commit is contained in:
parent
7906b6c8f6
commit
dfb502f95a
|
@ -948,11 +948,11 @@ void ButtonInstallOptions(EsInstance *, EsElement *, EsCommand *) {
|
|||
}
|
||||
|
||||
void ButtonShutdown(EsInstance *, EsElement *, EsCommand *) {
|
||||
EsSyscall(ES_SYSCALL_SHUTDOWN, SHUTDOWN_ACTION_POWER_OFF, 0, 0, 0);
|
||||
EsSyscall(ES_SYSCALL_SHUTDOWN, ES_SHUTDOWN_ACTION_POWER_OFF, 0, 0, 0);
|
||||
}
|
||||
|
||||
void ButtonRestart(EsInstance *, EsElement *, EsCommand *) {
|
||||
EsSyscall(ES_SYSCALL_SHUTDOWN, SHUTDOWN_ACTION_RESTART, 0, 0, 0);
|
||||
EsSyscall(ES_SYSCALL_SHUTDOWN, ES_SHUTDOWN_ACTION_RESTART, 0, 0, 0);
|
||||
}
|
||||
|
||||
void ButtonInstall(EsInstance *, EsElement *, EsCommand *) {
|
||||
|
|
|
@ -553,6 +553,10 @@ void EsSystemShowShutdownDialog() {
|
|||
MessageDesktop(&message, 1);
|
||||
}
|
||||
|
||||
void EsSystemShutdown(uint32_t action) {
|
||||
EsSyscall(ES_SYSCALL_SHUTDOWN, action, 0, 0, 0);
|
||||
}
|
||||
|
||||
void EsSystemConfigurationReadFileTypes(EsBuffer *buffer) {
|
||||
uint8_t m = DESKTOP_MSG_FILE_TYPES_GET;
|
||||
MessageDesktop(&m, 1, ES_INVALID_HANDLE, buffer);
|
||||
|
|
|
@ -1229,7 +1229,7 @@ bool RestartTest() {
|
|||
index++;
|
||||
if (ES_SUCCESS != EsFileWriteAll(EsLiteral("|Settings:/restart_test.txt"), &index, sizeof(uint32_t))) return false;
|
||||
EsPrint("Restart %d...\n", index);
|
||||
EsSyscall(ES_SYSCALL_SHUTDOWN, SHUTDOWN_ACTION_RESTART, 0, 0, 0);
|
||||
EsSyscall(ES_SYSCALL_SHUTDOWN, ES_SHUTDOWN_ACTION_RESTART, 0, 0, 0);
|
||||
while (EsMessageReceive());
|
||||
return false;
|
||||
}
|
||||
|
@ -1345,7 +1345,7 @@ void RunTests() {
|
|||
}
|
||||
}
|
||||
|
||||
EsSyscall(ES_SYSCALL_SHUTDOWN, SHUTDOWN_ACTION_POWER_OFF, 0, 0, 0);
|
||||
EsSyscall(ES_SYSCALL_SHUTDOWN, ES_SHUTDOWN_ACTION_POWER_OFF, 0, 0, 0);
|
||||
EsProcessTerminateCurrent();
|
||||
}
|
||||
|
||||
|
|
|
@ -1418,11 +1418,11 @@ void ShutdownModalCreate() {
|
|||
// Setup command callbacks when the buttons are pressed.
|
||||
|
||||
EsButtonOnCommand(shutdownButton, [] (EsInstance *, EsElement *, EsCommand *) {
|
||||
Shutdown(SHUTDOWN_ACTION_POWER_OFF);
|
||||
Shutdown(ES_SHUTDOWN_ACTION_POWER_OFF);
|
||||
});
|
||||
|
||||
EsButtonOnCommand(restartButton, [] (EsInstance *, EsElement *, EsCommand *) {
|
||||
Shutdown(SHUTDOWN_ACTION_RESTART);
|
||||
Shutdown(ES_SHUTDOWN_ACTION_RESTART);
|
||||
});
|
||||
|
||||
EsButtonOnCommand(cancelButton, [] (EsInstance *, EsElement *element, EsCommand *) {
|
||||
|
|
|
@ -779,6 +779,9 @@ define ES_LIST_VIEW_CHOOSE_ITEM_ENTER (2)
|
|||
define ES_LIST_VIEW_CHOOSE_ITEM_DOUBLE_CLICK (3)
|
||||
define ES_LIST_VIEW_CHOOSE_ITEM_MIDDLE_CLICK (4)
|
||||
|
||||
define ES_SHUTDOWN_ACTION_POWER_OFF (1)
|
||||
define ES_SHUTDOWN_ACTION_RESTART (2)
|
||||
|
||||
include desktop/icons.header
|
||||
|
||||
enum EsFatalError {
|
||||
|
@ -1984,6 +1987,7 @@ function EsHandle EsTakeSystemSnapshot(int type, size_t *bufferSize);
|
|||
function EsInstance *_EsInstanceCreate(size_t bytes, EsMessage *message, STRING name = BLANK_STRING);
|
||||
function EsError EsHandleClose(EsHandle handle);
|
||||
function void EsSystemShowShutdownDialog();
|
||||
function void EsSystemShutdown(uint32_t action);
|
||||
|
||||
function void EsPOSIXInitialise(int *argc, char ***argv);
|
||||
function long EsPOSIXSystemCall(long n, long a1, long a2, long a3, long a4, long a5, long a6);
|
||||
|
|
|
@ -378,9 +378,6 @@ struct SystemStartupDataHeader {
|
|||
#define CURSOR_SPEED(x) ((x) >> 16)
|
||||
#define CURSOR_TRAILS(x) (((x) >> 13) & 7)
|
||||
|
||||
#define SHUTDOWN_ACTION_POWER_OFF (1)
|
||||
#define SHUTDOWN_ACTION_RESTART (2)
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" const void *EsBufferRead(struct EsBuffer *buffer, size_t readBytes);
|
||||
extern "C" const void *EsBufferReadMany(struct EsBuffer *buffer, size_t a, size_t b);
|
||||
|
|
|
@ -329,7 +329,7 @@ CPULocalStorage *KGetCPULocal(uintptr_t index) {
|
|||
#include "acpica.cpp"
|
||||
#else
|
||||
void ArchShutdown() {
|
||||
if (shutdownAction == SHUTDOWN_ACTION_RESTART) ProcessorReset();
|
||||
if (shutdownAction == ES_SHUTDOWN_ACTION_RESTART) ProcessorReset();
|
||||
StartDebugOutput();
|
||||
EsPrint("\nIt's now safe to turn off your computer.\n");
|
||||
ProcessorDisableInterrupts();
|
||||
|
|
|
@ -595,7 +595,7 @@ ACPI_STATUS ACPIWalkNamespaceCallback(ACPI_HANDLE object, uint32_t depth, void *
|
|||
}
|
||||
|
||||
void ArchShutdown() {
|
||||
if (shutdownAction == SHUTDOWN_ACTION_RESTART) ProcessorReset();
|
||||
if (shutdownAction == ES_SHUTDOWN_ACTION_RESTART) ProcessorReset();
|
||||
AcpiEnterSleepStatePrep(5);
|
||||
ProcessorDisableInterrupts();
|
||||
AcpiEnterSleepState(5);
|
||||
|
|
|
@ -340,6 +340,7 @@ EsClipboardReadText=338
|
|||
EsClipboardOpen=339
|
||||
EsSpacerCreate=340
|
||||
EsTextPlanCreate=341
|
||||
EsSystemShutdown=342
|
||||
EsListDisplayCreate=343
|
||||
EsCRTfabsf=344
|
||||
EsCRTisnanf=345
|
||||
|
|
Loading…
Reference in New Issue