Set the class hints for managed windows.

diff --git a/include/ts_xutil.h b/include/ts_xutil.h
index 41af045..01bef38 100644
--- a/include/ts_xutil.h
+++ b/include/ts_xutil.h
@@ -32,6 +32,7 @@
 extern Region  TSXPolygonRegion(XPoint*, int, int);
 extern int  TSXRectInRegion(Region, int, int, unsigned int, unsigned int);
 extern int  TSXSaveContext(Display*, XID, XContext, const  char*);
+extern int  TSXSetClassHint(Display*, Window, XClassHint*);
 extern void  TSXSetWMProperties(Display*, Window, XTextProperty*, XTextProperty*, char**, int, XSizeHints*, XWMHints*, XClassHint*);
 extern void  TSXSetWMSizeHints(Display*, Window, XSizeHints*, Atom);
 extern int  TSXSetRegion(Display*, GC, Region);
diff --git a/tsx11/X11_calls b/tsx11/X11_calls
index 78fd27b..96350b0 100644
--- a/tsx11/X11_calls
+++ b/tsx11/X11_calls
@@ -113,6 +113,7 @@
 XSendEvent
 XSetArcMode
 XSetBackground
+XSetClassHint
 XSetClipMask
 XSetClipOrigin
 XSetClipRectangles
diff --git a/tsx11/ts_xutil.c b/tsx11/ts_xutil.c
index 0f17ea3d..e9647f8 100644
--- a/tsx11/ts_xutil.c
+++ b/tsx11/ts_xutil.c
@@ -219,6 +219,17 @@
   return r;
 }
 
+int  TSXSetClassHint(Display* a0, Window a1, XClassHint* a2)
+{
+  int  r;
+  TRACE(x11, "Call XSetClassHint\n");
+  EnterCriticalSection( &X11DRV_CritSection );
+  r = XSetClassHint(a0, a1, a2);
+  LeaveCriticalSection( &X11DRV_CritSection );
+  TRACE(x11, "Ret XSetClassHint\n");
+  return r;
+}
+
 void  TSXSetWMProperties(Display* a0, Window a1, XTextProperty* a2, XTextProperty* a3, char** a4, int a5, XSizeHints* a6, XWMHints* a7, XClassHint* a8)
 {
   TRACE(x11, "Call XSetWMProperties\n");
diff --git a/windows/x11drv/wnd.c b/windows/x11drv/wnd.c
index b31a9d7..cf5ae7b 100644
--- a/windows/x11drv/wnd.c
+++ b/windows/x11drv/wnd.c
@@ -128,13 +128,20 @@
       if(!wndPtr->window)
 	return FALSE;
 
-      if ((wndPtr->flags & WIN_MANAGED) &&
-	  (cs->dwExStyle & WS_EX_DLGMODALFRAME))
-        {
+      if (wndPtr->flags & WIN_MANAGED) {
+	XClassHint *class_hints = TSXAllocClassHint();
+
+	if (class_hints) {
+	  class_hints->res_name = "wineManaged";
+	  class_hints->res_class = "Wine";
+	  TSXSetClassHint( display, wndPtr->window, class_hints );
+	  TSXFree (class_hints);
+	}
+
+	if (cs->dwExStyle & WS_EX_DLGMODALFRAME) {
 	  XSizeHints* size_hints = TSXAllocSizeHints();
 	  
-	  if (size_hints)
-            {
+	  if (size_hints) {
 	      size_hints->min_width = size_hints->max_width = cs->cx;
 	      size_hints->min_height = size_hints->max_height = cs->cy;
                 size_hints->flags = (PSize | PMinSize | PMaxSize);
@@ -143,6 +150,7 @@
                 TSXFree(size_hints);
             }
         }
+      }
       
       if (cs->hwndParent)  /* Get window owner */
 	{