Ignore:
Timestamp:
Feb 15, 2001, 1:33:01 AM (25 years ago)
Author:
sandervl
Message:

SetFocus fixes during WM_SETFOCUS

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/user32/window.cpp

    r5060 r5137  
    1 /* $Id: window.cpp,v 1.87 2001-02-03 18:52:02 sandervl Exp $ */
     1/* $Id: window.cpp,v 1.88 2001-02-15 00:33:01 sandervl Exp $ */
    22/*
    33 * Win32 window apis for OS/2
     
    3434#include "user32.h"
    3535#include "winicon.h"
     36#include "oslibmsg.h"
    3637#include <win\winpos.h>
    3738#include <win\win.h>
     
    668669HWND WIN32API SetFocus (HWND hwnd)
    669670{
    670     HWND lastFocus, lastFocus_W, hwnd_O;
    671     BOOL activate;
     671 HWND lastFocus, lastFocus_W, hwnd_O;
     672 BOOL activate;
     673 TEB *teb;
     674
     675    teb = GetThreadTEB();
     676    if(teb == NULL) {
     677        DebugInt3();
     678        return 0;
     679    }
    672680
    673681    hwnd_O    = Win32ToOS2Handle (hwnd);
     
    678686    dprintf(("SetFocus %x (%x) -> %x (%x)\n", lastFocus_W, lastFocus, hwnd, hwnd_O));
    679687
     688    //PM doesn't allow SetFocus calls during WM_SETFOCUS message processing;
     689    //must delay this function call
     690    if(teb->o.odin.fWM_SETFOCUS) {
     691        dprintf(("USER32: Delay SetFocus call!"));
     692        teb->o.odin.hwndFocus = hwnd;
     693        //mp1 = win32 window handle
     694        //mp2 = activate flag
     695        OSLibPostMessageDirect(hwnd_O, WIN32APP_SETFOCUSMSG, hwnd, activate);
     696        return lastFocus_W;
     697    }
    680698    return (OSLibWinSetFocus (OSLIB_HWND_DESKTOP, hwnd_O, activate)) ? lastFocus_W : 0;
    681699}
     
    684702HWND WIN32API GetFocus(void)
    685703{
    686     HWND hwnd;
     704 TEB *teb;
     705 HWND hwnd;
     706
     707    teb = GetThreadTEB();
     708    if(teb == NULL) {
     709        DebugInt3();
     710        return 0;
     711    }
     712    //PM doesn't allow SetFocus calls during WM_SETFOCUS message processing;
     713    //If focus was changed during WM_SETFOCUS, the focus window handle is
     714    //stored in teb->o.odin.hwndFocus (set back to 0 when delayed SetFocus
     715    //is activated)
     716    if(teb->o.odin.hwndFocus) {
     717        dprintf(("USER32: GetFocus %x (DURING WM_SETFOCUS PROCESSING)", teb->o.odin.hwndFocus));
     718        return teb->o.odin.hwndFocus;
     719    }
    687720
    688721    hwnd = OSLibWinQueryFocus(OSLIB_HWND_DESKTOP);
Note: See TracChangeset for help on using the changeset viewer.