-
Notifications
You must be signed in to change notification settings - Fork 185
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #325 from thr3343/NativeWaylandTestV3.2-Final
Add native Wayland support + Minor performance optimisations
- Loading branch information
Showing
34 changed files
with
537 additions
and
329 deletions.
There are no files selected for viewing
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
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
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
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
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
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
23 changes: 23 additions & 0 deletions
23
src/main/java/net/vulkanmod/mixin/wayland/InputConstantsM.java
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,23 @@ | ||
package net.vulkanmod.mixin.wayland; | ||
|
||
import com.mojang.blaze3d.platform.InputConstants; | ||
import net.vulkanmod.config.VideoResolution; | ||
import org.lwjgl.glfw.*; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.Overwrite; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.Redirect; | ||
|
||
@Mixin(InputConstants.class) | ||
public class InputConstantsM { | ||
/** | ||
* @author | ||
* @reason Setting the cursor position is not supported on Wayland | ||
*/ | ||
@Overwrite | ||
public static void grabOrReleaseMouse(long l, int i, double d, double e) { | ||
if (!VideoResolution.isWayLand()) | ||
GLFW.glfwSetCursorPos(l, d, e); | ||
GLFW.glfwSetInputMode(l, 208897, i); | ||
} | ||
} |
38 changes: 38 additions & 0 deletions
38
src/main/java/net/vulkanmod/mixin/wayland/MinecraftMixin.java
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,38 @@ | ||
package net.vulkanmod.mixin.wayland; | ||
|
||
import com.mojang.blaze3d.platform.IconSet; | ||
import com.mojang.blaze3d.platform.Window; | ||
import net.minecraft.SharedConstants; | ||
import net.minecraft.client.Minecraft; | ||
import net.minecraft.client.Options; | ||
import net.minecraft.server.packs.PackResources; | ||
import net.minecraft.server.packs.VanillaPackResources; | ||
import net.vulkanmod.config.VideoResolution; | ||
import org.spongepowered.asm.mixin.Final; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.Shadow; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.Redirect; | ||
|
||
import java.io.IOException; | ||
|
||
@Mixin(Minecraft.class) | ||
public class MinecraftMixin { | ||
|
||
@Shadow @Final private Window window; | ||
@Shadow @Final public Options options; | ||
|
||
@Shadow @Final private VanillaPackResources vanillaPackResources; | ||
|
||
/** | ||
* @author | ||
* @reason Only KWin supports setting the Icon on Wayland AFAIK | ||
*/ | ||
@Redirect(method="<init>", at=@At(value="INVOKE", target="Lcom/mojang/blaze3d/platform/Window;setIcon(Lnet/minecraft/server/packs/PackResources;Lcom/mojang/blaze3d/platform/IconSet;)V")) | ||
private void bypassWaylandIcon(Window instance, PackResources packResources, IconSet iconSet) throws IOException { | ||
if(!VideoResolution.isWayLand()) | ||
{ | ||
this.window.setIcon(this.vanillaPackResources, SharedConstants.getCurrentVersion().isStable() ? IconSet.RELEASE : IconSet.SNAPSHOT); | ||
} | ||
} | ||
} |
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
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
Oops, something went wrong.