diff --git a/src/dorkbox/systemTray/jna/JnaHelper.java b/src/dorkbox/systemTray/jna/JnaHelper.java deleted file mode 100644 index 53cdc72..0000000 --- a/src/dorkbox/systemTray/jna/JnaHelper.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright 2016 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; - -import java.util.HashMap; -import java.util.Map; - -import com.sun.jna.Library; -import com.sun.jna.Native; -import com.sun.jna.NativeLibrary; - -/** - * Helper method to get the library info from JNA when registering via direct map - */ -public -class JnaHelper { - @SuppressWarnings("unchecked") - public static - NativeLibrary register(final String libraryName, final Class clazz) throws IllegalArgumentException { - final Map options = new HashMap(); - options.put(Library.OPTION_CLASSLOADER, clazz.getClassLoader()); - - final NativeLibrary library = NativeLibrary.getInstance(libraryName, options); - if (library == null) { - throw new IllegalArgumentException(libraryName + " doesn't exist or cannot be loaded."); - } - - Native.register(clazz, library); - return library; - } -} diff --git a/src/dorkbox/systemTray/jna/linux/AppIndicator.java b/src/dorkbox/systemTray/jna/linux/AppIndicator.java index c86ab28..d4a7321 100644 --- a/src/dorkbox/systemTray/jna/linux/AppIndicator.java +++ b/src/dorkbox/systemTray/jna/linux/AppIndicator.java @@ -22,7 +22,7 @@ import com.sun.jna.NativeLibrary; import com.sun.jna.Pointer; import dorkbox.systemTray.SystemTray; -import dorkbox.systemTray.jna.JnaHelper; +import dorkbox.util.jna.JnaHelper; import dorkbox.util.OS; /** diff --git a/src/dorkbox/systemTray/jna/linux/GThread.java b/src/dorkbox/systemTray/jna/linux/GThread.java index b30d44e..9d6144a 100644 --- a/src/dorkbox/systemTray/jna/linux/GThread.java +++ b/src/dorkbox/systemTray/jna/linux/GThread.java @@ -17,7 +17,7 @@ package dorkbox.systemTray.jna.linux; import com.sun.jna.Pointer; -import dorkbox.systemTray.jna.JnaHelper; +import dorkbox.util.jna.JnaHelper; /** * bindings for libgthread diff --git a/src/dorkbox/systemTray/jna/windows/Gdi32.java b/src/dorkbox/systemTray/jna/windows/Gdi32.java deleted file mode 100644 index fcdd985..0000000 --- a/src/dorkbox/systemTray/jna/windows/Gdi32.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * 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.windows; - -import com.sun.jna.Pointer; - -import dorkbox.systemTray.jna.JnaHelper; - -/** - * bindings for GDI32 - * - * Direct-mapping, See: https://github.com/java-native-access/jna/blob/master/www/DirectMapping.md - */ -public -class Gdi32 { - - static { - JnaHelper.register("gdi32", Gdi32.class); - } - - /** - * Number of pixels per logical inch along the screen width. In a system with multiple display monitors, this value is the same for - * all monitors. - */ - public static final int LOGPIXELSX = 88; - - - /** - * The GetDeviceCaps function retrieves device-specific information for the specified device. - * - * https://msdn.microsoft.com/en-us/library/dd144877(v=vs.85).aspx - * - * @param handle A handle to the DC. - * @param nIndex The item to be returned. - */ - public static native int GetDeviceCaps(Pointer handle, int nIndex); -} diff --git a/src/dorkbox/systemTray/jna/windows/User32.java b/src/dorkbox/systemTray/jna/windows/User32.java deleted file mode 100644 index 475b8cd..0000000 --- a/src/dorkbox/systemTray/jna/windows/User32.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * 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.windows; - -import com.sun.jna.Pointer; - -import dorkbox.systemTray.jna.JnaHelper; - -/** - * bindings for User32 - *

- * Direct-mapping, See: https://github.com/java-native-access/jna/blob/master/www/DirectMapping.md - */ -public -class User32 { - - static { - JnaHelper.register("user32", User32.class); - } - - - /** - * https://msdn.microsoft.com/en-us/library/windows/desktop/dd144871(v=vs.85).aspx - * - * @param shouldBeNull A handle to the window whose DC is to be retrieved. If this value is NULL, GetDC retrieves the DC for the entire - * screen. - * - * @return if the function succeeds, the return value is a handle to the DC for the specified window's client area. If the function - * fails, the return value is NULL. - */ - public static native - Pointer GetDC(Pointer shouldBeNull); - - /** - * https://msdn.microsoft.com/en-us/library/windows/desktop/dd162920(v=vs.85).aspx - */ - public static native - void ReleaseDC(Pointer shouldBeNull, Pointer dcHandle); -}