XShmQueryExtension, XShmQueryVersion, XShmPixmapFormat, XShmAttach, XShmDetach XShmCreateImage, XShmPutImage, XShmGetImage, XShmCreatePixmap, XShmGetEventBase - X Shared Memory extension functions


#include <X11/Xlib.h>
#include <sys/ipc.h>
#include <sys/shm.h>
#include <X11/extensions/XShm.h>



Display *display);

Bool XShmQueryVersion(

Display *display;

int *major, *minor;

Bool *pixmaps);

Status XShmPixmapFormat(

Display *display);

Status XShmAttach(

Display *display;

XShmSegmentInfo *shminfo);

Status XShmDetach(

Display *display;

XShmSegmentInfo *shminfo);

XImage *XShmCreateImage (

Display *display;

Visual *visual;

unsigned int depth;

int format;

char *data;

XShmSegmentInfo *shminfo;

unsigned int width, height);

Status XShmPutImage(

Display *display;

Drawable d;

GC gc;

XImage *image;

int src_x, src_y, dest_x, dest_y;

unsigned int width, height;

bool send_event);

Status XShmGetImage (

Display *display;

Drawable d;

XImage *image;

int x, y;

unsigned long plane_mask);

Pixmap XShmCreatePixmap(
Display *display;
Drawable d;
char *data;

XShmSegmentInfo *shminfo;

unsigned int width, height, depth);

Status XShmGetEventBase(

Display *display);


typedef struct {
int type; /* of event */
unsigned long serial; /* # of last request processed by server*/
Bool send_event; /* true if this came from a SendEvent request*/
Display *display; /* Display the event was read from */
Drawable drawable; /* drawable of request */
int major_code; /* ShmReqCode */
int minor_code; /* X_ShmPutImage */
ShmSeg shmseg; /* the ShmSeg used in the request*/
unsigned long offset; /* the offset into ShmSeg used in the request*/
} XShmCompletionEvent;

a structure of type XShmSegmentInfo :

typedef struct {
ShmSeg shmseg; /* resource id */
int shmid; /* kernel id */
char *shmaddr; /* address in client */
Bool readOnly; /* how the server should attach it */
} XShmSegmentInfo;


XShmQueryExtension checks to see if the shared memory extensions are available for the specified display.

XShmQueryVersion returns the version numbers of the extension implementation. Shared memory pixmaps are supported if the pixmaps argument returns true.

XShmAttach tells the server to attach to your shared memory segment. If all goes well, you will get a non-zero status, back and your XImage is ready for use.

XShmDetach tells the server to detach from your shared memory segment.

XShmPutImage combines an image in memory with a shape of the specified drawable. If XYBitmap format is used, the depth must be one, or a ‘‘BadMatch’’ error results. The foreground pixel in the GC defines the source for the one bits in the image, and the background pixel defines the source for the zero bits. For XYPixmap and ZPixmap, the depth must match the depth of the drawable, or a ‘‘BadMatch’’ error results.

XShmGetImage reads image data into a shared memory XImage where display is the display of interest, drawable is the source drawable, image is the destination XImage, x and y are offsets within the drawable, and plane_mask defines which planes are to be read.

XShmCreateImage allocates the memory needed for an XImage structure for the specified display but does not allocate space for the image itself.

XShmPixmapFormat gets the format for the server. If your application can deal with the server pixmap data format, a shared memory segment and shminfo structure are created.

XShmCreatePixmap points to a pixmap which you can manipulate in all of the usual ways, with the added bonus of being able to edit its contents directly through the shared memory segment.

XShmGetEventBase gets the completion event value.


MIT-SHM - The MIT Shared Memory Extension

More Linux Commands

lchown(2) - change ownership of a file - Linux manual page
These system calls change the owner and group of a file. The chown(), fchown(), and lchown() system calls differ only in how the file is specified: * chown() ch

XkbGetVirtualMods(3) - Obtain a subset of the virtual modifi
XkbGetVirtualMods sends a request to the server to obtain the vmods entries for the virtual modifiers specified in the mask, which, and waits for a reply. Virtu

combinediff(1) - create a cumulative unified patch from two
combinediff creates a unified diff that expresses the sum of two diffs. The diff files must be listed in the order that they are to be applied. For best results

rmiregistry-java-1.8.0-openjdk(1) Starts a remote object reg
The rmiregistry command creates and starts a remote object registry on the specified port on the current host. If the port is omitted, then the registry is star

unsetenv(3) - change or add an environment variable.........
The setenv() function adds the variable name to the environment with the value value, if name does not already exist. If name does exist in the environment, the

leaftoppm(1) - convert Interleaf image format to PPM image
This program is part of Netpbm(1) leaftoppm reads a PPM image as input and generates an Interleaf image file as output. Interleaf is a now-defunct (actually pur

libcurl(3) - client-side URL transfers - Linux manual page
This is a short overview on how to use libcurl in your C programs. There are specific man pages for each function mentioned in here. There are also the libcurl-

getwin_sp(3ncurses) - curses screen-pointer extension.......
This implementation can be configured to provide a set of functions which improve the ability to manage multiple screens. This feature can be added to any of th

XtAppAddBlockHook(3) - register a block hook procedure......
XtAppAddBlockHook registers the specified procedure and returns an identifier for it. The hook is called at any time in the future when the Intrinsics are about

mvwinch(3ncurses) - get a character and attributes from a cu
These routines return the character, of type chtype, at the current position in the named window. If any attributes are set for that position, their values are

Tcl_AllocStatBuf(3) - procedures to interact with any filesy
There are several reasons for calling the Tcl_FS API functions (e.g. Tcl_FSAccess and Tcl_FSStat) rather than calling system level functions like access and sta

Tk_Class(3) - set or retrieve a window's class (Man Page)...
Tk_SetClass is called to associate a class with a particular window. The class string identifies the type of the window; all windows with the same general class

We can't live, work or learn in freedom unless the software we use is free.