x11

Taking screenshot with libx11

一个人想着一个人 提交于 2019-12-18 17:12:11
问题 I'm currently trying to take a screenshot using libx11 #include <X11/Xlib.h> #include <X11/Xutil.h> #include <stdio.h> int main(void) { XImage* pic; Display* dpl; unsigned int buffer_size; dpl = XOpenDisplay("127.0.0.1:0.0"); pic = XGetImage(dpl, RootWindow(dpl, DefaultScreen(dpl)), 10, 10, 201, 201, AllPlanes, ZPixmap); } if I compile the code using -lX11 and run it I keep getting a segmentation fault. Any ideas? Thanks in advance! 回答1: The X11 server does not usually listen on TCP/IP

X11: How do I REALLY grab the mouse pointer?

廉价感情. 提交于 2019-12-18 13:12:03
问题 I've implemented a horizontal splitter widget in Xlib. I'm trying to grab the mouse when the user clicks & drags on the splitter bar (so that the user can dynamically move the split & thus resize the windows on either side of the splitter bar). I've used XGrabPointer() after receiving a left click, in hopes that all future mouse motion (dragging) will be diverted to the splitter window until the left button is released. Unfortuntately, it doesn't seem to work like that. If the user drags too

How to check if X server is running?

怎甘沉沦 提交于 2019-12-18 10:32:37
问题 Is there any way to find out if the current session user is running an Xserver (under Linux) ? I'v started off with things like: ps -e | grep X but this doesn't work always and one more thing I tried is checking the $DISPLAY variable Are there any other ways to check this? EDIT: Some people suggested using the $DISPLAY variables but what if the user fiddles with this variable ? what if he tries to do something and changes this variable and then when I check it, it no longer reflects an

Run Java AWT/Swing GUI app in headless server

陌路散爱 提交于 2019-12-18 09:16:09
问题 I have a gateway application that comes up with a login dialog and then a GUI window. I will be running this app on a co-located server without a display. I need to interact with the dialog only when logging in and perhaps to check out the main GUI occasionally. The server is Debian 5.0. The only ideas I have so far are: Tunnel an X session to my desktop for logging in but I'm not sure what will happen if the X session disconnected (ie, I reboot my desktop, etc..) Try to instantiate/launch

How a draw a string in a splash screen by Xlib

人盡茶涼 提交于 2019-12-18 07:26:40
问题 here is my code and I can not jump out of the while(!done) function use XFlush(d) can show the display form buffer and do not disappear before XCloseDisplay(d) and I want to make draw string like that g++ -o youname youcppname -lX11 #include <X11/Xlib.h> #include <X11/Xatom.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <unistd.h> int main(void) { Display *d; Window w; XEvent e; const char *msg = "Hello, World!"; int s; bool done = false; /* open connection with the

Mechanism of clipboard of xwindow

做~自己de王妃 提交于 2019-12-18 06:53:54
问题 Can anybody explain the mechanism of clipboard of xwindow to me? For example, if I make a operation of open a file from gedit and copy the content of this file using ctrl+c. And then I open vim and use ctrl+v to paste the content into the new opened file. I know that it will use the buffer of xwindow to store the content. But I am curious how it works in the system level. More specifically, how the underlying linux kernel needs to do to handle this copy-paste operation? Is there any system

Mechanism of clipboard of xwindow

寵の児 提交于 2019-12-18 06:52:54
问题 Can anybody explain the mechanism of clipboard of xwindow to me? For example, if I make a operation of open a file from gedit and copy the content of this file using ctrl+c. And then I open vim and use ctrl+v to paste the content into the new opened file. I know that it will use the buffer of xwindow to store the content. But I am curious how it works in the system level. More specifically, how the underlying linux kernel needs to do to handle this copy-paste operation? Is there any system

X11: raise an existing window via command line?

走远了吗. 提交于 2019-12-18 04:37:13
问题 Given an X client window ID, is there a way to raise that window from the command line? $ xlsclients -a Window 0x3000001: Machine: ohm Name: Terminal Icon Name: foo Command: foo Instance/Class: foo/bar $ xraise -id 0x3000001 <-- this is what I would like to do 回答1: You can also use wmctrl, which does similar things 回答2: Like... http://zaurus.daemons.gr/menaie/build/hacks/xraise/xraise.c? EDIT: Inserting the code in the answer : #include <X11/Xos.h> #include <X11/Xlib.h> #include <X11/Xutil.h>

Global Hotkey in Mono and Gtk#

安稳与你 提交于 2019-12-18 04:21:30
问题 I'm trying to get a global hotkey working in Linux using Mono. I found the signatures of XGrabKey and XUngrabKey , but I can't seem to get them working. Whenever I try to invoke XGrabKey , the application crashes with a SIGSEGV. This is what I have so far: using System; using Gtk; using System.Runtime.InteropServices; namespace GTKTest { class MainClass { const int GrabModeAsync = 1; public static void Main(string[] args) { Application.Init(); MainWindow win = new MainWindow(); win.Show(); //

Global Hotkey in Mono and Gtk#

≡放荡痞女 提交于 2019-12-18 04:21:27
问题 I'm trying to get a global hotkey working in Linux using Mono. I found the signatures of XGrabKey and XUngrabKey , but I can't seem to get them working. Whenever I try to invoke XGrabKey , the application crashes with a SIGSEGV. This is what I have so far: using System; using Gtk; using System.Runtime.InteropServices; namespace GTKTest { class MainClass { const int GrabModeAsync = 1; public static void Main(string[] args) { Application.Init(); MainWindow win = new MainWindow(); win.Show(); //