Performance (XGetImage + XPutImage) VS XCopyArea VS (XShmGetImage + XShmPutImage) VS GTK +

I am new not only to Xlib, but also to Linux interface software.

I am trying to solve a general problem (which is not as common as it seems, since I cannot find a reliable example) of drawing the contents of one window to another.

However, I ran into serious performance issues, and I'm looking for a solution that I can use to make the program faster and more reliable.

Now I will provide some information about the program flow, since I'm not sure if the program design was chosen correctly, there may be some errors in using Xlib.

The program receives the identifier (Xlib "Window") of the active window (called SrcWin from now on) appropriately (not the widget identifiers of any program, but the real visible window where all the content is drawn), it first uses XGetInputFocusto get a focused window, then iterates through the windows XQueryTreeuntil the child root of the window is found, then it uses the function XmuClientWindowto get the named window (if it is not already found).

Then, using XGetWindowAttributes, it gets the width and height of SrcWin, which are both used in XCreateSimpleWindowto create a new window (called TrgWin) of the same size.

Some events are logged for a new TrgWin window, such as KeyPress and Expose, using a function XSelectInput.

The graphics context is created as follows:

GC  gc = DefaultGC (Display, ScreenCount (Display) - 1);

, select - X- (struct timeval).

SrcWin, :

XImage *xi;
xi = XGetImage (Display, SrcWin, 0, 0, SrcWinWidth, SrcWinHeight, AllPlanes, ZPixmap);

, TrgWin:

if (xi)
{
    XPutImage (Display, TrgWin, gc, xi, 0, 0, 0, 0, SrcWinWidth, SrcWinHeight);
    XFree (xi);
}

, :

while (XPending (Display))
{
    XNextEvent (Display, &XEvent);
    /* some event processing using switch(XEvent.type){} */
}

, , . , SrcWin TrgWin 40 ( , , ), i5-3337U 21% 20% Xorg, 683 * 752 .

, , SrcWin TrgWin, Xlib, Xlib.

1) KDE, , - - . ?

2) - XShmGetImage + XShmPutImage - , XGetImage + XPutImage?

3) , QT GTK , " ", , , Xlib?

4) "-" QT GTK beign send , , , ? - Xlib, TrgWin 40 , SrcWin .

5) GTK +, ?

.

+4

All Articles