google-code-export / gambas

Automatically exported from code.google.com/p/gambas
1 stars 0 forks source link

Wrong behaviour in desktop.w and screen.w on dual head? #245

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I've a dual head configuration, desktop is spanned over two screen placed in 
horizontal.
If i'm not wrong, in past gambas releases, either desktop.w or screen.w 
reported the total size of the available space.
Now i just get 1280 (but my total desktop width is 1280*2)

Version: 3.1.1
Operating system: Linux
Distribution: Archlinux
Architecture: x86
GUI component: QT4
Desktop used: KDE

Original issue reported on code.google.com by Kokok...@gmail.com on 24 Apr 2012 at 3:56

GoogleCodeExporter commented 9 years ago
Do you know if there is a way for a guy that has only one screen to simulate a 
dual-head configuration?

Original comment by benoit.m...@gmail.com on 25 Apr 2012 at 9:29

GoogleCodeExporter commented 9 years ago
I think now you should use the Screen and Screens classes. Screens.Count gives 
you the number of screens, and Screens[] returns a Screen object that allows 
you to get its geometry.

Logically, there is no global available space, as two screens can have 
different sizes, and can be layout in many different ways.

Original comment by benoit.m...@gmail.com on 25 Apr 2012 at 9:52

GoogleCodeExporter commented 9 years ago
Oh wow, i totally missed the screens class, i think i can manage to get the 
same info as before with it, but i'm pretty sure the generic screen.w worked in 
the past.

If you want, tomorrow i can test an older gambas version (maybe 3.0), that (if 
i remember well) worked that way.

Thanks.

Original comment by Kokok...@gmail.com on 25 Apr 2012 at 10:03

GoogleCodeExporter commented 9 years ago
I ended up in using the following code, it seems to mimic the previous 
desktop.h and desktop.w behaviour.
However, it could fail in some uncommon layout setup, where the screens are 
misaligned.

Public Function DektopWTotal() As Integer
  Dim S As Screen
  Dim VeryLeft As Integer = 99999
  Dim VeryRight As Integer = -1
  For Each s In Screens
    If s.AvailableX < VeryLeft Then VeryLeft = s.AvailableX
    If s.AvailableX + s.AvailableWidth > VeryRight Then VeryRight = s.AvailableX + s.AvailableWidth
  Next
  Return VeryRight - Veryleft
End

Public Function DektopHTotal() As Integer
  Dim S As Screen
  Dim VeryTop As Integer = 99999
  Dim VeryBottom As Integer = -1
  For Each s In Screens
    If s.AvailableY < VeryTop Then VeryTop = s.Availabley
    If s.AvailableY + s.AvailableHeight > VeryBottom Then VeryBottom = s.AvailableY + s.AvailableHeight
  Next
  Return VeryBottom - VeryTop
End

Original comment by Kokok...@gmail.com on 26 Apr 2012 at 11:46

GoogleCodeExporter commented 9 years ago
You should use the Rect class and its Union() method. It's easier with it.

Original comment by benoit.m...@gmail.com on 27 Apr 2012 at 1:33