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