Use the good'ole MouseHijacker to prevent the click that unpauses to
pass through to the board view. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@2996 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
//
|
//
|
||||||
// $Id: PuzzleController.java,v 1.6 2004/04/28 18:57:55 ray Exp $
|
// $Id: PuzzleController.java,v 1.7 2004/04/29 00:28:05 ray Exp $
|
||||||
|
|
||||||
package com.threerings.puzzle.client;
|
package com.threerings.puzzle.client;
|
||||||
|
|
||||||
@@ -13,6 +13,8 @@ import java.awt.event.MouseEvent;
|
|||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
import com.samskivert.swing.util.MouseHijacker;
|
||||||
|
|
||||||
import com.samskivert.util.CollectionUtil;
|
import com.samskivert.util.CollectionUtil;
|
||||||
import com.samskivert.util.ObserverList;
|
import com.samskivert.util.ObserverList;
|
||||||
|
|
||||||
@@ -152,12 +154,16 @@ public abstract class PuzzleController extends GameController
|
|||||||
|
|
||||||
// if we're moving focus to chat..
|
// if we're moving focus to chat..
|
||||||
if (chatting) {
|
if (chatting) {
|
||||||
|
// don't let mouse clicks land on the board
|
||||||
|
final MouseHijacker jack = new MouseHijacker(_panel.getBoardView());
|
||||||
|
|
||||||
// ...enable "click to unchat" mode in the puzzle board view
|
// ...enable "click to unchat" mode in the puzzle board view
|
||||||
MouseAdapter unpauser = new MouseAdapter() {
|
MouseAdapter unpauser = new MouseAdapter() {
|
||||||
public void mousePressed (MouseEvent event) {
|
public void mousePressed (MouseEvent event) {
|
||||||
setChatting(false);
|
setChatting(false);
|
||||||
_panel.removeMouseListener(this);
|
_panel.removeMouseListener(this);
|
||||||
_panel.getBoardView().removeMouseListener(this);
|
_panel.getBoardView().removeMouseListener(this);
|
||||||
|
jack.release();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
_panel.addMouseListener(unpauser);
|
_panel.addMouseListener(unpauser);
|
||||||
|
|||||||
Reference in New Issue
Block a user