Changeset 5137 for trunk/src


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

SetFocus fixes during WM_SETFOCUS

Location:
trunk/src/user32
Files:
5 edited

Legend:

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

    r4848 r5137  
    1 /* $Id: oslibmsg.cpp,v 1.35 2000-12-29 18:39:58 sandervl Exp $ */
     1/* $Id: oslibmsg.cpp,v 1.36 2001-02-15 00:33:01 sandervl Exp $ */
    22/*
    33 * Window message translation functions for OS/2
     
    457457}
    458458//******************************************************************************
     459//Direct posting of messages that must remain invisible to the win32 app
     460//******************************************************************************
     461BOOL OSLibPostMessageDirect(HWND hwnd, ULONG msg, ULONG wParam, ULONG lParam)
     462{
     463    return WinPostMsg(hwnd, msg, (MPARAM)wParam, (MPARAM)lParam);
     464}
     465//******************************************************************************
    459466BOOL    _System _O32_PostThreadMessage( DWORD, UINT, WPARAM, LPARAM );
    460467
  • trunk/src/user32/oslibmsg.h

    r3525 r5137  
    1 /* $Id: oslibmsg.h,v 1.13 2000-05-12 18:09:40 sandervl Exp $ */
     1/* $Id: oslibmsg.h,v 1.14 2001-02-15 00:33:01 sandervl Exp $ */
    22/*
    33 * Window message translation functions for OS/2
     
    4444ULONG OSLibSendMessage(HWND hwnd, ULONG msg, ULONG wParam, ULONG lParam, BOOL fUnicode);
    4545ULONG OSLibWinBroadcastMsg(ULONG msg, ULONG wParam, ULONG lParam, BOOL fSend);
     46
     47//Direct posting of messages that must remain invisible to the win32 app
     48BOOL OSLibPostMessageDirect(HWND hwnd, ULONG msg, ULONG wParam, ULONG lParam);
    4649
    4750#define WINWM_NULL                  0x0000
  • trunk/src/user32/pmwindow.cpp

    r4945 r5137  
    1 /* $Id: pmwindow.cpp,v 1.112 2001-01-14 17:15:46 sandervl Exp $ */
     1/* $Id: pmwindow.cpp,v 1.113 2001-02-15 00:33:01 sandervl Exp $ */
    22/*
    33 * Win32 Window Managment Code for OS/2
     
    2121#include <string.h>
    2222#include <win32type.h>
     23#include <win32api.h>
    2324#include <winconst.h>
    2425#include <winuser32.h>
     
    219220        }
    220221  }
     222  else
     223  if(msg == WIN32APP_SETFOCUSMSG) {
     224      //PM doesn't allow SetFocus calls during WM_SETFOCUS message processing;
     225      //must delay this function call
     226      //mp1 = win32 window handle
     227      //mp2 = activate flag
     228      dprintf(("USER32: Delayed SetFocus %x call!", mp1));
     229      teb->o.odin.hwndFocus = 0;
     230      WinFocusChange(HWND_DESKTOP, hwnd, mp2 ? FC_NOLOSEACTIVE : 0);
     231  }
    221232
    222233  switch( msg )
     
    282293        if (win32wnd->IsModalDialogOwner())
    283294        {
     295            dprintf(("win32wnd->IsModalDialogOwner %x", win32wnd->getWindowHandle()));
    284296            pswp->fl |= SWP_ZORDER;
    285297            pswp->hwndInsertBehind = win32wnd->getOS2HwndModalDialog();
     
    584596    {
    585597      HWND hwndFocus = (HWND)mp1;
    586 
     598       
    587599        dprintf(("OS2: WM_SETFOCUS %x %x (%x) %d", win32wnd->getWindowHandle(), mp1, OS2ToWin32Handle(hwndFocus), mp2));
     600
     601        //PM doesn't allow SetFocus calls during WM_SETFOCUS message processing;
     602        //must delay this function call
     603
     604        teb->o.odin.fWM_SETFOCUS = TRUE;
     605        teb->o.odin.hwndFocus    = 0;
    588606        if(WinQueryWindowULong(hwndFocus, OFFSET_WIN32PM_MAGIC) != WIN32PM_MAGIC) {
    589607                //another (non-win32) application's window
     
    597615        }
    598616        else win32wnd->MsgKillFocus(OS2ToWin32Handle(hwndFocus));
     617        teb->o.odin.fWM_SETFOCUS = FALSE;
     618
    599619        break;
    600620    }
     
    12001220        }
    12011221        else {
    1202             WinSetWindowPos(win32wnd->getOS2WindowHandle(),
    1203                                         0, track.rclTrack.xLeft, track.rclTrack.yBottom,
    1204                                         track.rclTrack.xRight - track.rclTrack.xLeft,
    1205                                         track.rclTrack.yTop - track.rclTrack.yBottom,
    1206                                         SWP_SIZE|SWP_MOVE);
     1222              SetWindowPos(win32wnd->getWindowHandle(), 0, track.rclTrack.xLeft,
     1223                           parentHeight - track.rclTrack.yTop,
     1224                           track.rclTrack.xRight - track.rclTrack.xLeft,
     1225                           track.rclTrack.yTop - track.rclTrack.yBottom,
     1226                           SWP_NOACTIVATE_W | SWP_NOZORDER_W | SWP_NOACTIVATE_W);
     1227//            WinSetWindowPos(win32wnd->getOS2WindowHandle(),
     1228//                                        0, track.rclTrack.xLeft, track.rclTrack.yBottom,
     1229//                                        track.rclTrack.xRight - track.rclTrack.xLeft,
     1230//                                        track.rclTrack.yTop - track.rclTrack.yBottom,
     1231//                                        SWP_SIZE|SWP_MOVE);
    12071232        }
    12081233        }
  • trunk/src/user32/win32wbase.h

    r4925 r5137  
    1 /* $Id: win32wbase.h,v 1.103 2001-01-10 20:39:15 sandervl Exp $ */
     1/* $Id: win32wbase.h,v 1.104 2001-02-15 00:33:01 sandervl Exp $ */
    22/*
    33 * Win32 Window Base Class for OS/2
     
    4949#define OPEN32_MSGDIFF            0xC00
    5050#define WIN32APP_POSTMSG          (0x1000+OPEN32_MSGDIFF)
     51
     52//PM doesn't allow SetFocus during WM_SETFOCUS message processing; must delay
     53//this by posting a message
     54#define WIN32APP_SETFOCUSMSG      (0x1001+OPEN32_MSGDIFF)
    5155
    5256#define WIN32MSG_MAGICA           0x12345678
  • 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.