Kirix Support Forums

Running on Linux

Please post any wxWebConnect patches or modifications you've created here. Thanks!

Running on Linux

Postby ngpaton on Wed Aug 19, 2009 5:09 am

Hi,

To get the testapp to run on linux you will need to download xulrunner 1.8.1.3 for linux from http://releases.mozilla.org/pub/mozilla.org/xulrunner/releases/1.8.1.3/contrib/linux-i686/xulrunner-1.8.1.3.en-US.linux-i686-20080128.tar.gz. Or you can try using the version you have installed on linux already, I happened to have 1.9.0.13 installed and it seemed to run okay.

Unless you download xulrunner and extract it all into webconnect/xr you will need to modify the testapp code slightly.

In MyApp::OnInit()

Code: Select all
#if defined (_WIN32)
        // the following call will look for a directory named "xr"
        xulrunner_path = FindXulRunner(wxT("xr"));
        if (xulrunner_path.IsEmpty())
        {
            wxMessageBox(wxT("Could not find xulrunner directory"));
            return false;
        }
#elif defined (__linux__)
        xulrunner_path = wxT("/usr/lib/xulrunner");
//        xulrunner_path = wxT("/usr/lib/xulrunner-1.9.0.13");
#elif
# error TBD find xulrunner dir for this platform
#endif   

        // Locate some common paths and initialize the control with
        // the plugin paths; add these common plugin directories to
        // MOZ_PLUGIN_PATH
#if defined (_WIN32)
        wxString program_files_dir;
        ::wxGetEnv(wxT("ProgramFiles"), &program_files_dir);
        if (program_files_dir.Length() == 0 || program_files_dir.Last() != '\\')
            program_files_dir += wxT("\\");

        wxString dir = program_files_dir;
        dir += wxT("Mozilla Firefox\\plugins");
        wxWebControl::AddPluginPath(dir);
#elif defined (__linux__)
        //wxWebControl::AddPluginPath(wxT("/usr/lib/xulrunner-addons/plugins"));
        wxWebControl::AddPluginPath(wxT("/usr/lib/firefox-addons/plugins"));
#elif
# error TBD add plugin dirs for this platform
#endif


The combo control for the address also appears to be too small on my linux system so I changed the following in MyFrame::MyFrame():

Code: Select all
#if defined (__linux__)
    m_urlbar = new wxComboBox(toolbar, wxID_URL, wxT(""), wxPoint(0,0), wxSize(850,24));   
#else
    m_urlbar = new wxComboBox(toolbar, wxID_URL, wxT(""), wxPoint(0,0), wxSize(850,18));   
#endif


When building testapp.cpp you'll also get a warning:

Code: Select all
testapp.cpp: In member function ‘void MyFrame::OnInitDownload(wxWebEvent&)’:
testapp.cpp:939: warning: cannot pass objects of non-POD type ‘class wxString’ through ‘...’; call will abort at runtime


To get rid of this in MyFrame::OnInitDownload() change:

Code: Select all
            wxString::Format(wxT("Would you like to download %s?"), filename),


to

Code: Select all
            wxString::Format(wxT("Would you like to download %s?"), filename.c_str()),


Cheers

Nigel
ngpaton
Registered User
 
Posts: 11
Joined: Wed Aug 19, 2009 4:42 am

Re: Running on Linux

Postby ngpaton on Wed Aug 19, 2009 5:13 am

One problem seen when running is that if you visit any page that uses flash the main display area reduces to a small square in the top left corner. If you resize the whole app it will come back to the correct size. Looks like there is some sizer magic needs to be called somewhere inside webconnect. This doesn't happen in the windows build.
ngpaton
Registered User
 
Posts: 11
Joined: Wed Aug 19, 2009 4:42 am

Re: Running on Linux

Postby ngpaton on Wed Aug 19, 2009 5:19 am

Better fix for combo box size in MyFrame::MyFrame() (works for linux and windows):

Code: Select all
    m_urlbar = new wxComboBox(toolbar, wxID_URL, wxT(""), wxPoint(0,0), wxSize(850,-1)); 
ngpaton
Registered User
 
Posts: 11
Joined: Wed Aug 19, 2009 4:42 am

Re: Running on Linux

Postby Ken on Wed Aug 19, 2009 8:38 am

Thanks for your work on this!
Ken Kaczmarek
Kirix Support Team
User avatar
Ken
Kirix Support Team
 
Posts: 147
Joined: Mon Dec 19, 2005 10:36 am

Re: Running on Linux

Postby ngpaton on Thu Aug 27, 2009 8:56 am

Thanks for the great control :D
ngpaton
Registered User
 
Posts: 11
Joined: Wed Aug 19, 2009 4:42 am

Fixing the grey windows bug on Linux with wxGTK 2.9

Postby Aubin Dadjo on Wed Aug 24, 2011 3:35 am

I'm in the midst of making sure that wxWebConnect works with wxWidgets
2.9. With 2.8, all supported platforms are working. On wxMSW with
2.9, all is working well. On wxGTK with 2.9, however, the library is
currently not working properly. I've tested this with older versions
of 2.9, such as 2.9.0, and the problem still exists there, so this
isn't anything new.
...
On wxGTK 2.9, the web page initially displays and works fine. The
user can browse the web fine. However, as soon as the window is
resized, the contents of the window blank out to grey and the web page
doesn't work anymore (e.g. clicks, controls, scrollbars don't show or
work).

Benjamin Williams | 25 Oct 13:24

To fix the bug, I've modified a bit the wxWebControl event table by replacing
EVT_SIZE(wxWebControl::OnSize)
with EVT_PAINT(wxWebControl::OnPaint)
and renamed OnSize(wxSizeEvent& evt) method and its' argument
void wxWebControl::OnSize(wxSizeEvent& evt);
is replaced with void wxWebControl::OnPaint(wxPaintEvent& evt);


Code: Select all
BEGIN_EVENT_TABLE(wxWebControl, wxControl)
    //EVT_SIZE(wxWebControl::OnSize)
    EVT_PAINT(wxWebControl::OnPaint)
    EVT_SET_FOCUS(wxWebControl::OnSetFocus)
    EVT_KILL_FOCUS(wxWebControl::OnKillFocus)
END_EVENT_TABLE()

//void wxWebControl::OnSize(wxSizeEvent& evt)
void wxWebControl::OnPaint(wxPaintEvent& evt)
{
    if (!IsOk())
        return;

    wxRect cli_rect = this->GetClientRect();

    if (m_ptrs->m_base_window)
    {
        m_ptrs->m_base_window->SetPositionAndSize(0, 0,
                                    cli_rect.GetWidth(),
                                    cli_rect.GetHeight(),
                                    PR_TRUE);
    }
}


And its works nice
Regards
Aubin Dadjo
Aubin Dadjo
Registered User
 
Posts: 1
Joined: Tue Aug 23, 2011 1:53 pm

Return to wxWebConnect Patches & Modifications