Dear all,

The attached patch allows the WINE desktop to be embedded within an existing X11 window, and is similar to the windowed mode in WINE.

I've tested this feature using MS PowerPoint Viewer 2007, so that a fullscreen slideshow can be fitted inside any X11 window.

Regards,
Timothy Lee

diff -Naur -wbBE wine-0.9.54-fe/dlls/winex11.drv/x11drv_main.c wine-0.9.54-fe.rootwin/dlls/winex11.drv/x11drv_main.c
--- wine-0.9.54-fe/dlls/winex11.drv/x11drv_main.c	2008-01-26 00:05:38.000000000 +0800
+++ wine-0.9.54-fe.rootwin/dlls/winex11.drv/x11drv_main.c	2008-02-12 23:20:33.000000000 +0800
@@ -447,6 +447,8 @@
     Display *display;
     XVisualInfo *desktop_vi = NULL;
     const char *env;
+    int new_root = -1;
+    XWindowAttributes attr;
 
     setup_options();
 
@@ -525,6 +527,22 @@
 
     if (TRACE_ON(synchronous)) XSynchronize( display, True );
 
+    // Handle WINEROOTWIN environment variable
+    if (getenv( "WINEROOTWIN" ))
+    {
+        const char* root_str = getenv( "WINEROOTWIN" );
+        if (0 == strncmp( root_str, "0x", 2 ))
+            sscanf( root_str + 2, "%x", &new_root );
+        else
+            sscanf( root_str, "%d", &new_root );
+        if ((new_root >= 0)
+            && XGetWindowAttributes( display, (Window)new_root, &attr ))
+            root_window = (Window)new_root;
+    }
+
+    if (root_window != DefaultRootWindow( display ))
+        xinerama_init( attr.width, attr.height );
+    else
     xinerama_init( WidthOfScreen(screen), HeightOfScreen(screen) );
     X11DRV_Settings_Init();
 
diff -Naur -wbBE wine-0.9.54-fe/loader/wine.man.in wine-0.9.54-fe.rootwin/loader/wine.man.in
--- wine-0.9.54-fe/loader/wine.man.in	2008-01-26 00:05:38.000000000 +0800
+++ wine-0.9.54-fe.rootwin/loader/wine.man.in	2008-02-12 23:52:34.000000000 +0800
@@ -207,6 +207,14 @@
 .I DISPLAY
 Specifies the X11 display to use.
 .TP
+.I WINEROOTWIN
+If set,
+.B
+wine
+will embed its desktop under an existing X11 window with the ID specified by
+this variable.  This allows fullscreen Windows applications to be embedded
+inside X11 applications.
+.TP
 OSS sound driver configuration variables
 .TP
 .I AUDIODEV



Reply via email to