I believe it's a bug. I noticed that if I hit control-c, the underlying window would have focus and kill the window. I grepped thru the Tk-804.027_502 distribution for Fullscreen and came up with interesting items
local $TODO = "-alpha and -fullscreen not yet implemented"; Getting fullscreen attribute is not yet implemented for X11 {setting/unsetting fullscreen does not change the focus} {change -fullscreen after map}); # Query above should not clear fullscreen state and many more such hits
So..... probably there is a problem with focus changing after mapping the $mw. Interestingly enough, you can't even use Fullscreen after the $mw is mapped
#!/usr/bin/perl use Tk; my $mw = new MainWindow; $mw->after(10,sub { $mw->FullScreen(1); $mw->bind('all'=> '<Key-Escape>' => sub {exit;}); $mw->focusForce; $mw->update; }); MainLoop;
Maybe there has been a fix in Tk-804.028, but I see nothing in the changelog. So there are a couple of hacks you can use:
#!/usr/bin/perl use Tk; my $mw = new MainWindow; $mw->bind('all' => '<Key-Escape>' => sub {exit;}); $mw->FullScreen(1); $mw->grabGlobal; $mw->focusForce; MainLoop;
or better yet, to avoid the globalgrab, use the old fashioned way of setting geometry for the $mw
#!/usr/bin/perl use Tk; my $mw = new MainWindow; $mw->geometry($mw->screenwidth . 'x' . $mw->screenheight . '+0+0'); $mw->bind('all' => '<Key-Escape>' => sub {exit;}); MainLoop;
I guess the lesson is, don't count on Fullscreen working. Use the geometry instead. Maybe Slaven Rezic will see this and chime in, as he is the current owner of Tk and knows the xs for converting from the tcl.

I'm not really a human, but I play one on earth Remember How Lucky You Are

In reply to Re: Tk fullscreen mainwindow key bindings by zentara
in thread Tk fullscreen mainwindow key bindings by rocklee

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.