From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6170 invoked by alias); 13 Aug 2011 18:39:37 -0000 Received: (qmail 6162 invoked by uid 22791); 13 Aug 2011 18:39:36 -0000 X-SWARE-Spam-Status: No, hits=1.1 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: sourceware.org Received: from mailout-de.gmx.net (HELO mailout-de.gmx.net) (213.165.64.23) by sourceware.org (qpsmtpd/0.43rc1) with SMTP; Sat, 13 Aug 2011 18:39:14 +0000 Received: (qmail invoked by alias); 13 Aug 2011 18:39:12 -0000 Received: from p5B08C50B.dip0.t-ipconnect.de (EHLO [192.168.178.23]) [91.8.197.11] by mail.gmx.net (mp015) with SMTP; 13 Aug 2011 20:39:12 +0200 Message-ID: <4E46C4CE.6000206@gmx.de> Date: Sat, 13 Aug 2011 18:39:00 -0000 From: Oliver Schmidt User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-GB; rv:1.9.2.18) Gecko/20110616 Mnenhy/0.8.2 Thunderbird/3.1.11 MIME-Version: 1.0 To: cygwin-xfree@cygwin.com Subject: XRaiseWindow for activating windows in multiwindow mode Content-Type: multipart/mixed; boundary="------------090209010106000006070700" X-IsSubscribed: yes Mailing-List: contact cygwin-xfree-help@cygwin.com; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-xfree-owner@cygwin.com Reply-To: cygwin-xfree@cygwin.com Mail-Followup-To: cygwin-xfree@cygwin.com X-SW-Source: 2011-08/txt/msg00034.txt.bz2 --------------090209010106000006070700 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-length: 2076 Hi, as reported in http://www.cygwin.com/ml/cygwin-xfree/2005-06/msg00072.html windows are not raised from the Cygwin X Server in multiwindow mode, if a program wants to programmatically activate a window. I played around and figured out that the problem can be solved by invoking the windows function SetForegroundWindow if a top level window is to be restacked and has no previous sibling. I enclose the patch in this email. It works fine for me, but I'm not sure if it has any side effects for other configurations or usage patterns. It would be nice if this feature could be integrated into future versions of the Cygwin X Server. Best regards, Oliver diff --git a/hw/xwin/winmultiwindowwindow.c b/hw/xwin/winmultiwindowwindow.c index 956a9a5..22390b3 100644 --- a/hw/xwin/winmultiwindowwindow.c +++ b/hw/xwin/winmultiwindowwindow.c @@ -465,6 +465,7 @@ winRestackWindowMultiWindow (WindowPtr pWin, WindowPtr pOldNextSib) HWND hInsertAfter; HWND hWnd = NULL; #endif + static Bool fRestacking = FALSE; /* Avoid recusive calls to this function */ ScreenPtr pScreen = pWin->drawable.pScreen; winScreenPriv(pScreen); @@ -472,10 +473,27 @@ winRestackWindowMultiWindow (WindowPtr pWin, WindowPtr pOldNextSib) winTrace ("winRestackMultiWindow - %08x\n", pWin); #endif + if (fRestacking) + { + /* It is a recusive call so immediately exit */ +#if CYGWINDOWING_DEBUG + ErrorF ("winRestackWindowMultiWindow - " + "exit because fRestacking == TRUE\n"); +#endif + return; + } + fRestacking = TRUE; + WIN_UNWRAP(RestackWindow); if (pScreen->RestackWindow) (*pScreen->RestackWindow)(pWin, pOldNextSib); WIN_WRAP(RestackWindow, winRestackWindowMultiWindow); + + if (isToplevelWindow(pWin) && pWin->prevSib == NULL) + { + winWindowPriv(pWin); + SetForegroundWindow(pWinPriv->hWnd); + } #if 1 /* @@ -538,6 +556,8 @@ winRestackWindowMultiWindow (WindowPtr pWin, WindowPtr pOldNextSib) 0, 0, uFlags); #endif + + fRestacking = FALSE; } static void --------------090209010106000006070700 Content-Type: text/plain; name="patch.txt" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="patch.txt" Content-length: 1405 diff --git a/hw/xwin/winmultiwindowwindow.c b/hw/xwin/winmultiwindowwindow.c index 956a9a5..22390b3 100644 --- a/hw/xwin/winmultiwindowwindow.c +++ b/hw/xwin/winmultiwindowwindow.c @@ -465,6 +465,7 @@ winRestackWindowMultiWindow (WindowPtr pWin, WindowPtr pOldNextSib) HWND hInsertAfter; HWND hWnd = NULL; #endif + static Bool fRestacking = FALSE; /* Avoid recusive calls to this function */ ScreenPtr pScreen = pWin->drawable.pScreen; winScreenPriv(pScreen); @@ -472,10 +473,27 @@ winRestackWindowMultiWindow (WindowPtr pWin, WindowPtr pOldNextSib) winTrace ("winRestackMultiWindow - %08x\n", pWin); #endif + if (fRestacking) + { + /* It is a recusive call so immediately exit */ +#if CYGWINDOWING_DEBUG + ErrorF ("winRestackWindowMultiWindow - " + "exit because fRestacking == TRUE\n"); +#endif + return; + } + fRestacking = TRUE; + WIN_UNWRAP(RestackWindow); if (pScreen->RestackWindow) (*pScreen->RestackWindow)(pWin, pOldNextSib); WIN_WRAP(RestackWindow, winRestackWindowMultiWindow); + + if (isToplevelWindow(pWin) && pWin->prevSib == NULL) + { + winWindowPriv(pWin); + SetForegroundWindow(pWinPriv->hWnd); + } #if 1 /* @@ -538,6 +556,8 @@ winRestackWindowMultiWindow (WindowPtr pWin, WindowPtr pOldNextSib) 0, 0, uFlags); #endif + + fRestacking = FALSE; } static void --------------090209010106000006070700 Content-Type: text/plain; charset=us-ascii Content-length: 223 -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://x.cygwin.com/docs/ FAQ: http://x.cygwin.com/docs/faq/ --------------090209010106000006070700--