Commit e189d442 authored by Andrej Shadura's avatar Andrej Shadura

Imported Upstream version 0.14+20091101

parent f06064af
include MANIFEST.in
include README COPYING NEWS TODO
global-include .cvsignore
recursive-include doc Makefile
include doc/src/*.texi
include doc/info/python-xlib.info doc/info/python-xlib.info-*[0-9]
include doc/html/index.html doc/html/python-xlib_toc.html
include doc/html/python-xlib_*.html doc/html/texi2html
include doc/ps/python-xlib.ps
include utils/tcpbug.py utils/parsexbug.py
include examples/draw.py examples/draw-proto.py examples/profilex.py
include examples/shapewin.py
include examples/threadtest.py
......@@ -2,6 +2,32 @@
NEWS for Python X Library
* Version 0.15 ???
** Composite extension
Support for the composite extension, used to implement a composition
manager (added for plcm work in plwm).
By itself this extension is not very useful, it is intended to be used
together with the DAMAGE and XFIXES extensions. Typically you would
also need RENDER or glX or some similar method of creating fancy
graphics.
** XF86 special function keysyms
Keysym definitions for special function keys found on modern
keyboards, e.g. raise and lower volume, start specific applications,
etc. Have a look in Xlib/keysymdef/xf86.py to see what there are and
experiment with xev to see what your keyboard generates. These
definitions aren't brought in by default, so you must do this after
importing Xlib.XK:
Xlib.XK.load_keysym_group('xf86')
* Version 0.14 1 Oct 2007 (trialed as 0.14rc1 on 10 Jun 2007)
A couple of new extensions, a Python 2.5 fix and a couple of aliases
......
# $Id: X.py,v 1.3 2007/06/10 14:11:58 mggrant Exp $
#
# Xlib.X -- basic X constants
#
# Copyright (C) 2000 Peter Liljenberg <petli@ctrl-c.liu.se>
......
# $Id: XK.py,v 1.7 2007/06/10 14:11:58 mggrant Exp $
#
# Xlib.XK -- X keysym defs
#
# Copyright (C) 2000 Peter Liljenberg <petli@ctrl-c.liu.se>
......
# $Id: Xatom.py,v 1.3 2007/06/10 14:11:58 mggrant Exp $
#
# Xlib.Xatom -- Standard X atoms
#
# Copyright (C) 2000 Peter Liljenberg <petli@ctrl-c.liu.se>
......
# $Id: Xcursorfont.py,v 1.2 2000/08/22 14:06:22 petli Exp $
#
# Xlib.Xcursorfont -- standard cursors
#
# Copyright (C) 2000 Peter Liljenberg <petli@ctrl-c.liu.se>
......
# $Id: Xutil.py,v 1.3 2007/06/10 14:11:58 mggrant Exp $
#
# Xlib.Xutil -- ICCCM definitions and similar stuff
#
# Copyright (C) 2000 Peter Liljenberg <petli@ctrl-c.liu.se>
......@@ -45,8 +43,11 @@ IconWindowHint = (1 << 3)
IconPositionHint = (1 << 4)
IconMaskHint = (1 << 5)
WindowGroupHint = (1 << 6)
MessageHint = (1 << 7)
UrgencyHint = (1 << 8)
AllHints = (InputHint|StateHint|IconPixmapHint|IconWindowHint|
IconPositionHint|IconMaskHint|WindowGroupHint)
IconPositionHint|IconMaskHint|WindowGroupHint|MessageHint|
UrgencyHint)
WithdrawnState = 0
NormalState = 1
IconicState = 3
......
# $Id: __init__.py,v 1.15 2007/06/10 14:11:58 mggrant Exp $
#
# Xlib.__init__ -- glue for Xlib package
#
# Copyright (C) 2000-2002 Peter Liljenberg <petli@ctrl-c.liu.se>
......@@ -18,13 +16,11 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
import string
__version__ = (0, 12)
__version__ = (0, 14)
__version_extra__ = ''
__version_string__ = string.join(map(str, __version__), '.') + __version_extra__
__version_string__ = '.'.join(map(str, __version__)) + __version_extra__
__all__ = [
'X',
......
# $Id: display.py,v 1.23 2007/06/10 14:11:58 mggrant Exp $
#
# Xlib.display -- high level display object
#
# Copyright (C) 2000 Peter Liljenberg <petli@ctrl-c.liu.se>
......
# $Id: error.py,v 1.6 2007/06/10 14:11:58 mggrant Exp $
#
# Xlib.error -- basic error classes
#
# Copyright (C) 2000 Peter Liljenberg <petli@ctrl-c.liu.se>
......
# $Id: __init__.py,v 1.5 2007/06/10 14:11:58 mggrant Exp $
#
# Xlib.ext.__init__ -- X extension modules
#
# Copyright (C) 2000 Peter Liljenberg <petli@ctrl-c.liu.se>
......@@ -27,6 +25,8 @@ __extensions__ = [
('SHAPE', 'shape'),
('XINERAMA', 'xinerama'),
('RECORD', 'record'),
('Composite', 'composite'),
('RANDR', 'randr'),
]
__all__ = map(lambda x: x[1], __extensions__)
# $Id: xtest.py,v 1.1 2000/08/21 10:03:45 petli Exp $
#
# Xlib.ext.composite -- Composite extension module
#
# Copyright (C) 2007 Peter Liljenberg <peter.liljenberg@gmail.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
"""Composite extension, allowing windows to be rendered to off-screen
storage.
For detailed description, see the protocol specification at
http://freedesktop.org/wiki/Software/CompositeExt
By itself this extension is not very useful, it is intended to be used
together with the DAMAGE and XFIXES extensions. Typically you would
also need RENDER or glX or some similar method of creating fancy
graphics.
"""
from Xlib import X
from Xlib.protocol import rq
from Xlib.xobject import drawable
extname = 'Composite'
RedirectAutomatic = 0
RedirectManual = 1
class QueryVersion(rq.ReplyRequest):
_request = rq.Struct(
rq.Card8('opcode'),
rq.Opcode(0),
rq.RequestLength(),
rq.Card32('major_version'),
rq.Card32('minor_version')
)
_reply = rq.Struct(
rq.ReplyCode(),
rq.Pad(1),
rq.Card16('sequence_number'),
rq.ReplyLength(),
rq.Card32('major_version'),
rq.Card32('minor_version'),
rq.Pad(16),
)
def query_version(self):
return QueryVersion(
display = self.display,
opcode = self.display.get_extension_major(extname),
)
class RedirectWindow(rq.Request):
_request = rq.Struct(
rq.Card8('opcode'),
rq.Opcode(1),
rq.RequestLength(),
rq.Window('window'),
rq.Set('update', 1, (RedirectAutomatic, RedirectManual)),
rq.Pad(3),
)
def redirect_window(self, update):
"""Redirect the hierarchy starting at this window to off-screen
storage.
"""
RedirectWindow(display = self.display,
opcode = self.display.get_extension_major(extname),
window = self,
update = update,
)
class RedirectSubwindows(rq.Request):
_request = rq.Struct(
rq.Card8('opcode'),
rq.Opcode(2),
rq.RequestLength(),
rq.Window('window'),
rq.Set('update', 1, (RedirectAutomatic, RedirectManual)),
rq.Pad(3),
)
def redirect_subwindows(self, update):
"""Redirect the hierarchies starting at all current and future
children to this window to off-screen storage.
"""
RedirectSubwindows(display = self.display,
opcode = self.display.get_extension_major(extname),
window = self,
update = update,
)
class UnredirectWindow(rq.Request):
_request = rq.Struct(
rq.Card8('opcode'),
rq.Opcode(3),
rq.RequestLength(),
rq.Window('window'),
rq.Set('update', 1, (RedirectAutomatic, RedirectManual)),
rq.Pad(3),
)
def unredirect_window(self, update):
"""Stop redirecting this window hierarchy.
"""
UnredirectWindow(display = self.display,
opcode = self.display.get_extension_major(extname),
window = self,
update = update,
)
class UnredirectSubindows(rq.Request):
_request = rq.Struct(
rq.Card8('opcode'),
rq.Opcode(4),
rq.RequestLength(),
rq.Window('window'),
rq.Set('update', 1, (RedirectAutomatic, RedirectManual)),
rq.Pad(3),
)
def unredirect_subwindows(self, update):
"""Stop redirecting the hierarchies of children to this window.
"""
RedirectWindow(display = self.display,
opcode = self.display.get_extension_major(extname),
window = self,
update = update,
)
class CreateRegionFromBorderClip(rq.Request):
_request = rq.Struct(
rq.Card8('opcode'),
rq.Opcode(5),
rq.RequestLength(),
rq.Card32('region'), # FIXME: this should be a Region from XFIXES extension
rq.Window('window'),
)
def create_region_from_border_clip(self):
"""Create a region of the border clip of the window, i.e. the area
that is not clipped by the parent and any sibling windows.
"""
rid = self.display.allocate_resource_id()
CreateRegionFromBorderClip(
display = self.display,
opcode = self.display.get_extension_major(extname),
region = rid,
window = self,
)
# FIXME: create Region object and return it
return rid
class NameWindowPixmap(rq.Request):
_request = rq.Struct(
rq.Card8('opcode'),
rq.Opcode(6),
rq.RequestLength(),
rq.Window('window'),
rq.Pixmap('pixmap'),
)
def name_window_pixmap(self):
"""Create a new pixmap that refers to the off-screen storage of
the window, including its border.
This pixmap will remain allocated until freed whatever happens
with the window. However, the window will get a new off-screen
pixmap every time it is mapped or resized, so to keep track of the
contents you must listen for these events and get a new pixmap
after them.
"""
pid = self.display.allocate_resource_id()
NameWindowPixmap(display = self.display,
opcode = self.display.get_extension_major(extname),
window = self,
pixmap = pid,
)
cls = self.display.get_resource_class('pixmap', drawable.Pixmap)
return cls(self.display, pid, owner = 1)
def init(disp, info):
disp.extension_add_method('display',
'composite_query_version',
query_version)
disp.extension_add_method('window',
'composite_redirect_window',
redirect_window)
disp.extension_add_method('window',
'composite_redirect_subwindows',
redirect_subwindows)
disp.extension_add_method('window',
'composite_unredirect_window',
unredirect_window)
disp.extension_add_method('window',
'composite_unredirect_subwindows',
unredirect_subwindows)
disp.extension_add_method('window',
'composite_create_region_from_border_clip',
create_region_from_border_clip)
disp.extension_add_method('window',
'composite_name_window_pixmap',
name_window_pixmap)
This diff is collapsed.
# $Id: record.py,v 1.2 2007/06/10 14:11:58 mggrant Exp $
#
# Xlib.ext.record -- RECORD extension module
#
# Copyright (C) 2006 Alex Badea <vamposdecampos@gmail.com>
......
# $Id: xtest.py,v 1.2 2007/06/10 14:11:58 mggrant Exp $
#
# Xlib.ext.xtest -- XTEST extension module
#
# Copyright (C) 2000 Peter Liljenberg <petli@ctrl-c.liu.se>
......
# $Id: __init__.py,v 1.1 2001/01/19 18:59:37 petli Exp $
#
# Xlib.keysymdef -- X keysym defs
#
# Copyright (C) 2001 Peter Liljenberg <petli@ctrl-c.liu.se>
......@@ -35,6 +33,7 @@ __all__ = [
'special',
'technical',
'thai',
'xf86',
'xk3270',
'xkb',
]
XK_XF86_MonBrightnessUp = 0x1008FF02
XK_XF86_MonBrightnessDown = 0x1008FF03
XK_XF86_KbdLightOnOff = 0x1008FF04
XK_XF86_KbdBrightnessUp = 0x1008FF05
XK_XF86_KbdBrightnessDown = 0x1008FF06
XK_XF86_Standby = 0x1008FF10
XK_XF86_AudioLowerVolume = 0x1008FF11
XK_XF86_AudioMute = 0x1008FF12
XK_XF86_AudioRaiseVolume = 0x1008FF13
XK_XF86_AudioPlay = 0x1008FF14
XK_XF86_AudioStop = 0x1008FF15
XK_XF86_AudioPrev = 0x1008FF16
XK_XF86_AudioNext = 0x1008FF17
XK_XF86_HomePage = 0x1008FF18
XK_XF86_Mail = 0x1008FF19
XK_XF86_Start = 0x1008FF1A
XK_XF86_Search = 0x1008FF1B
XK_XF86_AudioRecord = 0x1008FF1C
XK_XF86_Calculator = 0x1008FF1D
XK_XF86_Memo = 0x1008FF1E
XK_XF86_ToDoList = 0x1008FF1F
XK_XF86_Calendar = 0x1008FF20
XK_XF86_PowerDown = 0x1008FF21
XK_XF86_ContrastAdjust = 0x1008FF22
XK_XF86_RockerUp = 0x1008FF23
XK_XF86_RockerDown = 0x1008FF24
XK_XF86_RockerEnter = 0x1008FF25
XK_XF86_Back = 0x1008FF26
XK_XF86_Forward = 0x1008FF27
XK_XF86_Stop = 0x1008FF28
XK_XF86_Refresh = 0x1008FF29
XK_XF86_PowerOff = 0x1008FF2A
XK_XF86_WakeUp = 0x1008FF2B
XK_XF86_Eject = 0x1008FF2C
XK_XF86_ScreenSaver = 0x1008FF2D
XK_XF86_WWW = 0x1008FF2E
XK_XF86_Sleep = 0x1008FF2F
XK_XF86_Favorites = 0x1008FF30
XK_XF86_AudioPause = 0x1008FF31
XK_XF86_AudioMedia = 0x1008FF32
XK_XF86_MyComputer = 0x1008FF33
XK_XF86_VendorHome = 0x1008FF34
XK_XF86_LightBulb = 0x1008FF35
XK_XF86_Shop = 0x1008FF36
XK_XF86_History = 0x1008FF37
XK_XF86_OpenURL = 0x1008FF38
XK_XF86_AddFavorite = 0x1008FF39
XK_XF86_HotLinks = 0x1008FF3A
XK_XF86_BrightnessAdjust = 0x1008FF3B
XK_XF86_Finance = 0x1008FF3C
XK_XF86_Community = 0x1008FF3D
XK_XF86_AudioRewind = 0x1008FF3E
XK_XF86_XF86BackForward = 0x1008FF3F
XK_XF86_Launch0 = 0x1008FF40
XK_XF86_Launch1 = 0x1008FF41
XK_XF86_Launch2 = 0x1008FF42
XK_XF86_Launch3 = 0x1008FF43
XK_XF86_Launch4 = 0x1008FF44
XK_XF86_Launch5 = 0x1008FF45
XK_XF86_Launch6 = 0x1008FF46
XK_XF86_Launch7 = 0x1008FF47
XK_XF86_Launch8 = 0x1008FF48
XK_XF86_Launch9 = 0x1008FF49
XK_XF86_LaunchA = 0x1008FF4A
XK_XF86_LaunchB = 0x1008FF4B
XK_XF86_LaunchC = 0x1008FF4C
XK_XF86_LaunchD = 0x1008FF4D
XK_XF86_LaunchE = 0x1008FF4E
XK_XF86_LaunchF = 0x1008FF4F
XK_XF86_ApplicationLeft = 0x1008FF50
XK_XF86_ApplicationRight = 0x1008FF51
XK_XF86_Book = 0x1008FF52
XK_XF86_CD = 0x1008FF53
XK_XF86_Calculater = 0x1008FF54
XK_XF86_Clear = 0x1008FF55
XK_XF86_Close = 0x1008FF56
XK_XF86_Copy = 0x1008FF57
XK_XF86_Cut = 0x1008FF58
XK_XF86_Display = 0x1008FF59
XK_XF86_DOS = 0x1008FF5A
XK_XF86_Documents = 0x1008FF5B
XK_XF86_Excel = 0x1008FF5C
XK_XF86_Explorer = 0x1008FF5D
XK_XF86_Game = 0x1008FF5E
XK_XF86_Go = 0x1008FF5F
XK_XF86_iTouch = 0x1008FF60
XK_XF86_LogOff = 0x1008FF61
XK_XF86_Market = 0x1008FF62
XK_XF86_Meeting = 0x1008FF63
XK_XF86_MenuKB = 0x1008FF65
XK_XF86_MenuPB = 0x1008FF66
XK_XF86_MySites = 0x1008FF67
XK_XF86_New = 0x1008FF68
XK_XF86_News = 0x1008FF69
XK_XF86_OfficeHome = 0x1008FF6A
XK_XF86_Open = 0x1008FF6B
XK_XF86_Option = 0x1008FF6C
XK_XF86_Paste = 0x1008FF6D
XK_XF86_Phone = 0x1008FF6E
XK_XF86_Q = 0x1008FF70
XK_XF86_Reply = 0x1008FF72
XK_XF86_Reload = 0x1008FF73
XK_XF86_RotateWindows = 0x1008FF74
XK_XF86_RotationPB = 0x1008FF75
XK_XF86_RotationKB = 0x1008FF76
XK_XF86_Save = 0x1008FF77
XK_XF86_ScrollUp = 0x1008FF78
XK_XF86_ScrollDown = 0x1008FF79
XK_XF86_ScrollClick = 0x1008FF7A
XK_XF86_Send = 0x1008FF7B
XK_XF86_Spell = 0x1008FF7C
XK_XF86_SplitScreen = 0x1008FF7D
XK_XF86_Support = 0x1008FF7E
XK_XF86_TaskPane = 0x1008FF7F
XK_XF86_Terminal = 0x1008FF80
XK_XF86_Tools = 0x1008FF81
XK_XF86_Travel = 0x1008FF82
XK_XF86_UserPB = 0x1008FF84
XK_XF86_User1KB = 0x1008FF85
XK_XF86_User2KB = 0x1008FF86
XK_XF86_Video = 0x1008FF87
XK_XF86_WheelButton = 0x1008FF88
XK_XF86_Word = 0x1008FF89
XK_XF86_Xfer = 0x1008FF8A
XK_XF86_ZoomIn = 0x1008FF8B
XK_XF86_ZoomOut = 0x1008FF8C
XK_XF86_Away = 0x1008FF8D
XK_XF86_Messenger = 0x1008FF8E
XK_XF86_WebCam = 0x1008FF8F
XK_XF86_MailForward = 0x1008FF90
XK_XF86_Pictures = 0x1008FF91
XK_XF86_Music = 0x1008FF92
XK_XF86_Battery = 0x1008FF93
XK_XF86_Bluetooth = 0x1008FF94
XK_XF86_WLAN = 0x1008FF95
XK_XF86_UWB = 0x1008FF96
XK_XF86_AudioForward = 0x1008FF97
XK_XF86_AudioRepeat = 0x1008FF98
XK_XF86_AudioRandomPlay = 0x1008FF99
XK_XF86_Subtitle = 0x1008FF9A
XK_XF86_AudioCycleTrack = 0x1008FF9B
XK_XF86_CycleAngle = 0x1008FF9C
XK_XF86_FrameBack = 0x1008FF9D
XK_XF86_FrameForward = 0x1008FF9E
XK_XF86_Time = 0x1008FF9F
XK_XF86_Select = 0x1008FFA0
XK_XF86_View = 0x1008FFA1
XK_XF86_TopMenu = 0x1008FFA2
XK_XF86_Red = 0x1008FFA3
XK_XF86_Green = 0x1008FFA4
XK_XF86_Yellow = 0x1008FFA5
XK_XF86_Blue = 0x1008FFA6
XK_XF86_Switch_VT_1 = 0x1008FE01
XK_XF86_Switch_VT_2 = 0x1008FE02
XK_XF86_Switch_VT_3 = 0x1008FE03
XK_XF86_Switch_VT_4 = 0x1008FE04
XK_XF86_Switch_VT_5 = 0x1008FE05
XK_XF86_Switch_VT_6 = 0x1008FE06
XK_XF86_Switch_VT_7 = 0x1008FE07
XK_XF86_Switch_VT_8 = 0x1008FE08
XK_XF86_Switch_VT_9 = 0x1008FE09
XK_XF86_Switch_VT_10 = 0x1008FE0A
XK_XF86_Switch_VT_11 = 0x1008FE0B
XK_XF86_Switch_VT_12 = 0x1008FE0C
XK_XF86_Ungrab = 0x1008FE20
XK_XF86_ClearGrab = 0x1008FE21
XK_XF86_Next_VMode = 0x1008FE22
XK_XF86_Prev_VMode = 0x1008FE23
# $Id: __init__.py,v 1.1 2000/07/21 09:54:49 petli Exp $
#
# Xlib.protocol.__init__ -- glue for Xlib.protocol package
#
# Copyright (C) 2000 Peter Liljenberg <petli@ctrl-c.liu.se>
......
# $Id: display.py,v 1.25 2007/06/10 14:11:58 mggrant Exp $
# -*- coding: latin-1 -*-
#
# Xlib.protocol.display -- core display communication
......
# $Id: event.py,v 1.7 2007/06/10 14:11:58 mggrant Exp $
#
# Xlib.protocol.event -- definitions of core events
#
# Copyright (C) 2000-2002 Peter Liljenberg <petli@ctrl-c.liu.se>
......
# $Id: request.py,v 1.13 2007/06/10 14:11:58 mggrant Exp $
#
# Xlib.protocol.request -- definitions of core requests
#
# Copyright (C) 2000-2002 Peter Liljenberg <petli@ctrl-c.liu.se>
......
# $Id: rq.py,v 1.16 2007/06/10 14:11:58 mggrant Exp $
#
# Xlib.protocol.rq -- structure primitives for request, events and errors
#
# Copyright (C) 2000-2002 Peter Liljenberg <petli@ctrl-c.liu.se>
......@@ -631,7 +629,7 @@ class PropertyData(ValueField):
fmt, val = value
if fmt not in (8, 16, 32):
raise BadDataError('Invalid property data format %d' % format)
raise BadDataError('Invalid property data format %d' % fmt)
if type(val) is types.StringType:
size = fmt / 8
......
# $Id: structs.py,v 1.4 2007/06/10 14:11:58 mggrant Exp $
#
# Xlib.protocol.structs -- some common request structures
#
# Copyright (C) 2000 Peter Liljenberg <petli@ctrl-c.liu.se>
......
# $Id: rdb.py,v 1.5 2007/06/10 14:11:58 mggrant Exp $
#
# Xlib.rdb -- X resource database implementation
#
# Copyright (C) 2000 Peter Liljenberg <petli@ctrl-c.liu.se>
......
# $Id: __init__.py,v 1.3 2001/01/12 11:05:03 petli Exp $
#
# Xlib.support.__init__ -- support code package
#
# Copyright (C) 2000 Peter Liljenberg <petli@ctrl-c.liu.se>
......
# $Id: connect.py,v 1.3 2007/06/10 14:11:58 mggrant Exp $
#
# Xlib.support.connect -- OS-independent display connection functions
#
# Copyright (C) 2000 Peter Liljenberg <petli@ctrl-c.liu.se>
......
# $Id: lock.py,v 1.2 2007/06/10 14:11:58 mggrant Exp $
#
# Xlib.support.lock -- allocate a lock
#
# Copyright (C) 2000 Peter Liljenberg <petli@ctrl-c.liu.se>
......
# $Id: unix_connect.py,v 1.5 2007/06/10 14:11:58 mggrant Exp $
#
# Xlib.support.unix_connect -- Unix-type display connection functions
#
# Copyright (C) 2000,2002 Peter Liljenberg <petli@ctrl-c.liu.se>
......@@ -21,6 +19,7 @@
import re
import string
import os
import platform
import socket
# FCNTL is deprecated from Python 2.2, so only import it if we doesn't
......@@ -41,7 +40,14 @@ else:
from Xlib import error, xauth
display_re = re.compile(r'^([-a-zA-Z0-9._]*):([0-9]+)(\.([0-9]+))?$')
uname = platform.uname()
if (uname[0] == 'Darwin') and ([int(x) for x in uname[2].split('.')] >= [9, 0]):
display_re = re.compile(r'^([-a-zA-Z0-9._/]*):([0-9]+)(\.([0-9]+))?$')
else:
display_re = re.compile(r'^([-a-zA-Z0-9._]*):([0-9]+)(\.([0-9]+))?$')
def get_display(display):
# Use $DISPLAY if display isn't provided
......@@ -66,8 +72,13 @@ def get_display(display):
def get_socket(dname, host, dno):
try:
# Darwin funky socket
if (uname[0] == 'Darwin') and host and host.startswith('/tmp/'):
s = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
s.connect(dname)
# If hostname (or IP) is provided, use TCP socket
if host:
elif host:
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((host, 6000 + dno))
......@@ -86,7 +97,11 @@ def get_socket(dname, host, dno):
def new_get_auth(sock, dname, host, dno):
# Translate socket address into the xauth domain
if host:
if (uname[0] == 'Darwin') and host and host.startswith('/tmp/'):
family = xauth.FamilyLocal
addr = socket.gethostname()
elif host:
family = xauth.FamilyInternet
# Convert the prettyprinted IP number into 4-octet string.
......
# $Id: vms_connect.py,v 1.3 2007/06/10 14:11:58 mggrant Exp $
#
# Xlib.support.vms_connect -- VMS-type display connection functions
#
# Copyright (C) 2000 Peter Liljenberg <petli@ctrl-c.liu.se>
......
# $Id: threaded.py,v 1.2 2007/06/10 14:11:58 mggrant Exp $
#
# Xlib.threaded -- Import this module to enable threading
#
# Copyright (C) 2000 Peter Liljenberg <petli@ctrl-c.liu.se>
......
# $Id: xauth.py,v 1.5 2007/06/10 14:11:58 mggrant Exp $
#
# Xlib.xauth -- ~/.Xauthority access
#