ref: 275328341ba0825f3eac0af8aa1bf62e8510792c
parent: 25d017440f96bd59227c56a902dc7c0bb3e23c4f
parent: 63fe8a7a0105321c24a1fa79c6fef01c943a54ad
author: Jacob Moody <moody@posixcafe.org>
date: Sun Feb 12 21:38:01 EST 2023
merge
--- a/include/npe/SDL2/SDL_events.h
+++ b/include/npe/SDL2/SDL_events.h
@@ -125,6 +125,7 @@
int SDL_EventState(Uint32, int);
int SDL_PollEvent(SDL_Event *event);
int SDL_PushEvent(SDL_Event *event);
+int SDL_WaitEvent(SDL_Event *event);
int SDL_RegisterEvents(int);
int SDL_PeepEvents(SDL_Event *events, int numevents, SDL_eventaction action, Uint32 minType, Uint32 maxType);
Uint32 SDL_GetWindowID(SDL_Window *window);
--- a/include/npe/errno.h
+++ b/include/npe/errno.h
@@ -7,6 +7,7 @@
ENOENT = 2,
EINVAL = 22,
ERANGE = 34,
+ ENAMETOOLONG = 36,
};
extern int errno;
--- a/include/npe/stdlib.h
+++ b/include/npe/stdlib.h
@@ -8,5 +8,6 @@
#define EXIT_FAILURE 1
int setenv(char *name, char *value, int overwrite);
+char *realpath(char *path, char *buffer);
#endif
--- a/libnpe/mkfile
+++ b/libnpe/mkfile
@@ -37,6 +37,7 @@
mktime.$O\
opendir.$O\
readdir.$O\
+ realpath.$O\
rename.$O\
round.$O\
setenv.$O\
--- /dev/null
+++ b/libnpe/realpath.c
@@ -1,0 +1,19 @@
+#include <u.h>
+#include <libc.h>
+#include "limits.h"
+
+char *
+realpath(char *path, char *buffer)
+{
+ char *s, p[PATH_MAX];
+ int f;
+
+ s = nil;
+ if((f = open(path, OREAD)) < 0){
+ if(fd2path(f, p, sizeof(p)) == 0)
+ s = buffer == nil ? strdup(p) : strcpy(buffer, p);
+ close(f);
+ }
+
+ return s;
+}
--- a/libnpe_sdl2/events.c
+++ b/libnpe_sdl2/events.c
@@ -197,6 +197,18 @@
return 0;
}
+int
+SDL_WaitEvent(SDL_Event *e)
+{
+ int r;
+
+ salt[Numchan].op = CHANEND;
+ r = SDL_PollEvent(e);
+ salt[Numchan].op = CHANNOBLK;
+
+ return r;
+}
+
static int
rune2scancode(Rune r)
{