Commit dc0d0ccb authored by Benoît Minisini's avatar Benoît Minisini
Browse files

Fix desktop detection. The GridView 'Change' event now can be stopped to cancel a cursor move.

[GB.GUI.BASE]
* BUG: Fix KDE desktop detection, and do not crash if no desktop is detected.
* NEW: GridView: The 'Change' event now can be stopped to cancel a cursor move.
parent 8500e51a
Pipeline #361214496 passed with stage
in 26 minutes and 20 seconds
......@@ -20,11 +20,6 @@ Static Private Sub GetDesktop() As String
If $aDesktopType.Count = 0 Then
If Application.Env["KDE_FULL_SESSION"] Then
If Application.Env["KDE_SESSION_VERSION"] = "4" Then
$aDesktopType.Add("KDE4")
Else If Application.Env["KDE_SESSION_VERSION"] = "5" Then
$aDesktopType.Add("KDE5")
Endif
$aDesktopType.Add("KDE")
Else If Application.Env["GNOME_DESKTOP_SESSION_ID"] Then
$aDesktopType.Add("GNOME")
......@@ -46,8 +41,20 @@ Static Private Sub GetDesktop() As String
Endif
$sDesktop = $aDesktopType[0]
If $sDesktop Begins "X-" Then $sDesktop = Mid$($sDesktop, 3)
If $aDesktopType.Count Then
If $aDesktopType[0] = "KDE" Then
If Application.Env["KDE_SESSION_VERSION"] = "4" Then
$aDesktopType.Add("KDE4", 0)
Else If Application.Env["KDE_SESSION_VERSION"] = "5" Then
$aDesktopType.Add("KDE5", 0)
Endif
Endif
$sDesktop = $aDesktopType[0]
If $sDesktop Begins "X-" Then $sDesktop = Mid$($sDesktop, 3)
Endif
Return $sDesktop
......
......@@ -1448,6 +1448,9 @@ End
Public Sub MoveTo(Row As Integer, Column As Integer)
Dim S, L As Integer
Dim iOldRow As Integer
Dim iOldCol As Integer
Dim bCancel As Boolean
If Column < 0 Then Column = $iCol
......@@ -1460,6 +1463,9 @@ Public Sub MoveTo(Row As Integer, Column As Integer)
Return
Endif
iOldRow = $iRow
iOldCol = $iCol
$iRow = Row
$iCol = Column
......@@ -1468,7 +1474,13 @@ Public Sub MoveTo(Row As Integer, Column As Integer)
If $iRow >= 0 And If $iCol >= 0 Then _EnsureVisible($iRow, $iCol)
$hView.Refresh
Raise Change
bCancel = Raise Change
If bCancel Then
$iRow = iOldRow
$iCol = iOldCol
Return
Endif
If $iMode = Select.Single Then
Raise Select
Else If $bMoveSelect Or If $bMoveUnSelect Then
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment