TonyF Posted March 17, 2015 Share Posted March 17, 2015 Is it possible to check if the window is focused or not eg tabbed out? Some googling indicated in leadwerks 2 AppSuspended() was used however i cant seem to find a leadwerks 3 versions. Im basically trying to stop moving the mouse when the window isnt active Quote Link to comment Share on other sites More sharing options...
gamecreator Posted March 17, 2015 Share Posted March 17, 2015 http://www.leadwerks.com/werkspace/topic/11498-window-call-need-has-focus/ Quote Link to comment Share on other sites More sharing options...
TonyF Posted March 17, 2015 Author Share Posted March 17, 2015 So basically this dosnt exist yet? I would have thought alt-tabbing is a common need at some stage or another. Quote Link to comment Share on other sites More sharing options...
NightQuest Posted March 18, 2015 Share Posted March 18, 2015 Thanks to this, something like this should work EDIT: I installed XUbuntu 14.04 on dual-boot to test this, below is the working version bool isActiveWindow(Leadwerks::Window* window) { if( window == nullptr ) return false; #if defined(__linux__) && !defined(__ANDROID__) ::Window root = 0L; ::Window active = 0L; Atom _NET_ACTIVE_WINDOW = XInternAtom(window->display, "_NET_ACTIVE_WINDOW", False); Atom actual_type; int actual_format; unsigned long count, bytesAfter; unsigned char* properties = NULL; root = DefaultRootWindow(window->display); if( XGetWindowProperty(window->display, root, _NET_ACTIVE_WINDOW, 0L, sizeof(::Window), False, XA_WINDOW, &actual_type, &actual_format, &count, &bytesAfter, &properties) == Success ) { active = *reinterpret_cast<::Window*>(properties); XFree(properties); } return (window->window == active); #else return window->Active(); #endif } Quote Link to comment Share on other sites More sharing options...
Ywa Posted March 23, 2015 Share Posted March 23, 2015 I would have thought alt-tabbing is a common need at some stage or another. Yes it is. And that's why it's very strange why it isn't implemented yet. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.