User forums > Help

problem with wxSmith and Mac-OSX

<< < (6/7) > >>

Auria:
Thanks for leading me - guess what? I have a fix!!!


--- Code: ---void wxsDrawingWindow::FetchScreen()
{
    if ( !Bitmap ){ return; }

    wxYield();  // <-----

    // Fetching preview directly from screen
wxScreenDC DC;

--- End code ---

As simple as that :lol: now i don't say it fixes everything, but it fixes the most obvious bug. apparently wx just didnt have time to draw before you got the screen capture. maybe it would be better to call for redrawing the window instead of yield.

BTW What's wrong with autotools?? i need to issue the make command several times in a row as it randomly crashes or fails even though the code is valid. just reissuing it many times in a row fixes the problems...

I get seemingly randomly

--- Quote ---/bin/sh: line 1: make: No such file or directory

--- End quote ---

--- Quote ---ranlib $  d   
ranlib: can't open file: $ (No such file or directory)
ranlib: can't open file: d (No such file or directory)

--- End quote ---

MortenMacFly:

--- Quote from: Auria on June 14, 2007, 01:47:09 am ---
--- Code: ---    wxYield();  // <-----

--- End code ---

--- End quote ---
Remember that IMHO you'd better use

--- Code: ---Manager::Yield();

--- End code ---
at this point...
With regards, Morten.

byo:

--- Quote from: Auria on June 14, 2007, 01:47:09 am ---Thanks for leading me - guess what? I have a fix!!!


--- Code: ---void wxsDrawingWindow::FetchScreen()
{
    if ( !Bitmap ){ return; }

    wxYield();  // <-----

    // Fetching preview directly from screen
wxScreenDC DC;

--- End code ---

As simple as that :lol: now i don't say it fixes everything, but it fixes the most obvious bug. apparently wx just didnt have time to draw before you got the screen capture. maybe it would be better to call for redrawing the window instead of yield.


--- End quote ---

Wow, thanks for all your investigations :) Now we really have something  8)
That's funny because I've used Yields before switching to timers :? Maybe some unique combination: first call timer, than yield is the only available solution. But just to make sure: there's small inline function at the beginning of wxsdrawingwindow.cpp:

--- Code: ---    inline RepaintDelayType GetDelayType()
    {
        // Looks like this gives best results so far on both linux and windows
        return TimerNormal;
    }

--- End code ---

If you change it's content to return Yield; it will use yields instead of timers. Can you check if this works ? (It shouldn't because it didn't worked ealier).

Anyway, I'd like to avoid calling Yields because it can lead to some rare crashes, expecially when editor is being closed. And there's only one solution that come into my mind now: just call Refresh right before Update in OnFetchSequence (line 236). I assumed that refresh request is sent automaticaly after show/hide stuff, but obviously it was a bad assumption. I'll see how it works on other oses, maybe it's possible to avoid any timer/yield stuff.


Regards
   BYO

Auria:
Hi Byo,

your code works as well. When using this code components do not disappear. (they do disappear when trying to play with them e.g. clicking on a text area to add text in it but i think it did it with my other code too)

so it looks like


--- Code: ---#ifdef __WXMAC__
return Yield;
#else
return TimerNormal;
#endif

--- End code ---

byo:
Ok, I've updated sources so they use Yields on MAC. I also added Refresh() just before Update() and it works even without timers on Win now (and probably on Linux), but it's not as smooth as when using timers ;). So my request to Auria: Could you test the new code and play with it a little bit? (maybe this Refresh() / Update() sequence will work even withou any yields - using "None" delay type). Anyway, you've writteh that currently there's something shown inside wxSmith but it disappears on some circumstances. Could you describe more exact what are those circumstances? Thanks for your work :)

Regards
   BYO

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version