void MwDeliverMouseEvent(int buttons, int changebuttons, MWKEYMOD modifiers) { HWND hwnd; int hittest; UINT msg; mwCurrentButtons = buttons; hwnd = GetCapture(); if(!hwnd) hwnd = mousewp; hittest = SendMessage(hwnd, WM_NCHITTEST, 0, MAKELONG(cursorx,cursory)); if(!changebuttons) MwTranslateMouseMessage(hwnd, WM_MOUSEMOVE, hittest); if(changebuttons & MWBUTTON_L) { msg = (buttons&MWBUTTON_L)? WM_LBUTTONDOWN: WM_LBUTTONUP; MwTranslateMouseMessage(hwnd, msg, hittest); } if(changebuttons & MWBUTTON_M) { msg = (buttons&MWBUTTON_M)? WM_MBUTTONDOWN: WM_MBUTTONUP; MwTranslateMouseMessage(hwnd, msg, hittest); } if(changebuttons & MWBUTTON_R) { msg = (buttons&MWBUTTON_R)? WM_RBUTTONDOWN: WM_RBUTTONUP; MwTranslateMouseMessage(hwnd, msg, hittest); } }
void MwDeliverMouseEvent(int buttons, int changebuttons, MWKEYMOD modifiers) { HWND hwnd, top; int hittest; UINT msg; mwCurrentModifiers = modifiers; hwnd = GetCapture(); if(!hwnd) hwnd = mousewp; /* if wnd is disabled, or window is child and parent disabled, do nothing*/ if( hwnd == NULL || !IsWindowEnabled(hwnd) ) return; top = MwGetTopWindow(hwnd); if( top != NULL && !IsWindowEnabled(top) ) return; hittest = SendMessage(hwnd, WM_NCHITTEST, 0, MAKELONG(cursorx,cursory)); if(!changebuttons) MwTranslateMouseMessage(hwnd, WM_MOUSEMOVE, hittest, buttons); if(changebuttons & MWBUTTON_L) { msg = (buttons&MWBUTTON_L)? WM_LBUTTONDOWN: WM_LBUTTONUP; MwTranslateMouseMessage(hwnd, msg, hittest, buttons); } if(changebuttons & MWBUTTON_M) { msg = (buttons&MWBUTTON_M)? WM_MBUTTONDOWN: WM_MBUTTONUP; MwTranslateMouseMessage(hwnd, msg, hittest, buttons); } if(changebuttons & MWBUTTON_R) { msg = (buttons&MWBUTTON_R)? WM_RBUTTONDOWN: WM_RBUTTONUP; MwTranslateMouseMessage(hwnd, msg, hittest, buttons); } }