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.

84 lines
2.5 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 - 2006 Clifford Wolf
  10. #
  11. # This patch file is dual-licensed. It is available under the license the
  12. # patched project is licensed under, as long as it is an OpenSource license
  13. # as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms
  14. # of the GNU General Public License as published by the Free Software
  15. # Foundation; either version 2 of the License, or (at your option) any later
  16. # version.
  17. #
  18. # --- ROCK-COPYRIGHT-NOTE-END ---
  19. --- ./src/readnbkey.c.orig 2003-04-05 16:40:39.000000000 +0300
  20. +++ ./src/readnbkey.c 2003-08-10 12:27:23.000000000 +0300
  21. @@ -62,7 +62,7 @@
  22. /* saved mx/my in in range 0..MPOS_SAVE_MAX. */
  23. -#define MPOS_SAVE_MAX 16383
  24. +#define MPOS_SAVE_MAX 16383.0
  25. static int old_click_status=0,new_click_status=0;
  26. @@ -276,7 +276,8 @@
  27. }
  28. -static int saved_mx=0,saved_my=0;
  29. +/* All save/restore calculations are done in float to avoid int truncating. */
  30. +static float saved_mx=0.0,saved_my=0.0;
  31. /* save mouse pointer's current position. used when switching over
  32. * to the panning-follows-mouse model used by vgadisp.c, so that on
  33. @@ -288,7 +289,7 @@
  34. */
  35. void save_mouse_pos()
  36. {
  37. -int mx,my;
  38. +float mx,my;
  39. if(!has_mouse) return;
  40. @@ -297,13 +298,13 @@
  41. */
  42. if(vga_getcurrentmode()==TEXT)
  43. {
  44. - mx=MPOS_SAVE_MAX/2;
  45. - my=MPOS_SAVE_MAX/2;
  46. + mx=MPOS_SAVE_MAX/2.0;
  47. + my=MPOS_SAVE_MAX/2.0;
  48. }
  49. else
  50. {
  51. - mx=(mouse_getx()*MPOS_SAVE_MAX)/(vga_getxdim()-1);
  52. - my=(mouse_gety()*MPOS_SAVE_MAX)/(vga_getydim()-1);
  53. + mx=(mouse_getx()*MPOS_SAVE_MAX)/(vga_getxdim()-1.0);
  54. + my=(mouse_gety()*MPOS_SAVE_MAX)/(vga_getydim()-1.0);
  55. }
  56. /* just in case */
  57. if(mx>MPOS_SAVE_MAX) mx=MPOS_SAVE_MAX;
  58. @@ -323,12 +324,13 @@
  59. /* restore saved pos assuming given size screen */
  60. void restore_mouse_pos_with_size(int width,int height)
  61. {
  62. -int mx,my;
  63. +extern float roundf(float x); /* may be missing from math.h, must be declared */
  64. +float mx,my;
  65. if(!has_mouse) return;
  66. -mx=(saved_mx*(width-1))/MPOS_SAVE_MAX;
  67. -my=(saved_my*(height-1))/MPOS_SAVE_MAX;
  68. +mx=roundf((saved_mx*(width-1.0))/MPOS_SAVE_MAX);
  69. +my=roundf((saved_my*(height-1.0))/MPOS_SAVE_MAX);
  70. /* just in case */
  71. if(mx>width-1) mx=width-1;
  72. if(my>height-1) my=height-1;