xlib

What does XCloseDisplay return?

▼魔方 西西 提交于 2020-01-15 20:17:51
问题 I can see from various documentations that XCloseDisplay returns an integer, which I suspect to be an error code. What should I do with this value? Is it an error code? If so how do I handle the error? 回答1: I looked in the source code ( lib/X11/ClDisplay.c ) It says: return 0; So there's nothing you can really do with the return value. 来源: https://stackoverflow.com/questions/23083523/what-does-xclosedisplay-return

What does XCloseDisplay return?

烈酒焚心 提交于 2020-01-15 20:17:49
问题 I can see from various documentations that XCloseDisplay returns an integer, which I suspect to be an error code. What should I do with this value? Is it an error code? If so how do I handle the error? 回答1: I looked in the source code ( lib/X11/ClDisplay.c ) It says: return 0; So there's nothing you can really do with the return value. 来源: https://stackoverflow.com/questions/23083523/what-does-xclosedisplay-return

xlib - print event name

主宰稳场 提交于 2020-01-06 03:33:10
问题 So I have a standard window created with xlib that handles events: while (keep_running){ XNextEvent (display, &event); printf("event\n"); } Now it doesn't seem to be calling the expose event, so I'm not able to draw in the window. I can see by the print statement that there are some events being fired, and I'd like to know what events they are. So basically my question is, how can I get the event name to print it? I'm still learning C, so any help is appriciated! 回答1: so I don't totally agree

Xlib: Create window in mimized or maximized state

非 Y 不嫁゛ 提交于 2020-01-04 03:03:23
问题 Is it possible to create a Window in maximized or minimized state with Xlib? If so, how would I go about doing that? 回答1: Something like this; XEvent xev; Atom wm_state = XInternAtom(dpy, "_NET_WM_STATE", False); Atom max_horz = XInternAtom(dpy, "_NET_WM_STATE_MAXIMIZED_HORZ", False); Atom max_vert = XInternAtom(dpy, "_NET_WM_STATE_MAXIMIZED_VERT", False); memset(&xev, 0, sizeof(xev)); xev.type = ClientMessage; xev.xclient.window = win; xev.xclient.message_type = wm_state; xev.xclient.format

XPending cycle is making CPU 100%

↘锁芯ラ 提交于 2020-01-03 19:06:10
问题 Good day! I have a little bit of troubles making a xlib project. Here is the structure of my project: [ Init ] [ Making some stuff ] [ Creating a timer thread (see code below) ] [ Main cycle (see code below) ] When the user presses any button, I set the flag in the thread to true-like value and it starts to send CustomMessage to the window every n time. while (warehouse.destroyflag != SML_DEAD) { if (XPending(warehouse.display)) { XNextEvent(warehouse.display, &event); But there is a bit of

X11 non-clipped child windows

时光毁灭记忆、已成空白 提交于 2020-01-03 17:31:28
问题 Does X have the notion of non-clipped child windows? The behavior in Windows and OSX for these is: the parent always stays behind its children the children are closed automatically when the parent is closed the children follow the parent when moving If the answer is no, then I can emulate 2 and 3 but how about 1? Thanks, Cosmin. 回答1: The closest thing to overlapped non-clipped child windows in X is the window property WM_TRANSIENT_FOR. This will create a window that: will not appear on the

In Xlib, How can I animate until an event occurs?

◇◆丶佛笑我妖孽 提交于 2020-01-02 18:04:18
问题 I've been trying to animate in a C program using Xlib and I wanna do something when an event occurs, otherwise I wanna keep animating. Here's an example code snippet of what I am doing currently: while( 1 ) { // If an event occurs, stop and do whatever is needed. // If no event occurs, skip this if statement. if ( XEventsQueued( display, QueuedAlready ) > 0 ) { XNextEvent( display, &event ) switch ( event.type ) { // Don't do anything case Expose: while ( event.xexpose.count != 0 ) break; //

Excluding some keys from XGrabKeyboard

时间秒杀一切 提交于 2020-01-01 10:52:38
问题 Consider an application where it's desirable to grab the keyboard when focused in order to capture all window manager commands (Alt+F4 and whatnot) for processing. Now, this has the downside that the user has no way of switching to another application or virtual desktop via the keyboard when the keyboard is grabbed. I'd like to have a user-defined whitelist of key combination (say, the key combinations for switching virtual desktops) that are excluded from the grab. I can think of two

Explanation of Header Pixel in GIMP created C Header File of an XPM image

对着背影说爱祢 提交于 2019-12-31 01:25:53
问题 In GIMP, you're able to save an image as a C header file. I did so with an XPM file, which looks like the image below: If I were to save the XPM image as a C header file, GIMP will output this C header file. In order to process each pixel of the given image data, the header pixel is called repeatedly. What I don't understand is what the header pixel does to process the data in the first place. #define HEADER_PIXEL(data,pixel) {\ pixel[0] = (((data[0] - 33) << 2) | ((data[1] - 33) >> 4)); \

Xlib test window names

最后都变了- 提交于 2019-12-30 07:49:15
问题 I'm trying to get control of the the Xterm with Xlib. For that i'm making a Xterm with a strange title. After I list all window and check they names. But something is bugged the nammes of my Xterm does not appear when they are listed. Here is the code for list all window : void CMD::getWindowTerminal() { Atom a = XInternAtom(m_display, "_NET_CLIENT_LIST", true); Atom actualType; int format; unsigned long numItems, bytesAfter; unsigned char *data = 0; int status = XGetWindowProperty(m_display,