LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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 05-14-2006, 06:11 AM   #1
demerson3
Member
 
Registered: Sep 2004
Location: Seattle area
Distribution: debian stable
Posts: 51

Rep: Reputation: 15
Xlib / XSendEvent and kuickshow, kate


I'm trying to write a C program that will send keypresses to kuickshow. For example, the "M" key, or the "Page_Down" key. I'm using KDE 3.3.2 (debian stable) It seems like I'm almost there, but I have one more hump to get over.

- It works if kuickshow has FOCUS.

- It works perfectly with gaim, even when gaim does not have focus.

- kuickshow will work without focus IF the Ctrl key is included (event.state = ControlMask)

But... I can't seem to get kuickshow to respond to a plain Page_Down key without window focus. (Of course, I could make new shortcuts that have the control key included, but that's kind of a hack. I'd like to get this working properly!)

Here's some C code:

PHP Code:
#define XK_LATIN1
#define XK_MISCELLANY
#include <X11/keysymdef.h>
#include <X11/Xlib.h>

Display *disp;
XKeyEvent kp;

void press_key()
{
    
kp.type KeyPress;
    
XSendEvent (dispkp.windowFalseKeyPressMask, (XEvent *)(&kp));
}

int main()
{
    
disp XOpenDisplay(NULL);

    
kp.window 0x3200d1b;
    
kp.state ControlMask;
    
kp.keycode XKeysymToKeycode (dispXK_Page_Down);

    
press_key();

    
XCloseDisplay(disp);

So this works, but I want the kp.state to be 0 instead of ControlMask.

I've tried specifying all sorts of variables, like kp.display, or the time; I've tried including a KeyRelease, after the KeyPress; I've tried switching the propagate bool (3rd var in XSendEvent call) to True and False, etc.

A hint to others: to get that window ID (0x3200d1b) use xwininfo

Any bright ideas?

Too bad DCOP doesn't seem to offer functionality to fully control the app. Maybe later.
 
  


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
Kuickshow slideshow from the command line ncsuapex Linux - Software 2 12-21-2005 08:35 PM
XLib problem (XSendEvent) muratungor Programming 0 07-26-2005 07:34 AM
Kuickshow black screen Haiyadragon Linux - Software 3 02-11-2005 10:07 PM
Kate Is Not Working, Kate editor is not starting in Redhat 9 apur Linux - General 4 05-11-2004 09:52 AM
kuickshow will not open jpegs under blackbox mooreted Linux - Software 2 04-04-2004 05:20 PM

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

All times are GMT -5. The time now is 03:39 AM.

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