Browse Source

Merge pull request #37 from donRaphaco/master

support for two finger scrolling with mousepad
master
Maciej Borzecki 7 years ago
committed by GitHub
parent
commit
66c317a573
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 22 additions and 10 deletions
  1. +1
    -1
      extra/uncrustify.cfg
  2. +21
    -9
      src/mconnect/mousepad.vala

+ 1
- 1
extra/uncrustify.cfg View File

@ -794,7 +794,7 @@ align_with_tabs = false # false/true
align_on_tabstop = false # false/true
# Whether to left-align numbers
align_number_left = false # false/true
#align_number_left = false # false/true
# TODO DOC
# Whether to keep whitespace not required for alignment.


+ 21
- 9
src/mconnect/mousepad.vala View File

@ -75,12 +75,29 @@ class MousepadHandler : Object, PacketHandlerInterface {
} else if (pkt.body.has_member ("middleclick")) {
send_click (2);
} else if (pkt.body.has_member ("dx") && pkt.body.has_member ("dy")) {
// motion/position
// motion/position or scrolling
double dx = pkt.body.get_double_member ("dx");
double dy = pkt.body.get_double_member ("dy");
debug ("position: %f x %f", dx, dy);
move_cursor_relative (dx, dy);
if (pkt.body.has_member ("scroll") && pkt.body.get_boolean_member ("scroll")) {
// scroll with variable speed
while (dy > 3.0) {
// scroll down
send_click (5);
dy /= 4.0;
debug ("scroll down");
}
while (dy < -3.0) {
// scroll up
send_click (4);
dy /= 4.0;
debug ("scroll up");
}
} else {
debug ("position: %f x %f", dx, dy);
move_cursor_relative (dx, dy);
}
} else if (pkt.body.has_member ("key")) {
string key = pkt.body.get_string_member ("key");
debug ("got key: %s", key);
@ -101,12 +118,7 @@ class MousepadHandler : Object, PacketHandlerInterface {
}
private void send_click (int button, bool doubleclick = false) {
var etype = "b1c";
if (button == 2) {
etype = "b2c";
} else if (button == 3) {
etype = "b3c";
}
var etype = "b%ic".printf (button);
try {
int x, y;
_display.get_pointer (null, out x, out y, null);


Loading…
Cancel
Save