| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Description | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
library initialization, main event loop, and events | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Synopsis | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Initialisation | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
initGUI :: IO [String] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Initialize the GUI. This must be called before any other function in the Gtk2Hs library. This function initializes the GUI toolkit and parses all Gtk specific arguments. The remaining arguments are returned. If the initialization of the toolkit fails for whatever reason, an exception is thrown.
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Support for OS threads | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
unsafeInitGUIForThreadedRTS :: IO [String] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
postGUISync :: IO a -> IO a | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Post an action to be run in the main GUI thread. The current thread blocks until the action completes and the result is returned. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
postGUIAsync :: IO () -> IO () | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Post an action to be run in the main GUI thread. The current thread continues and does not wait for the result of the action. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
threadsEnter :: IO () | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Acquire the global Gtk lock.
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
threadsLeave :: IO () | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Release the global Gtk lock.
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Main event loop | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
mainGUI :: IO () | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Run the Gtk+ main event loop. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
mainQuit :: IO () | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Exit the main event loop. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Less commonly used event loop functions | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
eventsPending :: IO Int | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Inquire the number of events pending on the event queue | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
mainLevel :: IO Int | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Inquire the main loop level.
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
mainIteration :: IO Bool | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Process an event, block if necessary.
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
mainIterationDo :: Bool -> IO Bool | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Process a single event.
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
mainDoEvent :: EventM t () | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Processes a single GDK event. This is public only to allow filtering of events between GDK and GTK+. You will not usually need to call this function directly. While you should not call this function directly, you might want to know how exactly events are handled. So here is what this function does with the event: 1. Compress enterleave notify events. If the event passed build an enterleave pair together with the next event (peeked from GDK) both events are thrown away. This is to avoid a backlog of (de-)highlighting widgets crossed by the pointer. 2. Find the widget which got the event. If the widget can't be determined the event is thrown away unless it belongs to a INCR transaction. In that case it is passed to selectionIncrEvent. 3. Then the event is passed on a stack so you can query the currently handled event with getCurrentEvent. 4. The event is sent to a widget. If a grab is active all events for widgets that are not in the contained in the grab widget are sent to the latter with a few exceptions:
Another point of interest might be that all key events are first passed through the key snooper functions if there are any. Read the description of keySnooperInstall if you need this feature. 5. After finishing the delivery the event is popped from the event stack. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Grab widgets | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
grabAdd :: WidgetClass wd => wd -> IO () | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
add a grab widget | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
grabGetCurrent :: IO (Maybe Widget) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
inquire current grab widget | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
grabRemove :: WidgetClass w => w -> IO () | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
remove a grab widget | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Timeout and idle callbacks | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
type Priority = Int | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Priorities for installing callbacks. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
priorityLow :: Int | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
priorityDefaultIdle :: Int | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
priorityHighIdle :: Int | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
priorityDefault :: Int | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
priorityHigh :: Int | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
timeoutAdd :: IO Bool -> Int -> IO HandlerId | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Sets a function to be called at regular intervals, with the default priority priorityDefault. The function is called repeatedly until it returns False, after which point the timeout function will not be called again. The first call to the function will be at the end of the first interval. Note that timeout functions may be delayed, due to the processing of other event sources. Thus they should not be relied on for precise timing. After each call to the timeout function, the time of the next timeout is recalculated based on the current time and the given interval (it does not try to 'catch up' time lost in delays). This function differs from timeoutAdd in that the action will be executed within the global Gtk+ lock. It is therefore possible to call Gtk+ functions from the action. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
timeoutAddFull :: IO Bool -> Priority -> Int -> IO HandlerId | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Sets a function to be called at regular intervals, with the given priority. The function is called repeatedly until it returns False, after which point the timeout function will not be called again. The first call to the function will be at the end of the first interval. Note that timeout functions may be delayed, due to the processing of other event sources. Thus they should not be relied on for precise timing. After each call to the timeout function, the time of the next timeout is recalculated based on the current time and the given interval (it does not try to 'catch up' time lost in delays). This function differs from timeoutAddFull in that the action will be executed within the global Gtk+ lock. It is therefore possible to call Gtk+ functions from the action. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
timeoutRemove :: HandlerId -> IO () | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Remove a previously added timeout handler by its HandlerId. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
idleAdd :: IO Bool -> Priority -> IO HandlerId | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Add a callback that is called whenever the system is idle.
This function differs from idleAdd in that the action will be executed within the global Gtk+ lock. It is therefore possible to call Gtk+ functions from the action. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
idleRemove :: HandlerId -> IO () | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Remove a previously added idle handler by its HandlerId. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
inputAdd | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
inputRemove :: HandlerId -> IO () | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
data IOCondition | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
type HandlerId = CUInt | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
type FD = Int | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Produced by Haddock version 2.7.2 |