virtual void OnClick(BOOL /*bKeyboard = FALSE */, CPoint /*pt = CPoint */) { if (GetKeyState(VK_LBUTTON) >= 0) return; m_bPressed = TRUE; CXTPRibbonScrollableBar* pScrollableBar = GetScrollableBar(m_pParent); pScrollableBar->OnGroupsScroll(m_bScrollLeft); int cmsTimer = GetDoubleClickTime() * 4 / 5; m_pParent->SetTimer(IDSYS_SCROLL, cmsTimer, NULL); BOOL bFirst = TRUE; m_pParent->SetCapture(); while (::GetCapture() == m_pParent->GetSafeHwnd() && IsVisible()) { MSG msg; if (!::GetMessage(&msg, NULL, 0, 0)) { AfxPostQuitMessage((int)msg.wParam); break; } if (msg.message == WM_TIMER && msg.wParam == IDSYS_SCROLL) { pScrollableBar->OnGroupsScroll(m_bScrollLeft); if (bFirst) { cmsTimer = GetDoubleClickTime() / 10; m_pParent->SetTimer(IDSYS_SCROLL, cmsTimer, NULL); } bFirst = FALSE; } else if (msg.message == WM_LBUTTONUP) { break; } else { TranslateMessage(&msg); DispatchMessage(&msg); } } ReleaseCapture(); m_pParent->KillTimer(IDSYS_SCROLL); m_bPressed = FALSE; if (!IsVisible()) m_bSelected = FALSE; RedrawParent(FALSE); }
CTitleTip::CTitleTip() { // Register the window class if it has not already been registered. WNDCLASS wndcls; HINSTANCE hInst = AfxGetInstanceHandle(); if(!(::GetClassInfo(hInst, TITLETIP_CLASSNAME, &wndcls))) { // otherwise we need to register a new class wndcls.style = CS_SAVEBITS; wndcls.lpfnWndProc = ::DefWindowProc; wndcls.cbClsExtra = wndcls.cbWndExtra = 0; wndcls.hInstance = hInst; wndcls.hIcon = NULL; wndcls.hCursor = LoadCursor( hInst, IDC_ARROW ); wndcls.hbrBackground = (HBRUSH)(COLOR_INFOBK +1); wndcls.lpszMenuName = NULL; wndcls.lpszClassName = TITLETIP_CLASSNAME; if (!AfxRegisterClass(&wndcls)) AfxThrowResourceException(); } m_dwLastLButtonDown = ULONG_MAX; m_dwDblClickMsecs = GetDoubleClickTime(); m_bCreated = FALSE; m_pParentWnd = NULL; }
///////////////////////////////////////////////////////////////////////////// // ZTitleTip // ZTitleTip::ZTitleTip( zLONG lHoverDelay ) { #ifdef DEBUG_ALL TraceLineI( "ZTitleTip::ctor Delay: ", lHoverDelay ); #endif // Register the window class if it has not already been registered. WNDCLASS wndcls; HINSTANCE hInst = AfxGetInstanceHandle( ); if ( ::GetClassInfo( hInst, ZTITLETIP_CLASSNAME, &wndcls ) == 0 ) { // Otherwise we need to register a new class. wndcls.style = CS_SAVEBITS; wndcls.lpfnWndProc = ::DefWindowProc; wndcls.cbClsExtra = wndcls.cbWndExtra = 0; wndcls.hInstance = hInst; wndcls.hIcon = 0; wndcls.hCursor = LoadCursor( hInst, IDC_ARROW ); wndcls.hbrBackground = (HBRUSH)(COLOR_INFOBK + 1); wndcls.lpszMenuName = 0; wndcls.lpszClassName = ZTITLETIP_CLASSNAME; if ( AfxRegisterClass( &wndcls ) == 0 ) AfxThrowResourceException( ); } m_dwLastLButtonDown = ULONG_MAX; m_ulDblClickInterval = GetDoubleClickTime( ); m_bCreated = FALSE; m_pParentWnd = 0; m_lHoverDelay = lHoverDelay; }
void win_mouse_click(mouse_button b, LPARAM lp) { static mouse_button last_button; static uint last_time, count; static pos last_click_pos; win_show_mouse(); if (tab_bar_click(lp)) return; mod_keys mods = get_mods(); pos p = get_mouse_pos(lp); uint t = GetMessageTime(); if (b != last_button || p.x != last_click_pos.x || p.y != last_click_pos.y || t - last_time > GetDoubleClickTime() || ++count > 3) count = 1; term_mouse_click(win_active_terminal(), b, mods, p, count); last_pos = (pos){INT_MIN, INT_MIN}; last_click_pos = p; last_time = t; last_button = b; if (alt_state > ALT_NONE) alt_state = ALT_CANCELLED; }
// MDI client subclassing LRESULT CALLBACK EXPORT CallBack(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { LPOLDGLOBALS lp=FindGlobal(hWnd); if (!lp) return 0L; switch (message) { case WM_LBUTTONDOWN: { DWORD dwThisLBUTTONDOWNTime; dwThisLBUTTONDOWNTime=GetMessageTime(); if ( (dwThisLBUTTONDOWNTime-dwLastLBUTTONDOWNTime<=(DWORD)GetDoubleClickTime())) { dwLastLBUTTONDOWNTime=0; BoxSelectWindow(lp); return 0; } else dwLastLBUTTONDOWNTime=dwThisLBUTTONDOWNTime; } } return CallWindowProc(lp->lpfnOldFarProc,hWnd,message,wParam,lParam); }
// CodeReview I've duplicated this 'cache' trick for system settings // because they're unlikely to change and calling into the OS for values // repeatedly is just silly to begin with. [6/29/2007 justind] U32 Win32CursorController::getDoubleClickTime() { static S32 sPlatWinDoubleClicktime = -1; if( sPlatWinDoubleClicktime == -1 ) sPlatWinDoubleClicktime = GetDoubleClickTime(); return sPlatWinDoubleClicktime; }
QVariant QWindowsIntegration::styleHint(QPlatformIntegration::StyleHint hint) const { switch (hint) { case QPlatformIntegration::CursorFlashTime: if (const unsigned timeMS = GetCaretBlinkTime()) return QVariant(int(timeMS)); break; #ifdef SPI_GETKEYBOARDSPEED case KeyboardAutoRepeatRate: return QVariant(keyBoardAutoRepeatRateMS()); #endif case QPlatformIntegration::StartDragTime: case QPlatformIntegration::StartDragDistance: case QPlatformIntegration::KeyboardInputInterval: case QPlatformIntegration::ShowIsFullScreen: case QPlatformIntegration::PasswordMaskDelay: case QPlatformIntegration::StartDragVelocity: break; // Not implemented case QPlatformIntegration::FontSmoothingGamma: return QVariant(QWindowsFontDatabase::fontSmoothingGamma()); case QPlatformIntegration::MouseDoubleClickInterval: if (const int ms = GetDoubleClickTime()) return QVariant(ms); break; case QPlatformIntegration::UseRtlExtensions: return QVariant(d->m_context.useRTLExtensions()); } return QPlatformIntegration::styleHint(hint); }
void win_mouse_click(mouse_button b, LPARAM lp) { static mouse_button last_button; static uint last_time, count; static pos last_click_pos; win_show_mouse(); mod_keys mods = get_mods(); pos p = get_mouse_pos(lp); uint t = GetMessageTime(); if (b != last_button || p.x != last_click_pos.x || p.y != last_click_pos.y || t - last_time > GetDoubleClickTime() || ++count > 3) count = 1; SetFocus(wnd); // in case focus was in search bar term_mouse_click(b, mods, p, count); last_pos = (pos){INT_MIN, INT_MIN}; last_click_pos = p; last_time = t; last_button = b; if (alt_state > ALT_NONE) alt_state = ALT_CANCELLED; }
int mousewheel_scroll(HWND win, int delta, int page, BOOL is_vertical) { /* We accumulate the wheel_delta until there is enough to scroll for * at least a single line. This improves the feel for strange values * of SPI_GETWHEELSCROLLLINES and for some mouses. */ static HWND last_win = NULL; static DWORD last_time[2] = { 0, 0 }; /* horizontal, vertical */ static int accum_delta[2] = { 0, 0 }; /* horizontal, vertical */ DWORD now; UINT param; int dir = (is_vertical ? 1 : 0); /* index into accum_delta[], last_time[] */ UINT lines_per_WHEEL_DELTA; int lines; now = GetTickCount(); if(page < 1) page = 1; /* Ask the system for scroll speed. */ param = (is_vertical ? SPI_GETWHEELSCROLLLINES : SPI_GETWHEELSCROLLCHARS); if(MC_ERR(!SystemParametersInfo(param, 0, &lines_per_WHEEL_DELTA, 0))) lines_per_WHEEL_DELTA = 3; /* But never scroll more then complete page. */ if(lines_per_WHEEL_DELTA == WHEEL_PAGESCROLL || lines_per_WHEEL_DELTA >= page) lines_per_WHEEL_DELTA = page; mc_mutex_lock(&mousewheel_mutex); /* Reset the accumulated value(s) when switching to another window, when * changing scrolling direction, or when the wheel was not used for some * time. */ if(win != last_win) { last_win = win; accum_delta[0] = 0; accum_delta[1] = 0; } else if((now - last_time[dir] > GetDoubleClickTime() * 2) || ((delta > 0) == (accum_delta[dir] < 0))) { accum_delta[dir] = 0; } /* Compute lines to scroll. */ if(lines_per_WHEEL_DELTA > 0) { accum_delta[dir] += delta; lines = (accum_delta[dir] * (int)lines_per_WHEEL_DELTA) / WHEEL_DELTA; accum_delta[dir] -= (lines * WHEEL_DELTA) / (int)lines_per_WHEEL_DELTA; } else { /* lines_per_WHEEL_DELTA == 0 --> We just don't scroll at all. */ lines = 0; accum_delta[dir] = 0; } last_time[dir] = now; mc_mutex_unlock(&mousewheel_mutex); return (is_vertical ? -lines : lines); }
//-------------------------------------------------------------------------- void WindowsMouse::_Init() noexcept { VeCursorPtr spDefault = VE_NEW VeCursor(); VeCursor::Data* pkData = GetCursorData(spDefault); pkData->m_pvDriverdata = LoadCursor(nullptr, IDC_ARROW); SetDefaultCursor(pkData); SetDoubleClickTime(GetDoubleClickTime()); }
static pos translate_pos(int x, int y) { return (pos){ .x = floorf((x - PADDING) / (float)font_width ), .y = floorf((y - PADDING) / (float)font_height), }; } static pos get_mouse_pos(LPARAM lp) { return translate_pos(GET_X_LPARAM(lp), GET_Y_LPARAM(lp)); } static mouse_button clicked_button; static pos last_pos; void win_mouse_click(mouse_button b, LPARAM lp) { static mouse_button last_button; static uint last_time, count; static pos last_click_pos; win_show_mouse(); mod_keys mods = get_mods(); pos p = get_mouse_pos(lp); if (clicked_button) { term_mouse_release(b, mods, p); clicked_button = 0; } uint t = GetMessageTime(); if (b != last_button || p.x != last_click_pos.x || p.y != last_click_pos.y || t - last_time > GetDoubleClickTime() || ++count > 3) count = 1; term_mouse_click(b, mods, p, count); last_pos = last_click_pos = p; last_time = t; clicked_button = last_button = b; if (alt_state > ALT_NONE) alt_state = ALT_CANCELLED; } void win_mouse_release(mouse_button b, LPARAM lp) { win_show_mouse(); if (b == clicked_button) { term_mouse_release(b, get_mods(), get_mouse_pos(lp)); clicked_button = 0; ReleaseCapture(); } }
// static bool NativeTextfieldWin::IsDoubleClick(const POINT& origin, const POINT& current, DWORD elapsed_time) { // The CXDOUBLECLK and CYDOUBLECLK system metrics describe the width and // height of a rectangle around the origin position, inside of which clicks // within the double click time are considered double clicks. return (elapsed_time<=GetDoubleClickTime()) && (abs(current.x-origin.x)<=(GetSystemMetrics(SM_CXDOUBLECLK)/2)) && (abs(current.y-origin.y)<=(GetSystemMetrics(SM_CYDOUBLECLK)/2)); }
void HideFlyout(HWND hwndMainWindow, HWND hwndFlyout) { DestroyWindow(hwndFlyout); // immediately after hiding the flyout we don't want to allow showing it again, which will allow clicking // on the icon to hide the flyout. If we didn't have this code, clicking on the icon when the flyout is open // would cause the focus change (from flyout to the taskbar), which would trigger hiding the flyout // (see the WM_ACTIVATE handler). Since the flyout would then be hidden on click, it would be shown again instead // of hiding. SetTimer(hwndMainWindow, HIDEFLYOUT_TIMER_ID, GetDoubleClickTime(), NULL); }
// Left button void CMouse::InternalOnLButtonDown(UINT nFlags, const CPoint& point) { GetWnd().SetFocus(); m_bLeftDown = false; SetCursor(nFlags, point); if (MVRDown(nFlags, point)) { return; } bool bIsOnFS = IsOnFullscreenWindow(); if ((!m_bD3DFS || !bIsOnFS) && (abs(GetMessageTime() - m_popupMenuUninitTime) < 2)) { return; } if (m_pMainFrame->GetLoadState() == MLS::LOADED && m_pMainFrame->GetPlaybackMode() == PM_DVD && (m_pMainFrame->IsD3DFullScreenMode() ^ m_bD3DFS) == 0 && (m_pMainFrame->m_pDVDC->ActivateAtPosition(GetVideoPoint(point)) == S_OK)) { return; } if (m_bD3DFS && bIsOnFS && m_pMainFrame->m_OSD.OnLButtonDown(nFlags, point)) { return; } m_bLeftDown = true; bool bDouble = false; if (m_bLeftDoubleStarted && GetMessageTime() - m_leftDoubleStartTime < (int)GetDoubleClickTime() && CMouse::PointEqualsImprecise(m_leftDoubleStartPoint, point)) { m_bLeftDoubleStarted = false; bDouble = true; } else { m_bLeftDoubleStarted = true; m_leftDoubleStartTime = GetMessageTime(); m_leftDoubleStartPoint = point; } auto onButton = [&]() { GetWnd().SetCapture(); bool ret = false; if (bIsOnFS || !m_pMainFrame->IsCaptionHidden()) { ret = OnButton(wmcmd::LDOWN, point, bIsOnFS); } if (bDouble) { ret = OnButton(wmcmd::LDBLCLK, point, bIsOnFS) || ret; } if (!ret) { ReleaseCapture(); } return ret; }; m_drag = (!onButton() && !bIsOnFS) ? Drag::BEGIN_DRAG : Drag::NO_DRAG; if (m_drag == Drag::BEGIN_DRAG) { GetWnd().SetCapture(); m_beginDragPoint = point; GetWnd().ClientToScreen(&m_beginDragPoint); } }
void aui_Region::InitCommon(void) { #ifdef __AUI_USE_DIRECTX__ m_doubleClickTimeOut = GetDoubleClickTime(); #else m_doubleClickTimeOut = 375; #endif m_editGrabPoint.x = -1; m_editGrabPoint.y = -1; memset(&m_mouseState, 0, sizeof(m_mouseState)); }
void CTreeCtrlEx::OnLButtonDown( UINT nFlags, CPoint point ) { UINT nHitFlags = 0; HTREEITEM hClickedItem = HitTest( point, &nHitFlags ); // Must invoke label editing explicitly. The base class OnLButtonDown would normally // do this, but we can't call it here because of the multiple selection... if( !( nFlags&( MK_CONTROL|MK_SHIFT ) ) && ( GetStyle() & TVS_EDITLABELS ) && ( nHitFlags & TVHT_ONITEMLABEL ) ) if ( hClickedItem == GetSelectedItem() ) { // Clear multple selection before label editing ClearSelection(); SelectItem( hClickedItem ); // Invoke label editing m_bEditLabelPending = TRUE; m_idTimer = SetTimer(TCEX_EDITLABEL, GetDoubleClickTime(), NULL); return; } m_bEditLabelPending = FALSE; if( nHitFlags & TVHT_ONITEM ) { SetFocus(); m_hClickedItem = hClickedItem; // Is the clicked item already selected ? BOOL bIsClickedItemSelected = GetItemState( hClickedItem, TVIS_SELECTED ) & TVIS_SELECTED; if ( bIsClickedItemSelected ) { // Maybe user wants to drag/drop multiple items! // So, wait until OnLButtonUp() to do the selection stuff. m_bSelectPending=TRUE; } else { SelectMultiple( hClickedItem, nFlags, point ); m_bSelectPending=FALSE; } m_ptClick=point; } else CTreeCtrl::OnLButtonDown( nFlags, point ); }
UIContext::UIContext(const Vector2& screenSize) : m_screenSize(screenSize) { #if defined(WIN32) doubleClickTime = std::chrono::milliseconds(GetDoubleClickTime()); #endif pContentManager = oContentManager; m_pDownControls[0] = nullptr; m_pDownControls[1] = nullptr; m_pDownControls[2] = nullptr; m_pLastDownControls[0] = nullptr; m_pLastDownControls[1] = nullptr; m_pLastDownControls[2] = nullptr; }
void CIWinSyncDlg::HideFlyout() { m_pFlyoutDialog->ShowWindow(SW_HIDE); m_pFlyoutDialog->DestroyWindow(); delete(m_pFlyoutDialog); m_pFlyoutDialog = NULL; // immediately after hiding the flyout we don't want to allow showing it again, which will allow clicking // on the icon to hide the flyout. If we didn't have this code, clicking on the icon when the flyout is open // would cause the focus change (from flyout to the taskbar), which would trigger hiding the flyout // (see the WM_ACTIVATE handler). Since the flyout would then be hidden on click, it would be shown again instead // of hiding. SetTimer(HIDEFLYOUT_TIMER_ID, GetDoubleClickTime(), NULL); }
LRESULT msg_handler(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) { static UINT taskbarRestartMsg; /* static here means value is kept across multiple calls to this func */ switch(msg) { case WM_CREATE: taskbarRestartMsg = RegisterWindowMessage("TaskbarCreated"); break; case WM_TIMER: #if 0 KillTimer(hWnd, timerID); call_caml_systray_clicked(SYSTRAY_LBUTTONCLK); #endif break; case WM_DESTROY: break; case WM_TRAYMESSAGE: #if 0 switch (lParam) { case WM_RBUTTONUP: call_caml_systray_clicked(SYSTRAY_RBUTTONCLK); break; case WM_LBUTTONDBLCLK: KillTimer(hWnd, timerID); call_caml_systray_clicked(SYSTRAY_LBUTTONDBLCLK); break; case WM_LBUTTONDOWN: SetTimer(hWnd, timerID, GetDoubleClickTime(), NULL); break; } #endif default: if (msg == taskbarRestartMsg) { /* explorer crashed and left us hanging... This will put the systray icon back in it's place, when it restarts */ Shell_NotifyIcon(NIM_ADD,&nid); } break; }/* end switch */ return DefWindowProc(hWnd, msg, wParam, lParam); }
VOID CXElement::On_CXMsg_MouseEnter( CXMsg_MouseEnter& arg ) { CString toolTip; if (XSUCCEEDED(GetToolTip(toolTip))) { CXMsg_GetRealWnd msg; _SendXMsg(msg); if (!msg.wnd) { return; } HWND hWnd = 0; msg.wnd->GetHWnd(hWnd); if (!m_toolTip.IsWindow()) { m_toolTip.Create(hWnd, NULL, NULL, TTS_ALWAYSTIP | TTS_NOPREFIX,WS_EX_TOPMOST); if (!m_toolTip.IsWindow()) { WTF; } m_toolTip.SetWindowLongPtr(GWLP_USERDATA,(LONG_PTR)hWnd); CSize size; GetSize(size); m_toolTip.SetMaxTipWidth(260); m_toolTip.AddTool(hWnd,_T("")); m_toolTip.SetDelayTime( TTDT_AUTOPOP, static_cast<int>(GetDoubleClickTime() * 10) ) ; m_toolTip.SetDelayTime( TTDT_RESHOW, static_cast<int>(GetDoubleClickTime() * 10) ) ; m_toolTip.Activate(TRUE); } MSG mouseMsg = { hWnd, WM_MOUSEMOVE, 0, MAKELONG (arg.pt.x,arg.pt.y)}; m_toolTip.RelayEvent(&mouseMsg); m_toolTip.UpdateTipText((LPCTSTR)toolTip,hWnd); } arg.msgHandled = TRUE; }
static void SDLCALL SDL_MouseDoubleClickTimeChanged(void *userdata, const char *name, const char *oldValue, const char *hint) { SDL_Mouse *mouse = (SDL_Mouse *)userdata; if (hint && *hint) { mouse->double_click_time = SDL_atoi(hint); } else { #ifdef __WIN32__ mouse->double_click_time = GetDoubleClickTime(); #else mouse->double_click_time = 500; #endif } }
void GetSysParms(void) { TRACEBEGIN(TRCSUBSYSHOST, TRCSCOPEINTERN, "GetSysParms"); crAuto = GetSysColor(COLOR_WINDOWTEXT); cxBorder = GetSystemMetrics(SM_CXBORDER); // Unsizable window border cyBorder = GetSystemMetrics(SM_CYBORDER); // widths cxHScroll = GetSystemMetrics(SM_CXHSCROLL); // Scrollbar-arrow bitmap cxVScroll = GetSystemMetrics(SM_CXVSCROLL); // dimensions cyHScroll = GetSystemMetrics(SM_CYHSCROLL); // cyVScroll = GetSystemMetrics(SM_CYVSCROLL); // cxDoubleClk = GetSystemMetrics(SM_CXDOUBLECLK); cyDoubleClk = GetSystemMetrics(SM_CYDOUBLECLK); DCT = GetDoubleClickTime(); // Get system metrics (do this only once) // CF - Ideally we should not need these stupid metrics HWND hwnd = GetDesktopWindow(); HDC hdc = ::GetDC(hwnd); HFONT hfontOld; TEXTMETRIC tm; xPerInchScreenDC = GetDeviceCaps(hdc, LOGPIXELSX); yPerInchScreenDC = GetDeviceCaps(hdc, LOGPIXELSY); int cPalette = GetDeviceCaps(hdc, SIZEPALETTE); // 256 colors is where we seem to need to use the palette. if (256 == cPalette) { fUsePalette = TRUE; } // calculate a himetric selection bar for the window's host. dxSelBar = DXtoHimetricX(dxSelBarDefaultSize, xPerInchScreenDC); hfontOld = (HFONT)SelectObject(hdc, GetStockObject(SYSTEM_FONT)); if(hfontOld) { GetTextMetrics(hdc, &tm); CDisplay::_xWidthSys = (INT) tm.tmAveCharWidth; CDisplay::_yHeightSys = (INT) tm.tmHeight; SelectObject(hdc, hfontOld); } ::ReleaseDC(hwnd, hdc); }
int APIENTRY _tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow) { UNREFERENCED_PARAMETER(hPrevInstance); UNREFERENCED_PARAMETER(lpCmdLine); MSG msg; szTitle = GString(IDS_APP_TITLE); szWindowClass = GString(IDC_LAUNCHBROWSER); OptionsKeyName = Format(TEXT("Software\\%s"), szTitle.c_str()); // if it's running already, pop the options dialog HWND existingWindow = FindWindow(szWindowClass.c_str(), szTitle.c_str()); if(existingWindow != NULL) { SendNotifyMessage(existingWindow, WM_COMMAND, ID_FILE_OPTIONS, 0); return FALSE; } RegisterWindowClass(hInstance); if (!InitInstance (hInstance, nCmdShow)) { return FALSE; } Browser::ScanRegistryForBrowsers(); SearchEngine::InitSearchEngines(); MouseDoubleClickTime = GetDoubleClickTime() / 1000.0; hKeyboardHook = SetWindowsHookEx(WH_KEYBOARD_LL, fnKeyboardHook, hInstance, 0); if(LoadOptionsFromRegistry() == FALSE) { PostMessage(hMainWindow, WMU_POP_OPTIONS_DIALOG, 0, 0); } // Main message loop: while (GetMessage(&msg, NULL, 0, 0)) { TranslateMessage(&msg); DispatchMessage(&msg); } return (int) msg.wParam; }
void Console::onLBtnDown(HWND hWnd, int x, int y, const COORD &pos) { static DWORD prev_time = 0; static int prevX = -100; static int prevY = -100; { /* calc click count */ DWORD now_time = GetTickCount(); DWORD stime; if(prev_time > now_time) stime = now_time + ~prev_time+1; else stime = now_time - prev_time; if(stime <= GetDoubleClickTime()) { int sx = (prevX > x) ? prevX-x : x-prevX; int sy = (prevY > y) ? prevY-y : y-prevY; if(sx <= GetSystemMetrics(SM_CXDOUBLECLK) && sy <= GetSystemMetrics(SM_CYDOUBLECLK)) { if(++gSelectMode > 2) gSelectMode = 0; } else { gSelectMode = 0; } } else { gSelectMode = 0; } prev_time = now_time; prevX = x; prevY = y; } if(!gScreen) return; SetCapture(hWnd); gSelectPos.X = pos.X; gSelectPos.Y = pos.Y; gSelectRect.Left = gSelectRect.Right = pos.X; gSelectRect.Top = gSelectRect.Bottom = pos.Y; __select_expand(); InvalidateRect(hWnd, NULL, FALSE); }
/*static*/ bool Win32TrayItem::MessageHandler( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { if (message == trayClickedMessage) { UINT button = (UINT) lParam; int id = LOWORD(wParam); bool handled = false; for (size_t i = 0; i < trayItems.size(); i++) { AutoPtr<Win32TrayItem> item = trayItems[i]; item->is_double_clicked = false; if(item->GetId() == id && button == WM_LBUTTONDBLCLK) { item->is_double_clicked = true; KillTimer(hWnd, 100); item->HandleDoubleLeftClick(); handled = true; } if (item->GetId() == id && button == WM_LBUTTONDOWN) { SetTimer(hWnd, 100, GetDoubleClickTime(), (TIMERPROC)DoubleClickTimerProc); handled = true; } else if (item->GetId() == id && button == WM_RBUTTONDOWN) { item->HandleRightClick(); handled = true; } } return handled; } else if (message == WM_MENUCOMMAND) { HMENU nativeMenu = (HMENU) lParam; UINT position = (UINT) wParam; return Win32MenuItem::HandleClickEvent(nativeMenu, position); } else { // Not handled; return false; } }
///initialize GLUT bool init_glut() { static int argc = 1; static const char* argv[1] = { "x" }; //prepare GLUT environment if (!glut_initialized) { glutInit(&argc, (char**) argv); glut_initialized = true; } glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE | GLUT_DEPTH | GLUT_ACCUM); glutSetOption(GLUT_ACTION_ON_WINDOW_CLOSE, GLUT_ACTION_CONTINUE_EXECUTION); //obtain other parameters #ifdef WIN32 double_click_delay_ms = GetDoubleClickTime(); #endif return true; }
QVariant QWindowsIntegration::styleHint(QPlatformIntegration::StyleHint hint) const { switch (hint) { case QPlatformIntegration::CursorFlashTime: if (const unsigned timeMS = GetCaretBlinkTime()) return QVariant(int(timeMS) * 2); break; #ifdef SPI_GETKEYBOARDSPEED case KeyboardAutoRepeatRate: return QVariant(keyBoardAutoRepeatRateMS()); #endif case QPlatformIntegration::StartDragTime: case QPlatformIntegration::StartDragDistance: case QPlatformIntegration::KeyboardInputInterval: case QPlatformIntegration::ShowIsFullScreen: case QPlatformIntegration::PasswordMaskDelay: case QPlatformIntegration::StartDragVelocity: break; // Not implemented case QPlatformIntegration::FontSmoothingGamma: return QVariant(QWindowsFontDatabase::fontSmoothingGamma()); case QPlatformIntegration::MouseDoubleClickInterval: if (const int ms = GetDoubleClickTime()) return QVariant(ms); break; case QPlatformIntegration::UseRtlExtensions: return QVariant(d->m_context.useRTLExtensions()); case QPlatformIntegration::SynthesizeMouseFromTouchEvents: #ifdef Q_OS_WINCE // We do not want Qt to synthesize mouse events as Windows also does that. return false; #else // Q_OS_WINCE return QVariant(bool(d->m_options & DontPassOsMouseEventsSynthesizedFromTouch)); #endif // !Q_OS_WINCE default: break; } return QPlatformIntegration::styleHint(hint); }
void HippoCanvas::startTrackingHover() { if (tooltip_->isShowing()) return; // request a WM_MOUSEHOVER message; also resets the // hover timer if we've already asked for this message. TRACKMOUSEEVENT tme; tme.cbSize = sizeof(tme); tme.dwFlags = TME_HOVER; tme.hwndTrack = window_; // The default Windows tooltip delay is defined to be the // double click time. We don't currently support // it, but if we had a shorter delay when moving // along a toolbar, that is defined as 1/5 double click // time, and tooltips pop down by default after 10x double // click time. See docs for TTM_SETDELAYTIME for this. tme.dwHoverTime = GetDoubleClickTime(); if (TrackMouseEvent(&tme) == 0) { g_warning("Failed to request mouse hover events"); } }
//---------------------------------------------------------------------------------------------- // wmNotify //---------------------------------------------------------------------------------------------- VOID CStatusAreaIcon::wmNotify( WPARAM wParam ,LPARAM lParam ) { switch( wParam ) { case STATUS_AREA_ICON_ID: switch( lParam ) { case WM_LBUTTONDOWN: // タイマーでポップアップ メニュー(左)を表示する SetTimer( Wnd, LEFT_CLICK_TIMER, GetDoubleClickTime(), NULL ); break; case WM_LBUTTONDBLCLK: // 左クリック用タイマーを停止する KillTimer( Wnd, LEFT_CLICK_TIMER ); // プロパティ シートを開く if( PropertySheet->IsOpened() == FALSE ) { PropertySheet->Open(); } break; case WM_RBUTTONUP: // ポップアップ メニュー(右)を表示する ShowRightPopupMenu(); break; } break; case UPDATE_SETTING: // レジストリから設定を読み込む Setting->LoadRegistry(); break; } }
BOOL CResizablePage::PreTranslateMessage(MSG* pMsg) { if ( ::IsWindow ( m_pTitleTip->GetSafeHwnd () ) ) { m_pTitleTip->PreTranslateMessage ( pMsg ); } if (pMsg->message == WM_MOUSEMOVE && m_pTooltipMap!=NULL) { CPoint point ( GET_X_LPARAM(pMsg->lParam), GET_Y_LPARAM(pMsg->lParam) ); ::ClientToScreen (pMsg->hwnd, &point); ScreenToClient(&point); HWND hWndChild = ::ChildWindowFromPoint ( GetSafeHwnd (), point ); if ( ::IsWindow(hWndChild) && m_ptMouseClientPos != point) { HWND2STRING_MAP::iterator i = m_pTooltipMap->m_TooltipMap.find(hWndChild); if ( i != m_pTooltipMap->m_TooltipMap.end() ) { if (TOOLTIP_TIMER_ID) KillTimer(TOOLTIP_TIMER_ID); TOOLTIP_TIMER_ID = SetTimer (17, GetDoubleClickTime (), NULL); TRACE("SetTimer(TOOLTIP_TIMER_ID)\n"); m_ptMouseClientPos = point; m_hwndChild = hWndChild; m_szTooltipNext = i->second; } } } return CPropertyPage::PreTranslateMessage(pMsg); }