Advertisement
Guest User

Untitled

a guest
Mar 21st, 2021
158
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.64 KB | None | 0 0
  1. diff --git a/configure-xsdl.sh b/configure-xsdl.sh
  2. index 37549791a..db9d8862c 100755
  3. --- a/configure-xsdl.sh
  4. +++ b/configure-xsdl.sh
  5. @@ -7,4 +7,4 @@ env SDL=yes CFLAGS="-O0 -g -DDEBUG" \
  6. --disable-shm --disable-mitshm --disable-dri --disable-dri2 --disable-glx --disable-xf86vidmode \
  7. --enable-xsdl --enable-kdrive --enable-kdrive-kbd --enable-kdrive-mouse --enable-kdrive-evdev \
  8.  
  9. -nice -n19 make -j8
  10. +make -j16
  11. diff --git a/hw/kdrive/sdl/sdl.c b/hw/kdrive/sdl/sdl.c
  12. index 437146561..9e1f231c4 100644
  13. --- a/hw/kdrive/sdl/sdl.c
  14. +++ b/hw/kdrive/sdl/sdl.c
  15. @@ -36,7 +36,9 @@
  16. #include <sys/socket.h>
  17. #include <sys/un.h>
  18. #include <pthread.h>
  19. +#ifndef __HAIKU__
  20. #include <sys/inotify.h>
  21. +#endif
  22. #include <fcntl.h>
  23.  
  24. #ifdef __ANDROID__
  25. @@ -213,11 +215,12 @@ static Bool sdlScreenInit(KdScreenInfo *screen)
  26.  
  27. SDL_EnableUNICODE(1);
  28. SDL_EventState(SDL_SYSWMEVENT, SDL_ENABLE);
  29. +#ifndef __HAIKU__
  30. set_clipboard_text(SDL_GetClipboardText());
  31.  
  32. sdlScreenButtons = SDL_ANDROID_GetScreenKeyboardButtonShown(SDL_ANDROID_SCREENKEYBOARD_BUTTON_0);
  33. setScreenButtons(10000);
  34. -
  35. +#endif
  36. if (getenv("XSDL_BUILTIN_KEYBOARD") != NULL)
  37. sdlKeyboardType = (enum sdlKeyboardType_t) atoi(getenv("XSDL_BUILTIN_KEYBOARD"));
  38. unsetenv("XSDL_BUILTIN_KEYBOARD");
  39. @@ -749,10 +752,10 @@ static void sdlPollInput(void)
  40. KdEnqueueKeyboardEvent (sdlKeyboard, 37, 1); // LCTRL
  41. }
  42. }
  43. - else if((event.key.keysym.unicode & 0xFF80) != 0)
  44. +/* else if((event.key.keysym.unicode & 0xFF80) != 0)
  45. {
  46. send_unicode (event.key.keysym.unicode);
  47. - }
  48. + }*/
  49. else
  50. KdEnqueueKeyboardEvent (sdlKeyboard, event.key.keysym.scancode, event.type==SDL_KEYUP);
  51. // Force SDL screen update, so SDL virtual on-screen buttons will change their images
  52. @@ -775,13 +778,16 @@ static void sdlPollInput(void)
  53. // Oherwise SDL will stuck and we will get a permanent black screen
  54. SDL_Flip(SDL_GetVideoSurface());
  55. break;
  56. +#ifndef __HAIKU__
  57. case SDL_SYSWMEVENT:
  58. if (event.syswm.msg != NULL && event.syswm.msg->type == SDL_SYSWM_ANDROID_CLIPBOARD_CHANGED)
  59. set_clipboard_text(SDL_GetClipboardText());
  60. break;
  61. - //case SDL_QUIT:
  62. +#endif
  63. + case SDL_QUIT:
  64. /* this should never happen */
  65. - //SDL_Quit(); // SDL_Quit() on Android is buggy
  66. + SDL_Quit(); // SDL_Quit() on Android is buggy
  67. + break;
  68. }
  69. }
  70. /*
  71. @@ -795,7 +801,7 @@ static void sdlPollInput(void)
  72. }
  73.  
  74. static Bool xsdlConnectionClosed = 0;
  75. -
  76. +#ifndef __HAIKU__
  77. static void xsdlAudioCallback(void *userdata, Uint8 *stream, int len)
  78. {
  79. int fd = (int)userdata;
  80. @@ -953,13 +959,15 @@ static void xsdlCreateAudioThread()
  81. pthread_create(&threadId, NULL, &xsdlAudioThread, NULL);
  82. pthread_detach(threadId);
  83. }
  84. -
  85. +#endif
  86. static int xsdlInit(void)
  87. {
  88. printf("Calling SDL_Init()\n");
  89. SDL_Init(SDL_INIT_VIDEO | SDL_INIT_JOYSTICK | SDL_INIT_AUDIO);
  90. SDL_JoystickOpen(0); // Receive pressure events
  91. +#ifndef __HAIKU__
  92. xsdlCreateAudioThread();
  93. +#endif
  94. return 0;
  95. }
  96.  
  97. @@ -984,6 +992,7 @@ void OsVendorInit (void)
  98. {
  99. KdOsInit (&sdlOsFuncs);
  100. }
  101. +/*
  102.  
  103. static void *send_unicode_thread(void *param)
  104. {
  105. @@ -1002,7 +1011,6 @@ static void *send_unicode_thread(void *param)
  106. KdEnqueueKeyboardEvent (sdlKeyboard, 37, 1); // LCTRL
  107. return NULL;
  108. }
  109. -
  110. static void *set_clipboard_text_thread(void *param)
  111. {
  112. // International text input - copy symbol to clipboard, and send copypaste key
  113. @@ -1035,7 +1043,7 @@ void set_clipboard_text(const char *text)
  114. pthread_create (&thread_id, &attr, &set_clipboard_text_thread, (void *)text);
  115. pthread_attr_destroy (&attr);
  116. }
  117. -
  118. +*/
  119. int execute_command(const char * command, const char *mode, char * data, int datalen)
  120. {
  121. FILE *cmd;
  122. diff --git a/hw/kdrive/src/kinput.c b/hw/kdrive/src/kinput.c
  123. index d258aebb4..2558d62a2 100644
  124. --- a/hw/kdrive/src/kinput.c
  125. +++ b/hw/kdrive/src/kinput.c
  126. @@ -38,6 +38,12 @@
  127. #include <sys/file.h> /* needed for FNONBLOCK & FASYNC */
  128. #endif
  129.  
  130. +#ifdef __HAIKU__
  131. +#define SIGIO SIGPOLL
  132. +#define FASYNC 0
  133. +#define FNONBLOCK O_NONBLOCK
  134. +#endif
  135. +
  136. #include "xkbsrv.h"
  137.  
  138. #include <X11/extensions/XI.h>
  139. @@ -176,7 +182,9 @@ KdAddFd (int fd)
  140. sigset_t set;
  141.  
  142. kdnFds++;
  143. +#ifndef __HAIKU__
  144. fcntl (fd, F_SETOWN, getpid());
  145. +#endif
  146. KdNonBlockFd (fd);
  147. AddEnabledDevice (fd);
  148. memset (&act, '\0', sizeof act);
  149. diff --git a/os/WaitFor.c b/os/WaitFor.c
  150. index 867cb04b8..902683364 100644
  151. --- a/os/WaitFor.c
  152. +++ b/os/WaitFor.c
  153. @@ -335,11 +335,11 @@ WaitForSomething(int *pClientsReady)
  154. {
  155. int highest_priority = 0;
  156.  
  157. - while (clientsReadable.fds_bits[i])
  158. + while (clientsReadable.bits[i])
  159. {
  160. int client_priority, client_index;
  161.  
  162. - curclient = mffs (clientsReadable.fds_bits[i]) - 1;
  163. + curclient = mffs (clientsReadable.bits[i]) - 1;
  164. client_index = /* raphael: modified */
  165. ConnectionTranslation[curclient + (i * (sizeof(fd_mask) * 8))];
  166. #else
  167. @@ -383,7 +383,7 @@ WaitForSomething(int *pClientsReady)
  168. pClientsReady[nready++] = client_index;
  169. }
  170. #ifndef WIN32
  171. - clientsReadable.fds_bits[i] &= ~(((fd_mask)1L) << curclient);
  172. + clientsReadable.bits[i] &= ~(((fd_mask)1L) << curclient);
  173. }
  174. #else
  175. FD_CLR(curclient, &clientsReadable);
  176. diff --git a/os/access.c b/os/access.c
  177. index b7b19279f..1aba590e1 100644
  178. --- a/os/access.c
  179. +++ b/os/access.c
  180. @@ -84,6 +84,11 @@ SOFTWARE.
  181. #include <X11/Xwinsock.h>
  182. #endif
  183.  
  184. +#ifdef __HAIKU__
  185. +#undef AF_INET6
  186. +#undef IPv6
  187. +#endif
  188. +
  189. #include <stdio.h>
  190. #include <stdlib.h>
  191. #define XSERV_t
  192. @@ -113,7 +118,7 @@ SOFTWARE.
  193. # endif
  194. #endif
  195.  
  196. -#if defined(SVR4) || (defined(SYSV) && defined(__i386__)) || defined(__GNU__)
  197. +#if defined(SVR4) || (defined(SYSV) && defined(__i386__)) || defined(__GNU__) || defined(__HAIKU__)
  198. # include <sys/utsname.h>
  199. #endif
  200. #if defined(SYSV) && defined(__i386__)
  201. diff --git a/os/connection.c b/os/connection.c
  202. index cbce6d53b..22756765c 100644
  203. --- a/os/connection.c
  204. +++ b/os/connection.c
  205. @@ -814,7 +814,7 @@ EstablishNewConnections(ClientPtr clientUnused, pointer closure)
  206. #ifndef WIN32
  207. for (i = 0; i < howmany(XFD_SETSIZE, NFDBITS); i++)
  208. {
  209. - while (readyconnections.fds_bits[i])
  210. + while (readyconnections.bits[i])
  211. #else
  212. for (i = 0; i < XFD_SETCOUNT(&readyconnections); i++)
  213. #endif
  214. @@ -823,8 +823,8 @@ EstablishNewConnections(ClientPtr clientUnused, pointer closure)
  215. int status;
  216.  
  217. #ifndef WIN32
  218. - curconn = mffs (readyconnections.fds_bits[i]) - 1;
  219. - readyconnections.fds_bits[i] &= ~((fd_mask)1 << curconn);
  220. + curconn = mffs (readyconnections.bits[i]) - 1;
  221. + readyconnections.bits[i] &= ~((fd_mask)1 << curconn);
  222. curconn += (i * (sizeof(fd_mask)*8));
  223. #else
  224. curconn = XFD_FD(&readyconnections, i);
  225. @@ -984,7 +984,7 @@ CheckConnections(void)
  226. #ifndef WIN32
  227. for (i=0; i<howmany(XFD_SETSIZE, NFDBITS); i++)
  228. {
  229. - mask = AllClients.fds_bits[i];
  230. + mask = AllClients.bits[i];
  231. while (mask)
  232. {
  233. curoff = mffs (mask) - 1;
  234. diff --git a/os/io.c b/os/io.c
  235. index c59e18c5e..10b5e2189 100644
  236. --- a/os/io.c
  237. +++ b/os/io.c
  238. @@ -660,8 +660,8 @@ FlushAllOutput(void)
  239. #ifndef WIN32
  240. for (base = 0; base < howmany(XFD_SETSIZE, NFDBITS); base++)
  241. {
  242. - mask = OutputPending.fds_bits[ base ];
  243. - OutputPending.fds_bits[ base ] = 0;
  244. + mask = OutputPending.bits[ base ];
  245. + OutputPending.bits[ base ] = 0;
  246. while (mask)
  247. {
  248. index = ffs(mask) - 1;
  249. diff --git a/start.sh b/start.sh
  250. index 75e734a00..10781c86c 100755
  251. --- a/start.sh
  252. +++ b/start.sh
  253. @@ -1,3 +1,3 @@
  254. #!/bin/sh
  255.  
  256. -./Xsdl :1111 -screen 640x480x24 -mouse mouse -keybd keyboard
  257. +./Xsdl :0 -screen 640x480x24 -mouse mouse -keybd keyboard -nolock
  258.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement