RE: TOPMOST window support

2000-09-18 Thread Stephane Lussier



 -Original Message-
 From: gerard patel [mailto:[EMAIL PROTECTED]]

 As you can see (I have also added trace in XSetWindowPos),
 your last patch is doing restacking with unmapped windows :-)
 While it does not crash *my* X server, this kind of call seems
 to not produce any effect for me.

 In my other failing app, the problem was  similar but the app was
 trying to set a window before a combolbox (hidden, of course).

 The following patch fixes both my failing apps, but is it
 correct ? Probably it should be done at the X SetWindowPos
 level instead, but I'm not sure, these 'Z-order + visible' problems
 are complex :-(

 @@ -2737,7 +2737,7 @@
 {
   if (!(wndTemp-dwExStyle  WS_EX_TOPMOST))
 break;
 - else
 + else if (wndTemp-dwStyle  WS_VISIBLE)
{
 /* this is a topmost window, place the window
 after this one */
  hwndInsertAfter = wndTemp-hwndSelf;


To do it right, I think we should do the change in the X11 layer. If your
current patch is accepted, that shouldn't be too hard to do now, that you're
keeping a flag for the mapping state. When restacking the window, instead of
just checking if hwndInsertAfter is not a ZeroSized window, we could simply
check if it is map or not (using the flag you've introduced).



 OTOH, I have tried to reimplement your rejected patch on zero-size
 windows; the attached patch tries to tackle the same problem in
 the X-driver

 I have changed the presentation of your code because I found
 difficult to wrap
 my small brain around it and added a feature to reset the z-order
 when a window
 is reordered while not being mapped.

 This patch fixes my 2 not-yet-broken apps, fixes Lotus Notes,
 fixes also 2 other
 problems of managed mode (pseudotooltips of ForteFreeAgent, pseudo
 combos of the open dialog box of WordViewer 16 bits). OTOH it probably
 breaks lots of other applications :-)


I don't have a whole test suite of applications like you have, but your
patch is not causing any problem with the apps I'm working on. Also, I think
it is a little bit easier to read than current implementation.

Stephane Lussier
Macadamian Technologies




RE: TOPMOST window support

2000-09-17 Thread gerard patel

At 12:50 PM 9/15/00 -0400, you wrote:
snip

I have actually looked further at your patch and my first patch is
not correct. In fact, while a 'true' child window can not be made
ws_ex_topmost, a 'child of the desktop' can (useless as it is)
And I failed to notice that the call setting the combolbox topmost
was actually ... Wine internal code :-))

[I don't use +relay in this trace because it change the program
execution in this case; there is no problem if I use relay tracing :-]

I start from there :
hwnd  wndPtr  queue  Class Name StyleWndProc Text
008c 40345b18 0257   #327691600 40ca02bc null
 02fc40345d88 0257   TSwatForm 16ca 40ca07a8 L"Swat!"
 054040345fcc 0257   TOptionsDlg   86c8 40ca0898 L"Options"
 043c40345ec8 0257   TAboutBox 86c8 40ca0820 L"About"
 027040345cfc 0257   TPUtilWindow  8400 40ca0730 L""
 013040345bbc 0257   TApplication  94ca 40ca06b8 L"Swat!"

Then I open the menu for TSwatForm:

trace:win:WINPOS_WindowFromPoint scope 02fc 293,101
trace:win:WIN_CreateWindowEx # "#32768" 0008 8000 260,103 97x59 02fc  
0040 0x234
trace:win:WINPOS_SendNCCalcSize 260,103-357,162
trace:win:WIN_SetWindowLong 644=0x403460d0 0 234 2
trace:win:WIN_CreateWindowEx created window 0644
trace:win:SetWindowPos hwnd 0644, ins  swp (0,0)-(0,0) flags 0053
trace:win:SetWindowPos  current (260,103)-(357,162), style 8400
warn:win:SWP_DoOwnedPopups (0644) hInsertAfter =  

Then I select the menu item for opening TOptionsDlg,
the following code is run (I have added a trace) :

/* find the first non-topmost window */
for (wndTemp = WIN_LockWndPtr(WIN_GetDesktop()-child); wndTemp;
   WIN_UpdateWndPtr(wndTemp,wndTemp-next))
{
  TRACE("TOP: wnd=%x visible=%s top=%s\n", wndTemp-hwndSelf,
  (wndTemp-dwStyle  WS_VISIBLE)? "Yes":"No",
  (wndTemp-dwExStyle   WS_EX_TOPMOST) ? "Yes":"No");
  if (!(wndTemp-dwExStyle  WS_EX_TOPMOST))
break;
  else
  {
/* this is a topmost window, place the window after this one */
hwndInsertAfter = wndTemp-hwndSelf;
TRACE("the top window is a topmost window(hwnd=%x, 
hwndInsertAfter=%x)\n",
  wndPtr-hwndSelf, hwndInsertAfter);
  }
}
 

trace:win:ShowWindow hwnd=0540, cmd=1
trace:win:SetWindowPos hwnd 0540, ins  swp (0,0)-(0,0) flags 0063
trace:win:SetWindowPos  current (208,183)-(592,416), style 86c8
warn:win:SWP_DoOwnedPopups (0540) hInsertAfter = 
trace:win:WINPOS_SendNCCalcSize 208,183-592,416
trace:win:SetWindowPos A non topmost window(hwnd=540) is placed at the top
trace:win:SetWindowPos TOP: wnd=644 visible=No top=Yes
trace:win:SetWindowPos the top window is a topmost window(hwnd=540, 
hwndInsertAfter=644)
trace:win:SetWindowPos TOP: wnd=2fc visible=Yes top=No
trace:event:EVENT_ProcessAllEvents called (thread 80c3330).
trace:win:X11DRV_WND_SetZOrder restack 540 over 644
trace:event:EVENT_ProcessAllEvents called (thread 80c3330).
trace:event:EVENT_ProcessAllEvents called (thread 8064b80).
trace:win:WINPOS_SetActiveWindow (0540, 0, 1)
trace:win:SetWindowPos  status flags = 1863
trace:event:EVENT_ProcessAllEvents called (thread 80c3330).
trace:event:EVENT_ProcessAllEvents called (thread 8064b80).
trace:win:SetWindowPos hwnd 0540, swp (0,0)-(0,0) flags 0063
trace:win:SetWindowPos hwnd 0540, ins  swp (0,0)-(0,0) flags 0003
trace:win:SetWindowPos  current (208,183)-(592,416), style 96c8
warn:win:SWP_DoOwnedPopups (0540) hInsertAfter = 
trace:win:SetWindowPos A non topmost window(hwnd=540) is placed at the top
trace:win:SetWindowPos TOP: wnd=644 visible=No top=Yes
trace:win:SetWindowPos the top window is a topmost window(hwnd=540, 
hwndInsertAfter=644)
trace:win:SetWindowPos TOP: wnd=540 visible=Yes top=No
trace:event:EVENT_ProcessAllEvents called (thread 80c3330).
trace:win:X11DRV_WND_SetZOrder restack 540 over 644
trace:event:EVENT_ProcessAllEvents called (thread 80c3330)

As you can see (I have also added trace in XSetWindowPos), 
your last patch is doing restacking with unmapped windows :-)
While it does not crash *my* X server, this kind of call seems
to not produce any effect for me.

In my other failing app, the problem was  similar but the app was 
trying to set a window before a combolbox (hidden, of course).

The following patch fixes both my failing apps, but is it 
correct ? Probably it should be done at the X SetWindowPos
level instead, but I'm not sure, these 'Z-order + visible' problems
are complex :-(

@@ -2737,7 +2737,7 @@
{
  if (!(wndTemp-dwExStyle  WS_EX_TOPMOST))
break;
- else
+ else if (wndTemp-dwStyle  WS_VISIBLE)
   {

Re: TOPMOST window support

2000-09-15 Thread Dimitrie O. Paun

From: "Stephane Lussier" [EMAIL PROTECTED]

 Here's a patch trying to implement the TOPMOST feature of Windows. As some
 of you probably know, there's no way to set a window as topmost in X.

Well, this is something that probably the WMs can handle -- maybe we should
suggest that they add some hint to this effect to the GNOME/KDE WM standard.

--
Dimi.





Re: TOPMOST window support

2000-09-15 Thread gerard patel

At 09:49 AM 9/15/00 -0400, you (Stephane Lussier) wrote:
Here's a patch trying to implement the TOPMOST feature of Windows. As some
of you probably know, there's no way to set a window as topmost in X. So I
add to do a couple of tricky things to emulate this feature in Wine. Also
with this patch, a window will be topmost only relatively to other Wine
windows.
snip

I have not looked at your patch but it breaks one of my test apps; it seems
that an uncaring programmer asked to set topmost a  'child of the 'desktop'.
I guess that what he wanted was just to set the window at the top
of the z-order.

Does the following patch work also with your app(s) ?

Hmm, I see that I have also a problem with another test app; a config dialog
that used to come before the main window now hides itself behind;
it's a Borland test app - I guess that my licence includes the right
to distribute binaries, so I can send it to you if you're interested
(it's a fascinating game known as 'swat', really an apt symbol of
my activity with Wine :-))

Gerard

--- winpos.c.orig   Fri Sep 15 17:32:57 2000
+++ winpos.cFri Sep 15 18:00:31 2000
@@ -2709,8 +2709,11 @@
   if ( (hwndInsertAfter == HWND_TOPMOST) ||
(wnd  (wnd-dwExStyle  WS_EX_TOPMOST)  bChangePos) )
   {
-TRACE("Setting topmost flag for hwnd=%x\n", wndPtr-hwndSelf);
-wndPtr-dwExStyle |= WS_EX_TOPMOST;
+if (!(wndPtr-dwStyle  WS_CHILD))
+{
+TRACE("Setting topmost flag for hwnd=%x\n", wndPtr-hwndSelf);
+wndPtr-dwExStyle |= WS_EX_TOPMOST;
+}
 if (hwndInsertAfter == HWND_TOPMOST)
   hwndInsertAfter = HWND_TOP;
   }