      subroutine taille_fen(iprox,iproy,iopt)
      INCLUDE 'Parametres.f'
C
cc      if (iopt.eq.1.or.igarde_taille_fen.ne.1) then
        if (iopt.eq.2) then
          idx = iprox
          idy = iproy
        elseif(iprox.lt.0.and.iproy.lt.0) then
          idx = -iprox
          idy = -iproy
        else
          iproxloc = min(100,max(1,iprox))
          iproyloc = min(100,max(1,iproy))
          idx=(nbpixx*iproxloc)/100
          idy=(nbpixy*iproyloc)/100
        endif
        if (idx.ne.display_characteristics(1)
     &  .or.idy.ne.display_characteristics(2)) then
          call x11taillefen(idx,idy)
c
c Boucle pour perdre un peu de temps et eviter les pb de rafraichissement
c
cc        xbidon = 0.
cc        do i=1,200000
cc          xbidon = cos(xbidon)
cc        enddo
cc        display_characteristics(2) = nint(xbidon)
          tempsaperdre = 0.1
          call perddutemps(tempsaperdre)
c
          display_characteristics(1) = idx
          display_characteristics(2) = idy
        endif
cc      endif
      igarde_taille_fen = iopt
      end
C====================================================
      subroutine taille_fen_old(iprox,iproy,iopt)
      INCLUDE 'Parametres.f'
C
CC      print*,'igarde',igarde_taille_fen,iopt
      if (iopt.eq.1.or.igarde_taille_fen.ne.1) then
        if (iopt.eq.2) then
          idx = iprox
          idy = iproy
        elseif(iprox.lt.0.and.iproy.lt.0) then
          idx = -iprox
          idy = -iproy
        else
          iproxloc = min(100,max(1,iprox))
          iproyloc = min(100,max(1,iproy))
          idx=(nbpixx*iproxloc)/100
          idy=(nbpixy*iproyloc)/100
        endif
        if (idx.ne.display_characteristics(1)
     &  .or.idy.ne.display_characteristics(2)) then
          print*,'{{{'
     &         ,display_characteristics(1),display_characteristics(2)
     &         ,idx,idy
          call x11taillefen(idx,idy)
c
c Boucle pour perdre un peu de temps et eviter les pb de rafraichissement
c
ccc        xbidon = 0.
ccc        do i=1,200000
ccc          xbidon = cos(xbidon)
ccc        enddo
ccc        display_characteristics(2) = nint(xbidon)
c
          display_characteristics(1) = idx
          display_characteristics(2) = idy
        endif
      endif
      igarde_taille_fen = iopt
      end
