On Tue, Aug 10, 2004 at 01:01:01AM +0530, Kingsly John wrote:
> Hi!
> 
> When tvtime(http://tvtime.sf.net) is starting from a running instance of fvwm
> it doesn't maintain aspect ratio while resizing the window.
> 
> But if fvwm is restarted while tvtime is running... tvtime starts maintaining
> aspect ratio!
> 
> It's not an issue with my config either... as I'm able to get the same
> behavior even when I start fvwm with "-f /dev/null"
> 
> You can find the output of xprop on the same instance of tvtime before and
> after the restart here...
> 
> Before        -  http://kingsly.net/tmp/xprop-noconfig.txt
> 
> After         -  http://kingsly.net/tmp/xprop-restart.txt
> 
> Here is the diff output of the above two files...
> 
> nostalgia tmp $ diff xprop-noconfig.txt xprop-restart.txt 
> 0a1,4
> > _NET_WM_DESKTOP(CARDINAL) = 0
> > _NET_WM_ICON_VISIBLE_NAME(UTF8_STRING) = 0x74, 0x76, 0x74, 0x69, 0x6d, 0x65
> > _NET_WM_VISIBLE_NAME(UTF8_STRING) = 0x74, 0x76, 0x74, 0x69, 0x6d, 0x65,
> > 0x3a, 0x20, 0x76, 0x69, 0x65, 0x77, 0x65, 0x72, 0x20, 0x64, 0x69, 0x73,
> > 0x63, 0x72, 0x65, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x69, 0x73, 0x20, 0x61,
> > 0x64, 0x76, 0x69, 0x73, 0x65, 0x64
> > WM_DESKTOP(WM_DESKTOP) = 0x0
> 12d15
> < _NET_WM_DESKTOP(CARDINAL) = 0
> nostalgia tmp $ 
 
> On other window managers tvtime maintains aspect ratio always... (tried with
> metacity(gnome) and icewm)

I can hardly believe this works in metacity.  From the latest
tvtime sources:

 if( !strcasecmp( wmname, "metacity" ) ) {
   if( xcommon_verbose ) {
     fprintf( stderr, "xcommon: You are using metacity.  Disabling aspect ratio 
hints\n"
     "xcommon: since most deployed versions of metacity are still broken.\n" );
   }
   wm_is_metacity = 1;
 }

;-)
 
> I'm using 2.5.10 on gentoo... and this bug has been around for a long
> time...  I never got around to testing with the -f /dev/null option until now
> :-(

I think it's tvtime's fault.  It sets the aspect ratio hint only
after the window has been mapped and still expects the hint is
used.  I've committed a patch to fvwm too.

The attached patch fixes the tvtime-0.9.12 sources.

Ciao

Dominik ^_^  ^_^

 --
Dominik Vogt, [EMAIL PROTECTED]
Reply-To: [EMAIL PROTECTED]
--- xcommon.c.orig      Tue Aug 10 10:42:10 2004
+++ xcommon.c   Tue Aug 10 15:17:33 2004
@@ -102,6 +102,7 @@
 
 static area_t video_area;
 static area_t window_area;
+static area_t window_area_normal;
 static area_t scale_area;
 
 static int timediff( struct timeval *large, struct timeval *small )
@@ -971,6 +972,12 @@
     classhint.res_name = "TVFullscreen";
     XSetClassHint( display, fs_window, &classhint );
 
+    /* collaborate with the window manager for close requests */
+    XSetWMProtocols( display, wm_window, &wm_delete_window, 1 );
+
+    calculate_video_area();
+    x11_aspect_hint( display, wm_window, video_area.width, video_area.height );
+
     XMapWindow( display, output_window );
     XMapWindow( display, wm_window );
 
@@ -992,12 +999,6 @@
     XDefineCursor( display, output_window, nocursor );
     XSetIconName( display, wm_window, "tvtime" );
 
-    /* collaborate with the window manager for close requests */
-    XSetWMProtocols( display, wm_window, &wm_delete_window, 1 );
-
-    calculate_video_area();
-    x11_aspect_hint( display, wm_window, video_area.width, video_area.height );
-
     if( init_height < 0 ) {
         xcommon_resize_window_fullscreen();
     }
@@ -1090,7 +1091,10 @@
     win_changes.width = window_width;
     win_changes.height = window_height;
 
+#if 0
+    /* dv: why do this twice?  this may confuse window manages */
     XResizeWindow( display, wm_window, window_width, window_height );
+#endif
     XReconfigureWMWindow( display, wm_window, 0, CWWidth | CWHeight, 
&win_changes );
 }
 
@@ -1157,6 +1161,7 @@
         output_width = w;
         output_height = h;
 
+        window_area_normal = window_area;
         window_area.x = x;
         window_area.y = y;
         window_area.width = w;
@@ -1198,6 +1203,7 @@
             x11_ungrab_fullscreen_input( display );
         }
     } else {
+#if 0
         XWindowAttributes attrs;
 
         XGetWindowAttributes( display, wm_window, &attrs );
@@ -1206,6 +1212,11 @@
         output_height = attrs.height;
         window_area.width = attrs.width;
         window_area.height = attrs.height;
+#else
+        window_area = window_area_normal;
+        output_width = window_area.width;
+        output_height = window_area.height;
+#endif
 
         if( has_ewmh_state_fullscreen ) {
             XEvent ev;
@@ -1229,11 +1240,12 @@
             XUnmapWindow( display, fs_window );
             x11_wait_unmapped( display, fs_window );
         }
+    XMoveResizeWindow( display, wm_window, window_area.x, window_area.y,
+                       window_area.width, window_area.height );
     }
     XResizeWindow( display, output_window, output_width, output_height );
     calculate_video_area();
     xcommon_clear_screen();
-    XFlush( display );
     XSync( display, False );
 
     return output_fullscreen;
@@ -1246,10 +1258,25 @@
 
 int xcommon_toggle_aspect( void )
 {
+    unsigned int du;
+    unsigned int w;
+    unsigned int h;
+    int di;
+    Window dw;
+
     output_aspect = !output_aspect;
     calculate_video_area();
     x11_aspect_hint( display, wm_window, video_area.width, video_area.height );
     xcommon_clear_screen();
+    if ( XGetGeometry( display, wm_window, &dw, &di, &di, &w, &h, &du, &du)) {
+        if( output_fullscreen ) {
+            w = xv_get_width_for_height( h );
+            XResizeWindow( display, wm_window, w, h);
+        } else {
+            /* update the window size */
+            xcommon_set_window_height(h);
+        }
+    }
     return output_aspect;
 }
 
@@ -1352,17 +1379,25 @@
             }
             break;
         case ConfigureNotify:
-            if( event.xconfigure.window == wm_window ) {
-                window_area.x = event.xconfigure.x;
-                window_area.y = event.xconfigure.y;
-                window_area.width = event.xconfigure.width;
-                window_area.height = event.xconfigure.height;
-            }
-            reconfwidth = event.xconfigure.width;
-            reconfheight = event.xconfigure.height;
-            if( reconfwidth != output_width || reconfheight != output_height ) 
{
-                reconfigure = 1;
-            }
+            do {
+                if( event.xconfigure.window == wm_window ) {
+                    window_area.x = event.xconfigure.x;
+                    window_area.y = event.xconfigure.y;
+                    window_area.width = event.xconfigure.width;
+                    window_area.height = event.xconfigure.height;
+                    if ( output_fullscreen && !has_ewmh_state_fullscreen) {
+                        window_area_normal = window_area;
+                    }
+                    reconfwidth = event.xconfigure.width;
+                    reconfheight = event.xconfigure.height;
+                    if( reconfwidth != output_width ||
+                    reconfheight != output_height ) {
+                            reconfigure = 1;
+                    }
+                }
+            } while (XCheckTypedWindowEvent(
+                             display, wm_window, ConfigureNotify, &event) ==
+                     True);
             break;
         case KeyPress:
             /* if( event.xkey.state & ShiftMask ) arg |= I_SHIFT; */

Attachment: pgp4DdQb3Vu2K.pgp
Description: PGP signature

Reply via email to