From 41b2138815373f390044d25ca22f675c7aa07f1d Mon Sep 17 00:00:00 2001 From: nathan Date: Tue, 11 Jul 2017 01:36:35 +0200 Subject: [PATCH 1/2] Updated Copyright on missing files --- src/dorkbox/systemTray/jna/linux/Glib.java | 15 +++++++++++++++ .../systemTray/jna/linux/GtkEventDispatch.java | 15 +++++++++++++++ src/dorkbox/systemTray/jna/linux/GtkTheme.java | 15 +++++++++++++++ .../systemTray/jna/linux/structs/GdkColor.java | 15 +++++++++++++++ .../jna/linux/structs/GdkRGBAColor.java | 15 +++++++++++++++ .../jna/linux/structs/GtkRequisition.java | 15 +++++++++++++++ .../systemTray/jna/linux/structs/GtkStyle.java | 15 +++++++++++++++ .../jna/linux/structs/PangoRectangle.java | 15 +++++++++++++++ 8 files changed, 120 insertions(+) diff --git a/src/dorkbox/systemTray/jna/linux/Glib.java b/src/dorkbox/systemTray/jna/linux/Glib.java index ca6dfc5..adb17b2 100644 --- a/src/dorkbox/systemTray/jna/linux/Glib.java +++ b/src/dorkbox/systemTray/jna/linux/Glib.java @@ -1,3 +1,18 @@ +/* + * Copyright 2017 dorkbox, llc + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package dorkbox.systemTray.jna.linux; import com.sun.jna.Callback; diff --git a/src/dorkbox/systemTray/jna/linux/GtkEventDispatch.java b/src/dorkbox/systemTray/jna/linux/GtkEventDispatch.java index ce73dbc..e728d27 100644 --- a/src/dorkbox/systemTray/jna/linux/GtkEventDispatch.java +++ b/src/dorkbox/systemTray/jna/linux/GtkEventDispatch.java @@ -1,3 +1,18 @@ +/* + * Copyright 2015 dorkbox, llc + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package dorkbox.systemTray.jna.linux; import static dorkbox.systemTray.SystemTray.logger; diff --git a/src/dorkbox/systemTray/jna/linux/GtkTheme.java b/src/dorkbox/systemTray/jna/linux/GtkTheme.java index e66b9cb..afdd638 100644 --- a/src/dorkbox/systemTray/jna/linux/GtkTheme.java +++ b/src/dorkbox/systemTray/jna/linux/GtkTheme.java @@ -1,3 +1,18 @@ +/* + * Copyright 2017 dorkbox, llc + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package dorkbox.systemTray.jna.linux; import static dorkbox.systemTray.util.CssParser.injectAdditionalCss; diff --git a/src/dorkbox/systemTray/jna/linux/structs/GdkColor.java b/src/dorkbox/systemTray/jna/linux/structs/GdkColor.java index 110c8bb..c22a18a 100644 --- a/src/dorkbox/systemTray/jna/linux/structs/GdkColor.java +++ b/src/dorkbox/systemTray/jna/linux/structs/GdkColor.java @@ -1,3 +1,18 @@ +/* + * Copyright 2017 dorkbox, llc + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package dorkbox.systemTray.jna.linux.structs; import java.awt.Color; diff --git a/src/dorkbox/systemTray/jna/linux/structs/GdkRGBAColor.java b/src/dorkbox/systemTray/jna/linux/structs/GdkRGBAColor.java index e252284..9729496 100644 --- a/src/dorkbox/systemTray/jna/linux/structs/GdkRGBAColor.java +++ b/src/dorkbox/systemTray/jna/linux/structs/GdkRGBAColor.java @@ -1,3 +1,18 @@ +/* + * Copyright 2017 dorkbox, llc + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package dorkbox.systemTray.jna.linux.structs; import java.awt.Color; diff --git a/src/dorkbox/systemTray/jna/linux/structs/GtkRequisition.java b/src/dorkbox/systemTray/jna/linux/structs/GtkRequisition.java index 45e125a..faac052 100644 --- a/src/dorkbox/systemTray/jna/linux/structs/GtkRequisition.java +++ b/src/dorkbox/systemTray/jna/linux/structs/GtkRequisition.java @@ -1,3 +1,18 @@ +/* + * Copyright 2017 dorkbox, llc + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package dorkbox.systemTray.jna.linux.structs; import java.util.Arrays; diff --git a/src/dorkbox/systemTray/jna/linux/structs/GtkStyle.java b/src/dorkbox/systemTray/jna/linux/structs/GtkStyle.java index 6571c4a..b0b99c6 100644 --- a/src/dorkbox/systemTray/jna/linux/structs/GtkStyle.java +++ b/src/dorkbox/systemTray/jna/linux/structs/GtkStyle.java @@ -1,3 +1,18 @@ +/* + * Copyright 2017 dorkbox, llc + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package dorkbox.systemTray.jna.linux.structs; import java.util.Arrays; diff --git a/src/dorkbox/systemTray/jna/linux/structs/PangoRectangle.java b/src/dorkbox/systemTray/jna/linux/structs/PangoRectangle.java index 96a3373..1f58343 100644 --- a/src/dorkbox/systemTray/jna/linux/structs/PangoRectangle.java +++ b/src/dorkbox/systemTray/jna/linux/structs/PangoRectangle.java @@ -1,3 +1,18 @@ +/* + * Copyright 2017 dorkbox, llc + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package dorkbox.systemTray.jna.linux.structs; import java.util.Arrays; From f73df51a7824a244eb42a229c35bfc3db947af06 Mon Sep 17 00:00:00 2001 From: nathan Date: Tue, 11 Jul 2017 01:41:08 +0200 Subject: [PATCH 2/2] Code polish and fixes for Swing on linux --- src/dorkbox/systemTray/SystemTray.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/dorkbox/systemTray/SystemTray.java b/src/dorkbox/systemTray/SystemTray.java index f5c628e..654d96c 100644 --- a/src/dorkbox/systemTray/SystemTray.java +++ b/src/dorkbox/systemTray/SystemTray.java @@ -40,6 +40,7 @@ import org.slf4j.LoggerFactory; import dorkbox.systemTray.jna.linux.AppIndicator; import dorkbox.systemTray.jna.linux.Gtk; +import dorkbox.systemTray.jna.linux.GtkEventDispatch; import dorkbox.systemTray.nativeUI._AppIndicatorNativeTray; import dorkbox.systemTray.nativeUI._AwtTray; import dorkbox.systemTray.nativeUI._GtkStatusIconNativeTray; @@ -739,8 +740,8 @@ class SystemTray { if (isNix) { // linux/unix need access to GTK, so load it up before the tray is loaded! - Gtk.startGui(); - Gtk.waitForEventsToComplete(); + GtkEventDispatch.startGui(); + GtkEventDispatch.waitForEventsToComplete(); } @@ -753,15 +754,15 @@ class SystemTray { if (AUTO_FIX_INCONSISTENCIES) { // this logic has to be before we create the system Tray, but after GTK is started (if applicable) - if (OS.isWindows()) { + if (OS.isWindows() && (isTrayType(trayType, TrayType.AWT) || isTrayType(trayType, TrayType.Swing))) { // windows hard-codes the image size SystemTrayFixes.fixWindows(trayImageSize); } - else if (OS.isMacOsX()) { + else if (OS.isMacOsX() && (isTrayType(trayType, TrayType.AWT) || isTrayType(trayType, TrayType.Swing))) { // macosx doesn't respond to all buttons (but should) SystemTrayFixes.fixMacOS(); } - else if (isNix) { + else if (isNix && isTrayType(trayType, TrayType.Swing)) { // linux/mac doesn't have transparent backgrounds for swing and hard-codes the image size SystemTrayFixes.fixLinux(trayImageSize); } @@ -790,7 +791,6 @@ class SystemTray { ) { try { reference.set((Tray) trayType.getConstructors()[0].newInstance(systemTray)); - } catch (Exception e) { logger.error("Unable to create tray type: '" + trayType.getSimpleName() + "'", e); }