advpack: Forward SetPerUserSecValuesA to its Unicode counterpart.
[wine] / dlls / mshtml / view.c
1 /*
2  * Copyright 2005 Jacek Caban
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
17  */
18
19 #include "config.h"
20
21 #include <stdarg.h>
22 #include <stdio.h>
23
24 #define COBJMACROS
25
26 #include "windef.h"
27 #include "winbase.h"
28 #include "winuser.h"
29 #include "wingdi.h"
30 #include "ole2.h"
31 #include "resource.h"
32
33 #include "wine/debug.h"
34
35 #include "mshtml_private.h"
36
37 WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
38
39 static const WCHAR wszInternetExplorer_Server[] =
40     {'I','n','t','e','r','n','e','t',' ','E','x','p','l','o','r','e','r','_','S','e','r','v','e','r',0};
41
42 static ATOM serverwnd_class = 0;
43
44 static void paint_disabled(HWND hwnd) {
45     HDC hdc;
46     PAINTSTRUCT ps;
47     HBRUSH brush;
48     RECT rect;
49     HFONT font;
50     WCHAR wszHTMLDisabled[100];
51
52     LoadStringW(hInst, IDS_HTMLDISABLED, wszHTMLDisabled, sizeof(wszHTMLDisabled)/sizeof(WCHAR));
53
54     font = CreateFontA(25,0,0,0,400,0,0,0,ANSI_CHARSET,0,0,DEFAULT_QUALITY,DEFAULT_PITCH,NULL);
55     brush = CreateSolidBrush(RGB(255,255,255));
56     GetClientRect(hwnd, &rect);
57
58     hdc = BeginPaint(hwnd, &ps);
59     SelectObject(hdc, font);
60     SelectObject(hdc, brush);
61     Rectangle(hdc, rect.left, rect.top, rect.right, rect.bottom);
62     DrawTextW(hdc, wszHTMLDisabled,-1, &rect, DT_CENTER | DT_SINGLELINE | DT_VCENTER);
63     EndPaint(hwnd, &ps);
64
65     DeleteObject(font);
66     DeleteObject(brush);
67 }
68
69 static void activate_gecko(HTMLDocument *This)
70 {
71     TRACE("(%p) %p\n", This, This->nscontainer->window);
72
73     SetParent(This->nscontainer->hwnd, This->hwnd);
74     ShowWindow(This->nscontainer->hwnd, SW_SHOW);
75
76     nsIBaseWindow_SetVisibility(This->nscontainer->window, TRUE);
77     nsIBaseWindow_SetEnabled(This->nscontainer->window, TRUE);
78     nsIWebBrowserFocus_Activate(This->nscontainer->focus);
79 }
80
81 static LRESULT WINAPI serverwnd_proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
82 {
83     HTMLDocument *This;
84
85     static const WCHAR wszTHIS[] = {'T','H','I','S',0};
86
87     if(msg == WM_CREATE) {
88         This = *(HTMLDocument**)lParam;
89         SetPropW(hwnd, wszTHIS, This);
90     }else {
91         This = (HTMLDocument*)GetPropW(hwnd, wszTHIS);
92     }
93
94     switch(msg) {
95     case WM_CREATE:
96         This->hwnd = hwnd;
97         if(This->nscontainer)
98             activate_gecko(This);
99         break;
100     case WM_PAINT:
101         if(!This->nscontainer)
102             paint_disabled(hwnd);
103         break;
104     case WM_SIZE:
105         TRACE("(%p)->(WM_SIZE)\n", This);
106         if(This->nscontainer)
107             SetWindowPos(This->nscontainer->hwnd, NULL, 0, 0, LOWORD(lParam), HIWORD(lParam),
108                     SWP_NOZORDER | SWP_NOACTIVATE);
109     }
110         
111     return DefWindowProcW(hwnd, msg, wParam, lParam);
112 }
113
114 static void register_serverwnd_class(void)
115 {
116     static WNDCLASSEXW wndclass = {
117         sizeof(WNDCLASSEXW),
118         CS_DBLCLKS,
119         serverwnd_proc,
120         0, 0, NULL, NULL, NULL, NULL, NULL,
121         wszInternetExplorer_Server,
122         NULL,
123     };
124     wndclass.hInstance = hInst;
125     serverwnd_class = RegisterClassExW(&wndclass);
126 }
127
128 static HRESULT activate_window(HTMLDocument *This)
129 {
130     IOleInPlaceUIWindow *pIPWnd;
131     IOleInPlaceFrame *pIPFrame;
132     IOleCommandTarget *cmdtrg;
133     RECT posrect, cliprect;
134     OLEINPLACEFRAMEINFO frameinfo;
135     HWND parent_hwnd;
136     HRESULT hres;
137
138     if(!serverwnd_class)
139         register_serverwnd_class();
140
141     hres = IOleInPlaceSite_CanInPlaceActivate(This->ipsite);
142     if(hres != S_OK) {
143         WARN("CanInPlaceActivate returned: %08lx\n", hres);
144         return FAILED(hres) ? hres : E_FAIL;
145     }
146
147     hres = IOleInPlaceSite_GetWindowContext(This->ipsite, &pIPFrame, &pIPWnd, &posrect, &cliprect, &frameinfo);
148     if(FAILED(hres)) {
149         WARN("GetWindowContext failed: %08lx\n", hres);
150         return hres;
151     }
152     if(pIPWnd)
153         IOleInPlaceUIWindow_Release(pIPWnd);
154     TRACE("got window context: %p %p {%ld %ld %ld %ld} {%ld %ld %ld %ld} {%d %x %p %p %d}\n",
155             pIPFrame, pIPWnd, posrect.left, posrect.top, posrect.right, posrect.bottom,
156             cliprect.left, cliprect.top, cliprect.right, cliprect.bottom,
157             frameinfo.cb, frameinfo.fMDIApp, frameinfo.hwndFrame, frameinfo.haccel, frameinfo.cAccelEntries);
158
159     hres = IOleInPlaceSite_GetWindow(This->ipsite, &parent_hwnd);
160     if(FAILED(hres)) {
161         WARN("GetWindow failed: %08lx\n", hres);
162         return hres;
163     }
164
165     TRACE("got parent window %p\n", parent_hwnd);
166
167     if(This->hwnd) {
168         if(GetParent(This->hwnd) != parent_hwnd)
169             SetParent(This->hwnd, parent_hwnd);
170         SetWindowPos(This->hwnd, HWND_TOP,
171                 posrect.left, posrect.top, posrect.right-posrect.left, posrect.bottom-posrect.top,
172                 SWP_NOACTIVATE | SWP_SHOWWINDOW);
173     }else {
174         CreateWindowExW(0, wszInternetExplorer_Server, NULL,
175                 WS_CHILD | WS_CLIPSIBLINGS | WS_CLIPCHILDREN,
176                 posrect.left, posrect.top, posrect.right-posrect.left, posrect.bottom-posrect.top,
177                 parent_hwnd, NULL, hInst, This);
178
179         TRACE("Created window %p\n", This->hwnd);
180
181         SetWindowPos(This->hwnd, NULL, 0, 0, 0, 0,
182                 SWP_NOSIZE | SWP_NOMOVE | SWP_NOZORDER | SWP_NOREDRAW | SWP_NOACTIVATE | SWP_SHOWWINDOW);
183         RedrawWindow(This->hwnd, NULL, NULL, RDW_INVALIDATE | RDW_NOERASE | RDW_ALLCHILDREN);
184         SetFocus(This->hwnd);
185
186         /* NOTE:
187          * Windows implementation calls:
188          * RegisterWindowMessage("MSWHEEL_ROLLMSG");
189          * SetTimer(This->hwnd, TIMER_ID, 100, NULL);
190          */
191     }
192
193     This->in_place_active = TRUE;
194     hres = IOleInPlaceSite_OnInPlaceActivate(This->ipsite);
195     if(FAILED(hres)) {
196         WARN("OnInPlaceActivate failed: %08lx\n", hres);
197         This->in_place_active = FALSE;
198         return hres;
199     }
200
201     hres = IOleClientSite_QueryInterface(This->client, &IID_IOleCommandTarget, (void**)&cmdtrg);
202     if(SUCCEEDED(hres)) {
203         VARIANT var;
204
205         IOleInPlaceFrame_SetStatusText(pIPFrame, NULL);
206
207         V_VT(&var) = VT_I4;
208         V_I4(&var) = 0;
209         IOleCommandTarget_Exec(cmdtrg, NULL, OLECMDID_SETPROGRESSMAX, 0, &var, NULL);
210         IOleCommandTarget_Exec(cmdtrg, NULL, OLECMDID_SETPROGRESSPOS, 0, &var, NULL);
211
212         IOleCommandTarget_Release(cmdtrg);
213     }
214
215     if(This->frame)
216         IOleInPlaceFrame_Release(This->frame);
217     This->frame = pIPFrame;
218
219     This->window_active = TRUE;
220
221     return S_OK;
222 }
223
224 /**********************************************************
225  * IOleDocumentView implementation
226  */
227
228 #define DOCVIEW_THIS(iface) DEFINE_THIS(HTMLDocument, OleDocumentView, iface)
229
230 static HRESULT WINAPI OleDocumentView_QueryInterface(IOleDocumentView *iface, REFIID riid, void **ppvObject)
231 {
232     HTMLDocument *This = DOCVIEW_THIS(iface);
233     return IHTMLDocument2_QueryInterface(HTMLDOC(This), riid, ppvObject);
234 }
235
236 static ULONG WINAPI OleDocumentView_AddRef(IOleDocumentView *iface)
237 {
238     HTMLDocument *This = DOCVIEW_THIS(iface);
239     return IHTMLDocument2_AddRef(HTMLDOC(This));
240 }
241
242 static ULONG WINAPI OleDocumentView_Release(IOleDocumentView *iface)
243 {
244     HTMLDocument *This = DOCVIEW_THIS(iface);
245     return IHTMLDocument2_Release(HTMLDOC(This));
246 }
247
248 static HRESULT WINAPI OleDocumentView_SetInPlaceSite(IOleDocumentView *iface, IOleInPlaceSite *pIPSite)
249 {
250     HTMLDocument *This = DOCVIEW_THIS(iface);
251     TRACE("(%p)->(%p)\n", This, pIPSite);
252
253     if(pIPSite)
254         IOleInPlaceSite_AddRef(pIPSite);
255
256     if(This->ipsite)
257         IOleInPlaceSite_Release(This->ipsite);
258
259     This->ipsite = pIPSite;
260     return S_OK;
261 }
262
263 static HRESULT WINAPI OleDocumentView_GetInPlaceSite(IOleDocumentView *iface, IOleInPlaceSite **ppIPSite)
264 {
265     HTMLDocument *This = DOCVIEW_THIS(iface);
266     TRACE("(%p)->(%p)\n", This, ppIPSite);
267
268     if(!ppIPSite)
269         return E_INVALIDARG;
270
271     if(This->ipsite)
272         IOleInPlaceSite_AddRef(This->ipsite);
273
274     *ppIPSite = This->ipsite;
275     return S_OK;
276 }
277
278 static HRESULT WINAPI OleDocumentView_GetDocument(IOleDocumentView *iface, IUnknown **ppunk)
279 {
280     HTMLDocument *This = DOCVIEW_THIS(iface);
281     TRACE("(%p)->(%p)\n", This, ppunk);
282
283     if(!ppunk)
284         return E_INVALIDARG;
285
286     IHTMLDocument2_AddRef(HTMLDOC(This));
287     *ppunk = (IUnknown*)HTMLDOC(This);
288     return S_OK;
289 }
290
291 static HRESULT WINAPI OleDocumentView_SetRect(IOleDocumentView *iface, LPRECT prcView)
292 {
293     HTMLDocument *This = DOCVIEW_THIS(iface);
294     RECT rect;
295
296     TRACE("(%p)->(%p)\n", This, prcView);
297
298     if(!prcView)
299         return E_INVALIDARG;
300
301     if(This->hwnd) {
302         GetClientRect(This->hwnd, &rect);
303         if(memcmp(prcView, &rect, sizeof(RECT))) {
304             InvalidateRect(This->hwnd,NULL,TRUE);
305             SetWindowPos(This->hwnd, NULL, prcView->left, prcView->top, prcView->right,
306                     prcView->bottom, SWP_NOZORDER | SWP_NOACTIVATE);
307         }
308     }
309     
310     return S_OK;
311 }
312
313 static HRESULT WINAPI OleDocumentView_GetRect(IOleDocumentView *iface, LPRECT prcView)
314 {
315     HTMLDocument *This = DOCVIEW_THIS(iface);
316
317     TRACE("(%p)->(%p)\n", This, prcView);
318
319     if(!prcView)
320         return E_INVALIDARG;
321
322     GetClientRect(This->hwnd, prcView);
323     return S_OK;
324 }
325
326 static HRESULT WINAPI OleDocumentView_SetRectComplex(IOleDocumentView *iface, LPRECT prcView,
327                         LPRECT prcHScroll, LPRECT prcVScroll, LPRECT prcSizeBox)
328 {
329     HTMLDocument *This = DOCVIEW_THIS(iface);
330     FIXME("(%p)->(%p %p %p %p)\n", This, prcView, prcHScroll, prcVScroll, prcSizeBox);
331     return E_NOTIMPL;
332 }
333
334 static HRESULT WINAPI OleDocumentView_Show(IOleDocumentView *iface, BOOL fShow)
335 {
336     HTMLDocument *This = DOCVIEW_THIS(iface);
337     HRESULT hres;
338
339     TRACE("(%p)->(%x)\n", This, fShow);
340
341     if(fShow) {
342         if(!This->ui_active) {
343             hres = activate_window(This);
344             if(FAILED(hres))
345                 return hres;
346         }
347         ShowWindow(This->hwnd, SW_SHOW);
348     }else {
349         ShowWindow(This->hwnd, SW_HIDE);
350     }
351
352     return S_OK;
353 }
354
355 static HRESULT WINAPI OleDocumentView_UIActivate(IOleDocumentView *iface, BOOL fUIActivate)
356 {
357     HTMLDocument *This = DOCVIEW_THIS(iface);
358     HRESULT hres;
359
360     TRACE("(%p)->(%x)\n", This, fUIActivate);
361
362     if(!This->ipsite) {
363         FIXME("This->ipsite = NULL\n");
364         return E_FAIL;
365     }
366
367     if(fUIActivate) {
368         if(This->ui_active)
369             return S_OK;
370
371         if(!This->window_active) {
372             hres = activate_window(This);
373             if(FAILED(hres))
374                 return hres;
375         }
376
377         hres = IOleInPlaceSite_OnUIActivate(This->ipsite);
378         if(SUCCEEDED(hres)) {
379             OLECHAR wszHTMLDocument[30];
380             LoadStringW(hInst, IDS_HTMLDOCUMENT, wszHTMLDocument,
381                     sizeof(wszHTMLDocument)/sizeof(WCHAR));
382             IOleInPlaceFrame_SetActiveObject(This->frame, ACTOBJ(This), wszHTMLDocument);
383         }else {
384             FIXME("OnUIActivate failed: %08lx\n", hres);
385             IOleInPlaceFrame_Release(This->frame);
386             This->frame = NULL;
387             This->ui_active = FALSE;
388             return hres;
389         }
390
391         hres = IDocHostUIHandler_ShowUI(This->hostui, 0, ACTOBJ(This), CMDTARGET(This),
392                 This->frame, NULL);
393         if(FAILED(hres))
394             IDocHostUIHandler_HideUI(This->hostui);
395
396         This->ui_active = TRUE;
397     }else {
398         This->window_active = FALSE;
399         if(This->ui_active) {
400             This->ui_active = FALSE;
401             if(This->frame)
402                 IOleInPlaceFrame_SetActiveObject(This->frame, NULL, NULL);
403             if(This->hostui)
404                 IDocHostUIHandler_HideUI(This->hostui);
405             if(This->ipsite)
406                 IOleInPlaceSite_OnUIDeactivate(This->ipsite, FALSE);
407         }
408     }
409     return S_OK;
410 }
411
412 static HRESULT WINAPI OleDocumentView_Open(IOleDocumentView *iface)
413 {
414     HTMLDocument *This = DOCVIEW_THIS(iface);
415     FIXME("(%p)\n", This);
416     return E_NOTIMPL;
417 }
418
419 static HRESULT WINAPI OleDocumentView_CloseView(IOleDocumentView *iface, DWORD dwReserved)
420 {
421     HTMLDocument *This = DOCVIEW_THIS(iface);
422     TRACE("(%p)->(%lx)\n", This, dwReserved);
423
424     if(dwReserved)
425         WARN("dwReserved = %ld\n", dwReserved);
426
427     /* NOTE:
428      * Windows implementation calls QueryInterface(IID_IOleCommandTarget),
429      * QueryInterface(IID_IOleControlSite) and KillTimer
430      */
431
432     IOleDocumentView_Show(iface, FALSE);
433
434     return S_OK;
435 }
436
437 static HRESULT WINAPI OleDocumentView_SaveViewState(IOleDocumentView *iface, LPSTREAM pstm)
438 {
439     HTMLDocument *This = DOCVIEW_THIS(iface);
440     FIXME("(%p)->(%p)\n", This, pstm);
441     return E_NOTIMPL;
442 }
443
444 static HRESULT WINAPI OleDocumentView_ApplyViewState(IOleDocumentView *iface, LPSTREAM pstm)
445 {
446     HTMLDocument *This = DOCVIEW_THIS(iface);
447     FIXME("(%p)->(%p)\n", This, pstm);
448     return E_NOTIMPL;
449 }
450
451 static HRESULT WINAPI OleDocumentView_Clone(IOleDocumentView *iface, IOleInPlaceSite *pIPSiteNew,
452                                         IOleDocumentView **ppViewNew)
453 {
454     HTMLDocument *This = DOCVIEW_THIS(iface);
455     FIXME("(%p)->(%p %p)\n", This, pIPSiteNew, ppViewNew);
456     return E_NOTIMPL;
457 }
458
459 #undef DOCVIEW_THIS
460
461 static const IOleDocumentViewVtbl OleDocumentViewVtbl = {
462     OleDocumentView_QueryInterface,
463     OleDocumentView_AddRef,
464     OleDocumentView_Release,
465     OleDocumentView_SetInPlaceSite,
466     OleDocumentView_GetInPlaceSite,
467     OleDocumentView_GetDocument,
468     OleDocumentView_SetRect,
469     OleDocumentView_GetRect,
470     OleDocumentView_SetRectComplex,
471     OleDocumentView_Show,
472     OleDocumentView_UIActivate,
473     OleDocumentView_Open,
474     OleDocumentView_CloseView,
475     OleDocumentView_SaveViewState,
476     OleDocumentView_ApplyViewState,
477     OleDocumentView_Clone
478 };
479
480 /**********************************************************
481  * IViewObject implementation
482  */
483
484 #define VIEWOBJ_THIS(iface) DEFINE_THIS(HTMLDocument, ViewObject2, iface)
485
486 static HRESULT WINAPI ViewObject_QueryInterface(IViewObject2 *iface, REFIID riid, void **ppvObject)
487 {
488     HTMLDocument *This = VIEWOBJ_THIS(iface);
489     return IHTMLDocument2_QueryInterface(HTMLDOC(This), riid, ppvObject);
490 }
491
492 static ULONG WINAPI ViewObject_AddRef(IViewObject2 *iface)
493 {
494     HTMLDocument *This = VIEWOBJ_THIS(iface);
495     return IHTMLDocument2_AddRef(HTMLDOC(This));
496 }
497
498 static ULONG WINAPI ViewObject_Release(IViewObject2 *iface)
499 {
500     HTMLDocument *This = VIEWOBJ_THIS(iface);
501     return IHTMLDocument2_Release(HTMLDOC(This));
502 }
503
504 static HRESULT WINAPI ViewObject_Draw(IViewObject2 *iface, DWORD dwDrawAspect, LONG lindex, void *pvAspect,
505         DVTARGETDEVICE *ptd, HDC hdcTargetDev, HDC hdcDraw, LPCRECTL lprcBounds,
506         LPCRECTL lprcWBounds, BOOL (CALLBACK *pfnContinue)(ULONG_PTR dwContinue), ULONG_PTR dwContinue)
507 {
508     HTMLDocument *This = VIEWOBJ_THIS(iface);
509     FIXME("(%p)->(%ld %ld %p %p %p %p %p %p %p %ld)\n", This, dwDrawAspect, lindex, pvAspect,
510             ptd, hdcTargetDev, hdcDraw, lprcBounds, lprcWBounds, pfnContinue, dwContinue);
511     return E_NOTIMPL;
512 }
513
514 static HRESULT WINAPI ViewObject_GetColorSet(IViewObject2 *iface, DWORD dwDrawAspect, LONG lindex, void *pvAspect,
515         DVTARGETDEVICE *ptd, HDC hicTargetDev, LOGPALETTE **ppColorSet)
516 {
517     HTMLDocument *This = VIEWOBJ_THIS(iface);
518     FIXME("(%p)->(%ld %ld %p %p %p %p)\n", This, dwDrawAspect, lindex, pvAspect, ptd, hicTargetDev, ppColorSet);
519     return E_NOTIMPL;
520 }
521
522 static HRESULT WINAPI ViewObject_Freeze(IViewObject2 *iface, DWORD dwDrawAspect, LONG lindex,
523         void *pvAspect, DWORD *pdwFreeze)
524 {
525     HTMLDocument *This = VIEWOBJ_THIS(iface);
526     FIXME("(%p)->(%ld %ld %p %p)\n", This, dwDrawAspect, lindex, pvAspect, pdwFreeze);
527     return E_NOTIMPL;
528 }
529
530 static HRESULT WINAPI ViewObject_Unfreeze(IViewObject2 *iface, DWORD dwFreeze)
531 {
532     HTMLDocument *This = VIEWOBJ_THIS(iface);
533     FIXME("(%p)->(%ld)\n", This, dwFreeze);
534     return E_NOTIMPL;
535 }
536
537 static HRESULT WINAPI ViewObject_SetAdvise(IViewObject2 *iface, DWORD aspects, DWORD advf, IAdviseSink *pAdvSink)
538 {
539     HTMLDocument *This = VIEWOBJ_THIS(iface);
540     FIXME("(%p)->(%ld %ld %p)\n", This, aspects, advf, pAdvSink);
541     return E_NOTIMPL;
542 }
543
544 static HRESULT WINAPI ViewObject_GetAdvise(IViewObject2 *iface, DWORD *pAspects, DWORD *pAdvf, IAdviseSink **ppAdvSink)
545 {
546     HTMLDocument *This = VIEWOBJ_THIS(iface);
547     FIXME("(%p)->(%p %p %p)\n", This, pAspects, pAdvf, ppAdvSink);
548     return E_NOTIMPL;
549 }
550
551 static HRESULT WINAPI ViewObject_GetExtent(IViewObject2 *iface, DWORD dwDrawAspect, LONG lindex,
552                                 DVTARGETDEVICE* ptd, LPSIZEL lpsizel)
553 {
554     HTMLDocument *This = VIEWOBJ_THIS(iface);
555     FIXME("(%p)->(%ld %ld %p %p)\n", This, dwDrawAspect, lindex, ptd, lpsizel);
556     return E_NOTIMPL;
557 }
558
559 #undef VIEWOBJ_THIS
560
561 static const IViewObject2Vtbl ViewObjectVtbl = {
562     ViewObject_QueryInterface,
563     ViewObject_AddRef,
564     ViewObject_Release,
565     ViewObject_Draw,
566     ViewObject_GetColorSet,
567     ViewObject_Freeze,
568     ViewObject_Unfreeze,
569     ViewObject_SetAdvise,
570     ViewObject_GetAdvise,
571     ViewObject_GetExtent
572 };
573
574 void HTMLDocument_View_Init(HTMLDocument *This)
575 {
576     This->lpOleDocumentViewVtbl = &OleDocumentViewVtbl;
577     This->lpViewObject2Vtbl = &ViewObjectVtbl;
578
579     This->ipsite = NULL;
580     This->frame = NULL;
581     This->hwnd = NULL;
582
583     This->in_place_active = FALSE;
584     This->ui_active = FALSE;
585     This->window_active = FALSE;
586 }