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