Questions tagged [xlib]

Xlib is a library used to communicate with X11 servers. This is the library that widget toolkits like GTK+, Qt, and Motif use to draw their graphics, and it's considered to be low-level.

Xlib is a library used to communicate with X11 servers.

This is the library that widget toolkits like GTK+, Qt, and Motif use to draw their graphics, and it's considered to be low-level. If you're looking for a high-level GUI toolkit, you're better off looking at those toolkits instead of using Xlib directly.

Xlib was first developed in 1985. The newer XCB library is intended to replace Xlib and take over its functions, but currently very few programs use XCB.

1036 questions
8
votes
3 answers

How do we simulate a mouse click with Xlib / C?

I want to find C / Xorg code to 'enter' a left mouse button click. I'd expect a single line of code but the only things I've found written in C are about two dozen lines long and they don't work anyway :( It seems it can be done in Windows, but I'm…
Ray Andrews
  • 532
  • 4
  • 14
8
votes
1 answer

Draw border (frame) using xlib

Is it possible to draw transparent window without title bar, close button, responses on mouse buttons using xlib. So just border with specific color and width? Something like this orange rectangle is what I need to create. Also I'd like to have…
rudolfninja
  • 467
  • 7
  • 24
8
votes
1 answer

Capture Button Events in Xlib then passing the Event to the client

I'm working on a window manager, mainly as an exercise, and I'm facing a problem. I would like to be able to raise the clicked window to the top of the stack. Currently, I am using XGrabButton on Button1 and ControlMask to allow for moving of…
EthanS
  • 115
  • 7
8
votes
4 answers

Window position in Xlib

How to get top-level window position relative to root window (i.e. whole screen) using plain ol' xlib (or brand new XCB)?
8
votes
1 answer

Where are some good Xlib programming guides?

I'm a little confused on Xlib programming now. I started to use dwm (a lightweight window manager) a few weeks ago, and I'd like to pickup some Xlib programming books or online resource to customize the dwm. However, after Googling around the web,…
Patrick
  • 4,186
  • 9
  • 32
  • 45
8
votes
1 answer

Redirect Keyboard input with XGrabKey or XGrabKeyboard

Goal I want to redirect the keyboard input to different windows depending on the key. Not all the key will be redirected to the same window, I can't use XSetInputFocus. First Attempt : XGrabKey I found that I can grab certain keys and then send an…
Heckel
  • 428
  • 9
  • 23
8
votes
1 answer

Get UTF-8 input with X11 Display

I've been trying and reading lots of resources on the internet, trying to find a way to get an UTF-8 keyboard (composed) input from a X Display. But I could not make it work. I have tried the example code from this link (exaple 11-4), but no…
thiagobl
  • 83
  • 1
  • 3
8
votes
1 answer

globally capture, ignore and send keyevents with python xlib, recognize fake input

i want to implement key chording on a normal keyboard and i thought i use python xlib. for this to work the program has to globally swallow all keyevents and only later allow them to go through. my current test just grabs the "1" key. if this key is…
tino
  • 518
  • 5
  • 18
8
votes
2 answers

how to get a screen pixel's color in x11

I want to get the RGB value of the top/left pixel (0;0) of the whole x11 display. what I've got so far: XColor c; Display *d = XOpenDisplay((char *) NULL); XImage *image; image = XGetImage (d, RootWindow (d, DefaultScreen (d)), x, y, 1, 1,…
nonchip
  • 1,084
  • 1
  • 18
  • 36
8
votes
4 answers

Get window position and size in python with Xlib

I need to find window position and size, but I cannot figure out how. For example if I try: id.get_geometry() # "id" is Xlib.display.Window I get something like this: data = {'height': 2540, 'width': 1440, 'depth': 24, 'y': 0, 'x':…
Lissanro Rayen
  • 582
  • 8
  • 17
8
votes
5 answers

How to fix this script so that it won't peg the CPU?

On my home Kubuntu machine, I am running a script to beep on every keypress, no matter which window or application has focus, adapted from this insightful page #!/usr/bin/env python from Xlib.display import Display import os import…
dotancohen
  • 30,064
  • 36
  • 138
  • 197
8
votes
2 answers

What is wrong with my X11 code?

I am attempting to get the X Window at a certain location on screen. When I asked people for a function to do this, they said you would just call XQueryTree recursively. This is the code snippet which I think is somehow wrong. When I debug it, it…
Jeremy Salwen
  • 8,061
  • 5
  • 50
  • 73
8
votes
2 answers

Embedding QWidget into X11 Window

I want to embed two QWidgets into a window created using XLib. I have written this code: // Assume all the necessary headers included int main(int argc, char *argv[]) { QApplication app(argc, argv); // Create widget 1 QWidget widget1 ; …
Amit Tomar
  • 4,800
  • 6
  • 50
  • 83
7
votes
2 answers

X11 Mouse Movement Event

When creating a Window in XLib What are the masks I provide to the SetWindowAttributes.event_mask member? What do I have to pass to the 11th paramater of XCreateWindow() What are the Events I am looking for in the main message loop (Where I use…
Matthew Hoggan
  • 7,402
  • 16
  • 75
  • 140
7
votes
3 answers

XFetchName always returns 0

im trying to write a C code to get the title of the Active Window in my Linux System, but the Function XFetchName always returnes zero, i also tried XGetWMName, same result... but using xprop, i can see that there is a string in the "WM_NAME"…
killercode
  • 1,666
  • 5
  • 29
  • 42