xlib

linux, C++, xft : how to use it?

和自甴很熟 提交于 2019-11-30 16:00:41
问题 I try to use Xft, the tutorial, well let them calling that a tutorial... looks like it was written in a north korean camp... I also found this one. So let me try to do a step-by-step : // g++ XftTest.cc -lX11 -lXft `pkg-config --cflags freetype2` #include<unistd.h> #include<X11/Xlib.h> #include<X11/Xutil.h> #include<X11/Xft/Xft.h> int main() { Display *display; XftFont *font; XftDraw *xftdraw; XRenderColor xrcolor; XftColor xftcolor; display = XOpenDisplay(0); Window XP = XCreateSimpleWindow

linux, C++, xft : how to use it?

断了今生、忘了曾经 提交于 2019-11-30 15:46:46
I try to use Xft, the tutorial , well let them calling that a tutorial... looks like it was written in a north korean camp... I also found this one . So let me try to do a step-by-step : // g++ XftTest.cc -lX11 -lXft `pkg-config --cflags freetype2` #include<unistd.h> #include<X11/Xlib.h> #include<X11/Xutil.h> #include<X11/Xft/Xft.h> int main() { Display *display; XftFont *font; XftDraw *xftdraw; XRenderColor xrcolor; XftColor xftcolor; display = XOpenDisplay(0); Window XP = XCreateSimpleWindow(display,DefaultRootWindow(display),0,0,360,90,0,0,0); XMapWindow(display,XP); font = NULL; /* added 6

How can I use python xlib to generate a single keypress?

二次信任 提交于 2019-11-30 15:44:12
I want to make a very simple python 3 script that will generate a single keypress (F15). I don't want to use a bunch of libraries to do this as I only need one key to be pressed and don't need support for the whole keyboard. I know I need to use KeyPress and KeyRelease in order to generate a keyboard event. I'm just not sure where exactly to start and the documentation is a little confusing. http://tronche.com/gui/x/xlib/events/keyboard-pointer/keyboard-pointer.html http://python-xlib.sourceforge.net/?page=documentation tynn I'll use ctypes to show you how it could work, but porting it to

Does xlib have an active window event?

a 夏天 提交于 2019-11-30 15:23:55
I am trying to write a program that tracks when the active window changes using Xlib. I am have trouble figuring out the best way to do this. These are my ideas so far: Every second use _NET_ACTIVE_WINDOW to get the active window and if it has changed then running the related code for the event. Get a list of all windows and listen to their focus in event. I would have to figure out how to keep an up to date list of open windows though. Is their an easier/better way? I am new to programming with Xlib. Here's a Python implementation of what @alanc proposed. import Xlib import Xlib.display disp

X11 Mouse Movement Event

做~自己de王妃 提交于 2019-11-30 15:01:34
When creating a Window in XLib What are the masks I provide to the SetWindowAttributes.event_mask member? What do I have to pass to the 11th paramater of XCreateWindow() What are the Events I am looking for in the main message loop (Where I use XNextEvent(lDisplay, &xEvent); ? Since X behaves differently than Microsoft's Win32 API, how do I determine if the mouse is over my window or a window in my "Application" and not over the desktop? I have looked for a similar post. If there is already one out there please point me in the right direction. Update For those who want the easy answer to parts

Embed an app into a window

青春壹個敷衍的年華 提交于 2019-11-30 14:14:30
FvwmButtons (a module of fvwm window manager) has the Swallow function, that embeds the window of an application into a panel. I have to do something like this with Motif and Xlib. I want to embed an Xclock into my application. I guess I have to change the Window ID of the embedded app. How can I do that? the only supported and reliable mechanism is XEmbed, but it requires the embedded app to cooperate. Without a cooperating app, you're in a world of scary hacks. The basic thing you need to do is XReparentWindow() but the problem is that you're fighting the window manager which will also want

How to get Gdk window from xid?

自作多情 提交于 2019-11-30 13:26:54
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.X11Window.foreign_new_for_display(gdk_display, xlib_window) the xlib is killing me.. I'm unable to do anything

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

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

Xlib and Firefox behavior

╄→гoц情女王★ 提交于 2019-11-30 05:33:48
I'm trying to create a small window manager (just for fun), but I'm having problems in handling windows created by Firefox (only with that application, other apps works fine) The problem is, after I launch Firefox, and add my decoration, it seems to work fine, but if for example I try to click on the menu button, the (sub)window doesn't appear. What seems to happen is that after the click, a ClientMessage event is fired with the following values: Data: (null) Data: _NET_WM_STATE_HIDDEN Data: (null) Data: (null) Data: (null) Now the problem is that I don't know how to show the window, which