Tk Source Code

View Ticket
Login
Ticket UUID: 220349
Title: focus -force works poorly on Windows
Type: Bug Version: obsolete: 8.0p2
Submitter: welch Created on: 2000-10-31 23:15:05
Subsystem: 68. Win Window Operations Assigned To: nobody
Priority: 2 Severity:
Status: Closed Last Modified: 2001-03-23 08:56:37
Resolution: Fixed Closed By: dgp
    Closed on: 2001-03-23 01:56:37
Description:
OriginalBugID: 587 Bug
Version: 8.0p2
SubmitDate: '1998-05-21'
LastModified: '1998-06-12'
Severity: LOW
Status: Released
Submitter: stanton
ChangedBy: stanton
OS: All Windows
OSVersion: NA
Machine: NA
FixedInVersion: NA
ClosedDate: '1998-06-12'


With Tk8.0p2 and Tk8.1a2 on Windows, the focus -force option only
calls SetFocus.  This is OK, but when focus -force is used in practice
on Windows I think the user really wants to make the window the new
foreground window, particularly since Tk doesn't provide any other
mechanism to set the foreground window.

The appended patch implements this suggested change.

Ian Taylor
[email protected]


*** /5g/ian/tk8.0p2/win/tkWinPointer.c  Fri Oct 31 11:40:05 1997
--- tkWinPointer.c      Wed Apr 15 15:13:30 1998
*************** TkpChangeFocus(winPtr, force)
*** 409,414 ****
--- 409,419 ----
      if (winPtr->window == None) {
        panic("ChangeXFocus got null X window");
      }
+ 
+     if (force) {
+       SetForegroundWindow(Tk_GetHWND(winPtr->window));
+     }
+ 
      XSetInputFocus(dispPtr->display, winPtr->window, RevertToParent,
            CurrentTime);
  



The supplied patch seems to work correctly, so I have integrated it. (SS)