SeptemberHX/dde-top-panel

双显卡配置时,会出现两条panel

Opened this issue · 2 comments

dde-top-panel 版本是0.5.5
操作系统 deepin v20.1 社区版(1010)
问题重现:
在xorg.conf中如下配置:
`Section "ServerLayout"
Identifier "X.org Configured"
Screen 0 "screen_intel"
Screen 1 "screen_nvidia"
Inactive "card_intel"
InputDevice "Mouse0" "CorePointer"
InputDevice "Keyboard0" "CoreKeyboard"
EndSection

Section "Files"
ModulePath "/usr/lib/xorg/modules"
FontPath "/usr/share/fonts/X11/misc"
FontPath "/usr/share/fonts/X11/cyrillic"
FontPath "/usr/share/fonts/X11/100dpi/:unscaled"
FontPath "/usr/share/fonts/X11/75dpi/:unscaled"
FontPath "/usr/share/fonts/X11/Type1"
FontPath "/usr/share/fonts/X11/100dpi"
FontPath "/usr/share/fonts/X11/75dpi"
FontPath "built-ins"
EndSection

Section "Module"
Load "glx"
EndSection

Section "InputDevice"
Identifier "Keyboard0"
Driver "kbd"
EndSection

Section "InputDevice"
Identifier "Mouse0"
Driver "mouse"
Option "Protocol" "auto"
Option "Device" "/dev/input/mice"
Option "ZAxisMapping" "4 5 6 7"
EndSection

Section "Device"
Identifier "card_nvidia"
Driver "nvidia"
BusID "PCI:1:0:0"
EndSection

Section "Device"
Identifier "card_intel"
Driver "modesetting"
BusID "PCI:0:2:0"
EndSection

Section "Screen"
Identifier "screen_nvidia"
Device "card_nvidia"
EndSection

Section "Screen"
Identifier "screen_intel"
Device "card_intel"
EndSection
`
将会出现两条panel, 但是我却只有一个显示器, 就是当前屏幕,
如果我注释掉ServerLayout中的screen_nvidia这一行, 则只会出现一条panel.

这个我目前没有找到合适的解决方案。

我是用 Qt 的 screen 来判断有多少个屏幕的,Qt貌似没有很好的区分 xorg.conf 配置,导致 Qt 函数就上报了多个 screen。

后面我试试看这种情况下,是不是能够通过判断屏幕分辨率和位置等信息来判断是否是一个屏幕。

@SeptemberHX 我的想法很简单暴力,你自己创建一个ScreenCount()函数. 里面直接读取xorg.conf重的inactive来作为输出, 部分代码需要获取qtdesktop->screen中其他的返回值时. 再用qt原生的方法.