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.

87 lines
2.6 KiB

  1. # --- ROCK-COPYRIGHT-NOTE-BEGIN ---
  2. #
  3. # This copyright note is auto-generated by ./scripts/Create-CopyPatch.
  4. # Please add additional copyright information _after_ the line containing
  5. # the ROCK-COPYRIGHT-NOTE-END tag. Otherwise it might get removed by
  6. # the ./scripts/Create-CopyPatch script. Do not edit this copyright text!
  7. #
  8. # ROCK Linux: rock-src/package/jimmy/zgv/mousexy-fix.patch
  9. # ROCK Linux is Copyright (C) 1998 - 2003 Clifford Wolf
  10. #
  11. # This program is free software; you can redistribute it and/or modify
  12. # it under the terms of the GNU General Public License as published by
  13. # the Free Software Foundation; either version 2 of the License, or
  14. # (at your option) any later version. A copy of the GNU General Public
  15. # License can be found at Documentation/COPYING.
  16. #
  17. # Many people helped and are helping developing ROCK Linux. Please
  18. # have a look at http://www.rocklinux.org/ and the Documentation/TEAM
  19. # file for details.
  20. #
  21. # --- ROCK-COPYRIGHT-NOTE-END ---
  22. --- ./src/readnbkey.c.orig 2003-04-05 16:40:39.000000000 +0300
  23. +++ ./src/readnbkey.c 2003-08-10 12:27:23.000000000 +0300
  24. @@ -62,7 +62,7 @@
  25. /* saved mx/my in in range 0..MPOS_SAVE_MAX. */
  26. -#define MPOS_SAVE_MAX 16383
  27. +#define MPOS_SAVE_MAX 16383.0
  28. static int old_click_status=0,new_click_status=0;
  29. @@ -276,7 +276,8 @@
  30. }
  31. -static int saved_mx=0,saved_my=0;
  32. +/* All save/restore calculations are done in float to avoid int truncating. */
  33. +static float saved_mx=0.0,saved_my=0.0;
  34. /* save mouse pointer's current position. used when switching over
  35. * to the panning-follows-mouse model used by vgadisp.c, so that on
  36. @@ -288,7 +289,7 @@
  37. */
  38. void save_mouse_pos()
  39. {
  40. -int mx,my;
  41. +float mx,my;
  42. if(!has_mouse) return;
  43. @@ -297,13 +298,13 @@
  44. */
  45. if(vga_getcurrentmode()==TEXT)
  46. {
  47. - mx=MPOS_SAVE_MAX/2;
  48. - my=MPOS_SAVE_MAX/2;
  49. + mx=MPOS_SAVE_MAX/2.0;
  50. + my=MPOS_SAVE_MAX/2.0;
  51. }
  52. else
  53. {
  54. - mx=(mouse_getx()*MPOS_SAVE_MAX)/(vga_getxdim()-1);
  55. - my=(mouse_gety()*MPOS_SAVE_MAX)/(vga_getydim()-1);
  56. + mx=(mouse_getx()*MPOS_SAVE_MAX)/(vga_getxdim()-1.0);
  57. + my=(mouse_gety()*MPOS_SAVE_MAX)/(vga_getydim()-1.0);
  58. }
  59. /* just in case */
  60. if(mx>MPOS_SAVE_MAX) mx=MPOS_SAVE_MAX;
  61. @@ -323,12 +324,13 @@
  62. /* restore saved pos assuming given size screen */
  63. void restore_mouse_pos_with_size(int width,int height)
  64. {
  65. -int mx,my;
  66. +extern float roundf(float x); /* may be missing from math.h, must be declared */
  67. +float mx,my;
  68. if(!has_mouse) return;
  69. -mx=(saved_mx*(width-1))/MPOS_SAVE_MAX;
  70. -my=(saved_my*(height-1))/MPOS_SAVE_MAX;
  71. +mx=roundf((saved_mx*(width-1.0))/MPOS_SAVE_MAX);
  72. +my=roundf((saved_my*(height-1.0))/MPOS_SAVE_MAX);
  73. /* just in case */
  74. if(mx>width-1) mx=width-1;
  75. if(my>height-1) my=height-1;