LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
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.

Notices


Reply
  Search this Thread
Old 07-27-2006, 03:16 PM   #1
jrbrearley
LQ Newbie
 
Registered: May 2006
Posts: 7

Rep: Reputation: 0
XGetInputFocus issue


I am trying to determine the current X active window using the code shown below. The issue is that the window ID I get back does not match the environment variable WINDOWID for the window I am running the code in. When manually testing the code, I kind of expect that the active window id should be the same as the environment variable. Does anyone have any suggestions as to what is happening here?


#include <stdio.h>
#include <stdlib.h>
#include <X11/Xlib.h>

main()
{
// Declare variables
Display *display; //structure defined in Xlib.h
Window window_id; //structure defined in Xlib.h
int focus_state;

// Connect to the local X windows server.
if (display=XOpenDisplay(0)) {
// printf("display=0X.%x\n",display);
} else {
printf("Failed to open display!\n");
exit(1);
}

// Get the name of the current focused window.
if (XGetInputFocus(display,&window_id,&focus_state)) {
printf("WindowID=%d\n",window_id);
exit(0);
} else {
printf("Failed to get focus window info!\n");
exit(1);
}
}
 
  


Reply



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
IPv6 issue/dhclient issue ap0ll0 Linux - Wireless Networking 10 01-27-2006 04:58 PM
Slack 10.1 -- Mouse issue / X11 issue Pozican Linux - General 4 04-19-2005 03:44 AM
webmin issue, poss security issue bejiita Slackware 3 11-03-2004 06:07 AM
DNS issue or caching issue? AZDAVE Linux - Networking 7 10-02-2004 12:28 AM
Having Issue w/ Truetype fonts - Mozilla Issue clove Linux - Software 4 02-18-2004 08:26 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 10:44 PM.

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