Skip to content

Commit 71eab1a

Browse files
authored
build: drop xrandr (#310)
* build: drop xrandr - Added in steamrt3 since https://gitlab.steamos.cloud/steamrt/steamrt/-/commit/f9803d848e87de49c926550c7154a83b18405eea * util: find xrandr in PATH * gamefixes-steam: fix lint * util: ensure session is x11 before getting res * util: update type * util: refactor x11 detection * util: update comments
1 parent 510d407 commit 71eab1a

File tree

6 files changed

+25
-40
lines changed

6 files changed

+25
-40
lines changed

.gitmodules

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
[submodule "subprojects/x11-xserver-utils"]
2-
path = subprojects/x11-xserver-utils
3-
url = https://salsa.debian.org/xorg-team/app/x11-xserver-utils.git
41
[submodule "subprojects/libmspack"]
52
path = subprojects/libmspack
63
url = https://github.com/kyz/libmspack.git

Makefile

Lines changed: 2 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@ INSTALL_DIR ?= $(shell pwd)/dist/protonfixes
66

77
.PHONY: all
88

9-
all: xrandr-dist cabextract-dist libmspack-dist unzip-dist python-xlib-dist
9+
all: cabextract-dist libmspack-dist unzip-dist python-xlib-dist
1010

1111
.PHONY: install
1212

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

1616
#
1717
# protonfixes
@@ -29,36 +29,6 @@ protonfixes-install: protonfixes
2929
cp umu-database.csv $(INSTALL_DIR)
3030
rm $(INSTALL_DIR)/protonfixes_test.py
3131

32-
#
33-
# xrandr
34-
#
35-
36-
$(OBJDIR)/.build-xrandr-dist: | $(OBJDIR)
37-
$(info :: Installing xorg-macros )
38-
cd subprojects/xutils-dev/util-macros && \
39-
autoreconf -iv && \
40-
./configure --prefix=/usr && \
41-
make DESTDIR=$(INSTALL_DIR) install
42-
$(info :: Building xrandr )
43-
cd subprojects/x11-xserver-utils/xrandr && \
44-
autoreconf -iv -I$(INSTALL_DIR)/usr/share/aclocal && \
45-
./configure --prefix=/usr && \
46-
make
47-
touch $(@)
48-
49-
.PHONY: xrandr-dist
50-
51-
xrandr-dist: $(OBJDIR)/.build-xrandr-dist
52-
53-
xrandr-install: xrandr-dist
54-
$(info :: Installing xrandr )
55-
# Install
56-
cd subprojects/x11-xserver-utils/xrandr && \
57-
make DESTDIR=$(INSTALL_DIR) install
58-
# Post install
59-
cp $(INSTALL_DIR)/usr/bin/xrandr $(INSTALL_DIR)
60-
rm -r $(INSTALL_DIR)/usr
61-
6232
#
6333
# cabextract
6434
#

gamefixes-steam/497360.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,11 @@ def main() -> None:
2929
return
3030

3131
# Get width of resolution
32-
screen_width, screen_height = util.get_resolution()
32+
resolution = util.get_resolution()
33+
if not resolution:
34+
return None
35+
36+
screen_width, screen_height = resolution
3337
width = int(screen_width / screen_height * 768 // 1)
3438

3539
# dgvoodoo2 config patches

gamefixes-steam/65540.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,12 @@ def main() -> None:
3333

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

38+
if not resolution:
39+
return
40+
41+
screen_width, screen_height = resolution
3842
zVidResFullscreenX = str(screen_width)
3943
zVidResFullscreenY = str(screen_height)
4044

subprojects/x11-xserver-utils

Lines changed: 0 additions & 1 deletion
This file was deleted.

util.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -822,10 +822,21 @@ def set_xml_options(
822822
return True
823823

824824

825-
def get_resolution() -> tuple[int, int]:
825+
def get_resolution() -> Optional[tuple[int, int]]:
826826
"""Returns screen res width, height using xrandr"""
827827
# Execute xrandr command and capture its output
828-
xrandr_bin = os.path.abspath(__file__).replace('util.py', 'xrandr')
828+
xrandr_bin = shutil.which('xrandr')
829+
830+
if not xrandr_bin:
831+
log.info('xrandr not found in PATH, skipping screen resolution determination')
832+
return None
833+
834+
# Current session must be X11/XWayland to get the resolution and xrandr
835+
# requires DISPLAY to be set
836+
if not os.environ.get('DISPLAY'):
837+
log.info('DISPLAY does not exist, skipping screen resolution determination')
838+
return None
839+
829840
xrandr_output = subprocess.check_output([xrandr_bin, '--current']).decode('utf-8')
830841

831842
# Find the line that starts with 'Screen 0:' and extract the resolution

0 commit comments

Comments
 (0)