Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 8 Mar 1997 16:46:00 GMT
From:      jr@cs.mun.ca
To:        FreeBSD-gnats-submit@freebsd.org
Subject:   ports/2920: patch for mispositioned xv windows under some window managers
Message-ID:  <199703081646.QAA02749@raku.cs.mun.ca>
Resent-Message-ID: <199703082020.MAA00771@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         2920
>Category:       ports
>Synopsis:       patch for mispositioned xv windows under some window managers
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports
>State:          open
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sat Mar  8 12:20:01 PST 1997
>Last-Modified:
>Originator:     John Rochester
>Organization:
Memorial University of Newfoundland
>Release:        FreeBSD 2.2-970215-GAMMA i386
>Environment:
Window manager: fvwm-2.0.4[35]
>Description:
xv 3.10a doesn't set the window gravity according to a supplied geometry,
so geometry specifications like "-0-0" lead to the window being
positioned slightly off-screen by fvwm.
>How-To-Repeat:
xv -geometry -0-0
>Fix:
--- xv.c.orig	Sat Mar  8 16:29:05 1997
+++ xv.c	Sat Mar  8 16:38:48 1997
@@ -3197,9 +3197,17 @@
   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;
 
@@ -3218,7 +3226,7 @@
   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;
@@ -3267,10 +3275,6 @@
     }
   }
 
-
-  XSetStandardProperties(theDisp,mainW,"","",None,NULL,0,&hints);
-  setWinIconNames(name);
-
   xwmh.input = True;
   xwmh.flags = InputHint;
 
@@ -3295,12 +3299,12 @@
       }
     }
   }
-  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;
--- xvmisc.c.orig	Fri Jan 13 23:41:34 1995
+++ xvmisc.c	Sat Mar  8 16:05:19 1997
@@ -97,10 +97,18 @@
   if (!usesize || !(i&WidthValue))  w = defw;
   if (!usesize || !(i&HeightValue)) h = defh;
 
-  hints.flags |= USSize;
+  hints.flags |= USSize | PWinGravity;
 
-  if (i&XValue && i&XNegative) x = dispWIDE - w - abs(x);
-  if (i&YValue && i&YNegative) y = dispHIGH - h - abs(y);
+  hints.win_gravity = NorthWestGravity;
+  if (i&XValue && i&XNegative) {
+    hints.win_gravity = NorthEastGravity;
+    x = dispWIDE - (w + 2 * bwidth) - abs(x);
+  }
+  if (i&YValue && i&YNegative) {
+    hints.win_gravity = (hints.win_gravity == NorthWestGravity) ?
+	SouthWestGravity : SouthEastGravity;
+    y = dispHIGH - (h + 2 * bwidth) - abs(y);
+  }
 
 
 #define VROOT_TRANS
@@ -136,19 +144,18 @@
   if (!win) return(win);   /* leave immediately if couldn't create */
 
 
-  XSetStandardProperties(theDisp, win, name, name, None, NULL, 0, &hints);
-
   xwmh.input = True;
   xwmh.flags = InputHint;
   if (iconPix) { xwmh.icon_pixmap = iconPix;  xwmh.flags |= IconPixmapHint; }
-  XSetWMHints(theDisp, win, &xwmh);
 
   if (clname && strlen(clname)) {
     classh.res_name = "xv";
     classh.res_class = clname;
-    XSetClassHint(theDisp, win, &classh);
     StoreDeleteWindowProp(win);
   }
+
+  XmbSetWMProperties(theDisp, win, name, name, NULL, 0, &hints, &xwmh,
+      clname ? &classh : NULL);
 
   return(win);
 }
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199703081646.QAA02749>