mirror of the now-defunct rocklinux.org
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

134 lines
4.6 KiB

  1. copied from http://wiki.linuxfromscratch.org/blfs/attachment/wiki/W3M/w3m-0.5.1-gpm_fix-1.patch
  2. - stf
  3. Submitted by: Alexander E. Patrakov
  4. Date: 2005-09-24
  5. Initial Package Version: 0.5.1
  6. Upstream Status: Will submit
  7. Origin: Alexander E. Patrakov
  8. Description: fixes w3m compilation failure when GPM is built --without-curses
  9. diff -urN w3m-0.5.1/configure.in w3m-0.5.1.fixed/configure.in
  10. --- w3m-0.5.1/configure.in 2004-04-29 00:19:25.000000000 +0600
  11. +++ w3m-0.5.1.fixed/configure.in 2005-09-24 16:39:11.000000000 +0600
  12. @@ -97,6 +97,7 @@
  13. AC_SUBST(USE_W3M)
  14. AC_CHECK_LIB(gpm, Gpm_Open, [AC_DEFINE(USE_GPM)
  15. W3M_LIBS="$W3M_LIBS -lgpm"])
  16. + AC_CHECK_LIB(gpm, Gpm_Wgetch, AC_DEFINE(HAVE_GPM_WGETCH))
  17. AC_SUBST(USE_SYSMOUSE)
  18. AC_TRY_CPP([#include <machine/console.h>
  19. MOUSE_GETINFO], [AC_DEFINE(USE_SYSMOUSE)])
  20. diff -urN w3m-0.5.1/gpm-libcurses.c w3m-0.5.1.fixed/gpm-libcurses.c
  21. --- w3m-0.5.1/gpm-libcurses.c 1970-01-01 05:00:00.000000000 +0500
  22. +++ w3m-0.5.1.fixed/gpm-libcurses.c 2005-09-24 18:18:30.000000000 +0600
  23. @@ -0,0 +1,84 @@
  24. +/*
  25. + * libcurses.c - client library - curses level (gpm-Linux)
  26. + *
  27. + * Copied from GPM by Alexander E. Patrakov
  28. + * Copyright 1994,1995 rubini@linux.it (Alessandro Rubini)
  29. + * Copyright 2002 nico@schottelius.org (Nico Schottelius)
  30. + *
  31. + * This program is free software; you can redistribute it and/or modify
  32. + * it under the terms of the GNU General Public License as published by
  33. + * the Free Software Foundation; either version 2 of the License, or
  34. + * (at your option) any later version.
  35. + *
  36. + * This program is distributed in the hope that it will be useful,
  37. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  38. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  39. + * GNU General Public License for more details.
  40. + *
  41. + * You should have received a copy of the GNU General Public License
  42. + * along with this program; if not, write to the Free Software
  43. + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
  44. + ********/
  45. +
  46. +#include <stdio.h>
  47. +#include <stdlib.h>
  48. +#include <unistd.h> /* select(); */
  49. +#include <sys/time.h> /* timeval */
  50. +#include <sys/types.h> /* socket() */
  51. +
  52. +#include "config.h"
  53. +#if defined(USE_GPM) && !defined(HAVE_GPM_WGETCH)
  54. +
  55. +extern int getch();
  56. +
  57. +#include <gpm.h>
  58. +#include <errno.h>
  59. +
  60. +#define SELECT_TIME 86400 /* one day */
  61. +
  62. +int Gpm_Wgetch(void * dummy)
  63. +{
  64. +fd_set selSet;
  65. +int max, flag, result;
  66. +int fd=STDIN_FILENO;
  67. +static Gpm_Event ev;
  68. +
  69. + if (!gpm_flag || gpm_fd==-1) return getch();
  70. + if (gpm_morekeys) return (*gpm_handler)(&ev,gpm_data);
  71. + gpm_hflag=0;
  72. +
  73. + max = (gpm_fd>fd) ? gpm_fd : fd;
  74. +
  75. +/*...................................................................*/
  76. + if (gpm_fd>=0) /* linux */
  77. + while(1)
  78. + {
  79. + if (gpm_visiblepointer) GPM_DRAWPOINTER(&ev);
  80. + do
  81. + {
  82. + FD_ZERO(&selSet);
  83. + FD_SET(fd,&selSet);
  84. + FD_SET(gpm_fd,&selSet);
  85. + gpm_timeout.tv_sec=SELECT_TIME;
  86. + errno = 0;
  87. + flag=select(max+1,&selSet,(fd_set *)NULL,(fd_set *)NULL,&gpm_timeout);
  88. + }
  89. + while (!flag);
  90. +
  91. + if (flag==-1)
  92. + continue;
  93. +
  94. + if (FD_ISSET(fd,&selSet))
  95. + return getch();
  96. +
  97. + if (Gpm_GetEvent(&ev) && gpm_handler
  98. + && (result=(*gpm_handler)(&ev,gpm_data)))
  99. + {
  100. + gpm_hflag=1;
  101. + return result;
  102. + }
  103. + }
  104. + return 0;
  105. +}
  106. +#endif
  107. +
  108. diff -urN w3m-0.5.1/Makefile.in w3m-0.5.1.fixed/Makefile.in
  109. --- w3m-0.5.1/Makefile.in 2004-04-26 23:04:48.000000000 +0600
  110. +++ w3m-0.5.1.fixed/Makefile.in 2005-09-24 16:48:54.000000000 +0600
  111. @@ -85,11 +85,11 @@
  112. SRCS=main.c file.c buffer.c display.c etc.c search.c linein.c table.c local.c \
  113. form.c map.c frame.c rc.c menu.c mailcap.c image.c \
  114. symbol.c entity.c terms.c url.c ftp.c mimehead.c regex.c news.c \
  115. - func.c cookie.c history.c backend.c $(KEYBIND_SRC)
  116. + func.c cookie.c history.c backend.c gpm-libcurses.c $(KEYBIND_SRC)
  117. OBJS=main.o file.o buffer.o display.o etc.o search.o linein.o table.o local.o\
  118. form.o map.o frame.o rc.o menu.o mailcap.o image.o \
  119. symbol.o entity.o terms.o url.o ftp.o mimehead.o regex.o news.o \
  120. - func.o cookie.o history.o backend.o $(KEYBIND_OBJ)
  121. + func.o cookie.o history.o backend.o gpm-libcurses.o $(KEYBIND_OBJ)
  122. LSRCS=anchor.c parsetagx.c tagtable.c istream.c
  123. LOBJS=anchor.o parsetagx.o tagtable.o istream.o
  124. LLOBJS=version.o
  125. diff -urN w3m-0.5.1/config.h.in w3m-0.5.1.fixed/config.h.in
  126. --- w3m-0.5.1/config.h.in 2004-04-04 22:47:20.000000000 +0600
  127. +++ w3m-0.5.1.fixed/config.h.in 2005-09-24 16:50:43.000000000 +0600
  128. @@ -231,3 +231,4 @@
  129. #define INFLATE_NAME "inflate"
  130. +#undef HAVE_GPM_WGETCH
  131. #endif /* CONFIG_H_SEEN */