Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2010-12

Taskbar button for modal forms

8 messages · 3 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

cobines

Hi everyone.

I have a main form application that has a taskbar button. Whenever I show another form as modal form I don't want it to have a taskbar button, because switching back to previous form is pointless as it is disabled anyway. Is there a way to set this up for the whole application, or do I have to manually set ShowInTaskbar=stNever everytime I call ShowModal?

Also, I have noticed that in LCLQT (in Linux) a taskbar button is not shown for modal forms even with ShowInTaskbar=stAlways. However in LCLGTK2 (in Linux) it is shown for modal forms, unless I set ShowInTaskbar=stNever. Is there a bug in LCLGTK2 or LCLQT? It can also be WindowManager dependent, I use XFCE.

From LCL point of view (independent of widgetset), should modal forms

have taskbar button by default?

cobines

Reply by email

Graeme Geldenhuys
to cobines
cobines wrote 6 lines
Also, I have noticed that in LCLQT (in Linux) a taskbar button is not shown for modal forms even with ShowInTaskbar=stAlways. However in LCLGTK2 (in Linux) it is shown for modal forms, unless I set ShowInTaskbar=stNever. Is there a bug in LCLGTK2 or LCLQT? It can also be WindowManager dependent, I use XFCE.

Modal forms are supposed to share the same taskbar button as their parent form (meaning if you click the taskbar button of the parent form, the modal form will be brought to the front and have focus). So what you described above, means that LCL-GTK2 has a bug.

Regards, ? - Graeme - _______________________________________________ fpGUI - a cross-platform Free Pascal GUI toolkit http://opensoft.homeip.net:8080/fpgui/

Reply by email

zeljko
to Graeme Geldenhuys
Graeme Geldenhuys wrote 11 lines
On 24 December 2010 00:33, cobines wrote: > Also, I have noticed that in LCLQT (in Linux) a taskbar button is not > shown for modal forms even with ShowInTaskbar=stAlways. However in > LCLGTK2 (in Linux) it is shown for modal forms, unless I set > ShowInTaskbar=stNever. Is there a bug in LCLGTK2 or LCLQT? It can also > be WindowManager dependent, I use XFCE. Modal forms are supposed to share the same taskbar button as their parent form (meaning if you click the taskbar button of the parent form, the modal form will be brought to the front and have focus). So what you described above, means that LCL-GTK2 has a bug.

That's not LCL-gtk2, but gtk2 bug.

zeljko

Reply by email

Graeme Geldenhuys
to zeljko
zeljko wrote
That's not LCL-gtk2, but gtk2 bug.

You are wrong. I'm running Pan naw (a NNTP news reader), I open up the settings dialog which is a modal dialog. There is only one taskbar button. Changing desktops or application focus, and clicking on the taskbar button brings Pan's Settings dialog to focus. It works as expected, and Pan is a GTK2 application. I tried a few other true GTK2 apps (no LCL involved) and they all work as expected. I'm using Ubuntu 8.04.4 here.

So the odd behaviour seems to be limited to LCL-GTK2.

Regards, ? - Graeme - _______________________________________________ fpGUI - a cross-platform Free Pascal GUI toolkit http://opensoft.homeip.net:8080/fpgui/

Reply by email

zeljko
to Graeme Geldenhuys
Graeme Geldenhuys wrote
On 24 December 2010 09:34, zeljko wrote: > That's not LCL-gtk2, but gtk2 bug. You are wrong. I'm running Pan naw (a NNTP news reader), I open up the

No, I'm not. My devel machine have gtk2-2.12, and here it works ok (no need to hide modal forms from taskbar), but under gtk2-2.20 something's wrong and modal form is shown in taskbar.
Try Pan with eg. ubuntu 10.04 or 10.10

Reply by email

Graeme Geldenhuys
to zeljko
zeljko wrote 5 lines
No, I'm not. My devel machine have gtk2-2.12, and here it works ok (no need to hide modal forms from taskbar), but under gtk2-2.20 something's wrong and modal form is shown in taskbar. Try Pan with eg. ubuntu 10.04 or 10.10

My Ubunut 8.04.4 also uses gtk2-2.12 and it works fine here. I don't have access to Ubuntu 10.04 (which I have installed at work) at the moment, so can't test or verify there.

@to the original poster of this thread
What version of GTK2 are you using?

Regards, ? - Graeme - _______________________________________________ fpGUI - a cross-platform Free Pascal GUI toolkit http://opensoft.homeip.net:8080/fpgui/

Reply by email

cobines
to Graeme Geldenhuys

2010/12/24 Graeme Geldenhuys :

@to the original poster of this thread What version of GTK2 are you using?

I have GTK 2.23.2.

I checked some GTK2 non-LCL applications, whenever modal form is shown no additional taskbar button is created.

But could it be "fixed" in LCLGTK2, at least for the newer GTK2 versions? Same code that causes taskbar button not to be created for ShowInTaskbar=stNever could be used to suppress it when showing the form as modal. Like this:

Index: gtk2winapi.inc
===================================================================
--- gtk2winapi.inc	(wersja 28817)
+++ gtk2winapi.inc	(kopia robocza)
@@ -8186,6 +8186,8 @@
       {$IFDEF DebugGDKTraps}
       BeginGDKErrorTrap;
       {$ENDIF}
+      if fsModal in AForm.FormState then
+        SetGtkWindowShowInTaskbar(PGtkWindow(hwnd), False);
       gdk_window_show(GdkWindow);
       gdk_window_raise(GdkWindow);
       {$IFDEF DebugGDKTraps}
cobines

Reply by email

cobines
to cobines

I looked at some GTK2 programs and they usually create modal dialogs through gtk_dialog_new() which sets GDK_WINDOW_TYPE_HINT_DIALOG for the window, which in turn causes _NET_WM_WINDOW_TYPE_DIALOG X11 property to be set for such a window. This is causing the taskbar button not to appear. In LCLGTK2 all forms have type hint set as GDK_WINDOW_TYPE_HINT_NORMAL, so they don't get
_NET_WM_WINDOW_TYPE_DIALOG property. Some message boxes and user prompts in LCLGTK2 are created with gtk_dialog_new() so they are fine and don't have the taskbar button.

Maybe in GTK 2.12 if you call gtk_window_set_modal() it is enough, I don't have sources so I couldn't check.

To remedy this, whenever modal form is being shown there should be a call to gtk_window_set_type_hint(window, GDK_WINDOW_TYPE_HINT_DIALOG) or a direct call to gtk_window_set_skip_taskbar_hint(window, FALSE) (which sets _NET_WM_STATE_SKIP_TASKBAR property). LCLQT does this too by calling QWidget_setWindowFlags(Widget.Widget, QtDialog) in TQtWSCustomForm.ShowHide.

I have opened issue http://bugs.freepascal.org/view.php?id=18323.

cobines

Reply by email