]> git.saurik.com Git - wxWidgets.git/blame - docs/microwin/readme.txt
fix the old code for dlerror() returning const char as well (why was it changed?)
[wxWidgets.git] / docs / microwin / readme.txt
CommitLineData
0fd734af
JS
1wxMicroWindows port
2===================
3
25ad2ac2 4Julian Smart 2001-12-08
0fd734af 5
bd52bee1
JS
6This is a port of wxWindows to MicroWindows, under Linux.
7Widgets are supplied by the wxUniversal project, while the
8underlying port uses the Windows ports with small modifications
9for the MicroWindows API.
0fd734af
JS
10
11There are many things missing from MicroWindows that will
12make the port quite limited for the time being. I haven't
13worked out how to create bitmaps, though there is a BMP to C
bd52bee1
JS
14converter. There are no common dialogs (we will use generic ones),
15and only one WIN32 app may be run at a time.
0fd734af 16
bd52bee1
JS
17Note that you can gain confidence in the WIN32/wxUniversal
18combination by compiling wxUniversal under Windows using VC++,
19using src/wxvc_universal.dsp. You can compile the minimal
20and widgets samples in wxUniversal mode using the
21UnivDebug and UnivRelease targets. Most of the code is shared
22between this combination, and the wxMicroWindows port.
0fd734af
JS
23
24Installation
25============
26
bd52bee1 27MicroWindows:
0fd734af 28
25ad2ac2 29- unarchive MicroWindows 0.89pre8
46d0e4b2
JS
30
31- change 'config' to use X11 and any other options you feel fit.
32 Suggestions for changes to the defaults:
33
34 ERASEMOVE=N (otherwise moving windows will look messy)
35 X11=Y
36 OPTIMIZE=N
37 DEBUG=Y
38 VERBOSE=Y
39
2a7449f4
JS
40 Note: these are already applied by the patch below.
41
46d0e4b2 42- apply microwindows.patches (from wxWindows:
bd52bee1 43 docs/microwin/microwindows.patches) to fix PeekMessage
25ad2ac2 44 and other issues. If the patch doesn't apply automatically,
2a7449f4
JS
45 you may need to apply it by hand, and the relevant changed
46 functions are given at the end of this file for convenience.
47
48 Example patch command:
49
50 % cd microwindows-0.89pre8.orig
51 % patch -p0 < ~/wx2/docs/microwin/microwindows.patches
46d0e4b2 52
bd52bee1
JS
53- compile by typing 'make' from within the MicroWindows src directory
54
55wxMicroWindows:
56
25ad2ac2 57- Download wxMSW 2.3.2 or greater, or get it from CVS
c67d6888
JS
58
59- Copy include/wx/msw/setup_microwin.h to include/wx/setup.h if
60 include/wx/setup.h doesn't exist
46d0e4b2
JS
61
62- change the TOP variable at the top of src/msw/makefile.mic
bd52bee1 63 to reflect where MicroWindows is installed
46d0e4b2 64
25ad2ac2
JS
65- type 'make -f makefile.mic all' from src/msw. To clean, use
66 cleanwx and NOT clean since that will clean MicroWindows itself
46d0e4b2 67
bd52bee1 68- to make the sample, cd into samples/minimal, edit the TOP variable,
25ad2ac2 69 and type 'make -f makefile.mic all'
0fd734af 70
0fd734af
JS
71Running 'minimal' runs the virtual MicroWindows desktop
72and the minimal sample, since in a MicroWindows WIN32 application
73they are one and the same binary.
74
75Status
76======
77
46d0e4b2
JS
78The minimal sample is almost fully-functional, apart from minor
79menu presentation issues (no borders, for example).
bd52bee1
JS
80
81Implementation Notes
82====================
0fd734af 83
bd52bee1
JS
84wxMicroWindows is essentially the wxMSW port + wxUniversal
85widgets. Lots of things in include/wx/univ/setup.h are switched
86off to allow the port to compile. There are also #ifdefs
87switching off further functionality, such as most wxBitmap
88functions, pending proper implementation.
0fd734af 89
bd52bee1
JS
90There are some WIN32 API functions not implemented by MicroWindows
91that are instead stubbed out in include/wx/msw/microwin.c,
92and 'implemented' in src/msw/microwin.c. Some of these functions
93are important, some less so. They will need to be implemented
94in due course. But implementing missing functionality in this way
95is preferably to proliferating many #ifdefs in the
96wxMSW/wxMicroWindows port itself.
97
98Things missing from MicroWindows that need to be worked around
99==============================================================
100
101No ::GetKeyState (see include/wx/msw/private.h). Should probably use
102GdOpenKeyboard/GdCloseKeyboard/GdReadKeyboard. Could perhaps emulate
103GetKeyState this way.
0fd734af
JS
104
105No ::CreateBitmap or BITMAPINFO. But BMPs can be converted
106to C using convbmp, then need to use Gr... functions.
bd52bee1
JS
107We MUST implement creation from XPMs, since wxUniversal
108makes use of XPMs, or else create our own bitmaps for
109drawing radioboxes, checkboxes etc.: see renderers
110in src/univ.
0fd734af
JS
111
112No ::DestroyIcon, ::DestroyCursor - use ::DestroyObject instead?
113Also no LoadCursor, LoadImage. So how do we make cursors? No ::SetCursor.
114
115wxDC: no ::GetTextColor, ::GetBkColor, ::IntersectClipRect,
116::GetClipBox
117
bd52bee1
JS
118No ::SetMenu, so no menus or menubars (now implemented by
119wxUniversal).
0fd734af
JS
120
121No ::GetObject so we can't get LOGFONT from an HFONT
bd52bee1
JS
122in wxSystemSettings (worked around by passing HFONT to
123the wxFont constructor).
0fd734af 124
2a7449f4
JS
125
126Applying patches by hand
127========================
128
129The full altered functions are given below in case you have
130to apply them by hand.
131
132src/mwin/winevent.c
133-------------------
134
135A second test has been added to this line:
136
137 if(hittest == HTCLIENT || hwnd == GetCapture()) {
138
139in MwTranslateMouseMessage below. This corrects a mouse message
140bug.
141
142/*
143 * Translate and deliver hardware mouse message to proper window.
144 */
145void
146MwTranslateMouseMessage(HWND hwnd,UINT msg,int hittest)
147{
148 POINT pt;
149 DWORD tick;
150 static UINT lastmsg = 0;
151 static HWND lasthwnd;
152 static DWORD lasttick;
153 static int lastx, lasty;
154
155 /* determine double click eligibility*/
156 if(msg == WM_LBUTTONDOWN || msg == WM_RBUTTONDOWN) {
157 tick = GetTickCount();
158 if((hwnd->pClass->style & CS_DBLCLKS) &&
159 msg == lastmsg && hwnd == lasthwnd &&
160 tick - lasttick < DBLCLICKSPEED &&
161 abs(cursorx-lastx) < mwSYSMETRICS_CXDOUBLECLK &&
162 abs(cursory-lasty) < mwSYSMETRICS_CYDOUBLECLK)
163 msg += (WM_LBUTTONDBLCLK - WM_LBUTTONDOWN);
164 lastmsg = msg;
165 lasthwnd = hwnd;
166 lasttick = tick;
167 lastx = cursorx;
168 lasty = cursory;
169 }
170
171 /*
172 * We always send nc mouse message
173 * unlike Windows, for HTCLIENT default processing
174 */
175 PostMessage(hwnd, msg + (WM_NCMOUSEMOVE-WM_MOUSEMOVE), hittest,
176 MAKELONG(cursorx, cursory));
177
178 /* then possibly send user mouse message*/
179 if(hittest == HTCLIENT || hwnd == GetCapture()) {
180 pt.x = cursorx;
181 pt.y = cursory;
182 ScreenToClient(hwnd, &pt);
183 PostMessage(hwnd, msg, 0, MAKELONG(pt.x, pt.y));
184 }
185}
186
187winuser.c
188---------
189
190Part of PeekMessage has been factored out into PeekMessageHelper,
191and used in PeekMessage and GetMessage. The three relevant functions
192are:
193
194/*
195 * A helper function for sharing code between PeekMessage and GetMessage
196 */
197
198BOOL WINAPI
199PeekMessageHelper(LPMSG lpMsg, HWND hwnd, UINT uMsgFilterMin, UINT uMsgFilterMax,
200 UINT wRemoveMsg, BOOL returnIfEmptyQueue)
201{
202 HWND wp;
203 PMSG pNxtMsg;
204
205 /* check if no messages in queue*/
206 if(mwMsgHead.head == NULL) {
207 /* Added by JACS so it doesn't reach MwSelect */
208 if (returnIfEmptyQueue)
209 return FALSE;
210
211#if PAINTONCE
212 /* check all windows for pending paint messages*/
213 for(wp=listwp; wp; wp=wp->next) {
214 if(!(wp->style & WS_CHILD)) {
215 if(chkPaintMsg(wp, lpMsg))
216 return TRUE;
217 }
218 }
219 for(wp=listwp; wp; wp=wp->next) {
220 if(wp->style & WS_CHILD) {
221 if(chkPaintMsg(wp, lpMsg))
222 return TRUE;
223 }
224 }
225#endif
226 MwSelect();
227 }
228
229 if(mwMsgHead.head == NULL)
230 return FALSE;
231
232 pNxtMsg = (PMSG)mwMsgHead.head;
233 if(wRemoveMsg & PM_REMOVE)
234 GdListRemove(&mwMsgHead, &pNxtMsg->link);
235 *lpMsg = *pNxtMsg;
236 if(wRemoveMsg & PM_REMOVE)
237 GdItemFree(pNxtMsg);
238 return TRUE;
239}
240
241BOOL WINAPI
242PeekMessage(LPMSG lpMsg, HWND hwnd, UINT uMsgFilterMin, UINT uMsgFilterMax,
243 UINT wRemoveMsg)
244{
245 /* Never wait in MwSelect: pass TRUE */
246 return PeekMessageHelper(lpMsg, hwnd, uMsgFilterMin, uMsgFilterMax, wRemoveMsg, TRUE);
247}
248
249BOOL WINAPI
250GetMessage(LPMSG lpMsg,HWND hwnd,UINT wMsgFilterMin,UINT wMsgFilterMax)
251{
252 /*
253 * currently MwSelect() must poll for VT switch reasons,
254 * so this code will work
255 */
256 /* Always wait in MwSelect if there are messages: pass FALSE */
257 while(!PeekMessageHelper(lpMsg, hwnd, wMsgFilterMin, wMsgFilterMax,PM_REMOVE, FALSE))
258 continue;
259 return lpMsg->message != WM_QUIT;
260}