Some work on support clipboard
This commit is contained in:
parent
e27df23415
commit
a9c2a1922a
@ -39,8 +39,9 @@ extern bool GLContextDebugBit;
|
||||
|
||||
#endif // _IRR_COMPILE_WITH_JOYSTICK_EVENTS_
|
||||
|
||||
#define XRANDR_ROTATION_LEFT (1 << 1)
|
||||
#define XRANDR_ROTATION_RIGHT (1 << 3)
|
||||
#define MOD_SHIFT_MASK 0x01
|
||||
#define MOD_ALT_MASK 0x02
|
||||
#define MOD_CONTROL_MASK 0x04
|
||||
|
||||
namespace irr
|
||||
{
|
||||
@ -346,9 +347,8 @@ public:
|
||||
irrevent.EventType = irr::EET_KEY_INPUT_EVENT;
|
||||
irrevent.KeyInput.PressedDown = (state == WL_KEYBOARD_KEY_STATE_PRESSED);
|
||||
irrevent.KeyInput.Char = xkb_keysym_to_utf32(sym);
|
||||
// irrevent.KeyInput.Char = ((wchar_t*)(buf))[0];
|
||||
// irrevent.KeyInput.Control = (event.xkey.state & ControlMask) != 0;
|
||||
// irrevent.KeyInput.Shift = (event.xkey.state & ShiftMask) != 0;
|
||||
irrevent.KeyInput.Control = (device->modifiers & MOD_CONTROL_MASK) != 0;
|
||||
irrevent.KeyInput.Shift = (device->modifiers & MOD_SHIFT_MASK) != 0;
|
||||
|
||||
|
||||
|
||||
@ -405,13 +405,14 @@ public:
|
||||
XKB_STATE_MODS_DEPRESSED | XKB_STATE_MODS_LATCHED);
|
||||
mask = xkb_state_serialize_mods(device->state,
|
||||
state_component);
|
||||
//~ input->modifiers = 0;
|
||||
//~ if (mask & input->xkb.control_mask)
|
||||
//~ input->modifiers |= MOD_CONTROL_MASK;
|
||||
//~ if (mask & input->xkb.alt_mask)
|
||||
//~ input->modifiers |= MOD_ALT_MASK;
|
||||
//~ if (mask & input->xkb.shift_mask)
|
||||
//~ input->modifiers |= MOD_SHIFT_MASK;
|
||||
|
||||
device->modifiers = 0;
|
||||
if (mask & device->control_mask)
|
||||
device->modifiers |= MOD_CONTROL_MASK;
|
||||
if (mask & device->alt_mask)
|
||||
device->modifiers |= MOD_ALT_MASK;
|
||||
if (mask & device->shift_mask)
|
||||
device->modifiers |= MOD_SHIFT_MASK;
|
||||
}
|
||||
|
||||
static void
|
||||
@ -631,7 +632,7 @@ CIrrDeviceWayland::CIrrDeviceWayland(const SIrrlichtCreationParameters& param)
|
||||
linuxversion += " ";
|
||||
linuxversion += LinuxInfo.machine;
|
||||
|
||||
Operator = new COSOperator(linuxversion);
|
||||
Operator = new COSOperator(linuxversion, this);
|
||||
os::Printer::log(linuxversion.c_str(), ELL_INFORMATION);
|
||||
|
||||
// Retrieve wayland infos
|
||||
@ -1365,13 +1366,16 @@ bool CIrrDeviceWayland::getGammaRamp( f32 &red, f32 &green, f32 &blue, f32 &brig
|
||||
//! \return Returns 0 if no string is in there.
|
||||
const c8* CIrrDeviceWayland::getTextFromClipboard() const
|
||||
{
|
||||
return 0;
|
||||
printf("get text from clipboard: %s\n", Clipboard.c_str());
|
||||
return Clipboard.c_str();
|
||||
|
||||
}
|
||||
|
||||
//! copies text to the clipboard
|
||||
void CIrrDeviceWayland::copyToClipboard(const c8* text) const
|
||||
{
|
||||
printf("copy to clipboard: %s\n", text);
|
||||
Clipboard = text;
|
||||
}
|
||||
|
||||
|
||||
|
@ -259,6 +259,7 @@ namespace irr
|
||||
xkb_mod_mask_t control_mask;
|
||||
xkb_mod_mask_t alt_mask;
|
||||
xkb_mod_mask_t shift_mask;
|
||||
uint32_t modifiers;
|
||||
struct xkb_compose_table *compose_table;
|
||||
struct xkb_compose_state *compose_state;
|
||||
|
||||
|
@ -25,6 +25,9 @@
|
||||
#if defined(_IRR_COMPILE_WITH_X11_DEVICE_)
|
||||
#include "CIrrDeviceLinux.h"
|
||||
#endif
|
||||
#if defined(_IRR_COMPILE_WITH_WAYLAND)
|
||||
#include "CIrrDeviceWayland.h"
|
||||
#endif
|
||||
#ifdef _IRR_COMPILE_WITH_OSX_DEVICE_
|
||||
#include "MacOSX/OSXClipboard.h"
|
||||
#endif
|
||||
@ -40,6 +43,14 @@ namespace irr
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(_IRR_COMPILE_WITH_WAYLAND)
|
||||
// constructor linux
|
||||
COSOperator::COSOperator(const core::stringc& osVersion, CIrrDeviceWayland* device)
|
||||
: OperatingSystem(osVersion), IrrDeviceWayland(device)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
// constructor
|
||||
COSOperator::COSOperator(const core::stringc& osVersion) : OperatingSystem(osVersion)
|
||||
{
|
||||
@ -121,6 +132,9 @@ void COSOperator::copyToClipboard(const c8* text) const
|
||||
#elif defined(_IRR_COMPILE_WITH_X11_DEVICE_)
|
||||
if ( IrrDeviceLinux )
|
||||
IrrDeviceLinux->copyToClipboard(text);
|
||||
#elif defined(_IRR_COMPILE_WITH_WAYLAND)
|
||||
if ( IrrDeviceWayland )
|
||||
IrrDeviceWayland->copyToClipboard(text);
|
||||
#else
|
||||
|
||||
#endif
|
||||
@ -177,6 +191,11 @@ const c8* COSOperator::getTextFromClipboard() const
|
||||
return IrrDeviceLinux->getTextFromClipboard();
|
||||
return 0;
|
||||
|
||||
#elif defined(_IRR_COMPILE_WITH_WAYLAND)
|
||||
if ( IrrDeviceWayland )
|
||||
return IrrDeviceWayland->getTextFromClipboard();
|
||||
return 0;
|
||||
|
||||
#else
|
||||
|
||||
return 0;
|
||||
|
@ -11,6 +11,7 @@ namespace irr
|
||||
{
|
||||
|
||||
class CIrrDeviceLinux;
|
||||
class CIrrDeviceWayland;
|
||||
|
||||
//! The Operating system operator provides operation system specific methods and informations.
|
||||
class COSOperator : public IOSOperator
|
||||
@ -20,6 +21,9 @@ public:
|
||||
// constructor
|
||||
#if defined(_IRR_COMPILE_WITH_X11_DEVICE_)
|
||||
COSOperator(const core::stringc& osversion, CIrrDeviceLinux* device);
|
||||
#endif
|
||||
#if defined(_IRR_COMPILE_WITH_WAYLAND)
|
||||
COSOperator(const core::stringc& osversion, CIrrDeviceWayland* device);
|
||||
#endif
|
||||
COSOperator(const core::stringc& osversion);
|
||||
|
||||
@ -59,6 +63,10 @@ private:
|
||||
#if defined(_IRR_COMPILE_WITH_X11_DEVICE_)
|
||||
CIrrDeviceLinux * IrrDeviceLinux;
|
||||
#endif
|
||||
#if defined(_IRR_COMPILE_WITH_WAYLAND)
|
||||
CIrrDeviceWayland * IrrDeviceWayland;
|
||||
#endif
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user