diff options
Diffstat (limited to 'wacom_pointer.e')
-rw-r--r-- | wacom_pointer.e | 38 |
1 files changed, 33 insertions, 5 deletions
diff --git a/wacom_pointer.e b/wacom_pointer.e index 8bfd40c..494b156 100644 --- a/wacom_pointer.e +++ b/wacom_pointer.e @@ -99,6 +99,22 @@ feature {} type_id.append_in(Result) end end + +feature {} + reconfigure_crop(parameters: FAST_ARRAY[STRING]) is + -- parameters.item(0): crop configuration + require + parameters.count = 1 + do + if is_valid_crop(parameters.item(0)) then + set_crop(parameters.item(0)) + else + io.put_string(once "Recieved CHANGE_CROP message with % + %invalid crop definition: ") + io.put_line(parameters.item(0)) + end + end + feature {XINPUT_IVY} set_x_offset(offset: INTEGER) is @@ -151,17 +167,17 @@ feature {XINPUT_IVY} crop_height := y_max_crop - y_min_crop end - set_prediction(milliseconds: REAL) is + set_prediction (milliseconds: REAL) is do prediction_time := milliseconds end - set_ignore_rate(n: INTEGER) is + set_ignore_rate (n: INTEGER) is do ignore_rate := n end - set_message_header(header: STRING) is + set_message_header (header: STRING) is local history_size: INTEGER do @@ -175,7 +191,19 @@ feature {XINPUT_IVY} create time_history.make(0, history_size) end - device_to_screen_x(x: INTEGER): INTEGER is + crop_identifier (id: STRING) is + local + msg: STRING + do + msg := once "" + msg.clear_count + msg.append(once "^CHANGE_CROP device_id=") + msg.append(id) + msg.append(once " crop=(.*)") + xinput_ivy.ivy.subscribe(msg, agent reconfigure_crop) + end + + device_to_screen_x (x: INTEGER): INTEGER is do Result := ((x - 150) / 86650 * 1600 + x_offset).force_to_integer_32 -- **** geometrie paramétrable end @@ -267,7 +295,7 @@ feature {XINPUT_IVY} message.append(once " type=") message.append(type_to_name(v4.high_16)) message.append(once " serial_number=") - (v5.high_16.to_integer_32 |<< 16).bit_or(v6.high_16).append_in(message) + (v5.high_16.to_integer_32 |<< 16).bit_or((0x0000FFFF).bit_and(v6.high_16)).append_in(message) message.append(once " time=") time.append_in(message) message.append(once " hires_x=") |