Commit adc9e882 authored by DailyShana's avatar DailyShana

fix on linux

compile, input char, clipboard
parent d38e1fdf
......@@ -156,7 +156,7 @@ set (INCLUDE_FILES_GUI
"include/EMessageBoxFlags.h"
"include/ICursorControl.h"
"include/IGUIButton.h"
"include/IGUICheckbox.h"
"include/IGUICheckBox.h"
"include/IGUIComboBox.h"
"include/IGUIContextMenu.h"
"include/IGUIEditBox.h"
......@@ -827,7 +827,7 @@ set (SRC_FILES_GUI
"src/BuiltInFont.h"
"src/CDefaultGUIElementFactory.h"
"src/CGUIButton.h"
"src/CGUICheckbox.h"
"src/CGUICheckBox.h"
"src/CGUIColorSelectDialog.h"
"src/CGUIComboBox.h"
"src/CGUIContextMenu.h"
......@@ -855,7 +855,7 @@ set (SRC_FILES_GUI
"src/CGUIWindow.h"
"src/CDefaultGUIElementFactory.cpp"
"src/CGUIButton.cpp"
"src/CGUICheckbox.cpp"
"src/CGUICheckBox.cpp"
"src/CGUIColorSelectDialog.cpp"
"src/CGUIComboBox.cpp"
"src/CGUIContextMenu.cpp"
......@@ -898,12 +898,14 @@ include_directories ( include src/zlib src/jpeglib src/libpng )
add_definitions ("-D_IRR_STATIC_LIB_")
if (CMAKE_C_COMPILER MATCHES "cc")
add_definitions ("-U__STRICT_ANSI__")
endif ()
if (WIN32)
include_directories ( $ENV{DXSDK_DIR}/include )
if (MSVC)
add_definitions ("-DIRRLICHT_FAST_MATH")
elseif (MINGW)
add_definitions ("-U__STRICT_ANSI__")
endif ()
endif ()
......
......@@ -29,8 +29,7 @@ public:
virtual void copyToClipboard(const wchar_t* text) const = 0;
//! Get text from the clipboard
/** \return Returns 0 if no string is in there. */
virtual const wchar_t* getTextFromClipboard() const = 0;
virtual const core::stringw getTextFromClipboard() const = 0;
//! Get the processor speed in megahertz
/** \param MHz The integer variable to store the speed in.
......
......@@ -326,11 +326,9 @@ bool CGUIEditBox::processKey(const SEvent& event)
const s32 realmend = MarkBegin < MarkEnd ? MarkEnd : MarkBegin;
// add new character
const wchar_t* p = Operator->getTextFromClipboard();
if (p)
const irr::core::stringw widep = Operator->getTextFromClipboard();
if (!widep.empty())
{
irr::core::stringw widep(p);
if (MarkBegin == MarkEnd)
{
// insert text
......
......@@ -1042,9 +1042,13 @@ bool CIrrDeviceLinux::run()
char buf[8]={0};
XLookupString(&event.xkey, buf, sizeof(buf), &mp.X11Key, NULL);
irrevent.EventType = irr::EET_CHAR_INPUT_EVENT;
irrevent.CharInput.Char = irr::core::stringw(buf).c_str();
postEventFromUser(irrevent);
if(event.type == KeyPress
&& !(buf[0] < 32 || buf[0] > 126 && buf[0] < 160))
{
irrevent.EventType = irr::EET_CHAR_INPUT_EVENT;
irrevent.CharInput.Char = irr::core::stringw(buf).c_str()[0];
postEventFromUser(irrevent);
}
irrevent.EventType = irr::EET_KEY_INPUT_EVENT;
irrevent.KeyInput.PressedDown = (event.type == KeyPress);
......@@ -1877,7 +1881,7 @@ const c8* CIrrDeviceLinux::getTextFromClipboard() const
Clipboard = "";
if (ownerWindow != None )
{
XConvertSelection (display, X_ATOM_CLIPBOARD, XA_STRING, XA_PRIMARY, ownerWindow, CurrentTime);
XConvertSelection (display, X_ATOM_CLIPBOARD, X_ATOM_UTF8_STRING, XA_PRIMARY, ownerWindow, CurrentTime);
XFlush (display);
// check for data
......
......@@ -92,14 +92,13 @@ void COSOperator::copyToClipboard(const wchar_t* text) const
//! gets text from the clipboard
//! \return Returns 0 if no string is in there.
const wchar_t* COSOperator::getTextFromClipboard() const
const core::stringw COSOperator::getTextFromClipboard() const
{
#if defined(_IRR_XBOX_PLATFORM_)
return 0;
#elif defined(_IRR_WINDOWS_API_)
if (!OpenClipboard(NULL))
return 0;
return L"";
wchar_t * buffer = 0;
......@@ -110,11 +109,11 @@ const wchar_t* COSOperator::getTextFromClipboard() const
return buffer;
#elif defined(_IRR_COMPILE_WITH_OSX_DEVICE_)
return irr::core::stringw(OSXCopyFromClipboard()).c_str();
return irr::core::stringw(OSXCopyFromClipboard());
#elif defined(_IRR_COMPILE_WITH_X11_DEVICE_)
if ( IrrDeviceLinux )
return irr::core::stringw(IrrDeviceLinux->getTextFromClipboard()).c_str();
return irr::core::stringw(IrrDeviceLinux->getTextFromClipboard());
return 0;
#else
......
......@@ -30,8 +30,7 @@ public:
virtual void copyToClipboard(const wchar_t* text) const;
//! gets text from the clipboard
//! \return Returns 0 if no string is in there.
virtual const wchar_t* getTextFromClipboard() const;
virtual const core::stringw getTextFromClipboard() const;
//! gets the processor speed in megahertz
//! \param Mhz:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment