public inbox for cygwin-xfree@sourceware.org help / color / mirror / Atom feed
From: "Earle F. Philhower III" <earle@ziplabel.com> To: cygwin-xfree@cygwin.com Subject: Patch for centering exit/mode change dialogs on multiscreen Date: Tue, 27 Jan 2004 04:04:00 -0000 [thread overview] Message-ID: <5.1.1.6.2.20040126193430.00af97a0@mail.ziplabel.com> (raw) [-- Attachment #1: Type: text/plain, Size: 538 bytes --] It seems that the DS_CENTER property only centers a dialog onto the 1st detected monitor, and not the primary monitor (selected in Desktop props). At my office the two are the same, but on my home setup my center DVI monitor is detected as #3... I'm attaching a minor patchfile which programmatically centers the dialog during the WM_INITDIALOG stage using a pretty standard center() function for the exit and mode change dialogs. -Earle F. Philhower, III earle@ziplabel.com cdrlabel - ZipLabel - FlpLabel http://www.cdrlabel.com [-- Attachment #2: centermultiscreen.patch --] [-- Type: application/octet-stream, Size: 1321 bytes --] --- xwin.cvs/windialogs.c 2004-01-25 19:04:11.265625000 -0800 +++ xwin/windialogs.c 2004-01-26 18:29:04.734375000 -0800 @@ -43,6 +43,36 @@ /* + * Center a dialog window in the desktop window + */ +static void +winCenterDialog (HWND hwndDlg) +{ + HWND hwndDesk; + RECT rc, rcDlg, rcDesk; + + hwndDesk = GetParent (hwndDlg); + if (!hwndDesk) + hwndDesk = GetDesktopWindow (); + + 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_TOP, + rcDesk.left + (rc.right / 2), + rcDesk.top + (rc.bottom / 2), + 0, 0, + SWP_NOSIZE | SWP_NOZORDER); +} + + +/* * Display the Exit dialog box */ @@ -110,6 +140,8 @@ s_pScreenInfo = s_pScreenPriv->pScreenInfo; s_pScreen = s_pScreenInfo->pScreen; + winCenterDialog( hDialog ); + /* Set icon to standard app icon */ PostMessage (hDialog, WM_SETICON, @@ -258,6 +290,8 @@ s_pScreenInfo->dwBPP, s_pScreenPriv->dwLastWindowsBitsPixel); #endif + + winCenterDialog( hwndDialog ); /* Set icon to standard app icon */ PostMessage (hwndDialog,
reply other threads:[~2004-01-27 4:04 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=5.1.1.6.2.20040126193430.00af97a0@mail.ziplabel.com \ --to=earle@ziplabel.com \ --cc=cygwin-xfree@cygwin.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).