X11-1.9.1: A binding to the X11 graphics library

Copyright | (c) Joachim Breitner (c) Jochen Keil
License | BSD3
Maintainer | Joachim Breitner <mail@joachim-breitner.de>
Stability | provisional
Portability | portable
Safe Haskell | None
Language | Haskell98

Graphics.X11.XScreenSaver

Description

Synopsis

- getXIdleTime :: Display -> IO Int
- data XScreenSaverState
  - = ScreenSaverOff
  - | ScreenSaverOn
  - | ScreenSaverCycle
  - | ScreenSaverDisabled
- data XScreenSaverKind
  - = ScreenSaverBlanked
  - | ScreenSaverInternal
  - | ScreenSaverExternal
- data XScreenSaverInfo = XScreenSaverInfo {
  - xssi_window :: !Window
  - xssi_state :: !XScreenSaverState
  - xssi_kind :: !XScreenSaverKind
  - xssi_til_or_since :: !CULong
  - xssi_idle :: !CULong
  - xssi_event_mask :: !CULong
  }
- type XScreenSaverNotifyEvent = (Window, Window, CInt, CInt, Bool, Time)
- xScreenSaverQueryExtension :: Display -> IO (Maybe (CInt, CInt))
- xScreenSaverQueryVersion :: Display -> IO (Maybe (CInt, CInt))
- xScreenSaverQueryInfo :: Display -> IO (Maybe XScreenSaverInfo)
- xScreenSaverSelectInput :: Display -> EventMask -> IO ()
- xScreenSaverSetAttributes :: Display -> Position -> Position -> Dimension -> Dimension -> Dimension -> CInt -> WindowClass -> Visual -> AttributeMask -> Ptr SetWindowAttributes -> IO ()
- xScreenSaverUnsetAttributes :: Display -> IO ()
- xScreenSaverSaverRegister :: Display -> ScreenNumber -> XID -> Atom -> IO ()
- xScreenSaverUnregister :: Display -> ScreenNumber -> IO Status
- xScreenSaverGetRegistered :: Display -> ScreenNumber -> XID -> Atom -> IO Status
- xScreenSaverSuspend :: Display -> Bool -> IO ()
- get_XScreenSaverNotifyEvent :: XEventPtr -> IO XScreenSaverNotifyEvent
- compiledWithXScreenSaver :: Bool

# Documentation

getXIdleTime :: Display -> IO Int Source #

Simple wrapper around `xScreenSaverQueryInfo` if you are only interested in the idle time, in milliseconds. Returns 0 if the XScreenSaver extension is not available

data XScreenSaverState Source #

XScreenSaverState is for use in both XScreenSaverNotifyEvent and XScreenSaverInfo ScreenSaverCycle is not a valid value for use in XScreenSaverInfo ScreenSaverDisabled will not occur in an XScreenSaverNotifyEvent

Constructors

ScreenSaverOff | The screen is not currently being saved; til-or-since specifies the number of milliseconds until the screen saver is expected to activate.
ScreenSaverOn | The screen is currently being saved; til-or-since specifies the number of milliseconds since the screen saver activated.
ScreenSaverCycle | If this bit is set, ScreenSaverNotify events are generated whenever the screen saver cycle interval passes.
ScreenSaverDisabled | The screen saver is currently disabled; til-or-since is zero.

#### Instances

Instances details

Show XScreenSaverState Source # |
Instance details Defined in Graphics.X11.XScreenSaver Methods showsPrec :: Int -> XScreenSaverState -> ShowS show :: XScreenSaverState -> String showList :: [XScreenSaverState] -> ShowS
Storable XScreenSaverState Source # |

Instance details

Defined in Graphics.X11.XScreenSaver

Methods

sizeOf :: XScreenSaverState -> Int

alignment :: XScreenSaverState -> Int

peekElemOff :: Ptr XScreenSaverState -> Int -> IO XScreenSaverState

pokeElemOff :: Ptr XScreenSaverState -> Int -> XScreenSaverState -> IO ()

peekByteOff :: Ptr b -> Int -> IO XScreenSaverState

pokeByteOff :: Ptr b -> Int -> XScreenSaverState -> IO ()

peek :: Ptr XScreenSaverState -> IO XScreenSaverState

poke :: Ptr XScreenSaverState -> XScreenSaverState -> IO ()

data XScreenSaverKind Source #

Data type for use in a XScreenSaverInfo struct

Constructors

ScreenSaverBlanked | The video signal to the display monitor was disabled.
ScreenSaverInternal | A server-dependent, built-in screen saver image was displayed; either no client had set the screen saver window attributes or a different client had the server grabbed when the screen saver activated.
ScreenSaverExternal | The screen saver window was mapped with attributes set by a client using the ScreenSaverSetAttributes request.

#### Instances

Instances details

Show XScreenSaverKind Source # |
Instance details Defined in Graphics.X11.XScreenSaver Methods showsPrec :: Int -> XScreenSaverKind -> ShowS show :: XScreenSaverKind -> String showList :: [XScreenSaverKind] -> ShowS
Storable XScreenSaverKind Source # |

Instance details

Defined in Graphics.X11.XScreenSaver

Methods

sizeOf :: XScreenSaverKind -> Int

alignment :: XScreenSaverKind -> Int

peekElemOff :: Ptr XScreenSaverKind -> Int -> IO XScreenSaverKind

pokeElemOff :: Ptr XScreenSaverKind -> Int -> XScreenSaverKind -> IO ()

peekByteOff :: Ptr b -> Int -> IO XScreenSaverKind

pokeByteOff :: Ptr b -> Int -> XScreenSaverKind -> IO ()

peek :: Ptr XScreenSaverKind -> IO XScreenSaverKind

poke :: Ptr XScreenSaverKind -> XScreenSaverKind -> IO ()

data XScreenSaverInfo Source #

Representation of the XScreenSaverInfo struct.

Constructors

XScreenSaverInfo |

Fields

- xssi_window :: !Window
- xssi_state :: !XScreenSaverState

  The state field specified whether or not the screen saver is currently active and how the til-or-since value should be interpreted

- xssi_kind :: !XScreenSaverKind

  The kind field specifies the mechanism that either is currently being used or would have been were the screen being saved

- xssi_til_or_since :: !CULong
- xssi_idle :: !CULong

  The idle field specifies the number of milliseconds since the last input was received from the user on any of the input devices.

- xssi_event_mask :: !CULong

  The event-mask field specifies which, if any, screen saver events this client has requested using ScreenSaverSelectInput.

#### Instances

Instances details

Show XScreenSaverInfo Source # |
Instance details Defined in Graphics.X11.XScreenSaver Methods showsPrec :: Int -> XScreenSaverInfo -> ShowS show :: XScreenSaverInfo -> String showList :: [XScreenSaverInfo] -> ShowS
Storable XScreenSaverInfo Source # |

Instance details

Defined in Graphics.X11.XScreenSaver

Methods

sizeOf :: XScreenSaverInfo -> Int

alignment :: XScreenSaverInfo -> Int

peekElemOff :: Ptr XScreenSaverInfo -> Int -> IO XScreenSaverInfo

pokeElemOff :: Ptr XScreenSaverInfo -> Int -> XScreenSaverInfo -> IO ()

peekByteOff :: Ptr b -> Int -> IO XScreenSaverInfo

pokeByteOff :: Ptr b -> Int -> XScreenSaverInfo -> IO ()

peek :: Ptr XScreenSaverInfo -> IO XScreenSaverInfo

poke :: Ptr XScreenSaverInfo -> XScreenSaverInfo -> IO ()

type XScreenSaverNotifyEvent = (Window, Window, CInt, CInt, Bool, Time) Source #

xScreenSaverQueryExtension :: Display -> IO (Maybe (CInt, CInt)) Source #

xScreenSaverQueryVersion :: Display -> IO (Maybe (CInt, CInt)) Source #

xScreenSaverQueryInfo :: Display -> IO (Maybe XScreenSaverInfo) Source #

xScreenSaverQueryInfo returns information about the current state of the screen server. If the xScreenSaver extension is not available, it returns Nothing

xScreenSaverSelectInput :: Display -> EventMask -> IO () Source #

xScreenSaverSelectInput asks that events related to the screen saver be generated for this client. If no bits are set in event-mask, then no events will be generated.

xScreenSaverSetAttributes Source #

Arguments

:: Display |
-> Position | x
-> Position | y
-> Dimension | width
-> Dimension | height
-> Dimension | border width
-> CInt | depth (`defaultDepthOfScreen`)
-> WindowClass | class
-> Visual | visual (`defaultVisualOfScreen`)
-> AttributeMask | valuemask
-> Ptr SetWindowAttributes |
-> IO () |

XScreenSaverSetAttributes sets the attributes to be used the next time the external screen saver is activated. If another client currently has the attributes set, a BadAccess error is generated and the request is ignored.

Otherwise, the specified window attributes are checked as if they were used in a core CreateWindow request whose parent is the root. The override-redirect field is ignored as it is implicitly set to True. If the window attributes result in an error according to the rules for CreateWindow, the request is ignored.

Otherwise, the attributes are stored and will take effect on the next activation that occurs when the server is not grabbed by another client. Any resources specified for the background-pixmap or cursor attributes may be freed immediately. The server is free to copy the background-pixmap or cursor resources or to use them in place; therefore, the effect of changing the contents of those resources is undefined. If the specified colormap no longer exists when the screen saver activates, the parent's colormap is used instead. If no errors are generated by this request, any previous screen saver window attributes set by this client are released.

When the screen saver next activates and the server is not grabbed by another client, the screen saver window is created, if necessary, and set to the specified attributes and events are generated as usual. The colormap associated with the screen saver window is installed. Finally, the screen saver window is mapped.

The window remains mapped and at the top of the stacking order until the screen saver is deactivated in response to activity on any of the user input devices, a ForceScreenSaver request with a value of Reset, or any request that would cause the window to be unmapped.

If the screen saver activates while the server is grabbed by another client, the internal saver mechanism is used. The ForceScreenSaver request may be used with a value of Active to deactivate the internal saver and activate the external saver.

If the screen saver client's connection to the server is broken while the screen saver is activated and the client's close down mode has not been RetainPermanent or RetainTemporary, the current screen saver is deactivated and the internal screen saver is immediately activated.

When the screen saver deactivates, the screen saver window's colormap is uninstalled and the window is unmapped (except as described below). The screen saver XID is disassociated with the window and the server may, but is not required to, destroy the window along with any children.

When the screen saver is being deactivated and then immediately reactivated (such as when switching screen savers), the server may leave the screen saver window mapped (typically to avoid generating exposures).

xScreenSaverUnsetAttributes :: Display -> IO () Source #

XScreenSaverUnsetAttributes instructs the server to discard any previ‐ ous screen saver window attributes set by this client.

xScreenSaverSaverRegister :: Display -> ScreenNumber -> XID -> Atom -> IO () Source #

XScreenSaverRegister stores the given XID in the _SCREEN_SAVER_ID prop‐ erty (of the given type) on the root window of the specified screen. It returns zero if an error is encountered and the property is not changed, otherwise it returns non-zero.

xScreenSaverUnregister :: Display -> ScreenNumber -> IO Status Source #

XScreenSaverUnregister removes any _SCREEN_SAVER_ID from the root win‐ dow of the specified screen. It returns zero if an error is encoun‐ tered and the property is changed, otherwise it returns non-zero.

xScreenSaverGetRegistered :: Display -> ScreenNumber -> XID -> Atom -> IO Status Source #

XScreenSaverGetRegistered returns the XID and type stored in the _SCREEN_SAVER_ID property on the root window of the specified screen. It returns zero if an error is encountered or if the property does not exist or is not of the correct format; otherwise it returns non-zero.

xScreenSaverSuspend :: Display -> Bool -> IO () Source #

XScreenSaverSuspend temporarily suspends the screensaver and DPMS timer if suspend is `True`, and restarts the timer if suspend is `False`. This function should be used by applications that don't want the screensaver or DPMS to become activated while they're for example in the process of playing a media sequence, or are otherwise continuously presenting visual information to the user while in a non-interactive state. This function is not intended to be called by an external screensaver application.

If XScreenSaverSuspend is called multiple times with suspend set to `True`, it must be called an equal number of times with suspend set to `False` in order for the screensaver timer to be restarted. This request has no affect if a client tries to resume the screensaver with‐ out first having suspended it. XScreenSaverSuspend can thus not be used by one client to resume the screensaver if it's been suspended by another client.

If a client that has suspended the screensaver becomes disconnected from the X server, the screensaver timer will automatically be restarted, unless it's still suspended by another client. Suspending the screensaver timer doesn't prevent the screensaver from being forceably activated with the ForceScreenSaver request, or a DPMS mode from being set with the DPMSForceLevel request.

XScreenSaverSuspend also doesn't deactivate the screensaver or DPMS if either is active at the time the request to suspend them is received by the X server. But once they've been deactivated, they won't automatically be activated again, until the client has canceled the suspension.

get_XScreenSaverNotifyEvent :: XEventPtr -> IO XScreenSaverNotifyEvent Source #

compiledWithXScreenSaver :: Bool Source #

Deprecated: X11 now always compiles with XScreenSaver support

We have XScreenSaver, so the library will actually work