xlib

How do I efficiently determine if a polygon is convex, non-convex or complex?

强颜欢笑 提交于 2019-12-17 02:28:31
问题 From the man page for XFillPolygon: If shape is Complex , the path may self-intersect. Note that contiguous coincident points in the path are not treated as self-intersection. If shape is Convex , for every pair of points inside the polygon, the line segment connecting them does not intersect the path. If known by the client, specifying Convex can improve performance. If you specify Convex for a path that is not convex, the graphics results are undefined. If shape is Nonconvex , the path does

How to detect a user logged in through GUI in Linux

牧云@^-^@ 提交于 2019-12-14 03:55:42
问题 I would like to capture the user name logged in through GUI in my program. My program is running as a daemon from root login. If a non root user logs in through GUI my program should be notified. I am pasting my current program which calls a perl script making use of system call to check who is the current user logged in. I am pasting my perl script too for reference. #include <X11/Xlib.h> #include <X11/Xos.h> #include <X11/Xfuncs.h> #include <X11/Xutil.h> #include <X11/Xatom.h> int main() {

X11 ConfigureNotify() always returning x,y = (0,0)

偶尔善良 提交于 2019-12-14 02:22:44
问题 I have an X11 window that was created using XCreateWindow with the parent set to DefaultRootWindow(dpy). The window receives ConfigureNotify events. However, no matter where the window is moved, the ConfigureNotify reports the position as 0,0. The same is true for calls to XGetWindowAttributes(). What's going on here? There's also something else that's driving me nuts. I'm telling CreateWindow to place the window at a particular coordinates. But it's anyone's guess where the window actually

Saving xlib XImage to PNG

大兔子大兔子 提交于 2019-12-14 01:04:42
问题 I am using xlib. I have an XImage structure filled with information from an XGetImage() call. Is there a popular method to get from XImage to something more meaningful.. namely PNG? I have looked at libpng, but have heard from pretty much everyone that it's a beast to tame. Would this still be the recommended path to take? 回答1: See also How to save XImage as bitmap? though that person had the constraint that they couldn't use a library. If you can use a library, Cairo is a good one that will

X11: will XGrabPointer prevent other apps from any mouse event?

半世苍凉 提交于 2019-12-13 19:26:15
问题 with following code: XGrabPointer(d, root, False, ButtonPressMask , GrabModeAsync, GrabModeAsync, None, None, CurrentTime); I just specify with button press event, but when running other applications can't get any other mouse event such as mouse move. Is it what this function designed to be? or with something I made wrong understanding. like parameter owner_events, I can't understand well. If owner_events is False, all generated pointer events are reported with respect to grab_window and are

problem with dead keys (acute, diaeresis, etc) c++

落花浮王杯 提交于 2019-12-13 16:00:55
问题 I'm currently writing my own virtual keyboard for linux using the X11 lib and i just can't find the way to simulate a KeyPress event of any dead keys. I'd tried , for example, to write "á" using the asigned macro, which is XK_aacute, and nothing happens. later i'd tried to send XK_acute (the acute accent macro) and then XK_a, and again, nothing happens :( In the KDE virtual Keyboard "Kvkbd" it's possible to do this, so i downloaded the source code, but it only supports the english keyboard

Qt with XComposite problem

佐手、 提交于 2019-12-13 03:54:30
问题 I'm trying to write a simple program, which redirects all the windows to the backbuffer( as the composite manager does ), then write them to pixmap and save to disk. But I got this error: (.text.startup+0x5e):-1: error: undefined reference to `XCompositeRedirectSubwindows' (.text.startup+0x171):-1: error: undefined reference to `XCompositeNameWindowPixmap' :-1: error: collect2: ld returned 1 exit status Here is the code : #include <QApplication> #include <QDebug> #include <X11/Xlib.h>

Xlib python: cannot map firefox menus

Deadly 提交于 2019-12-13 01:12:19
问题 I'm making a small window manager based on: simplewm.py https://github.com/mpnordland/Mozzarella/blob/master/cheesewm.py~ I'm trying to get firefox working but have been unable to get the unmapped windows (which are the firefox menu/right click options) to appear. I have tried window.map() however that only makes the menu flicker and disappear again. It also causes an event of "Xlib.X.UnmapNotify" When I right click (or click the menu) in firefox it causes 2 xlib events: Xlib.protocol.event

XEventsQueued equivalent in xcb

主宰稳场 提交于 2019-12-12 10:14:55
问题 I have read 'Need for XEventsQueued(display, QueuedAfterReading) in XCB' but the answer specifies a function ( xcb_poll_for_queued_event ) that modifies the internal event queue. I need a function that is exactly the equivalent of XEventsQueued(display, QueuedAfterReading) . Modifying the event queue breaks the code I'm currently writing if done where XEventsQueued would be used. What is the equivalent function or block of code in xcb? 来源: https://stackoverflow.com/questions/31624732

XLib windows auto-alignment performance

余生颓废 提交于 2019-12-12 00:42:57
问题 In XLib based application, I need to make the child window to be resized after the parent window. (For example, in order to make the child window to take the whole client area of the parent window) I am processing the ConfigureNotify event of the parent window and resizing the child window when needed. In generally it works properly. But there is a delay between resizing the parent window (for example when the user resizes the window dragging the edge) and the event received by the