W3M: w3m-0.5.1-gpm_fix-1.patch

File w3m-0.5.1-gpm_fix-1.patch, 4.5 KB (added by alexander@…, 16 years ago)

Fix for missing Gpm_Wgetch()

  • configure.in

    Submitted by: Alexander E. Patrakov
    Date: 2005-09-24
    Initial Package Version: 0.5.1
    Upstream Status: Will submit
    Origin: Alexander E. Patrakov
    Description: fixes w3m compilation failure when GPM is built --without-curses
    
    diff -urN w3m-0.5.1/configure.in w3m-0.5.1.fixed/configure.in
    old new  
    9797 AC_SUBST(USE_W3M)
    9898 AC_CHECK_LIB(gpm, Gpm_Open, [AC_DEFINE(USE_GPM)
    9999                W3M_LIBS="$W3M_LIBS -lgpm"])
     100 AC_CHECK_LIB(gpm, Gpm_Wgetch, AC_DEFINE(HAVE_GPM_WGETCH))
    100101 AC_SUBST(USE_SYSMOUSE)
    101102 AC_TRY_CPP([#include <machine/console.h>
    102103   MOUSE_GETINFO], [AC_DEFINE(USE_SYSMOUSE)])
  • gpm-libcurses.c

    diff -urN w3m-0.5.1/gpm-libcurses.c w3m-0.5.1.fixed/gpm-libcurses.c
    old new  
     1/*
     2 * libcurses.c - client library - curses level (gpm-Linux)
     3 *
     4 * Copied from GPM by Alexander E. Patrakov
     5 * Copyright 1994,1995   rubini@linux.it (Alessandro Rubini)
     6 * Copyright 2002        nico@schottelius.org (Nico Schottelius)
     7 *
     8 *   This program is free software; you can redistribute it and/or modify
     9 *   it under the terms of the GNU General Public License as published by
     10 *   the Free Software Foundation; either version 2 of the License, or
     11 *   (at your option) any later version.
     12 *
     13 *   This program is distributed in the hope that it will be useful,
     14 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
     15 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     16 *   GNU General Public License for more details.
     17 *
     18 *   You should have received a copy of the GNU General Public License
     19 *   along with this program; if not, write to the Free Software
     20 *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
     21 ********/
     22
     23#include <stdio.h>
     24#include <stdlib.h>
     25#include <unistd.h>        /* select(); */
     26#include <sys/time.h>      /* timeval */
     27#include <sys/types.h>     /* socket() */
     28
     29#include "config.h"
     30#if defined(USE_GPM) && !defined(HAVE_GPM_WGETCH)
     31
     32extern int getch();
     33
     34#include <gpm.h>
     35#include <errno.h>
     36
     37#define SELECT_TIME 86400 /* one day */
     38
     39int Gpm_Wgetch(void * dummy)
     40{
     41fd_set selSet;
     42int max, flag, result;
     43int fd=STDIN_FILENO;
     44static Gpm_Event ev;
     45
     46  if (!gpm_flag || gpm_fd==-1) return getch();
     47  if (gpm_morekeys) return (*gpm_handler)(&ev,gpm_data);
     48  gpm_hflag=0;
     49
     50  max = (gpm_fd>fd) ? gpm_fd : fd;
     51
     52/*...................................................................*/
     53  if (gpm_fd>=0)                                            /* linux */
     54    while(1)
     55      {
     56      if (gpm_visiblepointer) GPM_DRAWPOINTER(&ev);
     57      do
     58        {
     59        FD_ZERO(&selSet);
     60        FD_SET(fd,&selSet);
     61        FD_SET(gpm_fd,&selSet);
     62        gpm_timeout.tv_sec=SELECT_TIME;
     63        errno = 0;
     64        flag=select(max+1,&selSet,(fd_set *)NULL,(fd_set *)NULL,&gpm_timeout);
     65        }
     66      while (!flag);
     67
     68      if (flag==-1)
     69        continue;
     70
     71      if (FD_ISSET(fd,&selSet))
     72        return getch();
     73     
     74      if (Gpm_GetEvent(&ev) && gpm_handler
     75          && (result=(*gpm_handler)(&ev,gpm_data)))
     76        {
     77        gpm_hflag=1;
     78        return result;
     79        }
     80      }
     81  return 0;
     82}
     83#endif
     84
  • Makefile.in

    diff -urN w3m-0.5.1/Makefile.in w3m-0.5.1.fixed/Makefile.in
    old new  
    8585SRCS=main.c file.c buffer.c display.c etc.c search.c linein.c table.c local.c \
    8686        form.c map.c frame.c rc.c menu.c mailcap.c image.c \
    8787        symbol.c entity.c terms.c url.c ftp.c mimehead.c regex.c news.c \
    88         func.c cookie.c history.c backend.c $(KEYBIND_SRC)
     88        func.c cookie.c history.c backend.c gpm-libcurses.c $(KEYBIND_SRC)
    8989OBJS=main.o file.o buffer.o display.o etc.o search.o linein.o table.o local.o\
    9090        form.o map.o frame.o rc.o menu.o mailcap.o image.o \
    9191        symbol.o entity.o terms.o url.o ftp.o mimehead.o regex.o news.o \
    92         func.o cookie.o history.o backend.o $(KEYBIND_OBJ)
     92        func.o cookie.o history.o backend.o gpm-libcurses.o $(KEYBIND_OBJ)
    9393LSRCS=anchor.c parsetagx.c tagtable.c istream.c
    9494LOBJS=anchor.o parsetagx.o tagtable.o istream.o
    9595LLOBJS=version.o
  • config.h.in

    diff -urN w3m-0.5.1/config.h.in w3m-0.5.1.fixed/config.h.in
    old new  
    231231#define INFLATE_NAME "inflate"
    232232
     233#undef HAVE_GPM_WGETCH
    233234#endif /* CONFIG_H_SEEN */