More improvements in the mouse events and the limits calculation

Signed-off-by: jagracar <jagracar@gmail.com>