Skip to content

build: drop xrandr #310

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
May 6, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
[submodule "subprojects/x11-xserver-utils"]
path = subprojects/x11-xserver-utils
url = https://salsa.debian.org/xorg-team/app/x11-xserver-utils.git
[submodule "subprojects/libmspack"]
path = subprojects/libmspack
url = https://github.com/kyz/libmspack.git
Expand Down
34 changes: 2 additions & 32 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ INSTALL_DIR ?= $(shell pwd)/dist/protonfixes

.PHONY: all

all: xrandr-dist cabextract-dist libmspack-dist unzip-dist python-xlib-dist
all: cabextract-dist libmspack-dist unzip-dist python-xlib-dist

.PHONY: install

# Note: `export DEB_BUILD_MAINT_OPTIONS=hardening=-format` is required for the unzip target
install: protonfixes-install xrandr-install cabextract-install libmspack-install unzip-install python-xlib-install
install: protonfixes-install cabextract-install libmspack-install unzip-install python-xlib-install

#
# protonfixes
Expand All @@ -29,36 +29,6 @@ protonfixes-install: protonfixes
cp umu-database.csv $(INSTALL_DIR)
rm $(INSTALL_DIR)/protonfixes_test.py

#
# xrandr
#

$(OBJDIR)/.build-xrandr-dist: | $(OBJDIR)
$(info :: Installing xorg-macros )
cd subprojects/xutils-dev/util-macros && \
autoreconf -iv && \
./configure --prefix=/usr && \
make DESTDIR=$(INSTALL_DIR) install
$(info :: Building xrandr )
cd subprojects/x11-xserver-utils/xrandr && \
autoreconf -iv -I$(INSTALL_DIR)/usr/share/aclocal && \
./configure --prefix=/usr && \
make
touch $(@)

.PHONY: xrandr-dist

xrandr-dist: $(OBJDIR)/.build-xrandr-dist

xrandr-install: xrandr-dist
$(info :: Installing xrandr )
# Install
cd subprojects/x11-xserver-utils/xrandr && \
make DESTDIR=$(INSTALL_DIR) install
# Post install
cp $(INSTALL_DIR)/usr/bin/xrandr $(INSTALL_DIR)
rm -r $(INSTALL_DIR)/usr

#
# cabextract
#
Expand Down
6 changes: 5 additions & 1 deletion gamefixes-steam/497360.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,11 @@ def main() -> None:
return

# Get width of resolution
screen_width, screen_height = util.get_resolution()
resolution = util.get_resolution()
if not resolution:
return None

screen_width, screen_height = resolution
width = int(screen_width / screen_height * 768 // 1)

# dgvoodoo2 config patches
Expand Down
6 changes: 5 additions & 1 deletion gamefixes-steam/65540.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,12 @@ def main() -> None:

def set_resolution() -> None:
# Patch the config to match the system resolution
screen_width, screen_height = util.get_resolution()
resolution = util.get_resolution()

if not resolution:
return

screen_width, screen_height = resolution
zVidResFullscreenX = str(screen_width)
zVidResFullscreenY = str(screen_height)

Expand Down
1 change: 0 additions & 1 deletion subprojects/x11-xserver-utils
Submodule x11-xserver-utils deleted from 01cf9c
15 changes: 13 additions & 2 deletions util.py
Original file line number Diff line number Diff line change
Expand Up @@ -822,10 +822,21 @@ def set_xml_options(
return True


def get_resolution() -> tuple[int, int]:
def get_resolution() -> Optional[tuple[int, int]]:
"""Returns screen res width, height using xrandr"""
# Execute xrandr command and capture its output
xrandr_bin = os.path.abspath(__file__).replace('util.py', 'xrandr')
xrandr_bin = shutil.which('xrandr')

if not xrandr_bin:
log.info('xrandr not found in PATH, skipping screen resolution determination')
return None

# Current session must be X11/XWayland to get the resolution and xrandr
# requires DISPLAY to be set
if not os.environ.get('DISPLAY'):
log.info('DISPLAY does not exist, skipping screen resolution determination')
return None

xrandr_output = subprocess.check_output([xrandr_bin, '--current']).decode('utf-8')

# Find the line that starts with 'Screen 0:' and extract the resolution
Expand Down
Loading