简体   繁体   English

Linux强制应用程序在特定显示器上全屏显示

[英]Linux force application to full screen on a specific display

For work, I am developing a very specialized piece of software has needs to run two full screen applications, one on each monitor. 对于工作,我正在开发一款非常专业的软件,需要运行两个全屏应用程序,每个监视器上运行一个。 For the sake of simplicity, I am currently using LUbuntu 64 bit, with an AMD Radeon HD graphics card (can't recall the exact version currrently, but it's fairly new). 为了简单起见,我目前将LUbuntu 64位与AMD Radeon HD图形卡一起使用(无法即时回想确切的版本,但这是相当新的)。

I'd like to stick with SDL2 if possible, but if I need to do some hacking with that or move to a different library, I'm fairly comfortable with that. 如果可能的话,我想坚持使用SDL2,但是如果我需要对此进行一些修改或移至其他库,则我对此非常满意。

So, my question is, is it possible to have two fullscreen applications running on different monitors in Linux (and if so, what sort of setup steps do I need to take)? 因此,我的问题是,是否可以在Linux的不同显示器上运行两个全屏应用程序(如果是,我需要采取哪种设置步骤)? What would be my best bet for enumerating the displays to get their top-left x/y position so I can tell SDL to move my window onto that monitor to fullscreen it? 枚举显示以获得左上角x / y位置的最佳选择是什么,让我告诉SDL将窗口移到该显示器上以全屏显示?

Note: I did not post this to askubuntu because I'm not sure this question strictly revolves around the Ubuntu platform. 注意:我没有将此问题发布到askubuntu,因为我不确定这个问题是否严格围绕Ubuntu平台展开。

Update: 更新:

Here is the output from xrandr -q : 这是xrandr -q的输出:

Screen 0: minimum 320 x 200, current 3200 x 1080, maximum 3200 x 3200
DFP1 disconnected (normal left inverted right x axis y axis)
DFP2 disconnected (normal left inverted right x axis y axis)
DFP3 disconnected (normal left inverted right x axis y axis)
DFP4 disconnected (normal left inverted right x axis y axis)
DFP5 disconnected (normal left inverted right x axis y axis)
DFP6 disconnected (normal left inverted right x axis y axis)
DFP7 disconnected (normal left inverted right x axis y axis)
DFP8 disconnected (normal left inverted right x axis y axis)
DFP9 connected 1920x1080+1280+0 (normal left inverted right x axis y axis) 533mm x 312mm
   1280x1024      50.0 +   75.0     60.0     30.0     24.0  
   1920x1080      60.0 +   50.0*    59.9     30.0     25.0     30.0     24.0     30.0     30.0     24.0  
   1776x1000      50.0     59.9     25.0     24.0     30.0     30.0  
   1680x1050      50.0     60.0     30.0     24.0  
   1400x1050      50.0     60.0     30.0     24.0  
   1600x900       50.0     60.0     30.0     24.0  
   1440x900       50.0     59.9     30.0     24.0  
   1280x960       50.0     60.0     30.0     24.0  
   1280x800       50.0     59.8     30.0     24.0  
   1152x864       50.0     59.9     75.0     30.0     24.0  
   1280x768       50.0     59.8     30.0     24.0  
   1280x720       60.0     50.0     59.9     30.0     24.0  
   1024x768       50.0     75.0     70.1     30.0     24.0     60.0  
   1152x648       50.0     59.9  
   800x600        50.0     30.0     24.0     72.2     75.0     60.3     56.2  
   720x576        59.9     30.0     24.0     50.0  
   720x480        50.0     30.0     24.0     60.0     59.9  
   640x480        50.0     30.0     24.0     75.0     72.8     67.0     60.0     59.9  
DFP10 connected 1280x1024+0+0 (normal left inverted right x axis y axis) 376mm x 301mm
   1280x1024      60.0*+   76.0     75.0     72.0  
   1280x960       76.0     75.0     72.0     60.0  
   1152x864       75.0     60.0  
   1280x768       76.0     75.0     72.0     60.0  
   1280x720       76.0     75.0     72.0     60.0  
   1024x768       75.0     70.1     60.0  
   800x600        72.2     75.0     60.3  
   640x480        75.0     72.8     67.0     59.9  
   640x350        60.0     70.1  
CRT1 disconnected (normal left inverted right x axis y axis)

I have tried searching some forums for a better explanation of what to do with this information, it seems I should do something like: 我尝试搜索一些论坛以更好地解释如何处理此信息,看来我应该这样做:

xrandr --output DFP9 --auto --output DFP10 --auto

When I do that, I still have only one display (":0"). 当我这样做时,我仍然只有一个显示器(“:0”)。

What's your setup? 你的设置是什么? Do you actually have 2 separate X displays, or are you using Xinerama to combine the two? 您实际上有2个单独的X显示器吗,还是正在使用Xinerama来将两者结合?

If you're using 2 displays, they should have their own -display or DISPLAY env variable. 如果您使用的是2个显示器,则它们应具有自己的-display或DISPLAY env变量。 You can use that to execute a new app. 您可以使用它来执行新应用。

$ echo $DISPLAY
:0.0
$ xterm -display :0.0

Open a shell in the other display to get your other display env variable. 在另一个显示中打开一个外壳,以获取另一个显示环境变量。

There's also -geometry, in the format of [Wth,Ht+X+Y] 还有-geometry,格式为[Wth,Ht + X + Y]

$ xterm -geometry 132x80+500+0

When Xinerama is enabled, your other display is usually a +X+Y offset. 启用Xinerama后,其他显示通常为+ X + Y偏移。

Of course, this does require the app to process command line arguments. 当然,这确实需要应用程序处理命令行参数。 It then passes those off to X when initialising the window. 然后在初始化窗口时将其传递给X。 For xterm, width and height are units of text characters, where X/Y are screen pixels. 对于xterm,宽度和高度是文本字符的单位,其中X / Y是屏幕像素。

If you have control over the X configuration, and if other applications will not be shown on the production workstations, you might want to disable the "Xinerama" feature and set up two screens. 如果您可以控制X的配置,并且生产工作站上不会显示其他应用程序,则可能要禁用“ Xinerama”功能并设置两个屏幕。 Then you could just have your apps connect to :0.0 and :0.1 and get the screen size from each. 然后,您可以将您的应用程序分别连接到:0.0:0.1并从每个屏幕获取屏幕尺寸。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 即使当前正在运行全屏应用程序,如何显示通知? - How to display a notification even when a full-screen application is currently running? 强制 Qt-Window 到特定屏幕 - Force Qt-Window to specific screen 全屏应用运行时获取屏幕的 bitmap - Getting a bitmap of the screen when a full screen application is running 如何在 linux 中使用 ncurses 创建全屏 window? - How to create a full screen window using ncurses in linux? 在DirectDraw全屏应用程序顶部显示另一个应用程序 - Displaying another application on top of a directdraw full screen application 如何强制我的应用程序只打开一个exe? qt,linux - How to force my application to open one exe only? qt, linux 在另一个全屏应用程序之上显示图形; 硬件覆盖? - Displaying graphics on top of another full screen application; hardware overlay? 使用ncurses c ++(Linux)将光标移动到屏幕上的特定点 - Move cursor to specific point on screen using ncurses c++ (Linux) 创建一个即使在全屏模式下仍位于顶部的新窗口(在Linux上为Qt) - Creating a new window that stays on top even when in full screen mode (Qt on Linux) linux 中的 force kill 命令 (kill -9) 是否会在 C++ 应用程序中使用 new 运算符清理动态分配的内存? - Does the force kill command (kill -9) in linux cleanup the dynamically allocated memory with new operator in C++ application?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM