United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
JDK-4449624 : requestFocus() does not work well when window is iconized and recovering

Details
Type:
Bug
Submit Date:
2001-04-24
Status:
Closed
Updated Date:
2001-10-19
Project Name:
JDK
Resolved Date:
2001-07-02
Component:
client-libs
OS:
windows_nt
Sub-Component:
java.awt
CPU:
x86
Priority:
P3
Resolution:
Fixed
Affected Versions:
1.3.1
Fixed Versions:
1.3.0_04 (04)

Related Reports
Backport:
Relates:
Relates:

Sub Tasks

Description
requestFocus() does notwrok correctly after window is iconized and recovering.
This issue happens with JDK1.3.0_02 and JDK1.3.1-b22, but does not occur with
JDK1.4-b60.

1. how to repoduce

  1) Compile the attached program
  2) Invoke the command "appletviewer Iconize.html"
    -> You can see the pane which has the button, "DISPLAY WINDOW"
  3) Click the button
    -> You can see another window which has RED square
       and the tittle "Java Applet Window" at the bottom.
  4) Click iconizing button.
    -> the windows wiil be iconized and the icon will show up 
       on the task bar.
  5) Click the icon on the task bar
    -> the window will recover.

  At the 5th step, we expect the square becomes RED, but actually BLUE with
  JDK1.3.0_02 and JDK1.3.1-b22.
  (When the "Java Applet Window" gets focus, the square turns RED.
   and losts focus, that turns BLUE.)

  I recommend to execute this program with JDK1.4-b60 in order to know 
  the correct behavior.


2. Configration

  MPU : Pentium III 400[MHz]
  Mem.: 256[MHz]
  OS  : WindowsNT 4.0 (SP5, Japanese)
  JDK. Ver : 
   -JDk1.3.0_02
     java version "1.3.0_02"
     Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0_02)
     Java HotSpot(TM) Client VM (build 1.3.0_02, mixed mode)
      
   -JDK1.3.1-b22
     java version "1.3.1-rc2"
     Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.1-rc2-b22)
     Java HotSpot(TM) Client VM (build 1.3.1-rc2-b22, mixed mode)

                                    

Comments
CONVERTED DATA

BugTraq+ Release Management Values

COMMIT TO FIX:
1.3.0_04
1.3.1_01

FIXED IN:
1.3.0_04
1.3.1_01

INTEGRATED IN:
1.3.0_04
1.3.1_01

VERIFIED IN:
1.3.0_04
1.3.1_01a


                                     
2004-06-14
PUBLIC COMMENTS

CTE verified it worked fine in jdk1.3.0_04. Tests passed, except there is one known problem. Please see bug 4233658.

                                     
2004-06-10
SUGGESTED FIX

See Suggested Fix of bug #4380809
hao.dong@eng 2001-05-02



*** /src/win32/native/sun/windows/awt_Component.h-   Tue Jun 12 18:16:42 2001
--- awt_Component.h     Tue Jun 12 18:14:23 2001

*** 551,560 ****
--- 551,563 ----
      jint m_drawState;
  
      // Cache for FindComponent
      static HWND sm_cursorOn;
  
+     //for bug 4449624
+     BOOL m_skipNextSetFocus;
+ 
  private:
      /*
       * The association list of children's IDs and corresponding components. 

*** /src/win32/native/sun/windows/awt_Component.cpp- Tue Jun 12 18:16:43 2001
--- awt_Component.cpp   Tue Jun 12 18:14:25 2001

*** 141,150 ****
--- 141,152 ----
      m_useNativeCompWindow = TRUE;
  
      m_drawState = (jint)JAWT_LOCK_SURFACE_CHANGED |
          (jint)JAWT_LOCK_BOUNDS_CHANGED |
          (jint)JAWT_LOCK_CLIP_CHANGED;
+ 
+     m_skipNextSetFocus = FALSE;
  }
  
  AwtComponent::~AwtComponent()
  {
      CriticalSection::Lock l(GetLock());


*** 880,898 ****
        case WM_EXITMENULOOP:
          mr = WmExitMenuLoop((BOOL)wParam);
            g_bMenuLoop = FALSE;
            break;     
  
!       case WM_SETFOCUS:   mr = WmSetFocus((HWND)wParam); break;
        case WM_KILLFOCUS:  mr = WmKillFocus((HWND)wParam); break;
        case WM_ACTIVATE:   
-           mr = WmActivate(LOWORD(wParam), (BOOL)HIWORD(wParam)); 
          {
            if( WA_ACTIVE == (UINT)(LOWORD(wParam)) ) {
              AwtToolkit::GetInstance().UpdateThemesStatus();
            }
          }
          break;
  
  #if defined(WIN32)
        case WM_CTLCOLORMSGBOX:
        case WM_CTLCOLOREDIT:
--- 882,915 ----
        case WM_EXITMENULOOP:
          mr = WmExitMenuLoop((BOOL)wParam);
            g_bMenuLoop = FALSE;
            break;     
  
!       case WM_SETFOCUS:   
!       if (!m_skipNextSetFocus)
!         mr = WmSetFocus((HWND)wParam); 
!       m_skipNextSetFocus = FALSE;
!       break;
        case WM_KILLFOCUS:  mr = WmKillFocus((HWND)wParam); break;
        case WM_ACTIVATE:   
        {
+         UINT nState = LOWORD(wParam);
+         BOOL fMinimized = (BOOL)HIWORD(wParam);
+         if (!fMinimized || (WA_INACTIVE == nState)) {
+           mr = WmActivate(nState, fMinimized);
+         }
+         else {
+           m_skipNextSetFocus = TRUE;
+           mr = mrConsume;
+         }
+ 
+         {
            if( WA_ACTIVE == (UINT)(LOWORD(wParam)) ) {
              AwtToolkit::GetInstance().UpdateThemesStatus();
            }
          }
+       }
        break;
        
  #if defined(WIN32)
        case WM_CTLCOLORMSGBOX:
        case WM_CTLCOLOREDIT:


hao.dong@eng 2001-06-20
                                     
2001-06-20
EVALUATION

Exactly, this is  bug in 1.3 and earlier releases that is fixed in Merlin.  No plans to fix in Ladybird.
richard.ray@eng 2001-04-24

This bug probably is a duplicate of bug 4380809
hao.dong@eng 2001-05-02
                                     
2001-04-24



Hardware and Software, Engineered to Work Together