summaryrefslogtreecommitdiff
path: root/hw/xwin/windialogs.c
blob: c83b49bab6d834168b05cbcfabf6c52da55004e2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
/*
 *Copyright (C) 2003-2004 Harold L Hunt II All Rights Reserved.
 *
 *Permission is hereby granted, free of charge, to any person obtaining
 * a copy of this software and associated documentation files (the
 *"Software"), to deal in the Software without restriction, including
 *without limitation the rights to use, copy, modify, merge, publish,
 *distribute, sublicense, and/or sell copies of the Software, and to
 *permit persons to whom the Software is furnished to do so, subject to
 *the following conditions:
 *
 *The above copyright notice and this permission notice shall be
 *included in all copies or substantial portions of the Software.
 *
 *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
 *EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 *MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
 *NONINFRINGEMENT. IN NO EVENT SHALL HAROLD L HUNT II BE LIABLE FOR
 *ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
 *CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
 *WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 *
 *Except as contained in this notice, the name of Harold L Hunt II
 *shall not be used in advertising or otherwise to promote the sale, use
 *or other dealings in this Software without prior written authorization
 *from Harold L Hunt II.
 *
 * Authors:	Harold L Hunt II
 *              Earle F. Philhower III
 */

#ifdef HAVE_XWIN_CONFIG_H
#include <xwin-config.h>
#endif
#include "win.h"
#include <shellapi.h>
#include "winprefs.h"

/*
 * Local function prototypes
 */

static INT_PTR CALLBACK
winExitDlgProc(HWND hDialog, UINT message, WPARAM wParam, LPARAM lParam);

static INT_PTR CALLBACK
winChangeDepthDlgProc(HWND hDialog, UINT message, WPARAM wParam, LPARAM lParam);

static INT_PTR CALLBACK
winAboutDlgProc(HWND hDialog, UINT message, WPARAM wParam, LPARAM lParam);

static void
 winDrawURLWindow(LPARAM lParam);

static LRESULT CALLBACK
winURLWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);

static void
 winOverrideURLButton(HWND hdlg, int id);

static void
 winUnoverrideURLButton(HWND hdlg, int id);

/*
 * Owner-draw a button as a URL
 */

static void
winDrawURLWindow(LPARAM lParam)
{
    DRAWITEMSTRUCT *draw;
    char str[256];
    RECT rect;
    HFONT font;
    COLORREF crText;

    draw = (DRAWITEMSTRUCT *) lParam;
    GetWindowText(draw->hwndItem, str, sizeof(str));
    str[255] = 0;
    GetClientRect(draw->hwndItem, &rect);

    /* Color the button depending upon its state */
    if (draw->itemState & ODS_SELECTED)
        crText = RGB(128 + 64, 0, 0);
    else if (draw->itemState & ODS_FOCUS)
        crText = RGB(0, 128 + 64, 0);
    else
        crText = RGB(0, 0, 128 + 64);
    SetTextColor(draw->hDC, crText);

    /* Create font 8 high, standard dialog font */
    font = CreateFont(-8, 0, 0, 0, FW_DONTCARE, FALSE, FALSE, FALSE,
                      0, 0, 0, 0, 0, "MS Sans Serif");
    if (!font) {
        ErrorF("winDrawURLWindow: Unable to create URL font, bailing.\n");
        return;
    }
    /* Draw it */
    SetBkMode(draw->hDC, OPAQUE);
    SelectObject(draw->hDC, font);
    DrawText(draw->hDC, str, strlen(str), &rect, DT_LEFT | DT_VCENTER);
    /* Delete the created font, replace it with stock font */
    DeleteObject(SelectObject(draw->hDC, GetStockObject(ANSI_VAR_FONT)));
}

/*
 * WndProc for overridden buttons
 */

static LRESULT CALLBACK
winURLWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
    WNDPROC origCB = NULL;
    HCURSOR cursor;

    /* If it's a SetCursor message, tell it to the hand */
    if (msg == WM_SETCURSOR) {
        cursor = LoadCursor(NULL, IDC_HAND);
        if (cursor)
            SetCursor(cursor);
        return TRUE;
    }
    origCB = (WNDPROC) GetWindowLongPtr(hwnd, GWLP_USERDATA);
    /* Otherwise fall through to original WndProc */
    if (origCB)
        return CallWindowProc(origCB, hwnd, msg, wParam, lParam);
    else
        return FALSE;
}

/*
 * Register and unregister the custom WndProc
 */

static void
winOverrideURLButton(HWND hwnd, int id)
{
    WNDPROC origCB;

    origCB = (WNDPROC) SetWindowLongPtr(GetDlgItem(hwnd, id),
                                        GWLP_WNDPROC, (LONG_PTR) winURLWndProc);
    SetWindowLongPtr(GetDlgItem(hwnd, id), GWLP_USERDATA, (LONG_PTR) origCB);
}

static void
winUnoverrideURLButton(HWND hwnd, int id)
{
    WNDPROC origCB;

    origCB = (WNDPROC) SetWindowLongPtr(GetDlgItem(hwnd, id), GWLP_USERDATA, 0);
    if (origCB)
        SetWindowLongPtr(GetDlgItem(hwnd, id), GWLP_WNDPROC, (LONG_PTR) origCB);
}

/*
 * Center a dialog window in the desktop window
 * and set small and large icons to X icons.
 */

static void
winInitDialog(HWND hwndDlg)
{
    HWND hwndDesk;
    RECT rc, rcDlg, rcDesk;
    HICON hIcon, hIconSmall;

    hwndDesk = GetParent(hwndDlg);
    if (!hwndDesk || IsIconic(hwndDesk))
        hwndDesk = GetDesktopWindow();

    /* Remove minimize and maximize buttons */
    SetWindowLongPtr(hwndDlg, GWL_STYLE, GetWindowLongPtr(hwndDlg, GWL_STYLE)
                     & ~(WS_MAXIMIZEBOX | WS_MINIMIZEBOX));

    /* Set Window not to show in the task bar */
    SetWindowLongPtr(hwndDlg, GWL_EXSTYLE,
                     GetWindowLongPtr(hwndDlg, GWL_EXSTYLE) & ~WS_EX_APPWINDOW);

    /* Center dialog window in the screen. Not done for multi-monitor systems, where
     * it is likely to end up split across the screens. In that case, it appears
     * near the Tray icon.
     */
    if (GetSystemMetrics(SM_CMONITORS) > 1) {
        /* Still need to refresh the frame change. */
        SetWindowPos(hwndDlg, HWND_TOPMOST, 0, 0, 0, 0,
                     SWP_NOMOVE | SWP_NOSIZE | SWP_FRAMECHANGED);
    }
    else {
        GetWindowRect(hwndDesk, &rcDesk);
        GetWindowRect(hwndDlg, &rcDlg);
        CopyRect(&rc, &rcDesk);

        OffsetRect(&rcDlg, -rcDlg.left, -rcDlg.top);
        OffsetRect(&rc, -rc.left, -rc.top);
        OffsetRect(&rc, -rcDlg.right, -rcDlg.bottom);

        SetWindowPos(hwndDlg,
                     HWND_TOPMOST,
                     rcDesk.left + (rc.right / 2),
                     rcDesk.top + (rc.bottom / 2),
                     0, 0, SWP_NOSIZE | SWP_FRAMECHANGED);
    }

#ifdef XWIN_MULTIWINDOW
    if (g_hIconX)
        hIcon = g_hIconX;
    else
#endif
        hIcon = LoadIcon(g_hInstance, MAKEINTRESOURCE(IDI_XWIN));

#ifdef XWIN_MULTIWINDOW
    if (g_hSmallIconX)
        hIconSmall = g_hSmallIconX;
    else
#endif
        hIconSmall = LoadImage(g_hInstance,
                               MAKEINTRESOURCE(IDI_XWIN), IMAGE_ICON,
                               GetSystemMetrics(SM_CXSMICON),
                               GetSystemMetrics(SM_CYSMICON), LR_SHARED);

    PostMessage(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM) hIcon);
    PostMessage(hwndDlg, WM_SETICON, ICON_SMALL, (LPARAM) hIconSmall);
}

/*
 * Display the Exit dialog box
 */

void
winDisplayExitDialog(winPrivScreenPtr pScreenPriv)
{
    int i;
    int liveClients = 0;

    /* Count up running clients (clients[0] is serverClient) */
    for (i = 1; i < currentMaxClients; i++)
        if (clients[i] != NullClient)
            liveClients++;
#if defined(XWIN_MULTIWINDOW)
    /* Count down server internal clients */
    if (pScreenPriv->pScreenInfo->fMultiWindow)
        liveClients -= 2;       /* multiwindow window manager & XMsgProc  */
#endif
#if defined(XWIN_CLIPBOARD)
    if (g_fClipboardStarted)
        liveClients--;          /* clipboard manager */
#endif

    /* A user reported that this sometimes drops below zero. just eye-candy. */
    if (liveClients < 0)
        liveClients = 0;

    /* Don't show the exit confirmation dialog if SilentExit & no clients,
       or ForceExit, is enabled */
    if ((pref.fSilentExit && liveClients <= 0) || pref.fForceExit) {
        if (g_hDlgExit != NULL) {
            DestroyWindow(g_hDlgExit);
            g_hDlgExit = NULL;
        }
        PostMessage(pScreenPriv->hwndScreen, WM_GIVEUP, 0, 0);
        return;
    }

    pScreenPriv->iConnectedClients = liveClients;

    /* Check if dialog already exists */
    if (g_hDlgExit != NULL) {
        /* Dialog box already exists, display it */
        ShowWindow(g_hDlgExit, SW_SHOWDEFAULT);

        /* User has lost the dialog.  Show them where it is. */
        SetForegroundWindow(g_hDlgExit);

        return;
    }

    /* Create dialog box */
    g_hDlgExit = CreateDialogParam(g_hInstance,
                                   "EXIT_DIALOG",
                                   pScreenPriv->hwndScreen,
                                   winExitDlgProc, (LPARAM) pScreenPriv);

    /* Show the dialog box */
    ShowWindow(g_hDlgExit, SW_SHOW);

    /* Needed to get keyboard controls (tab, arrows, enter, esc) to work */
    SetForegroundWindow(g_hDlgExit);

    /* Set focus to the Cancel button */
    PostMessage(g_hDlgExit, WM_NEXTDLGCTL,
                (WPARAM) GetDlgItem(g_hDlgExit, IDCANCEL), TRUE);
}

#define CONNECTED_CLIENTS_FORMAT	"There %s currently %d client%s connected."

/*
 * Exit dialog window procedure
 */

static INT_PTR CALLBACK
winExitDlgProc(HWND hDialog, UINT message, WPARAM wParam, LPARAM lParam)
{
    static winPrivScreenPtr s_pScreenPriv = NULL;

    /* Branch on message type */
    switch (message) {
    case WM_INITDIALOG:
    {
        char *pszConnectedClients;

        /* Store pointers to private structures for future use */
        s_pScreenPriv = (winPrivScreenPtr) lParam;

        winInitDialog(hDialog);

        /* Format the connected clients string */
        if (asprintf(&pszConnectedClients, CONNECTED_CLIENTS_FORMAT,
                     (s_pScreenPriv->iConnectedClients == 1) ? "is" : "are",
                     s_pScreenPriv->iConnectedClients,
                     (s_pScreenPriv->iConnectedClients == 1) ? "" : "s") == -1)
            return TRUE;

        /* Set the number of connected clients */
        SetWindowText(GetDlgItem(hDialog, IDC_CLIENTS_CONNECTED),
                      pszConnectedClients);
        free(pszConnectedClients);
    }
        return TRUE;

    case WM_COMMAND:
        switch (LOWORD(wParam)) {
        case IDOK:
            /* Send message to call the GiveUp function */
            PostMessage(s_pScreenPriv->hwndScreen, WM_GIVEUP, 0, 0);
            DestroyWindow(g_hDlgExit);
            g_hDlgExit = NULL;

            /* Fix to make sure keyboard focus isn't trapped */
            PostMessage(s_pScreenPriv->hwndScreen, WM_NULL, 0, 0);
            return TRUE;

        case IDCANCEL:
            DestroyWindow(g_hDlgExit);
            g_hDlgExit = NULL;

            /* Fix to make sure keyboard focus isn't trapped */
            PostMessage(s_pScreenPriv->hwndScreen, WM_NULL, 0, 0);
            return TRUE;
        }
        break;

    case WM_MOUSEMOVE:
    case WM_NCMOUSEMOVE:
        /* Show the cursor if it is hidden */
        if (g_fSoftwareCursor && !g_fCursor) {
            g_fCursor = TRUE;
            ShowCursor(TRUE);
        }
        return TRUE;

    case WM_CLOSE:
        DestroyWindow(g_hDlgExit);
        g_hDlgExit = NULL;

        /* Fix to make sure keyboard focus isn't trapped */
        PostMessage(s_pScreenPriv->hwndScreen, WM_NULL, 0, 0);
        return TRUE;
    }

    return FALSE;
}

/*
 * Display the Depth Change dialog box
 */

void
winDisplayDepthChangeDialog(winPrivScreenPtr pScreenPriv)
{
    /* Check if dialog already exists */
    if (g_hDlgDepthChange != NULL) {
        /* Dialog box already exists, display it */
        ShowWindow(g_hDlgDepthChange, SW_SHOWDEFAULT);

        /* User has lost the dialog.  Show them where it is. */
        SetForegroundWindow(g_hDlgDepthChange);

        return;
    }

    /*
     * Display a notification to the user that the visual
     * will not be displayed until the Windows display depth
     * is restored to the original value.
     */
    g_hDlgDepthChange = CreateDialogParam(g_hInstance,
                                          "DEPTH_CHANGE_BOX",
                                          pScreenPriv->hwndScreen,
                                          winChangeDepthDlgProc,
                                          (LPARAM) pScreenPriv);
    /* Show the dialog box */
    ShowWindow(g_hDlgDepthChange, SW_SHOW);

    if (!g_hDlgDepthChange)
        ErrorF("winDisplayDepthChangeDialog - GetLastError: %d\n",
                (int) GetLastError());

    /* Minimize the display window */
    ShowWindow(pScreenPriv->hwndScreen, SW_MINIMIZE);
}

/*
 * Process messages for the dialog that is displayed for
 * disruptive screen depth changes.
 */

static INT_PTR CALLBACK
winChangeDepthDlgProc(HWND hwndDialog, UINT message,
                      WPARAM wParam, LPARAM lParam)
{
    static winPrivScreenPtr s_pScreenPriv = NULL;
    static winScreenInfo *s_pScreenInfo = NULL;

#if CYGDEBUG
    winDebug("winChangeDepthDlgProc\n");
#endif

    /* Branch on message type */
    switch (message) {
    case WM_INITDIALOG:
#if CYGDEBUG
        winDebug("winChangeDepthDlgProc - WM_INITDIALOG\n");
#endif

        /* Store pointers to private structures for future use */
        s_pScreenPriv = (winPrivScreenPtr) lParam;
        s_pScreenInfo = s_pScreenPriv->pScreenInfo;

#if CYGDEBUG
        winDebug("winChangeDepthDlgProc - WM_INITDIALOG - s_pScreenPriv: %p, "
                 "s_pScreenInfo: %p\n",
                 s_pScreenPriv, s_pScreenInfo);
#endif

#if CYGDEBUG
        winDebug("winChangeDepthDlgProc - WM_INITDIALOG - orig bpp: %u, "
                 "current bpp: %d\n",
                 (unsigned int)s_pScreenInfo->dwBPP,
                 GetDeviceCaps(s_pScreenPriv->hdcScreen, BITSPIXEL));
#endif

        winInitDialog(hwndDialog);

        return TRUE;

    case WM_DISPLAYCHANGE:
#if CYGDEBUG
        winDebug("winChangeDepthDlgProc - WM_DISPLAYCHANGE - orig bpp: %u, "
                 "new bpp: %d\n",
                 (unsigned int)s_pScreenInfo->dwBPP,
                 GetDeviceCaps(s_pScreenPriv->hdcScreen, BITSPIXEL));
#endif

        /* Dismiss the dialog if the display returns to the original depth */
        if (GetDeviceCaps(s_pScreenPriv->hdcScreen, BITSPIXEL) ==
            s_pScreenInfo->dwBPP) {
            ErrorF("winChangeDelthDlgProc - wParam == s_pScreenInfo->dwBPP\n");

            /* Depth has been restored, dismiss dialog */
            DestroyWindow(g_hDlgDepthChange);
            g_hDlgDepthChange = NULL;

            /* Flag that we have a valid screen depth */
            s_pScreenPriv->fBadDepth = FALSE;
        }
        return TRUE;

    case WM_COMMAND:
        switch (LOWORD(wParam)) {
        case IDOK:
        case IDCANCEL:
            winDebug("winChangeDepthDlgProc - WM_COMMAND - IDOK or IDCANCEL\n");

            /*
             * User dismissed the dialog, hide it until the
             * display mode is restored.
             */
            ShowWindow(g_hDlgDepthChange, SW_HIDE);
            return TRUE;
        }
        break;

    case WM_CLOSE:
        winDebug("winChangeDepthDlgProc - WM_CLOSE\n");

        DestroyWindow(g_hDlgAbout);
        g_hDlgAbout = NULL;

        /* Fix to make sure keyboard focus isn't trapped */
        PostMessage(s_pScreenPriv->hwndScreen, WM_NULL, 0, 0);
        return TRUE;
    }

    return FALSE;
}

/*
 * Display the About dialog box
 */

void
winDisplayAboutDialog(winPrivScreenPtr pScreenPriv)
{
    /* Check if dialog already exists */
    if (g_hDlgAbout != NULL) {
        /* Dialog box already exists, display it */
        ShowWindow(g_hDlgAbout, SW_SHOWDEFAULT);

        /* User has lost the dialog.  Show them where it is. */
        SetForegroundWindow(g_hDlgAbout);

        return;
    }

    /*
     * Display the about box
     */
    g_hDlgAbout = CreateDialogParam(g_hInstance,
                                    "ABOUT_BOX",
                                    pScreenPriv->hwndScreen,
                                    winAboutDlgProc, (LPARAM) pScreenPriv);

    /* Show the dialog box */
    ShowWindow(g_hDlgAbout, SW_SHOW);

    /* Needed to get keyboard controls (tab, arrows, enter, esc) to work */
    SetForegroundWindow(g_hDlgAbout);

    /* Set focus to the OK button */
    PostMessage(g_hDlgAbout, WM_NEXTDLGCTL,
                (WPARAM) GetDlgItem(g_hDlgAbout, IDOK), TRUE);
}

/*
 * Process messages for the about dialog.
 */

static INT_PTR CALLBACK
winAboutDlgProc(HWND hwndDialog, UINT message, WPARAM wParam, LPARAM lParam)
{
    static winPrivScreenPtr s_pScreenPriv = NULL;

#if CYGDEBUG
    winDebug("winAboutDlgProc\n");
#endif

    /* Branch on message type */
    switch (message) {
    case WM_INITDIALOG:
#if CYGDEBUG
        winDebug("winAboutDlgProc - WM_INITDIALOG\n");
#endif

        /* Store pointer to private structure for future use */
        s_pScreenPriv = (winPrivScreenPtr) lParam;

        winInitDialog(hwndDialog);

        /* Override the URL buttons */
        winOverrideURLButton(hwndDialog, ID_ABOUT_WEBSITE);

        return TRUE;

    case WM_DRAWITEM:
        /* Draw the URL buttons as needed */
        winDrawURLWindow(lParam);
        return TRUE;

    case WM_MOUSEMOVE:
    case WM_NCMOUSEMOVE:
        /* Show the cursor if it is hidden */
        if (g_fSoftwareCursor && !g_fCursor) {
            g_fCursor = TRUE;
            ShowCursor(TRUE);
        }
        return TRUE;

    case WM_COMMAND:
        switch (LOWORD(wParam)) {
        case IDOK:
        case IDCANCEL:
            winDebug("winAboutDlgProc - WM_COMMAND - IDOK or IDCANCEL\n");

            DestroyWindow(g_hDlgAbout);
            g_hDlgAbout = NULL;

            /* Fix to make sure keyboard focus isn't trapped */
            PostMessage(s_pScreenPriv->hwndScreen, WM_NULL, 0, 0);

            /* Restore window procedures for URL buttons */
            winUnoverrideURLButton(hwndDialog, ID_ABOUT_WEBSITE);

            return TRUE;

        case ID_ABOUT_WEBSITE:
        {
            const char *pszPath = __VENDORDWEBSUPPORT__;
            INT_PTR iReturn;

            iReturn = (INT_PTR) ShellExecute(NULL,
                                         "open",
                                         pszPath, NULL, NULL, SW_MAXIMIZE);
            if (iReturn < 32) {
                ErrorF("winAboutDlgProc - WM_COMMAND - ID_ABOUT_WEBSITE - "
                       "ShellExecute failed: %d\n", (int)iReturn);

            }
        }
            return TRUE;
        }
        break;

    case WM_CLOSE:
        winDebug("winAboutDlgProc - WM_CLOSE\n");

        DestroyWindow(g_hDlgAbout);
        g_hDlgAbout = NULL;

        /* Fix to make sure keyboard focus isn't trapped */
        PostMessage(s_pScreenPriv->hwndScreen, WM_NULL, 0, 0);

        /* Restore window procedures for URL buttons */
        winUnoverrideURLButton(hwndDialog, ID_ABOUT_WEBSITE);

        return TRUE;
    }

    return FALSE;
}