Share your knowledge at the LQ Wiki.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 08-19-2004, 05:18 PM   #1
LQ Newbie
Registered: Aug 2004
Posts: 2

Rep: Reputation: 0
determining active x window

I am trying to write some code to determine the active x window and was wondering if there is any easy way to do this. I tried using xwinifo and xev but I can't figure out a slick way to determine the current active x window. Any ideas?

Old 08-22-2004, 05:52 AM   #2
Registered: Feb 2004
Location: Outside Paris
Distribution: Solaris10, Solaris 11, Mint, OL
Posts: 9,570

Rep: Reputation: 374Reputation: 374Reputation: 374Reputation: 374
This should work:
#include <X11/Xlib.h>
        Window focus;
        int revert;
        Display *display=XOpenDisplay((char*)0);
                XGetInputFocus(display, &focus, &revert);
                printf("window 0x%x has the focus\n", focus);


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
how to connect Linux machine with Window Active Directory hanybeee Linux - Networking 1 10-22-2005 04:16 PM
Determining the Active Virtual Console MasterPi Linux - General 5 05-02-2005 11:11 PM
tput - determining window size subu_s Programming 2 12-06-2004 10:46 PM
Cannot Resize, Move my active window in KDE 3.2? DigitalKid2004 Linux - Newbie 0 09-20-2004 12:19 PM
determining active x window tcorreia Linux - General 1 08-20-2004 03:55 AM

All times are GMT -5. The time now is 03:17 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration