Changeset 8416 for trunk/src


Ignore:
Timestamp:
May 15, 2002, 12:58:07 PM (23 years ago)
Author:
sandervl
Message:

Made mouse code reentrant

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/dinput/mouse.c

    r8348 r8416  
    117117        CRITICAL_SECTION                crit;
    118118
     119#ifdef __WIN32OS2__
     120        char                            hookcode[32];
     121#endif
     122
    119123        /* This is for mouse reporting. */
    120124        Wine_InternalMouseData          m_state;
     
    218222        ICOM_THIS(SysMouseAImpl,iface);
    219223
     224#ifdef __WIN32OS2__
     225        dprintf(("SysMouseAImpl_Release %x", This));
     226#endif
     227
    220228        This->ref--;
    221229        if (This->ref)
     
    316324 
    317325/* low-level mouse hook */
     326#ifdef __WIN32OS2__
     327static LRESULT CALLBACK dinput_mouse_hook(SysMouseAImpl* This, int code, WPARAM wparam, LPARAM lparam )
     328#else
    318329static LRESULT CALLBACK dinput_mouse_hook( int code, WPARAM wparam, LPARAM lparam )
     330#endif
    319331{
    320332    LRESULT ret;
    321333    MSLLHOOKSTRUCT *hook = (MSLLHOOKSTRUCT *)lparam;
     334#ifndef __WIN32OS2__
    322335    SysMouseAImpl* This = (SysMouseAImpl*) current_lock;
     336#endif
    323337
    324338//testestest
     
    440454  ICOM_THIS(SysMouseAImpl,iface);
    441455  RECT  rect;
    442  
     456
     457#ifdef __WIN32OS2__
     458  dprintf(("SysMouseAImpl_Acquire %x", This));
     459#else 
    443460  TRACE("(this=%p)\n",This);
    444 
     461#endif
    445462  if (This->acquired == 0) {
    446463    POINT point;
     
    465482
    466483    /* Install our mouse hook */
     484#ifdef __WIN32OS2__
     485    //push ebp
     486    This->hookcode[0]  = 0x55;
     487    //mov  ebp, esp
     488    This->hookcode[1]  = 0x8B; This->hookcode[2]  = 0xEC;
     489    //push [ebp+16]
     490    This->hookcode[3]  = 0xFF; This->hookcode[4]  = 0x75; This->hookcode[5]  = 0x10;
     491    //push [ebp+12]
     492    This->hookcode[6]  = 0xFF; This->hookcode[7]  = 0x75; This->hookcode[8]  = 0x0C;
     493    //push [ebp+8]
     494    This->hookcode[9]  = 0xFF; This->hookcode[10] = 0x75; This->hookcode[11] = 0x08;
     495    //push This
     496    This->hookcode[12] = 0x68; *(DWORD *)&This->hookcode[13]  = (DWORD)This;
     497    //mov  eax, dinput_mouse_hook
     498    This->hookcode[17] = 0xB8; *(DWORD *)&This->hookcode[18]  = (DWORD)&dinput_mouse_hook;
     499    //call eax
     500    This->hookcode[22] = 0xFF; This->hookcode[23]  = 0xD0;
     501    //pop  ebp
     502    This->hookcode[24] = 0x5D;
     503    //ret  12
     504    This->hookcode[25] = 0xC2; *(WORD *)&This->hookcode[26]  = 0x000C;
     505
     506    This->hook = SetWindowsHookExW( WH_MOUSE_LL, (HOOKPROC)This->hookcode, 0, 0 );
     507#else
    467508    This->hook = SetWindowsHookExW( WH_MOUSE_LL, dinput_mouse_hook, 0, 0 );
     509#endif
    468510
    469511    /* Get the window dimension and find the center */
     
    472514    This->win_centerY = (rect.bottom - rect.top ) / 2;
    473515
     516#ifndef __WIN32OS2__
    474517    /* Warp the mouse to the center of the window */
    475518    if (This->absolute == 0) {
     
    485528#endif
    486529    }
    487 
     530#endif
    488531    This->acquired = 1;
    489532  }
     
    498541    ICOM_THIS(SysMouseAImpl,iface);
    499542
     543#ifdef __WIN32OS2__
     544    dprintf(("SysMouseAImpl_Unacquire %x", This));
     545#else
    500546    TRACE("(this=%p)\n",This);
     547#endif
    501548
    502549    if (This->acquired)
Note: See TracChangeset for help on using the changeset viewer.