xlib

How to observe changes in connected monitors via Xlib?

风流意气都作罢 提交于 2019-12-19 09:48:21
问题 I'm trying to write a program that would detect external monitors being plugged in and automatically enable and configure them through Xlib. I know that there is XRandr extension that allows this. My question is, how do I enable receiving XRandr events to my application? What event mask should I use? I know that xev app is able to do this. 回答1: Xev's source code: http://cgit.freedesktop.org/xorg/app/xev/tree/ Or: git clone git://anongit.freedesktop.org/xorg/app/xev 回答2: For the second part, I

Global keybinding on X using Python gtk3

岁酱吖の 提交于 2019-12-18 18:01:27
问题 I was looking for some example of python xlib global keybinding that would work with gtk3, just as it is done for gtk2 at http://www.siafoo.net/snippet/239. Very similar code here: from Xlib.display import Display from Xlib import X import gtk.gdk import threading import gobject class GlobalKeyBinding (gobject.GObject, threading.Thread): __gsignals__ = { 'activate': (gobject.SIGNAL_RUN_LAST, gobject.TYPE_NONE, ()), } def __init__ (self): gobject.GObject.__init__ (self) threading.Thread.__init

pygtk window with box that ignores all X(mouse)events (passes them through)

会有一股神秘感。 提交于 2019-12-18 17:25:47
问题 I'd like to do the following: Create a fullscreen, always on top pygtk window with a webkit widget displaying some html, but with a box that is completely transparent, so that the windows below are visible. (This seems to be possible: Is it possible to render web content over a clear background using WebKit?) What I'd like is to (sometimes) pass all mouse events that occur in the transparent box down to the windows below my application's window, so that I can interact with them normally. So

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 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

Borderless windows on Linux

淺唱寂寞╮ 提交于 2019-12-18 04:21:44
问题 Is their a standard way to make a particular window borderless on Linux? I believe that the window border is drawn by your window manager, so it may be that I just need to use a particular window manager (that would be find, I'd just need to know which one)... My hope is that all the window managers might follow some standard that allows me to do this programatically... 回答1: Using Xlib and old _MOTIF_WM_HINTS : struct MwmHints { unsigned long flags; unsigned long functions; unsigned long

Get UTF-8 input with X11 Display

ⅰ亾dé卋堺 提交于 2019-12-18 04:17:28
问题 I've been trying and reading lots of resources on the internet, trying to find a way to get an UTF-8 keyboard (composed) input from a X Display. But I could not make it work. I have tried the example code from this link (exaple 11-4), but no success. I also have written a simple example (below) to try to make it work. My simple test case is to print an "é", which happens by typing the acute and then the e. What is wrong? Thanks, Here is my example: #include <X11/Xlib.h> #include <X11/Xutil.h>

How to get Gdk window from xid?

a 夏天 提交于 2019-12-18 04:12:38
问题 I'm lost in version 3.. in python2+gdk2 is: #!/usr/bin/env python2 import gtk gtk.gdk.window_process_all_updates() window_xid = 54525964 gdk_window = gtk.gdk.window_foreign_new(window_xid) which is pretty much straight forward. But then, the horror: #!/usr/bin/env python3 from gi.repository import xlib from gi.repository import Gdk from gi.repository import GdkX11 Gdk.Window.process_all_updates() xlib_window = "???????" gdk_display = GdkX11.X11Display.get_default() gdk_window = GdkX11

OpenGL GLX extension not supported

情到浓时终转凉″ 提交于 2019-12-17 23:32:52
问题 I had installed OpenGL and freeglut in Ubuntu 10.04 and it worked fine in 10.04 and 10.10. But after I upgraded to 11.04, the applications I've developed using OpenGL is not running properly. They're compiling without errors, but when I try to execute them, I get there errors: For GLUT: Xlib: extension "GLX" missing on display ":0.0". freeglut (./a.out): OpenGL GLX extension not supported by display ':0.0' For just OpenGL: Xlib: extension "GLX" missing on display ":0.0". main: X server has no

How to identify top-level X11 windows using xlib?

半城伤御伤魂 提交于 2019-12-17 15:36:43
问题 I'm trying to get a list of all top level desktop windows in an X11 session. Basically, I want to get a list of all windows that are shown in the window managers application-switching UI (commonly opened when the user presses ALT+TAB). I've never done any X11 programming before, but so far I've managed to enumerate through the entire window list, with code that looks something like this: void CSoftwareInfoLinux::enumerateWindows(Display *display, Window rootWindow) { Window parent; Window