forked from NixOS/nixpkgs
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
keyboard-layout-editor: init at 0-unstable-2019-05-14 (NixOS#353165)
- Loading branch information
Showing
3 changed files
with
280 additions
and
0 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
95 changes: 95 additions & 0 deletions
95
pkgs/by-name/ke/keyboard-layout-editor/fix-build-gradle.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
diff --git a/build.gradle b/build.gradle | ||
index b411200..a558065 100644 | ||
--- a/build.gradle | ||
+++ b/build.gradle | ||
@@ -1,5 +1,17 @@ | ||
+buildscript { | ||
+ repositories { | ||
+ maven { | ||
+ url "https://plugins.gradle.org/m2/" | ||
+ } | ||
+ } | ||
+ dependencies { | ||
+ classpath 'org.openjfx:javafx-plugin:0.1.0' | ||
+ } | ||
+} | ||
+ | ||
plugins { | ||
id 'java' | ||
+ id 'org.openjfx.javafxplugin' version '0.1.0' | ||
} | ||
|
||
group 'cz.gresak' | ||
@@ -12,22 +24,26 @@ repositories { | ||
} | ||
|
||
dependencies { | ||
- compile group: 'com.google.code.gson', name: 'gson', version: '2.8.5' | ||
- compile group: 'org.apache.commons', name: 'commons-exec', version: '1.3' | ||
- compile group: 'commons-io', name: 'commons-io', version: '2.6' | ||
- compile group: 'org.apache.commons', name: 'commons-lang3', version: '3.8.1' | ||
+ implementation group: 'com.google.code.gson', name: 'gson', version: '2.8.5' | ||
+ implementation group: 'org.apache.commons', name: 'commons-exec', version: '1.3' | ||
+ implementation group: 'commons-io', name: 'commons-io', version: '2.6' | ||
+ implementation group: 'org.apache.commons', name: 'commons-lang3', version: '3.8.1' | ||
|
||
- testCompile group: 'junit', name: 'junit', version: '4.12' | ||
+ testImplementation group: 'junit', name: 'junit', version: '4.12' | ||
} | ||
|
||
compileJava { | ||
options.encoding = 'UTF-8' | ||
} | ||
|
||
+javafx { | ||
+ modules = [ 'javafx.base', 'javafx.graphics', 'javafx.fxml' ] | ||
+} | ||
+ | ||
jar { | ||
manifest { | ||
attributes( | ||
- 'Class-Path': configurations.compile.collect { it.getName() }.join(' '), | ||
+ 'Class-Path': configurations.runtimeClasspath.collect { it.getName() }.join(' '), | ||
'Main-Class': 'cz.gresak.keyboardeditor.Main' | ||
) | ||
} | ||
@@ -40,7 +56,8 @@ task fatJar(type: Jar) { | ||
'Implementation-Version': version, | ||
'Main-Class': 'cz.gresak.keyboardeditor.Main' | ||
} | ||
- baseName = project.name + '-all' | ||
- from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } } | ||
+ archiveBaseName = project.name + '-all' | ||
+ duplicatesStrategy = DuplicatesStrategy.EXCLUDE | ||
+ from { configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) } } | ||
with jar | ||
} | ||
\ No newline at end of file | ||
diff --git a/src/main/java/cz/gresak/keyboardeditor/component/Key.java b/src/main/java/cz/gresak/keyboardeditor/component/Key.java | ||
index d81d66d..9530faf 100644 | ||
--- a/src/main/java/cz/gresak/keyboardeditor/component/Key.java | ||
+++ b/src/main/java/cz/gresak/keyboardeditor/component/Key.java | ||
@@ -170,8 +170,8 @@ public class Key extends Pane { | ||
bottomLeftChar.setLayoutY(bottomLine); | ||
bottomRightChar.setLayoutY(bottomLine); | ||
// horizontal alignment (needed only for the right column) | ||
- double topLeftWidth = fontLoader.computeStringWidth(topLeftChar.getText(), topLeftChar.getFont()); | ||
- double bottomLeftWidth = fontLoader.computeStringWidth(bottomLeftChar.getText(), bottomLeftChar.getFont()); | ||
+ double topLeftWidth = 0.0; // fontLoader.computeStringWidth(topLeftChar.getText(), topLeftChar.getFont()); | ||
+ double bottomLeftWidth = 0.0; // fontLoader.computeStringWidth(bottomLeftChar.getText(), bottomLeftChar.getFont()); | ||
double maxLeftColumnLayoutX = Math.max(topLeftChar.getLayoutX(), bottomLeftChar.getLayoutX()); | ||
double xOffset = Math.max( | ||
(getWidth() / 2 - HPADDING) + KEY_COLUMN_SPACE, // center of the key | ||
diff --git a/src/main/java/cz/gresak/keyboardeditor/service/impl/FontProviderImpl.java b/src/main/java/cz/gresak/keyboardeditor/service/impl/FontProviderImpl.java | ||
index 4804505..a91ef5c 100644 | ||
--- a/src/main/java/cz/gresak/keyboardeditor/service/impl/FontProviderImpl.java | ||
+++ b/src/main/java/cz/gresak/keyboardeditor/service/impl/FontProviderImpl.java | ||
@@ -81,7 +81,7 @@ public class FontProviderImpl implements FontProvider { | ||
@Override | ||
public double getFontSize(String text, Font font, double widthToFit, double heightToFit) { | ||
FontLoader fontLoader = Toolkit.getToolkit().getFontLoader(); | ||
- double sampleWidth = fontLoader.computeStringWidth(text, font); | ||
+ double sampleWidth = 0.0; // fontLoader.computeStringWidth(text, font); | ||
double fontSizeWidth = (widthToFit / sampleWidth) * font.getSize(); | ||
|
||
FontMetrics fontMetrics = fontLoader.getFontMetrics(font); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
{ | ||
lib, | ||
stdenv, | ||
fetchFromGitHub, | ||
gradle_8, | ||
makeBinaryWrapper, | ||
openjdk, | ||
wrapGAppsHook3, | ||
xorg, | ||
}: | ||
|
||
let | ||
jdk = openjdk.override { | ||
enableJavaFX = true; | ||
}; | ||
|
||
in | ||
stdenv.mkDerivation rec { | ||
pname = "keyboard-layout-editor"; | ||
version = "0-unstable-2019-05-14"; | ||
|
||
src = fetchFromGitHub { | ||
owner = "vgresak"; | ||
repo = "keyboard-layout-editor"; | ||
rev = "308c62ac4bb9ad25429f4d09c0aaa9f72d4194c9"; | ||
hash = "sha256-ieXHgXAdC1xVJWXwpf9sQ9FaSLeaJfd+Rr7uD8blwHE="; | ||
}; | ||
|
||
patches = [ ./fix-build-gradle.patch ]; | ||
|
||
nativeBuildInputs = [ | ||
gradle_8 | ||
makeBinaryWrapper | ||
wrapGAppsHook3 | ||
]; | ||
|
||
mitmCache = gradle_8.fetchDeps { | ||
inherit pname; | ||
data = ./deps.json; | ||
}; | ||
|
||
__darwinAllowLocalNetworking = true; | ||
|
||
gradleBuildTask = "fatJar"; | ||
|
||
installPhase = '' | ||
runHook preInstall | ||
mkdir -p $out/share/java | ||
cp build/libs/keyboard-layout-editor-all-1.0-SNAPSHOT.jar $out/share/java/keyboard-layout-editor.jar | ||
mkdir -p $out/bin | ||
makeWrapper ${lib.getExe jdk} $out/bin/keyboard-layout-editor \ | ||
--prefix PATH : ${lib.makeBinPath [ xorg.xkbcomp ]} \ | ||
--add-flags "--add-opens=javafx.graphics/com.sun.prism=ALL-UNNAMED" \ | ||
--add-flags "--add-opens=javafx.graphics/com.sun.javafx.font=ALL-UNNAMED" \ | ||
--add-flags "--add-opens=javafx.graphics/com.sun.javafx.tk=ALL-UNNAMED" \ | ||
--add-flags "-cp $out/share/java/keyboard-layout-editor.jar cz.gresak.keyboardeditor.Main" \ | ||
''${gappsWrapperArgs[@]} | ||
runHook postInstall | ||
''; | ||
|
||
meta = { | ||
description = "Keyboard layout editor for XKB"; | ||
homepage = "https://github.com/vgresak/keyboard-layout-editor"; | ||
license = lib.licenses.mit; | ||
maintainers = with lib.maintainers; [ fliegendewurst ]; | ||
mainProgram = "keyboard-layout-editor"; | ||
platforms = jdk.meta.platforms; | ||
# gradle resolves platform-specific dependencies | ||
broken = stdenv.hostPlatform.isAarch64 || stdenv.hostPlatform.isDarwin; | ||
}; | ||
} |