Skip to content

Commit e4560f4

Browse files
committed
Linux: Remove modGTK3 | NormalizeControlSizes
1 parent 7685bc3 commit e4560f4

File tree

7 files changed

+25
-144
lines changed

7 files changed

+25
-144
lines changed

App.rbbas

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@ Inherits Application
1818

1919
#tag Event
2020
Sub Open()
21-
Controls.GTK3_GlobalStyleCSS()
22-
2321
call Prefs.Open
2422
SSLStartupCheck
2523
End Sub

Components/Controls/BetterComboBox.xojo_code

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,13 @@ Protected Class BetterComboBox
33
Inherits ComboBox
44
#tag Event
55
Sub Open()
6-
#if TargetLinux and (XojoVersion >= 2017.02) then
7-
me.InitControl_GTK3()
8-
#endif
9-
106
#If TargetLinux
11-
Controls.InitControl_Height(me) = 26
12-
#endif
7+
Controls.InitControl_Height(Me) = 26
8+
#EndIf
139

1410
#If TargetWindows
15-
Controls.InitControl_Height(me) = 22
16-
#endif
11+
Controls.InitControl_Height(Me) = 22
12+
#EndIf
1713

1814
Open
1915
End Sub

Components/Controls/BetterPopupMenu.xojo_code

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,13 @@ Protected Class BetterPopupMenu
33
Inherits PopupMenu
44
#tag Event
55
Sub Open()
6-
#if TargetLinux and (XojoVersion >= 2017.02) then
7-
me.InitControl_GTK3()
8-
#endif
9-
106
#If TargetLinux
11-
Controls.InitControl_Height(me) = 26
12-
#endif
7+
Controls.InitControl_Height(Me) = 26
8+
#EndIf
139

1410
#If TargetWindows
15-
Controls.InitControl_Height(me) = 22
16-
#endif
11+
Controls.InitControl_Height(Me) = 22
12+
#EndIf
1713

1814
Open
1915
End Sub

Components/Controls/BetterPushButton.xojo_code

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,13 @@ Protected Class BetterPushButton
33
Inherits PushButton
44
#tag Event
55
Sub Open()
6-
#if TargetLinux and (XojoVersion >= 2017.02) then
7-
me.InitControl_GTK3()
8-
#endif
9-
106
#If TargetLinux
11-
Controls.InitControl_Height(me) = 26
12-
#endif
7+
Controls.InitControl_Height(Me) = 26
8+
#EndIf
139

1410
#If TargetWindows
15-
Controls.InitControl_Height(me) = 22
16-
#endif
11+
Controls.InitControl_Height(Me) = 22
12+
#EndIf
1713

1814
Open
1915
End Sub

Components/Controls/BetterTextField.xojo_code

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,13 @@ Protected Class BetterTextField
33
Inherits TextField
44
#tag Event
55
Sub Open()
6-
#if TargetLinux and (XojoVersion >= 2017.02) then
7-
me.InitControl_GTK3()
8-
#endif
9-
106
#If TargetLinux
11-
Controls.InitControl_Height(me) = 26
12-
#endif
7+
Controls.InitControl_Height(Me) = 26
8+
#EndIf
139

1410
#If TargetWindows
15-
Controls.InitControl_Height(me) = 22
16-
#endif
11+
Controls.InitControl_Height(Me) = 22
12+
#EndIf
1713

1814
Open
1915
End Sub
@@ -26,6 +22,14 @@ Inherits TextField
2622

2723

2824
#tag ViewBehavior
25+
#tag ViewProperty
26+
Name="Text"
27+
Visible=true
28+
Group="Initial State"
29+
InitialValue=""
30+
Type="String"
31+
EditorType="MultiLineEditor"
32+
#tag EndViewProperty
2933
#tag ViewProperty
3034
Name="AllowAutoDeactivate"
3135
Visible=true
@@ -105,14 +109,6 @@ Inherits TextField
105109
Type="String"
106110
EditorType="MultiLineEditor"
107111
#tag EndViewProperty
108-
#tag ViewProperty
109-
Name="Value"
110-
Visible=true
111-
Group="Initial State"
112-
InitialValue=""
113-
Type="String"
114-
EditorType="MultiLineEditor"
115-
#tag EndViewProperty
116112
#tag ViewProperty
117113
Name="AllowTabs"
118114
Visible=true

Components/Modules/Controls.xojo_code

Lines changed: 0 additions & 102 deletions
Original file line numberDiff line numberDiff line change
@@ -1,107 +1,5 @@
11
#tag Module
22
Protected Module Controls
3-
#tag Method, Flags = &h1
4-
Protected Sub GTK3_GlobalStyleCSS()
5-
//GTK3
6-
#If TargetLinux and (XojoVersion >= 2017.02) Then
7-
Dim sLinuxOSVersion As String = "undefined"
8-
9-
Dim shlHost As New Shell
10-
shlHost.Execute "lsb_release -d" 'Description: Ubuntu 16.04.3 LTS
11-
Dim sResult As String
12-
if (shlHost.ErrorCode = 0) then sResult = Trim(shlHost.Result)
13-
14-
'if we get the expected result
15-
if (Left(sResult, 12) = "Description:") then
16-
sResult = ReplaceLineEndings(sResult, " ")
17-
sLinuxOSVersion = Trim(Mid(sResult, 13))
18-
end if
19-
20-
21-
Dim sStylesCSS() As String
22-
23-
sStylesCSS.Append("entry, .entry { min-height:10px; min-width:18px; }")
24-
sStylesCSS.Append("entry, .entry { padding:1px; padding-left: 5px; padding-right: 5px; margin:0px; }")
25-
if (InStr(sLinuxOSVersion, "Ubuntu 16.04") > 0) then
26-
sStylesCSS.Append("entry, .entry { padding:4px; }")
27-
end if
28-
sStylesCSS.Append("button, .button { min-height:16px; min-width:18px; }")
29-
sStylesCSS.Append("button, .button { padding:0px; padding-left: 4px; padding-right: 4px; margin:0px; }")
30-
sStylesCSS.Append("messagedialog .dialog-action-area button { padding: 5px; }")
31-
sStylesCSS.Append("GtkMessageDialog * { padding: 5px; margin: 5px; }")
32-
sStylesCSS.Append("GtkMessageDialog GtkButton GtkLabel{ padding: 4px; padding-top: 2px; padding-bottom: 4px; margin: 0px; }")
33-
'sStylesCSS.Append("scrollbar.horizontal trough slider { min-height:8px; }")
34-
'sStylesCSS.Append("scrollbar.vertical trough slider { min-width:8px; }")
35-
sStylesCSS.Append("progressbar trough { min-width:1px; }")
36-
37-
'Ubuntu 14 has a parsing error when assigning "min-width/height"
38-
'so let's go through the Styles one-by-one, and just assign those that work in the client's distribution
39-
for i As Integer = 0 to UBound(sStylesCSS)
40-
GTK3_GlobalStyleCSS = sStylesCSS(i)
41-
next
42-
#EndIf
43-
End Sub
44-
#tag EndMethod
45-
46-
#tag Method, Flags = &h21
47-
Private Sub GTK3_GlobalStyleCSS(Assigns psCSSData As String)
48-
//GTK3
49-
#If TargetLinux and (XojoVersion >= 2017.02) Then
50-
If (Trim(psCSSData) = "") Then Return
51-
52-
Try
53-
Declare Function gdk_screen_get_default Lib "libgdk-3" () As Ptr
54-
Declare Function gtk_css_provider_new Lib "libgtk-3" () As Ptr
55-
Declare Function gtk_css_provider_load_from_data Lib "libgtk-3" (provider As Ptr, data As CString, dataLen As Integer, error As Ptr) As Boolean
56-
Declare Sub gtk_style_context_add_provider_for_screen Lib "libgtk-3" (Screen As Ptr, provider As Ptr, priority As UInt32)
57-
Declare Sub g_object_unref Lib "libgobject-2.0" (obj As Ptr)
58-
59-
Const GTK_STYLE_PROVIDER_PRIORITY_APPLICATION = 600
60-
61-
Dim Screen As Ptr = gdk_screen_get_default
62-
Dim provider As Ptr = gtk_css_provider_new
63-
If (provider = Nil) Then Return
64-
65-
try
66-
If gtk_css_provider_load_from_data(provider, psCSSData, psCSSData.Len, Nil) Then
67-
gtk_style_context_add_provider_for_screen(Screen, provider, GTK_STYLE_PROVIDER_PRIORITY_APPLICATION)
68-
End If
69-
70-
Catch err As RuntimeException
71-
'ignore
72-
Finally
73-
g_object_unref(provider)
74-
End Try
75-
76-
Catch err As RuntimeException
77-
'ignore
78-
End Try
79-
80-
#EndIf
81-
End Sub
82-
#tag EndMethod
83-
84-
#tag Method, Flags = &h0
85-
Sub InitControl_GTK3(Extends poControl As Control)
86-
//GTK3
87-
#If TargetLinux And (XojoVersion >= 2017.02) Then
88-
Declare Sub g_object_set Lib "libgtk-3" (obj As Ptr, name As CString, value As Int32, term As ptr=Nil)
89-
Declare Function gtk_bin_get_child Lib "libgtk-3" (obj As ptr) As Ptr
90-
91-
If (poControl IsA TextField) Then
92-
g_object_set(Ptr(TextField(poControl).Handle), "width-chars", 0)
93-
End If
94-
95-
If (poControl IsA ComboBox) Then
96-
Dim t As Ptr = gtk_bin_get_child(Ptr(ComboBox(poControl).Handle))
97-
g_object_set(t, "width-chars", 0)
98-
End If
99-
#EndIf
100-
101-
102-
End Sub
103-
#tag EndMethod
104-
1053
#tag Method, Flags = &h1
1064
Protected Sub InitControl_Height(poControl As RectControl, Assigns piHeight As Integer)
1075
if (poControl.Height < piHeight) then

CubeSQLAdmin.rbvcp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ IsWebProject=False
110110
LinuxBuildArchitecture=1
111111
MacBuildArchitecture=4
112112
WindowsBuildArchitecture=1
113+
LinuxNormalizeControlSizes=True
113114
OptimizationLevel=6
114115
WindowsVersions={35138b9a-5d96-4fbd-8e2d-a2440225f93a}|{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}|{1f676c76-80e1-4239-95bb-83d0f6d0da78}|{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}
115116
WindowsRunAs=0

0 commit comments

Comments
 (0)