Skip to content

Commit

Permalink
Upgrading to jdk 21 with module-info.java
Browse files Browse the repository at this point in the history
  • Loading branch information
moaxcp committed Apr 25, 2024
1 parent b183ddc commit 8fd6f25
Show file tree
Hide file tree
Showing 115 changed files with 730 additions and 251 deletions.
28 changes: 14 additions & 14 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,19 @@ jobs:
uses: actions/setup-java@v2
with:
distribution: temurin
java-version: 17
- name: Cache SonarCloud packages
uses: actions/cache@v1
with:
path: ~/.sonar/cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar
- name: Cache Gradle packages
uses: actions/cache@v1
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
restore-keys: ${{ runner.os }}-gradle
java-version: 21
# - name: Cache SonarCloud packages
# uses: actions/cache@v1
# with:
# path: ~/.sonar/cache
# key: ${{ runner.os }}-sonar
# restore-keys: ${{ runner.os }}-sonar
# - name: Cache Gradle packages
# uses: actions/cache@v1
# with:
# path: ~/.gradle/caches
# key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
# restore-keys: ${{ runner.os }}-gradle
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build with Gradle
Expand All @@ -45,4 +45,4 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: ./gradlew sonar --info
run: ./gradlew sonar
4 changes: 3 additions & 1 deletion .idea/compiler.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions .idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/modules/x11-keysym/x11.x11-keysym.main.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ as X11lib by queuing one-way requests before sending them to the server. The
x11-protocol project enables reading and writing the entire protocol and can
be used to help write a x11 server.

[![Java CI with Gradle](https://github.com/moaxcp/x11/workflows/Java%20CI%20with%20Gradle/badge.svg?branch=master)](https://github.com/moaxcp/x11/actions?query=workflow%3A%22Java+CI+with+Gradle%22)
[![Java CI with Gradle](https://github.com/moaxcp/x11/actions/workflows/gradle.yml/badge.svg)](https://github.com/moaxcp/x11/actions/workflows/gradle.yml)
[![maven central](https://img.shields.io/maven-central/v/com.github.moaxcp.x11/x11-client)](https://search.maven.org/artifact/com.github.moaxcp.x11/x11-client)
[![javadoc](https://javadoc.io/badge2/com.github.moaxcp.x11/x11-client/javadoc.svg)](https://javadoc.io/doc/com.github.moaxcp.x11/x11-client)
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=moaxcp_x11-client&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=moaxcp_x11-client)
Expand Down
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
plugins {
id 'org.sonarqube' version '4.4.1.3373'
id 'io.freefair.lombok' version '8.4' apply false
id 'org.sonarqube' version '5.0.0.4638'
id 'io.freefair.lombok' version '8.6' apply false
id 'org.unbroken-dome.test-sets' version '4.1.0' apply false
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package com.github.moaxcp.x11.examples;

import com.github.moaxcp.x11.keysym.KeySym;
import com.github.moaxcp.x11.x11client.X11Client;
import lombok.extern.java.Log;

import java.io.IOException;
import java.util.List;

@Log
public class KeySymMain {

public static void main(String... args) throws IOException {
try(X11Client client = X11Client.connect()) {
List<Byte> keyCodes = client.keySymToKeyCodes(KeySym.XK_Escape);
for(byte keyCode : keyCodes) {
KeySym keySym = client.keyCodeToKeySym(keyCode, (short) 0);
log.info(keySym.toString());
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.github.moaxcp.x11.x11client;
package com.github.moaxcp.x11.examples;

import com.github.moaxcp.x11.protocol.record.QueryVersionReply;
import com.github.moaxcp.x11.x11client.X11Client;
import lombok.extern.java.Log;

import java.io.IOException;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
package com.github.moaxcp.x11.x11client;
package com.github.moaxcp.x11.examples;

import com.github.moaxcp.x11.protocol.KeySym;
import com.github.moaxcp.x11.keysym.KeySym;
import com.github.moaxcp.x11.protocol.XEvent;
import com.github.moaxcp.x11.protocol.record.*;
import com.github.moaxcp.x11.protocol.xproto.KeyPressEvent;
import com.github.moaxcp.x11.protocol.xproto.MotionNotifyEvent;
import com.github.moaxcp.x11.x11client.X11Client;
import lombok.extern.java.Log;

import java.io.IOException;
Expand Down Expand Up @@ -67,7 +68,7 @@ public static void main(String... args) throws IOException {

if (replyData instanceof KeyPressEvent) {
KeyPressEvent e = (KeyPressEvent) replyData;
com.github.moaxcp.x11.protocol.KeySym keysym = data.keyCodeToKeySym(e);
KeySym keysym = data.keyCodeToKeySym(e);
if(keysym == KeySym.XK_Escape) {
break;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
package com.github.moaxcp.x11.x11client;
package com.github.moaxcp.x11.examples;

import com.github.moaxcp.x11.protocol.KeySym;
import com.github.moaxcp.x11.keysym.KeySym;
import com.github.moaxcp.x11.protocol.record.*;
import com.github.moaxcp.x11.protocol.xproto.GeGenericEvent;
import com.github.moaxcp.x11.protocol.xproto.KeyPressEvent;
import com.github.moaxcp.x11.x11client.X11Client;
import com.github.moaxcp.x11.x11client.api.record.RecordData;
import com.github.moaxcp.x11.x11client.api.record.RecordReply;
import lombok.extern.java.Log;
Expand Down Expand Up @@ -67,7 +68,7 @@ public static void main(String... args) throws IOException {
while(true) {
RecordReply recordReply = data.record().readNextRecord();
log.info(String.format("%s", recordReply));
Optional<com.github.moaxcp.x11.protocol.KeySym> first = recordReply.getData().stream()
Optional<KeySym> first = recordReply.getData().stream()
.map(RecordData::getXObject)
.filter(obj -> obj instanceof KeyPressEvent)
.map(KeyPressEvent.class::cast)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
package com.github.moaxcp.x11.x11client;
package com.github.moaxcp.x11.examples;

import com.github.moaxcp.x11.protocol.KeySym;
import com.github.moaxcp.x11.keysym.KeySym;
import com.github.moaxcp.x11.protocol.record.*;
import com.github.moaxcp.x11.protocol.xproto.CreateWindow;
import com.github.moaxcp.x11.protocol.xproto.GeGenericEvent;
import com.github.moaxcp.x11.protocol.xproto.KeyPressEvent;
import com.github.moaxcp.x11.protocol.xproto.NoOperation;
import com.github.moaxcp.x11.x11client.X11Client;
import com.github.moaxcp.x11.x11client.api.record.RecordData;
import com.github.moaxcp.x11.x11client.api.record.RecordReply;
import lombok.extern.java.Log;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
package com.github.moaxcp.x11.x11client;
package com.github.moaxcp.x11.examples;

import com.github.moaxcp.x11.protocol.Utilities;
import com.github.moaxcp.x11.protocol.XEvent;
import com.github.moaxcp.x11.protocol.xproto.*;
import com.github.moaxcp.x11.x11client.X11Client;

import java.io.IOException;
import java.util.ArrayList;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
package com.github.moaxcp.x11.x11client;
package com.github.moaxcp.x11.examples;


import com.github.moaxcp.x11.protocol.XEvent;
import com.github.moaxcp.x11.protocol.xproto.*;
import com.github.moaxcp.x11.x11client.X11Client;

import java.io.IOException;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
package com.github.moaxcp.x11.x11client;
package com.github.moaxcp.x11.examples;

import com.github.moaxcp.x11.protocol.KeySym;
import com.github.moaxcp.x11.keysym.KeySym;
import com.github.moaxcp.x11.protocol.Utilities;
import com.github.moaxcp.x11.protocol.XEvent;
import com.github.moaxcp.x11.protocol.xproto.*;
import com.github.moaxcp.x11.x11client.X11Client;

import java.io.IOException;
import java.nio.ByteBuffer;
Expand Down Expand Up @@ -99,7 +100,7 @@ public static void main(String... args) throws IOException {
.build());
} else if(event instanceof KeyPressEvent) {
KeyPressEvent keyPress = (KeyPressEvent) event;
com.github.moaxcp.x11.protocol.KeySym keysym = client.keyCodeToKeySym(keyPress.getDetail(), keyPress.getState());
KeySym keysym = client.keyCodeToKeySym(keyPress.getDetail(), keyPress.getState());
if(keysym == KeySym.XK_Escape) {
break;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
package com.github.moaxcp.x11.x11client.X11Events;
package com.github.moaxcp.x11.examples.X11Events;

import com.github.moaxcp.x11.keysym.KeySym;
import com.github.moaxcp.x11.protocol.DisplayName;
import com.github.moaxcp.x11.protocol.KeySym;
import com.github.moaxcp.x11.protocol.Utilities;
import com.github.moaxcp.x11.protocol.XEvent;
import com.github.moaxcp.x11.protocol.xproto.*;
import com.github.moaxcp.x11.x11client.X11Client;

import java.io.IOException;

public class X11EventsWindow {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.github.moaxcp.x11.x11client.X11Events;
package com.github.moaxcp.x11.examples.X11Events;

import com.github.moaxcp.x11.xephyr.XephyrRunner;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.github.moaxcp.x11.x11client.basicwm;
package com.github.moaxcp.x11.examples.basicwm;

import com.github.moaxcp.x11.xephyr.XephyrRunner;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
package com.github.moaxcp.x11.x11client.basicwm;
package com.github.moaxcp.x11.examples.basicwm;

import com.github.moaxcp.x11.protocol.*;
import com.github.moaxcp.x11.keysym.KeySym;
import com.github.moaxcp.x11.protocol.AtomValue;
import com.github.moaxcp.x11.protocol.DisplayName;
import com.github.moaxcp.x11.protocol.Utilities;
import com.github.moaxcp.x11.protocol.XEvent;
import com.github.moaxcp.x11.protocol.xproto.*;
import com.github.moaxcp.x11.x11client.X11Client;

import java.io.IOException;
import java.util.Iterator;
import java.util.LinkedHashMap;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.github.moaxcp.x11.x11client.experimental;
package com.github.moaxcp.x11.examples.experimental;

import com.github.moaxcp.x11.protocol.DisplayName;
import com.github.moaxcp.x11.protocol.xproto.Rectangle;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.github.moaxcp.x11.x11client.tinywm;
package com.github.moaxcp.x11.examples.tinywm;

import com.github.moaxcp.x11.xephyr.XephyrRunner;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
package com.github.moaxcp.x11.x11client.tinywm;
package com.github.moaxcp.x11.examples.tinywm;

import com.github.moaxcp.x11.keysym.KeySym;
import com.github.moaxcp.x11.protocol.DisplayName;
import com.github.moaxcp.x11.protocol.KeySym;
import com.github.moaxcp.x11.protocol.XEvent;
import com.github.moaxcp.x11.protocol.xproto.*;
import com.github.moaxcp.x11.x11client.X11Client;

import java.io.IOException;

public class TinyWindowManager {
Expand Down
20 changes: 0 additions & 20 deletions examples/src/main/java/com/github/moaxcp/x11/x11client/KeySym.java

This file was deleted.

This file was deleted.

12 changes: 12 additions & 0 deletions examples/src/main/java/module-info.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
@SuppressWarnings("module")
module com.github.moaxcp.x11.examples {
exports com.github.moaxcp.x11.examples;

requires transitive com.github.moaxcp.x11.client;
requires transitive com.github.moaxcp.x11.xephyr;
requires transitive com.github.moaxcp.x11.toolkit;
requires transitive com.github.moaxcp.x11.keysym;
requires transitive java.logging;

requires static lombok;
}
Loading

0 comments on commit 8fd6f25

Please sign in to comment.