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
62
votes
3 answers

Xlib and Firefox behavior

I'm trying to create a small window manager (just for fun), but I'm having problems in handling windows created by Firefox (only with that application, other apps works fine) The problem is, after I launch Firefox, and add my decoration, it seems…
Ivan
  • 4,186
  • 5
  • 39
  • 72
60
votes
10 answers

How do I efficiently determine if a polygon is convex, non-convex or complex?

From the man page for XFillPolygon: If shape is Complex, the path may self-intersect. Note that contiguous coincident points in the path are not treated as self-intersection. If shape is Convex, for every pair of points inside the polygon, the…
hhafez
  • 38,949
  • 39
  • 113
  • 143
46
votes
2 answers

How do I gracefully exit an X11 event loop?

Almost every tutorial I find tells me to do this for my event loop: XEvent event; while (true) { XNextEvent(display, &event); switch (event.type) { case Expose: printf("Expose\n"); break; …
TheBuzzSaw
  • 8,648
  • 5
  • 39
  • 58
42
votes
8 answers

Why XGrabKey generates extra focus-out and focus-in events?

Does anyone know an xlib function to trap a keypress event without losing the original focus? How to get rid of it? (or "to use XGrabKey() without generating Grab-style focusout"?) (or "How to get rid of NotifyGrab and NotifyUngrab focus events at…
diyism
  • 12,477
  • 5
  • 46
  • 46
35
votes
3 answers

Global Hotkey with X11/Xlib

My goal is to have a program that sleeps in the background but can be activated by the user via some "hotkey". From digging around the Xlib manual and the Xlib O'reilly manual, I gather that the correct way to to this is with XGrabKey. However my…
cheshirekow
  • 4,797
  • 6
  • 43
  • 47
34
votes
4 answers

how to quit the blocking of xlib's XNextEvent

Under windows, the GUI thread usually call GetMessage to waiting for message, when another thread use PoseMessage put a message into the queue, then the GUI thread will return GetMessage (quit blocking). Does anyone can tell me, when I use…
Tom Wong
  • 343
  • 1
  • 3
  • 4
31
votes
3 answers

How do take a screenshot correctly with xlib?

I am trying to capture an image of the screen for use in screencasting. Thus I need a fast solution, and cannot rely on shell programs such as import or xwd. This is the code I have written so far, but it fails and gives me a junk image, which just…
user406009
25
votes
5 answers

What do I need to do to link with xlib?

I am using GCC, what switches do I need to add to link with Xlib? After searching, all I could find was -lX11, but that gave me ld: library not found for -lX11 I am using a mac (10.6), but I would not like anything that is Mac specific.
Jeffrey Aylesworth
  • 8,242
  • 9
  • 40
  • 57
24
votes
1 answer

Reducing input latency when working with X

I've been reading a few articles about input latency lately: https://danluu.com/term-latency/ https://pavelfatin.com/typing-with-pleasure/ And I've been trying to improve the user experience of my small text editor. I was using SDL to pool input and…
vinnylinux
  • 7,050
  • 13
  • 61
  • 127
20
votes
1 answer

How to wait for VSYNC in Xlib app?

I am drawing something on screen using XWindow Drawable, Pixmap, and XRender. I can see that sometimes there is flicker. Is there a way to wait for VBLANK? I googled a lot already, feels like looking for a coin in a forest. There is NO OpenGL…
exebook
  • 32,014
  • 33
  • 141
  • 226
20
votes
9 answers

Getting pid and details for topmost window

Does anyone know how to get the PID of the top active window and then how to get the properties of the window using the PID? I mean properties like process name, program name, etc. I'm using Qt under Linux (Ubuntu 9.10).
user247991
  • 219
  • 1
  • 2
  • 4
18
votes
2 answers

Modern ways to write a window manager

I'm trying to write a window manager. (Actually, I have written an OS and a compiler, but that's beside the point.) XLib and xcb aren't exactly nasty, at least not by, say, win32 standards, but they are definitely very old and don't lend themselves…
David Given
  • 13,277
  • 9
  • 76
  • 123
18
votes
3 answers

How to properly configure xstartup file for TightVNC with Ubuntu VPS GNOME environment

I'd like to access my Ubuntu 16.10 VPS (Contabo) with using a GNOME environment with VNC, however I am still facing some issues that I couldn't solve so far. To install and configure the software I ran the following commands: sudo apt-get install…
Matthias Munz
  • 3,583
  • 4
  • 30
  • 47
17
votes
5 answers

Get monitor count and resolutions in Python without xrandr command line tool

I'm running Ubuntu and I want to get the number of attached monitors, their current resolution and, if possible, their position in relation to each other. Because I don't like parsing Console output of the xrandr command line tool—at least not if I…
Wolkenarchitekt
  • 20,170
  • 29
  • 111
  • 174
17
votes
4 answers

How do you exit X11 program without Error

I have a fairly simple "Hello World" in X11 at end of question. But when it exits I get the run time error messages below: $ ./xtest XIO: fatal IO error 11 (Resource temporarily unavailable) on X server ":0" after 9 requests (7 known…
Joe McGrath
  • 1,481
  • 10
  • 26
1
2 3
68 69