On Sat, 8 Jun 2002, Mikulas Patocka wrote: > Here it is -- patch for reporting mouse movement in pixels. > > When application sets bit GPM_SMOOTH in both defaultMask and eventMask, > gpm reports dx and dy in pixels, not in characters (and acknowledges it by > setting GPM_SMOOTH in event.type). > > Included is also patch for framebuffer.c in links to take adventage of > this feature. > > GPM-UNLINK-PID is a simple fix for bug, that gpm doesn't delete gpm.pid on > errors, thus preventing next starts of gpm. > > BTW: why does gpm-1.20 have so agressive debugging messages enabled??? > Libgpm on client writes on terminal, gpm daemon writes to log every > connect including the file and line in sources where is it processed. > Could it be turned off? Sorry, I had one bug in it that prevented it from working with old gpm. This is correct patch for links. Mikulas
--- framebuffer.c_ Sat Jun 8 13:27:18 2002 +++ framebuffer.c Sat Jun 8 15:18:43 2002 @@ -35,6 +35,12 @@ #include "arrow.inc" +#ifdef GPM_HAVE_SMOOTH +#define gpm_smooth GPM_SMOOTH +#else +#define gpm_smooth 0 +#endif + #define TTY 0 #ifndef USE_GPM_DX @@ -885,8 +891,13 @@ } #else if (gev.dx || gev.dy) { - mouse_x += gev.dx * 8; - mouse_y += gev.dy * 8; + if (!(gev.type & gpm_smooth)) { + mouse_x += gev.dx * 8; + mouse_y += gev.dy * 8; + } else { + mouse_x += gev.dx; + mouse_y += gev.dy; + } } #endif ev.ev = EV_MOUSE; @@ -895,14 +906,14 @@ if (mouse_x < 0) mouse_x = 0; if (mouse_y < 0) mouse_y = 0; - if (gev.dx || gev.dy) { + if (!(gev.type & gpm_smooth) && (gev.dx || gev.dy)) { mouse_x = (mouse_x + 8) / 8 * 8 - 4; mouse_y = (mouse_y + 8) / 8 * 8 - 4; + if (mouse_x >= fb_xsize) mouse_x = fb_xsize - 1; + if (mouse_y >= fb_ysize) mouse_y = fb_ysize - 1; + if (mouse_x < 0) mouse_x = 0; + if (mouse_y < 0) mouse_y = 0; } - if (mouse_x >= fb_xsize) mouse_x = fb_xsize - 1; - if (mouse_y >= fb_ysize) mouse_y = fb_ysize - 1; - if (mouse_x < 0) mouse_x = 0; - if (mouse_y < 0) mouse_y = 0; ev.x = mouse_x; ev.y = mouse_y; @@ -956,7 +967,7 @@ get_terminal_size(1, &fb_txt_xsize, &fb_txt_ysize); #endif conn.eventMask = ~0; - conn.defaultMask = 0; + conn.defaultMask = gpm_smooth; conn.minMod = 0; conn.maxMod = -1; if ((fb_hgpm = Gpm_Open(&conn, 0)) < 0) { @@ -1172,6 +1183,7 @@ global_mouse_hidden=1; show_mouse(); if (handle_fb_mouse()) { + fb_driver.shutdown_device(mouse_graphics_device); mem_free(mouse_buffer); mem_free(background_buffer); mem_free(new_background_buffer);