Permalink
Browse files

Add Xrandr event data

  • Loading branch information...
1 parent 8b0206c commit fcfa9a72430f8d453b9a0bcb848a8999789d0620 @mathstuf mathstuf committed Mar 11, 2012
Showing with 54 additions and 0 deletions.
  1. +2 −0 Graphics/X11/Types.hsc
  2. +50 −0 Graphics/X11/Xlib/Extras.hsc
  3. +2 −0 include/XlibExtras.h
@@ -1304,6 +1304,8 @@ type EventType = Word32
, colormapNotify = ColormapNotify
, clientMessage = ClientMessage
, mappingNotify = MappingNotify
+ , rrScreenChangeNotify = RRScreenChangeNotify
+ , rrNotify = RRNotify
, lASTEvent = LASTEvent
}
@@ -212,6 +212,23 @@ data Event
, ev_message_type :: !Atom
, ev_data :: ![CInt]
}
+ | RRScreenChangeNotifyEvent
+ { ev_event_type :: !EventType
+ , ev_serial :: !CULong
+ , ev_send_event :: !Bool
+ , ev_event_display :: Display
+ , ev_window :: !Window
+ , ev_root :: !Window
+ , ev_timestamp :: !Time
+ , ev_config_timestamp :: !Time
+ , ev_size_index :: !SizeID
+ , ev_subpixel_order :: !SubpixelOrder
+ , ev_rotation :: !Rotation
+ , ev_width :: !CInt
+ , ev_height :: !CInt
+ , ev_mwidth :: !CInt
+ , ev_mheight :: !CInt
+ }
deriving ( Show, Typeable )
@@ -613,6 +630,39 @@ getEvent p = do
, ev_data = dat
}
+ -------------------------
+ -- RRScreenChangeNotify
+ -------------------------
+ | type_ == propertyNotify -> do
+ window <- #{peek XRRScreenChangeNotifyEvent, window } p
+ root <- #{peek XRRScreenChangeNotifyEvent, root } p
+ timestamp <- #{peek XRRScreenChangeNotifyEvent, timestamp } p
+ config_timestamp <- #{peek XRRScreenChangeNotifyEvent, config_timestamp } p
+ size_index <- #{peek XRRScreenChangeNotifyEvent, config_timestamp } p
+ subpixel_order <- #{peek XRRScreenChangeNotifyEvent, subpixel_order } p
+ rotation <- #{peek XRRScreenChangeNotifyEvent, rotation } p
+ width <- #{peek XRRScreenChangeNotifyEvent, width } p
+ height <- #{peek XRRScreenChangeNotifyEvent, height } p
+ mwidth <- #{peek XRRScreenChangeNotifyEvent, mwidth } p
+ mheight <- #{peek XRRScreenChangeNotifyEvent, mheight } p
+ return $ RRScreenChangeNotifyEvent
+ { ev_event_type = type_
+ , ev_serial = serial
+ , ev_send_event = send_event
+ , ev_event_display = display
+ , ev_window = window
+ , ev_root = root
+ , ev_timestamp = timestamp
+ , ev_config_timestamp = config_timestamp
+ , ev_size_index = size_index
+ , ev_subpixel_order = subpixel_order
+ , ev_rotation = rotation
+ , ev_width = width
+ , ev_height = height
+ , ev_mwidth = mwidth
+ , ev_mheight = mheight
+ }
+
-- We don't handle this event specifically, so return the generic
-- AnyEvent.
| otherwise -> do
@@ -17,6 +17,8 @@
#include <X11/Xutil.h>
#include <X11/Xproto.h>
+#include <X11/extensions/Xrandr.h>
+
/* Xutil.h overrides some functions with macros.
* In recent versions of X this can be turned off with
* #define XUTIL_DEFINE_FUNCTIONS

0 comments on commit fcfa9a7

Please sign in to comment.