x11

How to take screenshot of obscured window in C++ on Linux

前提是你 提交于 2019-12-06 11:39:00
I'm trying to figure out how to take a screenshot of a window that is currently not focused, so there is a good chance that the window will be partially or fully obscured by other windows. I've found an example here on this link Get a screenshot of a window that is cover or not visible or minimized with Xcomposite extension for X11 but I can't make it work, any time I take a screenshot I get only strange output, mostly black, like I'm accessing the wrong buffer or something. XID xid = windowID; // Checked and confirmed that the window ID is correct XGetWindowAttributes( display, windowID,

How to prohibit user to change OS window focus/type keys for several seconds on Linux

筅森魡賤 提交于 2019-12-06 11:27:41
I write automated tests for a website. One of the tests needs to press Ctrl + S and type some letters to save a webpage including CSS/JS. The test should require Firefox to have window focus for those several seconds to be able to type the filename and click "Save" (currently XDoTool is used for pressing keys and clicking the mouse). Sometimes I run the tests on my computer. I don't want to occasionally type something or change the window focus while the page is being saved, so I want to prohibit changing focus for those several seconds when those mouse clicks/key presses are running. It's not

freedesktop XEmbed systray client code in C, Xlib

不问归期 提交于 2019-12-06 11:00:28
问题 I've been trying to implement a systray icon using straight C and Xlib, going along with the freedesktop specification [0]. I can't seem to get my Window to embed into my desktop manager's systray[1], while other apps seem to be able to do it. I am not sure how to go forward debugging this, but I've provided minimal sample code below. I haven't been able to find any sample code using straight Xlib and C, and all the suggestions I've seen have been with regard to some framework like Gtk/Qt

How can I change the taskbar icon using XIconifyWindow?

怎甘沉沦 提交于 2019-12-06 07:05:21
问题 I am programming in Linux and am using X11 for my desktop. I would like to change the images of a minimized window in the task bar. I am using Fluxbox. I am currently using XIconifyWindow when the user clicks to minimize a window. How can I control the little square icon in the taskbar when the user minimized it? Thanks. Thank you for your help. The code I'm using to minimize looks something like this: void minWin(Window window, bool yes) const { if(yes) { XIconifyWindow(display, window,

What is the downside of XInitThreads()?

早过忘川 提交于 2019-12-06 06:59:10
问题 I know XInitThreads() will allow me to do calls to the X server from threads other than the main thread, and that concurrent thread support in Xlib is necessary if I want to make OpenGL calls from secondary threads using Qt. I have such a need for my application, but in a very rare context. Unfortunately, XInitThreads() needs to be called at the very beginning of my application's execution and will therefore affect it whether I need it or not for a particular run (I have no way of knowing

Why does XGrabKey return BadRequest?

a 夏天 提交于 2019-12-06 05:51:27
问题 So I'm working on a Gtk/X11/Linux app that does screen capture to .gif and one of the methods of stopping the capture is a key press (Esc, Space or End). You can also use a timeout. However to implement the key press to end capture I have to be able to grab the key such that I can get an event even though my window doesn't have focus (it's actually invisible during capture). I believe XGrabKey is the right X11 function for this task: Window w = Gtk::gdk_x11_drawable_get_xid(Gtk::gtk_widget

Sending Keystrokes to a X Window

非 Y 不嫁゛ 提交于 2019-12-06 05:44:10
问题 I am currently experimenting with xdotool to send keys to a process (I understand that it may not work for all processes that does not set _NET_WM_PID). I have trouble sending keystrokes to windows other from the focus. It does work if you are sending keystrokes to the CURRENTWINDOW . Below is the snippet that I used to test xdotool's functionality. extern "C"{ #include <xdo.h> } //extern "C" xdo_window_search #include <iostream> #include <string.h> using namespace std; int main(){ xdo_t* p

A virtual display for ubuntu server

こ雲淡風輕ζ 提交于 2019-12-06 04:36:41
My question is: is there a way to set up a virtual display as default display on a linux server (so that all GUI application launched will be displayed on that display, if no counter indication is made)? I tried using this: xvfb-run java -jar autoclick.jar , which produces the following output : searching graphic devices is Headless:false screen N°1 width:1600 height:900 just 1 robot click: Magic button clicked ! and here's the autoclick code : System.out.println("searching graphic devices"); System.out.println("is Headless:"+GraphicsEnvironment.isHeadless()); GraphicsEnvironment ge =

Matlab on Mountain Lion not working -

风流意气都作罢 提交于 2019-12-06 04:20:00
问题 Matlab (R2010a) seems to be kaput on Mountain Lion - if I click on the icon it crashes immediately. I installed XQuartz and Java on Mountain Lion but still keep getting the following error when trying to open it from xterm: bash-3.2$ /Applications/MATLAB_R2010a.app/bin/matlab dyld: Library not loaded: /usr/X11/lib/libXext.6.dylib Referenced from: /Applications/MATLAB_R2010a.app/bin/maci64/MATLAB.app/Contents/MacOS/libmwhg.dylib Reason: image not found Trace/BPT trap: 5 Unfortunately the error