diff --git a/libs/pyglet/event.py b/libs/pyglet/event.py index 965db9b..9941c19 100644 --- a/libs/pyglet/event.py +++ b/libs/pyglet/event.py @@ -331,30 +331,30 @@ class EventDispatcher: pass def dispatch_event(self, event_type, *args): - """Dispatch a single event to the attached handlers. + """Dispatch an event to the attached event handlers. - The event is propagated to all handlers from from the top of the stack - until one returns `EVENT_HANDLED`. This method should be used only by - :py:class:`~pyglet.event.EventDispatcher` implementors; applications should call - the ``dispatch_events`` method. + The event is propagated to all registered event handlers + in the stack, starting and the top and going down. If any + registered event handler returns `EVENT_HANDLED`, no further + handlers down the stack will receive this event. - Since pyglet 1.2, the method returns `EVENT_HANDLED` if an event - handler returned `EVENT_HANDLED` or `EVENT_UNHANDLED` if all events - returned `EVENT_UNHANDLED`. If no matching event handlers are in the - stack, ``False`` is returned. + This method has several possible return values. + If any event hander has returned `EVENT_HANDLED`, then this + method will also return `EVENT_HANDLED`. If not, this method + will return `EVENT_UNHANDLED`. If there were no events + registered to receive this event, ``False`` is returned. :Parameters: `event_type` : str - Name of the event. + The name of the event to dispatch. `args` : sequence - Arguments to pass to the event handler. + Optional arguments to pass to the event handlers. :rtype: bool or None - :return: (Since pyglet 1.2) `EVENT_HANDLED` if an event handler - returned `EVENT_HANDLED`; `EVENT_UNHANDLED` if one or more event - handlers were invoked but returned only `EVENT_UNHANDLED`; - otherwise ``False``. In pyglet 1.1 and earlier, the return value - is always ``None``. + :return: `EVENT_HANDLED` if any event handler returned `EVENT_HANDLED`; + `EVENT_UNHANDLED` if one or more event handlers were invoked + without any of them returning `EVENT_HANDLED`; + ``False`` if no event handlers were registered. """ assert hasattr(self, 'event_types'), ( diff --git a/libs/pyglet/image/codecs/wic.py b/libs/pyglet/image/codecs/wic.py index 41925ab..1e7ab11 100644 --- a/libs/pyglet/image/codecs/wic.py +++ b/libs/pyglet/image/codecs/wic.py @@ -1,5 +1,3 @@ -import warnings - from pyglet.image import * from pyglet.image.codecs import * from pyglet.libs.win32 import _kernel32 as kernel32 @@ -60,7 +58,7 @@ WICBitmapEncoderNoCache = 0x2 WICBITMAPENCODERCACHEOPTION_FORCE_DWORD = 0x7fffffff # Different pixel formats. -REFWICPixelFormatGUID = com.GUID +REFWICPixelFormatGUID = POINTER(com.GUID) GUID_WICPixelFormatDontCare = com.GUID(0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x00) GUID_WICPixelFormat1bppIndexed = com.GUID(0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x01) GUID_WICPixelFormat2bppIndexed = com.GUID(0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x02) @@ -158,7 +156,7 @@ class IWICBitmapFrameEncode(com.pIUnknown): ('SetResolution', com.STDMETHOD()), ('SetPixelFormat', - com.STDMETHOD(POINTER(REFWICPixelFormatGUID))), + com.STDMETHOD(REFWICPixelFormatGUID)), ('SetColorContexts', com.STDMETHOD()), ('SetPalette', @@ -242,7 +240,7 @@ class IWICBitmapSource(com.pIUnknown): ('GetSize', com.STDMETHOD(POINTER(UINT), POINTER(UINT))), ('GetPixelFormat', - com.STDMETHOD(POINTER(REFWICPixelFormatGUID))), + com.STDMETHOD(REFWICPixelFormatGUID)), ('GetResolution', com.STDMETHOD(POINTER(DOUBLE), POINTER(DOUBLE))), ('CopyPalette', @@ -255,10 +253,10 @@ class IWICBitmapSource(com.pIUnknown): class IWICFormatConverter(IWICBitmapSource, com.pIUnknown): _methods_ = [ ('Initialize', - com.STDMETHOD(IWICBitmapSource, POINTER(REFWICPixelFormatGUID), WICBitmapDitherType, c_void_p, DOUBLE, + com.STDMETHOD(IWICBitmapSource, REFWICPixelFormatGUID, WICBitmapDitherType, c_void_p, DOUBLE, WICBitmapPaletteType)), ('CanConvert', - com.STDMETHOD(POINTER(REFWICPixelFormatGUID), POINTER(REFWICPixelFormatGUID), POINTER(BOOL))), + com.STDMETHOD(REFWICPixelFormatGUID, REFWICPixelFormatGUID, POINTER(BOOL))), ] @@ -373,7 +371,7 @@ class IWICImagingFactory(com.pIUnknown): ('CreateColorTransformer', com.STDMETHOD()), ('CreateBitmap', - com.STDMETHOD(UINT, UINT, POINTER(REFWICPixelFormatGUID), WICBitmapCreateCacheOption, POINTER(IWICBitmap))), + com.STDMETHOD(UINT, UINT, REFWICPixelFormatGUID, WICBitmapCreateCacheOption, POINTER(IWICBitmap))), ('CreateBitmapFromSource', com.STDMETHOD()), ('CreateBitmapFromSourceRect', @@ -605,7 +603,7 @@ class WICEncoder(ImageEncoder): data = (c_byte * size).from_buffer(bytearray(image_data)) - frame.WritePixels(image.height, abs(image.pitch), size, data) + frame.WritePixels(image.height, pitch, size, data) frame.Commit()