06cb6c48c0
adapted by rohee@ by way of millert@ while here, adapt patches to regular naming scheme
92 lines
3.0 KiB
Plaintext
92 lines
3.0 KiB
Plaintext
$OpenBSD: patch-xv_c,v 1.1 2004/09/21 18:46:04 sturm Exp $
|
|
--- xv.c.orig Tue Sep 21 06:49:20 2004
|
|
+++ xv.c Tue Sep 21 06:50:28 2004
|
|
@@ -1990,10 +1990,9 @@ static int openPic(filenum)
|
|
#else /* it is VMS */
|
|
sprintf(filename, "[]xvXXXXXX");
|
|
#endif
|
|
- mktemp(filename);
|
|
+ fp = fdopen(mkstemp(filename), "w");
|
|
|
|
clearerr(stdin);
|
|
- fp = fopen(filename,"w");
|
|
if (!fp) FatalError("openPic(): can't write temporary file");
|
|
|
|
while ( (i=getchar()) != EOF) putc(i,fp);
|
|
@@ -2759,7 +2758,7 @@ int UncompressFile(name, uncompname)
|
|
|
|
#ifndef VMS
|
|
sprintf(uncompname, "%s/xvuXXXXXX", tmpdir);
|
|
- mktemp(uncompname);
|
|
+ close(mkstemp(uncompname));
|
|
sprintf(buf,"%s -c %s >%s", UNCOMPRESS, fname, uncompname);
|
|
#else /* it IS VMS */
|
|
strcpy(uncompname, "[]xvuXXXXXX");
|
|
@@ -2934,8 +2933,8 @@ static int readpipe(cmd, fname)
|
|
if (!cmd || (strlen(cmd) < (size_t) 2)) return 1;
|
|
|
|
sprintf(tmpname,"%s/xvXXXXXX", tmpdir);
|
|
- mktemp(tmpname);
|
|
- if (tmpname[0] == '\0') { /* mktemp() blew up */
|
|
+ close(mkstemp(tmpname));
|
|
+ if (tmpname[0] == '\0') { /* mkstemp() blew up */
|
|
sprintf(str,"Unable to create temporary filename.");
|
|
ErrPopUp(str, "\nHow unlikely!");
|
|
return 1;
|
|
@@ -3232,9 +3231,17 @@ static void createMainWindow(geom, name)
|
|
hints.flags = 0;
|
|
if ((i&XValue || i&YValue)) hints.flags = USPosition;
|
|
|
|
- if (i&XValue && i&XNegative) x = vrWIDE - eWIDE - abs(x);
|
|
- if (i&YValue && i&YNegative) y = vrHIGH - eHIGH - abs(y);
|
|
-
|
|
+ hints.win_gravity = NorthWestGravity;
|
|
+ if (i&XValue && i&XNegative) {
|
|
+ hints.win_gravity = NorthEastGravity;
|
|
+ x = vrWIDE - (eWIDE + 2 * bwidth) - abs(x);
|
|
+ }
|
|
+ if (i&YValue && i&YNegative) {
|
|
+ hints.win_gravity = (hints.win_gravity == NorthWestGravity) ?
|
|
+ SouthWestGravity : SouthEastGravity;
|
|
+ y = vrHIGH - (eHIGH + 2 * bwidth) - abs(y);
|
|
+ }
|
|
+
|
|
if (x+eWIDE > vrWIDE) x = vrWIDE - eWIDE; /* keep on screen */
|
|
if (y+eHIGH > vrHIGH) y = vrHIGH - eHIGH;
|
|
|
|
@@ -3253,7 +3260,7 @@ static void createMainWindow(geom, name)
|
|
hints.x = x; hints.y = y;
|
|
hints.width = eWIDE; hints.height = eHIGH;
|
|
hints.max_width = maxWIDE; hints.max_height = maxHIGH;
|
|
- hints.flags |= USSize | PMaxSize;
|
|
+ hints.flags |= USSize | PMaxSize | PWinGravity;
|
|
|
|
xswa.bit_gravity = StaticGravity;
|
|
xswa.background_pixel = bg;
|
|
@@ -3302,10 +3309,6 @@ static void createMainWindow(geom, name)
|
|
}
|
|
}
|
|
|
|
-
|
|
- XSetStandardProperties(theDisp,mainW,"","",None,NULL,0,&hints);
|
|
- setWinIconNames(name);
|
|
-
|
|
xwmh.input = True;
|
|
xwmh.flags = InputHint;
|
|
|
|
@@ -3330,12 +3333,12 @@ static void createMainWindow(geom, name)
|
|
}
|
|
}
|
|
}
|
|
- XSetWMHints(theDisp, mainW, &xwmh);
|
|
|
|
classh.res_name = "xv";
|
|
classh.res_class = "XVroot";
|
|
- XSetClassHint(theDisp, mainW, &classh);
|
|
|
|
+ XmbSetWMProperties(theDisp, mainW, NULL, NULL, NULL, 0, &hints, &xwmh, &classh);
|
|
+ setWinIconNames(name);
|
|
|
|
if (nodecor) { /* turn of image window decorations (in MWM) */
|
|
Atom mwm_wm_hints;
|