Skip Menu |

This queue is for tickets about the Tk-StayOnTop CPAN distribution.

Report information
The Basics
Id: 5996
Status: resolved
Priority: 0/
Queue: Tk-StayOnTop

People
Owner: gbrock [...] cpan.org
Requestors: slaven [...] rezic.de
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 0.03
Fixed in: (no value)



Subject: Better StayOnTop implementation for X11 and Windows
I have attached is a better method to get stayontop working on X11 systems. This works for "modern" window manager (e.g. the ones found in KDE or GNOME). For older window managers, a fallback to something like { my $stay_above_after; $mw->bind("<Visibility>" => sub { if ($stay_above_after) { $stay_above_after->cancel; } $stay_above_after = $mw->after (1000, sub { $mw->raise; #Tk->break; undef $stay_above_after; }); } ); } could be used. This could also be used on Windows if Win32::API is not installed. For Windows with Tk804.027 and better I would recommend to use $top->attributes(-topmost => 1) instead. Regards, Slaven
#!/usr/bin/perl use Tk; $mw = tkinit; keep_on_top($mw); MainLoop; sub keep_on_top { my $w = shift; my($wrapper) = $w->toplevel->wrapper; eval { if (!grep { $_ eq '_NET_WM_STATE_STAYS_ON_TOP' } $w->property('get', '_NET_SUPPORTED', 'root')) { die "_NET_WM_STATE_STAYS_ON_TOP not supported"; } $w->property('set', '_NET_WM_STATE', "ATOM", 32, ["_NET_WM_STATE_STAYS_ON_TOP"], $wrapper); }; if ($@) { warn $@; 0; } else { 1; } }
Subject: Thanks (and a question)...
Slaven, Thank you for the suggestions and sorry for not getting back sooner - it took a while to digest. I have been hacking with the code and ended up with a case statement for the four different method, chosen as follows: if (win32) if ($Tk::Version >= 804.027) use -toplevel => 1 else (if Win32 API available) use it else use Time/Visibility hack else if (_NET_WM_STATE_STAYS_ON_TOP available) use it else use Time/Visibility hack I have one question though - any idea how do I unset _NET_WM_STATE_STAYS_ON_TOP? Sadly I don't have Gnome/KDE handy for testing. If it's ok, I would like to send you the new version for a quick test, before sending it to CPAN. Thanks, Gavin Show quoted text
_____________________________ Gavin Brock - gbrock@cpan.org ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[GBROCK - Sun Apr 18 22:28:11 2004]: Show quoted text
> Slaven, > > Thank you for the suggestions and sorry for not getting back sooner - > it > took a while to digest. I have been hacking with the code and ended up > with a case statement for the four different method, chosen as > follows: > > if (win32) > if ($Tk::Version >= 804.027) > use -toplevel => 1 > else (if Win32 API available) > use it > else > use Time/Visibility hack > else > if (_NET_WM_STATE_STAYS_ON_TOP available) > use it > else > use Time/Visibility hack > > I have one question though - any idea how do I unset > _NET_WM_STATE_STAYS_ON_TOP? Sadly I don't have Gnome/KDE handy for > testing.
The syntax is $w->property("delete", "_NET_WM_STATE_STAYS_ON_TOP", $wrapper); Show quoted text
> If it's ok, I would like to send you the new version for a quick test, > before sending it to CPAN. >
Yes, that's OK. Regards, Slaven
Date: Thu, 22 Apr 2004 10:06:48 +0900 (JST)
Subject: Re: [cpan #5996] Better StayOnTop implementation for X11 and Windows
From: "Gavin Brock" <gbrock [...] cpan.org>
To: bug-Tk-StayOnTop [...] rt.cpan.org
RT-Send-Cc:
Slaven, Thank you for your help. I added the delete property and prepared a tarball (see attached). If you have time to give it the once-over I would really appreciate it. Regards, Gavin
Download Tk-StayOnTop-0.11.tar.gz
application/x-gzip 3.9k

Message body not shown because it is not plain text.

[GBROCK - Wed Apr 21 21:06:37 2004]: Show quoted text
> Slaven, > > Thank you for your help. I added the delete property and prepared a > tarball (see attached). > > If you have time to give it the once-over I would really appreciate it. >
Works fine with GNOME and the default window manager which comes with RedHat 8.0. Does not work with KDE on the same system, but this might be a KDE bug. Regards, Slaven
Date: Mon, 26 Apr 2004 22:17:54 +0900 (JST)
Subject: Re: [cpan #5996] Better StayOnTop implementation for X11 and Windows
From: "Gavin Brock" <gavin [...] brock-family.org>
To: bug-Tk-StayOnTop [...] rt.cpan.org
RT-Send-Cc:
Slaven, Great - I'll adjust the docs accordingly and release it to the world. Thanks! Gavin Show quoted text
> > This message about Tk-StayOnTop was sent to you by SREZIC > <SREZIC@cpan.org> via rt.cpan.org > > Full context and any attached attachments can be found at: > <URL: https://rt.cpan.org/Ticket/Display.html?id=5996 > > > [GBROCK - Wed Apr 21 21:06:37 2004]: >
>> Slaven, >> >> Thank you for your help. I added the delete property and prepared a >> tarball (see attached). >> >> If you have time to give it the once-over I would really appreciate it. >>
> > Works fine with GNOME and the default window manager which comes with > RedHat 8.0. Does not work with KDE on the same system, but this might be > a KDE bug. > > Regards, > Slaven >