x11

How to specify OpenGL version in X window?

浪尽此生 提交于 2019-12-10 18:58:35
问题 My question is how to specify OpenGL version in X window system and in addition remove those deprecated functions. My GL version is 4.3. I know how to do that using SDL or glut. 回答1: First you must know how to create a OpenGL context using bare X11 / Xlib first. Have a look at this code https://github.com/datenwolf/codesamples/blob/master/samples/OpenGL/x11argb_opengl/x11argb_opengl.c To make this actually select a modern version profile this code block is used #if USE_GLX_CREATE_CONTEXT

Xlib XGetWindowProperty Zero items returned

≡放荡痞女 提交于 2019-12-10 18:49:09
问题 I have problems reading some XWindow ICCCM Properties. The problem actually is when i try to read _NET_WM_STATUS property. The function i'm using is: int get_property_value(Display* display, Window window,char *propname, long max_length, unsigned long *nitems_return, unsigned char **prop_return){ int result; Atom property; Atom actual_type_return; int actual_format_return; unsigned long bytes_after_return; unsigned char* prop_to_return; unsigned long n_items; printf("-----GET_PROPERTY_VALUE--

get X11 window id of terminal from shell

送分小仙女□ 提交于 2019-12-10 18:44:33
问题 How can I get the window ID of the terminal that my shell script is running in? Background: I need to write a script to do something based on which virtual desktop it is running in. To get the virtual desktop (not current desktop, I may change it while the script is running), I need the window ID of the terminal that the script is running in. If the script is not run from a terminal, it should fail with an error. 回答1: I know very little of X11, but running the env command in my terminal, I

Mouse events callback

大城市里の小女人 提交于 2019-12-10 18:21:36
问题 I was using WinAPI SetWindowsHookEx and OS X objective-c [NSEvent addLocalMonitorForEventsMatchingMask:handler:] which both set up a callback and then i run the event loop endlessly and the callback triggers whenver it needs. I insert this hook into just my process/application (but it would be cool if I could do system wide as well). As users do mouse combinations I track them, and if a combination matches a certain pattern, it blocks the last mouse event and does a certain function. I was

Global alt+space hotkey grabbing - weird keyboard focus behaviour

孤者浪人 提交于 2019-12-10 17:25:37
问题 I'm grabbing Alt+Space global hotkey using xcb_grab_key , as follows: xcb_key_symbols_t *keysyms = xcb_key_symbols_alloc(c); xcb_keycode_t *keycodes = xcb_key_symbols_get_keycode(keysyms, XK_space), keycode; // add bindings for all screens xcb_screen_iterator_t iter; iter = xcb_setup_roots_iterator (xcb_get_setup (c)); for (; iter.rem; xcb_screen_next (&iter)) { int i = 0; while(keycodes[i] != XCB_NO_SYMBOL) { keycode = keycodes[i]; xcb_grab_key(c, true, iter.data->root, XCB_MOD_MASK_ANY,

How to set mouse cursor on X11 in a C application

余生长醉 提交于 2019-12-10 10:15:53
问题 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

X11: list top level windows

吃可爱长大的小学妹 提交于 2019-12-10 10:08:13
问题 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 ,

Transparent window in Xwindow parent

戏子无情 提交于 2019-12-10 09:29:22
问题 I am trying to create an overlay window above another running application. Let's say firefox. I implemented by using Xcreatewindow win = XCreateWindow( display, *firefoxwindow, 50, 300, 400, 400, 0, visualinfo.depth, InputOutput, visualinfo.visual, CWColormap|CWEventMask|CWBackPixmap|CWBorderPixel, &attr ) ; I searched *firefoxwindow by using XQueryTree() and then followed this code https://gist.github.com/903479 The result is the transparent window when I use the XRoot as parent. But, when I

Is there a simple way to detect mouse or keyboard activity in Linux/Xorg/Qt4/Kde4?

左心房为你撑大大i 提交于 2019-12-10 06:15:10
问题 Is there a simple way to detect mouse or keyboard activity in Linux or Xorg or Qt4 or Kde4 environment? Obviously not only on a particular window but in the entire Xorg desktop. 回答1: You can use the XScreenSaver extension ( man Xss ). It can provide you with values into this struct using the function XScreenSaverQueryInfo : typedef struct { Window window; /∗ screen saver window */ int state; /∗ ScreenSaver{Off,On,Disabled} */ int kind; /∗ ScreenSaver{Blanked,Internal,External} */ unsigned

Mac OSX Lion/X11/CImg Library

断了今生、忘了曾经 提交于 2019-12-10 02:36:48
问题 So I'm trying to incorporate the CImg image writing library into my XCode project However, the header file for the library contains the following include and XCode gives this error warning: #include <X11/Xlib.h> Error: File not found My laptop is running OSX Lion 10.8.2 and apparently, apple took away X11 for Lion, so I went on this site and downloaded XQuartz because that's what it said to do on the Apple Support page. So after the installation, I restarted my computer and tried to run my