@@ -152,23 +152,29 @@ def loop(self):
152152 print 'Screen change'
153153 print self .pp .pprint (e ._data )
154154
155- # CRTC information has changed
156- elif e .__class__ .__name__ == randr .CrtcChangeNotify .__name__ :
157- print 'CRTC change'
158- #e = randr.CrtcChangeNotify(display=display.display, binarydata = e._binary)
159- print self .pp .pprint (e ._data )
160-
161- # Output information has changed
162- elif e .__class__ .__name__ == randr .OutputChangeNotify .__name__ :
163- print 'Output change'
164- #e = randr.OutputChangeNotify(display=display.display, binarydata = e._binary)
165- print self .pp .pprint (e ._data )
166-
167- # Output property information has changed
168- elif e .__class__ .__name__ == randr .OutputPropertyNotify .__name__ :
169- print 'Output property change'
170- #e = randr.OutputPropertyNotify(display=display.display, binarydata = e._binary)
171- print self .pp .pprint (e ._data )
155+ # check if we're getting one of the RandR event types with subcodes
156+ elif e .type == self .d .extension_event .CrtcChangeNotify [0 ]:
157+ # yes, check the subcodes
158+
159+ # CRTC information has changed
160+ if (e .type , e .sub_code ) == self .d .extension_event .CrtcChangeNotify :
161+ print 'CRTC change'
162+ #e = randr.CrtcChangeNotify(display=display.display, binarydata = e._binary)
163+ print self .pp .pprint (e ._data )
164+
165+ # Output information has changed
166+ elif (e .type , e .sub_code ) == self .d .extension_event .OutputChangeNotify :
167+ print 'Output change'
168+ #e = randr.OutputChangeNotify(display=display.display, binarydata = e._binary)
169+ print self .pp .pprint (e ._data )
170+
171+ # Output property information has changed
172+ elif (e .type , e .sub_code ) == self .d .extension_event .OutputPropertyNotify :
173+ print 'Output property change'
174+ #e = randr.OutputPropertyNotify(display=display.display, binarydata = e._binary)
175+ print self .pp .pprint (e ._data )
176+ else :
177+ print "Unrecognised subcode" , e .sub_code
172178
173179 # Somebody wants to tell us something
174180 elif e .type == X .ClientMessage :
0 commit comments