x11

Locking mouse pointer using xGrabPointer in Linux

允我心安 提交于 2019-12-24 06:45:08
问题 I am using X11 to get mouse position when the mouse button is pressed in a application which runs on terminal without any window. Getting Mouse Position : Display *dpy; Window root, child; int rootX, rootY, winX, winY; unsigned int mask; dpy = XOpenDisplay(NULL); XQueryPointer(dpy,DefaultRootWindow(dpy),&root,&child, &rootX,&rootY,&winX,&winY,&mask); Now I want to use XGrabPointer() to lock the mouse so that it does not interact with objects(windows , icons and docks ) present on desktop .

preventing window maximisation/minimisation in x window system

橙三吉。 提交于 2019-12-24 03:19:02
问题 i'm writing some low level window code for a window in x (in c++), and I want to prevent the user from either maximising or minimising the window. i don't mind whether this is done by rejecting the request to resize, or by removing the buttons themselves. however, i am tied to x and can't use qt or other higher-level libraries which i know provide this functionality. at the moment all i have managed to do is intercept the ResizeRequest event and then set the window size back using

Cannot embed gnuplot x11 window into Gtk3 socket

风格不统一 提交于 2019-12-24 02:59:06
问题 I'm creating Gtk::Socket in my Gtk3 (actually, gtkmm) application and trying to embed gnuplot's window into it. But it does not work: the socket remains to stay as a black rectangle, while gnuplot window appears standalone elsewhere. Meanwhile, Gtk::Plug plugs into this socket perfectly. In Gtk2 this trick with gnuplot works well too. Here is socket.cpp #include <iostream> #include <fstream> #include <gtkmm.h> #include <gtkmm/socket.h> using namespace std; void plug_added(){ cout << "A plug

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

displaying png file using XPutImage does not work

让人想犯罪 __ 提交于 2019-12-24 02:45:29
问题 I tried to display a png file in xwindow using xputimage. But the xputimage throws the following error: window width - '426'; height - '341' X Error of failed request: BadMatch (invalid parameter attributes) Major opcode of failed request: 72 (X_PutImage) Serial number of failed request: 11 Current serial number in output stream: 12 I tried chnaging the parameters of xputimage but still the same error occurs. Please help me out.. The source code is below: /* * simple-drawing.c - demonstrate

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

XCB equivalent of XkbSetDetectableAutoRepeat

与世无争的帅哥 提交于 2019-12-24 01:43:17
问题 I was running code from a separate thread, so couldn't call any Xlib functions, I can only call XCB. I was wondering what the equivalent for XkbSetDetectableAutoRepeat would be? Thanks 回答1: XCB presents a more direct view of the protocol than Xlib does, so you often have to look at either the protocol specs or Xlib source code to find out what the underlying protocol request is to find an equivalent. In this case, the Detectable Autorepeat section of the XKB extension spec says it uses the

No X11 DISPLAY variable was set, but this program performed an operation which requires it using Putty? [closed]

自古美人都是妖i 提交于 2019-12-24 01:18:37
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 4 years ago . I am using Putty to connect to a Server that was running remotely . To monitor the server i entered jconsole under the putty terminal I was getting this below exception . [user001@test.hhh.com ~]$ jconsole Exception in thread "AWT-EventQueue-0" java.awt.HeadlessException: No X11 DISPLAY variable was set, but

Moving the mouse pointer in C++ fails on Linux

流过昼夜 提交于 2019-12-24 01:12:39
问题 I'm using the following code to hide and show the mouse cursor: XDefineCursor( m_display, m_window, show ? None : m_hiddenCursor ); XFlush( m_display ); That works fine. However, when I run this: XWarpPointer( m_display, None, m_window, 0, 0, 0, 0, x, y ); XFlush( m_display ); The mouse doesn't move at all. Simply nothing happens. SetMousePos, which I'm using for Windows, works fine. 回答1: It's been a while, but doesn't XWarpPointer make a relative move of the cursor using the passed offsets?

Pyplot “cannot connect to X server localhost:10.0” despite ioff() and matplotlib.use('Agg')

只谈情不闲聊 提交于 2019-12-24 00:55:00
问题 I have a piece of code which gets called by a different function, carries out some calculations for me and then plots the output to a file. Seeing as the whole script can take a while to run for larger datasets and since I may want to analyse multiple datasets at a given time I start it in screen then disconnect and close my putty session and check back on it the next day. I am using Ubuntu 14.04. My code looks as follows (I have skipped the calculations): import shelve import os, sys, time