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.
1,018
questions
1
vote
1
answer
42
views
Displaying image with alpha channel in x11 window
I've created a window with a transparent background and can make it borderless but first, I want to display an image that is just uint32* in it. However, I got this error message below.
When I try ...
0
votes
0
answers
3
views
XwcLookupString cause progress crash when switch Input Method or restart Input Method
Based on the debian operating system, when using the XwcLookupString function provided by Xlib, if the input method is switched or restarted when the window is opened to input text, the ...
0
votes
1
answer
34
views
How to select and resize an Xlib font?
I am making a cross-platform graphics library (please don't ask why I am re-inventing the wheel) and want to add something I thought was simple: changing the size of fonts. Before, my Expose event ...
0
votes
1
answer
48
views
How to subscribe to X11 events in Haskell?
I tried mimicking this Python solution in Haskell using XMonad's X11 library, but unfortunately my code just hangs and does not react when I trigger events by switching focused windows:
disp <- X11....
0
votes
1
answer
15
views
Xlib Sending Characters to Text Editor
I am testing some features of X, and using Xlib to manipulate X.
The problem is I cannot send some basic characters to text editor. My purpose is sending those characters via Xlib's XSendEvent() ...
0
votes
1
answer
29
views
Is reading a X11 Property of type UTF8_STRING guaranteed to end with NULL?
I have the following code:
static Atom _NET_WM_NAME = XInternAtom( display, "_NET_WM_NAME", false );
unsigned char* wm_data = NULL;
Atom wm_type;
int wm_format;
unsigned long wm_nitems, ...
0
votes
0
answers
41
views
How do you run a portion of a python script that requires superuser privileges, while the rest does not?
I'm trying to make a script that will detect the color of a pixel, and have a keybind (say F5) to trigger this action.
The pixel scan portion can be done with something like this (put together from ...
2
votes
1
answer
205
views
BadWindow (invalid Window parameter) when trying to close a Display in X11
I am writing in x86-64 NASM assembly and I wrote a function to close a window using X11 on Ubuntu via WSL
I keep getting this error:
X Error of failed request: BadWindow (invalid Window parameter)
...
0
votes
0
answers
23
views
Python-xlib: simulate Unicode KeyPress Event
I want to type Arabic character into an inactive window
the following code works when writing ASCII characters. eg: English character
from Xlib.display import Display
from Xlib.protocol.event import ...
0
votes
0
answers
23
views
Linux-- How do I force my custom cursor to take priority in a remote server?
I use GeForce Now Cloud Gaming to game.
I also have vision issues in one eye.
In windows I use a cursor app called CursorNode.
With GeForce Now when you start it it take over your mouse and switched ...
0
votes
0
answers
56
views
How to unset a fullscreen display on X11
I got a x11 fullscreen window working, but I can't exit it. I don't understand why there are so many answers about entering fullscreen mode but none about leaving it.
I used this code to set ...
0
votes
1
answer
44
views
How can I use XCopyArea with colors other than blue in Xlib?
I'm trying to build a ray tracer in C++. To that end, I'd like to draw the final image to a window (instead of just outputting to PPM, which is what I'm currently doing). I have some code below that ...
0
votes
1
answer
60
views
X11 sending wrong key presses
I am making a simple xlib wrapper for recreation, but I am having a problem with X11 since I activated WSL: At the start of some programs, it starts sending a specific key press event and when I press ...
0
votes
1
answer
37
views
Drawing to an existing image with X-window
I am using X-window (X11) to render 2D graphics (lines, circles, text...). But rather than drawing to a window, I need to draw to an existing bitmap image. Is there a way to achieve this ? If yes, are ...
-2
votes
1
answer
56
views
How do I handle non US keyboard layouts with Xlib and xkb?
I'm using a Swedish keyboard layout and can't get access to many keys such as the bracket keys since I have to press AltGr to get access to them. I'm using the XkbKeycodeToKeysym to translate keycodes ...
0
votes
0
answers
17
views
Is it okay to redirect `XK_KP_Begin` as `XK_Clear` in user implementations?
The numpad key 5 seems to be mapped to XK_KP_Begin by default when num lock is off. And winapi seems to map this key to VK_CLEAR. What is the purpose of XK_KP_Begin? It seems similar to XK_KP_Home if ...
0
votes
0
answers
52
views
How to change a mouse cursor image for all windows?
I am trying to change a mouse cursor for the entire system (for each window on a display) with the help of XCursor and XInput2.
In the code below, the cursor changes. However, only for browser window ...
0
votes
0
answers
131
views
X11 virtual desktops: which are visible?
My Python program uses Xlib and Gtk3 and runs in an X-session with the window manager i3. I have 3 (real) monitors in this setup. i3 provides virtual desktops (and many other window managers behave ...
1
vote
2
answers
78
views
What is the difference between python-xlib, python3-xlib, pyxlib and xlib in Python3?
I individually installed (and posterior uninstalled):
python-xlib
python3-xlib
pyxlib
xlib
via pip (un)install and could execute
from Xlib import X, display, Xutil
from Xlib.ext import randr
d = ...
0
votes
1
answer
65
views
X11 Shift + Tab keysym?
How to detect Shift + Tab in Xlib? I'm able to match KeySym with XK_Tab, but it's not matching while holding shift to then check for ev->state & ShiftMask, so I'm kind of lost.
SOLUTION:
Thanks ...
1
vote
0
answers
146
views
Linux Crontab Python script error: "Authorization required, but no authorization protocol specified"
let me explain the problem in detail:
I have a Windows 10 desktop, from which i connect via RDP (same LAN) to a laptop running Kali Linux 2022.3.
On this laptop, i have Conda and Spyder for developing ...
1
vote
1
answer
61
views
Context menu does not consistently work on arch linux?
I am using arch linux and a basic cpp xlib custom window manager. However, every time I right click to open the context menu it just flickers and disappears. I cannot use it at all. I also cannot use ...
0
votes
0
answers
20
views
How to stick window to left half part of screen?
I am using xlib to set window to certain position using XMoveResizeWindow function
All works fine, but when I want to 'stick' my window to left part of screen, I get the wrong position and size: there ...
0
votes
0
answers
34
views
How to draw a selected part of one surface above another image surface?
I want to draw the area of one surface above another surface, but nothing appears on the screen. I want to create area selection mechanics for making a screenshot. That means that I should clear the ...
0
votes
2
answers
117
views
Is there a way to create GLX context after Xlib's window creation?
I'm trying to create OpenGLx context after the Xlib's window creation. I'm trying to separate the Xlib window creation and opengl context creation into two different phases.
Win32 window-opengl ...
0
votes
1
answer
100
views
X11 without backing store
I need to test an X11 application for its behavior when the X server does not use a backing store for the application's windows (see https://tronche.com/gui/x/xlib/window/attributes/backing-store.html)...
0
votes
1
answer
69
views
Getting the current GLXFBConfig in GLX
I can trivially get visuals, visual IDs, etc. when generating an OpenGL context using xlib, but OpenXR requires a GLXFBConfig in order to work. But I can't figure out how to get the GLXFBConfig for ...
0
votes
1
answer
33
views
Cant fin definition of XMapWindow() in Xlib headers
So i have this simple code that draws a small window using X11
int main(int, char*[])
{
Display* display = XOpenDisplay(NULL);
Window window = XCreateSimpleWindow(
display, ...
0
votes
0
answers
43
views
Chromium and Firefox reading the clipboard twice on paste on X11
On X11, the clipboard works by the application acting as a server for the clipboard data to other apps. I want to make use of this, by writing a program that can copy some text to the clipboard, which ...
0
votes
1
answer
77
views
How to detect in Linux an event when an expected window position appears when a window is dragged to one of the screen borders
How to programmatically detect in Linux via C/C++/Xlib an event when an expected window position appears when a window is dragged to one of the screen borders (such as shown in the picture).
Tried ...
3
votes
0
answers
158
views
X11/Xlib: Grab key events and then pass them to sub-windows
I'm tinkering with X11 using Go and Xlib (using cgo) and I'm trying to program basic window management functionalities, but I'm having problems with input management (keyboard in this case).
So far I'...
2
votes
1
answer
132
views
How to get a list of windows in X11 with Go
I would like to get a list of windows + window names of all open windows in X11 using go. I assume that the xgb package would be used.
1
vote
1
answer
232
views
How to get the active window using X11/Xlib c api?
I cannot find in the The Xlib Manual how to get the active window?
Is it the "focus window" that I obtain using XGetInputFocus?
Or should I query the root window property _NET_ACTIVE_WINDOW?
...
0
votes
0
answers
53
views
How can I create a bitmap and draw it from an array of pixel colors in Xlib?
I tried following many questions and answers online on this topic but I was never able to draw the buffer to the screen in a form of an array. I found people were creating visuals but I have no idea ...
1
vote
0
answers
30
views
Xlib. How to make XGrabButton not consume click?
First question so please forgive me if I am neglecting a requirement here.
I am attempting to build a window manager for arch linux. Currently, I am adding grab events before mapping a window.
I have ...
1
vote
1
answer
40
views
Pointers returned by xlib don't match any existing window IDs
I'm using some X11 bindings to query some window information and later pass it to FFmpeg. FFmpeg expects a "window ID" given in hexadecimal notation.
This notation seems somewhat standard, ...
0
votes
0
answers
22
views
Is there any reason to do xflush and xsync consecutively?
I'm looking through the source code of an x11 background manager, and I found these two lines towards the end of the code (@ line 585):
XFlush(display);
XSync(display, false);
I'm confused, because ...
0
votes
1
answer
32
views
How to make a window remain a separate window when reassigning the parent using the Xlib function XReparentWindow()?
I'm trying to assign a parent to a window using the function XReparentWindow(), but after that my window becomes part of the parent window, it ends up being drawn into the parent window.
void ...
0
votes
0
answers
95
views
linux X11, how to create transparent and insensitive to events window, non-dependant of window manager
Hi everyone! I've created such a window (thanks to X11/Xlib: Create "GlassPane"-Window), that is on always on top, semitransparent, and doesn't consume any events. It works fine on some ...
0
votes
0
answers
103
views
How the drag and drop system works with Xlib in C++?
I am developing an application in C++ with the gui frameworks ImGUI.
My ImGUI backend is GLFW.
I need to create a drag end drop system (between my app and others) for my app but for what I've been ...
0
votes
0
answers
64
views
Send EWMH messages with Qt on X11
How would I send an extended window manager hint using Qt5/6 on X11? I've found an example here but I'm not exactly sure what to do with it.
#include <X11/Xlib.h>
#include <Q11Info>
// ...
0
votes
0
answers
27
views
XUngrabPointer crashes when Display* belongs to another application
Description of problem. App X (e.g. a debugger) launches app Y (say a debugee). At some point Y grabs the mouse and reports its Display* dsp, to X. App X calls XUngrabPointer(dsp, CurrentTime), which ...
0
votes
0
answers
89
views
Displaying two translucent images on each other with XRender
So I was trying to display one translucent farbfeld image on top of another, often opaque farbfeld image (named f2.ff and f.ff in order) with the use of XRender to get the alpha compositing but due to ...
0
votes
0
answers
41
views
C - X11 - Implementing a quick X initiation to use display?
I am trying to start an X server on an arbitrary choice of DISPLAY. My purpose of trying to accomplish this is to initiate a GTK window in that display and control it remotely or forward the X session ...
1
vote
0
answers
749
views
Xlib.error.DisplayConnectionError: Can't connect to display ":0.0": b'Authorization required, but no authorization protocol specified
I'm working on a gui app in docker. It works good on linux host machine but the below error is appearing.
import pystray
File "/usr/local/lib/python3.8/dist-packages/pystray/__init__.py", ...
0
votes
0
answers
53
views
Pyautogui throws pipe error on second request behind web server
I have an python automation running with pyvirtualdisplay behind a fastapi web server. Below is the code:
import pyautogui
import time
@app.get("/")
def root():
with Display(visible=0, ...
0
votes
1
answer
326
views
C GTK - How to set :display.screen for gtk application window to appear
I am using gtk.h for a C application under GNU/Linux and I would like to open my gtk window under a specific display.screen without exporting any environmental variables. The reason I don't want to ...
1
vote
1
answer
55
views
Can gdb debug an inferior that grabs the mouse?
When gdb hits a breakpoint, while inferior has grabbed the mouse, my mouse does not work. Since I use gdb within an IDE, that completely freezes the computer. Hours of search only showed "--...
0
votes
1
answer
117
views
Trouble with XSetSelectionOwner
I have an application in which one opens many windows. I added copy/paste, using XA_PRIMARY.
That works fine within my application. It also works fine when copying from other applications (pluma, ...
1
vote
1
answer
161
views
How to paint bitmap data on a X11 window surface with cairo?
I want to paint bitmap data into a X11 window with cairo-xlib.
I am doing as below, but it does not work.
cairo_surface_t* x11_surface;
x11_surface = cairo_xlib_surface_create(display,
...