Re: Slow wsmouse down in console

2015-12-01 Thread Thierry Deval
Hi Ulf,

I indeed guess there are not much console users these modern days.

Personally, my current laptop is so slow in X that I find it convenient to
switch back and forth between ttyC[014]. In that regard, I will probably
investigate the possibility of sharing the copy-buffer between screens. Who
knows ?

I unfortunately couldn't test my patch as much as you did.
(I'm still waiting for my new laptop to speed up my builds. Should arrive
soon hopefully)

Thanks for your involved feedback,

Thierry


On Sun, Nov 29, 2015 at 5:02 PM, Ulf Brosziewski <
ulf.brosziew...@t-online.de> wrote:

> This looks nice. Maybe someone else who is more familiar with wsdisplay
> could also have a look at it?
>
> I made a test with a USB mouse and an ALPS Glidepoint, which worked
> well.  Without the patch wsmoused is completely useless for that
> touchpad. Out of curiosity, I made another test with an Elantech-v4
> clickpad, and the cursor control also worked well (of course, wsmoused
> remains useless for clickpads because you cannot paste).
>
> Both tracking the remainders when scaling and taking the size of the
> cells into account looks reasonable. There might still be no g
> ā€‹uā€‹
> arantee
> that this works everywhere - pms, for example, applies somewhat
> arbitrary scale factors in compat mode, there is no stable correlation
> to the touchpad resolutions. But if this works in standard environments,
> it is certainly more useful than the current version.
>
> Because I saw no complaints up to now, I have been thinking that hardly
> anyone uses touchpads at the console. Am I wrong here?
>
>
>
> On 11/27/2015 12:35 AM, Thierry Deval wrote:
>
>> Hi,
>>
>> I hope I'm not the only one being annoyed by the fast movement of wsmouse
>> when
>> in text mode, and this one can be useful.
>>
>> Here is a patch that slows down the cursor by reducing the mouse
>> coordinates
>> proportionally to the console font size.
>> I confess I have only tried it on this laptop with its Synaptics touchpad
>> and
>> some other USB mouses.
>>
>> Anyone else interested ?
>>
>> Thierry
>>
>> Index: sys/dev/wscons/wsdisplay.c
>> ===
>> RCS file: /cvs/src/sys/dev/wscons/wsdisplay.c,v
>> retrieving revision 1.124
>> diff -u -p -r1.124 wsdisplay.c
>> --- dev/wscons/wsdisplay.c  8 Sep 2015 11:13:20 -   1.124
>> +++ dev/wscons/wsdisplay.c  26 Nov 2015 20:28:48 -
>> @@ -2463,27 +2463,39 @@ ctrl_event(struct wsdisplay_softc *sc, u
>>   void
>>   mouse_moverel(struct wsscreen *scr, int dx, int dy)
>>   {
>> +   static int acc_dx, acc_dy;
>> struct wsscreen_internal *dconf = scr->scr_dconf;
>> +   const struct wsscreen_descr *descr = dconf->scrdata;
>> u_int old_mouse = scr->mouse;
>> int mouse_col = scr->mouse % N_COLS(dconf);
>> int mouse_row = scr->mouse / N_COLS(dconf);
>> +   int norm_dx, norm_dy;
>> +
>> +   /* accumulate movement and calculate character equivalent */
>> +   acc_dx += dx;
>> +   if ((norm_dx = acc_dx / descr->fontwidth )) acc_dx -=
>> descr->fontwidth  * norm_dx;
>> +   acc_dy += dy;
>> +   if ((norm_dy = acc_dy / descr->fontheight)) acc_dy -=
>> descr->fontheight * norm_dy;
>> +
>> +   /* bail out if mouse hasn't virtually moved */
>> +   if (norm_dx == 0 && norm_dy == 0) return;
>>
>> /* update position */
>> -   if (mouse_col + dx >= MAXCOL(dconf))
>> +   if (mouse_col + norm_dx >= MAXCOL(dconf))
>> mouse_col = MAXCOL(dconf);
>> else {
>> -   if (mouse_col + dx <= 0)
>> +   if (mouse_col + norm_dx <= 0)
>> mouse_col = 0;
>> else
>> -   mouse_col += dx;
>> +   mouse_col += norm_dx;
>> }
>> -   if (mouse_row + dy >= MAXROW(dconf))
>> +   if (mouse_row + norm_dy >= MAXROW(dconf))
>> mouse_row = MAXROW(dconf);
>> else {
>> -   if (mouse_row + dy <= 0)
>> +   if (mouse_row + norm_dy <= 0)
>> mouse_row = 0;
>> else
>> -   mouse_row += dy;
>> +   mouse_row += norm_dy;
>> }
>> scr->mouse = mouse_row * N_COLS(dconf) + mouse_col;
>>
>>
>>
>>
>


Re: Slow wsmouse down in console

2015-11-29 Thread Ulf Brosziewski

This looks nice. Maybe someone else who is more familiar with wsdisplay
could also have a look at it?

I made a test with a USB mouse and an ALPS Glidepoint, which worked
well.  Without the patch wsmoused is completely useless for that
touchpad. Out of curiosity, I made another test with an Elantech-v4
clickpad, and the cursor control also worked well (of course, wsmoused
remains useless for clickpads because you cannot paste).

Both tracking the remainders when scaling and taking the size of the
cells into account looks reasonable. There might still be no garantuee
that this works everywhere - pms, for example, applies somewhat
arbitrary scale factors in compat mode, there is no stable correlation
to the touchpad resolutions. But if this works in standard environments,
it is certainly more useful than the current version.

Because I saw no complaints up to now, I have been thinking that hardly
anyone uses touchpads at the console. Am I wrong here?


On 11/27/2015 12:35 AM, Thierry Deval wrote:

Hi,

I hope I'm not the only one being annoyed by the fast movement of wsmouse when
in text mode, and this one can be useful.

Here is a patch that slows down the cursor by reducing the mouse coordinates
proportionally to the console font size.
I confess I have only tried it on this laptop with its Synaptics touchpad and
some other USB mouses.

Anyone else interested ?

Thierry

Index: sys/dev/wscons/wsdisplay.c
===
RCS file: /cvs/src/sys/dev/wscons/wsdisplay.c,v
retrieving revision 1.124
diff -u -p -r1.124 wsdisplay.c
--- dev/wscons/wsdisplay.c  8 Sep 2015 11:13:20 -   1.124
+++ dev/wscons/wsdisplay.c  26 Nov 2015 20:28:48 -
@@ -2463,27 +2463,39 @@ ctrl_event(struct wsdisplay_softc *sc, u
  void
  mouse_moverel(struct wsscreen *scr, int dx, int dy)
  {
+   static int acc_dx, acc_dy;
struct wsscreen_internal *dconf = scr->scr_dconf;
+   const struct wsscreen_descr *descr = dconf->scrdata;
u_int old_mouse = scr->mouse;
int mouse_col = scr->mouse % N_COLS(dconf);
int mouse_row = scr->mouse / N_COLS(dconf);
+   int norm_dx, norm_dy;
+
+   /* accumulate movement and calculate character equivalent */
+   acc_dx += dx;
+   if ((norm_dx = acc_dx / descr->fontwidth )) acc_dx -= descr->fontwidth  
* norm_dx;
+   acc_dy += dy;
+   if ((norm_dy = acc_dy / descr->fontheight)) acc_dy -= descr->fontheight 
* norm_dy;
+
+   /* bail out if mouse hasn't virtually moved */
+   if (norm_dx == 0 && norm_dy == 0) return;

/* update position */
-   if (mouse_col + dx >= MAXCOL(dconf))
+   if (mouse_col + norm_dx >= MAXCOL(dconf))
mouse_col = MAXCOL(dconf);
else {
-   if (mouse_col + dx <= 0)
+   if (mouse_col + norm_dx <= 0)
mouse_col = 0;
else
-   mouse_col += dx;
+   mouse_col += norm_dx;
}
-   if (mouse_row + dy >= MAXROW(dconf))
+   if (mouse_row + norm_dy >= MAXROW(dconf))
mouse_row = MAXROW(dconf);
else {
-   if (mouse_row + dy <= 0)
+   if (mouse_row + norm_dy <= 0)
mouse_row = 0;
else
-   mouse_row += dy;
+   mouse_row += norm_dy;
}
scr->mouse = mouse_row * N_COLS(dconf) + mouse_col;







Slow wsmouse down in console

2015-11-26 Thread Thierry Deval
Hi,

I hope I'm not the only one being annoyed by the fast movement of wsmouse when
in text mode, and this one can be useful.

Here is a patch that slows down the cursor by reducing the mouse coordinates
proportionally to the console font size.
I confess I have only tried it on this laptop with its Synaptics touchpad and
some other USB mouses.

Anyone else interested ?

Thierry

Index: sys/dev/wscons/wsdisplay.c
===
RCS file: /cvs/src/sys/dev/wscons/wsdisplay.c,v
retrieving revision 1.124
diff -u -p -r1.124 wsdisplay.c
--- dev/wscons/wsdisplay.c  8 Sep 2015 11:13:20 -   1.124
+++ dev/wscons/wsdisplay.c  26 Nov 2015 20:28:48 -
@@ -2463,27 +2463,39 @@ ctrl_event(struct wsdisplay_softc *sc, u
 void
 mouse_moverel(struct wsscreen *scr, int dx, int dy)
 {
+   static int acc_dx, acc_dy;
struct wsscreen_internal *dconf = scr->scr_dconf;
+   const struct wsscreen_descr *descr = dconf->scrdata;
u_int old_mouse = scr->mouse;
int mouse_col = scr->mouse % N_COLS(dconf);
int mouse_row = scr->mouse / N_COLS(dconf);
+   int norm_dx, norm_dy;
+
+   /* accumulate movement and calculate character equivalent */
+   acc_dx += dx;
+   if ((norm_dx = acc_dx / descr->fontwidth )) acc_dx -= descr->fontwidth  
* norm_dx;
+   acc_dy += dy;
+   if ((norm_dy = acc_dy / descr->fontheight)) acc_dy -= descr->fontheight 
* norm_dy;
+
+   /* bail out if mouse hasn't virtually moved */
+   if (norm_dx == 0 && norm_dy == 0) return;
 
/* update position */
-   if (mouse_col + dx >= MAXCOL(dconf))
+   if (mouse_col + norm_dx >= MAXCOL(dconf))
mouse_col = MAXCOL(dconf);
else {
-   if (mouse_col + dx <= 0)
+   if (mouse_col + norm_dx <= 0)
mouse_col = 0;
else
-   mouse_col += dx;
+   mouse_col += norm_dx;
}
-   if (mouse_row + dy >= MAXROW(dconf))
+   if (mouse_row + norm_dy >= MAXROW(dconf))
mouse_row = MAXROW(dconf);
else {
-   if (mouse_row + dy <= 0)
+   if (mouse_row + norm_dy <= 0)
mouse_row = 0;
else
-   mouse_row += dy;
+   mouse_row += norm_dy;
}
scr->mouse = mouse_row * N_COLS(dconf) + mouse_col;