halflife icon indicating copy to clipboard operation
halflife copied to clipboard

HL1 spawns window on left-most screen, not primary screen

Open Tele42 opened this issue 12 years ago • 27 comments

I have a secondary monitor to the left setup with nVidia graphics and HL1 launches and plays on the left monitor only, which is ergonomically unsuitable for gaming. Having choice as to which monitor to use would be ideal.

    Processor Information:
    Vendor: AuthenticAMD
    Speed: 3600 Mhz
    8 logical processors
    8 physical processors
    HyperThreading: Unsupported
    FCMOV: Supported
    SSE2: Supported
    SSE3: Supported
    SSSE3: Supported
    SSE4a: Supported
    SSE41: Supported
    SSE42: Supported

    Network Information:
    Network Speed:

    Operating System Version:
    "Gentoo Base System release 2.1" (64 bit)
    Kernel Name: Linux
    Kernel Version: 3.6.11-gentoo
    X Server vendor: The X.Org Foundation
    X Server release: 11301000

    Video Card:
    Driver: NVIDIA Corporation GeForce GTX 460/PCIe/SSE2

    Driver Version: 4.3.0 NVIDIA 313.18
    Desktop Color Depth: 24 bits per pixel
    Monitor Refresh Rate: 60 Hz
    VendorID: 0x10de
    DeviceID: 0xe22
    Number of Monitors: 2
    Number of Video Cards Not Detected
    Primary Display Resolution: 1920 x 1080
    Desktop Resolution: 3840 x 1080
    Primary Display Size: 20.04" x 11.26" (22.95" diag)
    50.9cm x 28.6cm (58.3cm diag)
    Primary Bus: PCI Express 16x
    Primary VRAM: 1024 MB
    Supported MSAA Modes: 2x 4x 8x 16x

    Sound card:
    Audio device: Loopback Mixer

    Memory:
    RAM: 16035 Mb

    Miscellaneous:
    UI Language: English
    LANG: en_US.UTF-8
    Microphone: Not set
    Total Hard Disk Space Available: 905512 Mb
    Largest Free Hard Disk Block: 49214 Mb

    Installed software:

    Recent Failure Reports:
    Tue Jan 22 02:42:31 2013 GMT: file ''/tmp/dumps/assert_20130121214230_1.dmp'', upload yes: ''CrashID=bp-b3613bcc-4f59-4157-81f7-90ad02130121''
    Wed Jan 23 00:46:23 2013 GMT: file ''/tmp/dumps/assert_20130122194621_1.dmp'', upload yes: ''CrashID=bp-cccc792b-0780-4a48-aeae-3f5fe2130122''
    Thu Jan 24 00:42:12 2013 GMT: file ''/tmp/dumps/assert_20130123194210_1.dmp'', upload yes: ''CrashID=bp-a96aa96a-717e-4522-bbd5-e089e2130123''
    Thu Jan 24 01:14:10 2013 GMT: file ''/tmp/dumps/assert_20130123201408_1.dmp'', upload yes: ''CrashID=bp-952c1506-23c4-4f5b-b9aa-c14b32130123''

Tele42 avatar Feb 14 '13 21:02 Tele42

I still have the issue with the latest updates. However a temporary workaround is to go to nvidia-settings, and set your left monitor to go to the right. It's a bit annoying because you have to do it everytime back and forth, but it'll do while Valve implements a fix

jpleau avatar Feb 27 '13 23:02 jpleau

As expected, Day of Defeat (Beta) is also affected.

Tele42 avatar Mar 13 '13 23:03 Tele42

A few notes;

  • I have 3 monitors in 3600x1920 (5:3 ratio) and I'd like to have image on all 3 as a single monitor. Think eyefinity.
  • Card is ATI/AMD Radeon 6870.
  • The game, in my case CounterStrike, only uses the left most monitor.
  • The two other monitors are displaying my unity desktop unchanged.
  • It used to work on Windows last time I had tried, which is albeit a long time ago.

maruel avatar May 02 '13 19:05 maruel

While not fixed, Cinnamon 1.8 has the ability to throw fullscreen opengl windows to other screens.

Tele42 avatar Jul 04 '13 20:07 Tele42

Valve - please fix this. The 'Primary Display' Setting in the Nvidia driver is working fine for CS Source and CS:Go.

fred0r avatar Dec 30 '15 22:12 fred0r

After 7 years this annoying bug is still present. There is not any workaround like a launch option in order to force the primary display?

jamofer avatar Mar 15 '20 10:03 jamofer

@mikela-valve Please fix this..! I have multiple monitors and it gets pretty annoying...

sabianroberts avatar Mar 15 '20 13:03 sabianroberts

I never had this issue on Windows when I was on Windows and had a secondary monitor on the left (at least 4+ years; only Windows 7). When I switched to Ubuntu and then Kubuntu, I started having this issues.

I'm currently on Kubuntu and it's fairly easy to move it back to my primary monitor. I right click on the item on my task bar and go to More Actions > Move (which focuses your mouse on the left screen where the game is running) and I simply drag to my primary monitor and it brings it over.

fysiks1 avatar Mar 15 '20 17:03 fysiks1

I only tried Windows key + Arrow for move it without success. Now I tried what you said and it works perfectly :laughing:

Thank you!

jamofer avatar Mar 15 '20 17:03 jamofer

In Linux, the WindowsKey+Arrow is not a pre-configured thing. When I was on Ubuntu, I was able to configure a key combination to move it to the other window. When I switched to Kubuntu, I found the mouse-based move method and haven't gone back to the key combination.

fysiks1 avatar Mar 15 '20 18:03 fysiks1

I know, I use Kubuntu too and I have that key binding but for fullscreen doesn't seems to work.

jamofer avatar Mar 15 '20 19:03 jamofer

I right click on the item on my task bar and go to More Actions > Move (which focuses your mouse on the left screen where the game is running) and I simply drag to my primary monitor and it brings it over.

Finally Fullscreen - Thanks for that Hint !

fred0r avatar Mar 15 '20 22:03 fred0r

My solution for Ubuntu 20.04

Hit Super/Windows key so the Activities overview open up. Then click and hold the game window and move to the correct screen.

Screenshot from 2020-08-19 19-20-11

arthurazs avatar Aug 19 '20 22:08 arthurazs

This might be fixed by using SDL_WINDOWPOS_UNDEFINED for the X and Y coordinates of the window passed into SDL_CreateWindow. Currently the engine is passing 0 for both.

The display chosen when that constant is passed is the display with index 0. Checking the source code shows that at least for Windows and X11 display 0 is the primary display, so this should work.

SamVanheer avatar Aug 23 '20 11:08 SamVanheer

I just came across this issue on OpenSUSE using GNOME. I solved it by using -vulkan in the launch options. It renders on the main monitor now.

Strike-F8 avatar Feb 12 '23 01:02 Strike-F8

This happens to me with any HL1 engine games. Quite annoying and I can't find a satisfying fix in the engine itself Edit: this also happens in Portal 2

ghost avatar Mar 25 '23 09:03 ghost

confirmed still happening with HL1 and portal 2 as of august 29 2023. -vulkan just causes the game to be unlaunchable. how do you mess up a game so bad you cant query xrandr for the primary monitor setting?

mathew2214 avatar Aug 29 '23 23:08 mathew2214

This still happens with the 25th Anniversary Update. This bug report also has reached its 10th Anniversary, congratulations!!!

Valve, you can't say you support linux while you still ignore this bug. This is a game breaker for linux users.

I will switch to Proton to be able to play the game, as usual.

SebiTimeWaster avatar Nov 17 '23 19:11 SebiTimeWaster

If you are in KDE, you go into windowed mode, right-click the icon on taskbar -> more actions -> move, and bring it on screen where you can see the window title bar. I even reduced the resolution during this down a step from my native to have an easier window to manage.

Place the application in the top left of the monitor you want to play on. Right-click title bar -> more actions -> configure special application settings. With this new dialog, click Add Property -> Position. It should set its current position where you placed the window. Change the position settings to Force. Apply. OK. Change game back to native resolution and fullscreen, apply.

Your game should now be fullscreen on your target monitor.

jslay88 avatar Nov 18 '23 19:11 jslay88

Game launches on the left-most display/on the display with the highest resolution available across different ones connected to a PC

Issue transferred from https://github.com/ValveSoftware/halflife/issues/3472. @lsahnicne posted on 2023-11-18T19:38:21:

I'm playing on Linux.

Distribution: Pop!_OS 22.04 LTS

Issue/Bug Description: I have three displays connected to my PC - a 4K TV, a 2K monitor and a FullHD monitor. The 2K monitor is the primary display. When I launch the game, the TV is off. But the game still uses it to launch - I have to use keyboard shortcut to move game window one display to the left to bring it to the primary display. And then I can't use menu properly because it doesn't fit the screen. So on every launch I have to turn on the TV, change the game video settings there to match the resolution of a primary display and only then can I play.

Steps to reproduce:

  1. Connect three display devices to the PC like this: Screenshot from 2023-11-11 09-11-46 Where: 1 - 4K@120 Hz TV connected via HDMI 3 - 2K@144 Hz monitor connected via DisplayPort, primary display 2 - FullHD@60 Hz monitor connected via DisplayPort-DVI adapter
  2. Have monitors number 2 and 3 on, number 1 TV is off.
  3. Launch Half-Life
  4. The game window opens on monitor number 1, which is off, and have to be brought to the vieweing area by pressing super+shift+right arrow key.
  5. Menu can't be navigated properly because cursor poisition doesn't align with the rendered buttons. Screenshot from 2023-11-18 22-30-13

Expected behavior: The game opens on primary display in fullscreen mode using primary display's resolution.


@FridgeRacer commented on 2023-11-18T20:12:39:

https://github.com/ValveSoftware/halflife/issues/7 Same issue reported here, I also experience this on KDE. Does GNOME let you hold Meta + Left Click & Drag to move windows? Try that =)

kisak-valve avatar Nov 18 '23 20:11 kisak-valve

I can confirm that Goldsource games do not respect the primary display as set in KDE Plasma on Wayland.

Using the launch arguments -windowed -noborder -w 1920 -h 1080 (I believe goldsrc respects these), the game starts at the right size but not positioned correctly, requiring meta+drag to move it to the correct display.

olib14 avatar Nov 19 '23 11:11 olib14

I had this issue for years but was always able to move the game to the right screen with xdotool. After the recent update, this is not possible anymore for some reason. I'm no longer able to play half-life :(

fjthrowaway avatar Nov 19 '23 14:11 fjthrowaway

I am having the same issue on Debian 12 stable (GNOME). None of the workarounds listed above worked for me. I have a dual monitor setup. Primary is 4K 27 inches. Secondary is 1080p 24 inches.

meminens avatar Dec 18 '23 17:12 meminens

My face when a 10 year old bug still remains unfixed image

UncleBela avatar Dec 26 '23 09:12 UncleBela

BTW, for KDE users, you can press SUPER (Windows key) + Shift + Left Arrow key to bring the current selected window to the screen on the left. The same can be done to the right monitor, for example SUPER + Shift + Right Arrow key. Not sure if this workaround has been mentioned yet, but this works perfectly on the latest KDE. Not sure about other DEs.

UncleBela avatar Dec 26 '23 09:12 UncleBela

This issue is still happening to me. When will this get fixed?

Syphist avatar Mar 11 '25 00:03 Syphist

always happens when launching Counter-Strike 1.6 & Condition Zero

azur-wolve avatar Mar 12 '25 00:03 azur-wolve

bro how is this still not fixed? just read the primary display from my xrandr settings.

mathew2214 avatar Oct 28 '25 20:10 mathew2214

I've previously pointed out how this can be fixed but i'll be a bit more explicit this time:

The engine is currently doing this:

SDL_CreateWindow(title, 0, 0, 640, 480, flags);

When it should be doing this:

SDL_CreateWindow(title, SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, 640, 480, flags);

(Or use SDL_WINDOWPOS_CENTERED if it needs to be centered on the primary display)

There are 2 places where this needs changing, both in CGame::CreateGameWindow

See the SDL source code for why this picks the primary display: https://github.com/libsdl-org/SDL/blob/cecf4b0d4e771fea01ecbd0594a948ee0f872fb5/include/SDL3/SDL_video.h#L248-L257

Note that this depends on SDL picking the right display as the primary. If SDL is bugged then this won't work. But it should work fine.

SamVanheer avatar Oct 29 '25 16:10 SamVanheer