x11

Intercept WM_DELETE_WINDOW on X11?

柔情痞子 提交于 2019-11-30 11:46:18
I'd like to intercept the WM_DELETE_WINDOW message that is posted to a certain selection of windows that an application I'm writing ( AllTray ), so that I can act on it instead of the application receiving it. I'm currently looking at trying this at the GDK level via gdk_display_add_client_message_filter if possible, but I'd be happy with an Xlib solution if there is one as well; it seems to be possible, but I just don't seem to be understanding how I am to do it successfully. Currently, I have two programs (written in C) that I am trying to use to get this figured out, the first one does

GTK implementation of MessageBox

家住魔仙堡 提交于 2019-11-30 10:49:03
I have been trying to implement Win32's MessageBox using GTK. The app using SDL/OpenGL, so this isn't a GTK app. I handle the initialisation ( gtk_init ) sort of stuff inside the MessageBox function as follows: int MessageBox(HWND hwnd, const char* text, const char* caption, UINT type) { GtkWidget *window = NULL; GtkWidget *dialog = NULL; gtk_init(&gtkArgc, &gtkArgv); window = gtk_window_new(GTK_WINDOW_TOPLEVEL); g_signal_connect(G_OBJECT(window), "delete_event", G_CALLBACK(delete_event), NULL); g_signal_connect(G_OBJECT(window), "destroy", G_CALLBACK(destroy), NULL); // gcallback calls gtk

Screenshots in X11

不想你离开。 提交于 2019-11-30 10:47:46
What functions would one use to take a screenshot of an X11 desktop, using the Xlib library? I would prefer a method that's more efficient than getting individual pixels. Thanks. The standard tool for taking screenshots in X11 is to use xwd -root > myscreen.xwd Then, convert to .pnm with xwd2pnm myscreen.xwd > myscreen.pnm Therefore, you can locate the source code of xwd and see how it is implemented, http://cvsweb.xfree86.org/cvsweb/xc/programs/xwd/xwd.c?rev=HEAD&content-type=text/vnd.viewcvs-markup 来源: https://stackoverflow.com/questions/5293525/screenshots-in-x11

DBus Finch/Pidgin without X11

随声附和 提交于 2019-11-30 10:30:36
I want to do some Python scripting on my server where I can communicate with finch (A console interface of pidgin , with the interface looking like links2 ) through the DBus Python library to send messages or check for buddy online status. This works if you do it in X. Run finch in an X terminal and run the Python script in another terminal with no errors/exceptions. But if you do it without X , you have to run finch in TTY1 (ctrl+alt+f1) and the python script in TTY2 (ctrl+alt+f2) but the python script will fail . The following is the first few lines of the script: import dbus bus = dbus

X11/Xlib: Window always on top

假装没事ソ 提交于 2019-11-30 10:24:13
A window should stay on top of all other windows. Is this somehow possible with plain x11/xlib? Googling for "Always on top" and "x11" / "xlib" didn't return anything useful. I'd avoid toolkits like GTK+, if somehow possible. I'm using Ubuntu with gnome desktop. In the window menu, there's an option "Always On Top". Is this provided by the X server or the window manager? If the second is the case, is there a general function that can be called for nearly any wm? Or how to do this in an "X11-generic" way? Edit: I implemented fizzer's answer, now having following code: XSelectInput(this->display

X11/Xlib: Create “GlassPane”-Window

烈酒焚心 提交于 2019-11-30 10:11:01
I've tried to create a fully transparent window using C++ & X11. It should not consume any events and simply forwards them to the windows below. Some kind of GlassPane as it's known for Java-Windows, but full screen. Then I'd like to draw on this window. Is this somehow possible with X11? My first attempt was ignoring all events, simply copy the image from the root window using XGetImage() ... But first of all, this is quite slow as the window would need to be full screen. XShmGetImage unfortunately isn't an option here. For sure, this window wouldn't need any decoration, but that isn't a big

How to create a window with a bit depth of 32

落花浮王杯 提交于 2019-11-30 08:28:48
问题 I'm trying to create a X11 window with a bit depth of 32 so that I can use ARGB colors. Here's what I do: XVisualInfo vinfo; int depth = 32; XMatchVisualInfo(dpy, XDefaultScreen(dpy), depth, TrueColor, &vinfo); XCreateWindow(dpy, XDefaultRootWindow(dpy), 0, 0, 150, 100, 0, depth, InputOutput, vinfo.visual, 0, NULL); Here's what happens: X Error of failed request: BadMatch (invalid parameter attributes) Major opcode of failed request: 1 (X_CreateWindow) Serial number of failed request: 7

X11 - Draw on Overlay Window

邮差的信 提交于 2019-11-30 07:14:26
问题 I want to draw simple primitives at specific pixels on the screen (similar to this question). In order to do that I draw on top of all windows using the Overlay Window of the Window Manager. I can see the shape I am drawing and mouse events pass through but I don't see for example Window movements that are below the Overlay Window (unless I kill my application). I am new to Xlib programming, sry for asking a maybe simple question. #include <assert.h> #include <stdio.h> #include <X11/Xlib.h>

x11 forwarding with paramiko

最后都变了- 提交于 2019-11-30 06:54:04
I'm trying to run a command with paramiko that should be able to open an X window. The script I'm using would something as follows: import paramiko ssh_client = paramiko.SSHClient() ssh_client.set_missing_host_key_policy(paramiko.AutoAddPolicy()) ssh_client.connect('192.168.122.55', username='user', password='password') transport = ssh_client.get_transport() session = transport.open_session() session.request_x11() stdin = session.makefile('wb') stdout = session.makefile('rb') stderr = session.makefile_stderr('rb') session.exec_command('env; xterm') transport.accept() print 'Exit status:',

clang: error: unknown argument: '-mno-fused-madd' [-Wunused-command-line-argument-hard-error-in-future]

独自空忆成欢 提交于 2019-11-30 06:38:02
问题 I get the following error trying to install Scrapy in a Mavericks OS. I have command line tools and X11 installed I don't really know whats going on and I haven`t found the same error browsing through the Web. I think it might be related to some change in Xcode 5.1 Thanks for the answers! this is part of the command output: $pip install scrapy . . . . Downloading/unpacking cryptography>=0.2.1 (from pyOpenSSL->scrapy) Downloading cryptography-0.3.tar.gz (208kB): 208kB downloaded Running setup