Check hardware keyboard availability on wayland for better touch screen support

This commit is contained in:
Deve 2019-06-16 22:21:15 +02:00
parent a0e182b142
commit 4bd94f8ea6
3 changed files with 7 additions and 1 deletions

View File

@ -538,6 +538,7 @@ public:
if ((caps & WL_SEAT_CAPABILITY_KEYBOARD) && !device->m_keyboard) if ((caps & WL_SEAT_CAPABILITY_KEYBOARD) && !device->m_keyboard)
{ {
device->m_has_hardware_keyboard = true;
device->m_keyboard = wl_seat_get_keyboard(seat); device->m_keyboard = wl_seat_get_keyboard(seat);
wl_keyboard_add_listener(device->m_keyboard, &keyboard_listener, wl_keyboard_add_listener(device->m_keyboard, &keyboard_listener,
device); device);
@ -870,6 +871,7 @@ CIrrDeviceWayland::CIrrDeviceWayland(const SIrrlichtCreationParameters& params)
m_height = params.WindowSize.Height; m_height = params.WindowSize.Height;
m_touches_count = 0; m_touches_count = 0;
m_has_touch_device = false; m_has_touch_device = false;
m_has_hardware_keyboard = false;
m_window_has_focus = false; m_window_has_focus = false;
m_window_minimized = false; m_window_minimized = false;

View File

@ -118,6 +118,9 @@ namespace irr
//! Returns true if system has touch device //! Returns true if system has touch device
virtual bool supportsTouchDevice() const { return m_has_touch_device; } virtual bool supportsTouchDevice() const { return m_has_touch_device; }
//! Returns true if system has hardware keyboard
virtual bool hasHardwareKeyboard() const { return m_has_hardware_keyboard; }
//! Set the current Gamma Value for the Display //! Set the current Gamma Value for the Display
virtual bool setGammaRamp(f32 red, f32 green, f32 blue, virtual bool setGammaRamp(f32 red, f32 green, f32 blue,
@ -220,6 +223,7 @@ namespace irr
unsigned int m_height; unsigned int m_height;
unsigned int m_touches_count; unsigned int m_touches_count;
bool m_has_touch_device; bool m_has_touch_device;
bool m_has_hardware_keyboard;
bool m_window_has_focus; bool m_window_has_focus;
bool m_window_minimized; bool m_window_minimized;
mutable core::stringc m_clipboard; mutable core::stringc m_clipboard;

View File

@ -532,7 +532,7 @@ namespace UserConfigParams
"multitouch interface.")); "multitouch interface."));
PARAM_PREFIX IntUserConfigParam m_screen_keyboard PARAM_PREFIX IntUserConfigParam m_screen_keyboard
PARAM_DEFAULT( IntUserConfigParam(0, "screen_keyboard_mode", PARAM_DEFAULT( IntUserConfigParam(1, "screen_keyboard_mode",
&m_multitouch_group, &m_multitouch_group,
"Screen keyboard mode: 0 = disabled, 1 = enabled if no hardware " "Screen keyboard mode: 0 = disabled, 1 = enabled if no hardware "
"keyboard, 2 = always enabled") ); "keyboard, 2 = always enabled") );