Path: blob/trunk/cpp/webdriver-interactions/event_firing_thread.h
2867 views
/*1Licensed to the Software Freedom Conservancy (SFC) under one2or more contributor license agreements. See the NOTICE file3distributed with this work for additional information4regarding copyright ownership. The SFC licenses this file5to you under the Apache License, Version 2.0 (the "License");6you may not use this file except in compliance with the License.7You may obtain a copy of the License at89http://www.apache.org/licenses/LICENSE-2.01011Unless required by applicable law or agreed to in writing, software12distributed under the License is distributed on an "AS IS" BASIS,13WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.14See the License for the specific language governing permissions and15limitations under the License.16*/1718#ifndef event_firing_thread_h_19#define event_firing_thread_h_2021/**22* The purpose of background, persistent event firing is to make mouse hovering23* on Windows work. IE, specifically, would consider the mouse to have moved24* outside the window if WM_MOUSEMOVE messages are not constantly sent to25* the window.26*27* This is achieved by starting a background thread that keeps firing those28* messages every 10 ms. Event firing is paused when other mouse actions occur.29* Additionally, the state of the input devices must be updated so that30* WM_MOUSEMOVE events sent are consistent with previous actions. This31* boils down to whether the Shift key is pressed and whether the left32* mouse button is pressed (for drag-and-drop to work).33**/34// Start or resume persistent "mouse over" event firing by a35// background thread.36extern void resumePersistentEventsFiring(37HWND inputTo, long toX, long toY, WPARAM buttonValue);38// Resume without changing the target. Used after pausing evennt39// firing for mouse actions.40extern void resumePersistentEventsFiring();41// Pauses persistent event firing by the background thread.42extern void pausePersistentEventsFiring();43// When the state of the shift key changes, update the background thread44// so that subsequent mouse over events will have the right keyboard state.45extern void updateShiftKeyState(bool isShiftPressed);46// When the left mouse button is pressed, update the background thread.47// Otherwise IE gets confused.48extern void updateLeftMouseButtonState(bool isButtonPressed);49#endif // event_firing_thread_h_505152