Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package python-python-xlib for openSUSE:Factory checked in at 2023-04-25 16:53:45 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-python-xlib (Old) and /work/SRC/openSUSE:Factory/.python-python-xlib.new.1533 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-python-xlib" Tue Apr 25 16:53:45 2023 rev:12 rq:1082449 version:0.33 Changes: -------- --- /work/SRC/openSUSE:Factory/python-python-xlib/python-python-xlib.changes 2022-04-16 00:13:38.965601046 +0200 +++ /work/SRC/openSUSE:Factory/.python-python-xlib.new.1533/python-python-xlib.changes 2023-04-25 16:53:46.198368841 +0200 @@ -1,0 +2,19 @@ +Sun Apr 23 16:27:15 UTC 2023 - Frederic Crozat <[email protected]> + +- update to 0.33: + * Removed unused imports. + * Avoid to use fcntl module on some environments. + * Change a test behavior for unix_connect.get_socket. + * Fix accidental data change. + * Prefer bool over Literal[0, 1, None]. + * Change parentheses to brackets in LICENSE. +- Changes from version 0.32: + * Use archived link for X documentation resource. + * Fix for auth entry having no display number. + * Fix return type inconsistency with the pack_value for class Object. + * Rename add_extension_error method to extension_add_error. + * Extension screensaver: fix screensaver protocol mismatch. + * Extension XRandr: add version 1.5 support for + RRSetMonitor RRGetMonitors and RRDeleteMonitors. + +------------------------------------------------------------------- Old: ---- python-xlib-0.31.tar.gz New: ---- python-xlib-0.33.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-python-xlib.spec ++++++ --- /var/tmp/diff_new_pack.afl6qC/_old 2023-04-25 16:53:46.734374366 +0200 +++ /var/tmp/diff_new_pack.afl6qC/_new 2023-04-25 16:53:46.738374407 +0200 @@ -1,7 +1,7 @@ # # spec file # -# Copyright (c) 2022 SUSE LLC +# Copyright (c) 2023 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -32,7 +32,7 @@ %bcond_with wheel %endif Name: python-python-xlib%{psuffix} -Version: 0.31 +Version: 0.33 Release: 0 Summary: Python X11 interface License: LGPL-2.1-or-later ++++++ python-xlib-0.31.tar.gz -> python-xlib-0.33.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-xlib-0.31/CHANGELOG.md new/python-xlib-0.33/CHANGELOG.md --- old/python-xlib-0.31/CHANGELOG.md 2021-07-02 12:32:04.000000000 +0200 +++ new/python-xlib-0.33/CHANGELOG.md 2022-12-25 19:51:14.000000000 +0100 @@ -1,5 +1,37 @@ NEWS for Python X Library +Version 0.33 +============ + +Bug Fixes +--------- + +- Removed unused imports (thanks @Avasam). +- Avoid to use fcntl module on some environments (thanks @i2y). +- Change a test behavior for `unix_connect.get_socket` (thanks @i2y). +- Fix accidental data change (thanks @Avasam). +- Prefer `bool` over `Literal[0, 1, None]` (thanks @Avasam). +- Change parentheses to brackets in LICENSE (thanks @mtelka). + +--- +Version 0.32 +============ + +Bug Fixes +--------- + +- Use archived link for X documentation resource (thanks @yaxollum). +- Fix for auth entry having no display number (thanks @Majiir). +- Fix return type inconsistency with the `pack_value` for class `Object` (thanks @allfro). +- Rename `add_extension_error` method to `extension_add_error` (thanks @mattalexx). + +Extensions +-------------------- + +- screensaver: fix screensaver protocol mismatch (thanks @yut23). +- XRandr: add version 1.5 support for RRSetMonitor RRGetMonitors and RRDeleteMonitors (thanks @allfro and @jklong). + +--- Version 0.31 ============ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-xlib-0.31/LICENSE new/python-xlib-0.33/LICENSE --- old/python-xlib-0.31/LICENSE 2016-08-13 10:06:13.000000000 +0200 +++ new/python-xlib-0.33/LICENSE 2022-12-25 19:51:14.000000000 +0100 @@ -6,9 +6,9 @@ Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. -(This is the first released version of the Lesser GPL. It also counts +[This is the first released version of the Lesser GPL. It also counts as the successor of the GNU Library Public License, version 2, hence - the version number 2.1.) + the version number 2.1.] Preamble diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-xlib-0.31/PKG-INFO new/python-xlib-0.33/PKG-INFO --- old/python-xlib-0.31/PKG-INFO 2021-07-02 12:32:12.000000000 +0200 +++ new/python-xlib-0.33/PKG-INFO 2022-12-25 19:51:51.000000000 +0100 @@ -1,6 +1,6 @@ Metadata-Version: 1.1 Name: python-xlib -Version: 0.31 +Version: 0.33 Summary: Python X Library Home-page: https://github.com/python-xlib/python-xlib Author: Peter Liljenberg @@ -36,6 +36,9 @@ The Python X Library requires Python 2.7 or newer. It has been tested to various extents with Python 2.7 and 3.3 through 3.6. + The Python X Library will only work on systems that have an X server installed, + such as most Linux distros, but will not work on Windows or MacOS. + Installation ~~~~~~~~~~~~ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-xlib-0.31/README.rst new/python-xlib-0.33/README.rst --- old/python-xlib-0.31/README.rst 2021-05-15 20:11:33.000000000 +0200 +++ new/python-xlib-0.33/README.rst 2022-05-10 12:17:18.000000000 +0200 @@ -27,6 +27,9 @@ The Python X Library requires Python 2.7 or newer. It has been tested to various extents with Python 2.7 and 3.3 through 3.6. +The Python X Library will only work on systems that have an X server installed, +such as most Linux distros, but will not work on Windows or MacOS. + Installation ~~~~~~~~~~~~ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-xlib-0.31/Xlib/X.py new/python-xlib-0.33/Xlib/X.py --- old/python-xlib-0.31/Xlib/X.py 2016-08-13 10:06:09.000000000 +0200 +++ new/python-xlib-0.33/Xlib/X.py 2022-05-10 12:17:18.000000000 +0200 @@ -197,6 +197,8 @@ FamilyInternet = 0 FamilyDECnet = 1 FamilyChaos = 2 +FamilyServerInterpreted = 5 +FamilyInternetV6 = 6 PropertyNewValue = 0 PropertyDelete = 1 ColormapUninstalled = 0 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-xlib-0.31/Xlib/__init__.py new/python-xlib-0.33/Xlib/__init__.py --- old/python-xlib-0.31/Xlib/__init__.py 2021-07-02 12:32:04.000000000 +0200 +++ new/python-xlib-0.33/Xlib/__init__.py 2022-12-25 19:51:14.000000000 +0100 @@ -19,7 +19,7 @@ # Suite 330, # Boston, MA 02111-1307 USA -__version__ = (0, 31) +__version__ = (0, 33) __version_extra__ = '' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-xlib-0.31/Xlib/display.py new/python-xlib-0.33/Xlib/display.py --- old/python-xlib-0.31/Xlib/display.py 2019-02-03 22:05:24.000000000 +0100 +++ new/python-xlib-0.33/Xlib/display.py 2022-12-25 19:51:14.000000000 +0100 @@ -71,7 +71,7 @@ protocol_display.Display.__init__(self, *args, **keys) self._atom_cache = {} - def get_atom(self, atomname, only_if_exists=0): + def get_atom(self, atomname, only_if_exists=False): if atomname in self._atom_cache: return self._atom_cache[atomname] @@ -340,8 +340,8 @@ # extension dict maintained in the display object setattr(self.extension_event, name, (code,subcode)) - def add_extension_error(self, code, err): - """add_extension_error(code, err) + def extension_add_error(self, code, err): + """extension_add_error(code, err) Add an extension error. CODE is the numeric code, and ERR is the error class. @@ -473,7 +473,7 @@ ### X requests ### - def intern_atom(self, name, only_if_exists = 0): + def intern_atom(self, name, only_if_exists = False): """Intern the string name, returning its atom number. If only_if_exists is true and the atom does not already exist, it will not be created and X.NONE is returned.""" @@ -482,7 +482,7 @@ only_if_exists = only_if_exists) return r.atom - def get_atom(self, atom, only_if_exists = 0): + def get_atom(self, atom, only_if_exists = False): """Alias for intern_atom, using internal cache""" return self.display.get_atom(atom, only_if_exists) @@ -501,7 +501,7 @@ selection = selection) return r.owner - def send_event(self, destination, event, event_mask = 0, propagate = 0, + def send_event(self, destination, event, event_mask = 0, propagate = False, onerror = None): """Send a synthetic event to the window destination which can be a window object, or X.PointerWindow or X.InputFocus. event is the @@ -849,7 +849,8 @@ def change_hosts(self, mode, host_family, host, onerror = None): """mode is either X.HostInsert or X.HostDelete. host_family is - one of X.FamilyInternet, X.FamilyDECnet or X.FamilyChaos. + one of X.FamilyInternet, X.FamilyDECnet, X.FamilyChaos, + X.FamilyServerInterpreted or X.FamilyInternetV6. host is a list of bytes. For the Internet family, it should be the four bytes of an IPv4 address.""" @@ -868,7 +869,7 @@ The hosts on the access list. Each entry has the following attributes: family - X.FamilyInternet, X.FamilyDECnet, or X.FamilyChaos. + X.FamilyInternet, X.FamilyDECnet, X.FamilyChaos, X.FamilyServerInterpreted or X.FamilyInternetV6. name A list of byte values, the coding depends on family. For the Internet family, it is the 4 bytes of an IPv4 address. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-xlib-0.31/Xlib/error.py new/python-xlib-0.33/Xlib/error.py --- old/python-xlib-0.31/Xlib/error.py 2016-08-13 10:06:06.000000000 +0200 +++ new/python-xlib-0.33/Xlib/error.py 2022-12-25 19:51:14.000000000 +0100 @@ -70,7 +70,7 @@ ) def __init__(self, display, data): - self._data, data = self._fields.parse_binary(data, display, rawdict = 1) + self._data, _ = self._fields.parse_binary(data, display, rawdict = True) def __str__(self): s = [] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-xlib-0.31/Xlib/ext/__init__.py new/python-xlib-0.33/Xlib/ext/__init__.py --- old/python-xlib-0.31/Xlib/ext/__init__.py 2021-05-15 20:11:33.000000000 +0200 +++ new/python-xlib-0.33/Xlib/ext/__init__.py 2022-05-10 12:17:18.000000000 +0200 @@ -40,6 +40,7 @@ ('DAMAGE', 'damage'), ('DPMS', 'dpms'), ('X-Resource', 'res'), + ('MIT-SCREEN-SAVER', 'screensaver'), ] __all__ = map(lambda x: x[1], __extensions__) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-xlib-0.31/Xlib/ext/composite.py new/python-xlib-0.33/Xlib/ext/composite.py --- old/python-xlib-0.31/Xlib/ext/composite.py 2019-12-08 12:17:04.000000000 +0100 +++ new/python-xlib-0.33/Xlib/ext/composite.py 2022-12-25 19:51:14.000000000 +0100 @@ -33,7 +33,6 @@ graphics. """ -from Xlib import X from Xlib.protocol import rq from Xlib.xobject import drawable diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-xlib-0.31/Xlib/ext/damage.py new/python-xlib-0.33/Xlib/ext/damage.py --- old/python-xlib-0.31/Xlib/ext/damage.py 2019-12-08 12:17:04.000000000 +0100 +++ new/python-xlib-0.33/Xlib/ext/damage.py 2022-12-25 19:51:14.000000000 +0100 @@ -22,7 +22,6 @@ from Xlib import X from Xlib.protocol import rq, structs -from Xlib.xobject import resource from Xlib.error import XError extname = 'DAMAGE' @@ -179,4 +178,4 @@ disp.extension_add_event(info.first_event + DamageNotifyCode, DamageNotify) - disp.add_extension_error(code=BadDamageCode, err=BadDamageError) + disp.extension_add_error(code=BadDamageCode, err=BadDamageError) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-xlib-0.31/Xlib/ext/dpms.py new/python-xlib-0.33/Xlib/ext/dpms.py --- old/python-xlib-0.31/Xlib/ext/dpms.py 2020-09-19 22:29:42.000000000 +0200 +++ new/python-xlib-0.33/Xlib/ext/dpms.py 2022-12-25 19:51:14.000000000 +0100 @@ -27,7 +27,6 @@ Documentation: https://www.x.org/releases/X11R7.7/doc/xextproto/dpms.html ''' -from Xlib import X from Xlib.protocol import rq extname = 'DPMS' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-xlib-0.31/Xlib/ext/randr.py new/python-xlib-0.33/Xlib/ext/randr.py --- old/python-xlib-0.31/Xlib/ext/randr.py 2021-05-15 20:11:33.000000000 +0200 +++ new/python-xlib-0.33/Xlib/ext/randr.py 2022-12-25 19:51:14.000000000 +0100 @@ -22,10 +22,10 @@ """RandR - provide access to the RandR extension information. -This implementation is based off version 1.3 of the XRandR protocol, and may +This implementation is based off version 1.5 of the XRandR protocol, and may not be compatible with other versions. -Version 1.2 of the protocol is documented at: +Version 1.5 of the protocol is documented at: http://cgit.freedesktop.org/xorg/proto/randrproto/tree/randrproto.txt Version 1.3.1 here: @@ -35,7 +35,7 @@ from Xlib import X -from Xlib.protocol import rq, structs +from Xlib.protocol import rq extname = 'RANDR' @@ -122,6 +122,12 @@ BadRRCrtc = 1 BadRRMode = 2 +# Error classes # +class BadRROutputError(Exception): pass + +class BadRRCrtcError(Exception): pass + +class BadRRModeError(Exception): pass # Data Structures # @@ -168,6 +174,19 @@ rq.Card32('matrix33'), ) +MonitorInfo = rq.Struct( + rq.Card32('name'), + rq.Bool('primary'), + rq.Bool('automatic'), + rq.LengthOf('crtcs', 2), + rq.Int16('x'), + rq.Int16('y'), + rq.Card16('width_in_pixels'), + rq.Card16('height_in_pixels'), + rq.Card32('width_in_millimeters'), + rq.Card32('height_in_millimeters'), + rq.List('crtcs', rq.Card32Obj) +) # Requests # @@ -197,7 +216,7 @@ display=self.display, opcode=self.display.get_extension_major(extname), major_version=1, - minor_version=3, + minor_version=5, ) @@ -1078,6 +1097,76 @@ ) +# Version 1.5 methods + +class GetMonitors(rq.ReplyRequest): + _request = rq.Struct( + rq.Card8('opcode'), + rq.Opcode(42), + rq.RequestLength(), + rq.Window('window'), + rq.Bool('is_active'), + rq.Pad(3) + ) + + _reply = rq.Struct( + rq.ReplyCode(), + rq.Pad(1), + rq.Card16('sequence_number'), + rq.ReplyLength(), + rq.Card32('timestamp'), + rq.LengthOf('monitors', 4), + rq.Card32('outputs'), + rq.Pad(12), + rq.List('monitors', MonitorInfo) + ) + + +def get_monitors(self, is_active=True): + return GetMonitors( + display=self.display, + opcode=self.display.get_extension_major(extname), + window=self, + is_active=is_active + ) + +class SetMonitor(rq.Request): + _request = rq.Struct( + rq.Card8('opcode'), + rq.Opcode(43), + rq.RequestLength(), + rq.Window('window'), + rq.Object('monitor_info', MonitorInfo) + ) + + +def set_monitor(self, monitor_info): + return SetMonitor( + display=self.display, + opcode=self.display.get_extension_major(extname), + window=self, + monitor_info=monitor_info + ) + + +class DeleteMonitor(rq.Request): + _request = rq.Struct( + rq.Card8('opcode'), + rq.Opcode(44), + rq.RequestLength(), + rq.Window('window'), + rq.Card32('name') + ) + + +def delete_monitor(self, name): + return DeleteMonitor( + display=self.display, + opcode=self.display.get_extension_major(extname), + window=self, + name=name + ) + # Events # class ScreenChangeNotify(rq.Event): @@ -1149,8 +1238,6 @@ rq.Card8('state'), rq.Pad(11), ) - - # Initialization # def init(disp, info): @@ -1186,12 +1273,20 @@ disp.extension_add_method('display', 'xrandr_get_panning', get_panning) disp.extension_add_method('display', 'xrandr_set_panning', set_panning) - disp.extension_add_event(info.first_event + RRScreenChangeNotify, ScreenChangeNotify) - # add RRNotify events (1 event code with 3 subcodes) - disp.extension_add_subevent(info.first_event + RRNotify, RRNotify_CrtcChange, CrtcChangeNotify) - disp.extension_add_subevent(info.first_event + RRNotify, RRNotify_OutputChange, OutputChangeNotify) - disp.extension_add_subevent(info.first_event + RRNotify, RRNotify_OutputProperty, OutputPropertyNotify) - - #disp.extension_add_error(BadRROutput, BadRROutputError) - #disp.extension_add_error(BadRRCrtc, BadRRCrtcError) - #disp.extension_add_error(BadRRMode, BadRRModeError) + # If the server is running RANDR 1.5+, enable 1.5 compatible methods and events + version = query_version(disp) + if version.major_version == 1 and version.minor_version >= 5: + # version 1.5 compatible + disp.extension_add_method('window', 'xrandr_get_monitors', get_monitors) + disp.extension_add_method('window', 'xrandr_set_monitor', set_monitor) + disp.extension_add_method('window', 'xrandr_delete_monitor', delete_monitor) + + disp.extension_add_event(info.first_event + RRScreenChangeNotify, ScreenChangeNotify) + # add RRNotify events (1 event code with 3 subcodes) + disp.extension_add_subevent(info.first_event + RRNotify, RRNotify_CrtcChange, CrtcChangeNotify) + disp.extension_add_subevent(info.first_event + RRNotify, RRNotify_OutputChange, OutputChangeNotify) + disp.extension_add_subevent(info.first_event + RRNotify, RRNotify_OutputProperty, OutputPropertyNotify) + + disp.extension_add_error(BadRROutput, BadRROutputError) + disp.extension_add_error(BadRRCrtc, BadRRCrtcError) + disp.extension_add_error(BadRRMode, BadRRModeError) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-xlib-0.31/Xlib/ext/record.py new/python-xlib-0.33/Xlib/ext/record.py --- old/python-xlib-0.31/Xlib/ext/record.py 2016-08-13 10:06:08.000000000 +0200 +++ new/python-xlib-0.33/Xlib/ext/record.py 2022-12-25 19:51:14.000000000 +0100 @@ -19,7 +19,6 @@ # Suite 330, # Boston, MA 02111-1307 USA -from Xlib import X from Xlib.protocol import rq extname = 'RECORD' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-xlib-0.31/Xlib/ext/screensaver.py new/python-xlib-0.33/Xlib/ext/screensaver.py --- old/python-xlib-0.31/Xlib/ext/screensaver.py 1970-01-01 01:00:00.000000000 +0100 +++ new/python-xlib-0.33/Xlib/ext/screensaver.py 2022-11-01 10:46:08.000000000 +0100 @@ -0,0 +1,198 @@ +# Xlib.ext.screensaver -- X ScreenSaver extension module +# +# Copyright (C) 2022 Vladimir Panteleev <[email protected]> +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public License +# as published by the Free Software Foundation; either version 2.1 +# of the License, or (at your option) any later version. +# +# This library 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 Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the +# Free Software Foundation, Inc., +# 51 Franklin Street, +# Fifth Floor, +# Boston, MA 02110-1301 USA + +"""This extension allows registering the client as an X screensaver, +or query information about the current screensaver. + +For detailed description see any of the following documents. +Protocol specification: + https://www.x.org/releases/X11R7.7/doc/scrnsaverproto/saver.html +XCB Protocol specification: + https://cgit.freedesktop.org/xcb/proto/tree/src/screensaver.xml + +""" + +from Xlib import X +from Xlib.protocol import rq, structs + +extname = 'MIT-SCREEN-SAVER' + +# Event members +NotifyMask = 1 +CycleMask = 2 + +# Notify state +StateOff = 0 +StateOn = 1 +StateCycle = 2 + +# Notify kind +KindBlanked = 0 +KindInternal = 1 +KindExternal = 2 + +class QueryVersion(rq.ReplyRequest): + _request = rq.Struct( + rq.Card8('opcode'), + rq.Opcode(0), + rq.RequestLength(), + rq.Card8('major_version'), + rq.Card8('minor_version'), + rq.Pad(2), + ) + + _reply = rq.Struct( + rq.ReplyCode(), + rq.Pad(1), + rq.Card16('sequence_number'), + rq.ReplyLength(), + rq.Card16('major_version'), + rq.Card16('minor_version'), + rq.Pad(20), + ) + +def query_version(self): + return QueryVersion(display=self.display, + opcode=self.display.get_extension_major(extname), + major_version=1, + minor_version=0) + + +class QueryInfo(rq.ReplyRequest): + _request = rq.Struct( + rq.Card8('opcode'), + rq.Opcode(1), + rq.RequestLength(), + rq.Drawable('drawable'), + ) + + _reply = rq.Struct( + rq.ReplyCode(), + rq.Card8('state'), + rq.Card16('sequence_number'), + rq.ReplyLength(), + rq.Window('saver_window'), + rq.Card32('til_or_since'), + rq.Card32('idle'), + rq.Card32('event_mask'), # rq.Set('event_mask', 4, (NotifyMask, CycleMask)), + rq.Card8('kind'), + rq.Pad(7), + ) + +def query_info(self): + return QueryInfo(display=self.display, + opcode=self.display.get_extension_major(extname), + drawable=self, + ) + + +class SelectInput(rq.Request): + _request = rq.Struct( + rq.Card8('opcode'), + rq.Opcode(2), + rq.RequestLength(), + rq.Drawable('drawable'), + rq.Card32('event_mask'), # rq.Set('event_mask', 4, (NotifyMask, CycleMask)), + ) + +def select_input(self, mask): + return SelectInput(display=self.display, + opcode=self.display.get_extension_major(extname), + drawable=self, + event_mask=mask, + ) + + +class SetAttributes(rq.Request): + _request = rq.Struct( + rq.Card8('opcode'), + rq.Opcode(3), + rq.RequestLength(), + rq.Drawable('drawable'), + rq.Int16('x'), + rq.Int16('y'), + rq.Card16('width'), + rq.Card16('height'), + rq.Card16('border_width'), + rq.Set('window_class', 1, (X.CopyFromParent, X.InputOutput, X.InputOnly)), + rq.Card8('depth'), + rq.Card32('visual'), + structs.WindowValues('attrs'), + ) + +def set_attributes(self, x, y, width, height, border_width, + window_class = X.CopyFromParent, + depth = X.CopyFromParent, + visual = X.CopyFromParent, + onerror = None, + **keys): + return SetAttributes(display=self.display, + onerror = onerror, + opcode=self.display.get_extension_major(extname), + drawable=self, + x = x, + y = y, + width = width, + height = height, + border_width = border_width, + window_class = window_class, + depth = depth, + visual = visual, + attrs = keys) + + +class UnsetAttributes(rq.Request): + _request = rq.Struct( + rq.Card8('opcode'), + rq.Opcode(4), + rq.RequestLength(), + rq.Drawable('drawable'), + ) + +def unset_attributes(self, onerror = None): + return UnsetAttributes(display=self.display, + onerror = onerror, + opcode=self.display.get_extension_major(extname), + drawable=self) + + +class Notify(rq.Event): + _code = None + _fields = rq.Struct( + rq.Card8('type'), + rq.Set('state', 1, (StateOff, StateOn, StateCycle)), + rq.Card16('sequence_number'), + rq.Card32('timestamp'), + rq.Window('root'), + rq.Window('window'), + rq.Set('kind', 1, (KindBlanked, KindInternal, KindExternal)), + rq.Bool('forced'), + rq.Pad(14), + ) + +def init(disp, info): + disp.extension_add_method('display', 'screensaver_query_version', query_version) + disp.extension_add_method('drawable', 'screensaver_query_info', query_info) + disp.extension_add_method('drawable', 'screensaver_select_input', select_input) + disp.extension_add_method('drawable', 'screensaver_set_attributes', set_attributes) + disp.extension_add_method('drawable', 'screensaver_unset_attributes', unset_attributes) + + disp.extension_add_event(info.first_event + 0, Notify) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-xlib-0.31/Xlib/ext/xfixes.py new/python-xlib-0.33/Xlib/ext/xfixes.py --- old/python-xlib-0.31/Xlib/ext/xfixes.py 2019-12-08 12:17:04.000000000 +0100 +++ new/python-xlib-0.33/Xlib/ext/xfixes.py 2022-12-25 19:51:14.000000000 +0100 @@ -30,14 +30,17 @@ extname = 'XFIXES' XFixesSelectionNotify = 0 +XFixesCursorNotify = 1 XFixesSetSelectionOwnerNotifyMask = (1 << 0) XFixesSelectionWindowDestroyNotifyMask = (1 << 1) XFixesSelectionClientCloseNotifyMask = (1 << 2) +XFixesDisplayCursorNotifyMask = (1 << 0) XFixesSetSelectionOwnerNotify = 0 XFixesSelectionWindowDestroyNotify = 1 XFixesSelectionClientCloseNotify = 2 +XFixesDisplayCursorNotify = 0 class QueryVersion(rq.ReplyRequest): _request = rq.Struct(rq.Card8('opcode'), @@ -131,12 +134,67 @@ pass +class SelectCursorInput(rq.Request): + _request = rq.Struct(rq.Card8('opcode'), + rq.Opcode(3), + rq.RequestLength(), + rq.Window('window'), + rq.Card32('mask') + ) + +def select_cursor_input(self, window, mask): + return SelectCursorInput(opcode=self.display.get_extension_major(extname), + display=self.display, + window=window, + cursor_serial=0, + mask=mask) + + +class GetCursorImage(rq.ReplyRequest): + _request = rq.Struct(rq.Card8('opcode'), + rq.Opcode(4), + rq.RequestLength() + ) + _reply = rq.Struct(rq.ReplyCode(), + rq.Pad(1), + rq.Card16('sequence_number'), + rq.ReplyLength(), + rq.Int16('x'), + rq.Int16('y'), + rq.Card16('width'), + rq.Card16('height'), + rq.Card16('xhot'), + rq.Card16('yhot'), + rq.Card32('cursor_serial'), + rq.Pad(8), + rq.List('cursor_image', rq.Card32) + ) + +def get_cursor_image(self, window): + return GetCursorImage(opcode=self.display.get_extension_major(extname), + display=self.display, + ) + + +class DisplayCursorNotify(rq.Event): + _code = None + _fields = rq.Struct(rq.Card8('type'), + rq.Card8('sub_code'), + rq.Card16('sequence_number'), + rq.Window('window'), + rq.Card32('cursor_serial'), + rq.Card32('timestamp')) + + def init(disp, info): disp.extension_add_method('display', 'xfixes_select_selection_input', select_selection_input) disp.extension_add_method('display', 'xfixes_query_version', query_version) disp.extension_add_method('window', 'xfixes_hide_cursor', hide_cursor) disp.extension_add_method('window', 'xfixes_show_cursor', show_cursor) + disp.extension_add_method('display', 'xfixes_select_cursor_input', select_cursor_input) + disp.extension_add_method('display', 'xfixes_get_cursor_image', get_cursor_image) disp.extension_add_subevent(info.first_event + XFixesSelectionNotify, XFixesSetSelectionOwnerNotify, SetSelectionOwnerNotify) disp.extension_add_subevent(info.first_event + XFixesSelectionNotify, XFixesSelectionWindowDestroyNotify, SelectionWindowDestroyNotify) disp.extension_add_subevent(info.first_event + XFixesSelectionNotify, XFixesSelectionClientCloseNotify, SelectionClientCloseNotify) + disp.extension_add_subevent(info.first_event + XFixesCursorNotify, XFixesDisplayCursorNotify, DisplayCursorNotify) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-xlib-0.31/Xlib/ext/xinerama.py new/python-xlib-0.33/Xlib/ext/xinerama.py --- old/python-xlib-0.31/Xlib/ext/xinerama.py 2019-02-03 22:05:24.000000000 +0100 +++ new/python-xlib-0.33/Xlib/ext/xinerama.py 2022-12-25 19:51:14.000000000 +0100 @@ -35,7 +35,6 @@ returns the state information - because that's what libXinerama does.""" -from Xlib import X from Xlib.protocol import rq, structs extname = 'XINERAMA' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-xlib-0.31/Xlib/keysymdef/xf86.py new/python-xlib-0.33/Xlib/keysymdef/xf86.py --- old/python-xlib-0.31/Xlib/keysymdef/xf86.py 2016-08-13 10:06:07.000000000 +0200 +++ new/python-xlib-0.33/Xlib/keysymdef/xf86.py 2022-05-10 12:17:18.000000000 +0200 @@ -1,8 +1,11 @@ -XK_XF86_MonBrightnessUp = 0x1008FF02 -XK_XF86_MonBrightnessDown = 0x1008FF03 -XK_XF86_KbdLightOnOff = 0x1008FF04 -XK_XF86_KbdBrightnessUp = 0x1008FF05 -XK_XF86_KbdBrightnessDown = 0x1008FF06 +XK_XF86_ModeLock = 0x1008FF01 + +XK_XF86_MonBrightnessUp = 0x1008FF02 +XK_XF86_MonBrightnessDown = 0x1008FF03 +XK_XF86_KbdLightOnOff = 0x1008FF04 +XK_XF86_KbdBrightnessUp = 0x1008FF05 +XK_XF86_KbdBrightnessDown = 0x1008FF06 +XK_XF86_MonBrightnessCycle = 0x1008FF07 XK_XF86_Standby = 0x1008FF10 XK_XF86_AudioLowerVolume = 0x1008FF11 @@ -159,6 +162,25 @@ XK_XF86_Yellow = 0x1008FFA5 XK_XF86_Blue = 0x1008FFA6 +XK_XF86_Suspend = 0x1008FFA7 +XK_XF86_Hibernate = 0x1008FFA8 +XK_XF86_TouchpadToggle = 0x1008FFA9 +XK_XF86_TouchpadOn = 0x1008FFB0 +XK_XF86_TouchpadOff = 0x1008FFB1 + +XK_XF86_AudioMicMute = 0x1008FFB2 + +XK_XF86_Keyboard = 0x1008FFB3 + +XK_XF86_WWAN = 0x1008FFB4 +XK_XF86_RFKill = 0x1008FFB5 + +XK_XF86_AudioPreset = 0x1008FFB6 + +XK_XF86_RotationLockToggle = 0x1008FFB7 + +XK_XF86_FullScreen = 0x1008FFB8 + XK_XF86_Switch_VT_1 = 0x1008FE01 XK_XF86_Switch_VT_2 = 0x1008FE02 XK_XF86_Switch_VT_3 = 0x1008FE03 @@ -176,3 +198,5 @@ XK_XF86_ClearGrab = 0x1008FE21 XK_XF86_Next_VMode = 0x1008FE22 XK_XF86_Prev_VMode = 0x1008FE23 +XK_XF86_LogWindowTree = 0x1008FE24 +XK_XF86_LogGrabInfo = 0x1008FE25 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-xlib-0.31/Xlib/protocol/display.py new/python-xlib-0.33/Xlib/protocol/display.py --- old/python-xlib-0.31/Xlib/protocol/display.py 2020-04-07 17:03:59.000000000 +0200 +++ new/python-xlib-0.33/Xlib/protocol/display.py 2022-12-25 19:51:14.000000000 +0100 @@ -214,7 +214,7 @@ # Call send_and_recv, which will return when # something has occured - self.send_and_recv(event = 1) + self.send_and_recv(event = True) # Before looping around, lock the event queue against # modifications. @@ -240,7 +240,7 @@ # Make a send_and_recv pass, receiving any events self.send_recv_lock.acquire() - self.send_and_recv(recv = 1) + self.send_and_recv(recv = True) # Lock the queue, get the event count, and unlock again. self.event_queue_write_lock.acquire() @@ -252,7 +252,7 @@ def flush(self): self.check_for_error() self.send_recv_lock.acquire() - self.send_and_recv(flush = 1) + self.send_and_recv(flush = True) def close(self): self.flush() @@ -384,7 +384,7 @@ self.socket_error_lock.release() - def send_and_recv(self, flush = None, event = None, request = None, recv = None): + def send_and_recv(self, flush = False, event = False, request = None, recv = False): """send_and_recv(flush = None, event = None, request = None, recv = None) Perform I/O, or wait for some other thread to do it for us. @@ -402,7 +402,7 @@ To wait for an event to be received, event should be true. To wait for a response to a certain request (either an error - or a response), request should be set the that request's + or a response), request should be set to that request's serial number. To just read any pending data from the server, recv should be true. @@ -689,8 +689,8 @@ return self.parse_connection_setup() # Parse ordinary server response - gotreq = 0 - while 1: + gotreq = False + while True: if self.data_recv: # Check the first byte to find out what kind of response it is rtype = byte2int(self.data_recv) @@ -772,7 +772,7 @@ else: self.default_error_handler(e) - return 0 + return False def default_error_handler(self, err): @@ -937,7 +937,7 @@ # Only the ConnectionSetupRequest has been sent so far r = self.sent_requests[0] - while 1: + while True: # print 'data_send:', repr(self.data_send) # print 'data_recv:', repr(self.data_recv) @@ -946,7 +946,7 @@ # The full response haven't arrived yet if len(self.data_recv) < alen: - return 0 + return False # Connection failed or further authentication is needed. # Set reason to the reason string @@ -956,22 +956,22 @@ # Else connection succeeded, parse the reply else: x, d = r._success_reply.parse_binary(self.data_recv[:alen], - self, rawdict = 1) + self, rawdict = True) r._data.update(x) del self.sent_requests[0] self.data_recv = self.data_recv[alen:] - return 1 + return True else: # The base reply is 8 bytes long if len(self.data_recv) < 8: - return 0 + return False r._data, d = r._reply.parse_binary(self.data_recv[:8], - self, rawdict = 1) + self, rawdict = True) self.data_recv = self.data_recv[8:] # Loop around to see if we have got the additional data @@ -1066,7 +1066,7 @@ # Don't bother about locking, since no other threads have # access to the display yet - display.request_queue.append((self, 1)) + display.request_queue.append((self, True)) # However, we must lock send_and_recv, but we don't have # to loop. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-xlib-0.31/Xlib/protocol/request.py new/python-xlib-0.33/Xlib/protocol/request.py --- old/python-xlib-0.31/Xlib/protocol/request.py 2019-02-03 22:05:24.000000000 +0100 +++ new/python-xlib-0.33/Xlib/protocol/request.py 2022-05-10 12:17:18.000000000 +0200 @@ -1640,7 +1640,8 @@ rq.Opcode(109), rq.Set('mode', 1, (X.HostInsert, X.HostDelete)), rq.RequestLength(), - rq.Set('host_family', 1, (X.FamilyInternet, X.FamilyDECnet, X.FamilyChaos)), + rq.Set('host_family', 1, (X.FamilyInternet, X.FamilyDECnet, X.FamilyChaos, + X.FamilyServerInterpreted, X.FamilyInternetV6)), rq.Pad(1), rq.LengthOf('host', 2), rq.List('host', rq.Card8Obj) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-xlib-0.31/Xlib/protocol/rq.py new/python-xlib-0.33/Xlib/protocol/rq.py --- old/python-xlib-0.31/Xlib/protocol/rq.py 2020-11-22 12:58:26.000000000 +0100 +++ new/python-xlib-0.33/Xlib/protocol/rq.py 2022-12-25 19:51:14.000000000 +0100 @@ -24,7 +24,6 @@ import traceback import struct from array import array -import types # Python 2/3 compatibility. from six import PY3, binary_type, byte2int, indexbytes, iterbytes @@ -119,7 +118,7 @@ check_value = None parse_value = None - keyword_args = 0 + keyword_args = False def __init__(self): pass @@ -724,7 +723,7 @@ class ValueList(Field): structcode = None - keyword_args = 1 + keyword_args = True default = 'usekeywords' def __init__(self, name, mask, pad, *fields): @@ -1089,7 +1088,7 @@ raise BadDataError('%s is not a tuple or a list' % (value)) - def parse_value(self, val, display, rawdict = 0): + def parse_value(self, val, display, rawdict = False): """This function is used by List and Object fields to convert Struct objects with no var_fields into Python values. @@ -1132,9 +1131,9 @@ return DictWrapper(ret) return ret - def parse_binary(self, data, display, rawdict = 0): + def parse_binary(self, data, display, rawdict = False): - """values, remdata = s.parse_binary(data, display, rawdict = 0) + """values, remdata = s.parse_binary(data, display, rawdict = False) Convert a binary representation of the structure into Python values. @@ -1355,7 +1354,7 @@ return 0 class ReplyRequest(GetAttrData): - def __init__(self, display, defer = 0, *args, **keys): + def __init__(self, display, defer = False, *args, **keys): self._display = display self._binary = self._request.to_binary(*args, **keys) self._serial = None @@ -1364,7 +1363,7 @@ self._response_lock = lock.allocate_lock() - self._display.send_request(self, 1) + self._display.send_request(self, True) if not defer: self.reply() @@ -1390,7 +1389,7 @@ def _parse_response(self, data): self._response_lock.acquire() - self._data, d = self._reply.parse_binary(data, self._display, rawdict = 1) + self._data, d = self._reply.parse_binary(data, self._display, rawdict = True) self._response_lock.release() def _set_error(self, error): @@ -1409,7 +1408,7 @@ if binarydata: self._binary = binarydata self._data, data = self._fields.parse_binary(binarydata, display, - rawdict = 1) + rawdict = True) # split event type into type and send_event bit self._data['send_event'] = not not self._data['type'] & 0x80 self._data['type'] = self._data['type'] & 0x7f diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-xlib-0.31/Xlib/support/unix_connect.py new/python-xlib-0.33/Xlib/support/unix_connect.py --- old/python-xlib-0.31/Xlib/support/unix_connect.py 2019-02-03 22:05:24.000000000 +0100 +++ new/python-xlib-0.33/Xlib/support/unix_connect.py 2022-12-25 19:51:14.000000000 +0100 @@ -23,23 +23,6 @@ import os import platform import socket - -# FCNTL is deprecated from Python 2.2, so only import it if we doesn't -# get the names we need. Furthermore, FD_CLOEXEC seems to be missing -# in Python 2.2. - -import fcntl - -if hasattr(fcntl, 'F_SETFD'): - F_SETFD = fcntl.F_SETFD - if hasattr(fcntl, 'FD_CLOEXEC'): - FD_CLOEXEC = fcntl.FD_CLOEXEC - else: - FD_CLOEXEC = 1 -else: - from FCNTL import F_SETFD, FD_CLOEXEC - - from Xlib import error, xauth @@ -93,11 +76,13 @@ s.connect((host, 6000 + dno)) return s + def _get_unix_socket(address): s = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) s.connect(address) return s + def get_socket(dname, protocol, host, dno): assert protocol in SUPPORTED_PROTOCOLS try: @@ -127,11 +112,37 @@ raise error.DisplayConnectionError(dname, str(val)) # Make sure that the connection isn't inherited in child processes. - fcntl.fcntl(s.fileno(), F_SETFD, FD_CLOEXEC) + _ensure_not_inheritable(s) return s +def _ensure_not_inheritable(sock): + # According to PEP446, in Python 3.4 and above, + # it is not inherited in child processes by default. + # However, just in case, we explicitly make it non-inheritable. + # Also, we don't use the code like the following, + # because there would be no possibility of backporting to past versions. + # if sys.version_info.major == 3 and sys.version_info.minor >= 4: + # sock.set_inheritable(False) + # return + # We just check if the socket has `set_inheritable`. + if hasattr(sock, 'set_inheritable'): + sock.set_inheritable(False) + return + + # On Windows, + # Python doesn't support fcntl module because Windows doesn't have fcntl API. + # At least by not importing fcntl, we will be able to import python-xlib on Windows. + if platform.system() == 'Windows': + # so.. unfortunately, for Python 3.3 and below, on Windows, + # we can't make sure that the connection isn't inherited in child processes for now. + return + + import fcntl + fcntl.fcntl(sock.fileno(), fcntl.F_SETFD, fcntl.FD_CLOEXEC) + + def new_get_auth(sock, dname, protocol, host, dno): assert protocol in SUPPORTED_PROTOCOLS # Translate socket address into the xauth domain diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-xlib-0.31/Xlib/xauth.py new/python-xlib-0.33/Xlib/xauth.py --- old/python-xlib-0.31/Xlib/xauth.py 2019-02-03 22:05:24.000000000 +0100 +++ new/python-xlib-0.33/Xlib/xauth.py 2022-11-01 10:46:08.000000000 +0100 @@ -27,6 +27,8 @@ FamilyInternet = X.FamilyInternet FamilyDECnet = X.FamilyDECnet FamilyChaos = X.FamilyChaos +FamilyServerInterpreted = X.FamilyServerInterpreted +FamilyInternetV6 = X.FamilyInternetV6 FamilyLocal = 256 class Xauthority(object): @@ -118,6 +120,8 @@ matches = {} for efam, eaddr, enum, ename, edata in self.entries: + if enum == b'' and ename not in matches: + enum = num if efam == family and eaddr == address and num == enum: matches[ename] = edata diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-xlib-0.31/Xlib/xobject/drawable.py new/python-xlib-0.33/Xlib/xobject/drawable.py --- old/python-xlib-0.31/Xlib/xobject/drawable.py 2020-11-22 12:58:26.000000000 +0100 +++ new/python-xlib-0.33/Xlib/xobject/drawable.py 2022-12-25 19:51:14.000000000 +0100 @@ -19,7 +19,7 @@ # Suite 330, # Boston, MA 02111-1307 USA -from Xlib import X, Xatom, Xutil +from Xlib import X, Xatom from Xlib.protocol import request, rq # Other X resource objects @@ -451,7 +451,7 @@ window = self.id, property = property) - def get_property(self, property, property_type, offset, length, delete = 0): + def get_property(self, property, property_type, offset, length, delete = False): r = request.GetProperty(display = self.display, delete = delete, window = self.id, @@ -516,7 +516,7 @@ property = property, time = time) - def send_event(self, event, event_mask = 0, propagate = 0, onerror = None): + def send_event(self, event, event_mask = 0, propagate = False, onerror = None): request.SendEvent(display = self.display, onerror = onerror, propagate = propagate, @@ -629,7 +629,7 @@ focus = self.id, time = time) - def clear_area(self, x = 0, y = 0, width = 0, height = 0, exposures = 0, onerror = None): + def clear_area(self, x = 0, y = 0, width = 0, height = 0, exposures = False, onerror = None): request.ClearArea(display = self.display, onerror = onerror, exposures = exposures, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-xlib-0.31/doc/src/concepts.texi new/python-xlib-0.33/doc/src/concepts.texi --- old/python-xlib-0.31/doc/src/concepts.texi 2016-08-13 10:05:57.000000000 +0200 +++ new/python-xlib-0.33/doc/src/concepts.texi 2022-11-01 10:46:08.000000000 +0100 @@ -9,4 +9,4 @@ Here you might find an introduction to X concepts sometime in the future. For now, I just refer to the introduction parts of the standard X documentation. A vast collection of X documentation links can be -found at @uref{http://www.rahul.net/kenton/xsites.html}. +found at @uref{https://web.archive.org/web/20201228053920/http://www.rahul.net/kenton/xsites.html}. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-xlib-0.31/doc/src/objects.texi new/python-xlib-0.33/doc/src/objects.texi --- old/python-xlib-0.31/doc/src/objects.texi 2021-05-15 20:11:33.000000000 +0200 +++ new/python-xlib-0.33/doc/src/objects.texi 2022-05-10 12:17:18.000000000 +0200 @@ -678,7 +678,8 @@ @var{mode} is either @code{X.HostInsert} or @code{X.HostDelete}. @var{host_family} is one of @code{X.FamilyInternet}, -@code{X.FamilyDECnet} or @code{X.FamilyChaos}. +@code{X.FamilyDECnet}, @code{X.FamilyChaos}, @code{X.FamilyServerInterpreted} +or @code{X.FamilyInternetV6}. @var{host} is a list of bytes. For the Internet family, it should be the four bytes of an IPv4 address. @@ -699,7 +700,8 @@ @table @code @item family -@code{X.FamilyInternet}, @code{X.FamilyDECnet}, or @code{X.FamilyChaos}. +@code{X.FamilyInternet}, @code{X.FamilyDECnet}, @code{X.FamilyChaos}, +@code{X.FamilyServerInterpreted} or @code{X.FamilyInternetV6}. @item name A list of byte values, the coding depends on @code{family}. For the diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-xlib-0.31/examples/xfixes-cursor-notify.py new/python-xlib-0.33/examples/xfixes-cursor-notify.py --- old/python-xlib-0.31/examples/xfixes-cursor-notify.py 1970-01-01 01:00:00.000000000 +0100 +++ new/python-xlib-0.33/examples/xfixes-cursor-notify.py 2022-11-01 10:46:08.000000000 +0100 @@ -0,0 +1,72 @@ +#!/usr/bin/python3 +# +# examples/xfixes-cursor-notify.py -- demonstrate the XFIXES extension +# CursorNotify event. +# +# Copyright (C) 2022 +# Dan Isla <[email protected]> +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public License +# as published by the Free Software Foundation; either version 2.1 +# of the License, or (at your option) any later version. +# +# This library 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 Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the +# Free Software Foundation, Inc., +# 59 Temple Place, +# Suite 330, +# Boston, MA 02111-1307 USA + +# Python 2/3 compatibility. +from __future__ import print_function + +import sys +from Xlib.display import Display +from Xlib.ext import xfixes + +def main(): + display = Display() + + if not display.has_extension('XFIXES'): + if display.query_extension('XFIXES') is None: + print('XFIXES extension not supported') + return 1 + + xfixes_version = display.xfixes_query_version() + print('Found XFIXES version {}.{}'.format( + xfixes_version.major_version, + xfixes_version.minor_version + )) + + screen = display.screen() + + display.xfixes_select_cursor_input(screen.root, xfixes.XFixesDisplayCursorNotifyMask) + + cursor_cache = {} + + while True: + e = display.next_event() + print(e) + + if (e.type, e.sub_code) == display.extension_event.DisplayCursorNotify: + print("DisplayCursorNotify: cursor_serial={}".format(e.cursor_serial)) + image = display.xfixes_get_cursor_image(screen.root) + cached = False + if cursor_cache.get(image.cursor_serial): + cached = True + else: + cursor_cache[image.cursor_serial] = image.cursor_image + + print("Cursor position={},{}, size={}x{}, xyhot={},{}, cursor_serial={}, cached={}".format( + image.x, image.y, image.width,image.height, image.xhot, image.yhot, image.cursor_serial, cached + )) + + +if __name__ == "__main__": + sys.exit(main()) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-xlib-0.31/python_xlib.egg-info/PKG-INFO new/python-xlib-0.33/python_xlib.egg-info/PKG-INFO --- old/python-xlib-0.31/python_xlib.egg-info/PKG-INFO 2021-07-02 12:32:11.000000000 +0200 +++ new/python-xlib-0.33/python_xlib.egg-info/PKG-INFO 2022-12-25 19:51:44.000000000 +0100 @@ -1,6 +1,6 @@ Metadata-Version: 1.1 Name: python-xlib -Version: 0.31 +Version: 0.33 Summary: Python X Library Home-page: https://github.com/python-xlib/python-xlib Author: Peter Liljenberg @@ -36,6 +36,9 @@ The Python X Library requires Python 2.7 or newer. It has been tested to various extents with Python 2.7 and 3.3 through 3.6. + The Python X Library will only work on systems that have an X server installed, + such as most Linux distros, but will not work on Windows or MacOS. + Installation ~~~~~~~~~~~~ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-xlib-0.31/python_xlib.egg-info/SOURCES.txt new/python-xlib-0.33/python_xlib.egg-info/SOURCES.txt --- old/python-xlib-0.31/python_xlib.egg-info/SOURCES.txt 2021-07-02 12:32:11.000000000 +0200 +++ new/python-xlib-0.33/python_xlib.egg-info/SOURCES.txt 2022-12-25 19:51:45.000000000 +0100 @@ -34,6 +34,7 @@ Xlib/ext/randr.py Xlib/ext/record.py Xlib/ext/res.py +Xlib/ext/screensaver.py Xlib/ext/security.py Xlib/ext/shape.py Xlib/ext/xfixes.py @@ -114,6 +115,7 @@ examples/shapewin.py examples/threadtest.py examples/xdamage.py +examples/xfixes-cursor-notify.py examples/xfixes-selection-notify.py examples/xfixes.py examples/xinerama.py diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-xlib-0.31/test/test_unix_connect.py new/python-xlib-0.33/test/test_unix_connect.py --- old/python-xlib-0.31/test/test_unix_connect.py 2019-02-03 22:05:24.000000000 +0100 +++ new/python-xlib-0.33/test/test_unix_connect.py 2022-12-25 19:51:14.000000000 +0100 @@ -72,8 +72,8 @@ def path_exists(returns, path): calls.append(('os.path.exists', path)) return returns - def fcntl(*args): - calls.append(('fcntl',) + args) + def ensure_not_inheritable(*args): + calls.append(('ensure_not_inheritable',) + args) for params, allow_unix, unix_addr_exists, allow_tcp, expect_connection_error, expected_calls in ( # Successful explicit TCP socket connection. (('tcp/host:6', None, 'host', 6), False, False, True, False, [ @@ -141,7 +141,7 @@ partial(_get_socket, 'tcp', not allow_tcp)), \ patch('os.path.exists', partial(path_exists, unix_addr_exists)), \ - patch('fcntl.fcntl', fcntl): + patch('Xlib.support.unix_connect._ensure_not_inheritable', ensure_not_inheritable): del calls[:] if expect_connection_error: with self.assertRaises(DisplayConnectionError): @@ -149,9 +149,7 @@ else: s = unix_connect.get_socket(*params) self.assertIsInstance(s, FakeSocket) - expected_calls.append(('fcntl', 42, - unix_connect.F_SETFD, - unix_connect.FD_CLOEXEC)) + expected_calls.append(('ensure_not_inheritable', s)) self.assertEqual(calls, expected_calls) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-xlib-0.31/test/test_xlib_display.py new/python-xlib-0.33/test/test_xlib_display.py --- old/python-xlib-0.31/test/test_xlib_display.py 2016-08-13 10:06:07.000000000 +0200 +++ new/python-xlib-0.33/test/test_xlib_display.py 2022-11-01 11:25:16.000000000 +0100 @@ -87,7 +87,7 @@ self.assertRaises(AssertionError, self.display.extension_add_method, "font", "__init__", lambda x: x) def test_can_add_extension_error(self): - self.display.add_extension_error(1, Xlib.error.XError) + self.display.extension_add_error(1, Xlib.error.XError) self.assertEqual(self.display.display.error_classes[1], Xlib.error.XError) def test_keycode_to_keysym_for_invalid_index(self):
