Subject: | toplevel should be transient |
take the attached simple app
$ chmod +x kwin-focus.pl
$ ./kwin-focus.pl
==> a window with a button appears
click on the button
==> a dialog box appears, and is raised propery
click on the button again
==> the dialog box is iconified
click on the button again
==> the dialog box re-appears, but not above the main window
==> bug
this program works fine under gnome (ie, the last button click makes the
dialog re-appear above the main window), but not in kde with focus
stealing prevention set to low.
i reported a bug in kde (https://bugs.kde.org/show_bug.cgi?id=203447)
where they say that those windows should be made transient.
since toplevels are children of a mainwindow, i propose to make them
transient by default.
or propose a way in Tk::Wm to change their transient property.
Subject: | kwin-focus.pl |
#!/usr/bin/perl
use strict;
use warnings;
use Tk;
my $mw = new Tk::MainWindow;
$mw->Button(-text=>'click', -command=>\&toggle)->pack;
$mw->geometry("300x200");
MainLoop;
my $dialog;
sub toggle {
if ( not defined $dialog ) {
$dialog = $mw->Toplevel;
$dialog->withdraw;
$dialog->Popup(-popover=>$mw);
return;
}
if ( $dialog->state eq 'normal' ) {
$dialog->withdraw;
} else {
$dialog->Popup(-popover=>$mw);
$dialog->raise;
}
}