ExBemined Posted September 25, 2020 Share Posted September 25, 2020 Hi, Got another issue with the UI. It seems that when the main window receives focus, it ignores any mouse event from that frame. We experienced this issue in combination with a popup window (made with the Interface plugin) which shows some information for the selected object. When this popup as focus, the user needs to click twice to select a different object in the 3D view. I managed to create a simple repro script, tested in an empty 2.12 project with just the Interface plugin added to it: int init() { engine.controls.setMouseHandle(MOUSE_HANDLE_SOFT); InterfaceWindow iw = new InterfaceWindow(INTERFACE_WINDOW_TITLE); WidgetButton wb1 = new WidgetButton(engine.getGui(), "Click me first"); iw.setHidden(false); iw.setWidget(wb1); WidgetButton wb2 = new WidgetButton(engine.getGui(), "Click me second"); engine.gui.addChild(wb2, GUI_ALIGN_CENTER); return 1; } Simply run this script, press the button which says "Click me first" which causes the interface window to have focus, and then click the "Click me second" button located on the main window. You should notice the button 'animation' of being pressed down does not happen on the first click, but only on the second click. It's not limited to just Widgets, if I logspam the value of engine.app.getMouseButton() it also prints 0 to the console on the first click. I also tested this on the Unigine 2.5 SDK and it worked fine there, so I suspect the new AppWindow (we noticed this was refactored some versions ago) causes this? Link to comment
silent Posted September 25, 2020 Share Posted September 25, 2020 Bemined Yes, AppWindow refactoring may be the root cause. I've successfully reproduced this behavior. Hope the fix will not be very complex and we can include it in 2.13 SDK update. Thanks! How to submit a good bug report --- FTP server for test scenes and user uploads: ftp://files.unigine.com user: upload password: 6xYkd6vLYWjpW6SN Link to comment
silent Posted September 28, 2020 Share Posted September 28, 2020 Could you please check if this patch will work? source/engine/framework/AppSDL.cpp SDL_SetMainReady(); if (SDL_Init(SDL_INIT_VIDEO) < 0) Unigine::Log::fatal("AppSDL::AppSDL(): SDL_Init() %s\n", SDL_GetError()); SDL_SetHint(SDL_HINT_MOUSE_FOCUS_CLICKTHROUGH, "1"); // add this line // create RenderContext const auto &video_app = engine.engine->getVideoApp(); Thanks! How to submit a good bug report --- FTP server for test scenes and user uploads: ftp://files.unigine.com user: upload password: 6xYkd6vLYWjpW6SN Link to comment
ExBemined Posted September 29, 2020 Author Share Posted September 29, 2020 Seems to work perfectly now, thanks! Link to comment
silent Posted September 29, 2020 Share Posted September 29, 2020 If everything will be OK with this fix it will be included in the 2.13 release (this Autumn). How to submit a good bug report --- FTP server for test scenes and user uploads: ftp://files.unigine.com user: upload password: 6xYkd6vLYWjpW6SN Link to comment
silent Posted November 16, 2020 Share Posted November 16, 2020 We decided to revert this fix, because it introduces other issues when application was out of focus. You can patch the engine manually on your side (source/engine/framework/AppSDL.cpp): source/engine/framework/AppSDL.cpp AppSDL::AppSDL() ... if (SDL_Init(SDL_INIT_VIDEO) < 0) Unigine::Log::fatal("AppSDL::AppSDL(): SDL_Init() %s\n", SDL_GetError()); SDL_SetHint(SDL_HINT_MOUSE_FOCUS_CLICKTHROUGH, "1"); // add this line Proper solution would be to completely rewrite Interface plugin to use new SDL pipeline (that we eventually will do). Thanks! How to submit a good bug report --- FTP server for test scenes and user uploads: ftp://files.unigine.com user: upload password: 6xYkd6vLYWjpW6SN Link to comment
Recommended Posts