1,066
questions
0
votes
0
answers
18
views
X11/Xlib - how gnome window menu (alt + space) work?
I develop X11/Xlib application on Ubuntu 20.04. When I press alt+space Gnome creates a window menu over my window. That window is not accessible, for example the following command doesn't show it:
...
0
votes
2
answers
41
views
How to handle Compound Text Encoding in X11 library?
I am getting window title in Xlib using "WM_NAME" window property, and I have discovered that there is different string types that the property returns. For string type there is "...
0
votes
0
answers
54
views
Disable/enable control in X11/xlib
I am working on linux with xlib and am unclear on how to disable a control. This is a common pattern in GUI development where you enable/disable controls on a window based on certain conditions.
I've ...
0
votes
0
answers
38
views
How to filter out staled events using XLib?
Inside a function I want to make a request to the X server (by calling some XLib function) and wait for the reply. But the reply may never happen under certain circumstances, for example, if a ...
2
votes
0
answers
30
views
How to grab Alt key without swallowing it?
I'm implementing Alt-Tab functionality for i3wm. To do so, I'm writing a Python3 program communicating with i3 using the i3ipc package.
I use the Xlib package to grab "Alt-Tab", so my ...
0
votes
1
answer
70
views
XQuerytree returns wrong number of child windows
I am trying to get the number of top level windows aka children of the root window in Xlib using XQuerytree.
It is just working fine when only experimenting with basic X utilities such as Xterm or ...
0
votes
1
answer
29
views
Why xcb_poly_segment doesn't draw to the pixmap?
I'm trying to make a simple xcb program to learn the basics and hopefully use it in another projects, but i encountered a strange problem. Having created a pixmap i can draw to it with the ...
0
votes
0
answers
23
views
How do I make a 3D representation of a 2D matrix with a z value on each element
I am working on the 42 school project FdF that is a computer graphics related project that uses an API for the Xlib named minilibx (linked below if you want to check out) and need to make a 3D ...
1
vote
1
answer
37
views
X11/Xlib - how to intercept minimizing/restoring a window
I can check if a window is minimized when handling PropertyNotify event using _NET_WM_STATE_HIDDEN atom. Here is an example. That is too late in my case. I would like to intercept minimize/restore ...
2
votes
1
answer
63
views
How is this dwm source code snippet not throwing an error?
Following the dwm source code from main(), inside checkotherwm
xerrorxlib = XSetErrorHandler(xerrorstart);
, with xerrorxlib defined as
static int (*xerrorxlib)(Display *, XErrorEvent *);
, sets ...
2
votes
0
answers
71
views
Black flickering in C XLib on resize
I wrote a program that renders to XLib window in 60fps.
When i resize the window, XLib seems to clear the window to black and the effect lingers before it is time for my 60fps render cycle to repaint ...
0
votes
1
answer
64
views
Why does the while loop not work without the XPeekEvent call?
Title says it all.
The code works with the XPeekEvent right before the while XCheckTypedEvent but without that the conditional evaluates to false and I have no idea why that might be.
#include <X11/...
-2
votes
1
answer
72
views
how to scale a window with Xlib?
How to scale a window with Xlib ? I have search it in search engines. And almost all answer is to resize window. chatgpt answer me that scale with opengl. but its demo not work at all.
0
votes
0
answers
31
views
Virtual key not working in Gnome terminal with XLib
I have an application written in C that prints any key. If I have an active window with an editor such as Notepad, the key works, if I have an active window with Gnome Terminal, nothing is written. ...
1
vote
0
answers
37
views
Mapping Xlib to WinApi - how to check which keys are pressed
In my Linux application I can check which physical key is pressed using the following code:
int min_code = 0;
int max_code = 0;
char keys[32];
XDisplayKeycodes(dpy, &min_code, &max_code);
...
0
votes
0
answers
31
views
X11: Fake XInput clicks on a covered Gtk app
I have a window that listens for XInput events and conditionally forwards them to the window behind it. This works with basic X11 events as I can construct them, but Gtk applications (e.g. caja) ...
0
votes
0
answers
68
views
XQueryKeymap - how to calculate an index for the key
I have an array with some key symbols, for example:
KeySym keySymbols[] = {XK_Escape, XK_Return, XK_A};
I would like to check if those keys are pressed using XQueryKeymap. I have found an answer here,...
0
votes
1
answer
39
views
First event after window creation - XCreateWindow
I would like to perform some action when handling the first event after window creation - XCreateWindow. Events are obtained using XNextEvent function. I can use a bool variable to handle it but I ...
0
votes
0
answers
27
views
Can I use Xlib in service?
I am writing a C++ program that will run as a service in ubuntu. In it I need to use the Xlib library to manage the X session. But because I'm running the program as a systemd service, it doesn't have ...
0
votes
1
answer
51
views
XCreateWindow - parent argument implications
When I create a main window of my X11 application I specify a root window as a XCreateWindow parent argument. My application allow to open a dialog boxes, for example "Open File" window. ...
0
votes
1
answer
71
views
how to use fallback font to draw text with xlib/libxft?
How to use fallback fonts to draw text with xlib/libxft ?
For example, when drawing a string, the current font does not contain certain characters, but another font does. So, how to use fallback fonts ...
0
votes
0
answers
27
views
Xrandr making DisplayWidth() return incorrect value?
I'm beginning to work on a window manager in X using xlib. My window manager is called Bonsai and I am running DWM for my own use.
For running both of these I have an xinit file (.xinitrc for dwm and ....
1
vote
1
answer
45
views
Xlib Window Manager: Closing Focused Window Causes Unexpected Shutdown
i wrote a simple window manager using Xlib. the window manager runs, and launching a terminal with the Super+t shortcut works correctly. however, when i attempted to close the focused window by ...
0
votes
1
answer
133
views
freetype with xft and xlib, changing the font size does not work
The code below creates a window with xlib, uses a font on the screen with freetype and configures it with xft, the problem is that the code does not change the font size, it always stays static at the ...
2
votes
0
answers
52
views
It is safe to use stdlib allocator functions with XLib allocations (those requiring `XFree`)
Just wondering whether it's okay to use standard allocator functions (in this case realloc) in a portable XLib application? From what I can see the XLib source just defines XFree to free but I'm not ...
1
vote
1
answer
107
views
XInput 2 Error with RawMotion (BadValue on XISelectEvents with higher values)
I'm writing a pure Xlib app and want to use XInput2 extension for RawMotion events. The problem appears if I use XISelectEvents when I set the mask with any XI2 event higher than XI_PropertyEvent. So, ...
0
votes
0
answers
47
views
Buggy Xlib window manager destroys contextual menus
I'm writing a minuscule window manager using Xlib. So far, it does all I expected. However, it has a bug, where contextual menus in Chromium disappear. This starts to happen immediately after closing ...
2
votes
1
answer
225
views
Counting mouse buttons X11 Linux
This is my first question, but I am really lost and I need your help. I am writing a program in C, that prints out amount of buttons a mouse. I decided to use XI.h for this matter. The program behaves ...
0
votes
1
answer
236
views
Strange problem with X11 positioning of the windows and window manager interactions
I have a Linux, X11 application with main window (W0) and floating tool/palette window (Wt).
Wt must to be always above the W0 and when displayed for the first time it must appears in the upper-right ...
1
vote
0
answers
122
views
How can I use XFilterEvent?
I have seen many examples with the same way of creating IC and using XFilterEvent function:
XSetLocaleModifiers("@im=none")
im = XOpenIM(dpy, 0, NULL, NULL);
if(im)
{
ic = XCreateIC(im,...
0
votes
0
answers
48
views
Got wrong pictures while saving ZPixmap to png
I want to intercept the damaged region image of the client in ProcShmPutImage of xserver. I can confirm that the image is in Zpixmap format with a depth of 24 and bits_per_pixel is 32. I use the ...
0
votes
1
answer
78
views
For xlib, how to create a child window with the background pixel or pixmap of its parent window?
I want to create a child window with the background pixel or pixmap of its parent window. But i can not find refer Xlib API. The workaround I can think of is this: create a child window first, and ...
0
votes
0
answers
244
views
Opaque elements in transparent window in Xorg
I am developing a simple X11 application with cairo and xcb.
I was wondering if there is any way to to put fully opaque elements (for example icons) in a window with a transparent background.
For the ...
0
votes
1
answer
130
views
X11 - handling XSelectionRequestEvent after calling XSetSelectionOwner
I implement clipboard handling in my X11 application. The first step of a copy operation is calling XSetSelectionOwner:
Atom clipboardAtom = XInternAtom(display, "CLIPBOARD", False);
...
0
votes
1
answer
108
views
How do I generate an X11 geometry string using Xlib?
I know you can parse them using XParseGeometry, but I also need to generate them.
Are there any built in or external functions that could do this for me?
I tried to make my own function that does this,...
0
votes
1
answer
159
views
Change background color of x11 window in C xlib after window is created?
Almost this very same question has been asked here:
Change Xlib window background color with C++
But in that anwser it only tells how to set the bg color in the initial setup. I would want to change ...
0
votes
1
answer
196
views
How to get Num Lock and Scroll Lock status
In my X11 C++ application I need to check modifier keys status. Caps Lock status can be get using XkbGetIndicatorState, here is an example. How to get Num Lock and Scroll Lock status ?
0
votes
1
answer
68
views
XGetWindowAttributes doesn't return a correct window location
I have implemented a basic x11 window application. After moving a window using mouse XGetWindowAttributes always returns the same window location (x and y from XWindowAttributes struct). Calling XSync(...
1
vote
0
answers
41
views
XLib/X11 don't fire KeyPress event on upper Unicode ranges
Good day.
For Asian languages GUI we need hundle KeyPress event type for upper Unicode ranges.
For now we was able to hundle keyboard input up to 0x0600 (arabian language range) only.
We test this ...
2
votes
1
answer
76
views
UTF-8 input and using XGetICValues
I have found an example (accepted answer) of UTF-8 input but I wonder if that example is correct. The result of XGetICValues may be passed to XSelectInput:
unsigned long mask = 0;
if (!XGetICValues(...
1
vote
1
answer
128
views
Why is MapNotify sent too early in xlib
I am using xlib for the first time in C, not C++. I want to draw a test box to the screen but I have to wait for xorg to create the window. I have a callback for MapNotify which is called to early. I ...
0
votes
0
answers
74
views
How to free memory returned by glxChooseFBConfig?
glxChooseFBConfig returns GLXFBConfig* and GLXFBConfig is defined this way:
typedef struct __GLXFBConfigRec *GLXFBConfig;
Here is an example function which uses glxChooseFBConfig and frees memory:
...
2
votes
3
answers
168
views
Sharing colormap between windows
I create a x11 window using XCreateWindow function. I create colormap this way:
XSetWindowAttributes attribs = { 0 };
Colormap cmap = XCreateColormap(dpy, rootWindow, visualInfo->visual, AllocNone);...
0
votes
0
answers
346
views
why would vulkan graphics not work despite vulkan compute working?
When I run vkcube, I get this:
Selected GPU 0: NVIDIA GeForce RTX 4070, type: DiscreteGpu
Could not find both graphics and present queues
But when I run vulkaninfo --summary, I get this:
==========
...
0
votes
0
answers
1k
views
How to build libx11-dev from source?
I have a stupid question.
I'm trying to install the 32-bit development packages of Xlib on a 64-bit CentOS machine, for which I don't have root. Therefore, I'm thinking of compiling myself from the ...
0
votes
0
answers
80
views
Why is Xlib's Display.record_create_context() method not suggested by Visual Studio Code's code completion feature?
I am trying to understand interface interactions in Python. To start off, I have tried to deconstruct a simple mouse-cursor-hiding program found here:
https://github.com/eazar001/mousetrap
Here is the ...
0
votes
1
answer
39
views
How to determine whether a window has an embedded title bar?
I'm writing a window manager with xlib. I want to implement the following functionality: If a window has embedded titlebar, then window manager won't add WM titlebar for this window. So I'm wondering ...
1
vote
2
answers
92
views
What is the CARD variable type in XRANDR?
Edit2:
Just to make it clear, integers are what I originally entered into the program. My original code, before I started testing anything, was this:
import struct
from Xlib import X, display, Xutil
...
0
votes
1
answer
76
views
Xlib EnterNotify event not generated when expected (dwm)
I am running the 'dwm' tiling window manager. In another virtual terminal I have attached gdb to dwm using sudo gdb -p $(pidof dwm) and I have set a breakpoint on the enternotify function (b ...
1
vote
0
answers
120
views
XLib, memory leak when loading specific font string
When I try to load a font in Xlib via XLoadQueryFont with the following font name "fixed", the program does not leak, and everything is freed in the end.
When I try to load another font, the ...