summaryrefslogtreecommitdiff
path: root/xzoom/xzoom-0.3.shm.diff
diff options
context:
space:
mode:
authorB Stack <bgstack15@gmail.com>2021-02-16 16:55:58 -0500
committerB Stack <bgstack15@gmail.com>2021-02-16 16:55:58 -0500
commit1566ee33abe4ec709b6914afa8cbc849c0b6d34c (patch)
treed38771524a799e158866a4fc5b40840773ebacc9 /xzoom/xzoom-0.3.shm.diff
parentMerge branch 'xfce4-nocsd' into 'master' (diff)
downloadstackrpms-1566ee33abe4ec709b6914afa8cbc849c0b6d34c.tar.gz
stackrpms-1566ee33abe4ec709b6914afa8cbc849c0b6d34c.tar.bz2
stackrpms-1566ee33abe4ec709b6914afa8cbc849c0b6d34c.zip
add xzoom
Diffstat (limited to 'xzoom/xzoom-0.3.shm.diff')
-rw-r--r--xzoom/xzoom-0.3.shm.diff180
1 files changed, 180 insertions, 0 deletions
diff --git a/xzoom/xzoom-0.3.shm.diff b/xzoom/xzoom-0.3.shm.diff
new file mode 100644
index 0000000..26a1527
--- /dev/null
+++ b/xzoom/xzoom-0.3.shm.diff
@@ -0,0 +1,180 @@
+Source: https://build.opensuse.org/source/home:Akoellh/xzoom/xzoom-0.3.shm.diff?rev=68bf54e9d06f0bce019d310ccd70d579
+Date: 2021-02-16
+diff -uraN xzoom-0.3.orig/xzoom.c xzoom-0.3/xzoom.c
+--- xzoom-0.3.orig/xzoom.c 2017-10-12 17:53:38.446984725 +0200
++++ xzoom-0.3/xzoom.c 2017-10-12 17:54:46.094982727 +0200
+@@ -28,6 +28,8 @@
+ some other minor changes/fixes
+ tony mancill 2002/02/13 <tmancill@debian.org>
+ hacked in support for WM_DELETE_WINDOW
++Egmont Koblinger Added XSHM auto detection,
++ -shm, -noshm and -autoshm option
+ */
+
+ #include <stdio.h>
+@@ -87,6 +89,9 @@
+ #define MAGX MAG /* horizontal magnification */
+ #define MAGY MAG /* vertical magnification */
+
++int use_xshm = 1;
++int force_xshm = 0;
++
+ int xgrab, ygrab; /* where do we take the picture from */
+
+ int magx = MAGX;
+@@ -136,7 +141,7 @@
+
+ for(i = 0; i < 2; i++) {
+
+-#ifdef XSHM
++if (use_xshm) { /*#ifdef XSHM*/
+ ximage[i] = XShmCreateImage(dpy,
+ DefaultVisualOfScreen(scr),
+ DefaultDepthOfScreen(scr),
+@@ -172,11 +177,15 @@
+ ximage[i]->data = shminfo[i].shmaddr;
+ shminfo[i].readOnly = False;
+
+- XShmAttach(dpy, &shminfo[i]);
+- XSync(dpy, False);
++ if (XShmAttach(dpy, &shminfo[i]) || force_xshm) {
++ XSync(dpy, False);
+
+- shmctl(shminfo[i].shmid, IPC_RMID, 0);
+-#else
++ shmctl(shminfo[i].shmid, IPC_RMID, 0);
++ } else {
++ use_xshm = 0;
++ }
++}
++if (!use_xshm) { /*#else*/
+ char *data;
+ data = malloc(BitmapUnit(dpy) / 8 * width[i] * height[i]);
+
+@@ -191,7 +200,7 @@
+ exit(-1);
+ }
+
+-#endif /* XSHM */
++} /*#endif*/ /* XSHM */
+ }
+ created_images = True;
+ }
+@@ -204,12 +213,12 @@
+ return;
+
+ for(i = 0; i < 2; i++) {
+-#ifdef XSHM
++if (use_xshm) { /*#ifdef XSHM*/
+ XShmDetach(dpy, &shminfo[i]); /* ask X11 to detach shared segment */
+ shmdt(shminfo[i].shmaddr); /* detach it ourselves */
+-#else
++} else { /*#else*/
+ free(ximage[i]->data);
+-#endif
++} /*#endif*/
+ ximage[i]->data = NULL; /* remove refrence to that address */
+ XDestroyImage(ximage[i]); /* and destroy image */
+ }
+@@ -222,6 +231,9 @@
+ fprintf(stderr, "Usage: %s [ args ]\n"
+ "Command line args:\n"
+ "-display displayname\n"
++ "-shm\n"
++ "-noshm\n"
++ "-autoshm\n"
+ "-mag magnification [ magnification ]\n"
+ "-geometry geometry\n"
+ "-source geometry\n"
+@@ -351,6 +363,22 @@
+ continue;
+ }
+
++ if(!strcmp(argv[0], "-shm")) {
++ force_xshm = 1;
++ use_xshm = 1;
++ continue;
++ }
++ if(!strcmp(argv[0], "-noshm")) {
++ force_xshm = 0;
++ use_xshm = 0;
++ continue;
++ }
++ if(!strcmp(argv[0], "-autoshm")) {
++ force_xshm = 0;
++ use_xshm = 1;
++ continue;
++ }
++
+ if(!strcmp(argv[0], "-mag")) {
+ ++argv; --argc;
+
+@@ -818,14 +846,14 @@
+
+ }
+
+-#ifdef XSHM
++if (use_xshm) { /*#ifdef XSHM*/
+ XShmGetImage(dpy, RootWindowOfScreen(scr), ximage[SRC],
+ xgrab, ygrab, AllPlanes);
+-#else
++} else { /*#else*/
+ XGetSubImage(dpy, RootWindowOfScreen(scr),
+ xgrab, ygrab, width[SRC], height[SRC], AllPlanes,
+ ZPixmap, ximage[SRC], 0, 0);
+-#endif
++} /*#endif*/
+ #ifdef FRAME
+ if(buttonpressed) { /* show the frame */
+ DRAW_FRAME();
+@@ -840,11 +868,11 @@
+ else if (depth <= 8*sizeof(int))
+ scale32();
+
+-#ifdef XSHM
++if (use_xshm) { /*#ifdef XSHM*/
+ XShmPutImage(dpy, win, gc, ximage[DST], 0, 0, 0, 0, width[DST], height[DST], False);
+-#else
++} else { /*#else*/
+ XPutImage(dpy, win, gc, ximage[DST], 0, 0, 0, 0, width[DST], height[DST]);
+-#endif
++} /*#endif*/
+ if(set_title) {
+ if(magx == magy && !flipx && !flipy && !flipxy)
+ sprintf(title, "%s x%d", progname, magx);
+diff -uraN xzoom-0.3.orig/xzoom.man xzoom-0.3/xzoom.man
+--- xzoom-0.3.orig/xzoom.man 2017-10-12 17:53:38.446984725 +0200
++++ xzoom-0.3/xzoom.man 2017-10-12 17:56:39.442979378 +0200
+@@ -9,6 +9,7 @@
+ [ \-display \fIdisplayname\fP ] [ \-mag \fImag\fP [ \fImag\fP ] ]
+ [ \-x ] [ \-y ] [ \-xy ]
+ [ \-geometry \fIgeometry\fP ] [ \-source \fIgeometry\fP ]
++[ \-shm ] [ \-noshm ] [ \-autoshm ]
+ .SH OPTIONS
+ .LP
+ .TP 5
+@@ -38,6 +39,16 @@
+ The dimensions of this area are multiplied by the magnification to
+ get the size of \fBxzoom\fR's window. If these dimensions are given
+ separately (by use of \-geometry ) then an error is reported.
++.TP 5
++.B \-shm
++Force XSHM extension.
++.TP 5
++.B \-noshm
++Disable XSHM extension.
++.TP 5
++.B \-autoshm
++Try to autodetect if XSHM is available. This is the default. Unfortunately
++this is not perfect, sometimes you need to manually give \-noshm.
+ .br
+ .SH DESCRIPTION
+ .IR Xzoom
+@@ -148,6 +159,7 @@
+ For best performance the shared memory extension for X11 is
+ used. Xzoom will fail if it is compiled to use XSHM and its
+ display is not on the local host.
++However, Auto detection of XSHM is far from perfect.
+ .LP 5
+ \(dg
+ Xzoom is given with no warranty. It was tested only under
bgstack15