[PD-dev] found source of crazy focus bug

Hans-Christoph Steiner hans at at.or.at
Sun Nov 21 01:28:48 CET 2010


Here's my workaround, seems to be ok:



--- a/tcl/pdwindow.tcl
+++ b/tcl/pdwindow.tcl
@@ -44,7 +44,12 @@ proc ::pdwindow::set_layout {} {
  proc ::pdwindow::busygrab {} {
      # set the mouse cursor to look busy and grab focus so it stays  
that way
      .pdwindow.text configure -cursor watch
-    grab set .pdwindow.text
+    # on Mac OS X, this grab prevents the new window from receiving
+    # the FocusIn event, and therefore lots of things don't work, like
+    # keybindings, etc.  There should be a better way to do with on OSX
+    if {$::windowingsystem ne "aqua"} {
+        grab set .pdwindow.text
+    }
  }

  # release focus on part of the Pd window when Pd is finished




.hc


On Nov 20, 2010, at 6:31 PM, Hans-Christoph Steiner wrote:

>
> Hey all,
>
> Miller and I have been banging our heads against the Mac OS X-only  
> bug where the menubar would get focus and flash when you hit keys,  
> but the key command wouldn't work or do anything else.  It turns out  
> that it is caused by the 'grab' command in the ::pdwindow::busygrab  
> proc.  If you comment that out, then this bug goes away. Odd that it  
> only affects Mac OS X...
>
> The grab function is used to put up the busy cursor when Pd is  
> loading a patch, and it also locks the user out of trying to do  
> things, like edit a patch, while 'pd' is busy trying to load the  
> patch.  This works by forcing the focus to be on the Pd window while  
> 'pd' is busy.  It seems to work like a charm on X11 and Windows, but  
> on Mac OS X, it causes the new windows to not get the FocusIn  
> message, and therefore not set itself up properly.
>
> So now the question is how to fix this and retain the busy cursor  
> feature?
>
> .hc
>
>
> ----------------------------------------------------------------------------
>
> News is what people want to keep hidden and everything else is  
> publicity.          - Bill Moyers
>
>


----------------------------------------------------------------------------

I hate it when they say, "He gave his life for his country."  Nobody  
gives their life for anything.  We steal the lives of these kids.  - 
Admiral Gene LeRocque




More information about the Pd-dev mailing list