xlib

How to create semi transparent white window in XLib

扶醉桌前 提交于 2019-12-29 07:49:00
问题 I would like to create a semi transparent white window in XLib, but the window is not semi translucent, it remains fully opaque. I use the compton compositor and there are transparent windows in the system, so the problem is in the code: #include <X11/Xlib.h> #include <X11/Xutil.h> #include <stdio.h> int main(int argc, char* argv[]) { Display* display = XOpenDisplay(NULL); XVisualInfo vinfo; XMatchVisualInfo(display, DefaultScreen(display), 32, TrueColor, &vinfo); XSetWindowAttributes attr;

xlib / egl how to get VSync/swapInterval on eglSwapBuffers

百般思念 提交于 2019-12-25 16:58:10
问题 I'm wondering how to properly enable vsync with eglSwapBuffers when using xlib. It seems that calls to eglSwapInterval are simply ignored. I'm running both in a windowed and full-screen mode. Is it possible that it simply isn't supported in the windowed mode? In this case, what is a good way to reduce the frequency at which I render (sleeping tends to cause errative behaviour as there is no guarantee when it awakes). 回答1: Eventually I found this after a lot of googling: http://lists

Xft can draw rectangles on Pixmaps, but not text

吃可爱长大的小学妹 提交于 2019-12-25 07:37:26
问题 I am trying to render some text with Xft and set the resulting Pixmap as X root background. Despite having some diplomacy with X, the code I have is simple: #include <stdio.h> #include <unistd.h> #include <X11/Xlib.h> #include <X11/Xft/Xft.h> int main() { char font[] = "helvetica:size=11"; char buf[] = "Lorem Ipsum"; int s, x = 12; XRenderColor color = {0xFFFF, 0, 0, 0xFFFF}; Display * d; Window r; Pixmap p; XftFont * f; XftDraw * drw; XftColor xftc; d = XOpenDisplay(NULL); s = DefaultScreen

How to use Openbox+xcompmgr correctly?

泪湿孤枕 提交于 2019-12-25 07:24:23
问题 I use xcompmgr to make the 32 bit window to has a transparent background.The WM is Openbox.But When I run my 32 bit window example,the window is black not transparent.The result I want is set something make xcompmgr work fine.I saw a page "Background turns light gray briefly after logging in (e.g. in Openbox)", hsetroot .I run hsetroot,my window become steady,but like a 24 bit window with a black background.Is there any ideas to meet my demand? 回答1: Even if this message is quite old, maybe I

Second Cursor is not triggering a screen refresh

冷暖自知 提交于 2019-12-24 21:17:57
问题 I previously posted about controlling two separate cursors in two xsessions. (http://stackoverflow.com/questions/13714831/controlling-multiple-pointers-with-xlib-or-xinput-in-ubuntu-linux) That solution worked well. However, a odd thing occurs when I control the cursor. Instead of the cursor moving normally and the screen refreshing to adjust, the cursor is on top of a white box and when I move it the cursor leaves a trail and nothing refreshes. This only happens when I move the newly created

Xlib: How to ask window manager for maximized window size?

℡╲_俬逩灬. 提交于 2019-12-24 14:04:36
问题 I want my program's window to be as big as possible without overlapping the window manager's various small windows e.g. the pager. Is there any way to ask the wm what the maximized window size is, before I create my window? 回答1: _NET_WORKAREA property of the root window is probably closest match. However on a multi-headed system it will give you the combined work area on all monitors. If that's what you want, fine (but see here on making a window span multiple monitors). If you want to

OpenGL Rendering Context Produces “opcode of failed request 152 (GLX)” (Mesa 8.0 - OpenGL 3.0, Linux)

给你一囗甜甜゛ 提交于 2019-12-24 07:48:54
问题 This one is a huge issue: first off, while I know a little bit about the XLib API, I wanted to test and make sure I could actually create an OpenGL rendering context (3.0) before I did anything, thus I just copied and pasted some test code and ran it. When I run the code, my output is as follows: GLX_ARB_get_proc_address GLX_ARB_multisample GLX_EXT_import_context GLX_EXT_visual_info GLX_EXT_visual_rating GLX_MESA_copy_sub_buffer GLX_MESA_multithread_makecurrent GLX_MESA_swap_control GLX_OML

Unable to call member function pointer that is inside a struct

点点圈 提交于 2019-12-24 07:37:12
问题 I've been racking my brain over getting the syntax right on declaring, defining and finally calling a member function pointer inside my program. I'm writing a window manager with Xlib, and am trying to enable the user to define all key bindings in a vector of Keybind s. The Keybind struct contains more member variables, which I have left out here for the sake of brevity. Here's what I've got so far. Keybind , a struct containing a member variable, func , that points to a MyClass member

How to save XImage as bitmap?

时光总嘲笑我的痴心妄想 提交于 2019-12-24 02:55:53
问题 i'm trying to create JNI C++ library that will capture desktop video (frames). First step is to simply make a screenshot of desktop. Code is : #include <iostream> #include <X11/Xlib.h> using namespace std; int main() { Display *display; int screen; Window root; display = XOpenDisplay(0); screen = DefaultScreen(display); root = RootWindow(display, screen); XImage *img = XGetImage(display,root,0,0,400,400,XAllPlanes(),ZPixmap); if (img != NULL) { //save image here } return 0; } But, how to save

Is it safe for X's error handler to throw exceptions?

橙三吉。 提交于 2019-12-24 02:37:26
问题 Is it safe to do something like this? int foo(Display*, XErrorEvent*) { throw 0; } XSetErrorHandler(foo); I won't run into any troubles? 回答1: An X11 error handler is a callback provided by the user and called by Xlib. Any exception thrown from an error handler will propagate through Xlib code down to user code calling Xlib (typically XNextEvent or friends). foo() <C++> | [error is detected by Xlib] <C> | [some more Xlib code] <C> | [some Xlib code] <C> | XNextEvent() <C> | main() <C++> Since