Hi,

Am Sonntag, den 06.11.2005, 12:01 +0100 schrieb Mattias Gaertner:
> On Sat, 05 Nov 2005 21:21:27 +0100
> dannym <[EMAIL PROTECTED]> wrote:
> 
> > Hi,
> > 
> > Am Samstag, den 05.11.2005, 20:34 +0100 schrieb dannym:
> > > Hi,
> > > 
> > > I'm trying to get ShowInTaskbar for gtk2 working.
> > > 
> > > I tried to do it as in the attached patch for a quick test. Doesn't
> > > work.
> > > 
> > > It has to do with some ridiculously complicated dependency of the
> > > default of ShowInTaskbar on MainForm. Can't get it to work.
> > > 
> > > The symptoms after the patch are:
> > > - no form at all is still in the taskbar
> > > 
> > > Helpp ? :)
> 
> I applied it with a few additions. The MainForm is shown, but under gtk1 we
> have still the problem, that ShowModal hides all forms from the 'taskbar',
> and reshowing does not work.
> Under gtk2 it seems to work.
> 
> 
> > > (P.S. I suggest getting rid of GetShowInTaskBarDefault's dependency on
> > > MainForm, after all, the programmer can still set it the ~one time the
> > > mainform changes over the lifetime of his project)
> > 
> > I tried that, surely enough, that works. I'll stop investigating here,
> > since I think that (just having GetShowInTaskbarDefault return True) is
> > the corrent fix either way.
> ?

um, to sum it up, earlier the bug was because of, in chronological
order,

- the application is started
- the form is created
- In the TCustomForm.Create, FShowInTaskBar is set according to what
MainForm points to, which is nil, hence FShowInTaskBar False
- TCustomForm.Create returns
- the MainForm is set to the form just created, too late
- the Form is Shown
- my modification does thus:
 procedure TCustomForm.DoShow;
 begin
+  HandleNeeded;
+  TWSCustomFormClass(WidgetSetClass).SetShowInTaskbar(Self,
FShowInTaskbar);
+
   if Assigned(FOnShow) then FOnShow(Self);
 end;
 which makes it do anything at all with ShowInTaskbar, as opposed to
before. 
- *However*, FShowInTaskbar is False since it was set in the
constructor. I feel uneasy changing properties underneath the programmer
without notifying him, so I don't "fix it" within DoShow (i.e. set it to
True when nobody is looking :))

To fix the whole thing once and for all, have GetShowInTaskBarDefault
return always True and just have the programmer set it to false manually
for the forms he wants. 


[Note that that is better either way, because the programmer has to
bring the windows that aren't shown in the taskbar to the front
programmatically - since the user can't do it - (for example in reaction
to activating the mainform). At least then it's obvious since he also
has to set ShowInTaskBar to False himself, so he asked for it, he got
it ...]


As a side note:

Note also that in order to change the showintaskbar property, the form
has to be [hidden and] reshown as per EWMH standard
http://standards.freedesktop.org/wm-spec/wm-spec-1.4.html , search for
"The Window Manager SHOULD honor _NET_WM_STATE whenever a withdrawn
window requests to be mapped.". 

That is, the window has to be hidden, the flag set, and the window shown
again (when it was visible yet in the first place, that is).

i.e.
SetShowInTaskBar:
  OldVisible := Visible;
  if OldVisible then Hide;
  FShowInTaskbar := Value;
  gtk_window_set_skip_taskbar(... , not FShowInTaskbar);
  if OldVisible then Show;


> 
> Mattias

cheers,
  Danny


_________________________________________________________________
     To unsubscribe: mail [EMAIL PROTECTED] with
                "unsubscribe" as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives

Reply via email to