Linux - Wie Tastendruck an anderes Fenster?
-
- Beiträge: 250
- Registriert: Di 16. Dez 2008, 20:13
- OS, Lazarus, FPC: aptosid (aptosid.com); Lazarus SVN gtk2+qt4; FPC 2.4.0
- CPU-Target: 32/64Bit
Linux - Wie Tastendruck an anderes Fenster?
Wie kann man unter Linux Tastendrücke an ein anderes Fenster (z.b. Firefox) senden.
Ich habe schon einige Zeit gesucht, aber keine Lösung gefunden.
Vielen Dank im voraus.
mfg _X_
Ich habe schon einige Zeit gesucht, aber keine Lösung gefunden.
Vielen Dank im voraus.
mfg _X_
Re: Linux - Wie Tastendruck an anderes Fenster?
http://www.doctort.org/adam/nerd-notes/ ... event.html" onclick="window.open(this.href);return false;
-
- Beiträge: 2013
- Registriert: Do 16. Okt 2008, 10:22
- OS, Lazarus, FPC: Linux,Windows,FreeBSD,(MSEide+MSEgui 4.6,git master FPC 3.0.4,fixes_3_0)
- CPU-Target: x86,x64,ARM
Re: Linux - Wie Tastendruck an anderes Fenster?
Im Prinzip mit XSendEvent().
http://tronche.com/gui/x/xlib/event-han ... tions.html
http://tronche.com/gui/x/xlib/event-han ... Event.html
Das Senden von XKeyEvent an andere Applikationen ist eher ein Murks.
http://tronche.com/gui/x/xlib/event-han ... tions.html
http://tronche.com/gui/x/xlib/event-han ... Event.html
Das Senden von XKeyEvent an andere Applikationen ist eher ein Murks.
-
- Beiträge: 250
- Registriert: Di 16. Dez 2008, 20:13
- OS, Lazarus, FPC: aptosid (aptosid.com); Lazarus SVN gtk2+qt4; FPC 2.4.0
- CPU-Target: 32/64Bit
Re: Linux - Wie Tastendruck an anderes Fenster?
Danke erst Mal!
mfg _X_
mfg _X_
-
- Beiträge: 250
- Registriert: Di 16. Dez 2008, 20:13
- OS, Lazarus, FPC: aptosid (aptosid.com); Lazarus SVN gtk2+qt4; FPC 2.4.0
- CPU-Target: 32/64Bit
Re: Linux - Wie Tastendruck an anderes Fenster?
Gibt's ne Möglichkeit das Ganze in Pascal zu machen?
mfg _X_
mfg _X_
Re: Linux - Wie Tastendruck an anderes Fenster?
Unit xlib einbinden._X_ hat geschrieben:Gibt's ne Möglichkeit das Ganze in Pascal zu machen?
-
- Beiträge: 250
- Registriert: Di 16. Dez 2008, 20:13
- OS, Lazarus, FPC: aptosid (aptosid.com); Lazarus SVN gtk2+qt4; FPC 2.4.0
- CPU-Target: 32/64Bit
Re: Linux - Wie Tastendruck an anderes Fenster?
Hab ich schon gemacht, aber ich komm damit nicht klar.
Bei
Versteh ich die letzten 3 Parameter nicht.
mfg _X_
Bei
Code: Alles auswählen
XSendEvent(para1:PDisplay; para2:TWindow; para3:TBool; para4:clong; para5:PXEvent):TStatus;
mfg _X_
Re: Linux - Wie Tastendruck an anderes Fenster?
Das hat mit Lazarus wenig zu tun, da musst du dir schon selber zu helfen wissen, wenn du XLib programmieren willst.
Was willst du denn eigentlich machen? Vielleicht geht's ja auch anders.
Was willst du denn eigentlich machen? Vielleicht geht's ja auch anders.
-
- Beiträge: 250
- Registriert: Di 16. Dez 2008, 20:13
- OS, Lazarus, FPC: aptosid (aptosid.com); Lazarus SVN gtk2+qt4; FPC 2.4.0
- CPU-Target: 32/64Bit
Re: Linux - Wie Tastendruck an anderes Fenster?
Ich will für eine Ausfüllhilfe ala Ghostwriter (http://toolsandmore.de/Central/Produkte ... ostwriter/) einen Linux Version basteln.
mfg _X_
mfg _X_
Re: Linux - Wie Tastendruck an anderes Fenster?
Tja, das geht dann wohl nicht anders.
Vielleicht kann dir mse dabei helfen. Das dürfte für die meisten hier Neuland sein.
Edit: Evtl. kannst du dich auch hier dran orientieren, oder es gleich aufrufen, winID musst du aber trozdem ermitteln.
http://people.csail.mit.edu/adonovan/ha ... ndkey.html" onclick="window.open(this.href);return false;
Vielleicht kann dir mse dabei helfen. Das dürfte für die meisten hier Neuland sein.
Edit: Evtl. kannst du dich auch hier dran orientieren, oder es gleich aufrufen, winID musst du aber trozdem ermitteln.
http://people.csail.mit.edu/adonovan/ha ... ndkey.html" onclick="window.open(this.href);return false;
-
- Beiträge: 250
- Registriert: Di 16. Dez 2008, 20:13
- OS, Lazarus, FPC: aptosid (aptosid.com); Lazarus SVN gtk2+qt4; FPC 2.4.0
- CPU-Target: 32/64Bit
Re: Linux - Wie Tastendruck an anderes Fenster?
Danke für den Link, werd ich mir mal ansehen.
Die winID hol ich mir im Moment mit dem Befehl
mfg _X_
Die winID hol ich mir im Moment mit dem Befehl
Code: Alles auswählen
xwininfo -int
-
- Beiträge: 250
- Registriert: Di 16. Dez 2008, 20:13
- OS, Lazarus, FPC: aptosid (aptosid.com); Lazarus SVN gtk2+qt4; FPC 2.4.0
- CPU-Target: 32/64Bit
Re: Linux - Wie Tastendruck an anderes Fenster?
mse: Kannst du mir bitte den Syntax von XSendEvent() erkären?
mfg _X_
mfg _X_
Zuletzt geändert von _X_ am So 16. Mai 2010, 19:42, insgesamt 1-mal geändert.
-
- Beiträge: 2013
- Registriert: Do 16. Okt 2008, 10:22
- OS, Lazarus, FPC: Linux,Windows,FreeBSD,(MSEide+MSEgui 4.6,git master FPC 3.0.4,fixes_3_0)
- CPU-Target: x86,x64,ARM
Re: Linux - Wie Tastendruck an anderes Fenster?
Die unit xlib wurde aus den C-header Dateien automatisch erstellt, es empfielt sich, die original header anzusehen._X_ hat geschrieben: Versteh ich die letzten 3 Parameter nicht.
Das Xlib Manual hast du ja wohl gefunden:
http://tronche.com/gui/x/xlib/
XSendEvent:
http://tronche.com/gui/x/xlib/event-han ... Event.html
Code: Alles auswählen
Syntax
Status XSendEvent(display, w, propagate, event_mask, event_send)
Display *display;
Window w;
Bool propagate;
long event_mask;
XEvent *event_send;
Arguments
display Specifies the connection to the X server.
w Specifies the window the event is to be sent to, or PointerWindow, or InputFocus.
propagate Specifies a Boolean value.
event_mask Specifies the event mask.
event_send Specifies the event that is to be sent.
Code: Alles auswählen
To determine which clients should receive the specified events, XSendEvent() uses the propagate argument as follows:
If event_mask is the empty set, the event is sent to the client that created the destination window. If that client no longer exists, no event is sent.
If propagate is False, the event is sent to every client selecting on destination any of the event types in the event_mask argument.
If propagate is True and no clients have selected on destination any of the event types in event-mask, the destination is replaced with the closest ancestor of destination for which some client has selected a type in event-mask and for which no intervening window has that type in its do-not-propagate-mask. If no such window exists or if the window is an ancestor of the focus window and InputFocus was originally specified as the destination, the event is not sent to any clients. Otherwise, the event is reported to every client selecting on the final destination any of the types specified in event_mask.
The event in the XEvent structure must be one of the core events or one of the events defined by an extension (or a BadValue error results) so that the X server can correctly byte-swap the contents as necessary. The contents of the event are otherwise unaltered and unchecked by the X server except to force send_event to True in the forwarded event and to set the serial number in the event correctly; therefore these fields and the display field are ignored by XSendEvent().
Die XEvent Struktur ist in Pascal ein record mit varianten Teilen (aus packages/x11/src/xlib.pp):
Code: Alles auswählen
TXEvent = record
case longint of
0 : ( _type : cint );
1 : ( xany : TXAnyEvent );
2 : ( xkey : TXKeyEvent );
3 : ( xbutton : TXButtonEvent );
4 : ( xmotion : TXMotionEvent );
5 : ( xcrossing : TXCrossingEvent );
6 : ( xfocus : TXFocusChangeEvent );
7 : ( xexpose : TXExposeEvent );
8 : ( xgraphicsexpose : TXGraphicsExposeEvent );
9 : ( xnoexpose : TXNoExposeEvent );
10 : ( xvisibility : TXVisibilityEvent );
11 : ( xcreatewindow : TXCreateWindowEvent );
12 : ( xdestroywindow : TXDestroyWindowEvent );
13 : ( xunmap : TXUnmapEvent );
14 : ( xmap : TXMapEvent );
15 : ( xmaprequest : TXMapRequestEvent );
16 : ( xreparent : TXReparentEvent );
17 : ( xconfigure : TXConfigureEvent );
18 : ( xgravity : TXGravityEvent );
19 : ( xresizerequest : TXResizeRequestEvent );
20 : ( xconfigurerequest : TXConfigureRequestEvent );
21 : ( xcirculate : TXCirculateEvent );
22 : ( xcirculaterequest : TXCirculateRequestEvent );
23 : ( xproperty : TXPropertyEvent );
24 : ( xselectionclear : TXSelectionClearEvent );
25 : ( xselectionrequest : TXSelectionRequestEvent );
26 : ( xselection : TXSelectionEvent );
27 : ( xcolormap : TXColormapEvent );
28 : ( xclient : TXClientMessageEvent );
29 : ( xmapping : TXMappingEvent );
30 : ( xerror : TXErrorEvent );
31 : ( xkeymap : TXKeymapEvent );
32 : ( pad : array[0..23] of clong );
end;
Code: Alles auswählen
TXKeyEvent = record
_type : cint;
serial : culong;
send_event : TBool;
display : PDisplay;
window : TWindow;
root : TWindow;
subwindow : TWindow;
time : TTime;
x, y : cint;
x_root, y_root : cint;
state : cuint;
keycode : cuint;
same_screen : TBool;
end;
http://tronche.com/gui/x/xlib/events/st ... tml#XEvent
Für XKeyEvent:
Code: Alles auswählen
typedef struct {
int type; /* KeyPress or KeyRelease */
unsigned long serial; /* # of last request processed by server */
Bool send_event; /* true if this came from a SendEvent request */
Display *display; /* Display the event was read from */
Window window; /* ``event'' window it is reported relative to */
Window root; /* root window that the event occurred on */
Window subwindow; /* child window */
Time time; /* milliseconds */
int x, y; /* pointer x, y coordinates in event window */
int x_root, y_root; /* coordinates relative to root */
unsigned int state; /* key or button mask */
unsigned int keycode; /* detail */
Bool same_screen; /* same screen flag */
} XKeyEvent;

Keine Sache von Minuten fürchte ich.
-
- Beiträge: 250
- Registriert: Di 16. Dez 2008, 20:13
- OS, Lazarus, FPC: aptosid (aptosid.com); Lazarus SVN gtk2+qt4; FPC 2.4.0
- CPU-Target: 32/64Bit
Re: Linux - Wie Tastendruck an anderes Fenster?
Danke.
Das kann jetzt ein Weilchen dauern.
mfg _X_
Das kann jetzt ein Weilchen dauern.
mfg _X_
Zuletzt geändert von _X_ am So 16. Mai 2010, 19:43, insgesamt 1-mal geändert.
-
- Beiträge: 2013
- Registriert: Do 16. Okt 2008, 10:22
- OS, Lazarus, FPC: Linux,Windows,FreeBSD,(MSEide+MSEgui 4.6,git master FPC 3.0.4,fixes_3_0)
- CPU-Target: x86,x64,ARM
Re: Linux - Wie Tastendruck an anderes Fenster?
Noch ein Tip:
Ich würde eine eigenes Testprogramm als Empfänger schreiben, wo du die eintreffenden X-events mit dem Debugger beobachten kannst. Falls du MSEgui verwenden möchtest, setze einen breakpoint in lib/common/kernel/i386-linux/mseguiintf.pas in die funktion gui_getevent() nach xnextevent(), in der SVN trunk Version in Zeile 5368, dort laufen alle Xevents durch.
Ich würde eine eigenes Testprogramm als Empfänger schreiben, wo du die eintreffenden X-events mit dem Debugger beobachten kannst. Falls du MSEgui verwenden möchtest, setze einen breakpoint in lib/common/kernel/i386-linux/mseguiintf.pas in die funktion gui_getevent() nach xnextevent(), in der SVN trunk Version in Zeile 5368, dort laufen alle Xevents durch.