Skip to content

Commit

Permalink
Merge pull request #622 from NetLogo/3dmenu-fix
Browse files Browse the repository at this point in the history
Fix #47!  Add doubled modal popup for weird OSX issue
  • Loading branch information
frankduncan committed Jun 12, 2014
2 parents 95764a9 + b2c937e commit ab968c3
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/main/org/nlogo/swing/ModalProgressTask.scala
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@ import java.awt.BorderLayout
import javax.swing.{ BorderFactory, JDialog, JLabel, JPanel, SwingConstants }
import org.nlogo.awt.EventQueue.mustBeEventDispatchThread
import org.nlogo.awt.Positioning.center
import org.nlogo.api.Version

object ModalProgressTask {
val isMac = System.getProperty("os.name").startsWith("Mac")

def apply(parent: java.awt.Frame, message: String, r: Runnable) {
mustBeEventDispatchThread()
Expand Down Expand Up @@ -39,6 +41,15 @@ object ModalProgressTask {
boss.setPriority(Thread.MAX_PRIORITY)
boss.start()
dialog.setVisible(true)

// This is a workaround for the menu getting grayed out on macs in 3D mode
// See issue #47 FD 6/12/14
if(isMac && Version.is3D) {
val threedFixBoss = new Boss(dialog, new Runnable() { override def run() {} })
threedFixBoss.setPriority(Thread.MAX_PRIORITY)
threedFixBoss.start()
dialog.setVisible(true)
}
}

private class Boss(dialog: JDialog, r: Runnable)
Expand Down

0 comments on commit ab968c3

Please sign in to comment.