← Back to team overview

kicad-developers team mailing list archive

Re: pcbnew startup from clean

 

Hi Alexis,

Sorry about that - it's been on my list for a while. I misunderstood
how the GAL inits without config. Hopefully this will work. Patch
attached: the upshot is that legacy should never even be tried in a
blank-config startup now, even if the platform supports it (as this
will be the behaviour in future anyway, when legacy is gone).

GAL wizards please comment if I have got it wrong again!

Cheers,

John

On Fri, Jan 4, 2019 at 3:43 AM Alex Lockwood <alexlockwood@xxxxxxxxxxxx> wrote:
>
> Yup. Okay, thanks - I need to pay more attention the bug tracker before
> whinging on the list.
>
> On Thu, Jan 03, 2019 at 10:13:25PM -0500, Seth Hillbrand wrote:
> > Am 2019-01-03 21:27, schrieb Alex Lockwood:
> > > Hey, has anyone started pcbnew with nothing in ~/.config/kicad recently?
> > > I just did, and loaded a project, and this is what I got:
> > >
> > > https://misc.c4757p.com/wtfpcbnew.png
> > >
> > > I had to manually set the canvas from inside pcbnew. Otherwise the
> > > rendering was completely screwed up, everything piled on top of
> > > everything in a way that I couldn't even really tell what was going on.
> > > Uninitialized setting somewhere, maybe? It's entirely possible this is
> > > specific to this machine, I also haven't started from clean in a long
> > > time. Just curious whether anyone's testing those code paths.
> > >
> > > I also had to apply this patch to keep pcbnew from segfaulting when I
> > > open menus. Suppose I should probably open a proper bug for this one,
> > > but I'm a bit confused by it (it seems like this should have been broken
> > > for a long time for everyone, but it...isn't?)
> > >
> > > diff --git a/pcbnew/pcb_base_frame.cpp b/pcbnew/pcb_base_frame.cpp
> > > index 36ffbd45f..c663f8a60 100644
> > > --- a/pcbnew/pcb_base_frame.cpp
> > > +++ b/pcbnew/pcb_base_frame.cpp
> > > @@ -1189,7 +1189,7 @@ void PCB_BASE_FRAME::OnUpdateSwitchCanvas(
> > > wxUpdateUIEvent& aEvent )
> > >      for( auto ii: menuList )
> > >      {
> > >          wxMenuItem* item = menuBar->FindItem( ii.menuId );
> > > -        if( ii.galType == canvasType )
> > > +        if( item && ii.galType == canvasType )
> > >              item->Check( true );
> > >      }
> > >  }
> >
> > I think that this is the same as [1] that John is working on.  Are you using
> > GTK3?
> >
> > [1]https://bugs.launchpad.net/kicad/+bug/1809997
>
> _______________________________________________
> Mailing list: https://launchpad.net/~kicad-developers
> Post to     : kicad-developers@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~kicad-developers
> More help   : https://help.launchpad.net/ListHelp
From c9a57978e262044f32c6225ceab1052945e0dc76 Mon Sep 17 00:00:00 2001
From: John Beard <john.j.beard@xxxxxxxxx>
Date: Fri, 4 Jan 2019 14:00:05 +0000
Subject: [PATCH] On start without config, start pcbnew in Cairo GAL

Currently, GAL is initialised to NONE (i.e. off). This causes
issues when Legacy canvas is broken (i.e. GTK3).

This changes the default to GAL Cairo, both in PCB_EDIT_FRAME
init, and in the config load.

Now, when the user starts with no config, they are prompted for
a choice: OpenGL or Cairo, and one of them will be set up, with
Cairo as fall back.

Users on platforms that still support legacy can go to it as normal
from the menu, but it will not be the default in any circumstance.

Fixes: lp:1809997
* https://bugs.launchpad.net/kicad/+bug/1809997
---
 common/legacy_gal/eda_draw_frame.cpp | 3 ++-
 common/legacy_wx/eda_draw_frame.cpp  | 3 ++-
 pcbnew/pcb_edit_frame.cpp            | 7 ++++---
 3 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/common/legacy_gal/eda_draw_frame.cpp b/common/legacy_gal/eda_draw_frame.cpp
index 5adcc5aac..7139ddf7a 100644
--- a/common/legacy_gal/eda_draw_frame.cpp
+++ b/common/legacy_gal/eda_draw_frame.cpp
@@ -1085,10 +1085,11 @@ EDA_DRAW_PANEL_GAL::GAL_TYPE EDA_DRAW_FRAME::LoadCanvasTypeSetting()
     }
 
     // Coerce the value into a GAL type when Legacy is not available
+    // Default to Cairo, and on the first, user will be prompted for OpenGL
     if( canvasType == EDA_DRAW_PANEL_GAL::GAL_TYPE_NONE
             && !ADVANCED_CFG::GetCfg().AllowLegacyCanvas() )
     {
-        canvasType = EDA_DRAW_PANEL_GAL::GAL_TYPE_OPENGL;
+        canvasType = EDA_DRAW_PANEL_GAL::GAL_TYPE_CAIRO;
     }
 
     return canvasType;
diff --git a/common/legacy_wx/eda_draw_frame.cpp b/common/legacy_wx/eda_draw_frame.cpp
index 9cc319d95..6dd6ee840 100644
--- a/common/legacy_wx/eda_draw_frame.cpp
+++ b/common/legacy_wx/eda_draw_frame.cpp
@@ -1331,10 +1331,11 @@ EDA_DRAW_PANEL_GAL::GAL_TYPE EDA_DRAW_FRAME::LoadCanvasTypeSetting()
     }
 
     // Coerce the value into a GAL type when Legacy is not available
+    // Default to Cairo, and on the first, user will be prompted for OpenGL
     if( canvasType == EDA_DRAW_PANEL_GAL::GAL_TYPE_NONE
             && !ADVANCED_CFG::GetCfg().AllowLegacyCanvas() )
     {
-        canvasType = EDA_DRAW_PANEL_GAL::GAL_TYPE_OPENGL;
+        canvasType = EDA_DRAW_PANEL_GAL::GAL_TYPE_CAIRO;
     }
 
     return canvasType;
diff --git a/pcbnew/pcb_edit_frame.cpp b/pcbnew/pcb_edit_frame.cpp
index ae0bf9e48..05295e144 100644
--- a/pcbnew/pcb_edit_frame.cpp
+++ b/pcbnew/pcb_edit_frame.cpp
@@ -317,7 +317,7 @@ PCB_EDIT_FRAME::PCB_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
     EDA_DRAW_PANEL_GAL* galCanvas = new PCB_DRAW_PANEL_GAL( this, -1, wxPoint( 0, 0 ),
                                                 m_FrameSize,
                                                 GetGalDisplayOptions(),
-                                                EDA_DRAW_PANEL_GAL::GAL_TYPE_NONE );
+                                                EDA_DRAW_PANEL_GAL::GAL_TYPE_CAIRO );
 
     SetGalCanvas( galCanvas );
 
@@ -425,9 +425,10 @@ PCB_EDIT_FRAME::PCB_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
                     GetEventHandler()->ProcessEvent( cairoEvt );
                 }
             }
-            else if( canvasType == EDA_DRAW_PANEL_GAL::GAL_TYPE_NONE )
+            else
             {
-                // If they were on legacy, switch them to Cairo
+                // If they were on legacy, or they've been coerced into GAL
+                // due to unavailable legacy (GTK3), switch to Cairo
                 wxCommandEvent evt( wxEVT_MENU, ID_MENU_CANVAS_CAIRO );
                 GetEventHandler()->ProcessEvent( evt );
             }
-- 
2.20.1


Follow ups

References