From 7db63a9590e376ff8ed6460343dee379cefd7173 Mon Sep 17 00:00:00 2001 From: tkellner Date: Fri, 31 Jan 2014 13:39:53 +0000 Subject: Work around requestFocus deadlock git-svn-id: https://joinup.ec.europa.eu/svn/pdf-over/trunk@499 174cde9d-5d70-4d2a-aa98-46368bc2aaf7 --- .../pdfover/gui/composites/PositioningComposite.java | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'pdf-over-gui/src/main') diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/PositioningComposite.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/PositioningComposite.java index d9d7769c..a3a22070 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/PositioningComposite.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/PositioningComposite.java @@ -60,9 +60,9 @@ public class PositioningComposite extends StateComposite { private SignaturePanel viewer = null; - private Frame frame = null; + Frame frame = null; - private Composite mainArea = null; + Composite mainArea = null; Composite bottomBar = null; @@ -179,10 +179,15 @@ public class PositioningComposite extends StateComposite { * Request focus (to enable keyboard input) */ public void requestFocus() { - this.mainArea.setFocus(); - if(!this.frame.hasFocus()) { - this.frame.requestFocusInWindow(); - } + this.getDisplay().asyncExec(new Runnable() { + @Override + public void run() { + PositioningComposite.this.mainArea.setFocus(); + if(!PositioningComposite.this.frame.hasFocus()) { + PositioningComposite.this.frame.requestFocus(); + } + } + }); } /** -- cgit v1.2.3