Report after porting a windows app to WINE

Mike Engelhardt pmte at concentric.net
Thu Feb 27 18:29:09 CST 2003


Dear WINE developers,

I develop an MS windows app and just got it working under
WINE/Linux.  It's call LTspice/SwitcherCADIII.  It's a
free schematic capture/SPICE simulator obtainable from
www.linear.com/software.  

I've noticed a few things about WINE that might help you
improve it.  WINE can confuse SendMessage() with PostMessage().
LTspice uses SendMessage to handshake between threads
sometimes.  Wine usually obeys the difference, but treated
some SendMessage calls like a PostMessage.  My workaround
was to poll volatile global variables.

I needed to add some redraws to clear up some differences
between WINE and Windows dialog box updates.  This was for
a tab control that make different controls on the pane
visible or not depending on tab selection.  Also LTspice
draws directly to the screen and carefully counts the
number of times it XOR'ed something with the screen.  That
behaved a bit different between WINE and Windows.  Again,
I found workarounds for most of it.  I'm not sure, but maybe
it's just a difference between obeying the SetROP2() setting
for CDC::SetPixel() calls.

The version of LTspice I put up on the web today, 2.01c,
works quite well under WINE/Linux.  The main problem
with it is that the RoboHelp isn't working.  Any advice
there?

A few other WINE issues:

1.  The icons drawn on Property sheet tabs have a black
    background in WINE.  In Windows it's the background
    color.  You can see the problem on the Tools=>Control
    Panel tab icons.

2.  The resize grip on the lower right hand corner of resizeable
    dialogs is drawn like a scrollbar.  The "proper" windows
    method to draw these resize grips is to use a scroll bar
    created like this:

    CScrollBar m_Grip;

    char OldResizableGrip[] = "OldResizableGrip";
    LRESULT CALLBACK GripWindowProc(HWND hwnd, UINT msg, WPARAM wParam,LPARAM lParam)
    {
       if(WM_NCHITTEST == msg)
          return(HTBOTTOMRIGHT); // the mouse cursor that goes with a grip on the bottom right of a window
       HANDLE oldWndProc = GetProp(hwnd, OldResizableGrip);
       if(WM_DESTROY == msg)  // unsubclass
       {
          RemoveProp(hwnd, OldResizableGrip);
          SetWindowLong(hwnd, GWL_WNDPROC, (LONG) oldWndProc);
       }
       return(CallWindowProc((WNDPROC) oldWndProc, hwnd, msg, wParam,lParam));
    }

    BOOL CSelectWaveformsDlg::OnInitDialog()
    {
       CDialog::OnInitDialog();
       SetAllListBoxItems();
       CRect rect(0, 0, GetSystemMetrics(SM_CXVSCROLL),GetSystemMetrics(SM_CYHSCROLL));
       m_Grip.Create(WS_CHILD | WS_CLIPSIBLINGS | SBS_SIZEGRIP | WS_VISIBLE,rect, this, AFX_IDW_SIZE_BOX);
       CWnd *resizeWnd = GetDlgItem(AFX_IDW_SIZE_BOX);
       if(resizeWnd)
       {
          CRect rect, rect2;
          resizeWnd->GetWindowRect(&rect);
          GetClientRect(rect2);
          rect2.left = rect2.right  - rect.Width();
          rect2.top  = rect2.bottom - rect.Height();
          resizeWnd->MoveWindow(&rect2, FALSE);
          ::SetProp(m_Grip, OldResizableGrip, (HANDLE)
          ::GetWindowLong(m_Grip, GWL_WNDPROC));
          ::SetWindowLong(m_Grip, GWL_WNDPROC, (LONG) GripWindowProc);
       }
       return(TRUE);
    }

3.  Function key F6 is not trapped.

4.  The cursor colors are off.  For example, the voltage probe
    cursor should have a red body.  In WINE it's black.  The sleeve
    of the pointing hand is blue, in WINE it's black.

5.  Font's aren't always correct.  There's two types for schematics, "Arial"
    and "New Courier".  The Arial can become italic depending on the size
    required.

I would like to know if there is a way to determine if my app is running
under WINE under runtime.  That way I can work around more of these
problems without imparing its performance under MS Windows.  If you know
the answer, please e-mail me directly.

--Mike Engelhardt
pmte at concentric.net

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.winehq.org/pipermail/wine-devel/attachments/20030227/20037dae/attachment.htm


More information about the wine-devel mailing list