From 79af7a3035aee0515128033a6b0af599d1a29801 Mon Sep 17 00:00:00 2001 From: redman Date: Wed, 10 Mar 1999 19:29:24 +0000 Subject: Backported "focus -force" patch from 8.1. --- win/tkWinInt.h | 3 ++- win/tkWinPointer.c | 4 ++-- win/tkWinWm.c | 33 ++++++++++++++++++++++++++++++++- 3 files changed, 36 insertions(+), 4 deletions(-) diff --git a/win/tkWinInt.h b/win/tkWinInt.h index b1ab878..816e483 100644 --- a/win/tkWinInt.h +++ b/win/tkWinInt.h @@ -10,7 +10,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkWinInt.h,v 1.4 1999/03/10 07:04:46 stanton Exp $ + * RCS: @(#) $Id: tkWinInt.h,v 1.5 1999/03/10 19:29:24 redman Exp $ */ #ifndef _TKWININT @@ -148,6 +148,7 @@ extern int tkpWinRopModes[]; #include "tkIntPlatDecls.h" +extern void TkWinSetForegroundWindow(TkWindow *winPtr); extern LRESULT CALLBACK TkWinChildProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam); diff --git a/win/tkWinPointer.c b/win/tkWinPointer.c index e9c94be..289ff4b 100644 --- a/win/tkWinPointer.c +++ b/win/tkWinPointer.c @@ -8,7 +8,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkWinPointer.c,v 1.4 1999/02/04 21:00:57 stanton Exp $ + * RCS: @(#) $Id: tkWinPointer.c,v 1.5 1999/03/10 19:29:24 redman Exp $ */ #include "tkWinInt.h" @@ -441,7 +441,7 @@ TkpChangeFocus(winPtr, force) */ if (force) { - SetForegroundWindow(Tk_GetHWND(winPtr->window)); + TkWinSetForegroundWindow(winPtr); } XSetInputFocus(dispPtr->display, winPtr->window, RevertToParent, CurrentTime); diff --git a/win/tkWinWm.c b/win/tkWinWm.c index 98414e2..a0ed0ae 100644 --- a/win/tkWinWm.c +++ b/win/tkWinWm.c @@ -12,7 +12,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkWinWm.c,v 1.6 1999/02/04 21:01:46 stanton Exp $ + * RCS: @(#) $Id: tkWinWm.c,v 1.7 1999/03/10 19:29:24 redman Exp $ */ #include "tkWinInt.h" @@ -4235,3 +4235,34 @@ ActivateWindow( return 1; } + +/* + *---------------------------------------------------------------------- + * + * TkWinSetForegroundWindow -- + * + * This function is a wrapper for SetForegroundWindow, calling + * it on the wrapper window because it has no affect on child + * windows. + * + * Results: + * none + * + * Side effects: + * May activate the toplevel window. + * + *---------------------------------------------------------------------- + */ + +void +TkWinSetForegroundWindow(winPtr) + TkWindow *winPtr; +{ + register WmInfo *wmPtr = winPtr->wmInfoPtr; + + if (wmPtr->wrapper != NULL) { + SetForegroundWindow(wmPtr->wrapper); + } else { + SetForegroundWindow(Tk_GetHWND(winPtr->window)); + } +} -- cgit v0.12