attempt to transfer focus back to main window after closing popups, which is potentially relevant for heavy-weight windows (cf. workaround in org/gjt/sp/jedit/gui/CompletionPopup.java);
authorwenzelm
Tue Aug 13 13:18:26 2013 +0200 (2013-08-13)
changeset 5300339da27fc6101
parent 53002 9dd1a6dcebfd
child 53004 38165b99562e
attempt to transfer focus back to main window after closing popups, which is potentially relevant for heavy-weight windows (cf. workaround in org/gjt/sp/jedit/gui/CompletionPopup.java);
src/Tools/jEdit/src/jedit_lib.scala
src/Tools/jEdit/src/pretty_tooltip.scala
     1.1 --- a/src/Tools/jEdit/src/jedit_lib.scala	Tue Aug 13 12:48:06 2013 +0200
     1.2 +++ b/src/Tools/jEdit/src/jedit_lib.scala	Tue Aug 13 13:18:26 2013 +0200
     1.3 @@ -76,6 +76,21 @@
     1.4    def buffer_name(buffer: Buffer): String = buffer.getSymlinkPath
     1.5  
     1.6  
     1.7 +  /* focus of main window */
     1.8 +
     1.9 +  def request_focus_view: Unit =
    1.10 +  {
    1.11 +    jEdit.getActiveView() match {
    1.12 +      case null =>
    1.13 +      case view =>
    1.14 +        view.getTextArea match {
    1.15 +          case null =>
    1.16 +          case text_area => text_area.requestFocus
    1.17 +        }
    1.18 +    }
    1.19 +  }
    1.20 +
    1.21 +
    1.22    /* main jEdit components */
    1.23  
    1.24    def jedit_buffers(): Iterator[Buffer] = jEdit.getBuffers().iterator
     2.1 --- a/src/Tools/jEdit/src/pretty_tooltip.scala	Tue Aug 13 12:48:06 2013 +0200
     2.2 +++ b/src/Tools/jEdit/src/pretty_tooltip.scala	Tue Aug 13 13:18:26 2013 +0200
     2.3 @@ -116,7 +116,7 @@
     2.4          stack = rest
     2.5          rest match {
     2.6            case top :: _ => top.request_focus
     2.7 -          case Nil =>
     2.8 +          case Nil => JEdit_Lib.request_focus_view
     2.9          }
    2.10        case _ =>
    2.11      }
    2.12 @@ -129,6 +129,7 @@
    2.13      else {
    2.14        stack.foreach(_.hide_popup)
    2.15        stack = Nil
    2.16 +      JEdit_Lib.request_focus_view
    2.17        true
    2.18      }
    2.19    }