Преглед на файлове

Fixes issue 3212

Tracks active window in WindowManager for good measure

Change-Id: I1489a1bd6972226c96c55cda78707a25138b6ccf
Reviewed-on: http://gerrit.dmdirc.com/151
Reviewed-by: Shane Mc Cormack <shane@dmdirc.com>
Tested-by: Shane Mc Cormack <shane@dmdirc.com>
tags/0.6.3b1
Gregory Holmes преди 14 години
родител
ревизия
ff3f9ffbc7
променени са 3 файла, в които са добавени 21 реда и са изтрити 3 реда
  1. 5
    0
      src/com/dmdirc/FrameContainer.java
  2. 0
    3
      src/com/dmdirc/addons/ui_swing/components/frames/TextFrame.java
  3. 16
    0
      src/com/dmdirc/ui/WindowManager.java

+ 5
- 0
src/com/dmdirc/FrameContainer.java Целия файл

@@ -22,6 +22,8 @@
22 22
 
23 23
 package com.dmdirc;
24 24
 
25
+import com.dmdirc.actions.ActionManager;
26
+import com.dmdirc.actions.CoreActionType;
25 27
 import com.dmdirc.config.ConfigManager;
26 28
 import com.dmdirc.interfaces.ConfigChangeListener;
27 29
 import com.dmdirc.interfaces.FrameInfoListener;
@@ -273,6 +275,9 @@ public abstract class FrameContainer {
273 275
      * Invoked when our window is activated.
274 276
      */
275 277
     public void windowActivated() {
278
+        ActionManager.processEvent(
279
+                                    CoreActionType.CLIENT_FRAME_CHANGED,
280
+                                    null, this);
276 281
         LOGGER.finer(toString() + ": windowActivated(): frame = "
277 282
                 + (getFrame() == null ? null : getFrame().getClass().getName()));
278 283
 

+ 0
- 3
src/com/dmdirc/addons/ui_swing/components/frames/TextFrame.java Целия файл

@@ -300,9 +300,6 @@ public abstract class TextFrame extends JInternalFrame implements Window,
300 300
                             /** {@inheritDoc} */
301 301
                             @Override
302 302
                             protected Object doInBackground() throws Exception {
303
-                                ActionManager.processEvent(
304
-                                    CoreActionType.CLIENT_FRAME_CHANGED,
305
-                                    null, getContainer());
306 303
                                 return null;
307 304
                             }
308 305
                         }.execute();

+ 16
- 0
src/com/dmdirc/ui/WindowManager.java Целия файл

@@ -63,6 +63,9 @@ public class WindowManager {
63 63
     private static final SelectionListener selectionListener
64 64
             = new WMSelectionListener();
65 65
 
66
+    /** The active window in the client. */
67
+    private static Window activeWindow = null;
68
+
66 69
     /**
67 70
      * Creates a new instance of WindowManager.
68 71
      */
@@ -323,6 +326,18 @@ public class WindowManager {
323 326
         final List<Window> children = childWindows.get(window);
324 327
         return children.toArray(new Window[children.size()]);
325 328
     }
329
+
330
+    /**
331
+     * Retrieves the currently active window in the client, or null if no window
332
+     * is active.
333
+     *
334
+     * @since 0.6.3
335
+     *
336
+     * @return Active window or null
337
+     */
338
+    public static Window getActiveWindow() {
339
+        return activeWindow;
340
+    }
326 341
     
327 342
     /**
328 343
      * Fires the addWindow(Window) callback.
@@ -378,6 +393,7 @@ public class WindowManager {
378 393
         /** {@inheritDoc} */
379 394
         @Override
380 395
         public void selectionChanged(final Window window) {
396
+            activeWindow = window;
381 397
             for (SelectionListener listener : selListeners) {
382 398
                 listener.selectionChanged(window);
383 399
             }

Loading…
Отказ
Запис