Jump to content

Recommended Posts

Posted

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

Posted

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

}

Posted

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.

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...