]> git.saurik.com Git - wxWidgets.git/blob - docs/microwin/readme.txt
8cd81015a8b20825be82fbe775b52aa3613ee708
[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 - change the TOP variable at the top of src/msw/makefile.mic
63 to reflect where MicroWindows is installed
64
65 - type 'make -f makefile.mic all' from src/msw. To clean, use
66 cleanwx and NOT clean since that will clean MicroWindows itself
67
68 - to make the sample, cd into samples/minimal, edit the TOP variable,
69 and type 'make -f makefile.mic all'
70
71 Running 'minimal' runs the virtual MicroWindows desktop
72 and the minimal sample, since in a MicroWindows WIN32 application
73 they are one and the same binary.
74
75 Status
76 ======
77
78 The minimal sample is almost fully-functional, apart from minor
79 menu presentation issues (no borders, for example).
80
81 Implementation Notes
82 ====================
83
84 wxMicroWindows is essentially the wxMSW port + wxUniversal
85 widgets. Lots of things in include/wx/univ/setup.h are switched
86 off to allow the port to compile. There are also #ifdefs
87 switching off further functionality, such as most wxBitmap
88 functions, pending proper implementation.
89
90 There are some WIN32 API functions not implemented by MicroWindows
91 that are instead stubbed out in include/wx/msw/microwin.c,
92 and 'implemented' in src/msw/microwin.c. Some of these functions
93 are important, some less so. They will need to be implemented
94 in due course. But implementing missing functionality in this way
95 is preferably to proliferating many #ifdefs in the
96 wxMSW/wxMicroWindows port itself.
97
98 Things missing from MicroWindows that need to be worked around
99 ==============================================================
100
101 No ::GetKeyState (see include/wx/msw/private.h). Should probably use
102 GdOpenKeyboard/GdCloseKeyboard/GdReadKeyboard. Could perhaps emulate
103 GetKeyState this way.
104
105 No ::CreateBitmap or BITMAPINFO. But BMPs can be converted
106 to C using convbmp, then need to use Gr... functions.
107 We MUST implement creation from XPMs, since wxUniversal
108 makes use of XPMs, or else create our own bitmaps for
109 drawing radioboxes, checkboxes etc.: see renderers
110 in src/univ.
111
112 No ::DestroyIcon, ::DestroyCursor - use ::DestroyObject instead?
113 Also no LoadCursor, LoadImage. So how do we make cursors? No ::SetCursor.
114
115 wxDC: no ::GetTextColor, ::GetBkColor, ::IntersectClipRect,
116 ::GetClipBox
117
118 No ::SetMenu, so no menus or menubars (now implemented by
119 wxUniversal).
120
121 No ::GetObject so we can't get LOGFONT from an HFONT
122 in wxSystemSettings (worked around by passing HFONT to
123 the wxFont constructor).
124
125
126 Applying patches by hand
127 ========================
128
129 The full altered functions are given below in case you have
130 to apply them by hand.
131
132 src/mwin/winevent.c
133 -------------------
134
135 A second test has been added to this line:
136
137 if(hittest == HTCLIENT || hwnd == GetCapture()) {
138
139 in MwTranslateMouseMessage below. This corrects a mouse message
140 bug.
141
142 /*
143 * Translate and deliver hardware mouse message to proper window.
144 */
145 void
146 MwTranslateMouseMessage(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
187 winuser.c
188 ---------
189
190 Part of PeekMessage has been factored out into PeekMessageHelper,
191 and used in PeekMessage and GetMessage. The three relevant functions
192 are:
193
194 /*
195 * A helper function for sharing code between PeekMessage and GetMessage
196 */
197
198 BOOL WINAPI
199 PeekMessageHelper(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
241 BOOL WINAPI
242 PeekMessage(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
249 BOOL WINAPI
250 GetMessage(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 }