Skip to content

Commit

Permalink
Fixed: GTK critical warning messages
Browse files Browse the repository at this point in the history
  • Loading branch information
XusinboyBekchanov committed Feb 1, 2021
1 parent a3257dd commit b448e6a
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 19 deletions.
30 changes: 16 additions & 14 deletions src/Designer.bas
Expand Up @@ -219,7 +219,7 @@ Namespace My.Sys.Forms
#ifdef __USE_GTK__
FDots(0, i) = gtk_layout_new(NULL, NULL)
'g_object_ref(FDots(i))
gtk_layout_put(gtk_layout(ParentCtrl->layoutwidget), FDots(0, i), 0, 0)
If gtk_is_widget(FDots(0, i)) Then gtk_layout_put(gtk_layout(ParentCtrl->layoutwidget), FDots(0, i), 0, 0)
gtk_widget_set_size_request(FDots(0, i), FDotSize, FDotSize)
#ifdef __USE_GTK3__
g_signal_connect(FDots(0, i), "draw", G_CALLBACK(@Dot_Draw), @This)
Expand Down Expand Up @@ -252,7 +252,7 @@ Namespace My.Sys.Forms
For j As Integer = UBound(FDots) To 0 Step -1
For i As Integer = 7 To 0 Step -1
#ifdef __USE_GTK__
gtk_widget_destroy(FDots(j, i))
If gtk_is_widget(FDots(j, i)) Then gtk_widget_destroy(FDots(j, i))
#else
DestroyWindow(FDots(j, i))
#endif
Expand Down Expand Up @@ -380,14 +380,14 @@ Namespace My.Sys.Forms
g_signal_connect(FDots(j, i), "expose-event", G_CALLBACK(@Dot_ExposeEvent), @This)
#endif
Select Case i
Case 0: gtk_layout_put(gtk_layout(FDialogParent), FDots(j, 0), P.X-6, P.Y-6)
Case 1: gtk_layout_put(gtk_layout(FDialogParent), FDots(j, 1), P.X+iWidth/2-3, P.Y-6)
Case 2: gtk_layout_put(gtk_layout(FDialogParent), FDots(j, 2), P.X+iWidth, P.Y-6)
Case 3: gtk_layout_put(gtk_layout(FDialogParent), FDots(j, 3), P.X+iWidth, P.Y + iHeight/2-3)
Case 4: gtk_layout_put(gtk_layout(FDialogParent), FDots(j, 4), P.X+iWidth, P.Y + iHeight)
Case 5: gtk_layout_put(gtk_layout(FDialogParent), FDots(j, 5), P.X+iWidth/2-3, P.Y + iHeight)
Case 6: gtk_layout_put(gtk_layout(FDialogParent), FDots(j, 6), P.X-6, P.Y + iHeight)
Case 7: gtk_layout_put(gtk_layout(FDialogParent), FDots(j, 7), P.X-6, P.Y + iHeight/2-3)
Case 0: If gtk_is_widget(FDots(j, 0)) Then gtk_layout_put(gtk_layout(FDialogParent), FDots(j, 0), P.X-6, P.Y-6)
Case 1: If gtk_is_widget(FDots(j, 1)) Then gtk_layout_put(gtk_layout(FDialogParent), FDots(j, 1), P.X+iWidth/2-3, P.Y-6)
Case 2: If gtk_is_widget(FDots(j, 2)) Then gtk_layout_put(gtk_layout(FDialogParent), FDots(j, 2), P.X+iWidth, P.Y-6)
Case 3: If gtk_is_widget(FDots(j, 3)) Then gtk_layout_put(gtk_layout(FDialogParent), FDots(j, 3), P.X+iWidth, P.Y + iHeight/2-3)
Case 4: If gtk_is_widget(FDots(j, 4)) Then gtk_layout_put(gtk_layout(FDialogParent), FDots(j, 4), P.X+iWidth, P.Y + iHeight)
Case 5: If gtk_is_widget(FDots(j, 5)) Then gtk_layout_put(gtk_layout(FDialogParent), FDots(j, 5), P.X+iWidth/2-3, P.Y + iHeight)
Case 6: If gtk_is_widget(FDots(j, 6)) Then gtk_layout_put(gtk_layout(FDialogParent), FDots(j, 6), P.X-6, P.Y + iHeight)
Case 7: If gtk_is_widget(FDots(j, 7)) Then gtk_layout_put(gtk_layout(FDialogParent), FDots(j, 7), P.X-6, P.Y + iHeight/2-3)
End Select
gtk_widget_realize(FDots(j, i))
pdisplay = gtk_widget_get_display(FDots(j, i))
Expand Down Expand Up @@ -1296,10 +1296,12 @@ Namespace My.Sys.Forms
' WritePropertyFunc(Cpnt, "Top", @y)
' WritePropertyFunc(Cpnt, "Width", @FWidth)
' WritePropertyFunc(Cpnt, "Height", @FHeight)
If AParent = 0 OrElse Result = 0 Then
gtk_layout_put(GTK_LAYOUT(ReadPropertyFunc(DesignControl, "layoutwidget")), FSelControl, x, y)
Else
gtk_layout_put(GTK_LAYOUT(Result), FSelControl, x, y)
If gtk_is_widget(FSelControl) Then
If AParent = 0 OrElse Result = 0 Then
gtk_layout_put(GTK_LAYOUT(ReadPropertyFunc(DesignControl, "layoutwidget")), FSelControl, x, y)
Else
gtk_layout_put(GTK_LAYOUT(Result), FSelControl, x, y)
End If
End If
gtk_widget_show_all(FSelControl)
#else
Expand Down
4 changes: 2 additions & 2 deletions src/EditControl.bas
Expand Up @@ -3892,7 +3892,7 @@ Namespace My.Sys.Forms
gtk_widget_set_can_focus(scrollbarv, False)
g_signal_connect(adjustmentv, "value_changed", G_CALLBACK(@EditControl_ScrollValueChanged), @This)
'gtk_widget_set_parent(scrollbarv, widget)
gtk_layout_put(gtk_layout(widget), scrollbarv, 0, 0)
If gtk_is_widget(scrollbarv) Then gtk_layout_put(gtk_layout(widget), scrollbarv, 0, 0)
gtk_widget_show(scrollbarv)
adjustmenth = GTK_ADJUSTMENT(gtk_adjustment_new(0.0, 0.0, 101.0, 1.0, 20.0, 20.0))
#ifdef __USE_GTK3__
Expand All @@ -3903,7 +3903,7 @@ Namespace My.Sys.Forms
gtk_widget_set_can_focus(scrollbarh, False)
g_signal_connect(adjustmenth, "value_changed", G_CALLBACK(@EditControl_ScrollValueChanged), @This)
'gtk_widget_set_parent(scrollbarh, widget)
gtk_layout_put(gtk_layout(widget), scrollbarh, 0, 0)
If gtk_is_widget(scrollbarh) Then gtk_layout_put(gtk_layout(widget), scrollbarh, 0, 0)
gtk_widget_show(scrollbarh)
Dim As GtkRequisition vminimum, hminimum, vrequisition, hrequisition
#ifdef __USE_GTK3__
Expand Down
8 changes: 5 additions & 3 deletions src/Main.bas
Expand Up @@ -5580,9 +5580,11 @@ Sub OnProgramQuit() Destructor
WDeallocate MFFDll
WDeallocate gSearchSave
Dim As ToolType Ptr tt
For i As Integer = 0 To Tools.Count - 1
Delete_(Cast(ToolType Ptr, Tools.Items[i]))
Next
#ifndef __USE_GTK__
For i As Integer = 0 To Tools.Count - 1
Delete_(Cast(ToolType Ptr, Tools.Item(i)))
Next
#endif
Dim As TypeElement Ptr te, te1
For i As Integer = pGlobalNamespaces->Count - 1 To 0 Step -1
te = pGlobalNamespaces->Object(i)
Expand Down

0 comments on commit b448e6a

Please sign in to comment.