Pajama Sam's unmanaged window

Ori Pessach ori_pessach_blah at yahoo.com
Mon Jan 28 01:45:42 CST 2002


Hi,

With three small changes to menu.c, tooltips.c and window.c, things I'm 
getting much better results with Pajam Sam et al, without getting WM 
decorations on tooltips and context menus.

The changes are:

- Changed is_window_managed()'s default return value to TRUE
- In tooltips.c, TOOLTIPS_NCCreate(), I set the WS_EX_TOOLWINDOW bit in the 
tooltip's dwExStyle field. This, I believe, is the right thing to do 
regardless of WM considerations, since MSDN specifies that tooltip windows 
have that bit set. 
(http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/CommCtls/ToolTip/Styles.asp)
- In menu.c, I replaced CreateWindowA() with CreateWindowExA(), passing 
WS_EX_TOOLWINDOW as the first parameter. I'm not so sure about this one. I 
don't know whether Windows does this (Win16 surely doesn't), and if it 
doesn't, it might break apps that examine those bits.

With these changes, Pajama Sam works correctly, except for the KDE panel 
problem. I tested another app (WinRAR) for tooltip and context menu behavior, 
and it worked fine. I'd be happier if somebody else tested this, too, before 
submitting the patch. If someone with a Windows machine could check the 
dwExStyle bits on menus somehow, that would be nice. I'll do it myself, as 
soon as I can get my hands on the necessary software. (Windows, mostly).

Anyway, here's the patch:

Index: controls/menu.c
===================================================================
RCS file: /home/wine/wine/controls/menu.c,v
retrieving revision 1.135
diff -u -r1.135 menu.c
--- controls/menu.c	2002/01/03 02:35:23	1.135
+++ controls/menu.c	2002/01/28 05:51:10
@@ -1618,10 +1618,12 @@
     }
 
     /* NOTE: In Windows, top menu popup is not owned. */
-    menu->hWnd = CreateWindowA( POPUPMENU_CLASS_ATOM, NULL,
-                                WS_POPUP, x, y, width, height,
-                                hwndOwner, 0, 
GetWindowLongA(hwndOwner,GWL_HINSTANCE),
-                                (LPVOID)hmenu );
+	menu->hWnd = CreateWindowExA( WS_EX_TOOLWINDOW,
+								  POPUPMENU_CLASS_ATOM, NULL,
+								  WS_POPUP, x, y, width, height,
+								  hwndOwner, 0, GetWindowLongA(hwndOwner,GWL_HINSTANCE),
+								  (LPVOID)hmenu );
+
     if( !menu->hWnd ) return FALSE;
     if (!top_popup) top_popup = menu->hWnd;
 
Index: dlls/comctl32/tooltips.c
===================================================================
RCS file: /home/wine/wine/dlls/comctl32/tooltips.c,v
retrieving revision 1.40
diff -u -r1.40 tooltips.c
--- dlls/comctl32/tooltips.c	2002/01/04 21:27:34	1.40
+++ dlls/comctl32/tooltips.c	2002/01/28 05:51:11
@@ -2114,10 +2114,14 @@
 TOOLTIPS_NCCreate (HWND hwnd, WPARAM wParam, LPARAM lParam)
 {
     DWORD dwStyle = GetWindowLongA (hwnd, GWL_STYLE);
+    DWORD dwExStyle = GetWindowLongA (hwnd, GWL_EXSTYLE);
 
     dwStyle &= 0x0000FFFF;
     dwStyle |= (WS_POPUP | WS_BORDER | WS_CLIPSIBLINGS);
     SetWindowLongA (hwnd, GWL_STYLE, dwStyle);
+
+    dwExStyle |= WS_EX_TOOLWINDOW;
+    SetWindowLongA (hwnd, GWL_EXSTYLE, dwExStyle);
 
     return TRUE;
 }
Index: dlls/x11drv/window.c
===================================================================
RCS file: /home/wine/wine/dlls/x11drv/window.c,v
retrieving revision 1.30
diff -u -r1.30 window.c
--- dlls/x11drv/window.c	2002/01/21 18:41:27	1.30
+++ dlls/x11drv/window.c	2002/01/28 05:51:19
@@ -71,8 +71,9 @@
     /* windows with caption or thick frame are managed */
     if ((win->dwStyle & WS_CAPTION) == WS_CAPTION) return TRUE;
     if (win->dwStyle & WS_THICKFRAME) return TRUE;
+
     /* default: not managed */
-    return FALSE;
+    return TRUE;
 }
 

_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com





More information about the wine-devel mailing list