diff --git a/runelite-client/pom.xml b/runelite-client/pom.xml
index bffe89bb2b..1e5c50baab 100644
--- a/runelite-client/pom.xml
+++ b/runelite-client/pom.xml
@@ -130,6 +130,12 @@
discord
1.0
+
+ net.runelite
+ orange-extensions
+ 1.0
+ provided
+
junit
diff --git a/runelite-client/src/main/java/net/runelite/client/Notifier.java b/runelite-client/src/main/java/net/runelite/client/Notifier.java
index 5fa9ca3516..f2f2006a91 100644
--- a/runelite-client/src/main/java/net/runelite/client/Notifier.java
+++ b/runelite-client/src/main/java/net/runelite/client/Notifier.java
@@ -43,6 +43,7 @@ import lombok.extern.slf4j.Slf4j;
import net.runelite.client.config.RuneLiteConfig;
import net.runelite.client.ui.ClientUI;
import net.runelite.client.util.OSType;
+import net.runelite.client.util.OSXUtil;
@Singleton
@Slf4j
@@ -98,7 +99,14 @@ public class Notifier
if (runeLiteConfig.requestFocusOnNotification())
{
- clientUI.requestFocus();
+ if (OSType.getOSType() == OSType.MacOS)
+ {
+ OSXUtil.requestFocus();
+ }
+ else
+ {
+ clientUI.requestFocus();
+ }
}
if (runeLiteConfig.enableTrayNotifications())
diff --git a/runelite-client/src/main/java/net/runelite/client/ui/ClientUI.java b/runelite-client/src/main/java/net/runelite/client/ui/ClientUI.java
index 937eeeb8ce..2c435ad80c 100644
--- a/runelite-client/src/main/java/net/runelite/client/ui/ClientUI.java
+++ b/runelite-client/src/main/java/net/runelite/client/ui/ClientUI.java
@@ -37,14 +37,12 @@ import java.awt.LayoutManager;
import java.awt.SystemTray;
import java.awt.Toolkit;
import java.awt.TrayIcon;
-import java.awt.Window;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.awt.image.BufferedImage;
import java.io.IOException;
-import java.lang.reflect.InvocationTargetException;
import java.util.Enumeration;
import javax.imageio.ImageIO;
import javax.swing.BoxLayout;
@@ -67,7 +65,7 @@ import net.runelite.api.GameState;
import net.runelite.api.events.ConfigChanged;
import net.runelite.client.RuneLite;
import net.runelite.client.RuneLiteProperties;
-import net.runelite.client.util.OSType;
+import net.runelite.client.util.OSXUtil;
import org.pushingpixels.substance.api.skin.SubstanceGraphiteLookAndFeel;
import org.pushingpixels.substance.internal.utils.SubstanceCoreUtilities;
import org.pushingpixels.substance.internal.utils.SubstanceTitlePaneUtilities;
@@ -136,7 +134,7 @@ public class ClientUI extends JFrame
setUIFont(new FontUIResource(FontManager.getRunescapeFont()));
ClientUI gui = new ClientUI(runelite, properties, client);
- tryEnableOSXFullscreen(gui);
+ OSXUtil.tryEnableFullscreen(gui);
return gui;
}
@@ -459,26 +457,4 @@ public class ClientUI extends JFrame
return pluginToolbar;
}
- /**
- * Enables the osx native fullscreen if running on a mac.
- *
- * @param gui The gui to enable the fullscreen on.
- */
- private static void tryEnableOSXFullscreen(ClientUI gui)
- {
- if (OSType.getOSType() == OSType.MacOS)
- {
- try
- {
- Class.forName("com.apple.eawt.FullScreenUtilities")
- .getMethod("setWindowCanFullScreen", Window.class, boolean.class)
- .invoke(null, gui, true);
- log.debug("macOS fullscreen enabled");
- }
- catch (ClassNotFoundException | NoSuchMethodException | IllegalAccessException | InvocationTargetException ignored)
- {
- // not running macOS, ignore
- }
- }
- }
}
diff --git a/runelite-client/src/main/java/net/runelite/client/util/OSXUtil.java b/runelite-client/src/main/java/net/runelite/client/util/OSXUtil.java
new file mode 100644
index 0000000000..393e57445b
--- /dev/null
+++ b/runelite-client/src/main/java/net/runelite/client/util/OSXUtil.java
@@ -0,0 +1,64 @@
+/*
+ * Copyright (c) 2018, Adam
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package net.runelite.client.util;
+
+import com.apple.eawt.Application;
+import com.apple.eawt.FullScreenUtilities;
+import lombok.extern.slf4j.Slf4j;
+import net.runelite.client.ui.ClientUI;
+
+/**
+ * A class with OSX-specific functions to improve integration.
+ */
+@Slf4j
+public class OSXUtil
+{
+ /**
+ * Enables the osx native fullscreen if running on a mac.
+ *
+ * @param gui The gui to enable the fullscreen on.
+ */
+ public static void tryEnableFullscreen(ClientUI gui)
+ {
+ if (OSType.getOSType() == OSType.MacOS)
+ {
+ FullScreenUtilities.setWindowCanFullScreen(gui, true);
+ log.debug("Enabled fullscreen on macOS");
+ }
+ }
+
+ /**
+ * Requests the foreground in a macOS friendly way.
+ */
+ public static void requestFocus()
+ {
+ if (OSType.getOSType() == OSType.MacOS)
+ {
+ Application app = Application.getApplication();
+ app.requestForeground(true);
+ log.debug("Requested focus on macOS");
+ }
+ }
+}