sdlWindow.cpp 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709
  1. //-----------------------------------------------------------------------------
  2. // Copyright (c) 2012 GarageGames, LLC
  3. //
  4. // Permission is hereby granted, free of charge, to any person obtaining a copy
  5. // of this software and associated documentation files (the "Software"), to
  6. // deal in the Software without restriction, including without limitation the
  7. // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
  8. // sell copies of the Software, and to permit persons to whom the Software is
  9. // furnished to do so, subject to the following conditions:
  10. //
  11. // The above copyright notice and this permission notice shall be included in
  12. // all copies or substantial portions of the Software.
  13. //
  14. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15. // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16. // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  17. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  18. // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  19. // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
  20. // IN THE SOFTWARE.
  21. //-----------------------------------------------------------------------------
  22. #include "math/mMath.h"
  23. #include "gfx/gfxStructs.h"
  24. #include "windowManager/sdl/sdlWindow.h"
  25. #include "windowManager/sdl/sdlWindowMgr.h"
  26. #include "windowManager/sdl/sdlCursorController.h"
  27. #include "platformSDL/sdlInput.h"
  28. #include "platform/platformInput.h"
  29. #include "gfx/gfxDevice.h"
  30. #ifdef TORQUE_OS_LINUX
  31. #define SDL_VIDEO_DRIVER_X11 // TODO SDL
  32. #endif
  33. #include "SDL.h"
  34. #include "SDL_syswm.h"
  35. #define SCREENSAVER_QUERY_DENY 0 // Disable screensaver
  36. #ifndef IDI_ICON1
  37. #define IDI_ICON1 107
  38. #endif
  39. namespace
  40. {
  41. U32 getTorqueModFromSDL(U16 mod)
  42. {
  43. U32 ret = 0;
  44. if (mod & KMOD_LSHIFT)
  45. {
  46. ret |= SI_LSHIFT;
  47. ret |= SI_SHIFT;
  48. }
  49. if (mod & KMOD_RSHIFT)
  50. {
  51. ret |= SI_RSHIFT;
  52. ret |= SI_SHIFT;
  53. }
  54. if (mod & KMOD_LCTRL)
  55. {
  56. ret |= SI_LCTRL;
  57. ret |= SI_CTRL;
  58. }
  59. if (mod & KMOD_RCTRL)
  60. {
  61. ret |= SI_RCTRL;
  62. ret |= SI_CTRL;
  63. }
  64. if (mod & KMOD_LALT)
  65. {
  66. ret |= SI_LALT;
  67. ret |= SI_ALT;
  68. }
  69. if (mod & KMOD_RALT)
  70. {
  71. ret |= SI_RALT;
  72. ret |= SI_ALT;
  73. }
  74. return ret;
  75. }
  76. }
  77. PlatformWindowSDL::PlatformWindowSDL():
  78. mOwningManager(NULL),
  79. mNextWindow(NULL),
  80. mWindowHandle(NULL),
  81. mOldParent(NULL),
  82. mDevice(NULL),
  83. mTarget(NULL),
  84. mPosition(0,0),
  85. mMouseLocked(false),
  86. mShouldLockMouse(false),
  87. mSuppressReset(false),
  88. mMenuHandle(NULL),
  89. mClosing(false)
  90. {
  91. mCursorController = new PlatformCursorControllerSDL( this );
  92. mVideoMode.bitDepth = 32;
  93. mVideoMode.fullScreen = false;
  94. mVideoMode.refreshRate = 60;
  95. mVideoMode.resolution.set(800,600);
  96. }
  97. PlatformWindowSDL::~PlatformWindowSDL()
  98. {
  99. // delete our sdl handle..
  100. SDL_DestroyWindow(mWindowHandle);
  101. // unlink ourselves from the window list...
  102. AssertFatal(mOwningManager, "PlatformWindowSDL::~PlatformWindowSDL - orphan window, cannot unlink!");
  103. mOwningManager->unlinkWindow(this);
  104. }
  105. GFXDevice * PlatformWindowSDL::getGFXDevice()
  106. {
  107. return mDevice;
  108. }
  109. GFXWindowTarget * PlatformWindowSDL::getGFXTarget()
  110. {
  111. return mTarget;
  112. }
  113. const GFXVideoMode & PlatformWindowSDL::getVideoMode()
  114. {
  115. return mVideoMode;
  116. }
  117. void* PlatformWindowSDL::getSystemWindow(const WindowSystem system)
  118. {
  119. SDL_SysWMinfo info;
  120. SDL_VERSION(&info.version);
  121. SDL_GetWindowWMInfo(mWindowHandle,&info);
  122. #ifdef TORQUE_OS_WIN
  123. if( system == WindowSystem_Windows && info.subsystem == SDL_SYSWM_WINDOWS)
  124. return info.info.win.window;
  125. #endif
  126. #if defined(TORQUE_OS_LINUX)
  127. if( system == WindowSystem_X11 && info.subsystem == SDL_SYSWM_X11)
  128. return (void*)info.info.x11.window;
  129. #endif
  130. AssertFatal(0, "");
  131. return NULL;
  132. }
  133. void PlatformWindowSDL::_setVideoMode( const GFXVideoMode &mode )
  134. {
  135. mVideoMode = mode;
  136. mSuppressReset = true;
  137. S32 newDisplay = Con::getIntVariable("pref::Video::deviceId", 0);
  138. // Set our window to have the right style based on the mode
  139. if(mode.fullScreen && !Platform::getWebDeployment() && !mOffscreenRender)
  140. {
  141. SDL_Rect rect_sdl;
  142. // Move the window onto the correct monitor before setting fullscreen
  143. if (0 == SDL_GetDisplayBounds(newDisplay, &rect_sdl))
  144. {
  145. SDL_SetWindowPosition(mWindowHandle, rect_sdl.x, rect_sdl.y);
  146. }
  147. setSize(mode.resolution);
  148. SDL_SetWindowFullscreen( mWindowHandle, SDL_WINDOW_FULLSCREEN);
  149. // When switching to Fullscreen, reset device after setting style
  150. if(mTarget.isValid())
  151. mTarget->resetMode();
  152. }
  153. else
  154. {
  155. // Reset device *first*, so that when we call setSize() and let it
  156. // access the monitor settings, it won't end up with our fullscreen
  157. // geometry that is just about to change.
  158. if(mTarget.isValid())
  159. mTarget->resetMode();
  160. if (!mOffscreenRender)
  161. {
  162. SDL_SetWindowFullscreen( mWindowHandle, 0);
  163. }
  164. // Restore the window to it's original size/position before applying changes
  165. SDL_RestoreWindow(mWindowHandle);
  166. // pref::Video::deviceMode values 0-windowed, 1-borderless, 2-fullscreen
  167. bool hasBorder = (0 == Con::getIntVariable("pref::Video::deviceMode", 0));
  168. SDL_SetWindowBordered(mWindowHandle, hasBorder ? SDL_TRUE : SDL_FALSE);
  169. setSize(mode.resolution);
  170. SDL_SetWindowPosition(mWindowHandle, SDL_WINDOWPOS_CENTERED_DISPLAY(newDisplay), SDL_WINDOWPOS_CENTERED_DISPLAY(newDisplay));
  171. if (hasBorder && Con::getBoolVariable("pref::Video::isMaximized", false))
  172. SDL_MaximizeWindow(mWindowHandle);
  173. }
  174. getScreenResChangeSignal().trigger(this, true);
  175. mSuppressReset = false;
  176. }
  177. bool PlatformWindowSDL::clearFullscreen()
  178. {
  179. return true;
  180. }
  181. bool PlatformWindowSDL::isFullscreen()
  182. {
  183. U32 flags = SDL_GetWindowFlags( mWindowHandle );
  184. if( flags & SDL_WINDOW_FULLSCREEN || flags & SDL_WINDOW_FULLSCREEN_DESKTOP )
  185. return true;
  186. return false;
  187. }
  188. void PlatformWindowSDL::_setFullscreen(const bool fullscreen)
  189. {
  190. if( isFullscreen() )
  191. return;
  192. if(fullscreen && !mOffscreenRender)
  193. {
  194. Con::printf("PlatformWindowSDL::setFullscreen (full) enter");
  195. SDL_SetWindowFullscreen( mWindowHandle, SDL_WINDOW_FULLSCREEN);
  196. }
  197. else
  198. {
  199. Con::printf("PlatformWindowSDL::setFullscreen (windowed) enter");
  200. if (!mOffscreenRender)
  201. {
  202. SDL_SetWindowFullscreen( mWindowHandle, SDL_WINDOW_FULLSCREEN_DESKTOP);
  203. }
  204. setSize(mVideoMode.resolution);
  205. }
  206. Con::printf("PlatformWindowSDL::setFullscreen exit");
  207. }
  208. bool PlatformWindowSDL::setCaption( const char *cap )
  209. {
  210. SDL_SetWindowTitle(mWindowHandle, cap);
  211. return true;
  212. }
  213. const char * PlatformWindowSDL::getCaption()
  214. {
  215. return StringTable->insert( SDL_GetWindowTitle(mWindowHandle) );
  216. }
  217. void PlatformWindowSDL::setFocus()
  218. {
  219. SDL_RaiseWindow(mWindowHandle);
  220. }
  221. void PlatformWindowSDL::setClientExtent( const Point2I newExtent )
  222. {
  223. Point2I oldExtent = getClientExtent();
  224. if (oldExtent == newExtent)
  225. return;
  226. SDL_SetWindowSize(mWindowHandle, newExtent.x, newExtent.y);
  227. }
  228. const Point2I PlatformWindowSDL::getClientExtent()
  229. {
  230. // Fetch Client Rect from Windows
  231. Point2I size;
  232. SDL_GetWindowSize(mWindowHandle, &size.x, &size.y);
  233. return size;
  234. }
  235. void PlatformWindowSDL::setBounds( const RectI &newBounds )
  236. {
  237. // TODO SDL
  238. }
  239. const RectI PlatformWindowSDL::getBounds() const
  240. {
  241. // TODO SDL
  242. return RectI(0, 0, 0, 0);
  243. }
  244. void PlatformWindowSDL::setPosition( const Point2I newPosition )
  245. {
  246. SDL_SetWindowPosition( mWindowHandle, newPosition.x, newPosition.y );
  247. }
  248. const Point2I PlatformWindowSDL::getPosition()
  249. {
  250. Point2I position;
  251. SDL_GetWindowPosition( mWindowHandle, &position.x, &position.y );
  252. // Return position
  253. return position;
  254. }
  255. Point2I PlatformWindowSDL::clientToScreen( const Point2I& pos )
  256. {
  257. Point2I position;
  258. SDL_GetWindowPosition( mWindowHandle, &position.x, &position.y );
  259. return pos + position;
  260. }
  261. Point2I PlatformWindowSDL::screenToClient( const Point2I& pos )
  262. {
  263. Point2I position;
  264. SDL_GetWindowPosition( mWindowHandle, &position.x, &position.y );
  265. return pos - position;
  266. }
  267. void PlatformWindowSDL::centerWindow()
  268. {
  269. int sizeX, sizeY;
  270. SDL_GetWindowSize(mWindowHandle, &sizeX, &sizeY);
  271. SDL_DisplayMode mode;
  272. SDL_GetDesktopDisplayMode(0, &mode);
  273. U32 posX = (mode.w/2) - (sizeX/2);
  274. U32 posY = (mode.h/2) - (sizeY/2);
  275. SDL_SetWindowPosition( mWindowHandle, posX, posY);
  276. }
  277. bool PlatformWindowSDL::setSize( const Point2I &newSize )
  278. {
  279. SDL_SetWindowSize(mWindowHandle, newSize.x, newSize.y);
  280. return true;
  281. }
  282. bool PlatformWindowSDL::isOpen()
  283. {
  284. return mWindowHandle;
  285. }
  286. bool PlatformWindowSDL::isVisible()
  287. {
  288. // Is the window open and visible, ie. not minimized?
  289. if(!mWindowHandle)
  290. return false;
  291. if (mOffscreenRender)
  292. return true;
  293. U32 flags = SDL_GetWindowFlags( mWindowHandle );
  294. if( flags & SDL_WINDOW_SHOWN)
  295. return true;
  296. return false;
  297. }
  298. bool PlatformWindowSDL::isFocused()
  299. {
  300. if (mOffscreenRender)
  301. return true;
  302. U32 flags = SDL_GetWindowFlags( mWindowHandle );
  303. if( flags & SDL_WINDOW_INPUT_FOCUS || flags & SDL_WINDOW_INPUT_GRABBED || flags & SDL_WINDOW_MOUSE_FOCUS )
  304. return true;
  305. return false;
  306. }
  307. bool PlatformWindowSDL::isMinimized()
  308. {
  309. if (mOffscreenRender)
  310. return false;
  311. U32 flags = SDL_GetWindowFlags( mWindowHandle );
  312. if( flags & SDL_WINDOW_MINIMIZED)
  313. return true;
  314. return false;
  315. }
  316. bool PlatformWindowSDL::isMaximized()
  317. {
  318. if (mOffscreenRender)
  319. return true;
  320. U32 flags = SDL_GetWindowFlags( mWindowHandle );
  321. if( flags & SDL_WINDOW_MAXIMIZED)
  322. return true;
  323. return false;
  324. }
  325. WindowId PlatformWindowSDL::getWindowId()
  326. {
  327. return mWindowId;
  328. }
  329. void PlatformWindowSDL::minimize()
  330. {
  331. if (mOffscreenRender)
  332. return;
  333. SDL_MinimizeWindow( mWindowHandle );
  334. }
  335. void PlatformWindowSDL::maximize()
  336. {
  337. if (mOffscreenRender)
  338. return;
  339. SDL_MaximizeWindow( mWindowHandle );
  340. }
  341. void PlatformWindowSDL::restore()
  342. {
  343. if (mOffscreenRender)
  344. return;
  345. SDL_RestoreWindow( mWindowHandle );
  346. }
  347. void PlatformWindowSDL::hide()
  348. {
  349. if (mOffscreenRender)
  350. return;
  351. SDL_HideWindow( mWindowHandle );
  352. }
  353. void PlatformWindowSDL::show()
  354. {
  355. if (mOffscreenRender)
  356. return;
  357. SDL_ShowWindow( mWindowHandle );
  358. }
  359. void PlatformWindowSDL::close()
  360. {
  361. delete this;
  362. }
  363. void PlatformWindowSDL::defaultRender()
  364. {
  365. // TODO SDL
  366. }
  367. void PlatformWindowSDL::_triggerMouseLocationNotify(const SDL_Event& evt)
  368. {
  369. U32 mods = getTorqueModFromSDL(SDL_GetModState());
  370. if(!mMouseLocked)
  371. mouseEvent.trigger(getWindowId(), mods, evt.motion.x, evt.motion.y, false);
  372. else
  373. mouseEvent.trigger(getWindowId(), mods, evt.motion.xrel, evt.motion.yrel, true);
  374. }
  375. void PlatformWindowSDL::_triggerMouseWheelNotify(const SDL_Event& evt)
  376. {
  377. U32 mods = getTorqueModFromSDL(SDL_GetModState());
  378. S32 wheelDelta = Con::getIntVariable("$pref::Input::MouseWheelSpeed", 120);
  379. wheelEvent.trigger(getWindowId(), mods, evt.wheel.x * wheelDelta, evt.wheel.y * wheelDelta);
  380. }
  381. void PlatformWindowSDL::_triggerMouseButtonNotify(const SDL_Event& event)
  382. {
  383. S32 action = (event.type == SDL_MOUSEBUTTONDOWN) ? SI_MAKE : SI_BREAK;
  384. S32 button = -1;
  385. switch (event.button.button)
  386. {
  387. case SDL_BUTTON_LEFT:
  388. button = 0;
  389. break;
  390. case SDL_BUTTON_RIGHT:
  391. button = 1;
  392. break;
  393. case SDL_BUTTON_MIDDLE:
  394. button = 2;
  395. break;
  396. case SDL_BUTTON_X1:
  397. button = 3;
  398. break;
  399. case SDL_BUTTON_X2:
  400. button = 4;
  401. break;
  402. default:
  403. return;
  404. }
  405. U32 mod = getTorqueModFromSDL( SDL_GetModState() );
  406. buttonEvent.trigger(getWindowId(), mod, action, button );
  407. }
  408. void PlatformWindowSDL::_triggerKeyNotify(const SDL_Event& evt)
  409. {
  410. U32 inputAction = IA_MAKE;
  411. SDL_Keysym tKey = evt.key.keysym;
  412. if(evt.type == SDL_KEYUP)
  413. {
  414. inputAction = IA_BREAK;
  415. }
  416. if(evt.key.repeat)
  417. {
  418. inputAction = IA_REPEAT;
  419. }
  420. U32 torqueModifiers = getTorqueModFromSDL(evt.key.keysym.mod);
  421. U32 torqueKey = KeyMapSDL::getTorqueScanCodeFromSDL(tKey.scancode);
  422. if(tKey.scancode)
  423. {
  424. keyEvent.trigger(getWindowId(), torqueModifiers, inputAction, torqueKey);
  425. //Con::printf("Key %d : %d", tKey.sym, inputAction);
  426. if (inputAction == IA_MAKE && SDL_IsTextInputActive())
  427. {
  428. // We have to check if we already have a first responder active.
  429. // We don't want to type the character if it actually creates another responder!
  430. if (mWindowInputGenerator->lastKeyWasGlobalActionMap())
  431. {
  432. // Turn off Text input, and the next frame turn it back on. This tells SDL
  433. // to not generate a text event for this global action map key.
  434. SDL_StopTextInput();
  435. mOwningManager->updateSDLTextInputState(PlatformWindowManagerSDL::KeyboardInputState::TEXT_INPUT);
  436. }
  437. }
  438. }
  439. }
  440. void PlatformWindowSDL::_triggerTextNotify(const SDL_Event& evt)
  441. {
  442. U32 mod = getTorqueModFromSDL( SDL_GetModState() );
  443. if( !evt.text.text[1] ) // get a char
  444. {
  445. U16 wchar = evt.text.text[0];
  446. charEvent.trigger(getWindowId(), mod, wchar );
  447. //Con::printf("Char: %c", wchar);
  448. return;
  449. }
  450. else // get a wchar string
  451. {
  452. const U32 len = strlen(evt.text.text);
  453. U16 wchar[16] = {};
  454. dMemcpy(wchar, evt.text.text, sizeof(char)*len);
  455. for(int i = 0; i < 16; ++i)
  456. {
  457. if( !wchar[i] )
  458. return;
  459. charEvent.trigger(getWindowId(), mod, wchar[i] );
  460. }
  461. }
  462. }
  463. void PlatformWindowSDL::_updateMonitorFromMove(const SDL_Event& evt)
  464. {
  465. SDL_Rect sdlRect;
  466. S32 monitorCount = SDL_GetNumVideoDisplays();
  467. for (S32 index = 0; index < monitorCount; ++index)
  468. {
  469. if (0 == SDL_GetDisplayBounds(index, &sdlRect))
  470. {
  471. if ((evt.window.data1 >= sdlRect.x) && (evt.window.data1 < (sdlRect.x + sdlRect.w)) &&
  472. (evt.window.data2 >= sdlRect.y) && (evt.window.data2 < (sdlRect.y + sdlRect.h)))
  473. {
  474. Con::setIntVariable("pref::Video::deviceId", index);
  475. return;
  476. }
  477. }
  478. }
  479. }
  480. void PlatformWindowSDL::_processSDLEvent(SDL_Event &evt)
  481. {
  482. switch(evt.type)
  483. {
  484. case SDL_KEYDOWN:
  485. case SDL_KEYUP:
  486. {
  487. _triggerKeyNotify(evt);
  488. break;
  489. }
  490. case SDL_TEXTINPUT:
  491. {
  492. _triggerTextNotify(evt);
  493. break;
  494. }
  495. case SDL_MOUSEWHEEL:
  496. {
  497. _triggerMouseWheelNotify(evt);
  498. break;
  499. }
  500. case SDL_MOUSEMOTION:
  501. {
  502. _triggerMouseLocationNotify(evt);
  503. break;
  504. }
  505. case SDL_MOUSEBUTTONDOWN:
  506. case SDL_MOUSEBUTTONUP:
  507. {
  508. _triggerMouseButtonNotify(evt);
  509. break;
  510. }
  511. case SDL_WINDOWEVENT:
  512. {
  513. if (!mClosing)
  514. {
  515. switch (evt.window.event)
  516. {
  517. case SDL_WINDOWEVENT_FOCUS_GAINED:
  518. appEvent.trigger(getWindowId(), GainFocus);
  519. break;
  520. case SDL_WINDOWEVENT_FOCUS_LOST:
  521. appEvent.trigger(getWindowId(), LoseFocus);
  522. break;
  523. case SDL_WINDOWEVENT_MOVED:
  524. {
  525. _updateMonitorFromMove(evt);
  526. break;
  527. }
  528. case SDL_WINDOWEVENT_RESIZED:
  529. {
  530. int width, height;
  531. SDL_GetWindowSize(mWindowHandle, &width, &height);
  532. mVideoMode.resolution.set(width, height);
  533. getGFXTarget()->resetMode();
  534. resizeEvent.trigger(getWindowId(), width, height);
  535. getScreenResChangeSignal().trigger(this, true);
  536. break;
  537. }
  538. case SDL_WINDOWEVENT_CLOSE:
  539. {
  540. appEvent.trigger(getWindowId(), WindowClose);
  541. mClosing = true;
  542. }
  543. case SDL_WINDOWEVENT_MINIMIZED:
  544. break;
  545. case SDL_WINDOWEVENT_MAXIMIZED:
  546. Con::setBoolVariable("pref::Video::isMaximized", true);
  547. break;
  548. case SDL_WINDOWEVENT_RESTORED:
  549. Con::setBoolVariable("pref::Video::isMaximized", false);
  550. break;
  551. default:
  552. break;
  553. }
  554. }
  555. }
  556. }
  557. }
  558. //-----------------------------------------------------------------------------
  559. // Mouse Locking
  560. //-----------------------------------------------------------------------------
  561. void PlatformWindowSDL::setMouseLocked( bool enable )
  562. {
  563. if (mOffscreenRender)
  564. return;
  565. mMouseLocked = enable;
  566. SDL_SetWindowGrab( mWindowHandle, SDL_bool(enable) );
  567. SDL_SetRelativeMouseMode( SDL_bool(enable) );
  568. }
  569. const UTF16 *PlatformWindowSDL::getWindowClassName()
  570. {
  571. // TODO SDL
  572. static String str("WindowClassName");
  573. return str.utf16();
  574. }
  575. const UTF16 *PlatformWindowSDL::getCurtainWindowClassName()
  576. {
  577. // TODO SDL
  578. static String str("CurtainWindowClassName");
  579. return str.utf16();
  580. }
  581. void PlatformWindowSDL::setKeyboardTranslation(const bool enabled)
  582. {
  583. mEnableKeyboardTranslation = enabled;
  584. // Flag for update. Let SDL know what kind of input state we are changing to.
  585. if (enabled)
  586. mOwningManager->updateSDLTextInputState(PlatformWindowManagerSDL::KeyboardInputState::TEXT_INPUT);
  587. else
  588. mOwningManager->updateSDLTextInputState(PlatformWindowManagerSDL::KeyboardInputState::RAW_INPUT);
  589. }