refactor: rename borderless mode to exclusive mode, re-added old borderless mode
This commit is contained in:
parent
9203818dc7
commit
01758809b8
@ -10,8 +10,9 @@ import java.util.function.IntFunction;
|
|||||||
|
|
||||||
public enum FullscreenMode implements OptionEnum, StringRepresentable {
|
public enum FullscreenMode implements OptionEnum, StringRepresentable {
|
||||||
|
|
||||||
BORDERLESS(0, "borderless", "concentration.option.fullscreen_mode.borderless"),
|
EXCLUSIVE(0, "exclusive", "concentration.option.fullscreen_mode.exclusive"),
|
||||||
NATIVE(1, "native", "concentration.option.fullscreen_mode.native");
|
NATIVE(1, "native", "concentration.option.fullscreen_mode.native"),
|
||||||
|
BORDERLESS(2, "borderless", "concentration.option.fullscreen_mode.borderless");
|
||||||
|
|
||||||
public static final Codec<FullscreenMode> CODEC = StringRepresentable.fromEnum(FullscreenMode::values);
|
public static final Codec<FullscreenMode> CODEC = StringRepresentable.fromEnum(FullscreenMode::values);
|
||||||
public static final IntFunction<FullscreenMode> BY_ID = ByIdMap.continuous(FullscreenMode::getId, values(), ByIdMap.OutOfBoundsStrategy.ZERO);
|
public static final IntFunction<FullscreenMode> BY_ID = ByIdMap.continuous(FullscreenMode::getId, values(), ByIdMap.OutOfBoundsStrategy.ZERO);
|
||||||
|
@ -12,6 +12,10 @@ public interface Config {
|
|||||||
|
|
||||||
void save();
|
void save();
|
||||||
|
|
||||||
|
static boolean isExclusive() {
|
||||||
|
return ConfigProvider.INSTANCE.ensureLoaded().getFullscreenMode() == FullscreenMode.EXCLUSIVE;
|
||||||
|
}
|
||||||
|
|
||||||
static boolean isBorderless() {
|
static boolean isBorderless() {
|
||||||
return ConfigProvider.INSTANCE.ensureLoaded().getFullscreenMode() == FullscreenMode.BORDERLESS;
|
return ConfigProvider.INSTANCE.ensureLoaded().getFullscreenMode() == FullscreenMode.BORDERLESS;
|
||||||
}
|
}
|
||||||
|
@ -7,5 +7,4 @@ import org.spongepowered.asm.mixin.Mixin;
|
|||||||
public class MainMixin {
|
public class MainMixin {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -9,7 +9,6 @@ import net.minecraft.client.gui.screens.Screen;
|
|||||||
import net.minecraft.client.gui.screens.options.OptionsSubScreen;
|
import net.minecraft.client.gui.screens.options.OptionsSubScreen;
|
||||||
import net.minecraft.client.gui.screens.options.VideoSettingsScreen;
|
import net.minecraft.client.gui.screens.options.VideoSettingsScreen;
|
||||||
import net.minecraft.network.chat.Component;
|
import net.minecraft.network.chat.Component;
|
||||||
import net.minecraft.world.entity.HumanoidArm;
|
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
import org.spongepowered.asm.mixin.Shadow;
|
import org.spongepowered.asm.mixin.Shadow;
|
||||||
import org.spongepowered.asm.mixin.Unique;
|
import org.spongepowered.asm.mixin.Unique;
|
||||||
|
@ -9,5 +9,6 @@
|
|||||||
"concentration.option.fullscreen_mode": "Fullscreen Mode",
|
"concentration.option.fullscreen_mode": "Fullscreen Mode",
|
||||||
"concentration.option.fullscreen_mode.tooltip": "Fullscreen mode determines the fullscreen function using borderless fullscreen or native fullscreen.",
|
"concentration.option.fullscreen_mode.tooltip": "Fullscreen mode determines the fullscreen function using borderless fullscreen or native fullscreen.",
|
||||||
"concentration.option.fullscreen_mode.borderless": "Borderless",
|
"concentration.option.fullscreen_mode.borderless": "Borderless",
|
||||||
|
"concentration.option.fullscreen_mode.exclusive": "Exclusive",
|
||||||
"concentration.option.fullscreen_mode.native": "Native"
|
"concentration.option.fullscreen_mode.native": "Native"
|
||||||
}
|
}
|
@ -9,5 +9,6 @@
|
|||||||
"concentration.option.fullscreen_mode": "全屏模式",
|
"concentration.option.fullscreen_mode": "全屏模式",
|
||||||
"concentration.option.fullscreen_mode.tooltip": "决定开启全屏后应使用无边框窗口全屏还是原生全屏。",
|
"concentration.option.fullscreen_mode.tooltip": "决定开启全屏后应使用无边框窗口全屏还是原生全屏。",
|
||||||
"concentration.option.fullscreen_mode.borderless": "无边框",
|
"concentration.option.fullscreen_mode.borderless": "无边框",
|
||||||
|
"concentration.option.fullscreen_mode.exclusive": "独占",
|
||||||
"concentration.option.fullscreen_mode.native": "原生"
|
"concentration.option.fullscreen_mode.native": "原生"
|
||||||
}
|
}
|
@ -41,7 +41,7 @@ public class ConcentrationConfigFabric implements Config {
|
|||||||
public int y = 0;
|
public int y = 0;
|
||||||
public int width = 800;
|
public int width = 800;
|
||||||
public int height = 600;
|
public int height = 600;
|
||||||
public FullscreenMode fullscreen = FullscreenMode.BORDERLESS;
|
public FullscreenMode fullscreen = FullscreenMode.NATIVE;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean customized() {
|
public boolean customized() {
|
||||||
|
@ -76,19 +76,26 @@ public class GLFWMixin {
|
|||||||
} else {
|
} else {
|
||||||
ConcentrationConstants.LOGGER.info("Trying to switch to borderless fullscreen mode");
|
ConcentrationConstants.LOGGER.info("Trying to switch to borderless fullscreen mode");
|
||||||
|
|
||||||
if (ConcentrationConfigFabric.getInstance().customized) {
|
if (Config.isExclusive()) {
|
||||||
ConcentrationConstants.LOGGER.info("Customization enabled, so replace the fullscreen size with customized size");
|
|
||||||
finalMonitor = 0L;
|
|
||||||
finalX = config.x + (config.related ? monitorInstance.getX() : 0);
|
|
||||||
finalY = config.y - (config.height == height ? 1 : 0) + (config.related ? monitorInstance.getY() : 0);
|
|
||||||
finalWidth = config.width;
|
|
||||||
finalHeight = config.height + (config.height == height ? 1 : 0);
|
|
||||||
} else {
|
|
||||||
finalMonitor = monitor;
|
finalMonitor = monitor;
|
||||||
finalX = monitorInstance.getX();
|
finalX = monitorInstance.getX();
|
||||||
finalY = monitorInstance.getY();
|
finalY = monitorInstance.getY();
|
||||||
finalWidth = currentMode.getWidth();
|
finalWidth = currentMode.getWidth();
|
||||||
finalHeight = currentMode.getHeight();
|
finalHeight = currentMode.getHeight();
|
||||||
|
} else {
|
||||||
|
finalMonitor = 0L;
|
||||||
|
if (ConcentrationConfigFabric.getInstance().customized) {
|
||||||
|
ConcentrationConstants.LOGGER.info("Customization enabled, so replace the fullscreen size with customized size");
|
||||||
|
finalX = config.x + (config.related ? monitorInstance.getX() : 0);
|
||||||
|
finalY = config.y - (config.height == height ? 1 : 0) + (config.related ? monitorInstance.getY() : 0);
|
||||||
|
finalWidth = config.width;
|
||||||
|
finalHeight = config.height + (config.height == height ? 1 : 0);
|
||||||
|
} else {
|
||||||
|
finalX = monitorInstance.getX();
|
||||||
|
finalY = monitorInstance.getY() - 1;
|
||||||
|
finalWidth = width;
|
||||||
|
finalHeight = height + 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
accessor.setX(finalX);
|
accessor.setX(finalX);
|
||||||
@ -128,9 +135,10 @@ public class GLFWMixin {
|
|||||||
ConcentrationConstants.LOGGER.info("Trying to resize and reposition the window");
|
ConcentrationConstants.LOGGER.info("Trying to resize and reposition the window");
|
||||||
finalExecute(window, finalMonitor, finalX, finalY, finalWidth, finalHeight, -1);
|
finalExecute(window, finalMonitor, finalX, finalY, finalWidth, finalHeight, -1);
|
||||||
|
|
||||||
if (windowInstance.isFullscreen() && !(Config.isBorderless() && Config.isCustomized())) {
|
if (windowInstance.isFullscreen()) {
|
||||||
GLFW.glfwSetWindowAttrib(windowInstance.getWindow(), 0x20006, 1);
|
GLFW.glfwSetWindowAttrib(windowInstance.getWindow(), 0x20006, 1);
|
||||||
|
if (!Config.isBorderless()) {
|
||||||
|
if (System.getProperty("os.name").contains("Windows")) {
|
||||||
long hWnd = GLFWNativeWin32.glfwGetWin32Window(windowInstance.getWindow());
|
long hWnd = GLFWNativeWin32.glfwGetWin32Window(windowInstance.getWindow());
|
||||||
if (hWnd != 0) {
|
if (hWnd != 0) {
|
||||||
User32.SetWindowPos(
|
User32.SetWindowPos(
|
||||||
@ -145,11 +153,11 @@ public class GLFWMixin {
|
|||||||
User32.SetWindowLongPtr(hWnd, -16, 0x960A0000L);
|
User32.SetWindowLongPtr(hWnd, -16, 0x960A0000L);
|
||||||
User32.SetWindowLongPtr(hWnd, -20, 0x40010L);
|
User32.SetWindowLongPtr(hWnd, -20, 0x40010L);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (Config.isBorderless()) {
|
if (Config.isExclusive()) {
|
||||||
GLFW.glfwSetWindowAttrib(windowInstance.getWindow(), 0x20006, 0);
|
GLFW.glfwSetWindowAttrib(windowInstance.getWindow(), 0x20006, 0);
|
||||||
|
|
||||||
if (System.getProperty("os.name").contains("Windows")) {
|
if (System.getProperty("os.name").contains("Windows")) {
|
||||||
|
long hWnd = GLFWNativeWin32.glfwGetWin32Window(windowInstance.getWindow());
|
||||||
if (hWnd != 0) {
|
if (hWnd != 0) {
|
||||||
User32.SetWindowPos(
|
User32.SetWindowPos(
|
||||||
hWnd,
|
hWnd,
|
||||||
@ -166,12 +174,11 @@ public class GLFWMixin {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (windowInstance.isFullscreen() && Config.isBorderless() && Config.isCustomized()) {
|
|
||||||
GLFW.glfwSetWindowAttrib(window, GLFW.GLFW_DECORATED, GLFW.GLFW_FALSE);
|
GLFW.glfwSetWindowAttrib(window, GLFW.GLFW_DECORATED, GLFW.GLFW_FALSE);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
GLFW.glfwSetWindowAttrib(window, GLFW.GLFW_DECORATED, GLFW.GLFW_TRUE);
|
GLFW.glfwSetWindowAttrib(window, GLFW.GLFW_DECORATED, GLFW.GLFW_TRUE);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
ConcentrationConstants.LOGGER.info("================= [Concentration End] =================");
|
ConcentrationConstants.LOGGER.info("================= [Concentration End] =================");
|
||||||
ci.cancel();
|
ci.cancel();
|
||||||
|
@ -48,7 +48,8 @@ public abstract class WindowMixin {
|
|||||||
@Final
|
@Final
|
||||||
private long window;
|
private long window;
|
||||||
|
|
||||||
@Shadow public abstract boolean isFullscreen();
|
@Shadow
|
||||||
|
public abstract boolean isFullscreen();
|
||||||
|
|
||||||
@Inject(method = "onMove", at = @At("HEAD"))
|
@Inject(method = "onMove", at = @At("HEAD"))
|
||||||
private void inject$onMove$head(long window, int x, int y, CallbackInfo ci) {
|
private void inject$onMove$head(long window, int x, int y, CallbackInfo ci) {
|
||||||
@ -116,21 +117,28 @@ public abstract class WindowMixin {
|
|||||||
} else {
|
} else {
|
||||||
ConcentrationConstants.LOGGER.info("Trying to switch to borderless fullscreen mode");
|
ConcentrationConstants.LOGGER.info("Trying to switch to borderless fullscreen mode");
|
||||||
|
|
||||||
if (ConcentrationConfigFabric.getInstance().customized) {
|
if (Config.isExclusive()) {
|
||||||
ConcentrationConstants.LOGGER.info("Customization enabled, so replace the fullscreen size with customized size");
|
|
||||||
|
|
||||||
finalMonitor = 0L;
|
|
||||||
finalX = config.x + (config.related ? monitorInstance.getX() : 0);
|
|
||||||
finalY = config.y - (config.height == height ? 1 : 0) + (config.related ? monitorInstance.getY() : 0);
|
|
||||||
finalWidth = config.width;
|
|
||||||
finalHeight = config.height + (config.height == height ? 1 : 0);
|
|
||||||
} else {
|
|
||||||
finalMonitor = monitor;
|
finalMonitor = monitor;
|
||||||
finalX = monitorInstance.getX();
|
finalX = monitorInstance.getX();
|
||||||
finalY = monitorInstance.getY();
|
finalY = monitorInstance.getY();
|
||||||
finalWidth = currentMode.getWidth();
|
finalWidth = currentMode.getWidth();
|
||||||
finalHeight = currentMode.getHeight();
|
finalHeight = currentMode.getHeight();
|
||||||
|
} else {
|
||||||
|
finalMonitor = 0L;
|
||||||
|
if (ConcentrationConfigFabric.getInstance().customized) {
|
||||||
|
ConcentrationConstants.LOGGER.info("Customization enabled, so replace the fullscreen size with customized size");
|
||||||
|
finalX = config.x + (config.related ? monitorInstance.getX() : 0);
|
||||||
|
finalY = config.y - (config.height == height ? 1 : 0) + (config.related ? monitorInstance.getY() : 0);
|
||||||
|
finalWidth = config.width;
|
||||||
|
finalHeight = config.height + (config.height == height ? 1 : 0);
|
||||||
|
} else {
|
||||||
|
finalX = monitorInstance.getX();
|
||||||
|
finalY = monitorInstance.getY() - 1;
|
||||||
|
finalWidth = width;
|
||||||
|
finalHeight = height + 1;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
this.x = finalX;
|
this.x = finalX;
|
||||||
this.y = finalY;
|
this.y = finalY;
|
||||||
this.width = finalWidth;
|
this.width = finalWidth;
|
||||||
@ -166,21 +174,21 @@ public abstract class WindowMixin {
|
|||||||
ConcentrationConstants.LOGGER.info("Trying to resize and reposition the window");
|
ConcentrationConstants.LOGGER.info("Trying to resize and reposition the window");
|
||||||
GLFW.glfwSetWindowMonitor(window, finalMonitor, finalX, finalY, finalWidth, finalHeight, -1);
|
GLFW.glfwSetWindowMonitor(window, finalMonitor, finalX, finalY, finalWidth, finalHeight, -1);
|
||||||
|
|
||||||
if (this.fullscreen && !(Config.isBorderless() && Config.isCustomized())) {
|
if (this.fullscreen) {
|
||||||
GLFW.glfwSetWindowAttrib(window, GLFW.GLFW_DECORATED, GLFW.GLFW_TRUE);
|
|
||||||
GLFW.glfwSetWindowAttrib(this.window, 0x20006, 1);
|
GLFW.glfwSetWindowAttrib(this.window, 0x20006, 1);
|
||||||
|
if (!Config.isBorderless()) {
|
||||||
|
if (System.getProperty("os.name").contains("Windows")) {
|
||||||
long hWnd = GLFWNativeWin32.glfwGetWin32Window(this.window);
|
long hWnd = GLFWNativeWin32.glfwGetWin32Window(this.window);
|
||||||
if (hWnd != 0) {
|
if (hWnd != 0) {
|
||||||
User32.SetWindowPos(hWnd, User32.HWND_TOPMOST, this.x, this.y, this.width, this.height, 1027);
|
User32.SetWindowPos(hWnd, User32.HWND_TOPMOST, this.x, this.y, this.width, this.height, 1027);
|
||||||
User32.SetWindowLongPtr(hWnd, -16, 0x960A0000L);
|
User32.SetWindowLongPtr(hWnd, -16, 0x960A0000L);
|
||||||
User32.SetWindowLongPtr(hWnd, -20, 0x40010L);
|
User32.SetWindowLongPtr(hWnd, -20, 0x40010L);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (Config.isBorderless()) {
|
if (Config.isExclusive()) {
|
||||||
GLFW.glfwSetWindowAttrib(this.window, 0x20006, 0);
|
GLFW.glfwSetWindowAttrib(this.window, 0x20006, 0);
|
||||||
|
|
||||||
if (System.getProperty("os.name").contains("Windows")) {
|
if (System.getProperty("os.name").contains("Windows")) {
|
||||||
|
long hWnd = GLFWNativeWin32.glfwGetWin32Window(this.window);
|
||||||
if (hWnd != 0) {
|
if (hWnd != 0) {
|
||||||
User32.SetWindowPos(hWnd, User32.HWND_NOTOPMOST, this.x, this.y, this.width, this.height, 1027);
|
User32.SetWindowPos(hWnd, User32.HWND_NOTOPMOST, this.x, this.y, this.width, this.height, 1027);
|
||||||
User32.SetWindowLongPtr(hWnd, -16, 369229824);
|
User32.SetWindowLongPtr(hWnd, -16, 369229824);
|
||||||
@ -189,12 +197,11 @@ public abstract class WindowMixin {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (this.isFullscreen() && Config.isBorderless() && Config.isCustomized()) {
|
|
||||||
GLFW.glfwSetWindowAttrib(window, GLFW.GLFW_DECORATED, GLFW.GLFW_FALSE);
|
GLFW.glfwSetWindowAttrib(window, GLFW.GLFW_DECORATED, GLFW.GLFW_FALSE);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
GLFW.glfwSetWindowAttrib(window, GLFW.GLFW_DECORATED, GLFW.GLFW_TRUE);
|
GLFW.glfwSetWindowAttrib(window, GLFW.GLFW_DECORATED, GLFW.GLFW_TRUE);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
ConcentrationConstants.LOGGER.info("================= [Concentration End] =================");
|
ConcentrationConstants.LOGGER.info("================= [Concentration End] =================");
|
||||||
}
|
}
|
||||||
|
@ -44,7 +44,7 @@ public final class ConcentrationConfigForge implements Config {
|
|||||||
HEIGHT = builder.comment("Height")
|
HEIGHT = builder.comment("Height")
|
||||||
.defineInRange("height", 600, 1, Integer.MAX_VALUE);
|
.defineInRange("height", 600, 1, Integer.MAX_VALUE);
|
||||||
FULLSCREEN = builder.comment("Fullscreen mode")
|
FULLSCREEN = builder.comment("Fullscreen mode")
|
||||||
.defineEnum("fullscreen", FullscreenMode.BORDERLESS);
|
.defineEnum("fullscreen", FullscreenMode.NATIVE);
|
||||||
|
|
||||||
builder.pop();
|
builder.pop();
|
||||||
|
|
||||||
|
@ -135,27 +135,34 @@ public abstract class WindowMixin {
|
|||||||
} else {
|
} else {
|
||||||
ConcentrationConstants.LOGGER.info("Trying to switch to borderless fullscreen mode");
|
ConcentrationConstants.LOGGER.info("Trying to switch to borderless fullscreen mode");
|
||||||
|
|
||||||
|
if (Config.isExclusive()) {
|
||||||
|
finalMonitor = monitor;
|
||||||
|
finalX = monitorInstance.getX();
|
||||||
|
finalY = monitorInstance.getY();
|
||||||
|
finalWidth = currentMode.getWidth();
|
||||||
|
finalHeight = currentMode.getHeight();
|
||||||
|
} else {
|
||||||
|
finalMonitor = 0L;
|
||||||
if (ConcentrationConfigForge.CUSTOMIZED.get()) {
|
if (ConcentrationConfigForge.CUSTOMIZED.get()) {
|
||||||
final boolean related = ConcentrationConfigForge.RELATED.get();
|
final boolean related = ConcentrationConfigForge.RELATED.get();
|
||||||
final int configX = ConcentrationConfigForge.X.get();
|
final int configX = ConcentrationConfigForge.X.get();
|
||||||
final int configY = ConcentrationConfigForge.Y.get();
|
final int configY = ConcentrationConfigForge.Y.get();
|
||||||
final int configWidth = ConcentrationConfigForge.WIDTH.get();
|
final int configWidth = ConcentrationConfigForge.WIDTH.get();
|
||||||
final int configHeight = ConcentrationConfigForge.HEIGHT.get();
|
final int configHeight = ConcentrationConfigForge.HEIGHT.get();
|
||||||
|
|
||||||
ConcentrationConstants.LOGGER.info("Customization enabled, so replace the fullscreen size with customized size");
|
ConcentrationConstants.LOGGER.info("Customization enabled, so replace the fullscreen size with customized size");
|
||||||
|
|
||||||
finalMonitor = 0L;
|
|
||||||
finalX = configX + (related ? monitorInstance.getX() : 0);
|
finalX = configX + (related ? monitorInstance.getX() : 0);
|
||||||
finalY = configY - (configHeight == height ? 1 : 0) + (related ? monitorInstance.getY() : 0);
|
finalY = configY - (configHeight == height ? 1 : 0) + (related ? monitorInstance.getY() : 0);
|
||||||
finalWidth = configWidth;
|
finalWidth = configWidth;
|
||||||
finalHeight = configHeight + (configHeight == height ? 1 : 0);
|
finalHeight = configHeight + (configHeight == height ? 1 : 0);
|
||||||
} else {
|
} else {
|
||||||
finalMonitor = monitor;
|
|
||||||
finalX = monitorInstance.getX();
|
finalX = monitorInstance.getX();
|
||||||
finalY = monitorInstance.getY();
|
finalY = monitorInstance.getY() - 1;
|
||||||
finalWidth = currentMode.getWidth();
|
finalWidth = width;
|
||||||
finalHeight = currentMode.getHeight();
|
finalHeight = height + 1;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
this.x = finalX;
|
this.x = finalX;
|
||||||
this.y = finalY;
|
this.y = finalY;
|
||||||
this.width = finalWidth;
|
this.width = finalWidth;
|
||||||
@ -191,20 +198,21 @@ public abstract class WindowMixin {
|
|||||||
ConcentrationConstants.LOGGER.info("Trying to resize and reposition the window");
|
ConcentrationConstants.LOGGER.info("Trying to resize and reposition the window");
|
||||||
GLFW.glfwSetWindowMonitor(window, finalMonitor, finalX, finalY, finalWidth, finalHeight, -1);
|
GLFW.glfwSetWindowMonitor(window, finalMonitor, finalX, finalY, finalWidth, finalHeight, -1);
|
||||||
|
|
||||||
if (this.fullscreen && !(Config.isBorderless() && Config.isCustomized())) {
|
if (this.fullscreen) {
|
||||||
GLFW.glfwSetWindowAttrib(this.window, 0x20006, 1);
|
GLFW.glfwSetWindowAttrib(this.window, 0x20006, 1);
|
||||||
|
if (!Config.isBorderless()) {
|
||||||
|
if (System.getProperty("os.name").contains("Windows")) {
|
||||||
long hWnd = GLFWNativeWin32.glfwGetWin32Window(this.window);
|
long hWnd = GLFWNativeWin32.glfwGetWin32Window(this.window);
|
||||||
if (hWnd != 0) {
|
if (hWnd != 0) {
|
||||||
User32.SetWindowPos(hWnd, User32.HWND_TOPMOST, this.x, this.y, this.width, this.height, 1027);
|
User32.SetWindowPos(hWnd, User32.HWND_TOPMOST, this.x, this.y, this.width, this.height, 1027);
|
||||||
User32.SetWindowLongPtr(hWnd, -16, 0x960A0000L);
|
User32.SetWindowLongPtr(hWnd, -16, 0x960A0000L);
|
||||||
User32.SetWindowLongPtr(hWnd, -20, 0x40010L);
|
User32.SetWindowLongPtr(hWnd, -20, 0x40010L);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (Config.isBorderless()) {
|
if (Config.isExclusive()) {
|
||||||
GLFW.glfwSetWindowAttrib(this.window, 0x20006, 0);
|
GLFW.glfwSetWindowAttrib(this.window, 0x20006, 0);
|
||||||
|
|
||||||
if (System.getProperty("os.name").contains("Windows")) {
|
if (System.getProperty("os.name").contains("Windows")) {
|
||||||
|
long hWnd = GLFWNativeWin32.glfwGetWin32Window(this.window);
|
||||||
if (hWnd != 0) {
|
if (hWnd != 0) {
|
||||||
User32.SetWindowPos(hWnd, User32.HWND_NOTOPMOST, this.x, this.y, this.width, this.height, 1027);
|
User32.SetWindowPos(hWnd, User32.HWND_NOTOPMOST, this.x, this.y, this.width, this.height, 1027);
|
||||||
User32.SetWindowLongPtr(hWnd, -16, 369229824);
|
User32.SetWindowLongPtr(hWnd, -16, 369229824);
|
||||||
@ -213,12 +221,11 @@ public abstract class WindowMixin {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (this.isFullscreen() && Config.isBorderless() && Config.isCustomized()) {
|
|
||||||
GLFW.glfwSetWindowAttrib(window, GLFW.GLFW_DECORATED, GLFW.GLFW_FALSE);
|
GLFW.glfwSetWindowAttrib(window, GLFW.GLFW_DECORATED, GLFW.GLFW_FALSE);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
GLFW.glfwSetWindowAttrib(window, GLFW.GLFW_DECORATED, GLFW.GLFW_TRUE);
|
GLFW.glfwSetWindowAttrib(window, GLFW.GLFW_DECORATED, GLFW.GLFW_TRUE);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
ConcentrationConstants.LOGGER.info("================= [Concentration End] =================");
|
ConcentrationConstants.LOGGER.info("================= [Concentration End] =================");
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
version=2.1.1
|
version=2.2.0
|
||||||
group=net.deechael.concentration
|
group=net.deechael.concentration
|
||||||
java_version=21
|
java_version=21
|
||||||
|
|
||||||
|
@ -38,7 +38,7 @@ public final class ConcentrationConfigNeoForge implements Config {
|
|||||||
HEIGHT = builder.comment("Height")
|
HEIGHT = builder.comment("Height")
|
||||||
.defineInRange("height", 600, 1, Integer.MAX_VALUE);
|
.defineInRange("height", 600, 1, Integer.MAX_VALUE);
|
||||||
FULLSCREEN = builder.comment("Fullscreen mode")
|
FULLSCREEN = builder.comment("Fullscreen mode")
|
||||||
.defineEnum("fullscreen", FullscreenMode.BORDERLESS);
|
.defineEnum("fullscreen", FullscreenMode.NATIVE);
|
||||||
|
|
||||||
builder.pop();
|
builder.pop();
|
||||||
|
|
||||||
|
@ -135,27 +135,34 @@ public abstract class WindowMixin {
|
|||||||
} else {
|
} else {
|
||||||
ConcentrationConstants.LOGGER.info("Trying to switch to borderless fullscreen mode");
|
ConcentrationConstants.LOGGER.info("Trying to switch to borderless fullscreen mode");
|
||||||
|
|
||||||
|
if (Config.isExclusive()) {
|
||||||
|
finalMonitor = monitor;
|
||||||
|
finalX = monitorInstance.getX();
|
||||||
|
finalY = monitorInstance.getY();
|
||||||
|
finalWidth = currentMode.getWidth();
|
||||||
|
finalHeight = currentMode.getHeight();
|
||||||
|
} else {
|
||||||
|
finalMonitor = 0L;
|
||||||
if (ConcentrationConfigNeoForge.CUSTOMIZED.get()) {
|
if (ConcentrationConfigNeoForge.CUSTOMIZED.get()) {
|
||||||
final boolean related = ConcentrationConfigNeoForge.RELATED.get();
|
final boolean related = ConcentrationConfigNeoForge.RELATED.get();
|
||||||
final int configX = ConcentrationConfigNeoForge.X.get();
|
final int configX = ConcentrationConfigNeoForge.X.get();
|
||||||
final int configY = ConcentrationConfigNeoForge.Y.get();
|
final int configY = ConcentrationConfigNeoForge.Y.get();
|
||||||
final int configWidth = ConcentrationConfigNeoForge.WIDTH.get();
|
final int configWidth = ConcentrationConfigNeoForge.WIDTH.get();
|
||||||
final int configHeight = ConcentrationConfigNeoForge.HEIGHT.get();
|
final int configHeight = ConcentrationConfigNeoForge.HEIGHT.get();
|
||||||
|
|
||||||
ConcentrationConstants.LOGGER.info("Customization enabled, so replace the fullscreen size with customized size");
|
ConcentrationConstants.LOGGER.info("Customization enabled, so replace the fullscreen size with customized size");
|
||||||
|
|
||||||
finalMonitor = 0L;
|
|
||||||
finalX = configX + (related ? monitorInstance.getX() : 0);
|
finalX = configX + (related ? monitorInstance.getX() : 0);
|
||||||
finalY = configY - (configHeight == height ? 1 : 0) + (related ? monitorInstance.getY() : 0);
|
finalY = configY - (configHeight == height ? 1 : 0) + (related ? monitorInstance.getY() : 0);
|
||||||
finalWidth = configWidth;
|
finalWidth = configWidth;
|
||||||
finalHeight = configHeight + (configHeight == height ? 1 : 0);
|
finalHeight = configHeight + (configHeight == height ? 1 : 0);
|
||||||
} else {
|
} else {
|
||||||
finalMonitor = monitor;
|
|
||||||
finalX = monitorInstance.getX();
|
finalX = monitorInstance.getX();
|
||||||
finalY = monitorInstance.getY();
|
finalY = monitorInstance.getY() - 1;
|
||||||
finalWidth = currentMode.getWidth();
|
finalWidth = width;
|
||||||
finalHeight = currentMode.getHeight();
|
finalHeight = height + 1;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
this.x = finalX;
|
this.x = finalX;
|
||||||
this.y = finalY;
|
this.y = finalY;
|
||||||
this.width = finalWidth;
|
this.width = finalWidth;
|
||||||
@ -191,20 +198,21 @@ public abstract class WindowMixin {
|
|||||||
ConcentrationConstants.LOGGER.info("Trying to resize and reposition the window");
|
ConcentrationConstants.LOGGER.info("Trying to resize and reposition the window");
|
||||||
GLFW.glfwSetWindowMonitor(window, finalMonitor, finalX, finalY, finalWidth, finalHeight, -1);
|
GLFW.glfwSetWindowMonitor(window, finalMonitor, finalX, finalY, finalWidth, finalHeight, -1);
|
||||||
|
|
||||||
if (this.fullscreen && !(Config.isBorderless() && Config.isCustomized())) {
|
if (this.fullscreen) {
|
||||||
GLFW.glfwSetWindowAttrib(this.window, 0x20006, 1);
|
GLFW.glfwSetWindowAttrib(this.window, 0x20006, 1);
|
||||||
|
if (!Config.isBorderless()) {
|
||||||
|
if (System.getProperty("os.name").contains("Windows")) {
|
||||||
long hWnd = GLFWNativeWin32.glfwGetWin32Window(this.window);
|
long hWnd = GLFWNativeWin32.glfwGetWin32Window(this.window);
|
||||||
if (hWnd != 0) {
|
if (hWnd != 0) {
|
||||||
User32.SetWindowPos(hWnd, User32.HWND_TOPMOST, this.x, this.y, this.width, this.height, 1027);
|
User32.SetWindowPos(hWnd, User32.HWND_TOPMOST, this.x, this.y, this.width, this.height, 1027);
|
||||||
User32.SetWindowLongPtr(hWnd, -16, 0x960A0000L);
|
User32.SetWindowLongPtr(hWnd, -16, 0x960A0000L);
|
||||||
User32.SetWindowLongPtr(hWnd, -20, 0x40010L);
|
User32.SetWindowLongPtr(hWnd, -20, 0x40010L);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (Config.isBorderless()) {
|
if (Config.isExclusive()) {
|
||||||
GLFW.glfwSetWindowAttrib(this.window, 0x20006, 0);
|
GLFW.glfwSetWindowAttrib(this.window, 0x20006, 0);
|
||||||
|
|
||||||
if (System.getProperty("os.name").contains("Windows")) {
|
if (System.getProperty("os.name").contains("Windows")) {
|
||||||
|
long hWnd = GLFWNativeWin32.glfwGetWin32Window(this.window);
|
||||||
if (hWnd != 0) {
|
if (hWnd != 0) {
|
||||||
User32.SetWindowPos(hWnd, User32.HWND_NOTOPMOST, this.x, this.y, this.width, this.height, 1027);
|
User32.SetWindowPos(hWnd, User32.HWND_NOTOPMOST, this.x, this.y, this.width, this.height, 1027);
|
||||||
User32.SetWindowLongPtr(hWnd, -16, 369229824);
|
User32.SetWindowLongPtr(hWnd, -16, 369229824);
|
||||||
@ -213,12 +221,11 @@ public abstract class WindowMixin {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (this.isFullscreen() && Config.isBorderless() && Config.isCustomized()) {
|
|
||||||
GLFW.glfwSetWindowAttrib(window, GLFW.GLFW_DECORATED, GLFW.GLFW_FALSE);
|
GLFW.glfwSetWindowAttrib(window, GLFW.GLFW_DECORATED, GLFW.GLFW_FALSE);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
GLFW.glfwSetWindowAttrib(window, GLFW.GLFW_DECORATED, GLFW.GLFW_TRUE);
|
GLFW.glfwSetWindowAttrib(window, GLFW.GLFW_DECORATED, GLFW.GLFW_TRUE);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
ConcentrationConstants.LOGGER.info("================= [Concentration End] =================");
|
ConcentrationConstants.LOGGER.info("================= [Concentration End] =================");
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user