Hi Dominik,

> > I assume you're talking about grabbing the X server whenever a new
> > window is created to GrabWindowKey() for each applicable binding?
> 
> No, I mean the underlying calls to XGrabKey()/XUngrabKey() in
> libs/bindings.c.

Yeah, that's what I meant.

> If you have lots of bindings that change and/or an application with a
> frequently changing title, this can be a problem.

I can see why this could be a problem for bindings that change, but
I don't see what that has to do with windows that frequently change
their title.

> Hm?  Earlier you wrote:
> 
> > > The patch handles windows that dynamically change name/class/resource.
> > > I just wrote a small Perl/Tk app to change the window name at the
> > > click of a button ($mw->configure(-title => ...)) to confirm this.
> 
> So I assumed that it reacts to name/class/resource changes.  Doing
> so requires redoing the grabs.

Nah. All bindings are grabbed for all windows. But a binding is only
_activated_ if it's resource/class/name matches. (See my last patch -
just posted - which fixes a bug. Previously this wasn't strictly true.)
And we lookup the resource/class/name just before we search the binding
list.

Find attached a very simple Perl/Tk app to test this functionality.

Setup a couple of window-specific bindings like so:
Key G (Abc)A C Echo ABC
Key G (Something)A C Echo SOMETHING

Click the 2 buttons ('Something' & 'Abc') to change the title & then
press Ctrl-G in the window.

SCoTT. :)
-- 
[EMAIL PROTECTED]
#!/usr/local/bin/perl -w
 
use strict;
use Tk;
 
my $main = new MainWindow(-class => 'Scott', -title => 'Abc');
$main->Button(-text => 'Something',
                          -command => sub { $main->configure(-title => 
'Something'); }
             )->pack(-expand => 1, -fill => 'x');
$main->Button(-text => 'Abc',
                          -command => sub { $main->configure(-title => 'Abc'); }
             )->pack(-expand => 1, -fill => 'x');
$main->Button(-text => 'Quit',
              -command => sub{exit}
              )->pack(-expand => 1, -fill => 'x');
MainLoop;

Reply via email to