Merge remote-tracking branch 'origin/master' into new-pi
This commit is contained in:
commit
ae36208e29
@ -38,9 +38,12 @@ addons:
|
|||||||
- zlib1g-dev
|
- zlib1g-dev
|
||||||
|
|
||||||
before_script:
|
before_script:
|
||||||
#- export THREADS=$((`nproc` + 1))
|
|
||||||
# Unfortunately using all threads crashes g++: "g++: internal compiler error: Killed (program cc1plus)"
|
# Unfortunately using all threads crashes g++: "g++: internal compiler error: Killed (program cc1plus)"
|
||||||
- export THREADS=4
|
- 'if [ ${CC} = "gcc" ]; then
|
||||||
|
export THREADS=4;
|
||||||
|
else
|
||||||
|
export THREADS=$((`nproc` + 1));
|
||||||
|
fi'
|
||||||
- echo "THREADS = $THREADS"
|
- echo "THREADS = $THREADS"
|
||||||
- free -mt
|
- free -mt
|
||||||
|
|
||||||
|
@ -62,6 +62,7 @@ if(WIN32)
|
|||||||
set(ENV{LIB} ${PROJECT_SOURCE_DIR}/dependencies/lib)
|
set(ENV{LIB} ${PROJECT_SOURCE_DIR}/dependencies/lib)
|
||||||
set(ENV{OPENALDIR} ${PROJECT_SOURCE_DIR}/dependencies)
|
set(ENV{OPENALDIR} ${PROJECT_SOURCE_DIR}/dependencies)
|
||||||
add_definitions(-D_IRR_STATIC_LIB_)
|
add_definitions(-D_IRR_STATIC_LIB_)
|
||||||
|
add_definitions(-DNO_IRR_COMPILE_WITH_X11_)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(USE_GLES2)
|
if(USE_GLES2)
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
<card contains="Intel" os="osx" disable="GI"/>
|
<card contains="Intel" os="osx" disable="GI"/>
|
||||||
<card contains="Intel" os="linux" version="<11.2" disable="ComputeShader"/>
|
<card contains="Intel" os="linux" version="<11.2" disable="ComputeShader"/>
|
||||||
<card contains="Intel" os="linux" version="<11.2" disable="GeometryShader"/>
|
<card contains="Intel" os="linux" version="<11.2" disable="GeometryShader"/>
|
||||||
<card contains="Intel" os="linux" version="<16.0" disable="FramebufferSRGBCapable"/>
|
<card contains="Intel" os="linux" disable="FramebufferSRGBCapable"/>
|
||||||
<card contains="Intel" os="linux" version="<11.2" disable="TextureCompressionS3TC"/>
|
<card contains="Intel" os="linux" version="<11.2" disable="TextureCompressionS3TC"/>
|
||||||
<card contains="Intel" os="windows" disable="TextureCompressionS3TC"/>
|
<card contains="Intel" os="windows" disable="TextureCompressionS3TC"/>
|
||||||
<card contains="Intel" os="osx" disable="TextureCompressionS3TC"/>
|
<card contains="Intel" os="osx" disable="TextureCompressionS3TC"/>
|
||||||
|
@ -443,6 +443,8 @@ bool CGUIListBox::OnEvent(const SEvent& event)
|
|||||||
case EET_JOYSTICK_INPUT_EVENT:
|
case EET_JOYSTICK_INPUT_EVENT:
|
||||||
case EGUIET_FORCE_32_BIT:
|
case EGUIET_FORCE_32_BIT:
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -74,7 +74,6 @@ namespace
|
|||||||
Atom X_ATOM_CLIPBOARD;
|
Atom X_ATOM_CLIPBOARD;
|
||||||
Atom X_ATOM_TARGETS;
|
Atom X_ATOM_TARGETS;
|
||||||
Atom X_ATOM_UTF8_STRING;
|
Atom X_ATOM_UTF8_STRING;
|
||||||
Atom X_ATOM_TEXT;
|
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -88,7 +87,8 @@ CIrrDeviceLinux::CIrrDeviceLinux(const SIrrlichtCreationParameters& param)
|
|||||||
: CIrrDeviceStub(param),
|
: CIrrDeviceStub(param),
|
||||||
#ifdef _IRR_COMPILE_WITH_X11_
|
#ifdef _IRR_COMPILE_WITH_X11_
|
||||||
display(0), visual(0), screennr(0), window(0), StdHints(0), SoftwareImage(0),
|
display(0), visual(0), screennr(0), window(0), StdHints(0), SoftwareImage(0),
|
||||||
XInputMethod(0), XInputContext(0), numlock_mask(0),
|
XInputMethod(0), XInputContext(0), m_font_set(0), numlock_mask(0),
|
||||||
|
m_ime_enabled(false),
|
||||||
#ifdef _IRR_COMPILE_WITH_OPENGL_
|
#ifdef _IRR_COMPILE_WITH_OPENGL_
|
||||||
glxWin(0),
|
glxWin(0),
|
||||||
Context(0),
|
Context(0),
|
||||||
@ -141,8 +141,12 @@ CIrrDeviceLinux::CIrrDeviceLinux(const SIrrlichtCreationParameters& param)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
#ifdef _IRR_COMPILE_WITH_X11_
|
#ifdef _IRR_COMPILE_WITH_X11_
|
||||||
|
m_ime_position.x = 0;
|
||||||
|
m_ime_position.y = 0;
|
||||||
createInputContext();
|
createInputContext();
|
||||||
numlock_mask = getNumlockMask(display);
|
numlock_mask = getNumlockMask(display);
|
||||||
|
// Get maximum 16 characters from input method
|
||||||
|
m_ime_char_holder.reallocate(16);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
createGUIAndScene();
|
createGUIAndScene();
|
||||||
@ -1186,6 +1190,9 @@ void CIrrDeviceLinux::createDriver()
|
|||||||
#ifdef _IRR_COMPILE_WITH_X11_
|
#ifdef _IRR_COMPILE_WITH_X11_
|
||||||
bool CIrrDeviceLinux::createInputContext()
|
bool CIrrDeviceLinux::createInputContext()
|
||||||
{
|
{
|
||||||
|
if (!display)
|
||||||
|
return false;
|
||||||
|
|
||||||
// One one side it would be nicer to let users do that - on the other hand
|
// One one side it would be nicer to let users do that - on the other hand
|
||||||
// not setting the environment locale will not work when using i18n X11 functions.
|
// not setting the environment locale will not work when using i18n X11 functions.
|
||||||
// So users would have to call it always or their input is broken badly.
|
// So users would have to call it always or their input is broken badly.
|
||||||
@ -1200,31 +1207,56 @@ bool CIrrDeviceLinux::createInputContext()
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
XInputMethod = XOpenIM(display, NULL, NULL, NULL);
|
char* p = XSetLocaleModifiers("");
|
||||||
if ( !XInputMethod )
|
if (p == NULL)
|
||||||
{
|
{
|
||||||
|
os::Printer::log("Could not set locale modifiers. Falling back to non-i18n input.", ELL_WARNING);
|
||||||
setlocale(LC_CTYPE, oldLocale.c_str());
|
setlocale(LC_CTYPE, oldLocale.c_str());
|
||||||
os::Printer::log("XOpenIM failed to create an input method. Falling back to non-i18n input.", ELL_WARNING);
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
XIMStyles *im_supported_styles;
|
XInputMethod = XOpenIM(display, NULL, NULL, NULL);
|
||||||
XGetIMValues(XInputMethod, XNQueryInputStyle, &im_supported_styles, (char*)NULL);
|
if ( !XInputMethod )
|
||||||
XIMStyle bestStyle = 0;
|
|
||||||
// TODO: If we want to support languages like chinese or japanese as well we probably have to work with callbacks here.
|
|
||||||
XIMStyle supportedStyle = XIMPreeditNone | XIMStatusNone;
|
|
||||||
for (int i=0; i < im_supported_styles->count_styles; ++i)
|
|
||||||
{
|
{
|
||||||
XIMStyle style = im_supported_styles->supported_styles[i];
|
os::Printer::log("XOpenIM failed to create an input method. Falling back to non-i18n input.", ELL_WARNING);
|
||||||
if ((style & supportedStyle) == style) /* if we can handle it */
|
setlocale(LC_CTYPE, oldLocale.c_str());
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
XIMStyles *im_supported_styles = NULL;
|
||||||
|
XGetIMValues(XInputMethod, XNQueryInputStyle, &im_supported_styles, (void*)NULL);
|
||||||
|
if (!im_supported_styles)
|
||||||
{
|
{
|
||||||
bestStyle = style;
|
os::Printer::log("XGetIMValues failed to get supported styles. Falling back to non-i18n input.", ELL_WARNING);
|
||||||
|
setlocale(LC_CTYPE, oldLocale.c_str());
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Only OverTheSpot and Root pre-edit type are implemented for now
|
||||||
|
core::array<unsigned long> supported_style;
|
||||||
|
//supported_style.push_back(XIMPreeditPosition | XIMStatusNothing);
|
||||||
|
supported_style.push_back(XIMPreeditNothing | XIMStatusNothing);
|
||||||
|
XIMStyle best_style = 0;
|
||||||
|
bool found = false;
|
||||||
|
int supported_style_start = -1;
|
||||||
|
|
||||||
|
while (!found && supported_style_start < (int)supported_style.size())
|
||||||
|
{
|
||||||
|
supported_style_start++;
|
||||||
|
for (int i = 0; i < im_supported_styles->count_styles; i++)
|
||||||
|
{
|
||||||
|
XIMStyle cur_style = im_supported_styles->supported_styles[i];
|
||||||
|
if (cur_style == supported_style[supported_style_start])
|
||||||
|
{
|
||||||
|
best_style = cur_style;
|
||||||
|
found = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
XFree(im_supported_styles);
|
XFree(im_supported_styles);
|
||||||
|
|
||||||
if ( !bestStyle )
|
if (!found)
|
||||||
{
|
{
|
||||||
XDestroyIC(XInputContext);
|
XDestroyIC(XInputContext);
|
||||||
XInputContext = 0;
|
XInputContext = 0;
|
||||||
@ -1234,18 +1266,53 @@ bool CIrrDeviceLinux::createInputContext()
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Only use root preedit type for now
|
||||||
|
/*if (best_style != (XIMPreeditNothing | XIMStatusNothing))
|
||||||
|
{
|
||||||
|
char **list = NULL;
|
||||||
|
int count = 0;
|
||||||
|
m_font_set = XCreateFontSet(display, "fixed", &list, &count, NULL);
|
||||||
|
if (!m_font_set)
|
||||||
|
{
|
||||||
|
os::Printer::log("XInputContext failed to create font set. Falling back to non-i18n input.", ELL_WARNING);
|
||||||
|
setlocale(LC_CTYPE, oldLocale.c_str());
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (count > 0)
|
||||||
|
{
|
||||||
|
XFreeStringList(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
XPoint spot = {0, 0};
|
||||||
|
XVaNestedList p_list = XVaCreateNestedList(0, XNSpotLocation, &spot,
|
||||||
|
XNFontSet, m_font_set, (void*)NULL);
|
||||||
XInputContext = XCreateIC(XInputMethod,
|
XInputContext = XCreateIC(XInputMethod,
|
||||||
XNInputStyle, bestStyle,
|
XNInputStyle, best_style,
|
||||||
XNClientWindow, window,
|
XNClientWindow, window,
|
||||||
(char*)NULL);
|
XNFocusWindow, window,
|
||||||
|
XNPreeditAttributes, p_list,
|
||||||
|
(void*)NULL);
|
||||||
|
XFree(p_list);
|
||||||
|
}
|
||||||
|
else*/
|
||||||
|
{
|
||||||
|
XInputContext = XCreateIC(XInputMethod,
|
||||||
|
XNInputStyle, best_style,
|
||||||
|
XNClientWindow, window,
|
||||||
|
XNFocusWindow, window,
|
||||||
|
(void*)NULL);
|
||||||
|
}
|
||||||
|
|
||||||
if (!XInputContext )
|
if (!XInputContext )
|
||||||
{
|
{
|
||||||
os::Printer::log("XInputContext failed to create an input context. Falling back to non-i18n input.", ELL_WARNING);
|
os::Printer::log("XInputContext failed to create an input context. Falling back to non-i18n input.", ELL_WARNING);
|
||||||
setlocale(LC_CTYPE, oldLocale.c_str());
|
setlocale(LC_CTYPE, oldLocale.c_str());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
XSetICFocus(XInputContext);
|
XSetICFocus(XInputContext);
|
||||||
setlocale(LC_CTYPE, oldLocale.c_str());
|
setlocale(LC_CTYPE, oldLocale.c_str());
|
||||||
|
XFree(p);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1262,6 +1329,34 @@ void CIrrDeviceLinux::destroyInputContext()
|
|||||||
XCloseIM(XInputMethod);
|
XCloseIM(XInputMethod);
|
||||||
XInputMethod = 0;
|
XInputMethod = 0;
|
||||||
}
|
}
|
||||||
|
if (display && m_font_set)
|
||||||
|
{
|
||||||
|
XFreeFontSet(display, m_font_set);
|
||||||
|
m_font_set = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CIrrDeviceLinux::setIMELocation(const irr::core::position2di& pos)
|
||||||
|
{
|
||||||
|
if (!XInputContext || !m_ime_enabled) return;
|
||||||
|
m_ime_position.x = pos.X;
|
||||||
|
m_ime_position.y = pos.Y;
|
||||||
|
updateIMELocation();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CIrrDeviceLinux::updateIMELocation()
|
||||||
|
{
|
||||||
|
if (!XInputContext || !m_ime_enabled) return;
|
||||||
|
XVaNestedList list;
|
||||||
|
list = XVaCreateNestedList(0, XNSpotLocation, &m_ime_position, (void*)NULL);
|
||||||
|
XSetICValues(XInputContext, XNPreeditAttributes, list, (void*)NULL);
|
||||||
|
XFree(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CIrrDeviceLinux::setIMEEnable(bool enable)
|
||||||
|
{
|
||||||
|
if (!XInputContext) return;
|
||||||
|
m_ime_enabled = enable;
|
||||||
}
|
}
|
||||||
|
|
||||||
int CIrrDeviceLinux::getNumlockMask(Display* display)
|
int CIrrDeviceLinux::getNumlockMask(Display* display)
|
||||||
@ -1364,12 +1459,30 @@ bool CIrrDeviceLinux::run()
|
|||||||
|
|
||||||
while (XPending(display) > 0 && !Close)
|
while (XPending(display) > 0 && !Close)
|
||||||
{
|
{
|
||||||
|
if (!m_ime_char_holder.empty())
|
||||||
|
{
|
||||||
|
irrevent.KeyInput.Char = m_ime_char_holder[0];
|
||||||
|
irrevent.EventType = irr::EET_KEY_INPUT_EVENT;
|
||||||
|
irrevent.KeyInput.PressedDown = true;
|
||||||
|
irrevent.KeyInput.Control = false;
|
||||||
|
irrevent.KeyInput.Shift = false;
|
||||||
|
irrevent.KeyInput.Key = (irr::EKEY_CODE)0;
|
||||||
|
postEventFromUser(irrevent);
|
||||||
|
m_ime_char_holder.erase(0);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
XEvent event;
|
XEvent event;
|
||||||
XNextEvent(display, &event);
|
XNextEvent(display, &event);
|
||||||
|
if (m_ime_enabled && XFilterEvent(&event, None))
|
||||||
|
{
|
||||||
|
updateIMELocation();
|
||||||
|
continue;
|
||||||
|
}
|
||||||
switch (event.type)
|
switch (event.type)
|
||||||
{
|
{
|
||||||
case ConfigureNotify:
|
case ConfigureNotify:
|
||||||
|
updateIMELocation();
|
||||||
// check for changed window size
|
// check for changed window size
|
||||||
if ((event.xconfigure.width != (int) Width) ||
|
if ((event.xconfigure.width != (int) Width) ||
|
||||||
(event.xconfigure.height != (int) Height))
|
(event.xconfigure.height != (int) Height))
|
||||||
@ -1542,9 +1655,8 @@ bool CIrrDeviceLinux::run()
|
|||||||
SKeyMap mp;
|
SKeyMap mp;
|
||||||
if ( XInputContext )
|
if ( XInputContext )
|
||||||
{
|
{
|
||||||
wchar_t buf[8]={0};
|
|
||||||
Status status;
|
Status status;
|
||||||
int strLen = XwcLookupString(XInputContext, &event.xkey, buf, sizeof(buf), &mp.X11Key, &status);
|
int strLen = XwcLookupString(XInputContext, &event.xkey, m_ime_char_holder.pointer(), 16 * sizeof(wchar_t), &mp.X11Key, &status);
|
||||||
if ( status == XBufferOverflow )
|
if ( status == XBufferOverflow )
|
||||||
{
|
{
|
||||||
os::Printer::log("XwcLookupString needs a larger buffer", ELL_INFORMATION);
|
os::Printer::log("XwcLookupString needs a larger buffer", ELL_INFORMATION);
|
||||||
@ -1552,8 +1664,14 @@ bool CIrrDeviceLinux::run()
|
|||||||
if ( strLen > 0 && (status == XLookupChars || status == XLookupBoth) )
|
if ( strLen > 0 && (status == XLookupChars || status == XLookupBoth) )
|
||||||
{
|
{
|
||||||
if ( strLen > 1 )
|
if ( strLen > 1 )
|
||||||
os::Printer::log("Additional returned characters dropped", ELL_INFORMATION);
|
{
|
||||||
irrevent.KeyInput.Char = buf[0];
|
m_ime_char_holder.set_used(strLen > 16 ? 16 : strLen);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
irrevent.KeyInput.Char = m_ime_char_holder[0];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -1566,7 +1684,7 @@ bool CIrrDeviceLinux::run()
|
|||||||
{
|
{
|
||||||
char buf[8];
|
char buf[8];
|
||||||
wchar_t wbuf[2];
|
wchar_t wbuf[2];
|
||||||
} tmp = {0};
|
} tmp = {{0}};
|
||||||
XLookupString(&event.xkey, tmp.buf, sizeof(tmp.buf), &mp.X11Key, NULL);
|
XLookupString(&event.xkey, tmp.buf, sizeof(tmp.buf), &mp.X11Key, NULL);
|
||||||
irrevent.KeyInput.Char = tmp.wbuf[0];
|
irrevent.KeyInput.Char = tmp.wbuf[0];
|
||||||
}
|
}
|
||||||
@ -1605,7 +1723,7 @@ bool CIrrDeviceLinux::run()
|
|||||||
{
|
{
|
||||||
XEvent respond;
|
XEvent respond;
|
||||||
XSelectionRequestEvent *req = &(event.xselectionrequest);
|
XSelectionRequestEvent *req = &(event.xselectionrequest);
|
||||||
if ( req->target == XA_STRING)
|
if ( req->target == X_ATOM_UTF8_STRING)
|
||||||
{
|
{
|
||||||
XChangeProperty (display,
|
XChangeProperty (display,
|
||||||
req->requestor,
|
req->requestor,
|
||||||
@ -1618,14 +1736,13 @@ bool CIrrDeviceLinux::run()
|
|||||||
}
|
}
|
||||||
else if ( req->target == X_ATOM_TARGETS )
|
else if ( req->target == X_ATOM_TARGETS )
|
||||||
{
|
{
|
||||||
long data[2];
|
long data[1];
|
||||||
|
|
||||||
data[0] = X_ATOM_TEXT;
|
data[0] = X_ATOM_UTF8_STRING;
|
||||||
data[1] = XA_STRING;
|
|
||||||
|
|
||||||
XChangeProperty (display, req->requestor,
|
XChangeProperty (display, req->requestor,
|
||||||
req->property, req->target,
|
req->property, XA_ATOM,
|
||||||
8, PropModeReplace,
|
32, PropModeReplace,
|
||||||
(unsigned char *) &data,
|
(unsigned char *) &data,
|
||||||
sizeof (data));
|
sizeof (data));
|
||||||
respond.xselection.property = req->property;
|
respond.xselection.property = req->property;
|
||||||
@ -2480,7 +2597,7 @@ const c8* CIrrDeviceLinux::getTextFromClipboard() const
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
Atom selection = XInternAtom(display, "IRR_SELECTION", False);
|
Atom selection = XInternAtom(display, "IRR_SELECTION", False);
|
||||||
XConvertSelection(display, X_ATOM_CLIPBOARD, XA_STRING, selection, window, CurrentTime);
|
XConvertSelection(display, X_ATOM_CLIPBOARD, X_ATOM_UTF8_STRING, selection, window, CurrentTime);
|
||||||
|
|
||||||
const int SELECTION_RETRIES = 500;
|
const int SELECTION_RETRIES = 500;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
@ -2572,7 +2689,6 @@ void CIrrDeviceLinux::initXAtoms()
|
|||||||
X_ATOM_CLIPBOARD = XInternAtom(display, "CLIPBOARD", False);
|
X_ATOM_CLIPBOARD = XInternAtom(display, "CLIPBOARD", False);
|
||||||
X_ATOM_TARGETS = XInternAtom(display, "TARGETS", False);
|
X_ATOM_TARGETS = XInternAtom(display, "TARGETS", False);
|
||||||
X_ATOM_UTF8_STRING = XInternAtom (display, "UTF8_STRING", False);
|
X_ATOM_UTF8_STRING = XInternAtom (display, "UTF8_STRING", False);
|
||||||
X_ATOM_TEXT = XInternAtom (display, "TEXT", False);
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -129,6 +129,8 @@ namespace irr
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _IRR_COMPILE_WITH_X11_
|
#ifdef _IRR_COMPILE_WITH_X11_
|
||||||
|
void setIMELocation(const irr::core::position2di& pos);
|
||||||
|
void setIMEEnable(bool enable);
|
||||||
// convert an Irrlicht texture to a X11 cursor
|
// convert an Irrlicht texture to a X11 cursor
|
||||||
Cursor TextureToCursor(irr::video::ITexture * tex, const core::rect<s32>& sourceRect, const core::position2d<s32> &hotspot);
|
Cursor TextureToCursor(irr::video::ITexture * tex, const core::rect<s32>& sourceRect, const core::position2d<s32> &hotspot);
|
||||||
Cursor TextureToMonochromeCursor(irr::video::ITexture * tex, const core::rect<s32>& sourceRect, const core::position2d<s32> &hotspot);
|
Cursor TextureToMonochromeCursor(irr::video::ITexture * tex, const core::rect<s32>& sourceRect, const core::position2d<s32> &hotspot);
|
||||||
@ -158,6 +160,7 @@ namespace irr
|
|||||||
void destroyInputContext();
|
void destroyInputContext();
|
||||||
int getNumlockMask(Display* display);
|
int getNumlockMask(Display* display);
|
||||||
EKEY_CODE getKeyCode(XEvent &event);
|
EKEY_CODE getKeyCode(XEvent &event);
|
||||||
|
void updateIMELocation();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//! Implementation of the linux cursor control
|
//! Implementation of the linux cursor control
|
||||||
@ -399,8 +402,12 @@ namespace irr
|
|||||||
XImage* SoftwareImage;
|
XImage* SoftwareImage;
|
||||||
XIM XInputMethod;
|
XIM XInputMethod;
|
||||||
XIC XInputContext;
|
XIC XInputContext;
|
||||||
|
XFontSet m_font_set;
|
||||||
|
core::array<wchar_t> m_ime_char_holder;
|
||||||
|
XPoint m_ime_position;
|
||||||
mutable core::stringc Clipboard;
|
mutable core::stringc Clipboard;
|
||||||
int numlock_mask;
|
int numlock_mask;
|
||||||
|
bool m_ime_enabled;
|
||||||
#ifdef _IRR_LINUX_X11_VIDMODE_
|
#ifdef _IRR_LINUX_X11_VIDMODE_
|
||||||
XF86VidModeModeInfo oldVideoMode;
|
XF86VidModeModeInfo oldVideoMode;
|
||||||
#endif
|
#endif
|
||||||
|
@ -75,9 +75,6 @@ void NewsManager::init(bool force_refresh)
|
|||||||
pthread_attr_t attr;
|
pthread_attr_t attr;
|
||||||
pthread_attr_init(&attr);
|
pthread_attr_init(&attr);
|
||||||
pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
|
pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
|
||||||
// Should be the default, but just in case:
|
|
||||||
pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL);
|
|
||||||
//pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL);
|
|
||||||
pthread_t thread_id;
|
pthread_t thread_id;
|
||||||
int error = pthread_create(&thread_id, &attr,
|
int error = pthread_create(&thread_id, &attr,
|
||||||
&NewsManager::downloadNews, this);
|
&NewsManager::downloadNews, this);
|
||||||
|
@ -91,9 +91,6 @@ SFXManager::SFXManager()
|
|||||||
pthread_attr_init(&attr);
|
pthread_attr_init(&attr);
|
||||||
pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE);
|
pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE);
|
||||||
|
|
||||||
// Should be the default, but just in case:
|
|
||||||
pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL);
|
|
||||||
|
|
||||||
m_thread_id.setAtomic(new pthread_t());
|
m_thread_id.setAtomic(new pthread_t());
|
||||||
// The thread is created even if there atm sfx are disabled
|
// The thread is created even if there atm sfx are disabled
|
||||||
// (since the user might enable it later).
|
// (since the user might enable it later).
|
||||||
@ -299,8 +296,6 @@ void* SFXManager::mainLoop(void *obj)
|
|||||||
VS::setThreadName("SFXManager");
|
VS::setThreadName("SFXManager");
|
||||||
SFXManager *me = (SFXManager*)obj;
|
SFXManager *me = (SFXManager*)obj;
|
||||||
|
|
||||||
pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL);
|
|
||||||
|
|
||||||
me->m_sfx_commands.lock();
|
me->m_sfx_commands.lock();
|
||||||
|
|
||||||
// Wait till we have an empty sfx in the queue
|
// Wait till we have an empty sfx in the queue
|
||||||
|
@ -42,6 +42,7 @@ CameraNormal::CameraNormal(Camera::CameraType type, int camera_index,
|
|||||||
{
|
{
|
||||||
m_distance = kart ? kart->getKartProperties()->getCameraDistance() : 1000.0f;
|
m_distance = kart ? kart->getKartProperties()->getCameraDistance() : 1000.0f;
|
||||||
m_ambient_light = World::getWorld()->getTrack()->getDefaultAmbientColor();
|
m_ambient_light = World::getWorld()->getTrack()->getDefaultAmbientColor();
|
||||||
|
m_smooth_dt = 0.0f;
|
||||||
|
|
||||||
// TODO: Put these values into a config file
|
// TODO: Put these values into a config file
|
||||||
// Global or per split screen zone?
|
// Global or per split screen zone?
|
||||||
@ -111,7 +112,8 @@ void CameraNormal::smoothMoveCamera(float dt)
|
|||||||
f = current_speed >0 ? current_speed/3 + 1.0f
|
f = current_speed >0 ? current_speed/3 + 1.0f
|
||||||
: -1.5f * current_speed + 2.0f;
|
: -1.5f * current_speed + 2.0f;
|
||||||
}
|
}
|
||||||
current_position += (wanted_position - current_position) * (dt *f);
|
m_smooth_dt = 0.3f * dt + 0.7f * m_smooth_dt;
|
||||||
|
current_position += (wanted_position - current_position) * (m_smooth_dt*f);
|
||||||
|
|
||||||
// Avoid camera crash: if the speed is negative, the current_position
|
// Avoid camera crash: if the speed is negative, the current_position
|
||||||
// can oscillate between plus and minus, getting bigger and bigger. If
|
// can oscillate between plus and minus, getting bigger and bigger. If
|
||||||
|
@ -49,6 +49,8 @@ private:
|
|||||||
/** Factor of the effects of steering in camera aim. */
|
/** Factor of the effects of steering in camera aim. */
|
||||||
float m_rotation_range;
|
float m_rotation_range;
|
||||||
|
|
||||||
|
/** Used to smoothly move the camera. */
|
||||||
|
float m_smooth_dt;
|
||||||
void smoothMoveCamera(float dt);
|
void smoothMoveCamera(float dt);
|
||||||
void handleEndCamera(float dt);
|
void handleEndCamera(float dt);
|
||||||
void getCameraSettings(float *above_kart, float *cam_angle,
|
void getCameraSettings(float *above_kart, float *cam_angle,
|
||||||
|
@ -62,7 +62,7 @@ struct CustomUnrollArgs<>
|
|||||||
static void drawMesh(const STK::Tuple<TupleTypes...> &t,
|
static void drawMesh(const STK::Tuple<TupleTypes...> &t,
|
||||||
Args... args)
|
Args... args)
|
||||||
{
|
{
|
||||||
irr_driver->IncreaseObjectCount(); //TODO: move somewhere else
|
irr_driver->increaseObjectCount(); //TODO: move somewhere else
|
||||||
GLMesh *mesh = STK::tuple_get<0>(t);
|
GLMesh *mesh = STK::tuple_get<0>(t);
|
||||||
|
|
||||||
//shadow_custom_unroll_args, rsm_custom_unroll_args and custom_unroll_args
|
//shadow_custom_unroll_args, rsm_custom_unroll_args and custom_unroll_args
|
||||||
|
@ -166,41 +166,48 @@ void IrrDriver::reset()
|
|||||||
#endif
|
#endif
|
||||||
} // reset
|
} // reset
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
void IrrDriver::setPhase(STKRenderingPass p)
|
void IrrDriver::setPhase(STKRenderingPass p)
|
||||||
{
|
{
|
||||||
m_phase = p;
|
m_phase = p;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
STKRenderingPass IrrDriver::getPhase() const
|
STKRenderingPass IrrDriver::getPhase() const
|
||||||
{
|
{
|
||||||
return m_phase;
|
return m_phase;
|
||||||
}
|
}
|
||||||
|
|
||||||
void IrrDriver::IncreaseObjectCount()
|
#// ----------------------------------------------------------------------------
|
||||||
|
void IrrDriver::increaseObjectCount()
|
||||||
{
|
{
|
||||||
m_renderer->incObjectCount(m_phase);
|
m_renderer->incObjectCount(m_phase);
|
||||||
}
|
} // increaseObjectCount
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
core::array<video::IRenderTarget> &IrrDriver::getMainSetup()
|
core::array<video::IRenderTarget> &IrrDriver::getMainSetup()
|
||||||
{
|
{
|
||||||
return m_mrt;
|
return m_mrt;
|
||||||
}
|
} // getMainSetup
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
#ifndef SERVER_ONLY
|
#ifndef SERVER_ONLY
|
||||||
|
|
||||||
GPUTimer &IrrDriver::getGPUTimer(unsigned i)
|
GPUTimer &IrrDriver::getGPUTimer(unsigned i)
|
||||||
{
|
{
|
||||||
return m_perf_query[i];
|
return m_perf_query[i];
|
||||||
}
|
} // getGPUTimer
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
#ifndef SERVER_ONLY
|
#ifndef SERVER_ONLY
|
||||||
std::unique_ptr<RenderTarget> IrrDriver::createRenderTarget(const irr::core::dimension2du &dimension,
|
std::unique_ptr<RenderTarget> IrrDriver::createRenderTarget(const irr::core::dimension2du &dimension,
|
||||||
const std::string &name)
|
const std::string &name)
|
||||||
{
|
{
|
||||||
return m_renderer->createRenderTarget(dimension, name);
|
return m_renderer->createRenderTarget(dimension, name);
|
||||||
}
|
} // createRenderTarget
|
||||||
#endif
|
#endif // ~SERVER_ONLY
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
@ -203,7 +203,7 @@ public:
|
|||||||
|
|
||||||
void setPhase(STKRenderingPass);
|
void setPhase(STKRenderingPass);
|
||||||
STKRenderingPass getPhase() const;
|
STKRenderingPass getPhase() const;
|
||||||
void IncreaseObjectCount();
|
void increaseObjectCount();
|
||||||
core::array<video::IRenderTarget> &getMainSetup();
|
core::array<video::IRenderTarget> &getMainSetup();
|
||||||
void updateConfigIfRelevant();
|
void updateConfigIfRelevant();
|
||||||
void setAllMaterialFlags(scene::IMesh *mesh) const;
|
void setAllMaterialFlags(scene::IMesh *mesh) const;
|
||||||
|
@ -347,7 +347,7 @@ void STKMeshSceneNode::render()
|
|||||||
// Only untextured
|
// Only untextured
|
||||||
for (unsigned i = 0; i < GLmeshes.size(); i++)
|
for (unsigned i = 0; i < GLmeshes.size(); i++)
|
||||||
{
|
{
|
||||||
irr_driver->IncreaseObjectCount();
|
irr_driver->increaseObjectCount();
|
||||||
GLMesh &mesh = GLmeshes[i];
|
GLMesh &mesh = GLmeshes[i];
|
||||||
GLenum ptype = mesh.PrimitiveType;
|
GLenum ptype = mesh.PrimitiveType;
|
||||||
GLenum itype = mesh.IndexType;
|
GLenum itype = mesh.IndexType;
|
||||||
@ -393,7 +393,7 @@ void STKMeshSceneNode::render()
|
|||||||
// Only untextured
|
// Only untextured
|
||||||
for (unsigned i = 0; i < GLmeshes.size(); i++)
|
for (unsigned i = 0; i < GLmeshes.size(); i++)
|
||||||
{
|
{
|
||||||
irr_driver->IncreaseObjectCount();
|
irr_driver->increaseObjectCount();
|
||||||
GLMesh &mesh = GLmeshes[i];
|
GLMesh &mesh = GLmeshes[i];
|
||||||
GLenum ptype = mesh.PrimitiveType;
|
GLenum ptype = mesh.PrimitiveType;
|
||||||
GLenum itype = mesh.IndexType;
|
GLenum itype = mesh.IndexType;
|
||||||
@ -496,7 +496,7 @@ void STKMeshSceneNode::render()
|
|||||||
for (unsigned i = 0; i < GLmeshes.size(); i++)
|
for (unsigned i = 0; i < GLmeshes.size(); i++)
|
||||||
{
|
{
|
||||||
GLMesh &mesh = GLmeshes[i];
|
GLMesh &mesh = GLmeshes[i];
|
||||||
irr_driver->IncreaseObjectCount();
|
irr_driver->increaseObjectCount();
|
||||||
GLenum ptype = mesh.PrimitiveType;
|
GLenum ptype = mesh.PrimitiveType;
|
||||||
GLenum itype = mesh.IndexType;
|
GLenum itype = mesh.IndexType;
|
||||||
size_t count = mesh.IndexCount;
|
size_t count = mesh.IndexCount;
|
||||||
@ -549,7 +549,7 @@ void STKMeshSceneNode::render()
|
|||||||
Shaders::TransparentShader::getInstance()->use();
|
Shaders::TransparentShader::getInstance()->use();
|
||||||
for (unsigned i = 0; i < GLmeshes.size(); i++)
|
for (unsigned i = 0; i < GLmeshes.size(); i++)
|
||||||
{
|
{
|
||||||
irr_driver->IncreaseObjectCount();
|
irr_driver->increaseObjectCount();
|
||||||
GLMesh &mesh = GLmeshes[i];
|
GLMesh &mesh = GLmeshes[i];
|
||||||
GLenum ptype = mesh.PrimitiveType;
|
GLenum ptype = mesh.PrimitiveType;
|
||||||
GLenum itype = mesh.IndexType;
|
GLenum itype = mesh.IndexType;
|
||||||
|
@ -13,10 +13,13 @@
|
|||||||
#include "Keycodes.h"
|
#include "Keycodes.h"
|
||||||
|
|
||||||
#include "graphics/2dutils.hpp"
|
#include "graphics/2dutils.hpp"
|
||||||
|
#include "graphics/irr_driver.hpp"
|
||||||
#include "utils/string_utils.hpp"
|
#include "utils/string_utils.hpp"
|
||||||
#include "utils/translation.hpp"
|
#include "utils/translation.hpp"
|
||||||
#include "utils/time.hpp"
|
#include "utils/time.hpp"
|
||||||
|
|
||||||
|
#include "../../../lib/irrlicht/source/Irrlicht/CIrrDeviceLinux.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
todo:
|
todo:
|
||||||
optional scrollbars
|
optional scrollbars
|
||||||
@ -101,6 +104,10 @@ CGUIEditBox::~CGUIEditBox()
|
|||||||
|
|
||||||
if (Operator)
|
if (Operator)
|
||||||
Operator->drop();
|
Operator->drop();
|
||||||
|
#ifdef _IRR_COMPILE_WITH_X11_
|
||||||
|
CIrrDeviceLinux* dl = dynamic_cast<CIrrDeviceLinux*>(irr_driver->getDevice());
|
||||||
|
dl->setIMEEnable(false);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -241,7 +248,19 @@ bool CGUIEditBox::OnEvent(const SEvent& event)
|
|||||||
MouseMarking = false;
|
MouseMarking = false;
|
||||||
setTextMarkers(0,0);
|
setTextMarkers(0,0);
|
||||||
}
|
}
|
||||||
|
#ifdef _IRR_COMPILE_WITH_X11_
|
||||||
|
CIrrDeviceLinux* dl = dynamic_cast<CIrrDeviceLinux*>(irr_driver->getDevice());
|
||||||
|
dl->setIMEEnable(false);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
#ifdef _IRR_COMPILE_WITH_X11_
|
||||||
|
else if (event.GUIEvent.EventType == EGET_ELEMENT_FOCUSED)
|
||||||
|
{
|
||||||
|
CIrrDeviceLinux* dl = dynamic_cast<CIrrDeviceLinux*>(irr_driver->getDevice());
|
||||||
|
dl->setIMEEnable(true);
|
||||||
|
dl->setIMELocation(calculateICPos());
|
||||||
|
}
|
||||||
|
#endif
|
||||||
break;
|
break;
|
||||||
#if defined(_IRR_COMPILE_WITH_WINDOWS_DEVICE_)
|
#if defined(_IRR_COMPILE_WITH_WINDOWS_DEVICE_)
|
||||||
case EET_IMPUT_METHOD_EVENT:
|
case EET_IMPUT_METHOD_EVENT:
|
||||||
@ -851,7 +870,9 @@ bool CGUIEditBox::processIMEEvent(const SEvent& event)
|
|||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(_IRR_COMPILE_WITH_WINDOWS_DEVICE_) || defined(_IRR_COMPILE_WITH_X11_)
|
||||||
//! calculate the position of input composition window
|
//! calculate the position of input composition window
|
||||||
core::position2di CGUIEditBox::calculateICPos()
|
core::position2di CGUIEditBox::calculateICPos()
|
||||||
{
|
{
|
||||||
@ -1590,6 +1611,13 @@ void CGUIEditBox::calculateScrollPos()
|
|||||||
VScrollPos = 0;
|
VScrollPos = 0;
|
||||||
|
|
||||||
// todo: adjust scrollbar
|
// todo: adjust scrollbar
|
||||||
|
#if defined(_IRR_COMPILE_WITH_X11_)
|
||||||
|
CIrrDeviceLinux* dl = dynamic_cast<CIrrDeviceLinux*>(irr_driver->getDevice());
|
||||||
|
if (dl)
|
||||||
|
{
|
||||||
|
dl->setIMELocation(calculateICPos());
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
//! set text markers
|
//! set text markers
|
||||||
|
@ -139,6 +139,8 @@ using namespace gui;
|
|||||||
bool processMouse(const SEvent& event);
|
bool processMouse(const SEvent& event);
|
||||||
#if defined(_IRR_COMPILE_WITH_WINDOWS_DEVICE_)
|
#if defined(_IRR_COMPILE_WITH_WINDOWS_DEVICE_)
|
||||||
bool processIMEEvent(const SEvent& event);
|
bool processIMEEvent(const SEvent& event);
|
||||||
|
#endif
|
||||||
|
#if defined(_IRR_COMPILE_WITH_WINDOWS_DEVICE_) || defined(_IRR_COMPILE_WITH_X11_)
|
||||||
//! calculates the input composition position
|
//! calculates the input composition position
|
||||||
core::position2di calculateICPos();
|
core::position2di calculateICPos();
|
||||||
#endif
|
#endif
|
||||||
|
@ -43,8 +43,10 @@ NetworkConsole::NetworkConsole()
|
|||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
NetworkConsole::~NetworkConsole()
|
NetworkConsole::~NetworkConsole()
|
||||||
{
|
{
|
||||||
|
#ifndef ANDROID
|
||||||
if (m_thread_keyboard)
|
if (m_thread_keyboard)
|
||||||
pthread_cancel(*m_thread_keyboard);//, SIGKILL);
|
pthread_cancel(*m_thread_keyboard);//, SIGKILL);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
@ -104,10 +104,6 @@ namespace Online
|
|||||||
pthread_attr_init(&attr);
|
pthread_attr_init(&attr);
|
||||||
pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE);
|
pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE);
|
||||||
|
|
||||||
// Should be the default, but just in case:
|
|
||||||
pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL);
|
|
||||||
//pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL);
|
|
||||||
|
|
||||||
m_thread_id.setAtomic(new pthread_t());
|
m_thread_id.setAtomic(new pthread_t());
|
||||||
int error = pthread_create(m_thread_id.getData(), &attr,
|
int error = pthread_create(m_thread_id.getData(), &attr,
|
||||||
&RequestManager::mainLoop, this);
|
&RequestManager::mainLoop, this);
|
||||||
@ -189,8 +185,6 @@ namespace Online
|
|||||||
VS::setThreadName("RequestManager");
|
VS::setThreadName("RequestManager");
|
||||||
RequestManager *me = (RequestManager*) obj;
|
RequestManager *me = (RequestManager*) obj;
|
||||||
|
|
||||||
pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL);
|
|
||||||
|
|
||||||
me->m_current_request = NULL;
|
me->m_current_request = NULL;
|
||||||
me->m_request_queue.lock();
|
me->m_request_queue.lock();
|
||||||
while (me->m_request_queue.getData().empty() ||
|
while (me->m_request_queue.getData().empty() ||
|
||||||
|
@ -31,7 +31,9 @@ std::string CommandLine::m_exec_name="";
|
|||||||
*/
|
*/
|
||||||
void CommandLine::init(unsigned int argc, char *argv[])
|
void CommandLine::init(unsigned int argc, char *argv[])
|
||||||
{
|
{
|
||||||
|
if (argc > 0)
|
||||||
m_exec_name = argv[0];
|
m_exec_name = argv[0];
|
||||||
|
|
||||||
for(unsigned int i=1; i<argc; i++)
|
for(unsigned int i=1; i<argc; i++)
|
||||||
m_argv.push_back(argv[i]);
|
m_argv.push_back(argv[i]);
|
||||||
} // CommandLine
|
} // CommandLine
|
||||||
|
Loading…
x
Reference in New Issue
Block a user