Skip to content

Commit 96565a8

Browse files
authored
Merge pull request #783 from o-sdn-o/gui-bridge
Fix duplicate devices in Linux in-kernel console/KMSCON
2 parents e953bd8 + ea403e7 commit 96565a8

File tree

3 files changed

+220
-197
lines changed

3 files changed

+220
-197
lines changed

src/netxs/desktopio/application.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ namespace netxs::app
2222

2323
namespace netxs::app::shared
2424
{
25-
static const auto version = "v2025.08.04a";
25+
static const auto version = "v2025.08.04b";
2626
static const auto repository = "https://github.com/directvt/vtm";
2727
static const auto usr_config = "~/.config/vtm/settings.xml"s;
2828
static const auto sys_config = "/etc/vtm/settings.xml"s;

src/netxs/desktopio/lixx.hpp

Lines changed: 94 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -3078,6 +3078,7 @@ namespace netxs::lixx // li++, libinput++.
30783078
virtual libinput_button_state libinput_event_pointer_get_button_state() { if constexpr (debugmode) bad_event_type(__func__); return {}; }
30793079
virtual si32 libinput_event_pointer_has_axis(libinput_pointer_axis /*axis*/) { if constexpr (debugmode) bad_event_type(__func__); return {}; }
30803080
virtual fp64_coor libinput_event_pointer_get_scroll_value() { if constexpr (debugmode) bad_event_type(__func__); return {}; }
3081+
virtual fp64_coor libinput_event_pointer_get_scroll_value_v120() { if constexpr (debugmode) bad_event_type(__func__); return {}; }
30813082

30823083
view event_type_to_str()
30833084
{
@@ -3179,6 +3180,7 @@ namespace netxs::lixx // li++, libinput++.
31793180
virtual libinput_button_state libinput_event_pointer_get_button_state() override { return state; }
31803181
virtual si32 libinput_event_pointer_has_axis(libinput_pointer_axis axis) override { return !!(active_axes & (1ul << axis)); }
31813182
virtual fp64_coor libinput_event_pointer_get_scroll_value() override { return delta; }
3183+
virtual fp64_coor libinput_event_pointer_get_scroll_value_v120() override { return v120; }
31823184
};
31833185
struct libinput_event_gesture : libinput_event
31843186
{
@@ -3470,25 +3472,23 @@ namespace netxs::lixx // li++, libinput++.
34703472
_set_properties();
34713473
_sync_with_hwdb();
34723474
}
3473-
if (initialized)
3475+
if (!initialized)
3476+
{
3477+
log(" Device %% is not initialized", devpath);
3478+
os::close(new_fd);
3479+
}
3480+
else
34743481
{
34753482
if constexpr (debugmode)
34763483
{
3477-
if (initialized)
3478-
{
3479-
auto mx = 0u;
3480-
for (auto& [propname, value] : properties) if (mx < propname.size()) mx = propname.size();
3481-
mx += 10;
3482-
log(" Property\r\x1b[%mx%CValue", mx);
3483-
log(" ---------------------------------");
3484-
for ([[maybe_unused]] auto& [propname, value] : properties)
3485-
{
3486-
log(" %propname%\r\x1b[%mx%C%value%", propname, mx, value);
3487-
}
3488-
}
3489-
else
3484+
auto mx = 0u;
3485+
for (auto& [propname, value] : properties) if (mx < propname.size()) mx = propname.size();
3486+
mx += 10;
3487+
log(" Property\r\x1b[%mx%CValue", mx);
3488+
log(" ---------------------------------");
3489+
for ([[maybe_unused]] auto& [propname, value] : properties)
34903490
{
3491-
log(" Device %% is uninitialized", devpath);
3491+
log(" %propname%\r\x1b[%mx%C%value%", propname, mx, value);
34923492
}
34933493
}
34943494
}
@@ -4985,6 +4985,13 @@ namespace netxs::lixx // li++, libinput++.
49854985
void input_enable();
49864986
void input_disable();
49874987

4988+
void enumerate_active_devices(auto proc)
4989+
{
4990+
for (auto d : path_list)
4991+
{
4992+
if (!proc(d)) break;
4993+
}
4994+
}
49884995
bool current_tty_is_active()
49894996
{
49904997
return ud_monitor && ud_monitor->initial_tty.size() && ud_monitor->initial_tty == ud_monitor->current_tty;
@@ -6697,6 +6704,78 @@ namespace netxs::lixx // li++, libinput++.
66976704
button_event.abs_info_y2 = *y;
66986705
post_device_event(now, LIBINPUT_EVENT_TABLET_TOOL_BUTTON, button_event);
66996706
}
6707+
si32 libinput_device_config_tap_get_finger_count()
6708+
{
6709+
return config.tap ? config.tap->count(This()) : 0;
6710+
}
6711+
libinput_config_status libinput_device_config_tap_set_enabled(libinput_config_tap_state enable)
6712+
{
6713+
auto rc = LIBINPUT_CONFIG_STATUS_INVALID;
6714+
if (enable == LIBINPUT_CONFIG_TAP_ENABLED || enable == LIBINPUT_CONFIG_TAP_DISABLED)
6715+
{
6716+
auto fn = libinput_device_config_tap_get_finger_count();
6717+
rc = fn ? config.tap->set_enabled(This(), enable)
6718+
: enable ? LIBINPUT_CONFIG_STATUS_UNSUPPORTED
6719+
: LIBINPUT_CONFIG_STATUS_SUCCESS;
6720+
}
6721+
return rc;
6722+
}
6723+
ui32 libinput_device_config_scroll_get_methods()
6724+
{
6725+
return config.scroll_method ? config.scroll_method->get_methods(This()) : 0u;
6726+
}
6727+
libinput_config_status libinput_device_config_scroll_set_method(libinput_config_scroll_method method)
6728+
{
6729+
auto rc = LIBINPUT_CONFIG_STATUS_INVALID;
6730+
if (method == LIBINPUT_CONFIG_SCROLL_NO_SCROLL // Check method is a single valid method.
6731+
|| method == LIBINPUT_CONFIG_SCROLL_2FG
6732+
|| method == LIBINPUT_CONFIG_SCROLL_EDGE
6733+
|| method == LIBINPUT_CONFIG_SCROLL_ON_BUTTON_DOWN)
6734+
{
6735+
if ((libinput_device_config_scroll_get_methods() & method) != method) rc = LIBINPUT_CONFIG_STATUS_UNSUPPORTED;
6736+
else if (config.scroll_method) rc = config.scroll_method->set_method(This(), method);
6737+
else /* method must be _NO_SCROLL to get here */ rc = LIBINPUT_CONFIG_STATUS_SUCCESS;
6738+
}
6739+
return rc;
6740+
}
6741+
bool libinput_device_config_accel_is_available()
6742+
{
6743+
return config.accel && config.accel->available(This());
6744+
}
6745+
libinput_config_status libinput_device_config_accel_set_speed(fp64 speed)
6746+
{
6747+
if (speed >= -1.0 && speed <= 1.0)
6748+
{
6749+
if (!libinput_device_config_accel_is_available()) return LIBINPUT_CONFIG_STATUS_UNSUPPORTED;
6750+
else return config.accel->set_speed(This(), speed);
6751+
}
6752+
else return LIBINPUT_CONFIG_STATUS_INVALID;
6753+
}
6754+
fp64 libinput_device_config_accel_get_speed()
6755+
{
6756+
if (!libinput_device_config_accel_is_available()) return 0;
6757+
else return config.accel->get_speed(This());
6758+
}
6759+
ui32 libinput_device_config_accel_get_profiles()
6760+
{
6761+
if (!libinput_device_config_accel_is_available()) return 0;
6762+
return config.accel->get_profiles(This());
6763+
}
6764+
libinput_config_status libinput_device_config_accel_set_profile(libinput_config_accel_profile profile)
6765+
{
6766+
switch (profile)
6767+
{
6768+
case LIBINPUT_CONFIG_ACCEL_PROFILE_FLAT:
6769+
case LIBINPUT_CONFIG_ACCEL_PROFILE_ADAPTIVE:
6770+
case LIBINPUT_CONFIG_ACCEL_PROFILE_CUSTOM: break;
6771+
default: return LIBINPUT_CONFIG_STATUS_INVALID;
6772+
}
6773+
if (libinput_device_config_accel_is_available() && (libinput_device_config_accel_get_profiles() & profile))
6774+
{
6775+
return config.accel->set_profile(This(), profile);
6776+
}
6777+
else return LIBINPUT_CONFIG_STATUS_UNSUPPORTED;
6778+
}
67006779
};
67016780

67026781
struct input_prop
@@ -21222,40 +21301,6 @@ namespace netxs::lixx // li++, libinput++.
2122221301
return ctx;
2122321302
}
2122421303
}
21225-
si32 libinput_device_config_tap_get_finger_count(libinput_device_sptr li_device)
21226-
{
21227-
return li_device->config.tap ? li_device->config.tap->count(li_device) : 0;
21228-
}
21229-
libinput_config_status libinput_device_config_tap_set_enabled(libinput_device_sptr li_device, libinput_config_tap_state enable)
21230-
{
21231-
auto rc = LIBINPUT_CONFIG_STATUS_INVALID;
21232-
if (enable == LIBINPUT_CONFIG_TAP_ENABLED || enable == LIBINPUT_CONFIG_TAP_DISABLED)
21233-
{
21234-
auto fn = libinput_device_config_tap_get_finger_count(li_device);
21235-
rc = fn ? li_device->config.tap->set_enabled(li_device, enable)
21236-
: enable ? LIBINPUT_CONFIG_STATUS_UNSUPPORTED
21237-
: LIBINPUT_CONFIG_STATUS_SUCCESS;
21238-
}
21239-
return rc;
21240-
}
21241-
ui32 libinput_device_config_scroll_get_methods(libinput_device_sptr li_device)
21242-
{
21243-
return li_device->config.scroll_method ? li_device->config.scroll_method->get_methods(li_device) : 0u;
21244-
}
21245-
libinput_config_status libinput_device_config_scroll_set_method(libinput_device_sptr li_device, libinput_config_scroll_method method)
21246-
{
21247-
auto rc = LIBINPUT_CONFIG_STATUS_INVALID;
21248-
if (method == LIBINPUT_CONFIG_SCROLL_NO_SCROLL // Check method is a single valid method.
21249-
|| method == LIBINPUT_CONFIG_SCROLL_2FG
21250-
|| method == LIBINPUT_CONFIG_SCROLL_EDGE
21251-
|| method == LIBINPUT_CONFIG_SCROLL_ON_BUTTON_DOWN)
21252-
{
21253-
if ((libinput_device_config_scroll_get_methods(li_device) & method) != method) rc = LIBINPUT_CONFIG_STATUS_UNSUPPORTED;
21254-
else if (li_device->config.scroll_method) rc = li_device->config.scroll_method->set_method(li_device, method);
21255-
else /* method must be _NO_SCROLL to get here */ rc = LIBINPUT_CONFIG_STATUS_SUCCESS;
21256-
}
21257-
return rc;
21258-
}
2125921304
}
2126021305
#if not defined(DEBUG)
2126121306
#undef log

0 commit comments

Comments
 (0)