Advertisement
Guest User

links-2.3-zipit.patch

a guest
Jun 22nd, 2012
252
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 60.12 KB | None | 0 0
  1. diff -rupN links-2.3/Makefile.am links-2.3.zipt/Makefile.am
  2. --- links-2.3/Makefile.am 2009-05-17 15:45:41.000000000 -0400
  3. +++ links-2.3.zipt/Makefile.am 2012-06-22 09:43:22.000000000 -0400
  4. @@ -13,7 +13,7 @@ links_LDADD=atheos.o
  5. else
  6. endif
  7.  
  8. -links_SOURCES=af_unix.c auth.c beos.c bfu.c block.c bookmarks.c cache.c charsets.c connect.c cookies.c default.c dip.c directfb.c directfb_cursors.h dither.c dns.c drivers.c error.c file.c finger.c font_include.c framebuffer.c ftp.c gif.c html.c html_gr.c html_r.c html_tbl.c http.c https.c img.c imgcache.c jpeg.c jsint.c kbd.c language.c links_icon.c listedit.c lru.c mailto.c main.c memory.c menu.c objreq.c os_dep.c pmshell.c png.c sched.c select.c session.c smb.c svgalib.c terminal.c tiff.c types.c url.c view.c view_gr.c x.c xbm.c links.h cfg.h os_dep.h os_depx.h setup.h codepage.h language.h codepage.inc entity.inc uni_7b.inc language.inc upcase.inc arrow.inc bits.h
  9. +links_SOURCES=af_unix.c auth.c beos.c bfu.c block.c bookmarks.c cache.c charsets.c connect.c cookies.c default.c dip.c directfb.c directfb_cursors.h dither.c dns.c drivers.c error.c file.c finger.c font_include.c framebuffer.c ftp.c gif.c html.c html_gr.c html_r.c html_tbl.c http.c https.c img.c imgcache.c jpeg.c jsint.c kbd.c language.c links_icon.c listedit.c lru.c mailto.c main.c memory.c menu.c objreq.c os_dep.c pmshell.c png.c sched.c select.c session.c smb.c svgalib.c terminal.c tiff.c types.c url.c view.c view_gr.c x.c xbm.c links.h cfg.h os_dep.h os_depx.h setup.h codepage.h language.h codepage.inc entity.inc uni_7b.inc language.inc upcase.inc arrow.inc bits.h sdl.c
  10.  
  11. dist-hook:
  12. #remove the symlinka:
  13. diff -rupN links-2.3/configure links-2.3.zipt/configure
  14. --- links-2.3/configure 2011-08-14 13:48:41.000000000 -0400
  15. +++ links-2.3.zipt/configure 2012-06-22 10:11:15.000000000 -0400
  16. @@ -39,6 +39,8 @@ ac_help="$ac_help
  17. ac_help="$ac_help
  18. --without-directfb compile without DirectFB graphics driver"
  19. ac_help="$ac_help
  20. + --without-sdl compile without SDL graphics driver"
  21. +ac_help="$ac_help
  22. --without-pmshell compile without PMShell graphics driver"
  23. ac_help="$ac_help
  24. --without-atheos compile without Atheos graphics driver"
  25. @@ -5744,6 +5746,12 @@ if test "${with_directfb+set}" = set; th
  26. if test "$withval" = no; then disable_directfb=yes; else disable_directfb=no; fi
  27. fi
  28.  
  29. +# Check whether --with-sdl or --without-sdl was given.
  30. +if test "${with_sdl+set}" = set; then
  31. + withval="$with_sdl"
  32. +if test "$withval" = no; then disable_sdl=yes; else disable_sdl=no; fi
  33. +fi
  34. +
  35. # Check whether --with-pmshell or --without-pmshell was given.
  36. if test "${with_pmshell+set}" = set; then
  37. withval="$with_pmshell"
  38. @@ -6382,6 +6390,142 @@ EOF
  39. fi
  40.  
  41.  
  42. +if test "$disable_sdl" != yes ; then
  43. + # Extract the first word of "sdl-config", so it can be a program name with args.
  44. +set dummy sdl-config; ac_word=$2
  45. +{ echo "$as_me:$LINENO: checking for $ac_word" >&5
  46. +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
  47. +if test "${ac_cv_path_SDL_CONFIG+set}" = set; then
  48. + echo $ECHO_N "(cached) $ECHO_C" >&6
  49. +else
  50. + case $SDL_CONFIG in
  51. + [\\/]* | ?:[\\/]*)
  52. + ac_cv_path_SDL_CONFIG="$SDL_CONFIG" # Let the user override the test with a path.
  53. + ;;
  54. + *)
  55. + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
  56. +for as_dir in $PATH
  57. +do
  58. + IFS=$as_save_IFS
  59. + test -z "$as_dir" && as_dir=.
  60. + for ac_exec_ext in '' $ac_executable_extensions; do
  61. + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
  62. + ac_cv_path_SDL_CONFIG="$as_dir/$ac_word$ac_exec_ext"
  63. + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
  64. + break 2
  65. + fi
  66. +done
  67. +done
  68. +IFS=$as_save_IFS
  69. +
  70. + test -z "$ac_cv_path_SDL_CONFIG" && ac_cv_path_SDL_CONFIG="no"
  71. + ;;
  72. +esac
  73. +fi
  74. +SDL_CONFIG=$ac_cv_path_SDL_CONFIG
  75. +if test -n "$SDL_CONFIG"; then
  76. + { echo "$as_me:$LINENO: result: $SDL_CONFIG" >&5
  77. +echo "${ECHO_T}$SDL_CONFIG" >&6; }
  78. +else
  79. + { echo "$as_me:$LINENO: result: no" >&5
  80. +echo "${ECHO_T}no" >&6; }
  81. +fi
  82. +
  83. +
  84. + if test "$SDL_CONFIG" != "no"; then
  85. + { echo "$as_me:$LINENO: checking for SDL >= 1.2.0" >&5
  86. +echo $ECHO_N "checking for SDL >= 1.2.0... $ECHO_C" >&6; }
  87. + sdl_version="`$SDL_CONFIG --version`"
  88. + if expr "$sdl_version" \>= 1.2.0 >/dev/null; then
  89. + { echo "$as_me:$LINENO: result: yes" >&5
  90. +echo "${ECHO_T}yes" >&6; }
  91. + SDL_CFLAGS="`$SDL_CONFIG --cflags`"
  92. + SDL_LIBS="`$SDL_CONFIG --libs`"
  93. + cat >>confdefs.h <<\_ACEOF
  94. +#define GRDRV_SDL 1
  95. +_ACEOF
  96. +
  97. + drivers="$drivers SDL"
  98. + CPPFLAGS="$CPPFLAGS $SDL_CFLAGS"
  99. +
  100. +{ echo "$as_me:$LINENO: checking for XextAddDisplay in -lXext" >&5
  101. +echo $ECHO_N "checking for XextAddDisplay in -lXext... $ECHO_C" >&6; }
  102. +if test "${ac_cv_lib_Xext_XextAddDisplay+set}" = set; then
  103. + echo $ECHO_N "(cached) $ECHO_C" >&6
  104. +else
  105. + ac_check_lib_save_LIBS=$LIBS
  106. +LIBS="-lXext $LIBS"
  107. +cat >conftest.$ac_ext <<_ACEOF
  108. +/* confdefs.h. */
  109. +_ACEOF
  110. +cat confdefs.h >>conftest.$ac_ext
  111. +cat >>conftest.$ac_ext <<_ACEOF
  112. +/* end confdefs.h. */
  113. +
  114. +/* Override any GCC internal prototype to avoid an error.
  115. + Use char because int might match the return type of a GCC
  116. + builtin and then its argument prototype would still apply. */
  117. +#ifdef __cplusplus
  118. +extern "C"
  119. +#endif
  120. +char XextAddDisplay ();
  121. +int
  122. +main ()
  123. +{
  124. +return XextAddDisplay ();
  125. + ;
  126. + return 0;
  127. +}
  128. +_ACEOF
  129. +rm -f conftest.$ac_objext conftest$ac_exeext
  130. +if { (ac_try="$ac_link"
  131. +case "(($ac_try" in
  132. + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
  133. + *) ac_try_echo=$ac_try;;
  134. +esac
  135. +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
  136. + (eval "$ac_link") 2>conftest.er1
  137. + ac_status=$?
  138. + grep -v '^ *+' conftest.er1 >conftest.err
  139. + rm -f conftest.er1
  140. + cat conftest.err >&5
  141. + echo "$as_me:$LINENO: \$? = $ac_status" >&5
  142. + (exit $ac_status); } && {
  143. + test -z "$ac_c_werror_flag" ||
  144. + test ! -s conftest.err
  145. + } && test -s conftest$ac_exeext &&
  146. + $as_test_x conftest$ac_exeext; then
  147. + ac_cv_lib_Xext_XextAddDisplay=yes
  148. +else
  149. + echo "$as_me: failed program was:" >&5
  150. +sed 's/^/| /' conftest.$ac_ext >&5
  151. +
  152. + ac_cv_lib_Xext_XextAddDisplay=no
  153. +fi
  154. +
  155. +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
  156. + conftest$ac_exeext conftest.$ac_ext
  157. +LIBS=$ac_check_lib_save_LIBS
  158. +fi
  159. +{ echo "$as_me:$LINENO: result: $ac_cv_lib_Xext_XextAddDisplay" >&5
  160. +echo "${ECHO_T}$ac_cv_lib_Xext_XextAddDisplay" >&6; }
  161. +if test $ac_cv_lib_Xext_XextAddDisplay = yes; then
  162. + cat >>confdefs.h <<_ACEOF
  163. +#define HAVE_LIBXEXT 1
  164. +_ACEOF
  165. +
  166. + LIBS="-lXext $LIBS"
  167. +
  168. +fi
  169. +
  170. + LIBS="$SDL_LIBS $LIBS"
  171. + else
  172. + { echo "$as_me:$LINENO: result: no" >&5
  173. +echo "${ECHO_T}no" >&6; }
  174. + fi
  175. + fi
  176. +fi
  177. +
  178. if test "$disable_pmshell" != yes ; then
  179. echo $ac_n "checking for pmshell""... $ac_c" 1>&6
  180. echo "configure:6380: checking for pmshell" >&5
  181. @@ -7882,6 +8026,7 @@ s%@OPENSSL_LIBS@%$OPENSSL_LIBS%g
  182. s%@NSS_CFLAGS@%$NSS_CFLAGS%g
  183. s%@NSS_LIBS@%$NSS_LIBS%g
  184. s%@DIRECTFB_CONFIG@%$DIRECTFB_CONFIG%g
  185. +s%SDL_CONFIG@%$SDL_CONFIG%g
  186. s%@CXX@%$CXX%g
  187. s%@LIBPNG_CFLAGS@%$LIBPNG_CFLAGS%g
  188. s%@LIBPNG_LIBS@%$LIBPNG_LIBS%g
  189. diff -rupN links-2.3/configure.in links-2.3.zipt/configure.in
  190. --- links-2.3/configure.in 2011-06-26 19:47:52.000000000 -0400
  191. +++ links-2.3.zipt/configure.in 2012-06-22 09:38:04.000000000 -0400
  192. @@ -470,7 +470,7 @@ AC_ARG_WITH(svgalib, [ --without-svgali
  193. AC_ARG_WITH(x, [ --without-x compile without X Window System graphics driver],[if test "$withval" = no; then disable_x=yes; else disable_x=no; fi])
  194. AC_ARG_WITH(fb, [ --without-fb compile without Linux Framebuffer graphics driver],[if test "$withval" = no; then disable_fb=yes; else disable_fb=no; fi])
  195. AC_ARG_WITH(directfb, [ --without-directfb compile without DirectFB graphics driver],[if test "$withval" = no; then disable_directfb=yes; else disable_directfb=no; fi])
  196. -dnl AC_ARG_WITH(sdl, [ --without-sdl compile without SDL graphics driver],[if test "$withval" = no; then disable_sdl=yes; else disable_sdl=no; fi])
  197. +AC_ARG_WITH(sdl, [ --without-sdl compile without SDL graphics driver],[if test "$withval" = no; then disable_sdl=yes; else disable_sdl=no; fi])
  198. AC_ARG_WITH(pmshell, [ --without-pmshell compile without PMShell graphics driver],[if test "$withval" = no; then disable_pmshell=yes; else disable_pmshell=no; fi])
  199. AC_ARG_WITH(atheos, [ --without-atheos compile without Atheos graphics driver],[if test "$withval" = no; then disable_atheos=yes; else disable_atheos; fi])
  200.  
  201. @@ -541,25 +541,25 @@ if test "$disable_x" != yes ; then
  202. fi
  203. fi
  204.  
  205. -dnl if test "$disable_sdl" != yes ; then
  206. -dnl AC_PATH_PROG(SDL_CONFIG, sdl-config, no)
  207. -dnl if test "$SDL_CONFIG" != "no"; then
  208. -dnl AC_MSG_CHECKING(for SDL >= 1.2.0)
  209. -dnl sdl_version="`$SDL_CONFIG --version`"
  210. -dnl if expr "$sdl_version" \>= 1.2.0 >/dev/null; then
  211. -dnl AC_MSG_RESULT(yes)
  212. -dnl SDL_CFLAGS="`$SDL_CONFIG --cflags`"
  213. -dnl SDL_LIBS="`$SDL_CONFIG --libs`"
  214. -dnl AC_DEFINE(GRDRV_SDL)
  215. -dnl drivers="$drivers SDL"
  216. -dnl CPPFLAGS="$CPPFLAGS $SDL_CFLAGS"
  217. -dnl AC_CHECK_LIB(Xext, XextAddDisplay)
  218. -dnl LIBS="$SDL_LIBS $LIBS"
  219. -dnl else
  220. -dnl AC_MSG_RESULT(no)
  221. -dnl fi
  222. -dnl fi
  223. -dnl fi
  224. +if test "$disable_sdl" != yes ; then
  225. + AC_PATH_PROG(SDL_CONFIG, sdl-config, no)
  226. + if test "$SDL_CONFIG" != "no"; then
  227. + AC_MSG_CHECKING(for SDL >= 1.2.0)
  228. + sdl_version="`$SDL_CONFIG --version`"
  229. + if expr "$sdl_version" \>= 1.2.0 >/dev/null; then
  230. + AC_MSG_RESULT(yes)
  231. + SDL_CFLAGS="`$SDL_CONFIG --cflags`"
  232. + SDL_LIBS="`$SDL_CONFIG --libs`"
  233. + AC_DEFINE(GRDRV_SDL)
  234. + drivers="$drivers SDL"
  235. + CPPFLAGS="$CPPFLAGS $SDL_CFLAGS"
  236. + AC_CHECK_LIB(Xext, XextAddDisplay)
  237. + LIBS="$SDL_LIBS $LIBS"
  238. + else
  239. + AC_MSG_RESULT(no)
  240. + fi
  241. + fi
  242. +fi
  243.  
  244. if test "$disable_pmshell" != yes ; then
  245. AC_CACHE_CHECK([for pmshell], ac_cv_have_pmshell,
  246. diff -rupN links-2.3/default.c links-2.3.zipt/default.c
  247. --- links-2.3/default.c 2011-06-26 16:11:29.000000000 -0400
  248. +++ links-2.3.zipt/default.c 2012-06-22 09:35:57.000000000 -0400
  249. @@ -140,10 +140,26 @@ unsigned char *p_arse_options(int argc,
  250. return "";
  251. }
  252.  
  253. +#if 1 /* ZIPIT_Z2 */
  254. +/* Use off white for background on ZIPIT instead of ugly gray. */
  255. +unsigned int default_bgcolor = 0xFFFFDD;
  256. +
  257. +unsigned char *parse_options(int argc, unsigned char *argv[])
  258. +{
  259. + unsigned char *retval;
  260. + retval = p_arse_options(argc, argv, all_options);
  261. + default_bg_g.r = (default_bgcolor >> 16) & 0xFF;
  262. + default_bg_g.g = (default_bgcolor >> 8) & 0xFF;
  263. + default_bg_g.b = (default_bgcolor ) & 0xFF;
  264. + return retval;
  265. +}
  266. +
  267. +#else
  268. unsigned char *parse_options(int argc, unsigned char *argv[])
  269. {
  270. return p_arse_options(argc, argv, all_options);
  271. }
  272. +#endif
  273.  
  274. unsigned char *get_token(unsigned char **line)
  275. {
  276. @@ -426,6 +442,11 @@ void load_config_file(unsigned char *pre
  277. return;
  278. ok:
  279. parse_config_file(config_file, c, all_options);
  280. +#if 1 /* ZIPIT_Z2 */
  281. + default_bg_g.r = (default_bgcolor >> 16) & 0xFF;
  282. + default_bg_g.g = (default_bgcolor >> 8) & 0xFF;
  283. + default_bg_g.b = (default_bgcolor ) & 0xFF;
  284. +#endif
  285. mem_free(c);
  286. mem_free(config_file);
  287. }
  288. @@ -1474,7 +1495,13 @@ struct rgb default_link = { 255, 255, 25
  289. struct rgb default_vlink = { 255, 255, 0, 0 };
  290.  
  291. struct rgb default_fg_g = { 0, 0, 0, 0 };
  292. +#if 1 /* ZIPIT_Z2 */
  293. +/* Use off white for background on ZIPIT instead of ugly gray. */
  294. +struct rgb default_bg_g = { 0xFF, 0xFF, 0xDD, 0 };
  295. +//unsigned int default_bgcolor = 0xFFFFDD;
  296. +#else
  297. struct rgb default_bg_g = { 192, 192, 192, 0 };
  298. +#endif
  299. struct rgb default_link_g = { 0, 0, 255, 0 };
  300. struct rgb default_vlink_g = { 0, 0, 128, 0 };
  301.  
  302. @@ -1621,6 +1648,9 @@ struct option html_options[] = {
  303. {1, gen_cmd, num_rd, num_wr, 0, 1, &dds.target_in_new_window, "html_target_in_new_window", "html-target-in-new-window"},
  304. {1, gen_cmd, num_rd, num_wr, 0, 9, &dds.margin, "html_margin", "html-margin"},
  305. {1, gen_cmd, num_rd, num_wr, 1, MAX_FONT_SIZE, &dds.font_size, "html_font_size", "html-user-font-size"},
  306. +#if 1 /* ZIPIT_Z2 */
  307. + {1, gen_cmd, num_rd, num_wr, 0, 0xffffff, &default_bgcolor, "html_default_bgcolor", "html-default-bgcolor"},
  308. +#endif
  309. {0, NULL, NULL, NULL, 0, 0, NULL, NULL, NULL},
  310. };
  311.  
  312. diff -rupN links-2.3/sdl.c links-2.3.zipt/sdl.c
  313. --- links-2.3/sdl.c 1969-12-31 19:00:00.000000000 -0500
  314. +++ links-2.3.zipt/sdl.c 2012-06-22 09:35:58.000000000 -0400
  315. @@ -0,0 +1,1016 @@
  316. +/*sdl.c
  317. + -- SDL graphic driver for Links (version 0.1.2)
  318. +
  319. + Copyright (C) 2004 Samuel Behan <sam(at)frida(dot)fri(dot)utc(dot)sk>
  320. +
  321. + This driver is free software; you can redistribute it and/or
  322. + modify it under the terms of the GNU General Public License
  323. + as published by the Free Software Foundation; either version 2
  324. + of the License, or (at your option) any later version.
  325. +
  326. + This driver is distributed in the hope that it will be useful,
  327. + but WITHOUT ANY WARRANTY; without even the implied warranty of
  328. + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  329. + General Public License for more details.
  330. +
  331. + ---
  332. + I've wrote this driver just as a proof of concept for using SDL library. I wanted
  333. + to use something easy, so i've decided for the world's best web browser :)
  334. +
  335. + TODO & BUGS:
  336. + - keyboard input system doesn't handles all characters, because sdl ignores any
  337. + system mappings and provides something like `raw keyboard access'
  338. + - *_strip functions are possibly bad implemented, actualy i don't understand what
  339. + they should do, or better i'm too lazy to find it out :)
  340. + - video initialization is static only, nor parametrized !!!
  341. + - BUGBUG: aa-lib nor caca lib, dont display nicely - they actualy display nothing ;(
  342. + This needs to be fixed, becase links over aa-lib as that what i've been
  343. + dreaming of [ try set env SDL_VIDEODRIVER="aalib" ]
  344. + * resize does not works (fixed)
  345. + ? sdl_set_title should possibly convert passed strings
  346. + ...and many more, not found yet :)
  347. +*/
  348. +
  349. +
  350. +#include "cfg.h"
  351. +
  352. +#ifdef GRDRV_SDL
  353. +
  354. +#ifdef TEXT
  355. +#undef TEXT
  356. +#endif
  357. +
  358. +#include "links.h"
  359. +#include <signal.h>
  360. +/* #include "arrow.inc" */
  361. +
  362. +/*sdl inclusions*/
  363. +#include <SDL.h>
  364. +#include <SDL_gfxPrimitives.h>
  365. +
  366. +
  367. +/* helper tools */
  368. +/* FIXME: enabled debug mode */
  369. +#undef DEBUG
  370. +#ifdef DEBUG
  371. +#include <assert.h>
  372. +#define S_ASSERT(code) assert((code))
  373. +#define S_ON_DEBUG(code) code
  374. +#define S_ON_DEBUG_TRACE(str) fprintf(stderr, "[%s:%s:%d] %s\n", __FILE__, __PRETTY_FUNCTION__, __LINE__, str);
  375. +#else
  376. +#define S_ASSERT(code)
  377. +#define S_ON_DEBUG(code)
  378. +#define S_ON_DEBUG_TRACE(str)
  379. +#endif
  380. +
  381. +/* internal types */
  382. +typedef unsigned char u_char_t;
  383. +typedef unsigned short int u_short_t;
  384. +struct graphics_driver sdl_driver;
  385. +
  386. +/* keysyms */
  387. +#include "sdl_data.inc"
  388. +
  389. +static struct t_sdl_driver_data {
  390. + u_char_t *video_drv; /* used video driver name */
  391. + SDL_VideoInfo *video_info; /* video informations */
  392. + SDL_Cursor *cursor; /* cursor */
  393. + int event_timer; /* event timer id */
  394. + struct {
  395. + long int flags; /* video flags */
  396. + short int width;
  397. + short int height;
  398. + short int depth;
  399. + } video;
  400. +} sdl_data = {
  401. + NULL,
  402. + NULL,
  403. + NULL,
  404. + 0,
  405. + { 0, 0, 0, 0 },
  406. +};
  407. +#define sdl_VIDEO_WIDTH sdl_DATA.video.width
  408. +#define sdl_VIDEO_HEIGHT sdl_DATA.video.height
  409. +#define sdl_VIDEO_DEPTH sdl_DATA.video.depth
  410. +#define sdl_VIDEO_FLAGS sdl_DATA.video.flags
  411. +
  412. +/* DRIVER DATA HELPERS */
  413. +#define sdl_DATA sdl_data
  414. +#define sdl_DATA_FREE() if(sdl_DATA.video_drv != NULL) mem_free(sdl_DATA.video_drv); \
  415. + if(sdl_DATA.video_info != NULL) mem_free(sdl_DATA.video_info);
  416. +struct t_sdl_device_data {
  417. + SDL_Surface *p_surf; /* primary surface */
  418. + struct graphics_device *g_dev; /* draphic device */
  419. +/* SDL_Rect u_rect; */ /* update rectangle */
  420. + short u_pending; /* update pending */
  421. +};
  422. +#define sdl_SURFACE(ptr) (ptr)->p_surf
  423. +#define sdl_GD(ptr) (ptr)->g_dev
  424. +#define sdl_URECT(ptr) (ptr)->u_rect
  425. +#define sdl_UPENDING(ptr) (ptr)->u_pending
  426. +
  427. +/* HELPER FUNCTIONS */
  428. +#define sdl_COLOR(col) (((col) << 2) | 0x00)
  429. +
  430. +#define sdl_SETUP_TIMER(dev) \
  431. + sdl_DATA.event_timer = install_timer(20, sdl_catch_event, (dev))
  432. +#define sdl_KILL_TIMER() \
  433. + kill_timer(sdl_DATA.event_timer)
  434. +
  435. +/* event catch helpers */
  436. +#define sdl_CATCH_EVENTS_NUM 3
  437. +#define sdl_MOUSE_STATE(var_in, var_out, def) \
  438. + if(var_in == SDL_BUTTON(SDL_BUTTON_LEFT)) \
  439. + var_out |= B_LEFT; \
  440. + else if(var_in == SDL_BUTTON(SDL_BUTTON_RIGHT)) \
  441. + var_out |= B_RIGHT; \
  442. + else if(var_in == SDL_BUTTON(SDL_BUTTON_MIDDLE)) \
  443. + var_out |= B_MIDDLE; \
  444. + else if(var_in == SDL_BUTTON(SDL_BUTTON_WHEELUP)) \
  445. + var_out |= B_WHEELUP; \
  446. + else if(var_in == SDL_BUTTON(SDL_BUTTON_WHEELDOWN)) \
  447. + var_out |= B_WHEELDOWN; \
  448. + else var_out = (def);
  449. +
  450. +
  451. +
  452. +/* tha event handler */
  453. +static void sdl_catch_event(void *data)
  454. +{
  455. + register int i = 0, ev_num = 0;
  456. + register struct t_sdl_device_data *dev = NULL;
  457. + SDL_Event events[sdl_CATCH_EVENTS_NUM];
  458. + u_short_t fl = 0;
  459. + /* speedup (BUGGY, not thread safe !?!) */
  460. + static u_short_t o_x = 0, o_y = 0, o_fl = 0;
  461. +#ifdef ZIPIT_Z2
  462. + static int dead_key = 0;
  463. +
  464. + //static FILE *fp = NULL;
  465. +#endif
  466. +
  467. + SDL_PumpEvents();
  468. + ev_num = SDL_PeepEvents(events, sdl_CATCH_EVENTS_NUM, SDL_GETEVENT, SDL_ALLEVENTS);
  469. +/*
  470. + S_ON_DEBUG(fprintf(stderr, "event: received %d\n", ev_num); );
  471. +*/
  472. + S_ASSERT(ev_num != -1);
  473. + /* get dev data */
  474. + dev = (struct t_sdl_device_data *) data;
  475. + for(i = 0; i < ev_num; i++)
  476. + {
  477. +#define event events[i]
  478. + switch (event.type)
  479. + {
  480. +/* case SDL_ACTIVEEVENT: */
  481. + /* mouse motion */
  482. + case SDL_MOUSEMOTION:
  483. + /* mose btn state */
  484. + S_ON_DEBUG_TRACE("event: mouse motion");
  485. + fl = B_DRAG;
  486. + sdl_MOUSE_STATE(event.motion.state, fl, B_MOVE);
  487. + /* save som calls (SDL generates many similar events) */
  488. + if(event.motion.x == o_x && event.motion.y == o_y && fl == o_fl)
  489. + break;
  490. + /* call handler */
  491. + sdl_GD(dev)->mouse_handler(sdl_GD(dev), event.motion.x, event.motion.y, fl);
  492. + o_x = event.motion.x;
  493. + o_y = event.motion.y;
  494. + o_fl = fl;
  495. + break;
  496. + /* mouse click */
  497. + case SDL_MOUSEBUTTONUP:
  498. + case SDL_MOUSEBUTTONDOWN:
  499. + if(event.type == SDL_MOUSEBUTTONDOWN)
  500. + fl = B_DOWN;
  501. + else
  502. + fl = B_UP;
  503. + S_ON_DEBUG_TRACE("event: mouse click");
  504. +/* sdl_MOUSE_STATE(event.button.state, fl, fl); */
  505. + sdl_GD(dev)->mouse_handler(sdl_GD(dev), event.button.x, event.button.y, fl);
  506. + break;
  507. + /* keyboard */
  508. + case SDL_KEYUP:
  509. + S_ON_DEBUG_TRACE("event: key up");
  510. + break;
  511. + case SDL_KEYDOWN:
  512. + { /*translate */
  513. + int k = 0;
  514. + int key = 0;
  515. +/*
  516. +* //////////////////////////
  517. +* //FIXME: needs rework !!!
  518. +* // -- sdl works at low-level ignoring any system keymappings
  519. +* // i've no idea how to do it (easily):(
  520. +* //////////////////////////
  521. +*/
  522. + S_ON_DEBUG_TRACE("event: key down");
  523. + while(sdl_keysyms[k].sym != event.key.keysym.sym && sdl_keysyms[k].sym != SDLK_LAST)
  524. + k++;
  525. + S_ASSERT(sdl_keysyms[k].sym != SDLK_LAST);
  526. + /* FIXME: hope nobody changes enumeration values in SDL libs */
  527. + if(sdl_keysyms[k].sym >= SDLK_NUMLOCK && sdl_keysyms[k].sym <= SDLK_COMPOSE)
  528. + break; /* aka ignore modifiers */
  529. +#ifdef ZIPIT_Z2
  530. + //if (fp == NULL)
  531. + // fp = fopen("/tmp/keylog.txt", "w");
  532. +
  533. + /* key re-map */
  534. + key = sdl_keysyms[k].key;
  535. + fl = event.key.keysym.mod;
  536. + if((fl & KMOD_RALT) || (fl & KMOD_LALT)) /* (fl & KMOD_ALT) */
  537. + {
  538. + if(fl & KMOD_SHIFT)
  539. + key = sdl_keysyms[k].sakey;
  540. + else
  541. + key = sdl_keysyms[k].akey;
  542. + }
  543. + else if(fl & KMOD_SHIFT)
  544. + {
  545. + if((fl & KMOD_RALT) || (fl & KMOD_LALT)) /* (fl & KMOD_ALT) */
  546. + key = sdl_keysyms[k].sakey;
  547. + else
  548. + key = sdl_keysyms[k].skey;
  549. + }
  550. +#if 1
  551. + //fprintf(fp, "sym=%d, key=%d, u=%d, mod=0x%0X\n",
  552. + // (int)sdl_keysyms[k].key, key, event.key.keysym.unicode, (int)fl);
  553. + /* Try the Unicode if available? (bad for sticky and KBD_* keys) */
  554. + if (((key >= 'a') && (key <= 'z')) || ((key >= 'A') && (key <= 'Z')) || (key == ' '))
  555. + {
  556. + //if (!(fl & KMOD_CTRL) && (event.key.keysym.unicode == 0)) // Dead key
  557. + if (event.key.keysym.unicode == 0) // Dead key
  558. + {
  559. + switch (key) {
  560. + case 'A':
  561. + case 'G':
  562. + case 'D':
  563. + case 'F':
  564. + case 'T':
  565. + case 'C':
  566. + dead_key = key;
  567. + default:
  568. + break;
  569. + case 'V':
  570. + dead_key = 'C'; // (doppleganger for c)
  571. + break;
  572. + }
  573. + //if (dead_key) fprintf(fp, " dead=%c\n", dead_key);
  574. + //else fprintf(fp, " undead=0\n");
  575. + break; /* skip COMPOSE (dead) keys */
  576. + }
  577. + else if (dead_key)
  578. + {
  579. + if((key == 'V') && ((fl & KMOD_ALT) && (fl & KMOD_SHIFT)))
  580. + {
  581. + //fprintf(fp, " decomposing %c+<%c>", dead_key, key);
  582. + break; // (doppleganger for c)
  583. + }
  584. + //fprintf(fp, " composing %c+<%c>", dead_key, key);
  585. + if (key == ' ')
  586. + key = 'Z'+1;
  587. + if (dead_key == 'G') // (event.key.keysym.unicode == 0x300) // grave
  588. + key = grave_map[key - 'A'];
  589. + else if (dead_key == 'A') // (event.key.keysym.unicode == 0x301) // acute
  590. + key = acute_map[key - 'A'];
  591. + else if (dead_key == 'C') // (event.key.keysym.unicode == 0x302) // circum
  592. + key = circumflex_map[key - 'A'];
  593. + else if (dead_key == 'T') // (event.key.keysym.unicode == 0x303) // tilde
  594. + key = tilde_map[key - 'A'];
  595. + else if (dead_key == 'D') // (event.key.keysym.unicode == 0x308) // dia
  596. + key = diaeresis_map[key - 'A'];
  597. + else if (dead_key == 'F') // (event.key.keysym.unicode == 0x327) // cedilla
  598. + key = cedilla_map[key - 'A'];
  599. + dead_key = 0;
  600. + //fprintf(fp, " = +<%c>\n", key);
  601. + }
  602. +#if 0
  603. + else if((key == 'O') && ((fl & KMOD_ALT) && (fl & KMOD_SHIFT)))
  604. + break; // (doppleganger for p)
  605. + else if((key == 'M') && ((fl & KMOD_ALT) && (fl & KMOD_SHIFT)))
  606. + key = 0xBF; // Upside down question (instead of percent)
  607. + else if((key == 'R') && ((fl & KMOD_ALT) && (fl & KMOD_SHIFT)))
  608. + key = 0xB0; // Happier place for degree
  609. +#else
  610. + else if((key == 'P') && ((fl & KMOD_ALT) && (fl & KMOD_SHIFT)))
  611. + break; // (doppleganger for o)
  612. + else if((key == 'Q') && ((fl & KMOD_ALT) && (fl & KMOD_SHIFT)))
  613. + key = 0xBF; // Happier place for upside down question
  614. +#endif
  615. + else if((key == 'W') && ((fl & KMOD_ALT) && (fl & KMOD_SHIFT)))
  616. + break; // (doppleganger for e)
  617. +#if 0
  618. + else if((key == 'N') && ((fl & KMOD_ALT) && (fl & KMOD_SHIFT)))
  619. + {
  620. + dead_key = 'C'; // Happier place for circumflex
  621. + //fprintf(fp, " fakedead=%c\n", dead_key);
  622. + break;
  623. + }
  624. +#endif
  625. + else if((key == 'V') && ((fl & KMOD_ALT) && (fl & KMOD_SHIFT)))
  626. + {
  627. + dead_key = 'C'; // Happier place for circumflex
  628. + //fprintf(fp, " fakeDEAD=%c\n", dead_key);
  629. + break;
  630. + }
  631. + else
  632. + {
  633. + dead_key = 0;
  634. + if (fl & KMOD_CTRL)
  635. + {
  636. + /* Skip unicode translation for ctrl keys. */
  637. + }
  638. + else
  639. + if (((event.key.keysym.unicode & 0xff80) == 0)) // ASCII
  640. + key = event.key.keysym.unicode;
  641. + else if ((event.key.keysym.unicode != 0) &&
  642. + ((event.key.keysym.unicode & 0xff00) == 0)) // Latin 1 (8bit)
  643. + key = event.key.keysym.unicode;
  644. + else if (event.key.keysym.unicode == 0x20AC) // euro
  645. + key = 0xA4; // Latin15
  646. + //fprintf(fp, " unicoding to <%c>\n", key);
  647. +
  648. + }
  649. + }
  650. + else
  651. + dead_key = 0;
  652. +#endif
  653. + //printf(fp, " sym=%d, key=%d, u=%d, mod=0x%0X\n", (int)sdl_keysyms[k].key, key, event.key.keysym.unicode, (int)fl);
  654. + /* find modifiers */
  655. + fl = 0;
  656. + if(event.key.keysym.mod & KMOD_SHIFT)
  657. + fl |= KBD_SHIFT;
  658. + if(event.key.keysym.mod & KMOD_ALT)
  659. + fl |= KBD_ALT;
  660. + if(event.key.keysym.mod & KMOD_CTRL)
  661. + fl |= KBD_CTRL;
  662. + /* If ALT changes the key on the Zipit then hide the SHIFT and ALT modifiers. */
  663. + if((event.key.keysym.mod & KMOD_ALT) && (key != sdl_keysyms[k].key))
  664. + fl &= ~(KBD_ALT|KBD_SHIFT);
  665. +#else /* not ZIPIT_Z2 */
  666. + /* find modifiers */
  667. + fl = 0;
  668. + if(event.key.keysym.mod & KMOD_SHIFT)
  669. + fl |= KBD_SHIFT;
  670. + if(event.key.keysym.mod & KMOD_ALT)
  671. + fl |= KBD_ALT;
  672. + if(event.key.keysym.mod & KMOD_CTRL)
  673. + fl |= KBD_CTRL;
  674. + /* key re-map */
  675. + key = sdl_keysyms[k].key;
  676. + /* upper letters fix (not handled directly by SDL) */
  677. + if(key >= 97 && key <= 122 && fl & KBD_SHIFT)
  678. + { key -= 32;
  679. + fl &= ~KBD_SHIFT; }
  680. + /* find modifiers */
  681. + fl = 0;
  682. + if(event.key.keysym.mod & KMOD_SHIFT)
  683. + fl |= KBD_SHIFT;
  684. + if(event.key.keysym.mod & KMOD_ALT)
  685. + fl |= KBD_ALT;
  686. + if(event.key.keysym.mod & KMOD_CTRL)
  687. + fl |= KBD_CTRL;
  688. +#endif
  689. + /* send keyb */
  690. + S_ON_DEBUG(fprintf(stderr, "KEY(%d) = %c&%d\n", k, key, fl););
  691. + if(fl & KBD_CTRL && sdl_keysyms[k].sym == SDLK_c)
  692. + sdl_GD(dev)->keyboard_handler(sdl_GD(dev), KBD_CTRL_C, 0);
  693. + else
  694. + sdl_GD(dev)->keyboard_handler(sdl_GD(dev), key, fl);
  695. + }break;
  696. + case SDL_VIDEORESIZE:
  697. + /* new dims */
  698. + sdl_GD(dev)->size.x2 = event.resize.w;
  699. + sdl_GD(dev)->size.y2 = event.resize.h;
  700. + sdl_driver.x = event.resize.w;
  701. + sdl_driver.y = event.resize.h;
  702. + /* resize */
  703. + /*
  704. + S_ON_DEBUG(fprintf(stderr, "RESIZE(%dx%d)\n", event.resize.w, event.resize.h));
  705. + */
  706. + /* info resize */
  707. + sdl_GD(dev)->resize_handler(sdl_GD(dev));
  708. + break;
  709. +/*
  710. + case SDL_VIDEOEXPOSE:
  711. +*/
  712. + case SDL_QUIT:
  713. + sdl_GD(dev)->keyboard_handler(sdl_GD(dev), KBD_CLOSE, 0);
  714. + break;
  715. + default:
  716. + /* printf("Unhandled event: %d !\n", event.type); */
  717. + break;
  718. + }
  719. + }
  720. +#undef event
  721. + sdl_SETUP_TIMER((void *)dev);
  722. + return;
  723. +}
  724. +
  725. +static inline void sdl_update_sc(void *data)
  726. +{
  727. + struct t_sdl_device_data *dev = NULL;
  728. +
  729. + S_ON_DEBUG_TRACE("in");
  730. + /* assing struct */
  731. + if(data == NULL)
  732. + return;
  733. + dev = (struct t_sdl_device_data *)data;
  734. +
  735. + /* check if update neccesary */
  736. + if(dev == NULL || sdl_SURFACE(dev) == NULL)
  737. + return;
  738. + if(!sdl_UPENDING(dev))
  739. + return;
  740. +
  741. + /* do update screen */
  742. +/* SDL_UpdateRect(sdl_SURFACE(dev), sdl_URECT(dev).x, sdl_URECT(dev).y, sdl_URECT(dev).w, sdl_URECT(dev).h);
  743. +*/
  744. + SDL_UpdateRect(sdl_SURFACE(dev), 0, 0, 0, 0);
  745. + /* remove pending flag */
  746. + sdl_UPENDING(dev) = 0;
  747. + S_ON_DEBUG_TRACE("out");
  748. + return;
  749. +}
  750. +
  751. +
  752. +/* quite stuppit function */
  753. +#define sdl_NORM_UPDATE 0
  754. +#define sdl_FULL_UPDATE 1
  755. +static inline void sdl_register_update(struct t_sdl_device_data *dev, int x, int y, int w, int h, int opt)
  756. +{
  757. + S_ON_DEBUG_TRACE("in");
  758. + sdl_UPENDING(dev) = 1;
  759. + register_bottom_half(sdl_update_sc, dev);
  760. + S_ON_DEBUG_TRACE("out");
  761. + return;
  762. +}
  763. +
  764. +/* partialy stolen from documentation :)
  765. + XXX: we can quite easily add here alpha blending :))) */
  766. +static inline void sdl_putpixel(SDL_Surface *s, int x, int y, unsigned long pixel)
  767. +{
  768. + Uint8 *p;
  769. +
  770. + /* check our clip rect */
  771. + if(!((s->clip_rect.x < x && (s->clip_rect.x + s->clip_rect.w) > x)
  772. + && (s->clip_rect.y < y && (s->clip_rect.y + s->clip_rect.h) > y)))
  773. + return;
  774. + /* our sanity (fight int overflow :) */
  775. + pixel &= (1<<(s->format->BytesPerPixel)) - 1;
  776. + /* our point */
  777. + p = (Uint8 *)s->pixels + y * s->pitch + x * s->format->BytesPerPixel;
  778. + switch(s->format->BytesPerPixel) {
  779. + case 1:
  780. + *p = pixel;
  781. + break;
  782. + case 2:
  783. + *(Uint16 *)p = pixel;
  784. + break;
  785. +
  786. + case 3:
  787. + if(SDL_BYTEORDER == SDL_BIG_ENDIAN) {
  788. + p[0] = (pixel >> 16) & 0xff;
  789. + p[1] = (pixel >> 8) & 0xff;
  790. + p[2] = pixel & 0xff;
  791. + } else {
  792. + p[0] = pixel & 0xff;
  793. + p[1] = (pixel >> 8) & 0xff;
  794. + p[2] = (pixel >> 16) & 0xff;
  795. + }
  796. + break;
  797. + case 4:
  798. + *(Uint32 *)p = pixel;
  799. + break;
  800. + }
  801. + return;
  802. +}
  803. +
  804. +
  805. +/* DRIVER FUNCTIONS */
  806. +
  807. +/* init driver */
  808. +u_char_t *sdl_init_driver(u_char_t *param, u_char_t *display)
  809. +{
  810. + S_ON_DEBUG_TRACE("in");
  811. + /* init sdl video */
  812. + if(SDL_Init(SDL_INIT_VIDEO) != 0)
  813. + return (u_char_t *)stracpy((u_char_t *)SDL_GetError());
  814. +
  815. + /* fetch current video hw informations */
  816. + sdl_DATA.video_info = (SDL_VideoInfo *) mem_alloc(sizeof(SDL_VideoInfo));
  817. + S_ASSERT(sdl_DATA.video_info != NULL);
  818. + memcpy(sdl_DATA.video_info, SDL_GetVideoInfo(), (sizeof(SDL_VideoInfo)));
  819. + /* fetch driver name */
  820. + sdl_DATA.video_drv = (u_char_t *)mem_alloc(sizeof(u_char_t) * 11);
  821. + S_ASSERT(sdl_DATA.video_drv != NULL);
  822. + SDL_VideoDriverName((char *)sdl_DATA.video_drv, 11);
  823. +
  824. + /*TODO: SDL_VideoModeOk() */
  825. +
  826. + /* setup mode */
  827. + sdl_VIDEO_FLAGS |= SDL_HWSURFACE | SDL_HWPALETTE | SDL_RLEACCEL | SDL_RESIZABLE;
  828. + sdl_VIDEO_WIDTH = 320; /* ZIPIT_Z2 */
  829. + sdl_VIDEO_HEIGHT = 240; /* ZIPIT_Z2 */
  830. + sdl_VIDEO_DEPTH = sdl_DATA.video_info->vfmt->BitsPerPixel;
  831. +
  832. + /* set driv config */
  833. + sdl_driver.x = sdl_VIDEO_WIDTH;
  834. + sdl_driver.y = sdl_VIDEO_HEIGHT;
  835. + sdl_driver.depth = ((sdl_DATA.video_info->vfmt->BytesPerPixel & 0x7) |
  836. + ((sdl_DATA.video_info->vfmt->BitsPerPixel & 0x1F) << 3));
  837. +
  838. + /* create cursor :) (need nice one) */
  839. +#ifdef sdl_HAVE_CURSOR
  840. + if(sdl_DATA.cursor == NULL)
  841. + {
  842. + /* sdl_DATA.cursor = SDL_CreateCursor((void *)arrow, (void *)arrow, 32, 32, 0, 0);
  843. + */
  844. + S_ASSERT(sdl_DATA.cursor != NULL);
  845. + }
  846. +#endif
  847. + /* key repeat */
  848. +#ifdef ZIPIT_Z2
  849. + /* On the zipit EnableUNICODE will pass the red keys in the .unicode field */
  850. + /* Then I can read the .unicode field instead of the raw .key and .mod. */
  851. + /* But that runs into trouble with the sticky keymap. */
  852. +#endif
  853. + SDL_EnableUNICODE(1);
  854. + SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL);
  855. +
  856. + S_ON_DEBUG(fprintf(stderr, "VIDEO(%s): %dx%dx%d [%d]\n", sdl_DATA.video_drv,
  857. + sdl_VIDEO_WIDTH, sdl_VIDEO_HEIGHT, sdl_VIDEO_DEPTH, sdl_driver.depth));
  858. + return NULL;
  859. +}
  860. +
  861. +/* shutdown driver */
  862. +void sdl_shutdown_driver()
  863. +{
  864. + S_ON_DEBUG_TRACE("in");
  865. + sdl_KILL_TIMER();
  866. + sdl_DATA_FREE();
  867. + SDL_Quit();
  868. + return;
  869. +}
  870. +
  871. +/* create new graph device */
  872. +struct graphics_device *sdl_init_device()
  873. +{
  874. + struct graphics_device *dev = NULL;
  875. + struct t_sdl_device_data *data = NULL;
  876. +
  877. + S_ON_DEBUG_TRACE("in");
  878. +
  879. + /* device data */
  880. + data = (struct t_sdl_device_data *) mem_alloc(sizeof(struct t_sdl_device_data));
  881. + S_ASSERT(data != NULL);
  882. + memset(data, 0, sizeof(struct t_sdl_device_data));
  883. +
  884. + /* init video mode */
  885. + sdl_SURFACE(data) = SDL_SetVideoMode(sdl_VIDEO_WIDTH, sdl_VIDEO_HEIGHT, sdl_VIDEO_DEPTH,
  886. + sdl_VIDEO_FLAGS);
  887. + if(sdl_SURFACE(data) == NULL)
  888. + return NULL;
  889. + SDL_SetAlpha(sdl_SURFACE(data), SDL_SRCALPHA, 0xff);
  890. +
  891. + /* FIXME: here we shoulde re-update video info by calling SDL_VideoInfo() again */
  892. +
  893. + /* alloc gd */
  894. + dev = (struct graphics_device *) mem_alloc(sizeof(struct graphics_device));
  895. + S_ASSERT(dev != NULL);
  896. +
  897. + /* setup gdS */
  898. + dev->size.x1 = 0;
  899. + dev->size.y1 = 0;
  900. + dev->size.x2 = sdl_VIDEO_WIDTH;
  901. + dev->size.y2 = sdl_VIDEO_HEIGHT;
  902. + dev->clip = dev->size;
  903. +
  904. + /*driver */
  905. + sdl_driver.flags |= GD_NEED_CODEPAGE;
  906. + sdl_GD(data) = dev;
  907. +
  908. + /*driver */
  909. + dev->drv = &sdl_driver;
  910. + dev->driver_data = (void *) data;
  911. + dev->user_data = NULL;
  912. +
  913. + /*set my cursor */
  914. + if(sdl_DATA.cursor != NULL)
  915. + SDL_SetCursor(sdl_DATA.cursor);
  916. +
  917. + /*init timer */
  918. + if(sdl_DATA.event_timer == 0)
  919. + sdl_SETUP_TIMER((void *)data);
  920. + S_ON_DEBUG_TRACE("out");
  921. + return dev;
  922. +}
  923. +
  924. +/* destroy device */
  925. +void sdl_shutdown_device(struct graphics_device *drv)
  926. +{
  927. + struct t_sdl_device_data *dev = NULL;
  928. +
  929. + S_ON_DEBUG_TRACE("in");
  930. + dev = (struct t_sdl_device_data *) drv->driver_data;
  931. + S_ASSERT(dev != NULL);
  932. +
  933. + /* unregister bh */
  934. + unregister_bottom_half(sdl_update_sc, dev);
  935. +
  936. + /* deinit video */
  937. + SDL_FreeSurface(sdl_SURFACE(dev));
  938. + sdl_SURFACE(dev) = NULL;
  939. + mem_free(dev);
  940. + drv->driver_data = NULL;
  941. + mem_free(drv);
  942. + S_ON_DEBUG_TRACE("out");
  943. + return;
  944. +}
  945. +
  946. +/* get driver parameters
  947. + XXX: what is this fx() for ??? */
  948. +u_char_t *sdl_get_driver_param()
  949. +{
  950. + S_ON_DEBUG_TRACE("in");
  951. + S_ASSERT(0);
  952. + return NULL;
  953. +}
  954. +
  955. +/* GRAPHICS */
  956. +
  957. +/* create empty bitmap */
  958. +int sdl_get_empty_bitmap(struct bitmap *bmp)
  959. +{
  960. + SDL_Surface *s = NULL;
  961. +
  962. + S_ON_DEBUG_TRACE("in");
  963. +
  964. + /* null */
  965. + bmp->data = bmp->flags = bmp->user = NULL;
  966. + bmp->skip = 0;
  967. +
  968. + /* alloc surface */
  969. + /* FIXED: ignoring byteorder here (taking from video info) */
  970. + s = (SDL_Surface *)SDL_CreateRGBSurface(sdl_VIDEO_FLAGS, bmp->x, bmp->y, sdl_VIDEO_DEPTH,
  971. + sdl_DATA.video_info->vfmt->Rmask, sdl_DATA.video_info->vfmt->Gmask,
  972. + sdl_DATA.video_info->vfmt->Bmask, sdl_DATA.video_info->vfmt->Amask);
  973. + S_ASSERT(s != NULL);
  974. +
  975. + /* copy data */
  976. + bmp->data = (void *)s->pixels;
  977. + bmp->skip = s->pitch;
  978. + bmp->flags = (void *)s;
  979. +
  980. + /* lock if required */
  981. + if(SDL_MUSTLOCK(s))
  982. + SDL_LockSurface(s);
  983. + S_ON_DEBUG_TRACE("out");
  984. + return 0;
  985. +}
  986. +
  987. +/* create filled bitmap */
  988. +int sdl_get_filled_bitmap(struct bitmap *bmp, long color)
  989. +{
  990. + S_ON_DEBUG_TRACE("in");
  991. + S_ASSERT(0);
  992. + return 0;
  993. +}
  994. +
  995. +/* register bitmap */
  996. +void sdl_register_bitmap(struct bitmap *bmp)
  997. +{
  998. + SDL_Surface *s = NULL;
  999. +
  1000. + S_ON_DEBUG_TRACE("in");
  1001. +
  1002. + /* unlock surface */
  1003. + s = (SDL_Surface *)bmp->flags;
  1004. + if(SDL_MUSTLOCK(s))
  1005. + SDL_UnlockSurface(s);
  1006. + /* hide pixel mem */
  1007. + bmp->data = NULL;
  1008. + S_ON_DEBUG_TRACE("out");
  1009. + return;
  1010. +}
  1011. +
  1012. +
  1013. +/* prepare strip */
  1014. +void *sdl_prepare_strip(struct bitmap *bmp, int top, int lines)
  1015. +{
  1016. + SDL_Surface *s = NULL;
  1017. +
  1018. + S_ON_DEBUG_TRACE("in");
  1019. +
  1020. + /* unlock surface */
  1021. + s = (SDL_Surface *)bmp->flags;
  1022. + if(SDL_MUSTLOCK(s))
  1023. + SDL_LockSurface(s);
  1024. + S_ON_DEBUG_TRACE("out");
  1025. + return (void *)(s->pixels + (top * s->pitch));
  1026. +}
  1027. +
  1028. +/* commit strip */
  1029. +void sdl_commit_strip(struct bitmap *bmp, int top, int lines)
  1030. +{
  1031. + SDL_Surface *s = NULL;
  1032. +
  1033. + S_ON_DEBUG_TRACE("in");
  1034. +
  1035. + /* unlock surface */
  1036. + s = (SDL_Surface *)bmp->flags;
  1037. + if(SDL_MUSTLOCK(s))
  1038. + SDL_UnlockSurface(s);
  1039. + return;
  1040. +}
  1041. +
  1042. +/* unregister bitmap */
  1043. +void sdl_unregister_bitmap(struct bitmap *bmp)
  1044. +{
  1045. + SDL_Surface *s = NULL;
  1046. +
  1047. + S_ON_DEBUG_TRACE("in");
  1048. +
  1049. + s = (SDL_Surface *)bmp->flags;
  1050. + S_ASSERT(s != 0);
  1051. + /* delete data */
  1052. + SDL_FreeSurface(s);
  1053. + /* null data */
  1054. + bmp->data = NULL;
  1055. + bmp->flags = NULL;
  1056. + S_ON_DEBUG_TRACE("out");
  1057. + return;
  1058. +}
  1059. +
  1060. +/* draw bmp */
  1061. +void sdl_draw_bitmap(struct graphics_device *drv, struct bitmap *bmp, int x, int y)
  1062. +{
  1063. + SDL_Surface *s = NULL;
  1064. + struct t_sdl_device_data *dev = NULL;
  1065. + SDL_Rect rect;
  1066. +
  1067. + S_ON_DEBUG_TRACE("in");
  1068. + dev = (struct t_sdl_device_data *) drv->driver_data;
  1069. + s = (SDL_Surface *)bmp->flags;
  1070. + memset(&rect, 0, sizeof(SDL_Rect));
  1071. +
  1072. + /* blit :) */
  1073. + rect.x = x;
  1074. + rect.y = y;
  1075. + SDL_BlitSurface(s, NULL, sdl_SURFACE(dev), &rect);
  1076. + sdl_register_update(dev, rect.x, rect.y, rect.w, rect.h, 0);
  1077. + S_ON_DEBUG_TRACE("out");
  1078. + return;
  1079. +}
  1080. +
  1081. +/* draw more bmps */
  1082. +void sdl_draw_bitmaps(struct graphics_device *drv, struct bitmap **bmps, int n, int x, int y)
  1083. +{
  1084. + int i = 0;
  1085. + struct t_sdl_device_data *dev = NULL;
  1086. + SDL_Rect rect;
  1087. +
  1088. + S_ON_DEBUG_TRACE("in");
  1089. + /* check */
  1090. + if(n < 1)
  1091. + return;
  1092. +
  1093. + S_ON_DEBUG(fprintf(stderr, "draw_bitmaps(drv=%p, b=%p, n=%d,%d,%d)\n", drv, bmps, n,x,y));
  1094. +
  1095. + dev = (struct t_sdl_device_data *) drv->driver_data;
  1096. + S_ON_DEBUG_TRACE("1");
  1097. + memset(&rect, 0, sizeof(SDL_Rect));
  1098. +
  1099. + /* blit */
  1100. + rect.x = x;
  1101. + rect.y = y;
  1102. + for(i = 0; i < n; i++)
  1103. + {
  1104. + S_ON_DEBUG_TRACE("2");
  1105. + SDL_BlitSurface((SDL_Surface *)bmps[i]->flags, NULL, sdl_SURFACE(dev), &rect);
  1106. + rect.x += bmps[i]->x;
  1107. + }
  1108. + /* FIXME: this should care about updating area, and possibly not update everythink */
  1109. + S_ON_DEBUG_TRACE("3");
  1110. + sdl_register_update(dev, 0, 0, 0, 0, sdl_FULL_UPDATE);
  1111. + S_ON_DEBUG_TRACE("out");
  1112. + return;
  1113. +}
  1114. +
  1115. +/* get color */
  1116. +long sdl_get_color(int rgb)
  1117. +{
  1118. + /*FIXME: not sure this is ok :) */
  1119. + return SDL_MapRGB(sdl_DATA.video_info->vfmt, ((rgb >> 16) & 0xff), ((rgb >> 8) & 0xff), ((rgb) & 0xff));
  1120. +}
  1121. +
  1122. +/* fill some area */
  1123. +void sdl_fill_area(struct graphics_device *drv, int x1, int y1, int x2, int y2, long color)
  1124. +{
  1125. + struct t_sdl_device_data *dev = NULL;
  1126. + SDL_Rect rect;
  1127. +
  1128. + S_ON_DEBUG_TRACE("in");
  1129. + dev = (struct t_sdl_device_data *) drv->driver_data;
  1130. +
  1131. +
  1132. + rect.x = x1;
  1133. + rect.y = y1;
  1134. + rect.w = x2 - x1;
  1135. + rect.h = y2 - y1;
  1136. + if(SDL_MUSTLOCK(sdl_SURFACE(dev)))
  1137. + SDL_LockSurface(sdl_SURFACE(dev));
  1138. + SDL_FillRect(sdl_SURFACE(dev), &rect, color);
  1139. + if(SDL_MUSTLOCK(sdl_SURFACE(dev)))
  1140. + SDL_UnlockSurface(sdl_SURFACE(dev));
  1141. + sdl_register_update(dev, rect.x, rect.y, rect.w, rect.h, 0);
  1142. +/* sdl_register_update(dev, x1, y1, x2, y2, 0);
  1143. +*/
  1144. + S_ON_DEBUG_TRACE("out");
  1145. + return;
  1146. +}
  1147. +
  1148. +/* draw horizontal line */
  1149. +void sdl_draw_hline(struct graphics_device *drv, int left, int y, int right, long color)
  1150. +{
  1151. + register int i = 0;
  1152. + struct t_sdl_device_data *dev = NULL;
  1153. +
  1154. + S_ON_DEBUG_TRACE("in");
  1155. + dev = (struct t_sdl_device_data *) drv->driver_data;
  1156. + if(SDL_MUSTLOCK(sdl_SURFACE(dev)))
  1157. + SDL_LockSurface(sdl_SURFACE(dev));
  1158. + for(i = left; i < right; i++)
  1159. + sdl_putpixel(sdl_SURFACE(dev), i, y, color);
  1160. + if(SDL_MUSTLOCK(sdl_SURFACE(dev)))
  1161. + SDL_UnlockSurface(sdl_SURFACE(dev));
  1162. + sdl_register_update(dev, left, y, 1, right - left, 0);
  1163. + S_ON_DEBUG_TRACE("out");
  1164. + return;
  1165. +}
  1166. +
  1167. +/* draw vertical line */
  1168. +void sdl_draw_vline(struct graphics_device *drv, int x, int top, int bottom, long color)
  1169. +{
  1170. + register int i = 0;
  1171. + struct t_sdl_device_data *dev = NULL;
  1172. +
  1173. + S_ON_DEBUG_TRACE("in");
  1174. + /* get ptr */
  1175. + dev = (struct t_sdl_device_data *) drv->driver_data;
  1176. + if(SDL_MUSTLOCK(sdl_SURFACE(dev)))
  1177. + SDL_LockSurface(sdl_SURFACE(dev));
  1178. + for(i = top; i < bottom; i++)
  1179. + sdl_putpixel(sdl_SURFACE(dev), x, i, color);
  1180. + if(SDL_MUSTLOCK(sdl_SURFACE(dev)))
  1181. + SDL_UnlockSurface(sdl_SURFACE(dev));
  1182. + sdl_register_update(dev, x, top, bottom - top, 1, 0);
  1183. + S_ON_DEBUG_TRACE("out");
  1184. + return;
  1185. +}
  1186. +
  1187. +/* horizontal scroll */
  1188. +int sdl_hscroll(struct graphics_device *drv, struct rect_set **set, int sc)
  1189. +{
  1190. + struct t_sdl_device_data *dev = NULL;
  1191. + SDL_Rect rect1, rect2;
  1192. +
  1193. + S_ON_DEBUG_TRACE("in");
  1194. + dev = (struct t_sdl_device_data *) drv->driver_data;
  1195. +
  1196. + /* rect1 */
  1197. + rect1.x = drv->clip.x1;
  1198. + rect1.y = drv->clip.y1;
  1199. + rect1.w = drv->clip.x2 - rect1.x;
  1200. + rect1.h = drv->clip.y2 - rect1.y;
  1201. +
  1202. + /* rect2 */
  1203. + rect2.x = drv->clip.x1 + sc;
  1204. + rect2.y = drv->clip.y1;
  1205. + rect2.w = drv->clip.x2 - rect1.x;
  1206. + rect2.h = drv->clip.y2 - rect1.y;
  1207. +
  1208. + SDL_BlitSurface(sdl_SURFACE(dev), &rect1, sdl_SURFACE(dev), &rect2);
  1209. + sdl_register_update(dev, rect1.x, rect1.y, rect1.w, rect1.h, 0);
  1210. + S_ON_DEBUG_TRACE("out");
  1211. + return 1;
  1212. +}
  1213. +
  1214. +/* vertical scroll */
  1215. +int sdl_vscroll(struct graphics_device *drv, struct rect_set **set, int sc)
  1216. +{
  1217. + struct t_sdl_device_data *dev = NULL;
  1218. + SDL_Rect rect1, rect2;
  1219. +
  1220. + S_ON_DEBUG_TRACE("in");
  1221. + /* get ptr */
  1222. + dev = (struct t_sdl_device_data *) drv->driver_data;
  1223. +
  1224. + /* rect1 */
  1225. + rect1.x = drv->clip.x1;
  1226. + rect1.y = drv->clip.y1;
  1227. + rect1.w = drv->clip.x2 - rect1.x;
  1228. + rect1.h = drv->clip.y2 - rect1.y;
  1229. +
  1230. + /* rect2 */
  1231. + rect2.x = drv->clip.x1;
  1232. + rect2.y = drv->clip.y1 + sc;
  1233. + rect2.w = drv->clip.x2 - rect1.x;
  1234. + rect2.h = drv->clip.y2 - rect1.y;
  1235. +
  1236. + SDL_BlitSurface(sdl_SURFACE(dev), &rect1, sdl_SURFACE(dev), &rect2);
  1237. + sdl_register_update(dev, rect1.x, rect1.y, rect1.w, rect1.h, 0);
  1238. + S_ON_DEBUG_TRACE("out");
  1239. + return 1;
  1240. +}
  1241. +
  1242. +/* set cliping area */
  1243. +void sdl_set_clip_area(struct graphics_device *drv, struct rect *r)
  1244. +{
  1245. + struct t_sdl_device_data *dev = NULL;
  1246. + SDL_Rect rect;
  1247. +
  1248. + S_ON_DEBUG_TRACE("in");
  1249. + /* get ptr */
  1250. + dev = (struct t_sdl_device_data *) drv->driver_data;
  1251. + /* set rect */
  1252. + rect.x = r->x1;
  1253. + rect.y = r->y1;
  1254. + rect.w = r->x2 - r->x1;
  1255. + rect.h = r->y2 - r->y1;
  1256. + /* dev clipp */
  1257. + drv->clip = *r;
  1258. + /* clipp */
  1259. + SDL_SetClipRect(sdl_SURFACE(dev), &rect);
  1260. + S_ON_DEBUG_TRACE("out");
  1261. + return;
  1262. +}
  1263. +
  1264. +
  1265. +/* block dev
  1266. +int sdl_block(struct graphics_device *drv)
  1267. +{
  1268. + S_ON_DEBUG_TRACE("in");
  1269. + S_ASSERT(0);
  1270. + return 0;
  1271. +}
  1272. +*/
  1273. +
  1274. +
  1275. +/* unblock dev
  1276. +void sdl_unblock(struct graphics_device *drv)
  1277. +{
  1278. + S_ON_DEBUG_TRACE("in");
  1279. + S_ASSERT(0);
  1280. + return;
  1281. +}
  1282. +*/
  1283. +
  1284. +/* set window title (tittle utf-8 encoded !!!!) */
  1285. +void sdl_set_title(struct graphics_device *drv, u_char_t *title)
  1286. +{
  1287. + S_ON_DEBUG_TRACE("in");
  1288. + SDL_WM_SetCaption((const char *)title, NULL);
  1289. + return;
  1290. +}
  1291. +
  1292. +
  1293. +
  1294. +/* driver definition data */
  1295. +struct graphics_driver sdl_driver={
  1296. + "sdl",
  1297. + sdl_init_driver,
  1298. + sdl_init_device,
  1299. + sdl_shutdown_device,
  1300. + sdl_shutdown_driver,
  1301. + sdl_get_driver_param,
  1302. + sdl_get_empty_bitmap,
  1303. + /*sdl_get_filled_bitmap,*/
  1304. + sdl_register_bitmap,
  1305. + sdl_prepare_strip,
  1306. + sdl_commit_strip,
  1307. + sdl_unregister_bitmap,
  1308. + sdl_draw_bitmap,
  1309. + sdl_draw_bitmaps,
  1310. + sdl_get_color, /* sdl_get_color */
  1311. + sdl_fill_area,
  1312. + sdl_draw_hline,
  1313. + sdl_draw_vline,
  1314. + sdl_hscroll,
  1315. + sdl_vscroll,
  1316. + sdl_set_clip_area,
  1317. + dummy_block,
  1318. + dummy_unblock,
  1319. + NULL, /* sdl_set_title,*/ /* set_title */
  1320. + NULL, /* exec */
  1321. + 0, /* depth (filled in sdl_init_driver function) */
  1322. + 0, 0, /* size (in X is empty) */
  1323. + 0, /* flags */
  1324. + 0, /* codepage */
  1325. + NULL /* shell */
  1326. +};
  1327. +
  1328. +
  1329. +
  1330. +#endif /* GRDRV_SDL */
  1331. +
  1332. diff -rupN links-2.3/sdl_data.inc links-2.3.zipt/sdl_data.inc
  1333. --- links-2.3/sdl_data.inc 1969-12-31 19:00:00.000000000 -0500
  1334. +++ links-2.3.zipt/sdl_data.inc 2012-06-22 09:42:27.000000000 -0400
  1335. @@ -0,0 +1,400 @@
  1336. +/**
  1337. + sdl key syms
  1338. +
  1339. + XXX: i'know this is stupit but i'm preparing for some good solution :)
  1340. +
  1341. +*/
  1342. +
  1343. +
  1344. +#ifndef _SDL_KEYS_INC
  1345. +#define _SDL_KEYS_INC
  1346. +
  1347. +#define ZIPIT_Z2 1
  1348. +
  1349. +struct t_sdl_keysym
  1350. +{
  1351. + unsigned short sym;
  1352. + int key;
  1353. +#ifdef ZIPIT_Z2
  1354. + int skey;
  1355. + int akey;
  1356. + int sakey;
  1357. +#endif
  1358. +};
  1359. +
  1360. +#ifdef ZIPIT_Z2
  1361. +/* dead key accent mappings for latin15 */
  1362. +int acute_map[] = {
  1363. +0xC1,'B','C','D',0xC9,'F','G','H',0xCD,'J','K','L','M','N',0xD3,'P','Q','R','S','T',0xDA,'V','W','X',0xDD,'Z',
  1364. +'\'',0,0,0,0,0,
  1365. +0xE1,'b','c','d',0xE9,'f','g','h',0xED,'j','k','l','m','n',0xF3,'p','q','r','s','t',0xFA,'v','w','x',0xFD,'z'};
  1366. +int grave_map[] = {
  1367. +0xC0,'B','C','D',0xC8,'F','G','H',0xCC,'J','K','L','M','N',0xD2,'P','Q','R','S','T',0xD9,'V','W','X','Y','Z',
  1368. +'`',0,0,0,0,0,
  1369. +0xE0,'b','c','d',0xE8,'f','g','h',0xEC,'j','k','l','m','n',0xF2,'p','q','r','s','t',0xF9,'v','w','x','y','z'};
  1370. +int circumflex_map[] = {
  1371. +0xC2,'B','C','D',0xCA,'F','G','H',0xCE,'J','K','L','M','N',0xD4,'P','Q','R','S','T',0xDB,'V','W','X','Y','Z',
  1372. +'^',0,0,0,0,0,
  1373. +0xE2,'b','c','d',0xEA,'f','g','h',0xEE,'j','k','l','m','n',0xF4,'p','q','r','s','t',0xFB,'v','w','x','y','z'};
  1374. +int diaeresis_map[] = {
  1375. +0xC4,'B','C','D',0xCB,'F','G','H',0xCF,'J','K','L','M','N',0xD6,'P','Q','R','S','T',0xDC,'V','W','X','Y','Z',
  1376. +'\"',0,0,0,0,0,
  1377. +0xE4,'b','c','d',0xEB,'f','g','h',0xEF,'j','k','l','m','n',0xF6,'p','q','r','s','t',0xFC,'v','w','x',0xFF,'z'};
  1378. +int cedilla_map[] = {
  1379. +'A','B',0xC7,'D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z',
  1380. +',',0,0,0,0,0,
  1381. +'a','b',0xE7,'d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
  1382. +int tilde_map[] = {
  1383. +0xC3,'B','C','D','E','F','G','H','I','J','K','L','M',0xD1,0xD5,'P','Q','R','S','T','U','V','W','X','Y','Z',
  1384. +'~',0,0,0,0,0,
  1385. +0xE3,'b','c','d','e','f','g','h','i','j','k','l','m',0xF1,0xF5,'p','q','r','s','t','u','v','w','x','y','z'};
  1386. +#endif
  1387. +
  1388. +/* big mapping SDL->LINKS */
  1389. +static struct t_sdl_keysym sdl_keysyms[] =
  1390. +{
  1391. +#ifdef ZIPIT_Z2
  1392. + { SDLK_UNKNOWN ,0 ,0, 0, 0},
  1393. + { SDLK_FIRST ,0 ,0, 0, 0},
  1394. + { SDLK_ESCAPE,KBD_ESC,KBD_ESC,'|',KBD_ESC},
  1395. + { SDLK_0,'0',')','0',')'},
  1396. + { SDLK_1,'1','!','1','!'},
  1397. + { SDLK_2,'2','@','2','@'},
  1398. + { SDLK_3,'3','#','3','#'},
  1399. + { SDLK_4,'4','$','4','$'},
  1400. + { SDLK_5,'5','%','5','%'},
  1401. + { SDLK_6,'6','^','6','^'},
  1402. + { SDLK_7,'7','&','7','&'},
  1403. + { SDLK_8,'8','*','8','*'},
  1404. + { SDLK_9,'9','(','9','('},
  1405. + { SDLK_a,'a','A','$','A'},
  1406. + { SDLK_b,'b','B','=','B'},
  1407. + { SDLK_c,'c','C','+','C'},
  1408. + { SDLK_d,'d','D','&','D'},
  1409. + { SDLK_e,'e','E','3','E'},
  1410. + { SDLK_f,'f','F','@','F'},
  1411. + { SDLK_g,'g','G','"','G'},
  1412. + { SDLK_h,'h','H','\'','`'},
  1413. + { SDLK_i,'i','I','8','I'},
  1414. + { SDLK_j,'j','J','[','J'},
  1415. + { SDLK_k,'k','K',']','`'},
  1416. + { SDLK_l,'l','L','-','|'},
  1417. + { SDLK_m,'m','M','?','%'},
  1418. + { SDLK_n,'n','N','_','N'},
  1419. + { SDLK_o,'o','O','9','O'},
  1420. + { SDLK_p,'p','P','0','P'},
  1421. + { SDLK_q,'q','Q','1','Q'},
  1422. + { SDLK_r,'r','R','4','R'},
  1423. + { SDLK_s,'s','S','#','S'},
  1424. + { SDLK_t,'t','T','5','T'},
  1425. + { SDLK_u,'u','U','7','U'},
  1426. + { SDLK_v,'v','V','*','V'},
  1427. + { SDLK_w,'w','W','2','W'},
  1428. + { SDLK_x,'x','X','/','\\'},
  1429. + { SDLK_y,'y','Y','6','Y'},
  1430. + { SDLK_z,'z','Z','!','C'},
  1431. + { SDLK_MINUS,'-','_','-','_'},
  1432. + { SDLK_EQUALS,'=','+','=','+'},
  1433. + { SDLK_LEFTBRACKET,'[','{','[','{'},
  1434. + { SDLK_RIGHTBRACKET,']','}',']','}'},
  1435. + { SDLK_SEMICOLON,';','~',':','^'},
  1436. + { SDLK_QUOTE,'\'','"','\'','"'},
  1437. + { SDLK_BACKSLASH,'\\','|','\\','|'},
  1438. + { SDLK_SLASH,'/','?','/','?'},
  1439. + { SDLK_PERIOD,'.',')','>','}'},
  1440. + { SDLK_COMMA,',','(','<','{'},
  1441. + { SDLK_BACKQUOTE,'`','~','`','~'},
  1442. + { SDLK_BACKSPACE,KBD_BS,KBD_BS,KBD_BS,KBD_BS},
  1443. + { SDLK_TAB,KBD_TAB,KBD_TAB,'~',KBD_TAB},
  1444. + { SDLK_DELETE,127,127,127,127},
  1445. + { SDLK_RETURN,KBD_ENTER,KBD_ENTER,KBD_ENTER,KBD_ENTER},
  1446. + { SDLK_F1,KBD_F1,KBD_F1,KBD_F1,KBD_F1},
  1447. + { SDLK_F2,KBD_F2,KBD_F2,KBD_F2,KBD_F2},
  1448. + { SDLK_F3,KBD_F3,KBD_F3,KBD_F3,KBD_F3},
  1449. + { SDLK_F4,KBD_F4,KBD_F4,KBD_F4,KBD_F4},
  1450. + { SDLK_F5,KBD_F5,KBD_F5,KBD_F5,KBD_F5},
  1451. + { SDLK_F6,KBD_F6,KBD_F6,KBD_F6,KBD_F6},
  1452. + { SDLK_F7,KBD_F7,KBD_F7,KBD_F7,KBD_F7},
  1453. + { SDLK_F8,KBD_F8,KBD_F8,KBD_F8,KBD_F8},
  1454. + { SDLK_F9,KBD_F9,KBD_F9,KBD_F9,KBD_F9},
  1455. + { SDLK_F10,KBD_F10,KBD_F10,KBD_F10,KBD_F10},
  1456. + { SDLK_ESCAPE,0x1b,0x1b,'|',0x1b},
  1457. +
  1458. + { SDLK_LEFT,KBD_LEFT,KBD_LEFT,KBD_LEFT,KBD_LEFT},
  1459. + { SDLK_RIGHT,KBD_RIGHT,KBD_RIGHT,KBD_RIGHT,KBD_RIGHT},
  1460. + { SDLK_UP,KBD_UP,KBD_UP,KBD_UP,KBD_UP},
  1461. + { SDLK_DOWN,KBD_DOWN,KBD_DOWN,KBD_DOWN,KBD_DOWN},
  1462. +// { SDLK_PAGEUP,KBD_PAGE_UP,KBD_PAGE_UP,']', KBD_PAGE_UP},
  1463. +// { SDLK_PAGEDOWN,KBD_PAGE_DOWN,KBD_PAGE_DOWN, '[', KBD_PAGE_DOWN},
  1464. +// The [] was a hack for left/rt, but INS/DEL for scroll is a better fit.
  1465. + { SDLK_PAGEUP,KBD_PAGE_UP,KBD_PAGE_UP,KBD_INS, KBD_INS},
  1466. + { SDLK_PAGEDOWN,KBD_PAGE_DOWN,KBD_PAGE_DOWN, KBD_DEL, KBD_DEL},
  1467. + { SDLK_SPACE,' ',' ',' ',' '},
  1468. + { SDLK_HOME,KBD_HOME,KBD_HOME,KBD_PAGE_UP,KBD_PAGE_UP},
  1469. + { SDLK_END,KBD_END,KBD_END,KBD_PAGE_DOWN,KBD_PAGE_DOWN},
  1470. +
  1471. + { SDLK_LALT,308,308,308,308},
  1472. + { SDLK_RALT,307,307,307,307},
  1473. + { SDLK_LCTRL,306,306,306,306},
  1474. + { SDLK_RCTRL,305,305,305,305},
  1475. + { SDLK_LSHIFT,304,304,304,304},
  1476. + { SDLK_RSHIFT,303,303,303,303},
  1477. + { SDLK_LAST ,0 ,0, 0, 0},
  1478. +#else
  1479. + { SDLK_UNKNOWN ,0 },
  1480. + { SDLK_FIRST ,0 },
  1481. + { SDLK_BACKSPACE ,KBD_BS },
  1482. + { SDLK_TAB ,KBD_TAB },
  1483. + { SDLK_CLEAR ,12 },
  1484. + { SDLK_RETURN ,KBD_ENTER },
  1485. + { SDLK_PAUSE ,19 },
  1486. + { SDLK_ESCAPE ,KBD_ESC },
  1487. + { SDLK_SPACE ,32 },
  1488. + { SDLK_EXCLAIM ,33 },
  1489. + { SDLK_QUOTEDBL ,34 },
  1490. + { SDLK_HASH ,35 },
  1491. + { SDLK_DOLLAR ,36 },
  1492. + { SDLK_AMPERSAND ,38 },
  1493. + { SDLK_QUOTE ,39 },
  1494. + { SDLK_LEFTPAREN ,40 },
  1495. + { SDLK_RIGHTPAREN ,41 },
  1496. + { SDLK_ASTERISK ,42 },
  1497. + { SDLK_PLUS ,43 },
  1498. + { SDLK_COMMA ,44 },
  1499. + { SDLK_MINUS ,45 },
  1500. + { SDLK_PERIOD ,46 },
  1501. + { SDLK_SLASH ,47 },
  1502. + { SDLK_0 ,48 },
  1503. + { SDLK_1 ,49 },
  1504. + { SDLK_2 ,50 },
  1505. + { SDLK_3 ,51 },
  1506. + { SDLK_4 ,52 },
  1507. + { SDLK_5 ,53 },
  1508. + { SDLK_6 ,54 },
  1509. + { SDLK_7 ,55 },
  1510. + { SDLK_8 ,56 },
  1511. + { SDLK_9 ,57 },
  1512. + { SDLK_COLON ,58 },
  1513. + { SDLK_SEMICOLON ,59 },
  1514. + { SDLK_LESS ,60 },
  1515. + { SDLK_EQUALS ,61 },
  1516. + { SDLK_GREATER ,62 },
  1517. + { SDLK_QUESTION ,63 },
  1518. + { SDLK_AT ,64 },
  1519. + /*
  1520. + Skip uppercase letters
  1521. + */
  1522. + { SDLK_LEFTBRACKET ,91 },
  1523. + { SDLK_BACKSLASH ,92 },
  1524. + { SDLK_RIGHTBRACKET ,93 },
  1525. + { SDLK_CARET ,94 },
  1526. + { SDLK_UNDERSCORE ,95 },
  1527. + { SDLK_BACKQUOTE ,96 },
  1528. + { SDLK_a ,97 },
  1529. + { SDLK_b ,98 },
  1530. + { SDLK_c ,99 },
  1531. + { SDLK_d ,100 },
  1532. + { SDLK_e ,101 },
  1533. + { SDLK_f ,102 },
  1534. + { SDLK_g ,103 },
  1535. + { SDLK_h ,104 },
  1536. + { SDLK_i ,105 },
  1537. + { SDLK_j ,106 },
  1538. + { SDLK_k ,107 },
  1539. + { SDLK_l ,108 },
  1540. + { SDLK_m ,109 },
  1541. + { SDLK_n ,110 },
  1542. + { SDLK_o ,111 },
  1543. + { SDLK_p ,112 },
  1544. + { SDLK_q ,113 },
  1545. + { SDLK_r ,114 },
  1546. + { SDLK_s ,115 },
  1547. + { SDLK_t ,116 },
  1548. + { SDLK_u ,117 },
  1549. + { SDLK_v ,118 },
  1550. + { SDLK_w ,119 },
  1551. + { SDLK_x ,120 },
  1552. + { SDLK_y ,121 },
  1553. + { SDLK_z ,122 },
  1554. + { SDLK_DELETE ,127 },
  1555. + /* End of ASCII mapped keysyms */
  1556. +
  1557. + /* International keyboard syms */
  1558. + { SDLK_WORLD_0 ,160 }, /* 0xA0 */
  1559. + { SDLK_WORLD_1 ,161 },
  1560. + { SDLK_WORLD_2 ,162 },
  1561. + { SDLK_WORLD_3 ,163 },
  1562. + { SDLK_WORLD_4 ,164 },
  1563. + { SDLK_WORLD_5 ,165 },
  1564. + { SDLK_WORLD_6 ,166 },
  1565. + { SDLK_WORLD_7 ,167 },
  1566. + { SDLK_WORLD_8 ,168 },
  1567. + { SDLK_WORLD_9 ,169 },
  1568. + { SDLK_WORLD_10 ,170 },
  1569. + { SDLK_WORLD_11 ,171 },
  1570. + { SDLK_WORLD_12 ,172 },
  1571. + { SDLK_WORLD_13 ,173 },
  1572. + { SDLK_WORLD_14 ,174 },
  1573. + { SDLK_WORLD_15 ,175 },
  1574. + { SDLK_WORLD_16 ,176 },
  1575. + { SDLK_WORLD_17 ,177 },
  1576. + { SDLK_WORLD_18 ,178 },
  1577. + { SDLK_WORLD_19 ,179 },
  1578. + { SDLK_WORLD_20 ,180 },
  1579. + { SDLK_WORLD_21 ,181 },
  1580. + { SDLK_WORLD_22 ,182 },
  1581. + { SDLK_WORLD_23 ,183 },
  1582. + { SDLK_WORLD_24 ,184 },
  1583. + { SDLK_WORLD_25 ,185 },
  1584. + { SDLK_WORLD_26 ,186 },
  1585. + { SDLK_WORLD_27 ,187 },
  1586. + { SDLK_WORLD_28 ,188 },
  1587. + { SDLK_WORLD_29 ,189 },
  1588. + { SDLK_WORLD_30 ,190 },
  1589. + { SDLK_WORLD_31 ,191 },
  1590. + { SDLK_WORLD_32 ,192 },
  1591. + { SDLK_WORLD_33 ,193 },
  1592. + { SDLK_WORLD_34 ,194 },
  1593. + { SDLK_WORLD_35 ,195 },
  1594. + { SDLK_WORLD_36 ,196 },
  1595. + { SDLK_WORLD_37 ,197 },
  1596. + { SDLK_WORLD_38 ,198 },
  1597. + { SDLK_WORLD_39 ,199 },
  1598. + { SDLK_WORLD_40 ,200 },
  1599. + { SDLK_WORLD_41 ,201 },
  1600. + { SDLK_WORLD_42 ,202 },
  1601. + { SDLK_WORLD_43 ,203 },
  1602. + { SDLK_WORLD_44 ,204 },
  1603. + { SDLK_WORLD_45 ,205 },
  1604. + { SDLK_WORLD_46 ,206 },
  1605. + { SDLK_WORLD_47 ,207 },
  1606. + { SDLK_WORLD_48 ,208 },
  1607. + { SDLK_WORLD_49 ,209 },
  1608. + { SDLK_WORLD_50 ,210 },
  1609. + { SDLK_WORLD_51 ,211 },
  1610. + { SDLK_WORLD_52 ,212 },
  1611. + { SDLK_WORLD_53 ,213 },
  1612. + { SDLK_WORLD_54 ,214 },
  1613. + { SDLK_WORLD_55 ,215 },
  1614. + { SDLK_WORLD_56 ,216 },
  1615. + { SDLK_WORLD_57 ,217 },
  1616. + { SDLK_WORLD_58 ,218 },
  1617. + { SDLK_WORLD_59 ,219 },
  1618. + { SDLK_WORLD_60 ,220 },
  1619. + { SDLK_WORLD_61 ,221 },
  1620. + { SDLK_WORLD_62 ,222 },
  1621. + { SDLK_WORLD_63 ,223 },
  1622. + { SDLK_WORLD_64 ,224 },
  1623. + { SDLK_WORLD_65 ,225 },
  1624. + { SDLK_WORLD_66 ,226 },
  1625. + { SDLK_WORLD_67 ,227 },
  1626. + { SDLK_WORLD_68 ,228 },
  1627. + { SDLK_WORLD_69 ,229 },
  1628. + { SDLK_WORLD_70 ,230 },
  1629. + { SDLK_WORLD_71 ,231 },
  1630. + { SDLK_WORLD_72 ,232 },
  1631. + { SDLK_WORLD_73 ,233 },
  1632. + { SDLK_WORLD_74 ,234 },
  1633. + { SDLK_WORLD_75 ,235 },
  1634. + { SDLK_WORLD_76 ,236 },
  1635. + { SDLK_WORLD_77 ,237 },
  1636. + { SDLK_WORLD_78 ,238 },
  1637. + { SDLK_WORLD_79 ,239 },
  1638. + { SDLK_WORLD_80 ,240 },
  1639. + { SDLK_WORLD_81 ,241 },
  1640. + { SDLK_WORLD_82 ,242 },
  1641. + { SDLK_WORLD_83 ,243 },
  1642. + { SDLK_WORLD_84 ,244 },
  1643. + { SDLK_WORLD_85 ,245 },
  1644. + { SDLK_WORLD_86 ,246 },
  1645. + { SDLK_WORLD_87 ,247 },
  1646. + { SDLK_WORLD_88 ,248 },
  1647. + { SDLK_WORLD_89 ,249 },
  1648. + { SDLK_WORLD_90 ,250 },
  1649. + { SDLK_WORLD_91 ,251 },
  1650. + { SDLK_WORLD_92 ,252 },
  1651. + { SDLK_WORLD_93 ,253 },
  1652. + { SDLK_WORLD_94 ,254 },
  1653. + { SDLK_WORLD_95 ,255 }, /* 0xFF */
  1654. +
  1655. + /* Numeric keypad */
  1656. + { SDLK_KP0 ,256 },
  1657. + { SDLK_KP1 ,257 },
  1658. + { SDLK_KP2 ,258 },
  1659. + { SDLK_KP3 ,259 },
  1660. + { SDLK_KP4 ,260 },
  1661. + { SDLK_KP5 ,261 },
  1662. + { SDLK_KP6 ,262 },
  1663. + { SDLK_KP7 ,263 },
  1664. + { SDLK_KP8 ,264 },
  1665. + { SDLK_KP9 ,265 },
  1666. + { SDLK_KP_PERIOD ,266 },
  1667. + { SDLK_KP_DIVIDE ,267 },
  1668. + { SDLK_KP_MULTIPLY ,268 },
  1669. + { SDLK_KP_MINUS ,269 },
  1670. + { SDLK_KP_PLUS ,270 },
  1671. + { SDLK_KP_ENTER ,KBD_ENTER },
  1672. + { SDLK_KP_EQUALS ,272 },
  1673. +
  1674. + /* Arrows + Home/End pad */
  1675. + { SDLK_UP ,KBD_UP },
  1676. + { SDLK_DOWN ,KBD_DOWN },
  1677. + { SDLK_RIGHT ,KBD_RIGHT },
  1678. + { SDLK_LEFT ,KBD_LEFT },
  1679. + { SDLK_INSERT ,KBD_INS },
  1680. + { SDLK_HOME ,KBD_HOME },
  1681. + { SDLK_END ,KBD_END },
  1682. + { SDLK_PAGEUP ,KBD_PAGE_UP },
  1683. + { SDLK_PAGEDOWN ,KBD_PAGE_DOWN },
  1684. +
  1685. + /* Function keys */
  1686. + { SDLK_F1 ,KBD_F1 },
  1687. + { SDLK_F2 ,KBD_F2 },
  1688. + { SDLK_F3 ,KBD_F3 },
  1689. + { SDLK_F4 ,KBD_F4 },
  1690. + { SDLK_F5 ,KBD_F5 },
  1691. + { SDLK_F6 ,KBD_F6 },
  1692. + { SDLK_F7 ,KBD_F7 },
  1693. + { SDLK_F8 ,KBD_F8 },
  1694. + { SDLK_F9 ,KBD_F9 },
  1695. + { SDLK_F10 ,KBD_F10 },
  1696. + { SDLK_F11 ,KBD_F11 },
  1697. + { SDLK_F12 ,KBD_F12 },
  1698. + { SDLK_F13 ,294 },
  1699. + { SDLK_F14 ,295 },
  1700. + { SDLK_F15 ,296 },
  1701. +
  1702. + /* Key state modifier keys */
  1703. + { SDLK_NUMLOCK ,300 },
  1704. + { SDLK_CAPSLOCK ,301 },
  1705. + { SDLK_SCROLLOCK ,302 },
  1706. + { SDLK_RSHIFT ,303 },
  1707. + { SDLK_LSHIFT ,304 },
  1708. + { SDLK_RCTRL ,305 },
  1709. + { SDLK_LCTRL ,306 },
  1710. + { SDLK_RALT ,307 },
  1711. + { SDLK_LALT ,308 },
  1712. + { SDLK_RMETA ,309 },
  1713. + { SDLK_LMETA ,310 },
  1714. + { SDLK_LSUPER ,311 }, /* Left "Windows" key */
  1715. + { SDLK_RSUPER ,312 }, /* Right "Windows" key */
  1716. + { SDLK_MODE ,313 }, /* "Alt Gr" key */
  1717. + { SDLK_COMPOSE ,314 }, /* Multi-key compose key */
  1718. +
  1719. + /* Miscellaneous function keys */
  1720. + { SDLK_HELP ,315 },
  1721. + { SDLK_PRINT ,316 },
  1722. + { SDLK_SYSREQ ,317 },
  1723. + { SDLK_BREAK ,318 },
  1724. + { SDLK_MENU ,KBD_F9 },
  1725. + { SDLK_POWER ,320 }, /* Power Macintosh power key */
  1726. + { SDLK_EURO ,321 }, /* Some european keyboards */
  1727. + { SDLK_UNDO ,322 }, /* Atari keyboard has Undo */
  1728. +
  1729. + /* Add any other keys here */
  1730. +
  1731. + { SDLK_LAST ,0 },
  1732. +#endif
  1733. +};
  1734. +
  1735. +#endif
  1736. diff -rupN links-2.3/setup.h links-2.3.zipt/setup.h
  1737. --- links-2.3/setup.h 2009-09-08 00:11:03.000000000 -0400
  1738. +++ links-2.3.zipt/setup.h 2012-06-22 09:36:06.000000000 -0400
  1739. @@ -138,7 +138,12 @@
  1740. #define G_DIALOG_BUTTON_L "[ "
  1741. #define G_DIALOG_BUTTON_R " ]"
  1742.  
  1743. +#if 1 /* ZIPIT_Z2 */
  1744. +/* Shave a few pixels off the big fat scroll bar. */
  1745. +#define G_SCROLL_BAR_WIDTH 8
  1746. +#else
  1747. #define G_SCROLL_BAR_WIDTH 12
  1748. +#endif
  1749. #define G_SCROLL_BAR_MIN_SIZE 20
  1750. #define G_DEFAULT_SCROLL_BAR_FRAME_COLOR 0x000000
  1751. #define G_DEFAULT_SCROLL_BAR_AREA_COLOR 0xc0c0c0
  1752. diff -rupN links-2.3/view.c links-2.3.zipt/view.c
  1753. --- links-2.3/view.c 2011-08-14 13:43:04.000000000 -0400
  1754. +++ links-2.3.zipt/view.c 2012-06-22 09:35:58.000000000 -0400
  1755. @@ -3016,7 +3016,12 @@ static int frame_ev(struct session *ses,
  1756. return 1;
  1757. }
  1758. if (ev->ev == EV_KBD) {
  1759. +#if 1 /* ZIPIT_Z2 */
  1760. + /* Add more conveient scroll keys for ZIPIT_Z2 */
  1761. + if (ev->x == KBD_PAGE_DOWN || (upcase(ev->x) == 'F' && ev->y & KBD_CTRL)) rep_ev(ses, fd, page_down, 0);
  1762. +#else
  1763. if (ev->x == KBD_PAGE_DOWN || (ev->x == ' ' && (!(ev->y & KBD_ALT))) || (upcase(ev->x) == 'F' && ev->y & KBD_CTRL)) rep_ev(ses, fd, page_down, 0);
  1764. +#endif
  1765. else if (ev->x == KBD_PAGE_UP || (upcase(ev->x) == 'B' && (!(ev->y & KBD_ALT)))) rep_ev(ses, fd, page_up, 0);
  1766. else if (ev->x == KBD_DOWN) rep_ev(ses, fd, down, 0);
  1767. else if (ev->x == KBD_UP) rep_ev(ses, fd, up, 0);
  1768. @@ -3038,9 +3043,22 @@ static int frame_ev(struct session *ses,
  1769. }
  1770. }
  1771. else if (ev->x == KBD_INS || (upcase(ev->x) == 'P' && ev->y & KBD_CTRL)) rep_ev(ses, fd, scroll, -1 - !ses->kbdprefix.rep);
  1772. +#if 1 /* ZIPIT_Z2 */
  1773. + /* Add more conveient scroll keys for ZIPIT_Z2 */
  1774. + else if (ev->x == KBD_DEL || (upcase(ev->x) == 'N' && ev->y & KBD_CTRL)
  1775. + || (ev->x == ' ' && !(ev->y & KBD_ALT)))
  1776. + rep_ev(ses, fd, scroll, 1 + !ses->kbdprefix.rep);
  1777. + /* Allow TAB, BACKTAB to traverse links on ZIPIT_Z2 */
  1778. + else if ((ev->x == KBD_TAB) && (ev->y & KBD_SHIFT)) rep_ev(ses, fd, up, 0);
  1779. + else if (ev->x == KBD_TAB) rep_ev(ses, fd, down, 0);
  1780. + /* Add more conveient sidescroll keys for ZIPIT_Z2 */
  1781. + else if ((ev->x == '[') || (ev->x == ',') || (ev->x == '<')) rep_ev(ses, fd, hscroll, -1 - 7 * !ses->kbdprefix.rep);
  1782. + else if ((ev->x == ']') || (ev->x == '.') || (ev->x == '>')) rep_ev(ses, fd, hscroll, 1 + 7 * !ses->kbdprefix.rep);
  1783. +#else
  1784. else if (ev->x == KBD_DEL || (upcase(ev->x) == 'N' && ev->y & KBD_CTRL)) rep_ev(ses, fd, scroll, 1 + !ses->kbdprefix.rep);
  1785. else if (ev->x == '[') rep_ev(ses, fd, hscroll, -1 - 7 * !ses->kbdprefix.rep);
  1786. else if (ev->x == ']') rep_ev(ses, fd, hscroll, 1 + 7 * !ses->kbdprefix.rep);
  1787. +#endif
  1788. /*else if (upcase(ev->x) == 'Y' && ev->y & KBD_CTRL) rep_ev(ses, fd, scroll, -1);
  1789. else if (upcase(ev->x) == 'E' && ev->y & KBD_CTRL) rep_ev(ses, fd, scroll, 1);*/
  1790. else if (ev->x == KBD_HOME || (upcase(ev->x) == 'A' && ev->y & KBD_CTRL)) rep_ev(ses, fd, home, 0);
  1791. diff -rupN links-2.3/view_gr.c links-2.3.zipt/view_gr.c
  1792. --- links-2.3/view_gr.c 2011-04-19 10:17:50.000000000 -0400
  1793. +++ links-2.3.zipt/view_gr.c 2012-06-22 09:35:58.000000000 -0400
  1794. @@ -989,6 +989,43 @@ static void unset_link(struct f_data_c *
  1795. }
  1796. }
  1797.  
  1798. +#if 1 /* ZIPIT_Z2 */
  1799. +unsigned char scrollmark_file[MAX_STR_LEN]="";
  1800. +static int read_scrollmark(struct session *ses, struct f_data_c *fd, int a)
  1801. +{
  1802. + unsigned int pos = 0;
  1803. + unsigned char *buf;
  1804. +
  1805. + if (!*scrollmark_file)
  1806. + snprintf(scrollmark_file,MAX_STR_LEN,"%sscrollmark.cfg",links_home?links_home:(unsigned char*)"");
  1807. +
  1808. + buf=read_config_file(scrollmark_file);
  1809. + if (a && buf){
  1810. + pos = atoi(buf);
  1811. + unset_link(fd);
  1812. + if (pos > fd->f_data->y - fd->yw + fd->f_data->hsb * G_SCROLL_BAR_WIDTH) {
  1813. + return 0;
  1814. + }
  1815. + fd->vs->view_pos = pos;
  1816. + fd->vs->orig_view_pos = fd->vs->view_pos;
  1817. + return 3;
  1818. + }
  1819. + return 0;
  1820. +}
  1821. +
  1822. +static int write_scrollmark(struct session *ses, struct f_data_c *f)
  1823. +{
  1824. + unsigned char buf[80];
  1825. + unsigned int pos = 0;
  1826. +
  1827. + if (!*scrollmark_file)
  1828. + read_scrollmark(ses, f, 0); /* 0 means just read, do not scroll*/
  1829. +
  1830. + sprintf(buf, "%d\n", f->vs->view_pos);
  1831. + write_to_config_file(scrollmark_file, buf);
  1832. +}
  1833. +#endif /* ZIPIT_Z2 */
  1834. +
  1835. int g_frame_ev(struct session *ses, struct f_data_c *fd, struct event *ev)
  1836. {
  1837. if (!fd->f_data) return 0;
  1838. @@ -1145,7 +1182,16 @@ int g_frame_ev(struct session *ses, stru
  1839. }
  1840. return enter(ses, fd, 0);
  1841. }
  1842. +#if 1 /* ZIPIT_Z2 */
  1843. + /* Add scroll mark for ZIPIT_Z2 ereading. */
  1844. + if (upcase(ev->x) == 'R' && !(ev->y & (KBD_CTRL | KBD_ALT))) return read_scrollmark(ses,fd, 1);
  1845. + if (upcase(ev->x) == 'M' && !(ev->y & (KBD_CTRL | KBD_ALT))) return write_scrollmark(ses,fd);
  1846. +
  1847. + /* Add more conveient croll keys for ZIPIT_Z2 */
  1848. + if (ev->x == KBD_PAGE_DOWN || (upcase(ev->x) == 'F' && ev->y & KBD_CTRL)) {
  1849. +#else
  1850. if (ev->x == KBD_PAGE_DOWN || (ev->x == ' ' && !(ev->y & KBD_ALT)) || (upcase(ev->x) == 'F' && ev->y & KBD_CTRL)) {
  1851. +#endif
  1852. unset_link(fd);
  1853. if (fd->vs->view_pos == fd->f_data->y - fd->yw + fd->f_data->hsb * G_SCROLL_BAR_WIDTH) {
  1854. fd->vs->orig_view_pos = fd->vs->view_pos;
  1855. @@ -1190,7 +1236,13 @@ int g_frame_ev(struct session *ses, stru
  1856. fd->vs->orig_view_pos = fd->vs->view_pos;
  1857. return 3;
  1858. }
  1859. +#if 1 /* ZIPIT_Z2 */
  1860. + /* Add more conveient scroll keys for ZIPIT_Z2 */
  1861. + if (ev->x == KBD_DEL || (upcase(ev->x) == 'N' && ev->y & KBD_CTRL)
  1862. + || (ev->x == ' ' && !(ev->y & KBD_ALT))) {
  1863. +#else
  1864. if (ev->x == KBD_DEL || (upcase(ev->x) == 'N' && ev->y & KBD_CTRL)) {
  1865. +#endif
  1866. if (fd->vs->view_pos == fd->f_data->y - fd->yw + fd->f_data->hsb * G_SCROLL_BAR_WIDTH) {
  1867. fd->vs->orig_view_pos = fd->vs->view_pos;
  1868. return 0;
  1869. @@ -1234,7 +1286,19 @@ int g_frame_ev(struct session *ses, stru
  1870. if (ev->x == KBD_UP) {
  1871. return g_next_link(fd, -1);
  1872. }
  1873. +#if 1 /* ZIPIT_Z2 */
  1874. + /* Allow TAB, BACKTAB to traverse links on ZIPIT_Z2 (mouse eats up,dn keys)*/
  1875. + if ((ev->x == KBD_TAB) && (ev->y & KBD_SHIFT)) {
  1876. + return g_next_link(fd, -1);
  1877. + }
  1878. + if (ev->x == KBD_TAB) {
  1879. + return g_next_link(fd, 1);
  1880. + }
  1881. + /* Add more conveient sidescroll keys for ZIPIT_Z2 */
  1882. + if ((ev->x == '[') || (ev->x == ',') || (ev->x == '<')) {
  1883. +#else
  1884. if (ev->x == '[') {
  1885. +#endif
  1886. left:
  1887. if (!fd->vs->view_posx) {
  1888. fd->vs->orig_view_posx = fd->vs->view_posx;
  1889. @@ -1244,7 +1308,12 @@ int g_frame_ev(struct session *ses, stru
  1890. fd->vs->orig_view_posx = fd->vs->view_posx;
  1891. return 3;
  1892. }
  1893. +#if 1 /* ZIPIT_Z2 */
  1894. + /* Add more conveient sidescroll keys for ZIPIT_Z2 */
  1895. + if ((ev->x == ']') || (ev->x == '.') || (ev->x == '>')) {
  1896. +#else
  1897. if (ev->x == ']') {
  1898. +#endif
  1899. right:
  1900. if (fd->vs->view_posx == fd->f_data->x - fd->xw + fd->f_data->vsb * G_SCROLL_BAR_WIDTH) {
  1901. fd->vs->orig_view_posx = fd->vs->view_posx;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement