xcb

How to use shm pixmap with xcb?

不问归期 提交于 2019-12-07 06:04:36
问题 I try to learn how to use shared memory pixmaps in the xcb library. Did any of you have experience with this and want to share example codes and/or information? This would be very helpful. Thanks 回答1: After some research I found out how to use shared memory pixmaps in xcb. Here is my testcode: #include <stdlib.h> #include <stdio.h> #include <sys/ipc.h> #include <sys/shm.h> #include <xcb/xcb.h> #include <xcb/shm.h> #include <xcb/xcb_image.h> #define WID 512 #define HEI 512 int main(){ xcb

Need for XEventsQueued(display, QueuedAfterReading) in XCB

柔情痞子 提交于 2019-12-06 15:48:17
I am migrating some code of CYBOI from Xlib to XCB. CYBOI uses a couple of threads for different communication channels like: serial_port, terminal, socket, x_window_system. However, it uses these threads only for signal/event/data detection; the actual receiving and sending is done in the main thread, in order to avoid any multi-threading conflicts of address space. For the x_window_system channel, I previously detected events in a thread: int n = XEventsQueued(display, QueuedAfterReading); Upon detection of an event, an "interrupt flag" was set. Afterwards, the main thread was reading the

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 =

How to use shm pixmap with xcb?

五迷三道 提交于 2019-12-05 11:10:48
I try to learn how to use shared memory pixmaps in the xcb library. Did any of you have experience with this and want to share example codes and/or information? This would be very helpful. Thanks After some research I found out how to use shared memory pixmaps in xcb. Here is my testcode: #include <stdlib.h> #include <stdio.h> #include <sys/ipc.h> #include <sys/shm.h> #include <xcb/xcb.h> #include <xcb/shm.h> #include <xcb/xcb_image.h> #define WID 512 #define HEI 512 int main(){ xcb_connection_t* connection; xcb_window_t window; xcb_screen_t* screen; xcb_gcontext_t gcontext; xcb_generic_event

Window position in Xlib

痴心易碎 提交于 2019-12-05 00:35:51
问题 How to get top-level window position relative to root window (i.e. whole screen) using plain ol' xlib (or brand new XCB)? 回答1: The x,y components of the structure returned by XGetWindowAttributes are relative to the origin of the window's parent. That's not the same as relative to the top left of the screen. Calling XTranslateCoordinates passing the root window and 0,0 gives coordinates of the window relative to the screen. I found that if I write: int x, y; Window child; XWindowAttributes

Create OpenGL Context only with XCB

こ雲淡風輕ζ 提交于 2019-12-04 10:14:28
I want to create OpenGL Context only with XCB without GLX and Xlib. Could you tell me that might be happened. Thanks a lot. I want to create OpenGL Context only with XCB without GLX and Xlib. You can't. Period. You need GLX, because that's how the X11 does OpenGL. And GLX is written against Xlib. The best you could do is use the Xcb GLX module to implement a purely indirect GLX context; limits you to OpenGL-2.1 though and everything has to pass through the X11 server, instead of having a direct context that talks directly to the GPU. 来源: https://stackoverflow.com/questions/32756336/create

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

大城市里の小女人 提交于 2019-12-04 08:24:25
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 = xcb_connect (NULL, NULL); screen = xcb_setup_roots_iterator (xcb_get_setup (connection)).data; } /** *

xcb keyboard button masks meaning

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-04 07:13:14
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? 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 implementations and/or keyboard models. Source: my own computer running X11, and various bits and pieces of code

How to send key event to application using XCB?

拥有回忆 提交于 2019-12-03 17:35:29
问题 How can I send a key press or key release event to a window (the currently active window) from another program using XCB ? I found some tutorials using XLib , however I would like to use XCB . I guess I will have to call xcb_send_event , however I have no idea what to pass it as parameters. 回答1: You should be able to use the XTEST extension to fake input to the active window, using the xcb_test_fake_input() function. #include <xcb/xtest.h> ... xcb_test_fake_input(c, XCB_KEY_PRESS, keycode,