mirror of https://gitlab.com/nakst/essence
general: bugfixes
This commit is contained in:
parent
a20b6fe91f
commit
4276411dba
|
@ -2,6 +2,9 @@
|
||||||
// It is released under the terms of the MIT license -- see LICENSE.md.
|
// It is released under the terms of the MIT license -- see LICENSE.md.
|
||||||
// Written by: nakst.
|
// Written by: nakst.
|
||||||
|
|
||||||
|
// TODO Terminating the child process on exit.
|
||||||
|
// TODO Handle ES_MSG_INSTANCE_CLOSE, and ignore following MSG_RECEIVED_OUTPUTs.
|
||||||
|
|
||||||
#include <essence.h>
|
#include <essence.h>
|
||||||
#include <shared/strings.cpp>
|
#include <shared/strings.cpp>
|
||||||
|
|
||||||
|
|
|
@ -753,6 +753,7 @@ EsInstance *_EsInstanceCreate(size_t bytes, EsMessage *message, const char *appl
|
||||||
// TODO Can the posted message be raced by a ES_MSG_INSTANCE_DOCUMENT_UPDATED?
|
// TODO Can the posted message be raced by a ES_MSG_INSTANCE_DOCUMENT_UPDATED?
|
||||||
EsMessage m = { ES_MSG_INSTANCE_OPEN_DELAYED };
|
EsMessage m = { ES_MSG_INSTANCE_OPEN_DELAYED };
|
||||||
m._argument = instance;
|
m._argument = instance;
|
||||||
|
EsInstanceOpenReference(instance);
|
||||||
EsMessagePost(nullptr, &m);
|
EsMessagePost(nullptr, &m);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1131,11 +1132,15 @@ EsMessage *EsMessageReceive() {
|
||||||
EsHandleClose(message.message.tabOperation.handle);
|
EsHandleClose(message.message.tabOperation.handle);
|
||||||
}
|
}
|
||||||
} else if (type == ES_MSG_INSTANCE_OPEN_DELAYED) {
|
} else if (type == ES_MSG_INSTANCE_OPEN_DELAYED) {
|
||||||
InstanceSendOpenMessage((EsInstance *) message.message._argument, false);
|
EsInstance *instance = (EsInstance *) message.message._argument;
|
||||||
|
InstanceSendOpenMessage(instance, false);
|
||||||
|
EsInstanceCloseReference(instance);
|
||||||
} else if (type == ES_MSG_INSTANCE_SAVE_COMPLETE_DELAYED) {
|
} else if (type == ES_MSG_INSTANCE_SAVE_COMPLETE_DELAYED) {
|
||||||
char buffer[1];
|
char buffer[1];
|
||||||
buffer[0] = DESKTOP_MSG_COMPLETE_SAVE;
|
buffer[0] = DESKTOP_MSG_COMPLETE_SAVE;
|
||||||
MessageDesktop(buffer, 1, ((EsInstance *) message.message._argument)->window->handle);
|
EsInstance *instance = (EsInstance *) message.message._argument;
|
||||||
|
MessageDesktop(buffer, 1, instance->window->handle);
|
||||||
|
EsInstanceCloseReference(instance);
|
||||||
} else if (type == ES_MSG_PRIMARY_CLIPBOARD_UPDATED) {
|
} else if (type == ES_MSG_PRIMARY_CLIPBOARD_UPDATED) {
|
||||||
EsInstance *instance = InstanceFromWindowID(message.message.tabOperation.id);
|
EsInstance *instance = InstanceFromWindowID(message.message.tabOperation.id);
|
||||||
if (instance) UIRefreshPrimaryClipboard(instance->window);
|
if (instance) UIRefreshPrimaryClipboard(instance->window);
|
||||||
|
@ -1243,6 +1248,7 @@ void EsInstanceSaveComplete(EsInstance *instance, EsFileStore *file, bool succes
|
||||||
if (instance) {
|
if (instance) {
|
||||||
// HACK Post this message so that our handle to the file is (hopefully) closed first.
|
// HACK Post this message so that our handle to the file is (hopefully) closed first.
|
||||||
EsMessage m = { .type = ES_MSG_INSTANCE_SAVE_COMPLETE_DELAYED, ._argument = instance };
|
EsMessage m = { .type = ES_MSG_INSTANCE_SAVE_COMPLETE_DELAYED, ._argument = instance };
|
||||||
|
EsInstanceOpenReference(instance);
|
||||||
EsMessagePost(nullptr, &m);
|
EsMessagePost(nullptr, &m);
|
||||||
|
|
||||||
if (success) {
|
if (success) {
|
||||||
|
|
|
@ -787,9 +787,12 @@ int ProcessWindowBorderMessage(EsWindow *window, EsMessage *message, EsRectangle
|
||||||
// --------------------------------- Windows.
|
// --------------------------------- Windows.
|
||||||
|
|
||||||
void UIWindowNeedsUpdate(EsWindow *window) {
|
void UIWindowNeedsUpdate(EsWindow *window) {
|
||||||
if (!window->willUpdate) {
|
if (!window->willUpdate && window->handle /* cleared in UIWindowDestroy, during InternalDestroy */) {
|
||||||
EsMessage m = { ES_MSG_UPDATE_WINDOW };
|
EsMessage m = { ES_MSG_UPDATE_WINDOW };
|
||||||
// Don't use the userland posted message queue, since we don't want this to block WM messages.
|
// Don't use the userland posted message queue, since we don't want this to block WM messages.
|
||||||
|
// This message will be received within the window's lifetime,
|
||||||
|
// because the window cannot be deallocated until ES_MSG_WINDOW_DESTROYED is received,
|
||||||
|
// and this message will always be received first.
|
||||||
EsSyscall(ES_SYSCALL_MESSAGE_POST, (uintptr_t) &m, (uintptr_t) window, ES_CURRENT_PROCESS, 0);
|
EsSyscall(ES_SYSCALL_MESSAGE_POST, (uintptr_t) &m, (uintptr_t) window, ES_CURRENT_PROCESS, 0);
|
||||||
window->willUpdate = true;
|
window->willUpdate = true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -65,6 +65,7 @@ bool runningTests;
|
||||||
#define PATH_MAX 1024
|
#define PATH_MAX 1024
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define DEPENDENCIES_FILE "bin/dependency_files/dependencies_utils.ini"
|
||||||
#include "build_common.h"
|
#include "build_common.h"
|
||||||
|
|
||||||
BuildFont fonts[] = {
|
BuildFont fonts[] = {
|
||||||
|
@ -255,7 +256,6 @@ void DoCommand(const char *l);
|
||||||
#define OPTIMISE_FULL (1 << 6)
|
#define OPTIMISE_FULL (1 << 6)
|
||||||
|
|
||||||
void Compile(uint32_t flags, int partitionSize, const char *volumeLabel) {
|
void Compile(uint32_t flags, int partitionSize, const char *volumeLabel) {
|
||||||
buildStartTimeStamp = time(NULL);
|
|
||||||
BuildUtilities();
|
BuildUtilities();
|
||||||
|
|
||||||
if (!BuildAPIDependencies()) {
|
if (!BuildAPIDependencies()) {
|
||||||
|
@ -384,8 +384,6 @@ void Compile(uint32_t flags, int partitionSize, const char *volumeLabel) {
|
||||||
void BuildUtilities() {
|
void BuildUtilities() {
|
||||||
#define WARNING_FLAGS " -Wall -Wextra -Wno-missing-field-initializers -Wno-unused-function -Wno-format-truncation -Wno-unused-parameter "
|
#define WARNING_FLAGS " -Wall -Wextra -Wno-missing-field-initializers -Wno-unused-function -Wno-format-truncation -Wno-unused-parameter "
|
||||||
|
|
||||||
buildStartTimeStamp = time(NULL);
|
|
||||||
|
|
||||||
#define BUILD_UTILITY(x, y, z) \
|
#define BUILD_UTILITY(x, y, z) \
|
||||||
if (CheckDependencies("Utilities." x)) { \
|
if (CheckDependencies("Utilities." x)) { \
|
||||||
if (!CallSystem("gcc -MMD -MF \"bin/dependency_files/" x ".d\" " "util/" z x ".c -o bin/" x " -g " WARNING_FLAGS " " y)) { \
|
if (!CallSystem("gcc -MMD -MF \"bin/dependency_files/" x ".d\" " "util/" z x ".c -o bin/" x " -g " WARNING_FLAGS " " y)) { \
|
||||||
|
@ -987,6 +985,7 @@ void BuildAndRun(int optimise, bool compile, int debug, int emulator, int log) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!runningTests) {
|
if (!runningTests) {
|
||||||
|
DependenciesListWrite();
|
||||||
exit(encounteredErrors ? 1 : 0);
|
exit(encounteredErrors ? 1 : 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1424,6 +1423,7 @@ int main(int _argc, char **_argv) {
|
||||||
coloredOutput = isatty(STDERR_FILENO);
|
coloredOutput = isatty(STDERR_FILENO);
|
||||||
systemLog = fopen("bin/Logs/system.log", "a");
|
systemLog = fopen("bin/Logs/system.log", "a");
|
||||||
if (!systemLog) systemLog = fopen("bin/Logs/system.log", "w");
|
if (!systemLog) systemLog = fopen("bin/Logs/system.log", "w");
|
||||||
|
buildStartTimeStamp = time(NULL);
|
||||||
|
|
||||||
if (argc < 2) {
|
if (argc < 2) {
|
||||||
fprintf(stderr, "Error: No command specified.\n");
|
fprintf(stderr, "Error: No command specified.\n");
|
||||||
|
@ -1439,6 +1439,8 @@ int main(int _argc, char **_argv) {
|
||||||
strcat(buffer, argv[i]);
|
strcat(buffer, argv[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DependenciesListRead();
|
||||||
DoCommand(buffer);
|
DoCommand(buffer);
|
||||||
|
DependenciesListWrite();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -107,7 +107,6 @@ bool CheckDependencies(const char *applicationName) {
|
||||||
struct stat s = { 0 };
|
struct stat s = { 0 };
|
||||||
|
|
||||||
if (stat(dependencies.files[i], &s) || s.st_mtime > dependencies.timeStamp) {
|
if (stat(dependencies.files[i], &s) || s.st_mtime > dependencies.timeStamp) {
|
||||||
// printf("%s, %s, %ld, %ld\n", applicationName, dependencies.files[i], s.st_mtime, dependencies.timeStamp);
|
|
||||||
needsRebuild = true;
|
needsRebuild = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -182,7 +181,7 @@ void ParseDependencies(const char *dependencyFile, const char *applicationName,
|
||||||
}
|
}
|
||||||
|
|
||||||
void DependenciesListRead() {
|
void DependenciesListRead() {
|
||||||
EsINIState s = { .buffer = (char *) LoadFile("bin/dependencies.ini", &s.bytes) };
|
EsINIState s = { .buffer = (char *) LoadFile(DEPENDENCIES_FILE, &s.bytes) };
|
||||||
char *start = s.buffer;
|
char *start = s.buffer;
|
||||||
if (!start) return;
|
if (!start) return;
|
||||||
|
|
||||||
|
@ -229,7 +228,7 @@ void DependenciesListWrite() {
|
||||||
#ifdef OS_ESSENCE
|
#ifdef OS_ESSENCE
|
||||||
// TODO.
|
// TODO.
|
||||||
#else
|
#else
|
||||||
FILE *f = fopen("bin/dependencies.ini", "wb");
|
FILE *f = fopen(DEPENDENCIES_FILE, "wb");
|
||||||
|
|
||||||
fprintf(f, "[general]\nconfiguration_hash=%lu\n", configurationHash);
|
fprintf(f, "[general]\nconfiguration_hash=%lu\n", configurationHash);
|
||||||
|
|
||||||
|
|
|
@ -157,6 +157,7 @@ File FileOpen(const char *path, char mode) {
|
||||||
|
|
||||||
#include "../shared/crc.h"
|
#include "../shared/crc.h"
|
||||||
#include "../shared/partitions.cpp"
|
#include "../shared/partitions.cpp"
|
||||||
|
#define DEPENDENCIES_FILE "bin/dependency_files/dependencies.ini"
|
||||||
#include "build_common.h"
|
#include "build_common.h"
|
||||||
#include "../shared/esfs2.h"
|
#include "../shared/esfs2.h"
|
||||||
#include "header_generator.c"
|
#include "header_generator.c"
|
||||||
|
|
Loading…
Reference in New Issue