xorg

Setting color brightness on Linux/Xorg

江枫思渺然 提交于 2019-12-05 09:37:15
Is there any command (or API) to set X.Org/Linux color brightness? In other words, I need something as handy as the xgamma command but for changing RGB brightness real-time . Is this possibile? Use the XF86VidMode* family of functions. #include <X11/Xlib.h> #include <X11/extensions/xf86vmode.h> #include <math.h> #include <stdio.h> #include <stdlib.h> #include <unistd.h> int main() { Display *display; int screen; int major, minor; int i; XF86VidModeGamma orig; display = XOpenDisplay(NULL); if (!display) return -1; screen = DefaultScreen(display); if (!XF86VidModeQueryVersion(display, &major,

Any efficient way of converting XImage data to pixel map (e.g. array of RGB quads)?

末鹿安然 提交于 2019-12-05 03:55:52
问题 I'm trying to capture images with XGetImage. Everything fine but I need to send the data to a module which expects an array of RGB quads. Calling XGetPixel for every pixel in the image is very slow (0.5 seconds on a i5 for 1440x900 resolution). I've looked up the XGetPixel source code in xlib and the reason is obvious, a lot of computations are done for each pixel. Is there any efficient (or maybe completely different) way of doing this? 回答1: With the MIT Shared Memory Extension you can store

Get X/Y position of caret (input text cursor) under Xorg?

痴心易碎 提交于 2019-12-05 01:58:49
I'd like to display a popover right above where the user is typing, in any Linux app (GTK, Qt, Electron, etc.), running on X. I figured out creating the popover, now I'm trying to figure out how to get the coordinates of the input text cursor (what blinks while you type, not sure if it's called "caret"?) relative to the screen. I know I can get info on where the mouse with xdotool : xdotool getmouselocation I would need the same thing but for the text cursor, in the currently focused window. I have no idea how to achieve this. I would love if someone could point me in the right direction. So,

How to monitor changes to an arbitrary widget?

半腔热情 提交于 2019-12-04 19:24:25
I am starting a QT5 application with a rather complex design based on Qt Widgets. It runs on Beagleboard with a touchscreen. I will have a rather weird local invention instead of the LCD display. It's a laser painting on acrylic plate. It has no driver yet. To actually update a screen I must create a screenshot of the window as bitmap, turn it to grayscale and feed to a proprietary library, which will handle the laser. It should look cute, when ready. Unfortunately, the laser blinks on update, so I cannot just make screenshots on timer, or it will be jerky like hell. I need to run a function

XLib Window Name Problems

风流意气都作罢 提交于 2019-12-04 14:51:33
since 4 days, I try to see how XLib works, and I have finally understood that. Si I tried to make a short program wich retrieve open window's name. For that, I created 2 functions : Window *list (Display *disp, unsigned long *len) { Atom prop = XInternAtom(disp,"_NET_CLIENT_LIST",False), type; int form; unsigned long remain; unsigned char *list; if (XGetWindowProperty(disp,XDefaultRootWindow(disp),prop,0,1024,False,XA_WINDOW, &type,&form,len,&remain,&list) != Success) { return 0; } return (Window*)list; } So, this first function return a window object of all the windows. Then, I created a

How to move the mouse cursor from user code?

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-04 13:57:13
My data comes from an arduino (which gets it from a sensor). I'd like to have the data processed by an user program (after reading it from /dev/ttyUSB0 ). After that I need to control the mouse cursor using the output of the program. (I'd really like to avoid writing a kernel driver at this moment.) What is the recommended way to do this(on a Linux environment)? Perhaps a library on top of X...or some tool/script I can directly pipe the data into? Taken from dzone : #include <stdio.h> #include <stdlib.h> #include <X11/Xlib.h> #include <X11/Xutil.h> void mouseMove(int x, int y) { Display

Get current window title with Python and Xorg

我与影子孤独终老i 提交于 2019-12-04 13:13:58
问题 After stackoverflow answered my previous question on here about my Wiimote left/right click issue, Not only can I move the mouse cursor, I can now left/right click on things. I now have one more question. What do I use in python to get the title of the current active window? After googling 'X11 Python Window Title', 'Linux Python Window Title' and things similar, All I've found is win32 and tkinker (again?), which isn't what I need. If you could help, That would be awesome! 回答1: EDIT best way

What is the fastest way to draw a 2D array of color triplets on screen?

陌路散爱 提交于 2019-12-04 02:35:02
The target language is C/C++ and the program has only to work on Linux, but platform independent solutions are preferred obviously. I run Xorg, XVideo and OpenGL are available. How many FPS can I expect on 1024x768 on an Intel Core 2 Duo with Intel graphics? (ONLY drawing counts, consider the arrays to be ready in RAM; no precise prognosis needed) The fastest way to draw a 2D array of color triplets: Use float ( not byte, not double) storage. Each triplet consists of 3 floats from 0.0 to 1.0 each. This is the format implemented most optimally by GPUs (but use greyscale GL_LUMINANCE storage

Any efficient way of converting XImage data to pixel map (e.g. array of RGB quads)?

ⅰ亾dé卋堺 提交于 2019-12-03 21:13:44
I'm trying to capture images with XGetImage. Everything fine but I need to send the data to a module which expects an array of RGB quads. Calling XGetPixel for every pixel in the image is very slow (0.5 seconds on a i5 for 1440x900 resolution). I've looked up the XGetPixel source code in xlib and the reason is obvious, a lot of computations are done for each pixel. Is there any efficient (or maybe completely different) way of doing this? With the MIT Shared Memory Extension you can store an image in a shared memory area. This way you avoid going through the Xlib IPC channel when processing the

How does X11 clipboard handle multiple data formats?

本小妞迷上赌 提交于 2019-12-03 06:22:49
问题 It probably happened to you as well - sometimes when you copy a text from some web page into your rich-text e-mail draft in your favorite webmail client, you dislike the fact that the pasted piece has a different font/size/weight.. it somehow remembers the style (often images, when selected). How is it than that if you paste the same into your favorite text editor like Vim, there's no HTML, just the plain text? It seems that clipboard maintains the selected data in various formats. How can