Commit 64543d13 authored by Mike O'Connor's avatar Mike O'Connor Committed by Andrej Shadura

Imported Debian patch 0.13-1

parents e177eb4d 89a047bd
...@@ -2,6 +2,10 @@ ...@@ -2,6 +2,10 @@
NEWS for Python X Library NEWS for Python X Library
* Version 0.13 6 Aug 2006 (trialed as 0.13pre1 on 22 Jul 2006)
A small release to incorporate a number of minor corrections and bug fixes, including small changes to keysym handling, .Xauthority parsing, several fixes to sending/receiving/flushing data, addition of WithdrawnState to WMHints. petli completed documentation for Display objects.
* Version 0.12 29 Mar 2002 * Version 0.12 29 Mar 2002
** SHAPE extension ** SHAPE extension
......
Metadata-Version: 1.0 Metadata-Version: 1.0
Name: python-xlib Name: python-xlib
Version: 0.12 Version: 0.13pre1
Summary: Python X Library Summary: Python X Library
Home-page: http://python-xlib.sourceforge.net/ Home-page: http://python-xlib.sourceforge.net/
Author: Peter Liljenberg Author: Peter Liljenberg
......
...@@ -97,8 +97,10 @@ approximately ordered by importance. ...@@ -97,8 +97,10 @@ approximately ordered by importance.
Author email: Peter Liljenberg <petli@ctrl-c.liu.se> Author email: Peter Liljenberg <petli@ctrl-c.liu.se>
Mailing list: http://sourceforge.net/mail/?group_id=10350
The Python X Library is a SourceForged project. The project page is The Python X Library is a SourceForged project. The project page is
http://sourgeforge.net/projects/python-xlib/. Source is available http://sourceforge.net/projects/python-xlib/. Source is available
from that page as tar.gz-releases and from the CVS tree. from that page as tar.gz-releases and from the CVS tree.
There isn't any real web page yet, only a derivative of this file. It There isn't any real web page yet, only a derivative of this file. It
......
2006-07-22 Mike Grant <mgg@nobodymuch.org>
Various typo fixes, general updates.
Changelog hasn't been maintained since 2002, but some of the more
significant comments from cvs logs follow:
* Xlib/display.py: (petli) Fix bug in refresh_keyboard_mapping:
ignore modifier and pointer remappings. Plays nice with pydoc.
Copied some text from the docs to __doc__ strings in
Xlib/display.py so that they appear when you use pydoc.
Completed documentation for Display objects.
* Xlib/XK.py: (calroc99) Minor doc string changes. Called
load_keysym_group() for miscellany and latin1 keysyms, rather
than importing the modules.
* Xlib/keysymdef/*: (calroc99) Small change to keysym loading.
Works the same way.
* Xlib/support/*, Xlib/xauth.py, Xlib/error.py: (petli) Added
~/.Xauthority parsing by Python code instead of relying on
/usr/X11R6/bin/xauth. Not activated yet in all cases yet?
Activated in unix_support.py.
* Xlib/xobject/drawable.py: (petli) Fix bugs in definition and
method of GrabButton/Pointer
* Xlib/xobject/icccm.py: (petli) Add WithdrawnState to WMHints
* doc/*: (petli) documentation updates, typos and completing
documentation for Display objects
2002-03-30 Peter Liljenberg <peter.liljenberg@esdgkonsult.com>
* support/unix_connect.py: Handle fcntl/FCNTL changes in Python
2.2.
2002-03-11 Peter Liljenberg <peter.liljenberg@esdgkonsult.com>
* xobject/drawable.py (Drawable.fill_arc): This should be a
PolyFillArc.
Fri Jan 19 17:49:45 2001 Peter Liljenberg <petli@cendio.se>
* XK.py: Moved all keysyms into separate modules, based on their
category. By default only the miscellany and latin1 keysyms are
loaded, and other have to be loaded by importing the
Xlib.keysymdef.<category> module, or calling
load_keysym_group('category').
* display.py (Display.lookup_string):
(Display.rebind_string):
Functions to translate keysyms to strings, and binding keysyms to
new strings.
2001-01-16 <petli@cendio.se>
* xobject/drawable.py (Window.send_event):
* display.py (Display.send_event): Changed the order of the
event_mask and propagate arguments.
2001-01-10 <petli@cendio.se>
* display.py (Display._update_keymap): The first half of the
update algorithm operated on an earlier type of code->sym map than
the second half. Stupid, stupid. It would have been nice with a
type-checker now.
Tue Jan 9 13:03:19 2001 Peter Liljenberg <petli@cendio.se>
* display.py (Display._update_keymap): Fixed call to append with
1.5.2 semantics, broke in newer Pythons.
2000-12-22 <petli@cendio.se>
* display.py (Display.keycode_to_keysym):
(Display.keysym_to_keycode):
(Display.keysym_to_keycodes):
(Display.refresh_keyboard_mapping):
(Display._update_keymap):
Added keymap cache implementation.
2000-12-21 <petli@cendio.se>
* xobject/colormap.py (Colormap.alloc_named_color): Extended to
handle #000000 style color specifications.
* xobject/drawable.py (Window.reparent): Renamed from
reparent_window.
* display.py (Display.set_error_handler): Added.
2000-12-20 <petli@cendio.se>
* display.py (_BaseDisplay):
Implement a cache of atom names.
# $Id: XK.py,v 1.4 2001/01/19 18:59:37 petli Exp $ # $Id: XK.py,v 1.6 2005/09/06 19:18:19 calroc99 Exp $
# #
# Xlib.XK -- X keysym defs # Xlib.XK -- X keysym defs
# #
...@@ -17,36 +17,62 @@ ...@@ -17,36 +17,62 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software # along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# This module defines some functions for working with X keysyms as well
# as a modular keysym definition and loading mechanism. See the keysym
# definition modules in the Xlib/keysymdef directory.
from X import NoSymbol from X import NoSymbol
def string_to_keysym(str): def string_to_keysym(keysym):
return globals().get('XK_' + str, NoSymbol) '''Return the (16 bit) numeric code of keysym.
Given the name of a keysym as a string, return its numeric code.
Don't include the 'XK_' prefix, just use the base, i.e. 'Delete'
instead of 'XK_Delete'.'''
return globals().get('XK_' + keysym, NoSymbol)
def load_keysym_group(group): def load_keysym_group(group):
'''Load all the keysyms in group.
Given a group name such as 'latin1' or 'katakana' load the keysyms
defined in module 'Xlib.keysymdef.group-name' into this XK module.'''
if '.' in group: if '.' in group:
raise ValueError('invalid keysym group name: %s' % group) raise ValueError('invalid keysym group name: %s' % group)
# Try to import the corresponding package. This will G = globals() #Get a reference to XK.__dict__ a.k.a. globals
# finally result in the package calling _load_keysyms_into_XK
__import__('Xlib.keysymdef.%s' % group, globals(), locals())
def _load_keysyms_into_XK(mod): #Import just the keysyms module.
# I reckon that this is the fastest way to import all mod = __import__('Xlib.keysymdef.%s' % group, G, locals(), [group])
# keysyms into this modules global dict.
# To have some kind of security, check that we're only #Extract names of just the keysyms.
# loading something out of Xlib.keysymdef keysyms = [n for n in dir(mod) if n.startswith('XK_')]
if mod[:15] == 'Xlib.keysymdef.': #Copy the named keysyms into XK.__dict__
exec 'from %s import *' % mod in globals() for keysym in keysyms:
## k = mod.__dict__[keysym]; assert k == int(k) #probably too much.
G[keysym] = mod.__dict__[keysym]
#And get rid of the keysym module.
del mod
def _load_keysyms_into_XK(mod):
'''keysym definition modules need no longer call Xlib.XK._load_keysyms_into_XK().
You should remove any calls to that function from your keysym modules.'''
pass
# Always import miscellany and latin1 keysyms # Always import miscellany and latin1 keysyms
import Xlib.keysymdef.miscellany load_keysym_group('miscellany')
import Xlib.keysymdef.latin1 load_keysym_group('latin1')
def keysym_to_string(keysym): def keysym_to_string(keysym):
'''Translate a keysym (16 bit number) into a python string.
This will pass 0 to 0xff as well as XK_BackSpace, XK_Tab, XK_Clear,
XK_Return, XK_Pause, XK_Scroll_Lock, XK_Escape, XK_Delete. For other
values it returns None.'''
# ISO latin 1, LSB is the code # ISO latin 1, LSB is the code
if keysym & 0xff00 == 0: if keysym & 0xff00 == 0:
return chr(keysym & 0xff) return chr(keysym & 0xff)
......
This diff is collapsed.
# $Id: error.py,v 1.4 2000/08/21 10:03:45 petli Exp $ # $Id: error.py,v 1.5 2003/01/29 23:53:31 petli Exp $
# #
# Xlib.error -- basic error classes # Xlib.error -- basic error classes
# #
...@@ -55,6 +55,9 @@ class ConnectionClosedError(Exception): ...@@ -55,6 +55,9 @@ class ConnectionClosedError(Exception):
return 'Display connection closed by %s' % self.whom return 'Display connection closed by %s' % self.whom
class XauthError(Exception): pass
class XNoAuthError(Exception): pass
class ResourceIDError(Exception): pass class ResourceIDError(Exception): pass
......
...@@ -17,6 +17,3 @@ XK_rightshoe = 0xbd8 ...@@ -17,6 +17,3 @@ XK_rightshoe = 0xbd8
XK_leftshoe = 0xbda XK_leftshoe = 0xbda
XK_lefttack = 0xbdc XK_lefttack = 0xbdc
XK_righttack = 0xbfc XK_righttack = 0xbfc
from Xlib.XK import _load_keysyms_into_XK
_load_keysyms_into_XK(__name__)
...@@ -48,6 +48,3 @@ XK_Arabic_kasra = 0x5f0 ...@@ -48,6 +48,3 @@ XK_Arabic_kasra = 0x5f0
XK_Arabic_shadda = 0x5f1 XK_Arabic_shadda = 0x5f1
XK_Arabic_sukun = 0x5f2 XK_Arabic_sukun = 0x5f2
XK_Arabic_switch = 0xFF7E XK_Arabic_switch = 0xFF7E
from Xlib.XK import _load_keysyms_into_XK
_load_keysyms_into_XK(__name__)
...@@ -105,6 +105,3 @@ XK_Cyrillic_E = 0x6fc ...@@ -105,6 +105,3 @@ XK_Cyrillic_E = 0x6fc
XK_Cyrillic_SHCHA = 0x6fd XK_Cyrillic_SHCHA = 0x6fd
XK_Cyrillic_CHE = 0x6fe XK_Cyrillic_CHE = 0x6fe
XK_Cyrillic_HARDSIGN = 0x6ff XK_Cyrillic_HARDSIGN = 0x6ff
from Xlib.XK import _load_keysyms_into_XK
_load_keysyms_into_XK(__name__)
...@@ -72,6 +72,3 @@ XK_Greek_chi = 0x7f7 ...@@ -72,6 +72,3 @@ XK_Greek_chi = 0x7f7
XK_Greek_psi = 0x7f8 XK_Greek_psi = 0x7f8
XK_Greek_omega = 0x7f9 XK_Greek_omega = 0x7f9
XK_Greek_switch = 0xFF7E XK_Greek_switch = 0xFF7E
from Xlib.XK import _load_keysyms_into_XK
_load_keysyms_into_XK(__name__)
...@@ -38,6 +38,3 @@ XK_hebrew_shin = 0xcf9 ...@@ -38,6 +38,3 @@ XK_hebrew_shin = 0xcf9
XK_hebrew_taw = 0xcfa XK_hebrew_taw = 0xcfa
XK_hebrew_taf = 0xcfa XK_hebrew_taf = 0xcfa
XK_Hebrew_switch = 0xFF7E XK_Hebrew_switch = 0xFF7E
from Xlib.XK import _load_keysyms_into_XK
_load_keysyms_into_XK(__name__)
...@@ -68,6 +68,3 @@ XK_kana_N = 0x4dd ...@@ -68,6 +68,3 @@ XK_kana_N = 0x4dd
XK_voicedsound = 0x4de XK_voicedsound = 0x4de
XK_semivoicedsound = 0x4df XK_semivoicedsound = 0x4df
XK_kana_switch = 0xFF7E XK_kana_switch = 0xFF7E
from Xlib.XK import _load_keysyms_into_XK
_load_keysyms_into_XK(__name__)
...@@ -105,6 +105,3 @@ XK_Hangul_J_PanSios = 0xef8 ...@@ -105,6 +105,3 @@ XK_Hangul_J_PanSios = 0xef8
XK_Hangul_J_KkogjiDalrinIeung = 0xef9 XK_Hangul_J_KkogjiDalrinIeung = 0xef9
XK_Hangul_J_YeorinHieuh = 0xefa XK_Hangul_J_YeorinHieuh = 0xefa
XK_Korean_Won = 0xeff XK_Korean_Won = 0xeff
from Xlib.XK import _load_keysyms_into_XK
_load_keysyms_into_XK(__name__)
...@@ -193,6 +193,3 @@ XK_udiaeresis = 0x0fc ...@@ -193,6 +193,3 @@ XK_udiaeresis = 0x0fc
XK_yacute = 0x0fd XK_yacute = 0x0fd
XK_thorn = 0x0fe XK_thorn = 0x0fe
XK_ydiaeresis = 0x0ff XK_ydiaeresis = 0x0ff
from Xlib.XK import _load_keysyms_into_XK
_load_keysyms_into_XK(__name__)
...@@ -55,6 +55,3 @@ XK_rcaron = 0x1f8 ...@@ -55,6 +55,3 @@ XK_rcaron = 0x1f8
XK_uring = 0x1f9 XK_uring = 0x1f9
XK_tcedilla = 0x1fe XK_tcedilla = 0x1fe
XK_abovedot = 0x1ff XK_abovedot = 0x1ff
from Xlib.XK import _load_keysyms_into_XK
_load_keysyms_into_XK(__name__)
...@@ -20,6 +20,3 @@ XK_gabovedot = 0x2f5 ...@@ -20,6 +20,3 @@ XK_gabovedot = 0x2f5
XK_gcircumflex = 0x2f8 XK_gcircumflex = 0x2f8
XK_ubreve = 0x2fd XK_ubreve = 0x2fd
XK_scircumflex = 0x2fe XK_scircumflex = 0x2fe
from Xlib.XK import _load_keysyms_into_XK
_load_keysyms_into_XK(__name__)
...@@ -34,6 +34,3 @@ XK_kcedilla = 0x3f3 ...@@ -34,6 +34,3 @@ XK_kcedilla = 0x3f3
XK_uogonek = 0x3f9 XK_uogonek = 0x3f9
XK_utilde = 0x3fd XK_utilde = 0x3fd
XK_umacron = 0x3fe XK_umacron = 0x3fe
from Xlib.XK import _load_keysyms_into_XK
_load_keysyms_into_XK(__name__)
...@@ -167,7 +167,3 @@ XK_Super_L = 0xFFEB ...@@ -167,7 +167,3 @@ XK_Super_L = 0xFFEB
XK_Super_R = 0xFFEC XK_Super_R = 0xFFEC
XK_Hyper_L = 0xFFED XK_Hyper_L = 0xFFED
XK_Hyper_R = 0xFFEE XK_Hyper_R = 0xFFEE
from Xlib.XK import _load_keysyms_into_XK
_load_keysyms_into_XK(__name__)
...@@ -81,6 +81,3 @@ XK_caret = 0xafc ...@@ -81,6 +81,3 @@ XK_caret = 0xafc
XK_singlelowquotemark = 0xafd XK_singlelowquotemark = 0xafd
XK_doublelowquotemark = 0xafe XK_doublelowquotemark = 0xafe
XK_cursor = 0xaff XK_cursor = 0xaff
from Xlib.XK import _load_keysyms_into_XK
_load_keysyms_into_XK(__name__)
...@@ -22,6 +22,3 @@ XK_rightt = 0x9f5 ...@@ -22,6 +22,3 @@ XK_rightt = 0x9f5
XK_bott = 0x9f6 XK_bott = 0x9f6
XK_topt = 0x9f7 XK_topt = 0x9f7
XK_vertbar = 0x9f8 XK_vertbar = 0x9f8
from Xlib.XK import _load_keysyms_into_XK
_load_keysyms_into_XK(__name__)
...@@ -47,6 +47,3 @@ XK_leftarrow = 0x8fb ...@@ -47,6 +47,3 @@ XK_leftarrow = 0x8fb
XK_uparrow = 0x8fc XK_uparrow = 0x8fc
XK_rightarrow = 0x8fd XK_rightarrow = 0x8fd
XK_downarrow = 0x8fe XK_downarrow = 0x8fe
from Xlib.XK import _load_keysyms_into_XK
_load_keysyms_into_XK(__name__)
...@@ -82,6 +82,3 @@ XK_Thai_lekhok = 0xdf6 ...@@ -82,6 +82,3 @@ XK_Thai_lekhok = 0xdf6
XK_Thai_lekchet = 0xdf7 XK_Thai_lekchet = 0xdf7
XK_Thai_lekpaet = 0xdf8 XK_Thai_lekpaet = 0xdf8
XK_Thai_lekkao = 0xdf9 XK_Thai_lekkao = 0xdf9
from Xlib.XK import _load_keysyms_into_XK
_load_keysyms_into_XK(__name__)
...@@ -28,6 +28,3 @@ XK_3270_ExSelect = 0xFD1B ...@@ -28,6 +28,3 @@ XK_3270_ExSelect = 0xFD1B
XK_3270_CursorSelect = 0xFD1C XK_3270_CursorSelect = 0xFD1C
XK_3270_PrintScreen = 0xFD1D XK_3270_PrintScreen = 0xFD1D
XK_3270_Enter = 0xFD1E XK_3270_Enter = 0xFD1E
from Xlib.XK import _load_keysyms_into_XK
_load_keysyms_into_XK(__name__)
...@@ -98,6 +98,3 @@ XK_Pointer_EnableKeys = 0xFEF9 ...@@ -98,6 +98,3 @@ XK_Pointer_EnableKeys = 0xFEF9
XK_Pointer_Accelerate = 0xFEFA XK_Pointer_Accelerate = 0xFEFA
XK_Pointer_DfltBtnNext = 0xFEFB XK_Pointer_DfltBtnNext = 0xFEFB
XK_Pointer_DfltBtnPrev = 0xFEFC XK_Pointer_DfltBtnPrev = 0xFEFC
from Xlib.XK import _load_keysyms_into_XK
_load_keysyms_into_XK(__name__)
2006-07-22 Mike Grant <mgg@nobodymuch.org>
* Xlib/protocol/display.py: (mggrant) Fix for 1219457 - flushing
was blocking and waiting for a read operation. Added missing
"import socket" per bug report #681511. Fix for bug:1098695 &
1098738. The "recv" variable was being used for more than one
thing - renamed one.
Changelog hasn't been maintained since 2002, but some of the more
significant comments from cvs logs follow:
* Xlib/protocol/request.py: (petli) Fix bugs in definition and
method of GrabButton/Pointer
2002-02-22 Peter Liljenberg <peter.liljenberg@esdgkonsult.com>
* event.py(CirculateNotify, CirculateRequest): These are
identical, so subclass the common Circulate.
2002-02-13 Peter Liljenberg <peter.liljenberg@esdgkonsult.com>
* rq.py (ValueList.parse_binary_value): Use = both for calcsize
and unpacking. Caused problems on Alpha.
2002-02-11 Peter Liljenberg <peter.liljenberg@esdgkonsult.com>
* request.py (GetWindowAttributes): Rename class to win_class.
(AllocColorPlanes): Fix Pad(4) to Pad(8) in reply.
* rq.py (ReplyLength): Add a reply length field, for completeness
and easier unit test generation.
2002-02-10 Peter Liljenberg <peter.liljenberg@esdgkonsult.com>
* rq.py (DictWrapper.__cmp__): Let DictWrapper compare with plain
dictionaries.
(Event.__init__): Set send_event to 0 when creating new events
objects, and allow events to be compared.
(Struct.parse_binary): Allow LengthFields to have a parse_value method.
(OddLength.parse_value): Decode field.
(String16.parse_binary_value): Handle OddLength fields.
(TextElements8.parse_binary_value): Bugfix: return values instead
of v.
(String8.parse_binary_value): Parse String8 with no LengthOf
field.
2002-02-09 Peter Liljenberg <peter.liljenberg@esdgkonsult.com>
* rq.py (TextElements16): Bugfix: inherit TextElements8 instead of
TextElements16. Found while preparing unit tests, whee.
2002-01-14 Peter Liljenberg <peter.liljenberg@esdgkonsult.com>
* display.py (Display.parse_event_response): Fix bug reported by
Ilpo Nyyssönen, whereby ReplyRequests which generates events
(e.g. get_property with delete = 1) will get dropped when the
event is received.
2001-12-14 Peter Liljenberg <peter.liljenberg@esdgkonsult.com>
* display.py (Display.parse_event_response):
* rq.py (Event.__init__): Fixed bug in event type decoding: bit
0-6 is the event type, and bit 7 is set if the event was sent by
SendEvent.
2001-01-16 <petli@cendio.se>
* event.py: Changed some class names so that they correspond
exactly to the event type constants.
Tue Jan 9 10:03:25 2001 Peter Liljenberg <petli@cendio.se>
* display.py (Display.send_request): Fixed a call to append() with
multiple arguments, something that modern Pythons don't allow.
2001-01-04 <petli@cendio.se>
* rq.py: The fix for 64-bit platforms didn't work, and close
scrutiny of structmodule.c shows why: it turns out that '='
translates into '<' or '>', the one the platform would use. This
means B is one byte, H is two and L is four, and no extra
alignment, always. '@', which is the default, selects native
number of bytes, which on Alpha means that 'L' is eight bytes.
Now the code goes to pains to ensure that '=' encoding is always
used, so _now_ it should work on all platforms. Ahem.
2000-12-29 <petli@cendio.se>
* rq.py: Optimizations:
+ replace calls to Field.get_name() with access to attribute
name.
(Struct.build_from_args):
Fri Dec 29 17:05:02 2000 Peter Liljenberg <petli@cendio.se>
* rq.py: Alpha forces us to probe how many bytes each struct code
in 'bhil' represents, instead of being able to assume that b is 1,
h is 2 and l is 4.
2000-12-21 <petli@cendio.se>
* request.py (SetClipRectangles): Fixed typo (attribute was
"rectangels").
2000-12-20 <petli@cendio.se>
* rq.py (DictWrapper.__setitem__),
(DictWrapper.__delitem__),
(DictWrapper.__setattr__),
(DictWrapper.__delattr__):
Add a few methods to the DictWrapper, to make sure that even if
attributes are changed, all attributes can be found in the _data
mapping.
(ValueField.__init__):
(Object.__init__):
(ValueField.pack_value):
(Set.__init__):
Added a default parameter, so that structure elements with a
default value can be omitted when calling build_from_args.
# $Id: display.py,v 1.17 2002/02/25 11:09:23 petli Exp $ # $Id: display.py,v 1.24 2006/07/19 23:05:52 mggrant Exp $
# -*- coding: latin-1 -*-
# #
# Xlib.protocol.display -- core display communication # Xlib.protocol.display -- core display communication
# #
...@@ -48,7 +49,8 @@ class Display: ...@@ -48,7 +49,8 @@ class Display:
self.socket = connect.get_socket(name, host, displayno) self.socket = connect.get_socket(name, host, displayno)
auth_name, auth_data = connect.get_auth(name, host, displayno) auth_name, auth_data = connect.get_auth(self.socket,
name, host, displayno)
# Internal structures for communication, grouped # Internal structures for communication, grouped
# by their function and locks # by their function and locks
...@@ -161,7 +163,7 @@ class Display: ...@@ -161,7 +163,7 @@ class Display:
# whether there are one active. # whether there are one active.
self.send_recv_lock.acquire() self.send_recv_lock.acquire()
# Relase event queue to allow an send_and_recv to # Release event queue to allow an send_and_recv to
# insert any now. # insert any now.
self.event_queue_write_lock.release() self.event_queue_write_lock.release()
...@@ -361,16 +363,21 @@ class Display: ...@@ -361,16 +363,21 @@ class Display:
# We go to sleep if there is already a thread doing what we # We go to sleep if there is already a thread doing what we
# want to do: # want to do:
# If flushing or waiting for a request we want to send # If flushing, we want to send
# If waiting for an event we want to recv # If waiting for a response to a request, we want to send
# (to ensure that the request was sent - we alway recv
# when we get to the main loop, but sending is the important
# thing here)
# If waiting for an event, we want to recv
# If just trying to receive anything we can, we want to recv
if (((flush or request is not None) and self.send_active) if (((flush or request is not None) and self.send_active)
or ((event or recv) and self.recv_active)): or ((event or recv) and self.recv_active)):
# Signal that we are waiting for something. These locks # Signal that we are waiting for something. These locks
# together with the *_waiting variables are used as # together with the *_waiting variables are used as
# semaphores. When an event or a reqeust respone arrives, # semaphores. When an event or a request response arrives,
# it will zero the *_waiting and unlock the lock. The # it will zero the *_waiting and unlock the lock. The
# locks will also be unlocked when an active send_and_recv # locks will also be unlocked when an active send_and_recv
# finishes to signal the other waiting threads that one of # finishes to signal the other waiting threads that one of
...@@ -379,7 +386,6 @@ class Display: ...@@ -379,7 +386,6 @@ class Display:
# All this makes these locks and variables a part of the # All this makes these locks and variables a part of the
# send_and_recv control logic, and hence must be modified # send_and_recv control logic, and hence must be modified
# only when we have the send_recv_lock locked. # only when we have the send_recv_lock locked.
if event: if event:
wait_lock = self.event_wait_lock wait_lock = self.event_wait_lock
if not self.event_waiting: if not self.event_waiting:
...@@ -487,13 +493,13 @@ class Display: ...@@ -487,13 +493,13 @@ class Display:
writeset = [] writeset = []
# Timeout immediately if we're only checking for # Timeout immediately if we're only checking for
# something to read, otherwise block # something to read or if we're flushing, otherwise block
if recv: if recv or flush:
timeout = 0 timeout = 0
else: else:
timeout = None timeout = None
rs, ws, es = select.select([self.socket], writeset, [], timeout) rs, ws, es = select.select([self.socket], writeset, [], timeout)
# Ignore errors caused by a signal recieved while blocking. # Ignore errors caused by a signal recieved while blocking.
...@@ -528,17 +534,17 @@ class Display: ...@@ -528,17 +534,17 @@ class Display:
# We're the recieving thread, parse the data # We're the recieving thread, parse the data
if recieving: if recieving:
try: try:
recv = self.socket.recv(2048) bytes_recv = self.socket.recv(2048)
except socket.error, err: except socket.error, err:
self.close_internal('server: %s' % err[1]) self.close_internal('server: %s' % err[1])
raise self.socket_error raise self.socket_error
if not recv: if not bytes_recv:
# Clear up, set a connection closed indicator and raise it # Clear up, set a connection closed indicator and raise it
self.close_internal('server') self.close_internal('server')
raise self.socket_error raise self.socket_error
self.data_recv = self.data_recv + recv self.data_recv = self.data_recv + bytes_recv
gotreq = self.parse_response(request) gotreq = self.parse_response(request)
# Otherwise return, allowing the calling thread to figure