x11

Is there any difference with the X11 atoms XA_WM_NAME and “_NET_WM_NAME”?

心已入冬 提交于 2019-12-06 04:14:48
问题 Is there any difference with the atom defined in XA_WM_NAME defined in Xatom.h and the one got using XInternAtom(display, "_NET_WM_NAME", False) ? Edit: I made a little program which prints the integer value of both and I got: _NET_WM_NAME: 312, XA_WM_NAME: 39 , so, they represent different atoms. What are the differences? Thanks. 回答1: They are different atoms, but they both represent the title of the window. _NET_WM_NAME is part of the newer XDG/freedesktop.org window manager spec. Like

How to stop an X11 event loop gracefully asynchronously

你说的曾经没有我的故事 提交于 2019-12-06 03:25:43
I have a small X11 application which has two threads. In one thread, I am listening to X11 events using XGrabKey() and then in a loop XNextEvent() . The other thread is doing other stuff and is not related to X11. Here's the code of the relevant thread: #include <X11/Xlib.h> #include <X11/Xutil.h> #include <X11/XF86keysym.h> #include <stdbool.h> #include <stdio.h> #include <string.h> volatile bool loop = true; void keyGrab(void) { Display *display = XOpenDisplay(0); Window root = DefaultRootWindow(display); int keycode = XKeysymToKeycode(display, XF86XK_AudioPlay); XGrabKey(display, keycode,

How to set mouse cursor on X11 in a C application

与世无争的帅哥 提交于 2019-12-06 02:58:01
I've got a rather large and rather old C application that has been ported to Linux. I'm in charge of getting mouse cursors to work correctly, but having some issues. I was able to convert most of the cursors we require to using the standard cursors provided by XFontCursor by using something like: gCursorTable[waitCurs] = XCreateFontCursor(gDisplay, XC_watch); ... XDefineCursor(gDisplay, WHostWindow(w), gCursorTable[cursor]); XFlush(gDisplay); This is fine for cursors which have analogs in the extremely limited list of (useful) cursors that XFontCursor provides, but there are other built in

xcb keyboard button masks meaning

六眼飞鱼酱① 提交于 2019-12-06 02:47:09
问题 I'm trying to figure what keys are handled by: XCB_MOD_MASK_1 XCB_MOD_MASK_2 XCB_MOD_MASK_3 XCB_MOD_MASK_4 XCB_MOD_MASK_5 in xcb, for XCB_MOD_MASK_1 it seems to be Alt (i'm correct?), but for others button i cannot find the mapping anywhere (i tried to google them before posting, but with no success). So what are the usual key associated to these masks? 回答1: Usually Mask1 is Alt or Meta, Mask2 is Num lock, Mask3 is AltGr, Mask4 is Win, and Mask5 is Scroll lock, but this varies between X

With X11, how can I get the user's time “away from keyboard” while ignoring certain events?

荒凉一梦 提交于 2019-12-06 02:34:15
问题 I'm making a little application that needs to know how long the user has been idle — as in, not using a keyboard or a mouse. Both XCB and Xlib promise to give me idle time through their respective screensaver extensions. Here is where I get idle time with XCB: #include <stdlib.h> #include <xcb/xcb.h> #include <xcb/screensaver.h> static xcb_connection_t * connection; static xcb_screen_t * screen; /** * Connects to the X server (via xcb) and gets the screen */ void magic_begin () { connection =

X11: list top level windows

一笑奈何 提交于 2019-12-06 01:42:59
So far I've found two approaches: For each root window (default screen, specific screen, all screens, etc), list each immediate child. Search each immediate child recursively for a window with the WM_STATE property; that window becomes the top-level application window of the immediate child and all recursion can stop. If no window within the hierarchy of the immediate child has the WM_STATE property, assume the immediate child is itself the top-level application window. Use xcb_get_property , and xcb_query_tree (which despite the name lists only immediate children). This is what xlsclients

How to avoid tearing with pygame on Linux/X11

╄→гoц情女王★ 提交于 2019-12-06 01:39:23
问题 I've been playing with pygame (on Debian/Lenny). It seems to work nicely, except for annoying tearing of blits (fullscreen or windowed mode). I'm using the default SDL X11 driver. Googling suggests that it's a known issue with SDL that X11 provides no vsync facility (even with a display created with FULLSCREEN|DOUBLEBUF|HWSURFACE flags), and I should use the "dga" driver instead. However, running SDL_VIDEODRIVER=dga ./mygame.py throws in pygame initialisation with pygame.error: No available

Programmatically launching standalone Adobe flashplayer on Linux/X11

你。 提交于 2019-12-05 23:45:30
问题 The standalone flashplayer takes no arguments other than a .swf file when you launch it from the command line. I need the player to go full screen, no window borders and such. This can be accomplished by hitting ctrl+f once the program has started. I want to do this programmatically as I need it to launch into full screen without any human interaction. My guess is that I need to some how get a handle to the window and then send it an event that looks like the "ctrl+f" keystroke. If it makes

Embedding QWidget into X11 Window

旧时模样 提交于 2019-12-05 22:00:12
问题 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 ; widget1.setGeometry(44,44,666,666); widget1.show(); // Create widget 2 QWidget widget2 ; widget2.setGeometry(144,144,666,666); widget2.show(); Display *display = XOpenDisplay( 0 ); // 0 parameter for default values if ( display != NULL ) { // Create the x11

How to display java swing on X11 when running on Mac

ε祈祈猫儿з 提交于 2019-12-05 17:43:13
I would really like to be able to run our test suite on Xvfb so that swing windows don't keep popping up in the way of my work. Unfortunately I cannot seem to find a way to get the java runtime to use the display specified in the DISPLAY environment variable. I suppose this is because the Mac JDK is hardwired to use the (non-X-based) Mac display. I can't find any switches for the java command that say to use X either. Thanks in advance for any help you can give! Matt I don't know if there is a way to get Apple's JDK to use X11, but there is the alternative of using SoyLatte , which is a Mac